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
Logout user to db
async logout(req, res) { try { // console.log("Hello"); const currentUser = req.user.id; console.log("Current User = ", currentUser); // console.log(req.user); // const user = await userModel.findById(currentUser); const user = await sequelize.query( `SELECT * FROM "user" WHERE Id='${currentUser}'`, ); // console.log(user) if (user.length !== 0) { user.token = null; // await user.save(); await sequelize.query(`UPDATE "user" SET token=${user.token}`); return res.send("Thank you visit again"); } else { throw Error("Please Login first"); } } catch (err) { return res.send({ msg: err.msg }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "logout() {\n _handleUserLogout();\n userDb.logout(this.user);\n this.userId = null;\n }", "function logout() {\n var user = $stamplay.User().Model;\n user.logout();\n }", "logout() { Backend.auth.logout(); }", "doLogout() {\n this.user = null;\n }", "logout() {\n\t\tgetRequest(\"/user/logout\");\n\t\tthis.setState({ user: { loginname: \"\", score: \"\", title: \"\" } });\n\t}", "function logout (){\n collectionOfUser.update(\n {\n id : loginUser.id,\n logIN : false,\n },\n function(){},\n error\n );\n clear();\n }", "logout() {\n\t\tUser.users.splice(User.users.indexOf(this), 1); // Remove user from memory.\n\t\t\n\t\tglobals.onLogout(this);\n\t\t\n\t\tthis.#connection.off(\"data\");\n\t\tthis.#connection.off(\"logout\");\n\t\tthis.#connection.leave(\"users\");\n\t\tthis.#connection.on(\"login\", data => User.tryLogin(this.#connection, data));\n\n\t\tthis.#connection.alert({msg:\"Logged out\", type:\"info\"});\n\t\tprint(`Web-CLI user has (been) logged out.`, `User-ID: ${this.id}`, `(Connection-ID: ${this.#connection.id})`);\n\t}", "function logout() {\n setCurrentUser(null);\n setToken(null);\n }", "handleLogout() {\n UserService.logOut();\n }", "logout() {\n Backend.logout();\n }", "function logout() {\n\n /* Cleanning up user's history */\n PStorage.drop();\n PStorage.init(function () {\n PStorage.set('logout', JSON.stringify({\n lat: userModel.get('latitude'),\n lon: userModel.get('longitude')\n }), function () {\n facebookConnectPlugin.logout(function () {\n location.reload();\n });\n\n });\n });\n}", "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 setToken(null);\n setCurrentUser(null);\n }", "function logoutUser() {\n auth.logout()\n .then(() => {\n sessionStorage.clear();\n showInfo('Logout successful.');\n userLoggedOut();\n }).catch(handleError);\n }", "logout() {\n this.authenticated = false;\n\n localStorage.removeItem('user');\n }", "function _logOutUser () {\n \tserverRequestService.serverRequest(PROJET_HEADER_CTRL_API_OBJECT.logout, 'GET');\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 }", "logout() {\n localStorage.removeItem(\"user\");\n }", "function log_out() {\n if (is_logged_in()) {\n remove_param('last_sync');\n remove_param('last_sync_user');\n set_cookie(\"user\", \"\");\n clean_db(function() { window.location = \"index.html\"; });\n }\n}", "logout() {\n localStorage.removeItem('user');\n }", "logout() {\r\n this.authenticated = false;\r\n localStorage.removeItem(\"islogedin\");\r\n localStorage.removeItem(\"token\");\r\n localStorage.removeItem(\"user\");\r\n }", "onLogoutClicked() {\n AuthActions.logoutUser();\n }", "logOut() {\n authContextApi.logOut();\n }", "function logout() {\n TokenService.removeToken();\n self.all = [];\n self.user = {};\n CurrentUser.clearUser();\n $window.location.reload();\n }", "function logout(){\n\t\t\tParse.User.logOut();\n\t\t}", "function logout() {\n window.Lemonade.Mirror.send('logout', CookieManager.getCookie('loggedIn_user'), CookieManager.getCookie('loggedIn_session'));\n\n Store.AuthStore.dispatch(Auth.LOGOUT_ACTION());\n CookieManager.removeCookie('loggedIn');\n CookieManager.removeCookie('loggedIn_user');\n CookieManager.removeCookie('loggedIn_session');\n}", "function logout()\n {\n setUserData({\n token: undefined,\n user: undefined\n })\n localStorage.setItem(\"auth-token\", \"\")\n }", "function handleLogout() {\n\t\ttry {\n\t\t\t//Resetting the user info\n\t\t\tuserContext.setUserInfo({ username: \"\", id: \"\" });\n\n\t\t\t//Changing authenticated to false\n\t\t\tuserContext.setIsAuthenticated(false);\n\n\t\t\t//Deleting the JWT from local storage;\n\t\t\tlocalStorage.removeItem(\"auth-token\");\n\t\t} catch (error) {\n\t\t\tconsole.log(error.message);\n\t\t}\n\t}", "function logout() {\n localStorage.removeItem('user');\n}", "function logout(req, res){\n const action = \"logout user\"\n const sessionId = req.cookies.sid;\n database.delete(\"sessions\", `id=\"${sessionId}\"`).then(function(){\n log.info(action, \"success\");\n res.clearCookie(\"sid\");\n res.json({status: \"User logged out\"});\n }).catch(function(){\n log.error(action, \"fail\");\n res.sendStatus(500);\n })\n\n}", "function logout() {\n\n }", "function handleLogout(user) {\n setLoginStatus(false)\n ls.removeItem('token')\n ls.removeItem('user_id')\n }", "function userLogout(req,cb){\n log.info(\"user logout: \" + req.user.email);\n users.destroyToken(req.body['token'], cb);\n}", "function logout(context) {\n userModel.logout()\n .then(function () {\n sessionStorage.clear();\n handler.showInfo(`Logout successful.`);\n context.redirect('#/home');\n })\n }", "function logOut(){\n clearCurrentUser();\n showLoggedOutView();\n}", "function handleLogout(){\n /**\n * Send request to backend\n */\n request.user.logout(function(result) {\n console.log(result);\n if (result === constants.RESPONSE_CODES.SUCCESS) {\n /**\n * Reset on success\n */\n request.user.dataSources = [\n {\n id: 9999,\n email: '[email protected]',\n sourceurl: 'https://services.odata.org/V2/Northwind/Northwind.svc',\n sourcetype: 0,\n sourcename: 'Northwind',\n islivedata: 'true',\n }\n ];\n props.handlePageType('home');\n props.setDashboardIndex('');\n props.setDashboardStage('dashboardHome');\n props.setIsAddingDashboard(false);\n props.setExploreStage('dataConnection');\n dispatch({ isLoggedIn: false }); \n logoutSuccessNotification('bottomRight');\n }\n });\n }", "function logout() {\n let endpoint = \"/Users/logout?access_token=\" + window.localStorage.getItem(\"access_token\");\n let headers = {};\n let payload = {};\n sendRequest(method, endpoint, headers, payload, logoutCallback); // From CRUD.js\n return true;\n}", "logOutUser() {\n this.__userAdmin__ = null\n this.__userToken__ = null\n this.removeStorage()\n window.location.reload()\n }", "logout(){\n\t\tvar self = this;\n\t\t\n\t\tUserHttpService.logout().then(function () {\n\t\t\tself.setState({\n\t\t\t\tuserSession: null\n\t\t\t}, function (){\n\t\t\t\t//redirect to the home page\n\t\t\t\tthis.props.history.push(\"/\");\n\t\t\t});\n\t\t});\t\n\t}", "function logout() {\r\n return auth().signOut();\r\n }", "Logout({ commit }) {\n commit('LOGOUT_USER'); \n storeWithExpiration.set('user', {});\n }", "function logout() {\n _basicLogin.logout();\n _handleSuccessLogin(null);\n}", "function logout()\n {\n\n }", "function logout() {\n sessionStorage.removeItem('user')\n sessionStorage.removeItem('isLogged')\n}", "logOutCurrentUser() {\n var self = this;\n self.auth.signOut();\n }", "logoutUser() {\n // Only call change user if the elevio library has been loaded.\n this._callIfElevioIsLoaded('logoutUser');\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 }", "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 logout(req, res) {\n const {id} = req.body;\n if(!id) return res.sendStatus(400);\n\n return User.findOne({_id: new ObjectID(id)})\n .then(user => {\n if(!user) return res.sendStatus(404);\n return providerFactory().revoke(id);\n })\n .then(() => res.sendStatus(200));\n\n}", "function logout() {\n userService.logout()\n .then(function() {\n $location.url(\"\");\n });\n }", "function logout() {\n return $http.post('/api/v1/signout')\n .then(response => {\n clearUser();\n clearSession();\n\n $rootScope.$broadcast('user-logout');\n\n $state.go('login');\n })\n .catch(err => {\n return exception.catcher('Failed Login')(err);\n });\n }", "function logout(){\n currentUser = null;\n updateHeader();\n toggleView(\"login\");\n}", "function logout() {\n localStorage.removeItem('user');\n $location.path('/');\n }", "function logout() {\n delete $localStorage.currentUser;\n $window.location.reload();\n }", "logout() {\n $cookies.remove('token');\n currentUser = {};\n }", "function Logout() {\n localStorage.removeItem('user_id')\n}", "logout() {\n this.setAccessToken(null);\n this.user = null;\n }", "function userLogout(){\r\n delCookie();\r\n}", "function logout() {\n\tuserService.logout();\n\treturn { type: userConstants.LOGOUT };\n}", "logout() {\n localStorage.removeItem(\"nguserId\");\n localStorage.removeItem(\"nguserName\");\n this.mem.userExist = false;\n this.router.navigate([\"/login\"]);\n }", "signOut() {\n this.bitski.userManager.removeUser();\n this.contractInstance = null;\n this.showLoginButton();\n }", "function LogOut(e){\n console.log(\"triggered\");\n db.auth().signOut();\n \n}", "function logout() {\n vm.loggedIn = false;\n vm.userData = null;\n vm.role = null;\n var cookies = $cookies.getAll();\n for (var x in cookies) {\n $cookies.remove(x);\n }\n }", "function logout() {\n userService.logout()\n .then(\n $location.url(\"/login\"));\n }", "function logoutUser() {\n\t\tauth.logout()\n\t\t\t.then(() => {\n\t\t\t\tsessionStorage.clear();\n\t\t\t\tshowInfo('Logout successful.');\n\t\t\t\tuserLoggedOut();\n\t\t\t\tshowView('SignIn');\n\t\t\t}).catch(handleError);\n\t}", "logout() {\n this.setMethod('POST');\n this.setAuth();\n return this.getApiResult(Config.LOGOUT_API);\n }", "function signOut() {\n localStorage.removeItem('curUser');\n}", "logout() {\n this._userId = null\n this._userToken = null\n this._userUsername = null\n\n sessionStorage.clear()\n }", "function logout() {\n auth.signOut();\n}", "function logout() {\n userService.logout();\n return { type: userConstants.LOGOUT };\n}", "function logout() {\n sessionStorage.removeItem('id');\n sessionStorage.removeItem('token');\n sessionStorage.removeItem('registerUser');\n setIsLoggedIn(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 }", "function logout(req, res) {\n // remove the session user id\n req.session.userId = null;\n res.status(200).send('logout successful');\n}", "function logout() {\n client.logout();\n window.location = \"#page-login\";\n }", "static logout() {\n document.deleteCookie('userId');\n document.deleteCookie('userFirstName');\n }", "function logoutUser() {\n sessionStorage.clear();\n showHideMenuLinks();\n showHomeView();\n}", "logout(request,response){\n request.session.destroy();\n response.clearCookie('userID');\n response.clearCookie('userName');\n response.clearCookie('expiration');\n response.json(true);\n }", "function logout(e){\r\n e.preventDefault()\r\n axios.post(\"http://localhost:5000/logout\", {logout: true}, {withCredentials: true}).then(response=> {\r\n console.log(response.data)\r\n if (response.data.msg === \"success\"){\r\n props.updateUser({loggedIn: false, username:null, _id:null, data:null})\r\n }\r\n })\r\n }", "logOut() {\n localStorage.removeItem('user');\n this.router.navigateByUrl('');\n }", "function logout(user){\n $scope.loggedin = false;\n $window.localStorage.removeItem('com.tp');\n $window.localStorage.removeItem('com.tp.userId');\n $window.localStorage.removeItem('com.tp.username');\n $window.location.href = '/#/';\n }", "logout() {\n // remove authentication credentials\n this.credentials = null;\n }", "function handleLogout() {\n window.localStorage.clear();\n setToken(\"\");\n setCurrentUser({});\n history.push('/');\n }", "function logout() {\n svc.token = null;\n svc.identity = null;\n delete $window.localStorage['authToken']; \n }", "function logout() {\n UserService\n .logout()\n .then(\n function (response) {\n $location.url(\"/login\");\n },\n function () {\n $location.url(\"/login\");\n }\n );\n }", "function logout() {\n userService\n .logout()\n .then(function () {\n $location.url('/');\n });\n }", "function logOut() {\n http.deleteAuthorization($stateParams.basic, $stateParams.id)\n .then(function (res) {\n console.log(res);\n $state.go('login');\n })\n }", "function logOut(){\n localStorage.removeItem(\"user\");\n localStorage.removeItem(\"token\");\n templateController();\n}", "function logout() {\n $auth.logout();\n localStorageService.remove(\"currentUser\");\n $state.go('home', {}, {reload: true});\n }", "function logoutUser(){\n updateViewToLoggedOut();\n}", "function logoutAppUser() {\n this.setLoggedInUser(null);\n this.setToken(null);\n }", "logout (request, response) {\n // Confirm the user was logged in.\n if (request.session) {\n // Destoy the session where the users data was temporairaly stored.\n request.session.destroy();\n // Then send response.\n response.writeHead(200, {\"Content-Type\": \"application/json\"}); // Status 200: All OK.\n response.end(JSON.stringify({status: true, message: 'You have been logged out.'}));\n } else {\n // If the user was not logged in send bad request response.\n response.writeHead(200, {\"Content-Type\": \"application/json\"}); // Status 400: Bad request.\n response.end(JSON.stringify({status: false, message: this.notLoggedIn}));\n }\n }", "function logout() {\n\tcurrent_user_profile_picture_path = \"\";\n\tregisterUserRole(\"anonymous\");\n\tdxRequestInternal(getServerRootPath()+\"api/global_functions/logoutCurrentAccount\",\n\t\t{AuthenticationToken:getAuthenticationToken()},\n\t\tfunction(data_obj) {\n\t\t\tif (data_obj.LogoutResult === true) {\n\t\t\t\tif (!isNative()) {\n\t\t\t\t\tloadUserRoleLandingPage(\"anonymous\");\n\t\t\t\t} else {\n\t\t\t\t\tloadUserRoleLandingPage(\"native_landing\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new Error(\"Could not logout user: \"+JSON.stringify(data_obj));\n\t\t\t}\n\t\t},\n\t\tfunction(data_obj) {\n\t\t\tthrow new Error(\"Could not logout user: \"+JSON.stringify(data_obj));\n\t\t})\n}", "function authLogout() {\n\t\tif (getAuthCookie() !== null)\n\t\t\trequest('GET', tools.urlLogout, authLogoutSuccess, authLogoutError);\n\t}", "logoutUser() {\n // Attempts to logout of the current account\n firebase.auth().signOut().then(function() {\n // Removes the users information from the session storage\n sessionStorage.setItem('userName', null);\n sessionStorage.setItem('isAdmin', null); \n sessionStorage.setItem('uid', null);\n sessionStorage.setItem('email', null); \n window.alert(\"You have signed out successfully\");\n }).catch(function(error) {\n // Alerts the user of the error\n window.alert(error.message);\n });\n }", "logout() {\n // destroy the session\n localStorage.removeItem('session');\n }", "logout() {\n this.Storage.unstore('isLoggedIn');\n this.Storage.unstore('token');\n }", "function logoutUser() {\n\n return $http({\n url: 'http://127.0.0.1/personal/dndspells2-api/api.php/api/user/logout',\n method: 'POST',\n data: currUserData,\n withCredentials: true,\n headers: {\n 'Content-Type': 'application/json; charset=utf-8'\n }\n });\n }", "function logout(req, res){\n userID = \"\";\n res.redirect(\"/\");\n}", "signOut() {\n this.loggedInUserId = '';\n sessionStorage.clear();\n this._router.navigate(['/Login']);\n }", "function logOut() {\n localStorage.removeItem('idToken');\n localStorage.removeItem('username');\n localStorage.removeItem('profilePicture');\n localStorage.removeItem('userId');\n window.location.href='http://clrksanford.github.io/date-night/';\n}" ]
[ "0.84915847", "0.83125484", "0.7911084", "0.7909532", "0.7856018", "0.77770144", "0.77166724", "0.7583284", "0.7579947", "0.7565246", "0.7555801", "0.75535446", "0.75429374", "0.75406486", "0.7533462", "0.7525072", "0.7507471", "0.75051874", "0.74745995", "0.74734306", "0.74733084", "0.74671596", "0.7460579", "0.74557835", "0.74528325", "0.7436147", "0.7429974", "0.7421959", "0.7414132", "0.7409965", "0.73867905", "0.7363006", "0.7352688", "0.7348644", "0.7348008", "0.7344997", "0.7342388", "0.7338595", "0.7332704", "0.7311393", "0.7306121", "0.7302742", "0.73006606", "0.7288102", "0.7285988", "0.7279693", "0.7276093", "0.7272433", "0.7271769", "0.72713137", "0.72687566", "0.723853", "0.7232999", "0.7224", "0.72233564", "0.7212541", "0.72067535", "0.7206375", "0.7203595", "0.7202105", "0.71996224", "0.7197138", "0.7196714", "0.71963984", "0.71928823", "0.719154", "0.71835667", "0.71721643", "0.7168283", "0.71656406", "0.7165529", "0.71623564", "0.7150937", "0.7146871", "0.71455127", "0.7138841", "0.71370536", "0.71330094", "0.71208125", "0.71202123", "0.71190274", "0.71157634", "0.7109944", "0.7108396", "0.7106605", "0.7104539", "0.70977145", "0.7097597", "0.7096885", "0.70927846", "0.7090771", "0.7087274", "0.70864445", "0.7083017", "0.70827466", "0.7081428", "0.7081364", "0.7081186", "0.7080884", "0.7078858" ]
0.7167798
69
Return the number of letters of the longest word
function countMaxLetters(arr) { let maxCount = 0 for (word of arr) { if (word.length > maxCount) { maxCount = word.length } } return maxCount }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function longestWord(sen) {}", "function findLongestWordLength(str) {\n let arr = str.split(' ');\n let longestWordCount = 0; \n for (let i = 0; i < arr.length; i++) {\n let letterCount = arr[i].length;\n if (letterCount > longestWordCount) {\n longestWordCount = letterCount;\n }\n }\n\n console.log(longestWordCount)\n return longestWordCount;\n }", "function findLongestWordLength(str) {\n var words = str.split(\" \");\n var longest =\"\";\n\n for(var word of words){\n if(word.length > longest.length) longest = word;\n }\n return longest.length;\n}", "function findLongestWordLength(str) {\n return str.split(' ').sort((a,b)=>b.length-a.length)[0].length;\n}", "function findLongestWordLength(s) {\n return s.split(' ')\n .reduce(function(longest, word) {\n return Math.max(longest, word.length)\n }, 0);\n }", "function findLongestWord(string) {\n return string.length;\n}", "function findLongestWord(str) {\n return str.split(/\\W+/).reduce(function(item1, item2) {\n return item1.length < item2.length ? item2 : item1;\n }, \"\").length;\n}", "function findLongestWordLength(str) {\n let length = 0;\n let arr = str.split(\" \");\n for(let i = 0;i<arr.length;i++)\n length = (length<arr[i].length ? arr[i].length:length)\n return length;\n}", "function findLongestWordLength(str) {\n\tconst wordsArray = str.split(' ');\n\tlet largestWord = wordsArray[0];\n\n\tfor (let word of wordsArray) {\n\t\tword.length > largestWord.length ? (largestWord = word) : '';\n\t}\n\n\treturn largestWord.length;\n}", "function findLongestWordLength(str) {\n var arr = str.split(' ');\n //console.log(arr);\n //console.log(arr[0]);\n //console.log(arr[0].length);\n var j = 0;\n for(let i = 0; i < arr.length; i++)\n {\n if(arr[i].length > j)\n {\n j = arr[i].length;\n }\n }\n return j;\n }", "function findLongestWord(str) {\n return str.split(' ').reduce( (max, item) => max < item.length ? item.length : max, 0);\n}", "function longestWord(str) {\n return str.split(\" \").sort((a, b) => b.length - a.length)[0];\n // return str.split(\" \").sort((a, b) => b.length - a.length)[0].length; //longest word length\n}", "function findLongestWord(word){\n var longestWord=word.split(' ').sort(function (a, b)\n {\n return b.length-a.length; });\n return longestWord[0].length;\n}", "function longestWordLength(str) {\n var strSplit = str.split(' ');\n var longestWord = 0;\n var i;\n for (i = 0; i < strSplit.length; i++) {\n if (strSplit[i].length > longestWord) {\n longestWord = strSplit[i].length;\n }\n }\n return longestWord;\n }", "function longest(words) {\n\n}", "function longestWord(str) {\n const findLongestWord = str.split(' ');\n const inArray = findLongestWord.sort(function (a, b) {\n return b.length - a.length;\n });\n return inArray[0];\n //return inArray[0].length; 11\n}", "function findLongestWordLength(str) {\r\n str = str.split(' ');\r\n return str.sort((a, b) => a.length - b.length)[str.length - 1].length;\r\n}", "function findLongestWord (words) {\n\t//iterate through the array\n\t//iterate through each letter in each word\n\t//record the number of letters in each word\n\t//record which one is the greatest\nvar lgth = 0;\nvar longest;\n\nfor(var i=0; i < words.length; i++){\n if(words[i].length > lgth){\n lgth = words[i].length;\n longest = words[i];\n } \n} \n\nreturn(longest);\n\n \n}", "function findLongestWordLength(str) {\n return Math.max(...str.split(\" \").map(word => word.length));\n }", "function findLongestWordLength(str) {\n return str.split(\" \").reduce((a, b) => Math.max(a, b.length), 0);\n}", "function findLongestWordLength(str) {\n let strArr = str.split(\" \");\n let longestWord = \"\";\n strArr.forEach((e) => {\n if (e.length > longestWord.length) {\n longestWord = e;\n }\n })\n return longestWord.length;\n}", "function findLongestWordLength(str) {\n var longestWord = str.split(' ').sort(function(a, b) { return b.length - a.length; });\n return longestWord[0].length;\n}", "function findLongestWordLength(str) {\n\tlet longestWord = '';\n\tstr\n\t\t.split(' ')\n\t\t.forEach(word => (word.length > longestWord.length ? (longestWord = word) : (longestWord = longestWord)));\n\treturn longestWord.length;\n}", "function find_longest_word(str)\n{\n var array1 = str.match(/\\w[a-z]{0,}/gi);\n var result = array1[0];\n\n for(var x = 1 ; x < array1.length ; x++)\n {\n if(result.length < array1[x].length)\n {\n result = array1[x];\n } \n }\n return result;\n}", "function find_longest_word(str)\n{\n var array1 = str.match(/\\w[a-z]{0,}/gi);\n var result = array1[0];\n\n for(var x = 1 ; x < array1.length ; x++)\n {\n if(result.length < array1[x].length)\n {\n result = array1[x];\n } \n }\n return result;\n}", "function findLongestWord(str) {\n return str.split(\" \").reduce(function(longest, currentWord) {\n return currentWord.length > longest.length ? currentWord : longest;\n }, \"\").length;\n}", "function findLongestWord(str) {\n\t// use .split to split the str into an array\n var myWords = str.split(\" \");\n var word = \"\";\n // use a for loop and if statement to compare myWords[i].length\n for (i = 0; i < myWords.length; i++) {\n if (word.length < myWords[i].length) {\n \tword = myWords[i];\n }\n }\n return word.length;\n}", "function findLongestWord(str) {\n return str.split(\" \").sort(function(a, b) { return a.length > b.length;}).pop().length;\n}", "function findLongestWordLength(str) {\n return Math.max(...str.split(\" \").map(word => word.length))\n \n}", "function findLongestWordLength(str) {\n let num = 0;\n const split = str.split(' ');\n for (let i = 0; i < split.length; i++) {\n if (split[i].length > num) {\n num = split[i].length\n }\n }\n return num;\n}", "function findLongestWordLength(str) {\n const strArray = str.split(\" \");\n let longestWord = \"\";\n\n strArray.forEach( val => {\n \n if (val.length > longestWord.length) {\n longestWord = val\n }\n }\n)\n\n return longestWord.length;\n}", "function findLongestWordLength(str) {\n\tlet String_sp = str.split(\" \");\n\tlet max_count = 0;\n\tfor (var i = 0; i < String_sp.length; i++) {\n\t\tif (String_sp[i].length > max_count) {\n\t\t\tmax_count = String_sp[i].length;\n\t\t}\n\t}\n\treturn max_count;\n}", "function findLongestWord(str) {\r\n var splitWords = str.split(\" \");\r\n var counter = 0;\r\n var longest;\r\n\r\n for (var i = 0; i < splitWords.length; i++) {\r\n if (splitWords[i].length > counter) {\r\n counter = splitWords[i].length;\r\n longest = splitWords[i];\r\n }\r\n }\r\n return capitalize(longest) + \" is the longest word at \"+ counter +\" letters.\";\r\n}", "function longest_word(word) {\n var longest = word[0];\n for (var i = 0; i< word.length; i++) {\n if (word[i].length > longest.length) {\n longest = word[i];\n }\n }\n return longest;\n}", "function findLongestWord(str) {\n str = str.split(' ');\n let res = '';\n for (i = 0; i < str.length; i++) {\n if (res < str[i].length) {\n res = str[i].length;\n }\n }\n return res;\n}", "function longestLength(string){\n return string.split(' ').reduce(function(acc, word){\n return Math.max(acc, word.length)\n }, 0);\n}", "function findLongestWordLength(str) {\n let long=str.split(\" \");\n let palabra=[];\n long.forEach(element =>palabra.push(element.length));\n let max = Math.max(...palabra);\n return max;\n }", "function longestWord(sen) {\n // SOLUTION BY @aweebit\n //\n // let maxLetters = 0;\n // let outputArr = [];\n // sen.toLowerCase()\n // .match(/\\w+/g)\n // .forEach(word => {\n // if (!(word.length < maxLetters)) {\n // if (word.length > maxLetters) {\n // maxLetters = word.length;\n // outputArr = [];\n // }\n // outputArr.push(word);\n // }\n // });\n // return outputArr.length > 1 ? outputArr : outputArr[0];\n}", "function findLongestWord(str) {\n var arrayWords = str.split(\" \");\n var singlewords = \"\";\n for(var i = 0; i < arrayWords.length; i++){ \n if(arrayWords[i].length > singlewords.length){\n singlewords = arrayWords[i];\n }\n }\n return singlewords.length;\n}", "function findLongestWordLength(str) {\n var arr = str.split(\" \");\n var longestWord = arr[0];\n for (var i = 1; i < arr.length; i++) {\n if (arr[i].length > longestWord.length) {\n longestWord = arr[i];\n }\n }\n return longestWord.length;\n}", "function LongestWord(X)\n{var Z = X.split(\" \");\nvar max = 0;\n\nfor(var i=0; i<Z.length; i++){\n if(Z[i].length > max){\n max = Z[i].length;\n }\n}\nreturn max;\n\n}", "function findLongestWordLength(str) {\n const pattern = /(\\w[a-z]*)/g;\n let words = str.match(pattern);\n let lenghts = [];\n words.forEach(element => {\n lenghts.push(element.length);\n });\n return Math.max(...lenghts);\n}", "function findLongestWordLength(str) {\n let split = str.split(' ')\n let result = 0\n for (let i=0; i< split.length; i++) {\n if(split[i].length > result) {\n result = split[i].length\n }\n }\n return result\n}", "function findLongestWord(str) {\n var myArr = str.split(\" \");\n /* 1st variant - loop and array\n var res = myArr[0].length;\n for(var i = 1; i < myArr.length; i++) {\n if(myArr[i].length > res) {\n res = myArr[i].length;\n }\n }\n */\n var res = myArr.reduce(function(max,current) {\n return current.length > max ? current.length : max;\n }, myArr[0].length);\n return res;\n}", "function findLongestWord(str) {\n let arr = str.split(\" \");\n let max = 0;\n for(var i = 0; i < arr.length; i++){\n if(max < arr[i].length){\n max = arr[i].length\n }\n }\n\n return max; \n}", "function findLongestWordLength(str) {\n let words = str.split(\" \");\n let longest = 0;\n\n for (let i = 0; i < words.length; i++) {\n let length = words[i].length;\n if (length > longest) {\n longest = length;\n }\n }\n\n return longest;\n}", "function find_longest_word(str)\n {\n var array1 = str.match(/\\w[a-z]{0,}/gi);\n var result = array1[0];\n\n for(var x = 1 ; x < array1.length ; x++)\n {\n if(result.length < array1[x].length)\n {\n result = array1[x];\n }\n }\n return result;\n }", "function findLongestWord(str) {\n var LongestWordLength = 0;\n\n str = str.split(' ');\n for (var i = 0; i < str.length; i++) {\n if (str[i].length > LongestWordLength) {\n LongestWordLength = str[i].length;\n //console.log(LongestWordLength);\n }\n } \n return LongestWordLength; \n}", "function longestWord (str) {\n\tvar arr = str.split(' ')\n\tvar a = '';\n\tfor (i=0 ; i<arr.length ; i++) {\n\t\tif (arr[i].length > a.length) {\n\t\t\ta = arr[i] ;\n\t\t}\n\t}\n\treturn a ;\n}", "function findLongestWord(str) {\n var strArray = str.split(' ');\n var biggestWord = '';\n for (var i = 0; i < strArray.length; i++) {\n if (strArray[i].length > biggestWord.length) {\n biggestWord = strArray[i];\n }\n }\n return biggestWord.length;\n}", "function findLongestWord(str) {\n var stringToArray = str.split(\" \");\n var theLongest = \"\";\n for(var i = 0; i < stringToArray.length; i++){\n if(stringToArray[i].length > theLongest.length){\n theLongest = stringToArray[i];\n }\n }\n return theLongest.length;\n}", "function longestWord(text) {\n return text.match(/[a-z]+/gi).sort((a, b) => b.length - a.length)[0];\n}", "function findLongestWordLength(str) {\n var splitArr = str.split(\" \");\n var sorted = splitArr.sort(\n function (a,b) {\n return b.length - a.length\n }\n )\n return sorted[0].length\n }", "function longestWord(str)\n{\n var array1 = str.match(/\\w[a-z]{0,}/gi); // this regex is looking for spaces\n var result = array1[0];\n\n for(var i = 1 ; i < array1.length ; i++)\n {\n if(result.length < array1[i].length)\n {\n result = array1[i];\n }\n }\n return result;\n}", "function findLongestWord(str) { \r\n var word = str.split(\" \");\r\n var s = Math.max.apply(null, word.map(function(str){return str.length;}));\r\n return word.filter(function(val){\r\n return val.length == s;\r\n }) \r\n}", "function longestword(str)\r\n{\r\n var arr = str.match(/\\w[a-z]{0,}/gi)\r\n document.write(\"Example String: \"+arr+\"<br>\")\r\n var result = arr[0]\r\n for (var i = 1; i < arr.length; i++)\r\n {\r\n if (result.length < arr[i].length)\r\n {\r\n result = arr[i]\r\n }\r\n } \r\n\r\n return result\r\n\r\n}", "function longestWord(text) {\n let sentence = text.split(' ');\n let maxLength = 0;\n for(let i = 0; i < sentence.length; i++) {\n if(sentence[i].length > maxLength){\n maxLength = sentence[i].length;\n }\n }\n return maxLength;\n}", "function findLongestWordLength(str) {\n return Math.max(...(str.split(\" \").map(word => {\n return word.length;\n })));\n}", "function findLongestWordLength(str) {\n const words = str.split(\" \");\n let lengthOfLongestWord = 0;\n for (let i = 0; i < words.length; i++) {\n const eachWord = words[i];\n if (eachWord.length > lengthOfLongestWord) {\n lengthOfLongestWord = eachWord.length;\n }\n }\n return lengthOfLongestWord;\n}", "function findLongestWordLength(str) {\n let arrOfWords = str.split(\" \");\n let result = \"\";\n let i = 0;\n while(i<arrOfWords.length){\n if(arrOfWords[i].length > result.length) {\n result = arrOfWords[i]\n }\n i++\n }\n console.log(result)\n return result.length;\n}", "function findLongestWord(str) {\n var words = str.split(' ');\n\n var longestWord = words[0].length;\n for (var i = 0; i < words.length; i++) {\n if (longestWord < words[i].length) {\n longestWord = words[i].length;\n }\n }\n return longestWord;\n}", "function findLongestWord(str) {\n var words = str.split(' ');\n var longestLength = 0;\n var longestWord;\n for (var i=0;i<words.length;i++) {\n if (words[i].length > longestLength) {\n longestLength = words[i].length;\n longestWord = words[i];\n }\n }\n return longestWord;\n}", "function longestWord(sentence){\n let words = sentence.split(\" \");\n let longest = 0;\n for (let i = 0; i < words.length; i++) {\n if(longest < words[i].length){\n longest = words[i].length;\n } \n }\n return longest;\n}", "function findLongestWord(str) {\n var myArray = [];\n // split string into array of strings, sort from longest to shortest\n myArray = str.split(\" \").sort(function(a, b){\n // ASC -> a.length - b.length DESC -> b.length - a.length\n return b.length - a.length;\n }); \n return myArray[0].length;\n}", "function findLongestWordLength(str) {\n // First convert the string to array\n let words = str.split(' ');\n // Initialize a variable to store the longest word\n let longestWord = '';\n // loop through the array\n for (let i = 0; i < words.length; i++) {\n // Check if the length of the current iteration is greater than last longest word\n if (words[i].length > longestWord.length) {\n // Set the longest word variable to the current iteration if longer\n longestWord = words[i];\n }\n }\n return longestWord.length;\n}", "function findLongestWord(str) {\r\n var s = Math.max.apply(null, str.split(\" \").map(function(str){return str.length;}).sort());\r\n return str.split(\" \").filter(function(word){\r\n return word.length == s;\r\n }) \r\n}", "function findLongestWord(str) {\n\tvar words = str.split(' ');\n\tvar words_length = [];\n\tfor(var i = 0; i < words.length; i++){\n\t\twords_length[i] = words[i].length;\n\t}\n\treturn Math.max(...words_length);\n}", "function longestWord(text) {\n let arr = text.match(/[a-z]+/gi);\n console.log('arr', arr);\n let longest = '';\n for (let i = 0; i < arr.length; i++) {\n if (arr[i].length > longest.length) {\n longest = arr[i];\n }\n }\n console.log('longest', longest);\n return longest;\n}", "function findLongest(str) {\n const arrOfWords = str.split(\" \")\n let longest = 0\n for (let i = 0; i < arrOfWords.length; i++) {\n if (arrOfWords[i].length > longest) {\n longest = arrOfWords[i].length\n }\n }\n return longest\n}", "function longestWord(words) {\n\tvar word = ''\n\tfor(var i = 0; i < words.length; i++) {\n\t\tif (words[i].length > word.length) {\n\t\t\tword = words[i]\n\t\t}\n\t}\n\treturn word\n}", "function findLongestWord(str) {\n return str.split(' ').reduce((accumulator, currentValue) => {\n return Math.max(accumulator, currentValue.length);\n }, 0); // Initialize accumulator to 0\n}", "function findLongestWord(string){\n return string.reduce((longStr, string)=> {\n return longStr > string.length ? longStr :string.length\n });\n}", "function strLongest(str) {\n var str = str.split(' ')\n var longestWord = 0\n for(var i =0; i < str.length; i++) {\n if(str[i].length > longestWord) {\n longestWord = str[i].length\n }\n }\n return longestWord \n}", "function findLongestWord(str) {\n var arrayStr = str.split(' ');\n //The sort() method sorts the elements of an array and returns the array\n var longWrd = arrayStr.sort(function(a, b){\n return b.length - a.length;\n });\n return longWrd[0].length;\n}", "function findLongestWordLength2(s) {\n return s.split(' ')\n .reduce(function(longest, currentWord) {\n //returns the length of the longest word\n return Math.max(longest, currentWord.length)\n }, 0); //gives the initial value of x to 0 so that Math.max knows where to start\n}", "function findLongestWord (str) {\n let arr = str.split(' ')\n let longest = 0\n\n for (let i = 0; i < arr.length; i++) {\n let count = 0\n for (let j = 0; j < arr[i].length; j++) {\n count += 1\n }\n if (count > longest) {\n longest = count\n }\n }\n return longest\n}", "function findLongestWordLength(str) {\n var arr = str.split(' ');\n\n function getLongest(longest, current) {\n if (current.length > longest){\n return current.length;\n }\n return longest;\n }\n var word = arr.reduce(getLongest, 0);\n return word;\n}", "function findLongestWordLength(str) {\n let resAux = 0;\n let regEx = /.*?\\S*/g; //expresion regular que busca cualquier caracter(.), que se repita cero o mas veces(*), lo anterior busca cero o 1 vez(?), todo menos los espacios (\\S), que se repita cero o mas veces\n let palabras = [];\n palabras = str.match(regEx);\n\n for (let i = 0; i < palabras.length; i++) {\n if (i % 2 === 0) {\n let palInf = palabras[i].length;\n if (resAux < palInf) {\n resAux = palInf;\n }\n }\n }\n return resAux\n}", "function findLongestWordLength(str) {\n\n //Convert str into array\n let newStr = str.split(\" \");\n\n //Set longest word count to 0\n let count = 0;\n \n //for loop to loop through the array of words\n for(var i=0; i<newStr.length; i++){\n\n //if each word length is bigger than the longest word count\n if(newStr[i].length > count){\n\n //word count becomes the length of the word. E.g. count = 0, array \"The\" = length of 3. count = 3... and so on until end of the array\n count = newStr[i].length;\n }\n }\n //return count\n return count;\n }", "function getlength(word) {return word.length }", "function longestWord(sen) {\n\n //breaking words apart\n let words = sen.split(' ');\n\n //replacing non-alphabetic chars\n for(let i = 0; i< words.length; i++) {\n words[i] = words[i].replace(/[^a-zA-Zsd]/g, '');\n }\n\n let result = words[0];\n\n //finding longest word\n for (let i = 1; i < words.length; i++) {\n if (words[i].length > result.length) {\n result = words[i];\n }\n }\n return result;\n\n}", "function findLongestWord2(str) {\n var longestWord = str.split(' ').reduce(function(longest, currentWord) {\n return currentWord.length > longest.length ? currentWord : longest;\n }, \"\");\n return longestWord.length;\n}", "function find_longest_word(str){\r\n var array1 = str.match(/\\w[a-z]{0,}/gi);\r\n var result = array1[0];\r\n for(var x = 1 ; x < array1.length ; x++){\r\n if(result.length < array1[x].length){\r\n result = array1[x];\r\n } \r\n }\r\n document.write(result);\r\n}", "function findLongestWordLength(str) {\n // convert string to array of words\n let arrWords = str.split(' ');\n \n // console.log(arrWords);\n // console.log(arrWords.length);\n\n // initialize max length variable\n let max_length = 0;\n\n // check all words in array\n for (let i = 0; i<arrWords.length; i++) {\n let word_length = arrWords[i].length;\n \n // if longer, then replace the max_length value\n if (word_length > max_length) {\n max_length = word_length;\n }\n }\n return max_length;\n}", "function longestWord(word) {\n var words = \"\";\n for (var i=0; i < word.length; i++){\n if (word[i].length > words.length){\n words = word[i]\n }\n }\n return words;\n}", "function findLongestWord(str) {\r\n var arrofthewholestring = str.split(' ');\r\n var longest = arrofthewholestring[0].length;\r\n for(var i=1; i<arrofthewholestring.length; i++) {\r\n if(arrofthewholestring[i].length > longest) {\r\n longest = arrofthewholestring[i].length;\r\n }\r\n }\r\n return longest;\r\n}", "function longest(word ){\n\n var longest = word[0];\n\n for (var i = 0; i < word.length; i++){\n\n\tif (word[i].length > longest.length){ \n \n longest = word[i];\n } \n \n\n } \n\n return longest;\n}", "function longestWord(string){\n\tvar word_arr = string.split(\" \")\n\tvar longest = 0\n\tword = ''\n\tfor (var i=0; i<word_arr.length; i++){\n\t\tif(longest <word_arr[i].length){\n\t\t\tlongest = word_arr[i].length\n\t\t\tword = word_arr[i]\n\t\t}\n\t}\n\treturn word\n}", "function longestString(longStr){\n var mostAmntOfCharacters = longStr.reduce((x,y) => x.length >= y.length ? x : y);\n return mostAmntOfCharacters\n}", "function findLongestWord(str){\n \"use strict\";\n var strSplit = str.split(' ');\n var longestWord = 0;\n\n for (var i = 0; i < strSplit.length; i++) {\n // console.log(strSplit[i].length);\n if(strSplit[i].length > longestWord){\n longestWord = strSplit[i].length;\n }\n }\n\n return longestWord;\n}", "function findLongestWord4(str) {\n var longestWord = str.split(' ').sort(function(a, b) { return b.length - a.length; });\n return longestWord[0].length;\n}", "function findLongestWord(words){\n \"use strict\";\n var longestLength = 0;\n\n for(var i=0; i<words.length; i++){\n var word = words[i];\n\n if(word.length > longestLength){\n longestLength = word.length;\n }\n }\n\n return longestLength;\n}", "function longest(words) {\n if(words.length == 0) return 0;\n\n if(words[0].length > longest(words.slice(1))){\n return words[0].length\n } else {\n return longest(words.slice(1))\n }\n}", "function findLongestWord(str) {\n let longestWord = \"\";\n let words = str.split(\" \")\n for( let i = 0; i < words.length; i++){\n let individualWords = words[i]\n //console.log(individualWords)\n if(individualWords.length > longestWord.length){\n longestWord = individualWords;\n //console.log(longestWord)\n }\n }\n return `the longest word in this string is ${longestWord} with ${longestWord.length} letters`;\n }", "function longestWord(sen) {\n\n\tvar longestWord = '',\n\t\tsenArr = sen.split(' ');\n\n\tfor ( var i = 0; i < senArr.length; i++ ) {\n\t\tif (senArr[i].length > longestWord) {\n\t\t\tlongestWord = senArr[i];\n\t\t}\n\t}\n\n\treturn longestWord;\n}", "function findLongestWord(str) {\n var arr = str.split(' ');\n var longestStr = arr[0].length;\n for(var i=1; i<arr.length; i++){\n if (arr[i].length> longestStr){\n longestStr=arr[i].length;\n }\n }\n return longestStr;\n}", "function findLongestWord(str) {\n var splitSentence = str.trim().split(' '), dummyCounter = 0, longest = 0;\n for (dummyCounter; dummyCounter < splitSentence.length; dummyCounter++) {\n if (splitSentence[dummyCounter].length > longest) \n longest = splitSentence[dummyCounter].length;\n }\n return longest;\n}", "function findLongestWordLength3(str) {\n return Math.max(...str.split(\" \").map(word => word.length));\n}", "function findLongestWord(str) {\n var arrayOfStrings = str.split(\" \");\n var longestStr = \"\";\n \n for ( var i = 0; i < arrayOfStrings.length; i++) {\n \n if (longestStr.length < arrayOfStrings[i].length) \n longestStr = arrayOfStrings[i];\n \n }\n return longestStr.length;\n\n}", "function longestWordLength(words) {\n let longest = words[0].length;\n\n for (const word of words) {\n if (longest < word.length) {\n longest = word.length;\n }\n }\n\n return longest;\n}", "function longestWord(string) {\n let array = string.split(\" \")\n let result = array[0];\n for (let i = 0; i < array.length; i++) {\n if (array[i].length > result.length) {\n result = array[i];\n }\n }\n return result;\n}" ]
[ "0.8564614", "0.8308133", "0.81195366", "0.8062265", "0.80450237", "0.8039002", "0.8036529", "0.8020933", "0.80086875", "0.8000622", "0.7999504", "0.7997454", "0.7988468", "0.796877", "0.7968203", "0.7965833", "0.79570377", "0.795621", "0.7953558", "0.79530823", "0.79529667", "0.79516906", "0.7944624", "0.79439455", "0.79439455", "0.79407954", "0.793826", "0.7934511", "0.79328567", "0.7931253", "0.79222465", "0.7918375", "0.7913745", "0.7911043", "0.7910699", "0.79100585", "0.79065233", "0.7903151", "0.7902832", "0.79010046", "0.78952897", "0.7892292", "0.7889665", "0.7883874", "0.78777945", "0.7873611", "0.78690743", "0.78684294", "0.78658724", "0.78620344", "0.7860604", "0.78544885", "0.7851817", "0.78393507", "0.783419", "0.7826682", "0.78230846", "0.78183657", "0.7814678", "0.7814469", "0.7791882", "0.77900195", "0.77897906", "0.77840036", "0.77837795", "0.77786344", "0.7777351", "0.77662367", "0.77590895", "0.77590275", "0.77523166", "0.7751195", "0.7748931", "0.7742734", "0.7739418", "0.77390397", "0.77386355", "0.7725764", "0.77247596", "0.7724104", "0.7721562", "0.77152145", "0.77069145", "0.7694108", "0.7693853", "0.7686628", "0.7683713", "0.76807284", "0.7679563", "0.76786864", "0.767084", "0.7667099", "0.76592976", "0.76470685", "0.7646409", "0.76436526", "0.764259", "0.76413846", "0.76397085", "0.76393104", "0.763577" ]
0.0
-1
Output the frame to the console
function makeFrame(arr) { let borderWidth = countMaxLetters(arr) + 4; // Make top border topBorder = '' for (let i = borderWidth; i > 0; i--) { topBorder += '*' } console.log(topBorder) // Make middle borders for (word of arr) { let middleBorder = '* ' + word // Add spaces if the length of the border is less than the borderWidth for (; middleBorder.length < borderWidth - 2;) { middleBorder += ' ' } middleBorder += ' *' console.log(middleBorder) } // Make bottom border let bottomBorder = '' for (let i = borderWidth; i > 0; i--) { bottomBorder += '*' } console.log(bottomBorder) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function frameConsoleListener (message) {\n console.log('frame:', message.data)\n}", "function consoleLogFrames() {\n console.log(\"consoleLogFrames()\");\n frames.forEach(frame => {\n console.log(\"frame:\", frame);\n });\n }", "drawFrame() {\n const term = this._terminal,\n width = term.getWidth(),\n height = term.getHeight();\n\n let chars = '',\n i;\n\n // generate the top and bottom frames\n for (i = 1; i < width - 1; i++) {\n chars += TerminalFrame.FRAME_SYMBOLS.HORIZONTAL;\n }\n\n term\n // print the top frame\n .move(2, 0)\n .print(chars)\n // print the bottom frame\n .move(2, height)\n .print(chars)\n ;\n\n const sideChar = TerminalFrame.FRAME_SYMBOLS.VERTICAL;\n\n // print the left and right frames\n for (i = 2; i < height; i++) {\n term\n // left frame\n .move(0, i)\n .print(sideChar)\n // right frame\n .move(width - 1, i)\n .print(sideChar)\n ;\n }\n\n // draw corners\n term\n // top left\n .move(0, 0)\n .print(TerminalFrame.FRAME_SYMBOLS.TOP_LEFT_CORNER)\n // top right\n .move(width, 0)\n .print(TerminalFrame.FRAME_SYMBOLS.TOP_RIGHT_CORNER)\n // bottom left\n .move(0, height)\n .print(TerminalFrame.FRAME_SYMBOLS.BOTTOM_LEFT_CORNER)\n // bottom right\n .move(width, height)\n .print(TerminalFrame.FRAME_SYMBOLS.BOTTOM_RIGHT_CORNER)\n ;\n }", "print_frame(frame) {\n // Output reference for nested frames.\n if (this.level > 0 && frame.state != ANONYMOUS) {\n this.print_symbol(frame.id);\n return;\n }\n\n // If frame has already been printed, only print a reference.\n let ref = this.refs && this.refs.get(frame);\n if (ref) {\n if (typeof ref === 'string') {\n // Public reference.\n this.print_symbol(ref);\n } else {\n // Local reference.\n this.write(\"#\");\n this.write(ref.toString());\n }\n return;\n }\n\n // Increase indentation for nested frames.\n this.write(\"{\");\n this.level++;\n\n // Add frame to set of printed references.\n if (this.refs) {\n if (frame.state == ANONYMOUS) {\n // Assign next local id for anonymous frame.\n let id = this.nextidx++;\n this.write(\"=#\");\n this.write(id.toString());\n this.write(\" \");\n this.refs.set(frame, id);\n } else {\n // Update reference table with frame id.\n this.refs.set(frame, frame.id);\n }\n }\n\n // Print slots.\n let slots = frame.slots;\n if (slots) {\n for (let n = 0; n < slots.length; n += 2) {\n // Indent.\n if (this.indent) {\n this.write(\"\\n\");\n for (let l = 0; l < this.level; ++l) this.write(this.indent);\n } else if (n > 0) {\n this.write(\" \");\n }\n\n // Output slot.\n let name = slots[n];\n let value = slots[n + 1];\n if (name == this.store.id) {\n this.write(\"=\");\n this.print_symbol(value);\n if (this.refs) this.refs.set(frame, value);\n } else if (name === this.store.isa) {\n this.write(\":\");\n this.print(value);\n } else if (name === this.store.is) {\n this.write(\"+\");\n this.print(value);\n } else {\n this.print(name);\n this.write(this.indent ? \": \" : \":\");\n this.print(value);\n }\n }\n }\n\n this.level--;\n if (this.indent) {\n // Restore indentation.\n this.write(\"\\n\");\n for (let l = 0; l < this.level; ++l) this.write(this.indent);\n }\n this.write(\"}\");\n }", "function printFrame(frame) {\n const obj = _objectSpread2({}, frame);\n obj.type = getFrameTypeName(frame.type) + ` (${toHex(frame.type)})`;\n const flagNames = [];\n forEachObject_1(FLAGS, (flag, name) => {\n if ((frame.flags & flag) === flag) {\n flagNames.push(name);\n }\n });\n if (!flagNames.length) {\n flagNames.push('NO FLAGS');\n }\n obj.flags = flagNames.join(' | ') + ` (${toHex(frame.flags)})`;\n if (frame.type === FRAME_TYPES.ERROR) {\n obj.code =\n getErrorCodeExplanation(frame.code) + ` (${toHex(frame.code)})`;\n }\n return JSON.stringify(obj, null, 2);\n }", "function printFrame(arr)\n{\n // Code goes here\n console.log(arr);\n}", "frame() {\n this.display();\n this.move();\n this.edgeCheck();\n }", "_dumpFrame()\n {\n const objects = {'@': this._droidPos};\n this._grid.dump(' ', objects);\n console.log(`springdroid position: [${this._droidPos}]`);\n console.log('');\n }", "function drawFrame() {\n // Draw background and a border\n context.fillStyle = \"#d0d0d0\";\n context.fillRect(0, 0, canvas.width, canvas.height);\n context.fillStyle = \"#e8eaec\";\n context.fillRect(1, 1, canvas.width-2, canvas.height-2);\n \n // Draw header\n context.fillStyle = \"#303030\";\n context.fillRect(0, 0, canvas.width, 65);\n \n // Draw title\n context.fillStyle = \"#ffffff\";\n context.font = \"24px Verdana\";\n context.fillText(\"Match3 Example - Rembound.com\", 10, 30);\n \n // Display fps\n context.fillStyle = \"#ffffff\";\n context.font = \"12px Verdana\";\n context.fillText(\"Fps: \" + fps, 13, 50);\n }", "print() {\n console.log.apply(console, this.stack);\n }", "function drawFrame() {\n // Draw background and a border\n context.fillStyle = \"#d0d0d0\";\n context.fillRect(0, 0, canvas.width, canvas.height);\n context.fillStyle = \"#e8eaec\";\n context.fillRect(1, 1, canvas.width-2, canvas.height-2);\n\n // Draw header\n context.fillStyle = \"#303030\";\n context.fillRect(0, 0, canvas.width, 65);\n\n // Draw title\n context.fillStyle = \"#ffffff\";\n context.font = \"24px Verdana\";\n context.fillText(\"Bouncy Square - Physikal\", 10, 30);\n\n // Display fps\n context.fillStyle = \"#ffffff\";\n context.font = \"12px Verdana\";\n context.fillText(\"Fps: \" + fps, 13, 50);\n }", "function showTrace() {\n function format( e, i ) {\n var f = \"<ul><li><em>name</em>: \";\n if( e[\"name\"] === undefined || e[\"name\"] === null ) f += \"anonymous\";\n else f += e[\"name\"];\n f +=\"</li><li><em>execution time</em>: \";\n if( i < Wrapper.log.length - 1 ) f += Wrapper.log[ i + 1 ][\"time\"] - e[\"time\"] + \" ms\";\n else f += \"N/A\";\n f += \"</li><li><em>arguments</em>: \";\n var args = e[\"args\"];\n for( var a = 0; a < args.length; a += 1 ) {\n f += args[ a ];\n if( a !== args.length ) f += \", \";\n }\n f += \"</li><li><em>return</em>: \";\n if( args[\"return\"] === undefined || args[\"return\"] === null ) f += \"void\";\n else f += args[\"return\"];\n f += \"</li></ul>\";\n return f;\n };\n \n var html = \"<html><head></head><body style='font-family:\\\"Courier new\\\"'><ol>\";\n var entries = Wrapper.log;\n for( var e = 0; e < Wrapper.log.length; e += 1 ) {\n html += \"<li>\" + format( entries[ e ], e ) + \"</li>\";\n }\n html += \"</ol></body></html>\";\n var sw = gui.create( \"WebWindow\" );\n if( Loco.wctx.os() !== \"MAC\") {\n sw.setParentWindow( mainWindow );\n sw.setWindowStyle( [\"dialog\"] );\n } else {\n sw.setParentWindow( mainWindow );\n sw.setWindowStyle( [\"drawer\"] );\n } \n sw.setHtml( html );\n sw.show();\n }", "function renderStackFrame() {\n const column = dividerColumn + 1;\n const histEntry = history[currentHistoryIdx];\n const stack = histEntry.stack;\n const lines = [];\n for (let i = stack.length - 1; i >= 0; i--) {\n renderFrame(stack[i], column, lines);\n }\n renderText(column, 1, stackFrameWidth - 1, windowHeight, lines);\n }", "beginFrame() { }", "print(){\n console.log(`boooooooop`);\n for (let i in this._faces){\n console.log(this._faces[i]);\n }\n }", "function frame(string) {\n \n}", "function printn() {\r\n this.print(this.stack.pop().toString());\r\n}", "function renderFrame(evt) {\n wasm.exports.renderFrame(evt);\n}", "function writeConsole(content) \n{\n //open new window\n top.consoleRef=window.open('','myconsole','width=350,height=400,menubar=0,toolbar=1,status=0,scrollbars=1,resizable=1')\n //write page\n top.consoleRef.document.writeln('<html><head><title>Console</title></head><body bgcolor=white onLoad=\"self.focus()\">'+content+'</body></html>')\n top.consoleRef.document.close()\n}", "function drawCapture() {\n\t\tconst cBuffer = cConsole.getCapturedText();\n\t\tif (cBuffer.length === 0) return;\n\t\tfor (var str of cBuffer) {\n\t\t\tif (str === \"\\x1b[0J\") clearLogText();\n\t\t\telse logText(str.replace(ansiRegexp, \"\"));\n\t\t\tdrawStats();\n\t\t}\n\t\tcConsole.clearCaptureText();\n\t}", "function drawFrame() {\n context.fillRect(0, 0, canvas.width, canvas.height);\n context.fillStyle = \"#e8eaec\";\n }", "function print() {\n [].map.call(arguments, function (message) {\n log(message);\n var formatted = newlinesToBreaklines(message);\n output.innerHTML = formatted + '<br />' + output.innerHTML;\n });\n }", "function healConsole() {\r\n //<iframe> element\r\n var iframe = document.createElement(\"iframe\");\r\n //Hide it somewhere\r\n iframe.style.position=\"fixed\";\r\n iframe.style.height = iframe.style.width = \"1px\";\r\n iframe.style.top = iframe.style.left = \"-5px\";\r\n //No src to prevent loading some data\r\n iframe.src = \"about: blank\";\r\n //Needs append to work\r\n document.body.appendChild(iframe);\r\n //Get the inner console\r\n return window.console = iframe.contentWindow.console;\r\n}", "function print(className, args) {\n\t\t\t\tconsole.injectBottom('div', {\n\t\t\t\t\tclassName: className,\n\t\t\t\t\ttext: Base.each(args, function(arg) {\n\t\t\t\t\t\tthis.push(arg + '');\n\t\t\t\t\t}, []).join(' ')\n\t\t\t\t});\n\t\t\t\tconsole.setScrollOffset(0,\n\t\t\t\t\tconsole.getScrollSize().height);\n\t\t\t}", "display() {\n push();\n noStroke();\n fill(80);\n rectMode(CORNER);\n rect(this.x, this.y, this.w, this.h);\n pop();\n }", "printIntoConsole() {\n console.log(this.messageText);\n }", "function logDraw() {\n\t\tterm.terminal.saveCursor();\n\t\tlogTextBuffer.draw();\n\t\tlogScreenBuffer.draw();\n\t\tterm.terminal.restoreCursor();\n\t}", "print() {\r\n console.log(this._playerBoard.map(row => row.join(' | ')).join('\\n'));\r\n }", "function printScreen() {\n var renderer = new THREE.WebGLRenderer({ preserveDrawingBuffer: true });\n\n window.open(renderer.domElement.toDataURL('image/png'), 'screenshot');\n\n}", "print() {\n console.log(this._playerBoard.map(row => row.join(' | ')).join('\\n'));\n }", "print(obj) {\n if (obj == null) {\n this.write(\"nil\");\n } else if (obj instanceof Frame) {\n this.print_frame(obj);\n } else if (typeof obj === 'string') {\n this.write(JSON.stringify(obj));\n } else if (Array.isArray(obj)) {\n this.print_array(obj);\n } else if (obj instanceof QString) {\n this.write(JSON.stringify(obj.text));\n if (obj.qual) {\n this.write(\"@\");\n this.level++;\n this.print(obj.qual);\n this.level--;\n }\n } else {\n // Number expected.\n this.write(obj.toString());\n }\n }", "function Capture(obj)\n{\n\tdocument.write(obj);\t\n}", "function do_frame() {\n\t\t\tupdate_stats();\n\t\t\tif(!call_user_callbacks()) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tupdate();\n\t\t\tdraw();\n\n\t\t\tmedeactx.frame_flags = 0;\n\t\t}", "printDebugLog() {\n this.printMemoryForDebug(this.memory, this.pointer);\n console.debug(`pointer is at ${this.pointer}`);\n console.debug(`relative base is ${this.base}`);\n console.debug(`flags: J:${this.flags.jumped ? 'X' : '-'}`);\n console.debug(`input queue: ${this.input}`);\n console.debug(`output queue: ${this.output}`);\n console.debug('');\n }", "function dumpFrames( path ) {\n console.log( 'Dumping frames for ' + path );\n\n // Get the windows path\n var split = path.split( '/' );\n var winBase = '';\n for( var i = 0; i < split.length - 1; i++ )\n winBase += split[ i ] + '\\\\';\n\n // Fork a child process to rip frames\n var child = spawn( 'ffmpeg/ffmpeg', [ '-i', winBase + 'video.mp4', '-r', '30', winBase + 'frames\\\\frame%04d.png' ] );\n\n // When frames are dumped, signal completion\n child.on( 'exit', function () {\n console.log( 'Frames dumped...' );\n dumpFinished();\n } );\n}", "function displayToScreen() {\n\n\n\t}", "function frame () {\n\tmap.frame();\n}", "function printMousePosition() {\n}", "function draw() {\n background(\"lightblue\");\n /*Put your main animations and code here*/\n\t \n /*ctx.fillStyle = \"blue\";\n\tt.rect(turt.x, turt.y, 200, 200);*/\n\t\n /*log frame*/\n showFrames();\n}", "function StdOut() {\r\n}", "function printc() {\r\n this.print(String.fromCharCode(this.stack.pop()));\r\n}", "postRedisplay(frames=4) {\n\t\t\tthis._redisplayFrames = frames;\n\t\t}", "function renderFrame(context, backgroundImage, filename) {\n\tcontext.drawImage(backgroundImage, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);\n\n\t// Draw circles for each earthquake\n\tquakes.forEach((quake) => {\n\t\tcontext.fillStyle = \"rgba(255, 0, 0, \" + quake.alpha + \")\";\n\n\t\tcontext.beginPath();\n\t\tcontext.arc(quake.x, quake.y, quake.radius, 0, Math.PI * 2);\n\t\tcontext.fill();\n\t});\n\n\t// Add the date of the frame window to the bottom left corner of the image\n\tcontext.font = \"30px Arial\";\n\tcontext.fillStyle = \"rgba(255, 0, 0, 1.0)\";\n\tcontext.fillText(frameWindow.start, 0, SCREEN_HEIGHT - 30);\n\n\t// Write the image out as a PNG\n\tlet stream = context.canvas.pngStream();\n\tlet out = fs.createWriteStream(filename);\n\n\tstream.on('data', (data) => {\n\t\tout.write(data);\n\t});\n\n\tstream.on('end', () => {\n\t\tout.end();\n\t});\n}", "_drawFrame() {\n let rect = this._chartLayout.canvasPlotAreaRect;\n let frameL = rect.left - 1;\n let frameR = rect.right;\n let frameT = rect.top;\n let frameB = rect.bottom - 1;\n\n this._setColor(this.displayOptions.plotArea.backColor);\n this._context.fillRect(rect.left, rect.top, rect.width, rect.height);\n\n this._setColor(this.displayOptions.plotArea.frameColor);\n this._drawLine(frameL, frameT, frameL, frameB);\n this._drawLine(frameR, frameT, frameR, frameB);\n this._drawLine(frameL, frameT, frameR, frameT);\n this._drawLine(frameL, frameB, frameR, frameB);\n }", "display() {\n console.log('head:', this.head)\n console.log('[ ')\n this.displayHelper(this.head)\n console.log(' ]')\n console.log('tail:', this.tail)\n }", "function PrintValueToConsole() {\n\n }", "function info() {\n\tseperator();\n\tOutput('<span>>info:<span><br>');\n\tOutput('<span>Console simulator by Mario Duarte https://codepen.io/MarioDesigns/pen/JbOyqe</span></br>');\n}", "function drawFrame() {\n // Reset background\n gl.clearColor(1, 1, 1, 1);\n gl.enable(gl.DEPTH_TEST);\n gl.clear(gl.COLOR_BUFFER_BIT);\n gl.viewport(0, 0, canvas.width, canvas.height);\n\n // Bind needle speeds\n // Draw Elements!\n // Topmost code is shown at the front! \n drawVertex(canvas, shaderProgram, gl.TRIANGLES, tri, indices, black);\n\n window.requestAnimationFrame(drawFrame);\n }", "function print() {\n var output = \"\";\n for (var y = 0; y < rows; ++y) {\n for (var x = 0; x < cols; ++x) {\n output += getJewel(x, y) + \" \";\n }\n output += \"\\r\\n\";\n }\n console.log(output);\n }", "function drawFrame() {\n // Draw background and a border\n\n mycanvas.drawRect({\n fillStyle: '#d0d0d0',\n x: 0, y: 0,\n fromCenter: false,\n width: $(mycanvas)[0].width,\n height: $(mycanvas)[0].height\n });\n \n mycanvas.drawRect({\n fillStyle: '#e8eaec',\n x: 1, y: 1,\n fromCenter: false,\n width: $(mycanvas)[0].width-2,\n height: $(mycanvas)[0].height-2\n \n \n });\n// Draw header\n// mycanvas.drawRect({\n// fillStyle: '#303030',\n// x: 0, y: 0,\n// fromCenter: false,\n// width: $(mycanvas)[0].width,\n// height: 65,\n// \n// \n// });\n// \n // Draw title\n// mycanvas.drawText({\n// fillStyle: \"#ffffff\",\n// fontFamily: 'Verdana',\n// text: \"Match3 Example - Rembound.com\", \n// fontSize: 24,\n// x:220,y:15, \n// });\n \n \n // Display fps\n \n// mycanvas.drawText({\n// fillStyle: \"#ffffff\",\n// fontFamily: 'Verdana',\n// text: \"Fps \" + fps, \n// fontSize: 18,\n// x:45,y:50, \n// });\n\n \n }", "printBuffers() {\r\n for (var i = 0; i < this.numVertices; i++) {\r\n console.log(\"v \", this.positionData[i*3], \" \",\r\n this.positionData[i*3 + 1], \" \",\r\n this.positionData[i*3 + 2], \" \");\r\n }\r\n for (var i = 0; i < this.numVertices; i++) {\r\n console.log(\"n \", this.normalData[i*3], \" \",\r\n this.normalData[i*3 + 1], \" \",\r\n this.normalData[i*3 + 2], \" \");\r\n }\r\n for (var i = 0; i < this.numFaces; i++) {\r\n console.log(\"f \", this.faceData[i*3], \" \",\r\n this.faceData[i*3 + 1], \" \",\r\n this.faceData[i*3 + 2], \" \");\r\n }\r\n }", "print() {\r\n console.log(\"node \" + this.value + \", x: \" + this.x + \", y: \" + this.y + \", color: \" + this.color + ', dragging: ' + this.dragging + ', selected: ' + this.selected);\r\n }", "function printInfo() {\n let ypos = 20;\n let xpos = 10;\n function nextY(){ ypos+=20; return ypos;}\n viewer.print('Dr.Santi Nuratch', xpos, nextY(), 'rgba(255,255,255,0.5)', 14);\n viewer.print('Machine Learning Algorithm', xpos, nextY(), 'rgba(255,255,10,0.5)', 14);\n viewer.print('Embedded Computing and Control Laboratory', xpos, nextY(), 'rgba(50,255,85,0.5)', 14);\n viewer.print('ECC-Lab | INC-KMUTT', xpos, nextY(), 'rgba(255,150,50,0.5)', 14);\n viewer.print('02 April 2018', xpos, nextY(), 'rgba(155,155,255,0.5)', 14);\n \n\n nextY(); // add empty line\n for(let i=0; i<centroids.length; i++) {\n viewer.print('Class-' + i + ': ' + centroids[i].members.length, xpos, nextY(), centroids[i].color);\n }\n viewer.print('Iteration: ' + (numIterations+1), xpos, nextY(), 'rgba(255,255,255,0.5)'); \n \n let err = (cenDist==0)?TERMINATION_TH/2 + Math.random() : cenDist;\n viewer.print('Error[' + (numIterations+1) +']: ' + err.toFixed(2), xpos, nextY(), 'rgba(255,255,255,0.5)'); \n }", "printBuffers() {\r\n for (var i = 0; i < this.numVertices; i++) {\r\n console.log(\"v \", this.positionData[i*3], \" \", \r\n this.positionData[i*3 + 1], \" \",\r\n this.positionData[i*3 + 2], \" \");\r\n }\r\n for (var i = 0; i < this.numVertices; i++) {\r\n console.log(\"n \", this.normalData[i*3], \" \", \r\n this.normalData[i*3 + 1], \" \",\r\n this.normalData[i*3 + 2], \" \");\r\n }\r\n for (var i = 0; i < this.numFaces; i++) {\r\n console.log(\"f \", this.faceData[i*3], \" \", \r\n this.faceData[i*3 + 1], \" \",\r\n this.faceData[i*3 + 2], \" \");\r\n } \r\n }", "display(){\r\n // assign the mouseX and mouseY to the x and y coordinates of the body\r\n var pos = this.body.position\r\n pos.x = mouseX\r\n pos.y = mouseY\r\n // capture the angle of the body\r\n var angle = this.body.angle\r\n //writ\r\n push()\r\n translate(pos.x,pos.y)\r\n rotate(angle)\r\n fill(\"turquoise\")\r\n rect(0,0,50,50)\r\n pop()\r\n }", "print() {\n console.log(`${this.movieName}, ${this.rating}, ${this.yearRelased}`);\n }", "function drawFrame(perc) {\n background(backColor);\n}", "updateFrame() {\n this._drawFrame();\n }", "displayAll() {\n for (let i=0; i < this.blobs.length; i++) {\n this.displayBlob(this.blobs[i])\n log(\"\\n\")\n }\n }", "_capture() {\n this._pane.capture();\n }", "print() {\n const self = this;\n this.forEveryLine(TOP_TO_DOWN, (line) => {\n let lineStr = '';\n\n self.forEveryColumn(LEFT_TO_RIGHT, (column) => {\n let elm = self.getElement(new Position(line, column));\n lineStr = `${lineStr}\\t${elm.value}`; \n });\n console.log(lineStr + '\\t\\t\\t\\t' + Math.random());\n });\n console.log('-------------------------');\n }", "function drawDebugInfo() {\n\tfill(255);\n\ttext(\"x: \"+ mouseX + \" y: \" + mouseY, 100, height-2);\n}", "function matStdout(mat) { console.log(matStr(mat)); }", "print() {\n // Changed: Typo--missing \".\" in \"this._board\".\n // console.log(this_board.map(row => row.join(' | ')).join('\\n'));\n console.log(this._playerBoard.map(row => row.join(' | ')).join('\\n'));\n }", "function frame(posx, posy, widthSize, heightSize){\n push();\n fill(0);\n noStroke();\n rect(posx,posy,widthSize,heightSize);\n pop();\n}", "function renderFrame() {\n let delta = 0;\n if (last_time !== 0) {\n delta = (new Date().getTime() - last_time);\n }\n last_time = new Date().getTime();\n\n // call the LoopCallback function in the WASM module\n exports.LoopCallback(delta,\n leftKeyPress, rightKeyPress,\n upKeyPress, downKeyPress,\n spaceKeyPress, cloakKeyPress);\n\n // Turn of click-shoot\n\n spaceKeyPress = false\n\n // requestAnimationFrame calls renderFrame the next time a frame is rendered\n requestAnimationFrame(renderFrame);\n}", "function insertFrame(){\n\t\tlet animation_frames = currentFrames.split(\"=====\\n\");\n\t\t$(\"text-area\").value = animation_frames[frameNumber]; \n\t\tframeNumber++;\n\t\tframeNumber = frameNumber % animation_frames.length;\n\t}", "function newFrame() {\n \n\n }", "function print(message) {\n var outputDiv = document.getElementById('quiz-output'); // node\n outputDiv.innerHTML = message; // similar to document.write\n $( '#quiz-output' ).removeClass( 'hidden' );\n // $( '#output' ).toggleClass( \"hidden\", addOrRemove );\n }", "function printConsole () {\n\t// Test victoire\n\tconsole.log(\"Gagné : \"+win);\n\t// Affiche cases du J2\n\tvar str = \"\";\n\tfor(var i=0; i<casesJ2.length ; i++) str+= casesJ2[i]+\",\";\n\tconsole.log(\"Joueur 2 : [\"+str+\"]\");\n\t// Affiche cases du J1\n\tstr = \"\";\n\tfor(var i=0; i<casesJ1.length ; i++) str+= casesJ1[i]+\",\";\n\tconsole.log(\"Joueur 1 : [\"+str+\"]\");\n}", "show() {\n\n for (let i = 0; i < this.frameCount; i++) {\n this[`frame${i}`].style.display = \"\";\n }\n this.isVisible = true;\n\n }", "loop() {\n if (this.state !== 'running') {\n return;\n }\n /**\n * Print the message as it is in testing mode or when the TTY is\n * not interactive\n */\n if (this.testing || !this.logger.options.interactive) {\n this.logger.logUpdate(`${this.messageBuilder.render(this.text)} ${this.frames[2]}`);\n return;\n }\n /**\n * Otherwise log the current frame and re-run the function\n * with some delay\n */\n const frame = this.frames[this.currentIndex];\n this.logger.logUpdate(`${this.messageBuilder.render(this.text)} ${frame}`);\n setTimeout(() => {\n this.incrementIndex();\n this.loop();\n }, this.interval);\n }", "function displayFPS() {\r\n let fps = frameRate();\r\n fill(255);\r\n stroke(0);\r\n text(\"FPS: \" + fps.toFixed(2), 10, height - 10);\r\n}", "function print() {\n process.stdout.write('\\u001B[2J\\u001B[0;0f')\n process.stdout.write(sep + '\\n')\n process.stdout.write('> ' + input)\n process.stdout.write('\\n' + sep + '\\n')\n}", "__showMoveFrame() {\n var location = this.getContentLocation();\n var bounds = this.getBounds();\n var frame = this.__getMoveFrame();\n frame.setUserBounds(\n location.left,\n location.top,\n bounds.width,\n bounds.height\n );\n\n frame.show();\n frame.setZIndex(this.getZIndex() + 1);\n }", "printBuffers()\n {\n \n for(var i=0;i<this.numVertices;i++)\n {\n console.log(\"v \", this.vBuffer[i*3], \" \", \n this.vBuffer[i*3 + 1], \" \",\n this.vBuffer[i*3 + 2], \" \");\n \n }\n \n for(var i=0;i<this.numFaces;i++)\n {\n console.log(\"f \", this.fBuffer[i*3], \" \", \n this.fBuffer[i*3 + 1], \" \",\n this.fBuffer[i*3 + 2], \" \");\n \n }\n \n }", "printBuffers()\n {\n \n for(var i=0;i<this.numVertices;i++)\n {\n console.log(\"v \", this.vBuffer[i*3], \" \", \n this.vBuffer[i*3 + 1], \" \",\n this.vBuffer[i*3 + 2], \" \");\n \n }\n \n for(var i=0;i<this.numFaces;i++)\n {\n console.log(\"f \", this.fBuffer[i*3], \" \", \n this.fBuffer[i*3 + 1], \" \",\n this.fBuffer[i*3 + 2], \" \");\n \n }\n \n }", "function showTestOutput() {\n testOutputChannel.show(true);\n}", "function print(stuff) {\n console.log(\"\\x1b[33m%s\\x1b[0m\", stuff);\n // console.log(stuff);\n}", "print() {\n console.log(this.toString())\n }", "function showPrintingDiagnostics() {\n showPrintingCropMarks();\n showPrintingDescription();\n showPrintingRulers();\n}", "function spook() {\n console.log(\" \\u2588\\u2588\\u2588 \\n \\u2588\",\n \"\\u2588 \\u2588 \\n\\u2588\\u2588\\u2588\",\n \"\\u2588\\u2588\\u2588\\n \\u2588\\u2588\",\n \"\\u2588\\u2588 \\n \\u2588\\u2588\",\n \"\\u2588\\u2588 \\n \\u2588 \\u2588 \\n \\u2588 \\n\")\n}", "function draw() {\n \tconsole.log( grid.print() );\n }", "function draw() {\n\tvar x = width / 2;\n\tvar y = height / 2;\n\tif (mouseX !== 0 && mouseY !== 0) {\n\t\tx = mouseX;\n\t\ty = mouseY;\n\t}\n\n\tbackground(0, 25);\n\tpush();\n\t\ttranslate(x, y);\n\t\trotate(frameCount / 30)\n\t\ttext(\"I'm working\", 0, 0);\n\tpop();\n}", "function printNimBoard() {\n console.log(nimBoard);\n console.log('_________________________________________________________________________________________');\n}", "function renderBox(context, frame, options) {\n const { fill, stroke } = options || {};\n const locs = locsFrameTrans(\n [[-1, -1], [1, -1], [1, 1], [-1, 1]], \n frame,\n identityFrame\n );\n context.beginPath();\n context.moveTo(...locs[0]);\n [1, 2, 3, 0].forEach(i => context.lineTo(...locs[i]));\n if (fill) { context.fill(); }\n if (stroke) { context.stroke(); }\n}", "display() {\n push();\n imageMode(CENTER);\n image(this.image, this.x, this.y, this.size * 2, this.size * 2);\n this.currentFrame = this.image.getCurrentFrame();\n pop();\n }", "printContent() {\n console.log(JSON.stringify(this, null, 4))\n }", "printBuffers()\r\n {\r\n \r\n for(var i=0;i<this.numVertices;i++)\r\n {\r\n console.log(\"v \", this.vBuffer[i*3], \" \", \r\n this.vBuffer[i*3 + 1], \" \",\r\n this.vBuffer[i*3 + 2], \" \");\r\n \r\n }\r\n \r\n for(var i=0;i<this.numFaces;i++)\r\n {\r\n console.log(\"f \", this.fBuffer[i*3], \" \", \r\n this.fBuffer[i*3 + 1], \" \",\r\n this.fBuffer[i*3 + 2], \" \");\r\n \r\n }\r\n \r\n }", "function showInfoConsole(){\n var msg = clc.xterm(221);\n console.clear;\n console.info(\" Transmission Node Rest Made by \"+msg('RaulGF92')+\" \");\n console.info(\" ---------------------------------------------------------\");\n console.info(\" | [Transmission Node Rest] is listenning on PORT \"+clc.red('8888')+\" |\");\n console.info(\" ---------------------------------------------------------\");\n console.info(\" Server transmission Info: (change:\"+change+\") \");\n console.info(\"\");\n console.info(server);\n}", "function log()\n {\n var l = arguments.length;\n var thing;\n var obs_l;\n var ob;\n var output = \"\";\n\n for (var i = 0; i < l; i++)\n {\n obs = [];\n\n thing = arguments[i];\n if (typeof thing == \"string\")\n output += thing + \"\\t\";\n else\n output += stringify(thing) + \" \";\n\n obs_l = obs.length;\n while (obs_l--)\n {\n ob = obs[obs_l];\n delete ob.__CONSOLE_VISITED__;\n }\n }\n\n print(output);\n }", "printCameraPosition() {\n var trackBackControls = this.trackBackControls;\n if (trackBackControls) {\n var target = trackBackControls.target.clone();\n var position = trackBackControls.object.position.clone();\n var record = {\n action: \"moveCamera\",\n params: {\n target: target,\n position: position\n },\n inTime: 1000,\n holdTime: 3000\n };\n var str = prompt(\"name\");\n if (str) {\n record.name = str;\n }\n this.frames.push(record);\n var str = JSON.stringify(this.frames, null, 2);\n console.log(str);\n\n /* var str = JSON.stringify(record, null, 2);\n console.log(str);*/\n }\n }", "displayInConsole() {\n console.log(\"{ name: \" + this.name + \", colors: \" + this.colors + \", manaCost: \" + this.manaCost + \", type: \" + this.modifier + \", TCGPlayer price: \" + this.tcgprice + \", Card Kingdom price: \" + this.ckprice);\n }", "display() {\n super.display();\n //Displays rock\n push();\n noStroke();\n fill(this.baseColor.r, this.baseColor.g, this.baseColor.b);\n ellipse(this.x, this.y, this.width,this.height);\n pop();\n }", "function printThis() {\n if (window.print) {\n window.print();\n } else {\n var WebBrowser = '<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>';\n document.body.insertAdjacentHTML('beforeEnd', WebBrowser);\n WebBrowser1.ExecWB(6, 2);\n WebBrowser1.outerHTML = \"\";\n }\n}", "function printMovieDetail() {\n if (movie.bkgimage != null) {\n bkgImageElt.css('background-image', `url(${movie.bkgimage})`);\n }\n else {\n bkgImageElt.css('background-image', `linear-gradient(rgb(81, 85, 115), rgb(21, 47, 123))`);\n }\n\n titleElt.text(movie.title);\n modalTitle.text(movie.title);\n originaltitleElt.text(movie.originaltitle);\n resumeElt.text(movie.resume);\n dateElt.text(printDateFr(movie.date));\n durationElt.text(printDuration(movie.duration));\n imgElt.attr('src', movie.image);\n iframe.attr('src', movie.traileryt + \"?version=3&enablejsapi=1\");\n // Afficher la liste des acteurs\n var actorsStr = '';\n for (var actor of movie.actors) {\n actorsStr += actor + ' | ';\n }\n actorsElt.text(actorsStr);\n // afficher le réalisteur\n directorElt.text(movie.director);\n}", "async print() {\n\t\tfor (let i = 0; i < 9; i++) {\n\t\t\tfor (let j = 0; j < 9; j++) {\n\t\t\t\tlet index = i * 9 + j\n\t\t\t\tlet value = '*'\n\t\t\t\tif (this.cells[index].possibilities.length === 0) {\n\t\t\t\t\tvalue = '!'\n\t\t\t\t} else if (this.cells[index].possibilities.length === 1) {\n\t\t\t\t\tvalue = `${this.cells[index].possibilities[0]}`\n\t\t\t\t}\n\t\t\t\tif (j % 3 === 2 && j !== 8) {\n\t\t\t\t\tvalue += ' |'\n\t\t\t\t}\n\t\t\t\tawait Deno.writeAll(Deno.stdout, new TextEncoder().encode(`${value} `))\n\t\t\t}\n\t\t\tif (i % 3 == 2 && i !== 8) {\n\t\t\t\tconsole.log('\\n---------------------')\n\t\t\t} else {\n\t\t\t\tconsole.log('')\n\t\t\t}\n\t\t}\n\t}", "function main()\n{\n // do all the initializations\n init();\n \n // create event listeners\n window.document.addEventListener('mouseup', onMouseUpWindow, false)\n document.getElementById(\"renderer\").addEventListener(\"mousedown\", onMouseDown, false);\n document.getElementById(\"renderer\").addEventListener(\"mousemove\", onMouseMove, false);\n document.getElementById(\"renderer\").addEventListener(\"mouseup\", onMouseUp, false);\n \n // render the first frame\n renderFrame();\n}", "showConsole(){\n console.log(this._operation);\n }", "function print(message, context) {\n\tif (!context.linesPrinted) {\n\t\tcontext.linesPrinted = 0;\n\t}\n\n\tif (!context.lines) {\n\t\tcontext.lines = [];\n\t}\n\t//console.log(message);\n\tcontext.linesPrinted++;\n\tcontext.lines.push(message);\n}", "function write() {\n console.log(\"TODO: Implement write\", arguments);\n }" ]
[ "0.736046", "0.7294354", "0.71238273", "0.7092929", "0.6713339", "0.668371", "0.66681486", "0.63698465", "0.62586266", "0.62450475", "0.61698484", "0.6151097", "0.6104736", "0.609078", "0.6030327", "0.59334594", "0.5915864", "0.5904062", "0.58770734", "0.5840642", "0.58146685", "0.5797906", "0.5739867", "0.5733793", "0.57057256", "0.5699718", "0.5693464", "0.5676546", "0.56739545", "0.5634397", "0.5634233", "0.5628518", "0.56243366", "0.56240004", "0.56195706", "0.5609696", "0.55992746", "0.5595292", "0.559528", "0.55728734", "0.55643624", "0.5556167", "0.5555482", "0.55369574", "0.5522875", "0.55222183", "0.55214036", "0.5516638", "0.5515622", "0.55083954", "0.55069196", "0.5501495", "0.5494775", "0.5494605", "0.54899657", "0.54833245", "0.5482477", "0.5481555", "0.5477979", "0.5473117", "0.54626244", "0.5460178", "0.54600674", "0.5458471", "0.54520994", "0.54513526", "0.5438897", "0.54378784", "0.5425012", "0.5419043", "0.54189795", "0.5414841", "0.5411868", "0.5411343", "0.5399941", "0.53859", "0.53859", "0.53821933", "0.5375699", "0.53748876", "0.5373818", "0.53737193", "0.53725344", "0.53706163", "0.5366781", "0.53647083", "0.53616023", "0.53595936", "0.53492016", "0.5348648", "0.5348586", "0.53470767", "0.5344503", "0.53407246", "0.5331729", "0.5326531", "0.5321114", "0.5315711", "0.5312039", "0.5305262", "0.5302788" ]
0.0
-1
This is an async function that will run the task in synchronous succession to ensure all calls are resolved this function will await multiple functions
async function runTask() { while (isRunning) { let result = await getTask(); await submitTask(result); postData(); await new Promise(resolve => setTimeout(resolve, 2000)) .catch(error =>console.log(error.message)); if (!isRunning) { break; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function executeHardAsync() {\n const r1 = await fetchUrlData(apis[0]);\n const r2 = await fetchUrlData(apis[1]);\n}", "async function executeTasks() {\n for (const task of autoTasks) {\n await executeTask(task);\n }\n }", "async function asyncPromiseAll() {\n //PLACE YOUR CODE HERE:\n}", "async function outPutEmployeeQuery() {\n console.log('function called')\n try {\n console.log('function called 1')\n const id = await getIds; // <--- will stop code execution until `resolved` \n console.log('function called 2')\n const name = await getEmployeeName(id);\n console.log('function called 3')\n const final = await finishingTouch(name);\n console.log(final);\n } catch (error) {\n console.log(`exception :: ${error}`);\n }\n}", "async function dowork() {\n try {\n const response = await makeReques('Google');\n console.log('response received');\n const processingResponse = await processRequest(response);\n console.log(processingResponse);\n\n }\n catch (err) {\n console.log(err);\n }\n}", "async function asyncPromAll() {\n const resultArray = await Promise.all([asyncTask1(), asyncTask2(), asyncTask3(), asyncTask4()]);\n for (let i = 0; i<resultArray.length; i++){\n console.log(resultArray[i]); \n }\n }", "async method(){}", "async function fn() {\n let content = await frP;\n console.log(\"content->\" + content);\n console.log(\"F2 read sent\");\n let f2rp = fs.promises.readFile(\"../f2.txt\");\n content = await f2rp\n console.log(\"content->\" + content);\n let f3rp = fs.promises.readFile(\"../f3.txt\");\n content = await f3rp;\n console.log(\"content->\" + content);\n // start next task\n console.log(\"All Task completed\");\n}", "async function asyncCall() {\n result = await resolveAfter2Seconds();\n result.forEach((indItem) =>\n printItem(\n indItem.title,\n indItem.tkt,\n indItem.desc,\n indItem.urg,\n indItem.store,\n indItem.owner,\n indItem.date\n )\n );\n }", "async function doWork() {\n // use try catch to handle any errors with the promise\n try {\n // await says that the code should wait for this code to finish before executing the next thing\n const response = await makeRequest('Google')\n console.log('Response received')\n const processedResponse = await makeRequest(response)\n console.log(processedResponse)\n // catch will be used if promise rejects instead of resolves\n } catch(err) {\n console.log(err)\n }\n}", "async function asyncPromAll() {\n const resultArray = await Promise.all([asyncTask1(), asyncTask2(), asyncTask3(), asyncTask4()]);\n for (let i = 0; i<resultArray.length; i++){\n console.log(resultArray[i]);\n }\n}", "async function getData() {\n let data = await getUsername1()\n data = await getAge1(data)\n data = await getDepartment1(data)\n data = await printDetails1(data)\n}", "async function doWork() {\n try {\n console.log(\"s1\");\n await step1();\n console.log(\"s2\");\n await step2();\n console.log(\"s3\");\n await step3();\n console.log(\"s4\");\n } catch (err) {}\n}", "async function executar(){\n await esperarPor(2000)\n console.log('Async 1');\n\n await esperarPor(2000)\n console.log('Async 2');\n\n await esperarPor(2000)\n console.log('Async 3');\n\n}", "async function executeAsyncTask() {\n const valueA = await functionA()\n const valueB = await functionB(valueA)\n return function3(valueA, valueB)\n}", "async function onClickAsyncAwait() {\n try {\n console.time('Measuring time');\n\n const valueOne = await taskOne();\n const valueTwo = await taskTwo();\n const valueThree = await taskThree();\n\n console.timeEnd('Measuring time');\n } catch (error) {\n //console.log(error);\n }\n\n}", "async function callClient(){\r\n console.log(\"Waiting for the project....\");\r\n let firstStep = await willGetProject();\r\n let secondStep = await showOff(firstStep);\r\n let lastStep = await willWork(secondStep);\r\n console.log(\"Completed and deployed in seatle\");\r\n}", "async function init() {\n await downloadFromServer();\n let response = await JSON.parse(backend.getItem('tasks')) || [];\n allTasks = response;\n console.log(allTasks)\n updateTasks();\n}", "async function work() { // work is called asynchronously i.e. in background\n try {\n await task3(); // To execute tasks sequentially use await\n const x =await task4(); //x is passed from task4 to task5\n //console.log(\"After await1\"); //gets printed\n await task5(x);\n //console.log(\"After await2\"); // doesn't get printed\n }catch (e) { // using try catch block for handling errors\n console.error(e);\n }\n}", "async function asyncAwaitRequest() {\n const beerListFetches = createBeerListFetches()\n\n console.clear()\n console.log(\"asyncAwaitRequest()\")\n showLoading(\"Async/Await\", true)\n \n const results = await Promise.all(beerListFetches)\n const names = await Promise.all(\n results.map((result) => { \n console.log(`AsyncAwait -> Normalize`)\n return new Promise((resolve) => {\n setTimeout(() => { \n result.json().then((data) => {\n const names = data.map(beer => beer.name)\n .reduce((acc, name) => `${acc}, ${name}`)\n resolve(names)\n })\n }, 2000)\n })\n })\n )\n\n names.forEach((nameList) => console.log(`AsyncAwait Names=[${nameList}]`))\n\n console.log(`AsyncAwait$Done`)\n showLoading(\"Async/Await\", false)\n}", "async function main() {\r\n console.time('Measuring time');\r\n // const result = await Promise.all([taskOne, taskTwo])\r\n const [valueOne, valueTwo] = await Promise.all([taskOne(), taskTwo()]);\r\n console.timeEnd('Measuring time');\r\n\r\n // console.log('Task One Returned => ', result[0]);\r\n // console.log('Task Two Returned => ', result[1]);\r\n console.log('Task One Returned => ', valueOne);\r\n console.log('Task Two Returned => ', valueTwo);\r\n}", "async function asyncCall() {\n try {\n const result = await getListActivity();\n console.log(result);\n return result;\n // the next line will fail\n //const result2 = await apiFunctionWrapper(\"bad query\");\n //console.log(result2);\n } catch(error) {\n console.error(\"ERROR:\" + error);\n }\n }", "async function getRecipesAW(){\n\t\t//waits till the promise is fulfilled and then stores the resolved value in the variable ie. Ids ,recipe ,related here\n\t\tconst Ids = await getIds; \n\t\tconsole.log(Ids);\n\t\tconst recipe=await getRecipe(Ids[2]);\n\t\tconsole.log(recipe);\n\t\tconst related = await getRelated('Jonas');\n\t\tconsole.log(related);\n\t\t\n\t\treturn recipe; //async function also returns a promise always!\n\t}", "async function test() {}", "async function app() {\n try {\n // const clientes = await descargarNuevosClientes();\n // const pedidos = await descargarUltimosPedidos();\n // console.log(clientes);\n // console.log(pedidos);\n\n const resultado = await Promise.all([descargarNuevosClientes(), descargarUltimosPedidos()]); // Como estamos haciendo async tenemos que poner el await, con Promise.all hacemos un arreglo el cual ejecutara las dos funciones al mismo tiempo \n console.log(resultado[0]);\n console.log(resultado[1]);\n } catch (error) {\n \n console.log(error);\n }\n}", "async mainLoop() {\n return new Promise((resolve) => {\n forEachLimit(\n Array.from({ length: this.asyncPage }, (_, k) => k + 1),\n this.asyncTasks,\n async (item) => {\n const body = await this.buildRequest(item);\n\n let totalResultCount = body.match(/\"totalResultCount\":\\w+(.[0-9])/gm);\n\n if (totalResultCount) {\n this.totalProducts = totalResultCount[0].split(\n 'totalResultCount\":'\n )[1];\n }\n this.grabProduct(body, item);\n },\n () => {\n resolve();\n }\n );\n });\n }", "async run() {\n }", "async function doWork() {\n await preheatCookier();\n addSpagetti();\n addSalt();\n await boil(5);\n console.log('ready');\n}", "async function main() {\n try {\n const [name, age] = await Promise.all([\n getName(),\n getAge()\n ])\n name;\n age;\n } catch (err) {\n console.log(err);\n }\n \n}", "async addTaskAsync(taskText){\n //create a new uncompleted task based on taskText\n const task={\n 'taskDescription': taskText,\n 'taskCompleted': 0,\n 'userId': 1\n }\n \n let tasks =[]\n try{\n //wait for the promise returned from addTaskAsync to resolve\n await TaskService.addTaskAsync(task)\n //THEN wait for getTasksAsync to reolve\n tasks = await TaskService.getTasksAsync()\n } catch(e){\n console.log(e)\n }\n this.setState({tasks:tasks})\n }", "async run() {\n await Promise.all(this[QUEUE].map(this[TEST_PAGE]));\n }", "async function submit(){\n \n // pull in values form the user inputs on the webpage\n getUserInput()\n \n // get the location data\n \n let data = await getData(geoURL)\n \n postData('/getLatLon', data);\n // let x = await postData('/getLatLon', data);\n // console.log(x) \n\n // update user interface with another async call\n // updateUI();\n \n // let imData = await getImage()\n await getImage()\n\n await getWeatBit()\n \n await getCountry()\n\n await updateUI()\n\n}", "async function runCheck(){\n /*await getRSS();\n //console.log(\"finish rss\");\n if(rss != null){ //if the rss feed is not there don't execute the other functions\n await getShows();\n //console.log(`finish shows`);\n await getMagnetlink();\n //console.log(`magnet`);\n }\n */\n getRSS(); \n console.log(getTimeStamp() + \".\");\n}", "async function getRecipeAW() { // the function always return a Promises\n //the await will stop executing the code at this point until the Promises is full filled\n // the await can be used in only async function\n const id = await getID;\n console.log(id)\n console.log('here 2');\n const recipe = await getRecipe(id[1]);\n console.log(recipe);\n const related = await getRelated('Publisher');\n console.log(related);\n\n return recipe;\n}", "async function concurrent() {\n const firstPromise = firstAsyncThing();\n const secondPromise = secondAsyncThing();\n console.log(await firstPromise, await secondPromise);\n }", "async function main() {\n\n\n const stubTasks = range(50).map(n => () => delay(500).then(() => `#${n} completed`))\n\n return runInParallel(stubTasks, 5, res => {console.log(res)})\n}", "async function doWork() {\n const response = await makeRequest('osu');\n console.log('response received')\n const finalResponse = await addSomething(response);\n console.log(finalResponse);\n\n}", "async function main() {\n try {\n console.time('Measuring time');\n\n let results = await Promise.all([taskOne(), taskTwo()])\n console.timeEnd('Measuring time');\n\n console.log('Value one:', results[0]);\n console.log('Value two:', results[1]);\n } catch (error) {\n console.log(error);\n }\n}", "async function main() {\n const userInfo = await getUserInfo('12');\n console.log(userInfo);\n\n const userAddress = await getUserAddress('12');\n console.log(userAddress);\n\n console.log('ceva4');\n}", "async function run() {\n try {\n const mongo = await connectMongo();\n\n const { source } = await Configuration.findOne();\n const configuration = yaml.parse(source);\n const { services, timeout, webhooks } = configuration;\n await Promise.all(services.map(service => checkService(service, webhooks, timeout)));\n\n await mongo.disconnect();\n } catch (err) {\n log.err(`[worker] [run()] Error: %s`, err.message || err);\n }\n}", "async function getData() {\n const location = document.getElementById('location').value;\n\n getGeoData(location)\n .then(function(data) {\n postData({\n latitude: data.geonames[0].lat,\n longitude: data.geonames[0].lng\n });\n getCoordinates()\n .then(function(localData) {\n callWeather(localData)\n .then(function(newData) { \n postWeather({\n day1: newData.data[1],\n day2: newData.data[2],\n day3: newData.data[3],\n day4: newData.data[4],\n day5: newData.data[5],\n day6: newData.data[6],\n day7: newData.data[7],\n day8: newData.data[8],\n day9: newData.data[9],\n day10: newData.data[10],\n day11: newData.data[11],\n day12: newData.data[12],\n day13: newData.data[13],\n day14: newData.data[14],\n });\n getPix(location)\n .then(function(pixData) {\n postPix({\n picture: pixData.hits[0]\n });\n updateUI(location);\n });\n });\n }); \n });\n}", "async function executeSeqWithForAwait(urls) {\n const responses = [];\n const promises = urls.map((url) => {\n return fetchUrlDataWithAsyncAwait(url);\n });\n\n for await (const res of promises) {\n console.log(res);\n responses.push(res);\n }\n console.log(responses);\n}", "async function asyncWrapperFunction() {\r\n await htmlRouting();\r\n await videoRouting();\r\n const data = await dataProcessing();\r\n const nodes = await nodesGetting();\r\n dynamic(data,nodes);\r\n display(data,nodes);\r\n}", "async function resolveHandler(resolve) {\n await resolve.forEach(resolve => {\n console.log(resolve)\n })\n }", "async function funcionAsincronaDeclarada (){\r\n try {\r\n console.log(`Inicio de Async function`)\r\n let obj = await cuadradoPromise(0);\r\n console.log(`Async function: ${obj.value}, ${obj.result}`)\r\n \r\n obj = await cuadradoPromise(1);\r\n console.log(`Async function: ${obj.value}, ${obj.result}`)\r\n\r\n obj = await cuadradoPromise(2);\r\n console.log(`Async function: ${obj.value}, ${obj.result}`)\r\n\r\n obj = await cuadradoPromise(3);\r\n console.log(`Async function: ${obj.value}, ${obj.result}`)\r\n\r\n obj = await cuadradoPromise(4);\r\n console.log(`Async function: ${obj.value}, ${obj.result}`)\r\n } catch (err) {\r\n console.error(err)\r\n }\r\n}", "static async method(){}", "async function asyncFuncExample(){\n let resolvedValue = await myPromise();\n console.log(resolvedValue);\n }", "async function updateTheUserTwiceProd() {\n\n let userEmail = await getEmailFromDb('admin')\n let updateWorked = await updateUserBasedOnEmail(userEmail)\n updateWorked = await updateUserBasedOnEmail(userEmail)\n //await myBusinessLogic(username)\n\n // do some stuff\n\n return 'aukfhuseifh'\n}", "async function doWork(){\r\n // all the code that could fail goes here.\r\n try {\r\n // await: the 'doWork' function will wait until the 'makeRequest' function has returned before moving forward. if 'await' is not used, it will\r\n // return the promise and not the result of the promise.\r\n // this will only return the resolve section of the promise\r\n const response = await makeRequest('Google')\r\n console.log('Response Recieved')\r\n const processedResponse = await processRequest(response)\r\n console.log(processedResponse)\r\n // catch takes a single parameter 'err' which is collected from the reject statement in the promise.\r\n } catch (err) {\r\n console.log(err)\r\n }\r\n}", "async function scenario1() { // eslint-disable-line no-unused-vars\n const nums = [1, 2, 3, 4, 5];\n \n \n async function processArray(array) {\n const results = [];\n array.forEach(async item => {\n const processedItem = await asyncOperation(item); // this does not block\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}", "async function receber() {\n setLoading(true)\n try {\n const response_get = await api.get('/api/bot')\n const data = response_get.data\n setTask(data)\n // setBotID(tasks) \n console.log(data);\n setLoading(false)\n } catch (error) {\n console.log(error)\n }\n}", "async function fetchData() {\n const response = await API.get(\"findTask/\");\n\n setTasks(response.data);\n console.log(\"👉 Returned data:\", response);\n }", "async function wrapperForAsyncFunc(){\n const [result1, result2] = await Promise.all([\n AsyncFunction1(),\n AsyncFunction2()\n ]);\n console.log(result1, result2)\n}", "function ticketUpdateScrapeController() {\n\n return new Promise( async(resolve, reject) => {\n\n try { \n\n const updatedData = await updated_data();\n\n const chunkedData = await chunkQueries(5, updatedData);\n\n const ticketToBeUpdated = [];\n\n const data = await chunkedData.reduce( async(accumulator, currentValue) => {\n\n const accum = await accumulator;\n\n const arrFuncs = currentValue.reduce((acc, curVal) => {\n\n ticketToBeUpdated.push(curVal.tckt_nmbr);\n\n return [...acc, scrapeTicketData(curVal.tckt_nmbr)];\n\n }, []);\n\n const result = await Promise.all(arrFuncs);\n\n const scrapeFuncs = result.reduce((acc, curVal) => {\n\n return [...acc, workNotedataScraper(curVal)];\n\n }, []);\n\n const extractedData = await Promise.all(scrapeFuncs);\n\n const spreadedData = extractedData.reduce((cur, val) => {\n\n return [...cur, ...val];\n \n }, []);\n\n return [...accum, ...spreadedData];\n\n }, Promise.resolve([]));\n\n await removeOldUpdateLogs(ticketToBeUpdated); \n\n await insertTicketUpdateLogs(data);\n\n resolve();\n \n } catch (error) {\n\n logger.error(error, 'An issue occured in workNoteDataScraper function');\n \n reject();\n\n }\n\n })\n\n}", "async function getRecipesAW() {\n const IDs = await getIDs; //receives the resolve value of the promise\n console.log(IDs);\n \n const recipe = await getRecipe(IDs[2]);\n console.log(recipe);\n \n const related = await getRelated('Jonas');\n console.log(related);\n \n return recipe;\n}", "function run() {\n return new Promise((resolve, reject) => {\n if (map.length == 0) {\n reject()\n }\n\n for (let i = 0; i < map.length; i++) {\n promises.push(() => {\n console.log('Fetching pngs into', `${map[i].destination_path}/png`, 'dir.')\n return fetchPngs(map[i])\n })\n }\n\n runSync(promises).then(() => {})\n resolve()\n })\n}", "async do() {\n if (this.operations.length === 0) {\n return Promise.resolve();\n }\n this.parallelExecute();\n return new Promise((resolve, reject) => {\n this.emitter.on(\"finish\", resolve);\n this.emitter.on(\"error\", (error) => {\n this.state = BatchStates.Error;\n reject(error);\n });\n });\n }", "async do() {\n if (this.operations.length === 0) {\n return Promise.resolve();\n }\n this.parallelExecute();\n return new Promise((resolve, reject) => {\n this.emitter.on(\"finish\", resolve);\n this.emitter.on(\"error\", (error) => {\n this.state = BatchStates.Error;\n reject(error);\n });\n });\n }", "async function translate(file_path, book_id, trans_langs) {\n var arguments = [];\n arguments.push(file_path);\n arguments.push(book_id);\n for (var i = 0; i < trans_langs.length; i++) {\n arguments.push(trans_langs[i]);\n }\n console.log(arguments);\n let options = {\n mode: \"text\",\n executable: \"python3.9\",\n pythonOptions: [\"-u\"], // get print results in real-time\n scriptPath:\n \"./public/translation\",\n args: arguments, //An argument which can be accessed in the script using sys.argv[1]\n };\n console.log(\"entered the async\")\n try{\n await PythonShell.run(\n \"ParseAndTranslate.py\",\n options,\n function (err, result) {\n if (err) throw err;\n //result is an array consisting of messages collected\n //during execution of script.\n console.log(\"result: \", result.toString());\n for(var i = 0 ; i < trans_langs.length ; i++){\n console.log(\"doing something in this loop for downloads\");\n uploadTranslatedBook(book_id, trans_langs[i]);\n }\n }\n );console.log(\"ok this is it\")} catch (error){\n console.log(\"ded\")\n console.log(error)\n }\n console.log(\"exiting the async\")\n \n}", "async function syncPipeline() {\n await generateAllowance();\n // await confirmPendingBookings();\n // the server-side script does this now\n await updateContactList();\n await updateTourList();\n}", "async function transformAllContactInfo(){\n smoothScrollToEle(document.getElementById('container-contact'));\n return new Promise(function(resolve, reject) {\n resolve(emailTransform()); \n }).then(function(result) {\n //console.log(result);\n return phoneTransform(); \n }).then(function(result){\n // console.log(result);\n return linkedinTransform();\n }).then(function(result){\n // console.log(result);\n return Promise.resolve('transformed all contacts');\n });\n \n }", "async function distribute() {\n // Running Promises in parallel\n const listOfPromises = listOfOptions.map(asyncOperation);\n // Harvesting\n return await Promise.all(listOfPromises);\n}", "async function main() {\n\tfor(i in file) {\n\t let [thing1, thing2, thing3] = file[i].split(\":\");\n\t let result = await myfunction(thing1, thing2, thing3);\n\t\t\tconsole.log(`Result of ${i} returned`);\n\t}\n}", "async function someFunc() {\n try {\n const arr = [\n funcThatReturnsPromise('some other shit', 1000),\n funcThatReturnsPromise('some other shit', 1000),\n funcThatReturnsPromise('some other shit', 1000)\n ];\n const res = await Promise.all(arr);\n console.log(res);\n }\n catch (error) {\n console.error(error);\n }\n}", "async function main(){\n try{\n const usuario= await obterUsuario();\n // const telefone = await obterTelefone(usuario.id);\n // const endereco = await obterEnderecoAsync(usuario.id);\n\n //o promise all permite fazer com que as funcoes nele executem ao `mesmo tempo`\n const resultado = await Promise.all(\n [\n obterTelefone(usuario.id),\n obterEnderecoAsync(usuario.id)\n ]\n )\n console.log(`\n Nome:${usuario.nome}\n Telefone:${resultado[0].telefone}\n Endereco:${resultado[1].rua}\n `);\n\n }catch(error){\n console.error(`Deu ruim`,error)\n }\n\n}", "function main() {\n return Promise.all([1, 2, 3, 4].map((value) => asyncThing(value)))\n}", "async function executeParallelAsyncTasks() {\n const [valueA, valueB, valueC] = await Promise.all([functionA(), functionB(), functionC()])\n doSomethingWith(valueA)\n doSomethingElseWith(valueB)\n doAnotherThingWith(valueC)\n}", "async function waiting() {\n const firstValue = await firstAsyncThing();\n const secondValue = await secondAsyncThing();\n console.log(firstValue, secondValue);\n }", "async function wrapperForAsyncFunc() {\n const result1 = await AsyncFunction1();\n console.log(result1);\n const result2 = await AsyncFunction2();\n console.log(result2);\n}", "async function asyncAwait() {\n try {\n let result = await cekHariKerja(\"sabtu\");\n console.log(`${result} adalah hari kerja`);\n } catch (error) {\n console.log(error.message);\n }\n}", "async asyncPromiseChain() {\n\n this.showSubmit = false;\n this.selectedAccount = true;\n this.foundAccounts = false;\n this.isLoading = true;\n this.rowData.forEach(d => {\n this.SelectedAccId = d.accountId;\n this.SelectedAccName = d.name;\n this.SelectedAccPhone = d.phone;\n });\n\n let conResp = await getRelatedContactList({ id: this.SelectedAccId });\n if (conResp && conResp.length > 0) {\n conResp.forEach((d, i) => {\n this.conData.push({\n id: d.Id,\n first: d.FirstName,\n last: d.LastName,\n email: d.Email\n })\n console.log(this.conData[i]);\n })\n this.foundContacts = true;\n }\n let oppResp = await getRelatedOpptyList({ id: this.SelectedAccId });\n if (oppResp && oppResp.length > 0) {\n oppResp.forEach((d, i) => {\n this.oppData.push({\n id: d.Id,\n stage: d.StageName,\n amount: '$' + d.Amount,\n source: d.LeadSource\n })\n console.log(this.oppData[i]);\n })\n this.foundOpptys = true;\n }\n this.isLoading = oppResp != null && conResp != null;\n }", "async resolveFully() {\n let x = await this.next();\n while (!x.done) {\n x = await this.next();\n }\n }", "async function main() {\n try {\n var id_data = await get_changed_ids_prices();\n console.log(id_data);\n //use the chained async functions to get the data to update\n //wait for it to complete\n await update_prices(id_data);\n //update the database, wait for it to complete\n db.close();\n }\n catch (e) {\n console.log(\"error\");\n console.log(e);\n }\n}", "async function prosess (){\r\n try{\r\n console.log(\"Proses 1\");\r\n console.log(\"Proses 2\");\r\n console.log(\"Proses 3\");\r\n const result = await cariHariKerja(\"senin\")\r\n console.log(result);\r\n console.log(\"Proses 4\");\r\n console.log(\"Proses 5\");\r\n } catch(err){\r\n console.log(err);\r\n }\r\n}", "async function cool() {\n let promise = new Promise(function(resolve, reject) {\n setTimeout(() => resolve('All done!'), 1000);\n });\n\n let result = await promise;\n return result;\n}", "async function arr(){\n // the await ensures the async code won´t continue forward until the fn quering is done\n // see fn quering in the bottom of code\n const theList = await quering(item_number);\n return theList;\n }", "async function main() {\n // create the promises first\n var call1 = myApiClient(1)\n var call2 = myApiClient(2)\n\n // then wait for them\n var response1 = await call1\n var response2 = await call2\n\n // do something with the responses\n var message = response1['message'] + ' ' + response2['message']\n console.log(message)\n}", "async function fun1() {\n await window.ethereum.request({\n method: \"eth_requestAccounts\",\n });\n}", "async function runOrder() {\n fillArrays();\n cleanseDetails();\n meetingObjects();\n api();\n jsonNotation();\n addToMongo();\n}", "async function main() {\n\n getUser(\"test1\");\n\n}", "async function ej3() {\n var res = await prom();\n console.log(res);\n}", "async function testLib() {\n var initC = await initContract();\n var callOne = await makeRequest(\"ShipmentDelivered\");\n var callTwo = await makeRequest(\"ShipmentDelivered\");\n console.log(initC, callOne, callTwo)\n}", "async function initialiseGameImages() {\n var i;\n var urlList = [];\n for (i = 0; i < 10; i++) {\n urlList.push(await addImage());\n }\n //console.log(urlList);\n return urlList;\n}", "async waitForActiveTaskToFinish() {\n await Promise.race(this.tasks());\n }", "function doAsyncTask(cb) {\n // cb();\n \n setImmediate(() => {\n console.log(\"Async Task Calling Callback\");\n cb();\n });\n \n // process.nextTick(() => {\n // console.log(\"Async Task Calling Callback\");\n // cb();\n // });\n }", "async function callTeddies(){\n const callTeddies = await getTeddies();\n}", "async function run() {\n if (tasks.length < 1) {\n status = statuses.IDLE\n } else if (status == statuses.IDLE) {\n status = statuses.DOING\n await tasks.shift()()\n status = statuses.IDLE\n } else {\n }\n }", "async forEachAsync(f) {\n return this.map(f).resolveFully();\n }", "async function mainAsync() {\n // Gets command-line arguments\n const dir = argv.d || argv.dir\n\n // Gets task to do\n const [taskArg] = argv._;\n\n // If task argument is null, return error\n if (taskArg === undefined) throw new Error(\"First argument expected\")\n logger.info(\"Performing task\", taskArg)\n\n // Checks types of those arguments\n if (dir !== undefined && typeof dir !== 'string')\n throw new TypeError('Argument -d or --dir must be a string')\n\n // If there is given task, then run it\n if (main[taskArg] !== null) { \n logger.info(\"Force closing Guilded\");\n // Creates path for ReGuilded\n const reguildedPath = path.resolve(\n dir ||\n // if variable `reguilded` is empty, get default path instead\n path.join(process.env.APPDATA || process.env.HOME, \".reguilded\")\n )\n\n try {\n // Kills Guilded's process\n exec(platformModule.closeGuilded);\n // Executes the task\n await main[taskArg](platformModule.getAppDir(), reguildedPath)\n // Tells us that it succeeded\n logger.info(\"Task\", taskArg, \"has been successful\");\n } catch(err) {\n logger.error(\"Failed to do task\", taskArg);\n logger.fatal(err);\n }\n // Otherwise shout that no task was found\n } else logger.error(\"Unknown task\", taskArg);\n}", "async function getDetailsAsync(){\n const details = await getDetails(\"Here is your details from ASYNC AWAIT\");\n\n console.log(details);\n}", "async function startFlow(){\n try{\n await helper.initialize();\n await helper.checkBalance();\n await helper.approveSCContract();\n await helper.topup();\n await helper.checkBalance();\n await helper.setPending();\n await helper.setResult();\n await helper.getResult();\n await helper.setFinished();\n await helper.checkBalance();\n process.exit(0);\n }catch(err){\n console.error(err);\n process.exit(1);\n }\n}", "async function main() {\n try {\n console.time('promise-time')\n const user = await getUser()\n // const phonenumber = await getUserPhoneNumber(user.id)\n // const address = await getUserAddressAsync(user.id)\n\n const response = await Promise.all([\n getUserPhoneNumber(user.id),\n getUserAddressAsync(user.id)\n ])\n\n const phonenumber = response[0];\n const address = response[1];\n\n const data = {...user, ...phonenumber, ...address}\n\n console.table(data)\n console.timeEnd('promise-time')\n \n } catch(error) {\n console.log('Anything is wrong', error)\n }\n}", "async function miAsyncFunction()\n{\n try \n { //Esto de acá sería como el then de la async function miAsyncFunction() \n const promesa = await miPromesa; //espera el resultado de la promesa satisfecha (resolved)\n console.log(`Este es el valor de la promesa ${promesa}`);\n } //Esto de acá sería como el catch de la async function miAsyncFunction() \n catch (error) {\n console.log(\"La pecheaste\"); \n }\n}", "function run() {\n return __awaiter(this, void 0, void 0, function* () {\n let policyResults = null;\n try {\n Inputs.readInputs();\n utilities_1.setUpUserAgent();\n const policyRequests = yield policyHelper_1.getAllPolicyRequests();\n //2. Push above polices to Azure policy service\n policyResults = yield policyHelper_1.createUpdatePolicies(policyRequests);\n //3. Print summary result to console\n reportGenerator_1.printSummary(policyResults);\n }\n catch (error) {\n core.setFailed(error.message);\n utilities_1.prettyLog(`Error : ${error}`);\n }\n finally {\n //4. Set action outcome\n setResult(policyResults);\n }\n });\n}", "async runTest() {}", "async function run() {\n try {\n console.log('Start the matching.');\n\n // Get pending bank statement lines.\n\n const bankEntries = bankStatement.getBankEntries();\n console.log(`* Found bank entries : ${bankEntries.length}`);\n\n // Get pending documents (type = purchase) from email.\n\n const emailsOffice = await mailManager.getEmails(emailAccount);\n const pendingDocumentsFromOffice = emailsOffice.filter((currentEmail) => {\n return currentEmail.categories.includes(categoryPurchase) && !currentEmail.categories.includes(categoryMatched);\n }).map((currentEmail) => {\n return {\n emailId: currentEmail.id\n };\n });\n\n // Get known documents from MongoDB.\n\n const matchCollection = await require('./category/mongodbConnect.js').getMatchersCollection();\n const matchArray = await matchCollection.find().toArray();\n\n pendingDocumentsFromOffice.forEach((currentEmail) => {\n const foundMatch = matchArray.find((currentMatch) => {\n return currentMatch.emailId === currentEmail.emailId;\n })\n\n if (foundMatch) {\n currentEmail.date = foundMatch.date;\n currentEmail.label = foundMatch.label;\n currentEmail.amount = foundMatch.amount;\n }\n });\n\n console.log(`* Found documents (from emails) : ${pendingDocumentsFromOffice.length}`);\n\n // Simple matching (1 to 1) between documents and bank entries.\n\n const foundMatch = [];\n\n bankEntries.forEach((currentEntry) => {\n const matchingDocument = pendingDocumentsFromOffice.find((currentDocument) => {\n if (foundMatch.includes((currentMatch) => {\n return currentMatch.emailId === currentDocument.emailId;\n })) {\n return false;\n }\n\n return currentDocument.amount === currentEntry.amount;\n });\n\n if (matchingDocument) {\n foundMatch.push({\n emailId: matchingDocument.emailId,\n transactionId: currentEntry.transactionId\n });\n }\n });\n\n console.log(`* Found matching bank entries : ${foundMatch.length}`);\n\n // Set tags on matched documents.\n\n const promSetTag = pendingDocumentsFromOffice.map(async (currentDocument) => {\n console.log(`* Add tag ${categoryMatched} to email ${currentDocument.emailId}`);\n return mailManager.setTag(emailAccount, currentDocument.emailId, categoryMatched)\n });\n\n await Promise.all(promSetTag);\n console.log('End category process');\n process.exit(0)\n } catch (e) {\n console.log(e);\n }\n}", "async function ejercicio() {\n console.log('1');\n try{\n console.log('2');\n const contenidoArchivoActual = await promesaLeerArchivo();\n console.log(contenidoArchivoActual)\n console.log('3');\n await promesaEscribirArchivo();\n console.log('4');\n const nuevoContenido = await promesaLeerArchivo();\n console.log(nuevoContenido);\n console.log('5');\n }catch (error) {\n console.error(error);\n }\n console.log('6');\n console.log('7');\n}", "async function obtenerPersonajes(){\nvar ids=[1,2,3,4,5,6,7]\n\nvar promesas = ids.map(id=> obtenerPersonaje(id))\n\n//wait detiene la ejecucion de la funcion hasta que se hayan cargado todas las promesas\ntry{\n \n var personajes= await Promise.all(promesas)\n console.log(personajes)\n\n}catch(id){\n error(id)\n}\n\n}", "async function MyAsyncFn () {}", "async function start() {\n return await Promise.resolve(\"async await\");\n}", "async function consume(){\n let addRes = await add(5);\n let subRes = await sub(addRes);\n let mulRes = await mul(subRes);\n let divRes = await div(mulRes);\n console.log( addRes, subRes, mulRes, divRes );\n}" ]
[ "0.67336273", "0.6714969", "0.66731167", "0.66301775", "0.65760773", "0.6546365", "0.65360326", "0.6470068", "0.646884", "0.64657193", "0.6456139", "0.6450517", "0.64408326", "0.6422546", "0.6387878", "0.6316789", "0.6313531", "0.63122416", "0.63047755", "0.6298999", "0.6290479", "0.62824583", "0.6265761", "0.62630635", "0.6223275", "0.61794585", "0.6170781", "0.6152695", "0.6139723", "0.6137979", "0.61299807", "0.6125872", "0.6123278", "0.6119138", "0.610351", "0.6091641", "0.6083728", "0.6075991", "0.6073382", "0.60724545", "0.60656554", "0.605486", "0.6054256", "0.6054025", "0.6015589", "0.6004053", "0.6003437", "0.59939176", "0.59901154", "0.5971524", "0.5969326", "0.59469366", "0.594371", "0.59417945", "0.5930738", "0.5929101", "0.592385", "0.592385", "0.59238416", "0.59209055", "0.591825", "0.5917257", "0.5915943", "0.59155035", "0.59135157", "0.5910672", "0.59073406", "0.59015125", "0.58974725", "0.58869517", "0.5882355", "0.5868786", "0.58583564", "0.5846427", "0.5842106", "0.58410263", "0.5816163", "0.58160317", "0.58153504", "0.5802686", "0.57988614", "0.5798185", "0.57926655", "0.5785851", "0.5782753", "0.5777748", "0.57751393", "0.5772111", "0.57715005", "0.57695484", "0.57684386", "0.5766714", "0.5764842", "0.5762526", "0.57511616", "0.5751122", "0.5748849", "0.5746944", "0.57460266", "0.5744389", "0.5743253" ]
0.0
-1
50 FPS dla 20 milis
sendPlayerPosition() { const player = this.players.get(this.myPlayerName); // this.lastAngle = player.angle; // // this.setDeceleratingTimeout(()=> { // const player: Player = this.players.get(this.myPlayerName); // this.requestCache.addRequest(++this.counterRequest, player.x, player.y); // if(this.arrayWithAdditionalData.length < 2000) { // this.arrayWithAdditionalData.push(new AdditionalObject(5555,this.additionalData)); // } // // this.websocketService.sendPosition({ // "nickname": this.myPlayerName, // "positionX": player.x, // "positionY": player.y, // "score": player.score, // "stepDirection": this.getDirection(), // "version": this.counterRequest, // "requestTimestamp": new Date().getTime(), // // "additionalData": this.arrayWithAdditionalData // }); // // }, 1, 10000); this.lastX = player.x; this.lastY = player.y; this.lastAngle = player.angle; const dataProvider = Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["interval"])(1000); const subscriptionDataProvider = dataProvider.subscribe(() => { for (let i = 0; i < 10; i++) { this.arrayWithAdditionalData.push(new _communication_simulation_data_AdditionalObject__WEBPACK_IMPORTED_MODULE_8__["AdditionalObject"](5555, this.additionalData)); } if (this.arrayWithAdditionalData.length > 300) { subscriptionDataProvider.unsubscribe(); } }); this.positionSender = Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["interval"])(20); this.positionSenderSubscription = this.positionSender.subscribe(() => { const player = this.players.get(this.myPlayerName); if ((this.lastX !== player.x) || (this.lastY !== player.y) || (this.lastAngle !== player.angle)) { this.lastX = player.x; this.lastY = player.y; this.lastAngle = player.angle; this.requestCache.addRequest(++this.counterRequest, player.x, player.y); this.websocketService.sendPosition({ "nickname": this.myPlayerName, "positionX": player.x, "positionY": player.y, "score": player.score, "stepDirection": this.getDirection(), "version": this.counterRequest, "requestTimestamp": new Date().getTime(), "additionalData": this.arrayWithAdditionalData }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FPS() {\n\t\tresize();\n\t\ttimeouts();\n\t\t(CS.tab === 'game' && S && S.firstTick && CS.enableGraphics) && R.drawCanvas();\n\t\t$timeout(FPS, Math.round(1000/CS.FPS));\n\t}", "calculateFrame() {\n const nowTime = (new Date()).getTime();\n this.tick += 1;\n if (nowTime - this.beforeTime >= 1000) {\n console.log(`fps: ${this.tick}`);\n this.tick = 0;\n this.beforeTime = nowTime;\n }\n }", "static getFrameRate(frames) {\nvar frameok;\n//------------\n// Use 25fps as the somewhat arbitrary default value.\nframeok = frames && frames.length !== 0;\nif (frameok) {\nreturn 1000 / frames[0].duration;\n} else {\nreturn 25;\n}\n}", "function compute_fps() {\n let counter_element = document.querySelector(\"#fps-counter\");\n if (counter_element != null) {\n counter_element.innerText = \"FPS: \" + g_frames_since_last_fps_count;\n }\n g_frames_since_last_fps_count = 0;\n}", "function 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}", "function displayFPS() {\r\n let fps = frameRate();\r\n fill(255);\r\n stroke(0);\r\n text(\"FPS: \" + fps.toFixed(2), 10, height - 10);\r\n}", "function Start()\n{\n\taccum = 0f;\n\tframes = 1;\n \n // Infinite loop executed every \"frenquency\" secondes.\n while( Application.isPlaying )\n {\n // Update the FPS\n var fps : float = accum / (frames > 0 ? frames : 1);\n sFPS = fps.ToString( \"f\" + Mathf.Clamp( nbDecimal, 0, 10 ) );\n \n //Update the color\n color = (fps >= 30) ? Color.green : ((fps > 10) ? Color.red : Color.yellow);\n \n accum = 0;\n frames = 0;\n \n yield WaitForSeconds( frequency );\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}", "function main(ctime) {\r\n window.requestAnimationFrame(main);\r\n if ((ctime - lastPaintTime) / 1000 < 1 / speed) return;\r\n lastPaintTime = ctime;\r\n // console.log(ctime);\r\n gameEngine();\r\n\r\n}", "function tick() {\r\n now = window.performance.now();\r\n delta = (now-last); // in milliseconds\r\n if(t_cooldown>0) {\r\n t_cooldown -= delta*dcd;\r\n } else {\r\n t -= delta*dt;\r\n }\r\n t = t<0 ? 0 : t;\r\n last = now;\r\n\r\n // Update fps counter\r\n fhStart = (fhStart+1)%100;\r\n fhEnd = (fhEnd+1)%100;\r\n frameHistory[fhEnd] = now;\r\n fpsElement.textContent = Math.ceil( 1000.0*frameHistory.length/(now-frameHistory[fhStart]) )\r\n }", "function setupFPS() {\r\n stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom\r\n document.body.appendChild(stats.dom);\r\n}", "function setupFPS() {\r\n stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom\r\n document.body.appendChild(stats.dom);\r\n}", "function setupFPS() {\r\n stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom\r\n document.body.appendChild(stats.dom);\r\n}", "function show_framerate() {\n if (timeRecords.frames.length < 2) {\n return;\n }\n var timeSpan = 5000,\n endPos = timeRecords.frames.length - 1,\n endTime = timeRecords.frames[endPos],\n startPos, startTime, fps, generate = 0, update = 0;\n for (startPos = endPos; startPos > 0; startPos -= 1) {\n if (endTime - timeRecords.frames[startPos] > timeSpan) {\n break;\n }\n generate += timeRecords.generate[startPos];\n update += timeRecords.update[startPos];\n }\n startTime = timeRecords.frames[startPos];\n timeSpan = endTime - startTime;\n fps = (endPos - startPos) * 1000 / timeSpan;\n generate /= (endPos - startPos);\n update /= (endPos - startPos);\n $('#timing-framerate').text(fps.toFixed(1));\n $('#timing-generate').text(generate.toFixed(1));\n $('#timing-update').text(update.toFixed(1));\n if (startPos > 1000) {\n timeRecords.frames.splice(0, startPos);\n timeRecords.generate.splice(0, startPos);\n timeRecords.update.splice(0, startPos);\n }\n }", "function setupFPS() {\n stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom\n document.body.appendChild(stats.dom);\n}", "function setupFPS() {\n stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom\n document.body.appendChild(stats.dom);\n}", "function gameSlow() {\n setInterval(oneFrame, 300);\n setInterval(buff6s, 12000);\n}", "function main() {\n webgl.checkAspectRatio();\n webgl.lightingToggle(config.modes.lightingMode.currstate);\n webgl.viewModeToggle(config.modes.viewMode.currstate);\n webgl.zooming(config.core.positions.zoomRatio);\n webgl.rotation(config.core.positions.angleX, config.core.positions.angleY, config.modes.rotateMode.currstate);\n let currentTime = new Date().getTime();\n document.getElementsByClassName(\"FPS\")[0].innerText = parseInt(fpsCount / (currentTime - startTime) * 1000);\n fpsCount++;\n requestAnimationFrame(main);\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 drawFps(duration) {\n let avgFps = 0;\n \n fps.push(p.frameRate());\n if (fps.length > 60*duration) { fps.splice(0, 1); }\n \n for (let i = 0; i < fps.length; i++) {\n avgFps += fps[i];\n }\n avgFps = avgFps/fps.length;\n \n p.push();\n p.textSize(20);\n p.text(p.int(avgFps), 32, 32);\n p.pop();\n }", "function showFPS(){\n\tif(! DEBUG) return;\n\n\t//SETTING UP THE DEBUG PLUGIN. THIS WILL RUN ON ALL SCENES\n\tgame.debug.font = \"24px monospace\";\n\tgame.debug.lineHeight = 20;\n\tif (!game.timing) {\n\t\tgame.timing = game.plugins.add(Phaser.Plugin.AdvancedTiming);\n\t}\n\t//this affects the game physics and not the actual displayed FPS. Setting this to our desired frame rate will allow catchup mechanics in the physics to work better in instances where the framerate drops below this desired rate\n\tgame.time.desiredFps = 30;\n\tgame.time.advancedTiming = true;\n}", "function setupFPS() {\n stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom\n document.getElementById('main').appendChild(stats.dom);\n}", "function drawSpeedo() {\n let fra = round(frameRate());\n let fractionOfMaxSpeed = fra/60;\n // start a new drawing context (colours, etc.)\n push();\n // draw the coloured \"speedo\" bar\n noStroke();\n // make it red when we're fast, grey when we're slow\n fill(255*fractionOfMaxSpeed, 50, 50);\n rect(width-150, height-100, 100*fractionOfMaxSpeed, 50);\n // draw the framerate number\n stroke(0);\n fill(255);\n strokeWeight(3);\n textSize(50);\n textAlign(CENTER, CENTER);\n text(fra, width-100, height-75);\n // restore the previous drawing context (colours, etc.)\n pop();\n}", "function drawFPS() {\n if (fps === 0)\n return;\n\n ctx.font = '16px Arial';\n ctx.fillStyle = fpsColor;\n ctx.textAlign = 'right';\n ctx.fillText(fps, width - 10, 20);\n }", "function setFrameRate() {\n // Game loop\n requestAnimationFrame(setFrameRate);\n\n elapsed = Date.now() - past;\n\n if(elapsed >= frameRate){\n past = Date.now() - (elapsed%frameRate);\n\n if(typeof update === \"function\")\n update();\n else\n console.error(\"Please define an update function\");\n }\n}", "function renderFPS(value) {\n\t\tcontext.save();\n\t\tcontext.font = 10 * stage.pixelRatio + \"px sans-serif\";\n\t\tcontext.fillStyle = \"white\";\n\t\tcontext.textBaseline = \"top\";\n\t\tcontext.fillText(value, 5 * stage.pixelRatio, 5 * stage.pixelRatio);\n\t\tcontext.restore();\n\t}", "function set_speed() {\r\n frameRate(speed_box.value * 1);\r\n}", "function setupFPS() {\n stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom\n\n document.getElementById('main').appendChild(stats.dom);\n}", "function getFramesPerInterval() {\n\treturn getInterval()*fps/1000;\n}", "function turboSpeed() {\r\n\t \tdelta = 500;\r\n\t}", "function runTimeFrame() {\n g.beginPath();\n evolve();\n draw();\n g.stroke();\n }", "function startFPSCounter() {\r\n var mspf = 1000;\r\n lastLoop = new Date().getTime();\r\n\r\n function instance() {\r\n fps();\r\n window.setTimeout(instance, mspf);\r\n }\r\n\r\n window.setTimeout(instance, mspf);\r\n}", "function gameSpeed() {\n speed -= 50;\n if (speed <= 100) {\n speed = 100;\n }\n clearInterval(drawer);\n drawer = setInterval(draw, speed);\n console.log('speeding', speed);\n }", "function frames(minute, number) {\n \n let fps = minute * number * 60;\n console.log(\"For \" + minute + \" minutes \" + \" and number \" + number + \"the FPS IS \" + fps);\n return fps;\n }", "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 }", "loop() {\n if (document.hidden) { this.running = false }\n\n let now = Date.now(),\n delta = now - (this.lastRender || now)\n this.lastRender = now;\n\n if (this.running) {\n this.draw(delta)\n this.frames++\n }\n\n requestAnimationFrame(() => this.loop());\n\n // Display fps and position\n if (now - this.lastFps > 999) {\n this.fpsMeter.innerText = this.frames\n this.lastFps = now;\n this.frames = 0;\n }\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 }", "function redrawHelper() {\n var sec = (Date.now() - timeSinceLastFPS) / 1000;\n framesSinceLastFPS++;\n var fps = framesSinceLastFPS / sec;\n\n // recalculate FPS every half second for better accuracy.\n if (sec > 0.5) {\n timeSinceLastFPS = Date.now();\n framesSinceLastFPS = 0;\n p.__frameRate = fps;\n }\n\n p.frameCount++;\n }", "gameLoop() {\n if (this.stopped) {\n return;\n }\n\n let now = Date.now();\n let dt = (now - this.lastTime) / 1000.0;\n this.fps = 1 / dt;\n\n this.update(dt);\n this.render();\n\n this.lastTime = now;\n\n window.requestAnimationFrame(() => this.gameLoop());\n }", "function updateFramerate() {\n\tthisTick = new Date().getTime();\n\tframeDuration = thisTick - lastTick;\n\tcurrentFramerate = Math.round(1000 / frameDuration);\n\tlastTick = thisTick;\n\tif(currentFramerate > framerateHigh) {\n\t\tframerateHigh = currentFramerate;\n\t}\n\tif(currentFramerate < framerateLow) {\n\t\tframerateLow = currentFramerate;\n\t}\n\tif(debugOn) {\n\t\tframerateDisplayUpdateCounter += 1;\n\t\tif(framerateDisplayUpdateCounter === framerateDisplayUpdateFrequency) {\n\t\t\tframerateDisplayUpdateCounter = 0;\n\t\t\tupdateFramerateDisplay();\n\t\t}\n\t}\n}", "function loop(){\n stats.begin();\n\n canv_draw();\n \n sim_update();\n\n stats.end();\n \n requestAnimationFrame(loop);\n}", "function draw() {\n /* Drawing function where you can get all the objects moving\n *\n */\n\n background(100, 140, 130);\n screenStats();\n checkBoudaries();\n arrivalParticle();\n timeelapsed();\n particleX();\n console.log('How Many Frames per Second : ' + requestAnimFrame());\n}", "function fps ( value ) {\n\t\treturn __do(\"fps\",value);\n\t}", "function fpsTick(thisFrame) {\n fpsStart = fpsStart || new Date().getTime();\n if (thisFrame - fpsStart >= 1000) {\n fpsStart += 1000;\n fps = fpsCounting;\n fpsCounting = 0;\n fpsText.innerHTML = fps + \" fps\";\n }\n fpsCounting++;\n if (debug)\n addTaskForFrame(fpsTick);\n }", "function main(currentTime){\r\n //so alli main logic nalli ond sati first time fire aagatte ee main function using\r\n // requestAnimation frame amele naavu idna pade pade kareetivi and we'll make this\r\n // function paint and render again and again andre frame rate jaasti aagatte\r\n window.requestAnimationFrame(main);\r\n counter++;\r\n // console.log(counter);\r\n if(counter%100 == 0){\r\n counter = counter%100;\r\n count++;\r\n // console.log(count);\r\n }\r\n if(count/10 === 1){\r\n count = count%10;\r\n level++;\r\n // console.log(level);\r\n }\r\n if(level != previouslevel){\r\n speed++;\r\n // console.log(speed);\r\n previouslevel = level;\r\n Level.innerHTML = \"LEVEL : \" + level;\r\n }\r\n // console.log(currentTime);\r\n if(((currentTime - lastpaintTime)/1000) < 1/speed){\r\n // currentTime = currentTime * 2;\r\n // console.log(\"currentTime\");\r\n return;\r\n }\r\n lastpaintTime = currentTime;\r\n gameEngine();\r\n}", "function render() {\n\t\trate = (droppedFrames > 0) ?\n\t\t\t((rate+(FPS/(droppedFrames*2)))/2):\n\t\t\t((rate + FPS)/2);\n\t\t\t\n\t\tcycleCounter = (cycleCounter + 1) % FPS;\n\t\tframeCounter = (frameCounter + 1) % 1e15;\n\t\t// just render every N frames to avoid a jarring display\n\t\tdroppedFrames = -1;\n\t\trdCallback();\n\t}", "start() {\n var time = new Date;\n var _this = this;\n\n if (this.fps == 60) {\n this.runLoop = displayBind(function tick() {\n _this.onTick(new Date - time);\n _this.runLoop = displayBind(tick);\n time = new Date;\n });\n } else {\n this.runLoop = setTimeout(function tick() {\n _this.onTick(new Date - time);\n _this.runLoop = setTimeout(tick, 1000 / _this.fps);\n time = new Date;\n }, 1000 / this.fps);\n }\n }", "function increaseSpeed() {\n\tvideo.playbackRate *= 1.25;\n\tconsole.log(\"Speed is \"+ video.playbackRate);\n}", "function frame(){\t\n\tvar t_step = secondsPerAnimatingMillisecond * animationStep;\n\tif(elapsedVirtualTime == 0){ // half step approx\n\t\tt_step = t_step / 2;\n\t\taccel();\n\t\tvel(t_step);\n\t} else {\n\t\tpos(t_step);\n\t\taccel();\n\t\tvel(t_step);\n\t\tredrawCanvas();\n\t}\n\t\n\telapsedVirtualTime += t_step;\n}", "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 startGameLoop() {\n fpsInterval = 1000 / framerate;\n then = window.performance.now();\n startTime = then;\n gameLoop();\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}", "displayFPS(f) {\r\n\t\tthis.ctx.beginPath()\r\n\t\tthis.ctx.font = \"10px Arial\"\r\n\t\tthis.ctx.fillStyle = \"#00ff00\"\r\n\t\tthis.ctx.fillText('FPS: '+ Math.round(f),10,15);\r\n\t\tthis.ctx.fill()\r\n\t\tthis.ctx.closePath()\r\n\t}", "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 }", "function loop(){\r\n update(); \r\n draw();\r\n frames++;\r\n requestAnimationFrame(loop);\r\n}", "get framesPerSecond() {\n\t\treturn this._fps;\n\t}", "function animation(update, context, dt, fps) {\n var current = new Date().getTime();\n var acc = 0;\n var dt = dt || 20;\n var fps = fps || 50;\n var time = Math.ceil(1000 / this.fps);\n function loop() {\n var now = new Date().getTime();\n var passed = now - current;\n current = now;\n acc += passed;\n while (acc >= dt) {\n update();\n acc -= dt;\n }\n context.drawCanvas();\n }\n return setInterval(loop, time);\n}", "function optEngine(i) {\n \n setTimeout(function(){\n console.log(fps.innerHTML);\n }, 200);\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}", "update() {\n\t\t/* 50 second per frame */\n\t\tthis.worldTime = new Date(this.worldTime.getTime()+1000*this.speed);\n\t\tthis.domElement.textContent = this.HTML;\n\t}", "function onTick(e) {\n\t\t// TESTING FPS\n\t\tdocument.getElementById('fps').innerHTML = createjs.Ticker.getMeasuredFPS();\n\n\t\t// update the stage!\n\t\tstage.update();\n\t}", "setFPS(_fps) {\n this._minDelay = Math.round(1000 / _fps);\n if (this._minDelay < this.ELEMTickerInterval) {\n this._minDelay = this.ELEMTickerInterval;\n }\n }", "setFPS(_fps) {\n this._minDelay = Math.round(1000 / _fps);\n if (this._minDelay < this.ELEMTickerInterval) {\n this._minDelay = this.ELEMTickerInterval;\n }\n }", "function perfRecordFrame() {\n const now = performance.now();\n const oneSecondAgo = now - 1000;\n while (refreshTimes.length > 0 && refreshTimes[0] <= oneSecondAgo) {\n refreshTimes.shift();\n }\n refreshTimes.push(now);\n\n if (now - lastFPSLabelUpdate > 200) {\n drawFPSLabel(refreshTimes.length);\n lastFPSLabelUpdate = now;\n }\n}", "function tick(){\n // Save the current time\n g_seconds = performance.now()/1000.0-g_startTime;\n //console.log(g_seconds);\n\n //Update animation angles:\n updateAnimationAngles();\n\n // Draw Everything: \n renderAllShapes();\n\n // Tell the browser to update again when it has time \n requestAnimationFrame(tick);\n}", "startAnimating(fps){\n this.fpsInterval = 1000 / fps;\n this.then = Date.now();\n this.animate();\n }", "function frames(minutes, fps) {\n\treturn minutes * 60 * fps;\n}", "function run() {\n var frame = 0;\n var loop = function() {\n update();\n frame++;\n // update();\n render();\n setTimeout(function() {\n window.requestAnimationFrame(loop, canvas);\n }, 1000/20);\n\n };\n window.requestAnimationFrame(loop, canvas);\n}", "function main() {\n /* Capturar a informaão de tempo delta que é requirida se o jogo\n * requer uma animação mais suave!\n */\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n\n /* \n */\n update(dt);\n render();\n\n /* \n */\n lastTime = now;\n\n /* \n */\n win.requestAnimationFrame(main);\n }", "function main() {\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n update(dt);\n render();\n\n lastTime = now;\n\n win.requestAnimationFrame(main);\n }", "function main() {\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n\n update(dt);\n render();\n\n lastTime = now;\n win.requestAnimationFrame(main);\n }", "function loop() {\n draw();\n update();\n frames++;\n requestAnimationFrame(loop);\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 }", "function main() {\r\n /* Get our time delta information which is required if your game\r\n * requires smooth animation. Because everyone's computer processes\r\n * instructions at different speeds we need a constant value that\r\n * would be the same for everyone (regardless of how fast their\r\n * computer is) - hurray time!\r\n */\r\n var now = Date.now(),\r\n dt = (now - lastTime) / 1000.0;\r\n\r\n /* Call our update/render functions, pass along the time delta to\r\n * our update function since it may be used for smooth animation.\r\n */\r\n update(dt);\r\n render();\r\n\r\n /* Set our lastTime variable which is used to determine the time delta\r\n * for the next time this function is called.\r\n */\r\n lastTime = now;\r\n\r\n /* Use the browser's requestAnimationFrame function to call this\r\n * function again as soon as the browser is able to draw another frame.\r\n */\r\n win.requestAnimationFrame(main);\r\n }", "function doFrame(timeStamp) {\n //time += timeStamp * 0.001; // convert to seconds;\n time = !reverse ? time + 1 / fps : time - 1 / fps; // convert to seconds;\n setTimeout(function () {\n drawScene(gl, shaderProg, model, lightTrans, time);\n if (time < 30 && !pause) {\n requestAnimationFrame(doFrame);\n }\n }, 1000 / fps);\n }", "function draw() {\n background(250);\n\n push();\n \n let step = frameCount % 600; // Modulus operator limits step variable to between 0 and 600.\n\n // An example of how to draw a graphic with the P5.js library. This statement draws a line that moves across the canvas every 10 seconds (10000 ms). Recall that 16.67 ms * 600 = 10000 ms or 10 seconds.\n\n stroke(255, 100, 100); // Color of the line\n strokeWeight(3); // Width of the line\n // \"line\" syntax: line(x1, y2, x2, y2)\n line(\n (step / 600) * width,\n height / 2 - 150,\n (step / 600) * width,\n height / 2 + 150\n );\n pop();\n}", "function setup(){\r\n createCanvas(900, 600);\r\n frameRate(12);\r\n}", "function FrameTimer()\r\n{\r\n\tvar lastFrameRate;\r\n\tvar frameRate;\r\n\t\r\n\tvar startTime = getTime()\r\n\t\r\n\tvar frameSpacing;\r\n\t\r\n\tvar lastTick = getTime();\r\n\tvar fpsLastTick = getTime();\r\n\t\r\n\tthis.getSeconds = function()\r\n\t{\r\n\t\tvar r = frameSpacing / 1000;\t\t\r\n\t\tif(r == 0 || isNaN(r))\r\n\t\t\treturn 0;\t\r\n\t\t\r\n\t\treturn r;\r\n\t}\r\n\t\r\n\tthis.tick = function()\r\n\t{\r\n\t\tframeSpacing = getTime() - lastTick;\r\n\t\tlastTick = getTime();\r\n\t}\r\n\t\r\n\tthis.calculateFrameRate = function()\r\n\t{\r\n\t\tif(getTime() - fpsLastTick >= 1000)\r\n\t\t{\r\n\t\t\tlastFrameRate = frameRate;\r\n\t\t\tframeRate = 0;\r\n\t\t\tfpsLastTick = getTime();\t\t\t\r\n\t\t}\r\n\t\tframeRate++;\r\n\t\treturn lastFrameRate;\r\n\t}\r\n\tthis.time = getTime;\r\n\t\r\n\tfunction getTime()\r\n\t{\r\n\t\tvar d = new Date();\r\n\t\treturn d.getTime();\r\n\t}\r\n}", "function draw() {\n if(video.paused || video.ended) return false;\n context.drawImage(video,0,0);\n processImage();\n var nowTime = new Date();\n var diffTime = Math.ceil((nowTime.getTime() - lastTime.getTime()));\n if (diffTime >= 1000) {\n fps = frameCount;\n frameCount = 0.0;\n lastTime = nowTime;\n }\n\n context.fillStyle = '#000000';\n context.fillRect(0, context.width - 15, 0, 15);\n context.fillStyle = '#FFF';\n context.font = 'bold 14px helvetica';\n context.fillText('FPS: ' + fps + '/' + maxfps, 4, canvas.height - 4);\n context.restore();\n frameCount++;\n setTimeout(draw,drawInterval);\n}", "function startGame()\n{\n\tsetInterval(draw, Math.floor(1000/30));\n}", "onFrame() {\n for (let i in this.boids) {\n this.boids[i].react(this.boids, this.obstacles);\n }\n for (let i in this.boids) {\n\n this.boids[i].update();\n }\n\n var nowTime = Date.now();\n this.fpsCounter.content = \"FPS: \" + Math.round(1000 / (nowTime - this.lastFrameTime));\n this.lastFrameTime = nowTime;\n }", "function handleSpeed () {\n if (keyIsDown(DOWN_ARROW) && !game.gamePaused) {\n frameRate(20)\n } else {\n frameRate(3)\n }\n}", "function setup(){\n frameRate(90);\n refresh(); //Line 104\n}", "function tick() {\n\n //make framecount always be a number between 0 to 600\n if (framecount<600) \n framecount++;\n else\n { \n flag++;\n framecount=framecount%600;\n }\n\n requestAnimFrame(tick);\n draw();\n animate();\n \n \n\n}", "function speedier() {\n //if (distance % 200 == 0 && distance != 0 && frameCount % 20 == 0) {\n if (meteorFrequency > 18) {\n meteorFrequency = round(meteorFrequency*.82);\n }\n //console.log(\"adding speed\");\n //console.log(\"Meteor Frequency: \" + meteorFrequency)\n //}\n}", "function onFrame(gl, event) {\n\t// Update player movement @ 60hz\n\t// The while ensures that we update at a fixed rate even if the rendering bogs down\n\tupdateFrame(event.frameTime,event);\n\tdrawFrame(gl,event);\n return 0;\n}", "function updateFramerateDisplay() {\n\tframerateDisplay.innerHTML = \"Time since last tick: \" + frameDuration + \"<br>Framerate: \" + currentFramerate + \"<br>High Framerate: \" + framerateHigh + \"<br>Low framerate: \" + framerateLow;\n}", "function update() {\n world.Step(\n 1 / 60 //frame-rate\n , 10 //velocity iterations\n , 10 //position iterations\n );\n world.DrawDebugData();\n world.ClearForces();\n\n requestAnimFrame(update);\n }", "function gameLoop() \n{\n window.requestAnimationFrame(gameLoop);\n var now = new Date().getTime();\n var dt = (now - (time || now))/FRAME_RATE;\n\tmyControl.updateGame(myGame,dt);\n time = now;\n \n\t//***DEBUGING text lines example\n //myControl.m_Dev.debugText(myGame.playState,50,50);\n}", "function render () {\n now = timestamp()\n dt = (now - last) / 1000 // to get time in seconds\n if (dt > 1 / 20) dt = (1 / 20) // will slow down time if framerate dips below 20fps\n last = now\n\n update(dt)\n renderer.render(scene, camera)\n window.requestAnimationFrame(render)\n}", "function frames(numFrames, numMins){\n return (numFrames*60) * numMins;\n }", "function StartGame(fps){\n var self = this;\n Initialize(self);\n //calls Update and Draw over and over\n setInterval(function(){Update(self);Draw(self);}, 1000/fps);\n}", "function startAnimating(fps) {\n fpsInterval = 1000 / fps;\n then = Date.now();\n animate();\n }", "function tick()\r\n {\r\n try\r\n {\r\n var now = new Date();\r\n var dt = Math.max(0, now - (last_frame_time || now)) / 1000;\r\n last_frame_time = now;\r\n // TODO: smoother updates, particularly on Windows where the timer\r\n // is limited to ~16msec resolution\r\n\r\n game.game_tick(gctx, w, h, keys, dt);\r\n if (game.render_ctx !== screen_ctx)\r\n {\r\n screen_ctx.drawImage(game.render_canvas, 0, 0);\r\n }\r\n\r\n profile_report();\r\n framerate_update();\r\n write_status_data(status_data);\r\n status_data.clear();\r\n game.cursor_move.clear();\r\n }\r\n catch (e)\r\n {\r\n debug(e);\r\n }\r\n }", "function main() {\n update((Date.now() - then) / 1000);\n if (game.images == game.imagesLoaded) {\n render();\n }\n then = Date.now();\n}", "function main() {\n /* Get our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n\n /* Call our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n update(dt);\n render();\n\n /* Set our lastTime variable which is used to determine the time delta\n * for the next time this function is called.\n */\n lastTime = now;\n\n /* Use the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n win.requestAnimationFrame(main);\n }", "function main() {\n /* Get our time delta information which is required if your game\n * requires smooth animation. Because everyone's computer processes\n * instructions at different speeds we need a constant value that\n * would be the same for everyone (regardless of how fast their\n * computer is) - hurray time!\n */\n var now = Date.now(),\n dt = (now - lastTime) / 1000.0;\n\n /* Call our update/render functions, pass along the time delta to\n * our update function since it may be used for smooth animation.\n */\n update(dt);\n render();\n\n /* Set our lastTime variable which is used to determine the time delta\n * for the next time this function is called.\n */\n lastTime = now;\n\n /* Use the browser's requestAnimationFrame function to call this\n * function again as soon as the browser is able to draw another frame.\n */\n win.requestAnimationFrame(main);\n }", "function increaseBallSpeed()\n{\n\tballSpeed = ballSpeed + (2 / numBlocks);\n}", "function drawFrame(frame) {\n\t\tvideo.currentTime = (frame.second > video.duration ? video.duration : frame.second);\n\t}", "function speed() {\n\tif (count < 5) {\n\t\treturn 700;\n\t} else if (count < 13) {\n\t\treturn 650;\n\t} else {\n\t\treturn 600;\n\t}\n}", "function setup() {\n createCanvas(600,400);\n frameRate(40);\n}" ]
[ "0.7572863", "0.71874315", "0.7010846", "0.6964547", "0.6928189", "0.68858063", "0.6867111", "0.6853093", "0.68528295", "0.6820719", "0.67642415", "0.67642415", "0.67642415", "0.6708033", "0.66997045", "0.66997045", "0.669287", "0.6682535", "0.6677085", "0.6666229", "0.66661614", "0.6644914", "0.6639598", "0.6626884", "0.66250414", "0.66111374", "0.66043586", "0.6604178", "0.65996003", "0.6594464", "0.65846413", "0.65777016", "0.6560387", "0.6557102", "0.6549918", "0.6548602", "0.65434605", "0.65344286", "0.65170115", "0.6514909", "0.6513462", "0.65093607", "0.6507645", "0.6507257", "0.6504655", "0.6502435", "0.6500655", "0.64930975", "0.64400077", "0.6438339", "0.6431142", "0.64257514", "0.64202744", "0.64119554", "0.64084774", "0.64031184", "0.64012915", "0.639117", "0.6386032", "0.63721746", "0.6359399", "0.63554674", "0.63554674", "0.63534623", "0.63421106", "0.63418657", "0.6340385", "0.6328437", "0.63094604", "0.63059545", "0.62990725", "0.62614006", "0.6255167", "0.62495726", "0.6249426", "0.62448436", "0.6242277", "0.6234292", "0.6204112", "0.62032425", "0.61996955", "0.6197274", "0.6189202", "0.61880374", "0.61840785", "0.6179182", "0.6178269", "0.6167621", "0.6157245", "0.61568654", "0.61566544", "0.6153625", "0.6153141", "0.6146963", "0.6145067", "0.6142224", "0.6142224", "0.6135454", "0.61353207", "0.61299163", "0.61281" ]
0.0
-1
call the constructor method
constructor(props) { //Call the constrictor of Super class i.e The Component super(props); //maintain the state required for this component this.state = { orders: "", filteredorders: "", orderStatusModal: false, idOrders: "", deliveryMode: "", status: "", currentPage: 1, itemsPerPage: 3, }; this.editOrderStatusHandler = this.editOrderStatusHandler.bind(this); this.statusChangeHandler = this.statusChangeHandler.bind(this); this.submitStatus = this.submitStatus.bind(this); this.onChange=this.onChange.bind(this); this.handleClick = this.handleClick.bind(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _construct()\n\t\t{;\n\t\t}", "function _ctor() {\n\t}", "constructur() {}", "function Constructor() {\n // All construction is actually done in the init method\n if ( this.initialize )\n this.initialize.apply(this, arguments);\n }", "function Constructor() {}", "function Constructor() {}", "function Constructor() {}", "consructor() {\n }", "function Ctor() {\r\n }", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){\r\n\t}", "constructor (){}", "constructor()\n {\n this.init();\n }", "constructor() {\n\t\t// ...\n\t}", "constructor() \n { \n \n\n }", "constructor(){\r\n }", "constructor() {\r\n // ohne Inhalt\r\n }", "constructor() {\n super();\n this._init();\n }", "constructor(){\r\n\r\n }", "constructor(){\n \n\n }", "function Ctor() {}", "constructor(){\n\n }", "constructor(){\n\n }", "function construct() { }", "constructor( ) {}", "constructor() {\r\n super()\r\n this.init()\r\n }", "constructor() {\n super()\n self = this\n self.init()\n }", "constructor() {\n this.init();\n }", "constructor () {\r\n\t\t\r\n\t}", "constructor() {\n \n }", "constructor(){\n\n }", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor() {}", "constructor(){\n this.init();\n }", "constructor() {\r\n\r\n\r\n }", "constructor() {\r\n }", "constructor() {\n\n }", "constructor() {\n\n }", "constructor() {\n this._initialize();\n }", "constructor() {\n }", "constructor() { \n\n }", "function Ctor() {\n\t// Empty...\n}", "constructor(){\n this.init();\n\n\n }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "init(){}", "constructor(args) {\n super(args);\n }", "constructor(args) {\n super(args);\n }", "constructor() {\n this.init();\n }", "constructor() {\n this.init();\n }", "constructor() {\n }", "constructor() {\n }", "constructor() {\n }" ]
[ "0.80362153", "0.79341316", "0.78611135", "0.7843023", "0.78206825", "0.78206825", "0.78206825", "0.76931036", "0.7557418", "0.7528882", "0.7528882", "0.7528882", "0.7528882", "0.7528882", "0.7528882", "0.7528882", "0.7507304", "0.74755096", "0.7461952", "0.7433301", "0.74325585", "0.742933", "0.7409472", "0.739988", "0.73989195", "0.7387864", "0.7385876", "0.73795193", "0.73795193", "0.7367825", "0.73472077", "0.73193896", "0.7299886", "0.7282577", "0.72229993", "0.7189171", "0.71819043", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.7181744", "0.71336216", "0.71257764", "0.708481", "0.7083789", "0.7083789", "0.70801175", "0.7075988", "0.7061682", "0.70561457", "0.7054258", "0.7051066", "0.7051066", "0.7051066", "0.7051066", "0.7051066", "0.7051066", "0.7051066", "0.7051066", "0.7051066", "0.7051066", "0.7051066", "0.70394677", "0.70187896", "0.70187896", "0.70148575", "0.70148575", "0.70116556", "0.70116556", "0.70116556" ]
0.0
-1
if this returns!=null, need to go back and reprocess
function resolveMovements(dir){ var moved=true; while(moved){ moved=false; for (var i=0;i<level.dat.length;i++) { var movementMask = level.movementMask[i]; if (movementMask!=0) { moved = repositionEntitiesAtCell(i) || moved; } } } var doUndo=false; for (var i=0;i<level.movementMask.length;i++) { var cellMask = level.dat[i]; var movementMask = level.movementMask[i]; if (movementMask!==0) { var rigidMovementAppliedMask = level.rigidMovementAppliedMask[i]; var movementMask_restricted = rigidMovementAppliedMask&movementMask; if (movementMask_restricted!==0) { //find what layer was restricted for (var j=0;j<6;j++) { var layerSection = parseInt("11111",2)&(movementMask_restricted>>(5*j)); if (layerSection!==0) { //this is our layer! var rigidGroupIndexMask = level.rigidGroupIndexMask[i]; var rigidGroupIndex = parseInt("11111",2)&(rigidGroupIndexMask>>(5*j)); rigidGroupIndex--;//group indices start at zero, but are incremented for storing in the bitfield var groupIndex = state.rigidGroupIndex_to_GroupIndex[rigidGroupIndex]; level.bannedGroup[groupIndex]=true; //backtrackTarget = rigidBackups[rigidGroupIndex]; doUndo=true; break; } } } for (var j=0;j<state.sfx_MovementFailureMasks.length;j++) { var o = state.sfx_MovementFailureMasks[j]; var objectMask = o.objectMask; if ((objectMask&cellMask)!==0) { var directionMask = o.directionMask; if ((movementMask&directionMask)!==0 && seedsToPlay_CantMove.indexOf(o.seed)===-1) { seedsToPlay_CantMove.push(o.seed); } } } } level.movementMask[i]=0; level.rigidGroupIndexMask[i]=0; level.rigidMovementAppliedMask[i]=0; } return doUndo; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "process(){\n return null;\n }", "function reflowContent() {\n\t\t\t}", "function skip() {\n return null;\n }", "Rewind() {}", "_postProcessing() {\n // None yet...\n }", "_onProcessReplaceableContent() {}", "if (/*ret DOES NOT contain any hint on the result (lock is cracked)*/) {\n break; //Break loop (since further attempts are not neccessary)\n }", "_reset() {}", "process () {\n const task = this.shift()\n\n if (task) {\n this.process()\n task.promise.finally(this.process.bind(this))\n }\n }", "tryMoveNext(out) {\n if (this.moveNext()) {\n out(this.current);\n return true;\n }\n return false;\n }", "analyze(){ return null }", "function processDuplicateFree(/* CODE HERE ONLY AFTER COMPLETING ALL OTHER TASKS */) {\n /* CODE HERE ONLY AFTER COMPLETING ALL OTHER TASKS */\n}", "function returnVoid() { }", "function processMove(){\n\t\tmyTile.pop();\n\t\ttryTile.push(obj);\n\t\tobj.move(x, y);\n\t\tmapGroup.addChild(obj);\n\t\treturn true;\n\t}", "dequeueInterruptOrPcb() {\n /// Strategy: Peek the root node / queue / whatever you want to call it\n /// if (root queue has more that one element) \n /// - just dequeue from the nested queue without modifying the min-heap\n /// else (root queue has one element left)\n /// - follow normal min-heap dequeue procedure\n var processControlBlockOrInterrupt = null;\n if (this.queues.length === 0) {\n return;\n } /// if\n if (this.queues[ROOT_NODE].q.length > 1) {\n TSOS.Control.hostLog('Peeking priority queue');\n processControlBlockOrInterrupt = this.queues[ROOT_NODE].dequeue();\n } /// if\n else if (this.queues[ROOT_NODE].q.length === 1) {\n TSOS.Control.hostLog('Removing a queue');\n /// Swap the root node with the bottom most left node (last node)\n /// Put value on the \"bottom-left\" most part of the heap...\n this.swapQueues(ROOT_NODE, this.queues.length - 1);\n /// Remove the last queue, that is now the highest priority node\n processControlBlockOrInterrupt = this.queues.pop().dequeue();\n /// Now bubble down the root queue (that is most likely not the highest priority queue)\n if (this.queues.length > 1) {\n this.bubbleDown(this.queues.length, ROOT_NODE);\n } /// if\n } /// else-if\n /// I would prefer overloaded methods because, well, yah...\n try {\n if (processControlBlockOrInterrupt instanceof TSOS.ProcessControlBlock) {\n TSOS.Control.hostLog(`Dequeued Pcb: ${processControlBlockOrInterrupt.processID}`);\n } /// if\n else if (processControlBlockOrInterrupt instanceof TSOS.Interrupt) {\n TSOS.Control.hostLog(`Dequeued Interrupt: ${processControlBlockOrInterrupt.irq}`);\n } /// else\n } /// try\n catch (e) { }\n return processControlBlockOrInterrupt;\n }", "function loadNothing() {\n return null;\n }", "unvoidLine() {\r\n\t\treturn null\r\n\t}", "replaceSucceeded() {}", "match(input){ return null }", "_tryRetarget(method, target, extra) {\n if (this._history[method]) {\n // if the last method wasnt even initialised, throw it away\n if (!this._history[method].caller.initialised) {\n let index = this._queue.indexOf(this._history[method].caller);\n\n this._queue.splice(index, 1);\n\n return false;\n } // for the case of transformations, we use the special retarget function\n // which has access to the outer scope\n\n\n if (this._history[method].caller.retarget) {\n this._history[method].caller.retarget(target, extra); // for everything else a simple morpher change is sufficient\n\n } else {\n this._history[method].morpher.to(target);\n }\n\n this._history[method].caller.finished = false;\n var timeline = this.timeline();\n timeline && timeline.play();\n return true;\n }\n\n return false;\n }", "function process() {\n\tlet p;\n\twhile ((p=q.pop())) {\n\t\tif (p._dirty) p.forceUpdate();\n\t}\n}", "async _recoverIfPossible() {\n log.error('Editor gave up!');\n\n const newInfo = await this._recover(this._editorComplex.docSession.sessionInfo);\n\n if (typeof newInfo !== 'string') {\n log.info('Nothing more to do. :\\'(');\n return;\n }\n\n log.info('Attempting recovery with new session info...');\n const sessionInfo = this._parseInfo(newInfo);\n this._editorComplex.connectNewSession(sessionInfo);\n this._recoverySetup();\n }", "_mining(){\n return false;\n }", "prepareForOutput(result) {\n result = model.prepareForFullOutput(result)\n delete result.results\n return result\n }", "function orderSetProcessed(){\n\ttry{\n\n\t\t\n\t}catch(e){\n\t}\n}", "transient private protected internal function m182() {}", "peek() {\n // console.log(\"This is the peek\", this.processes[0]);\n if (this.processes[0] !== undefined) {\n\n return this.processes[0];\n };\n\n return this.processes[0];\n }", "snoopWriteMiss(tag) {\r\n //console.log('DEBUG ' + this.name + '.snoopWriteMiss(tag=' + tag + ')')\r\n let lineNum = this.lineInCache(tag)\r\n if(lineNum == null) {\r\n //console.log('DEBUG ' + this.name + ': not in this cache')\r\n return null\r\n } else {\r\n //console.log('DEBUG ' + this.name + ': found in this cache')\r\n\t let values = this.getValues(lineNum)\r\n // no write back is necessary, because cache line moves from this cache to writing cache\r\n //if(line.state == States.MODIFIED) {\r\n // console.log('DEBUG ' + this.name + ': and is modified, so write back to memory')\r\n // this.bus.placeWriteBack(tag, this.numberOfAddressBits, line.values)\r\n //}\r\n\t \r\n\t this.setState(lineNum, States.INVALID)\r\n return values\r\n }\r\n }", "function handleBacklog() {\n var item = backlog.shift();\n if (item !== undefined) {\n console.log('from cache');\n // handle this single item\n realget(item.url, item.callback);\n } \n if (backlog.length === 0) {\n // if the backlog is empty \n // use realget for the next call\n getfunction = realget;\n }\n }", "function reset() {\n\t\t\treturn go(0);\n\t\t}", "redo(nothrow) {\n let okay= false;\n const act= this.revoked.pop(nothrow);\n if (act) {\n this.applied.push(act).apply(this.vm);\n ++this.changed;\n okay= true;\n }\n return okay;\n }", "dequeue() {\n return this.processes.shift();\n // console.log('dequeu',this.processes[0]);\n }", "queuePrev(customData) {\n return Native.queuePrev(customData);\n }", "snoopWriteMiss(tag) {\r\n //console.log('DEBUG ' + this.name + '.snoopWriteMiss(tag=' + tag + ')')\r\n let lineNum = this.lineInCache(tag)\r\n if(lineNum == null) {\r\n //console.log('DEBUG ' + this.name + ': not in this cache')\r\n return null\r\n } else {\r\n //console.log('DEBUG ' + this.name + ': found in this cache')\r\n //let line = this.cacheLines[lineNum]\r\n\t let values = this.getValues(lineNum)\r\n // no write back is necessary, because cache line moves from this cache to writing cache\r\n //if(line.state == States.MODIFIED) {\r\n // console.log('DEBUG ' + this.name + ': and is modified, so write back to memory')\r\n // this.bus.placeWriteBack(tag, this.numberOfAddressBits, line.values)\r\n //}\r\n\t this.setState(lineNum, States.INVALID)\r\n return values\r\n }\r\n }", "isDirty() {\r\n\r\n // resume\r\n return false;\r\n }", "if (/*ret DOES NOT contain any hint on any of the arguments (lock is cracked)*/) {\n break; //Break loop (since further attempts are not neccessary)\n }", "AllowNullMove (bb) { isNullMove = bb; }", "if (nextState.pageSize === rowCount && nextState.currentPage === 1) {\n return null;\n }", "async _recoverIfPossible() {\n log.error('Editor gave up!');\n\n const newKey = await this._recover(this._editorComplex.docSession.key);\n\n if (typeof newKey !== 'string') {\n log.info('Nothing more to do. :\\'(');\n return;\n }\n\n log.info('Attempting recovery with new key...');\n const sessionKey = this._parseAndFixKey(newKey);\n this._editorComplex.connectNewSession(sessionKey);\n this._recoverySetup();\n }", "analyze(input){ return null }", "_processQueue() {\n // eslint-disable-next-line no-empty\n while (this._tryToStartAnother()) { }\n }", "_processQueue() {\n // eslint-disable-next-line no-empty\n while (this._tryToStartAnother()) { }\n }", "redo(self) {\n let toRedo = {};\n\n if (this.undidStack.length == 0) return;\n toRedo = this.undidStack.splice(this.undidStack.length - 1, 1)[0];\n toRedo.do(self);\n this.didStack.push(toRedo);\n\n //Now check to see if the following ones can also be redone\n while (this.undidStack.length != 0 && this.undidStack[this.undidStack.length - 1].includeWithPrevious) {\n toRedo = this.undidStack.splice(this.undidStack.length - 1, 1)[0];\n toRedo.do(self);\n this.didStack.push(toRedo);\n }\n\n\n }", "_recover(error) {\n if (this._stopped) return;\n\n if (this.tasks.length > 0) {\n const task = this.__next;\n task.recover(error);\n if (!task.running && !task.done) {\n this._resetCurrent(true);\n\n super._recover(error);\n }\n } else {\n this._complete();\n }\n }", "preorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "_processQueue() {\n // eslint-disable-next-line no-empty\n while (this._tryToStartAnother()) {}\n }", "peekFirst() {\n return null;\n }", "function ignore() {\n return null\n }", "snoopWriteMiss(tag) {\r\n //console.log('DEBUG ' + this.name + '.snoopWriteMiss(tag=' + tag + ')')\r\n let lineNum = this.lineInCache(tag)\r\n if(lineNum == null) {\r\n //console.log('DEBUG ' + this.name + ': not in this cache')\r\n return null\r\n } else {\r\n //console.log('DEBUG ' + this.name + ': found in this cache')\r\n\t let values = this.getValues(lineNum)\r\n // no write back is necessary\r\n\t //, because cache line moves from this cache to writing cache\r\n\t this.setState(lineNum, States.INVALID)\r\n return values\r\n }\r\n }", "snoopWriteMiss(tag) {\r\n //console.log('DEBUG ' + this.name + '.snoopWriteMiss(tag=' + tag + ')')\r\n let lineNum = this.lineInCache(tag)\r\n if(lineNum == null) {\r\n //console.log('DEBUG ' + this.name + ': not in this cache')\r\n return null\r\n } else {\r\n //console.log('DEBUG ' + this.name + ': found in this cache')\r\n\t let values = this.getValues(lineNum)\r\n // no write back is necessary\r\n\t //, because cache line moves from this cache to writing cache\r\n\t this.setState(lineNum, States.INVALID)\r\n return values\r\n }\r\n }", "_maybeMigrate() {\n var self = this;\n\n if (self._retryMigrate && self._readyToMigrate()) {\n self._retryMigrate();\n\n self._retryMigrate = null;\n }\n }", "function BOT_reqApplicationPostProcessing () {\r\n\treturn;\r\n}", "private internal function m248() {}", "finishedReconstruction() {\n this.reconPack = null;\n this.buffers = [];\n }", "if (newFirstUpdate === null) {\n // This is the first skipped update. It will be the first update in\n // the new list.\n newFirstUpdate = update;\n // Since this is the first update that was skipped, the current result\n // is the new base state.\n newBaseState = resultState;\n }", "reset() {\n if (!pr.loading) {\n pr.reset();\n }\n }", "reset() {\n if (!pr.loading) {\n pr.reset();\n }\n }", "function checkDone() {\r\n\t\t\tif (todo===0) {\r\n\t\t\t\tresultCallback(unmarshalledTable);\r\n\t\t\t}\r\n\t\t}", "transient private internal function m185() {}", "unfinished() {\r\n\t\t\t\tvar ref;\r\n\t\t\t\treturn LINE_CONTINUER.test(this.chunk) || (ref = this.tag(), indexOf.call(UNFINISHED, ref) >= 0);\r\n\t\t\t}", "peekLast() {\n return null;\n }", "process(res) {\n if (res.params.skip && res.params.skip.some(item => item === res.data.resCode)) {\n res.ok = true;\n } else if (this[res.data.resCode]) {\n res.ok = this[res.data.resCode](res);\n } else if (res.data.res === eid.err.type) {\n // Unknown error\n res.ok = false;\n logger.error(res);\n this.eUnknown();\n } else if (res.data.res === eid.warn.type) {\n // Unknown warn\n res.ok = true;\n logger.warn(res);\n } else {\n res.ok = true;\n logger.info(res.data);\n }\n }", "_calculateHasSource(source){if(source&&\"\"!=source){return!0}this.source=null;return!1}", "protected internal function m252() {}", "if (newFirstCapturedUpdate === null) {\n // This is the first skipped captured update. It will be the first\n // update in the new list.\n newFirstCapturedUpdate = update;\n // If this is the first update that was skipped, the current result is\n // the new base state.\n if (newFirstUpdate === null) {\n newBaseState = resultState;\n }\n }", "function iNull() {\n\tresultHandle();\n\tiClose();\n}", "function revertChanges() {\n if (typeof db.getItem(savedData) !== 'undefined' && db.getItem(savedData) !== 'undefined' && db.getItem(savedData) !== 'null' && db.getItem(savedData) != null && db.getItem(savedData) !== \"\") {\n mainP.innerHTML = db.getItem(savedData);\n //makeEditable();\n sanitizeItems();\n };\n }", "function process() {\n // schaut in lokaler varable nach, ob ich am arbeiten bin oder nicht, falls ich am arbeiten bin mache ich ein return\n // wenn ich schon am arbeiten bin, dann passiert garnichts\n if (inProcess) { return; }\n if (tasks.length === 0) { return; } // guard clause\n inProcess = true; // habe etwas zu tun, signalisiere, dass ich am arbeiten bin\n const task = tasks.pop(); // hole mit pop das letzte element aus der taskliste\n\n\n // rufe in asynchron auf, kein zugriff auf reject\n new Promise( (resolve, reject) => {\n task(resolve);\n }). then ( () => {\n inProcess = false;\n process();\n });\n }", "function processOne() {\n\t\t\t\tvar item = array.pop();\n\t\t\t\tfn(item, function(result, err) {\n\t\t\t\t\tif (array.length > 0) {\n\t\t\t\t\t\tprocessOne();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcallback(result, err);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}", "__init3() {this._finished = false;}", "__init3() {this._finished = false;}", "__init3() {this._finished = false;}", "reset() {}", "reset() {}", "reset() {}", "_process(promise) {\n\t this._numProcessing += 1;\n\t void promise.then(\n\t value => {\n\t this._numProcessing -= 1;\n\t return value;\n\t },\n\t reason => {\n\t this._numProcessing -= 1;\n\t return reason;\n\t },\n\t );\n\t }", "function emptyReturn() {return;}", "postorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "function loadNext() {\n if (srcSetObj.callback) { srcSetObj.callback(); }\n thisObj.sourceFileSetQueue.shift();\n if (thisObj.sourceFileSetQueue.length > 0) {\n thisFn.call(thisObj, thisObj.sourceFileSetQueue[0]);\n } else {\n thisObj.sourceFileSetQueue.isRunning = false;\n } \n }", "finishedReconstruction() {\n this.reconPack = null;\n this.buffers = [];\n }", "_resetStates() {\r\n this._queue = null;\r\n this._ignoredLine = false;\r\n this._nextTarget = null;\r\n this._wait = false;N\r\n this._endScript = false;\r\n }", "snoopInvalidate(tag) {\r\n //console.log('DEBUG ' + this.name + '.snoopInvalidate(tag=' + tag + ')')\r\n let lineNum = this.lineInCache(tag)\r\n if(lineNum == null) {\r\n //console.log('DEBUG ' + this.name + ': not in this cache')\r\n } else {\r\n //console.log('DEBUG ' + this.name + ': found in this cache')\r\n //let line = this.cacheLines[lineNum]\r\n\t \r\n if(this.getState(lineNum) == States.MODIFIED) {\r\n //console.log('DEBUG ' + this.name + ': and is modified, so write back to memory')\r\n\t\tlet values = this.getValues(lineNum)\r\n this.bus.placeWriteBack(tag, this.numberOfAddressBits, values)\r\n }\r\n this.setState(lineNum, States.INVALID)\r\n }\r\n }", "release(){\n\t\tthis.current = Math.max(this.current - 1, 0);\n\t\t// ...execute the first in line from the waiting list.\n\t\treturn this.wait(this.waiting.shift());\n\t}", "voidLine() {\r\n\t\treturn null\r\n\t}", "_getResult() {\n\t\treturn null;\n\t}", "parseDone(data, flag) {\n //console.log(\"DracoTask::parseDone(), data.taskCmd: \", data.taskCmd);\n console.log(\"DracoTask::parseDone(), data: \", data);\n DracoSendData.RestoreByUid(data.dataIndex);\n\n switch (data.taskCmd) {\n case \"DRACO_INIT\":\n this.m_enabled = true;\n DracoTask.s_inited = true;\n\n if (DracoTask.s_initedTaskTotal >= DracoTask.s_taskTotal) {\n this.m_wasmBin = data.data;\n\n if (this.m_segIndex == 0 && this.m_segs != null && this.m_segs.length > 0) {\n this.parseNextSeg();\n }\n } else {\n this.initCurrTask(data.data, DracoTask.s_initedTaskTotal);\n }\n\n DracoTask.s_initedTaskTotal++;\n break;\n\n case \"DRACO_PARSE\":\n this.m_enabled = true;\n this.m_threadTask.increaseParseIndex();\n this.m_modules.push(data.data.module);\n\n if (this.m_listener != null) {\n console.log(\"this.m_threadTask.isFinished(): \", this.m_threadTask.isFinished());\n\n if (this.m_threadTask.isFinished()) {\n this.m_listener.dracoParseFinish(this.m_modules, this.m_threadTask.getParseTotal());\n } else {\n this.parseNextSeg();\n this.m_listener.dracoParse(data.data.module, this.m_threadTask.getParsedIndex(), this.m_threadTask.getParseTotal());\n }\n }\n\n break;\n\n default:\n break;\n }\n\n return true;\n }", "function meshReap(self)\n{\n function del(who, why)\n {\n if(who.line) delete self.lines[who.line];\n delete self.seen[who.hashname];\n debug(\"reaping \", who.hashname, why);\n }\n Object.keys(self.seen).forEach(function(h){\n var hn = self.seen[h];\n if(!hn.sentAt) return; // TODO never if these are from app? remove old ones from .see hints?\n if(!hn.recvAt) {\n if(Date.now() - hn.at > 120*1000) return del(hn, \"sent, never received, older than 2min\");\n return; // allow non-response for up to 2min\n }\n if(Date.now() - hn.sentAt > 60*1000) return del(hn, \"we stopped sending to them for more than 1min\");\n if(hn.sentAt - hn.recvAt > 60*1000) return del(hn, \"no response in 30sec\");\n });\n}", "process(raw_item) {\n return raw_item;\n }", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [];\n\t\t\t\terrors = [];\n\t\t\t}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [];\n\t\t\t\terrors = [];\n\t\t\t}", "function doStep()\n\t\t\t{\n\t\t\t\tstep(returnable());\n\t\t\t\tdata = [];\n\t\t\t\terrors = [];\n\t\t\t}", "@action\n undo() {\n // Always have initial data snapshot\n if (this.snapshots.length < 2) {\n return null;\n }\n\n this.snapshots.shift();\n this.fields.replace(this.snapshots[0]);\n\n return true;\n }", "function ignore() {\n return null;\n}", "fullReset() {\n this._parser.reset();\n this._onRequestReset.fire();\n return true;\n }", "snoopInvalidate(tag) {\r\n //console.log('DEBUG ' + this.name + '.snoopInvalidate(tag=' + tag + ')')\r\n let lineNum = this.lineInCache(tag)\r\n if(lineNum == null) {\r\n //console.log('DEBUG ' + this.name + ': not in this cache')\r\n } else {\r\n //console.log('DEBUG ' + this.name + ': found in this cache')\r\n if(this.getState(lineNum) == States.MODIFIED) {\r\n\t\tlet values = this.getValues(lineNum)\r\n //console.log('DEBUG ' + this.name + ': and is modified, so write back to memory')\r\n this.bus.placeWriteBack(tag, this.numberOfAddressBits, values)\r\n }\r\n\t this.setState(lineNum, States.INVALID)\r\n }\r\n }", "snoopInvalidate(tag) {\r\n //console.log('DEBUG ' + this.name + '.snoopInvalidate(tag=' + tag + ')')\r\n let lineNum = this.lineInCache(tag)\r\n if(lineNum == null) {\r\n //console.log('DEBUG ' + this.name + ': not in this cache')\r\n } else {\r\n //console.log('DEBUG ' + this.name + ': found in this cache')\r\n if(this.getState(lineNum) == States.MODIFIED) {\r\n\t\tlet values = this.getValues(lineNum)\r\n //console.log('DEBUG ' + this.name + ': and is modified, so write back to memory')\r\n this.bus.placeWriteBack(tag, this.numberOfAddressBits, values)\r\n }\r\n\t this.setState(lineNum, States.INVALID)\r\n }\r\n }", "function backFunction(ctx,next) {\n Events.resetAll();\n next();\n}", "function processOne() {\n var item = array.pop();\n fn(item, function(result, err) {\n if (array.length > 0) {\n processOne();\n } else {\n callback(result, err);\n }\n });\n }", "process() {}", "process() {}", "function recusion() {\n // some serious code\n recusion();\n}" ]
[ "0.65821373", "0.5725703", "0.5591418", "0.5571777", "0.5411897", "0.5408327", "0.53868663", "0.53556263", "0.52832", "0.52642417", "0.51549935", "0.51361966", "0.51334184", "0.5128336", "0.5123329", "0.5109923", "0.51048267", "0.50990194", "0.5075524", "0.5074784", "0.5064589", "0.5063869", "0.5062465", "0.50545466", "0.5041915", "0.5010204", "0.5009227", "0.50004053", "0.4999894", "0.4999874", "0.49955103", "0.49931657", "0.4984187", "0.49718556", "0.49584037", "0.49478632", "0.49441823", "0.49429", "0.49387684", "0.4925588", "0.49253646", "0.49253646", "0.49174145", "0.49067074", "0.49051735", "0.4886333", "0.48720035", "0.48682362", "0.48574606", "0.48574606", "0.4856569", "0.4850949", "0.4848672", "0.48438874", "0.48359418", "0.483253", "0.483253", "0.4830113", "0.48257095", "0.48211423", "0.48202652", "0.4816746", "0.48088905", "0.48073506", "0.4807157", "0.479129", "0.47811824", "0.47646868", "0.47634667", "0.47623512", "0.47623512", "0.47623512", "0.47586662", "0.47586662", "0.47586662", "0.47571597", "0.4756921", "0.4755847", "0.47538126", "0.47520918", "0.4749876", "0.4749089", "0.47452056", "0.4737671", "0.47355378", "0.47349793", "0.47330534", "0.4730889", "0.47297075", "0.47297075", "0.47297075", "0.47230494", "0.47228795", "0.47207478", "0.47162214", "0.47162214", "0.47131246", "0.47130463", "0.47068244", "0.47068244", "0.47036457" ]
0.0
-1
Look for '.stories' in __stories__ folders in src
function loadStories() { require('../src/components/__stories__/welcome'); // Load welcom page first req.keys().forEach(filename => req(filename)); // get all stories from context }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStories({ pkg, dir = \"components\" }) {\n const dirName = `packages/${dir}`\n const scope = pkg ? [pkg] : fs.readdirSync(dirName)\n return scope\n .map((pkg) => `${dirName}/${pkg}/stories`)\n .filter((storyDir) => fs.existsSync(storyDir))\n .map((storyDir) => `../${storyDir}/*.stories.tsx`)\n}", "function loadStories() {\n require(\"../index.stories\");\n}", "function loadStories() {\n const req = require.context('../src/storybook', true, /\\.stories\\.jsx$/)\n req.keys().forEach(filename => req(filename))\n}", "function loadStories() {\n const req = require.context(__PACKAGES__, true, /story\\.jsx$/);\n req.keys().forEach(filename => req(filename));\n}", "function loadStories() {\n require('../app/components/avatars/avatars.stories');\n require('../app/components/loading.stories');\n}", "function loadStories() {\n // You can require as many stories as you need.\n require('../src/stories/button');\n require('../src/stories/form');\n require('../src/stories/pagination');\n}", "function loadStories() {\n require('./welcomeStory');\n require('../stories');\n // req.keys().forEach(filename => req(filename));\n}", "function localPackageHasStorybooks(pkg) {\n const storybookPath = path.join(__dirname, 'packages', pkg, 'stories');\n return fs.existsSync(storybookPath);\n}", "function loadStories() {\n require(\"./welcomeStory\");\n req.keys().forEach(file => req(file));\n}", "function setupEachStory (modulePath) {\n const packageReadmePath = modulePath.replace(\n 'src/.stories.js',\n 'readme.md'\n );\n const readme = readmes[packageReadmePath];\n\n // Setup each story to have a readme in it, when available, regardless of if\n // the consumer uses a HeidiStorybook.\n const storiesOf = (name, ...args) => {\n if (!args[0]) args[0] = module;\n let story = storybook.storiesOf(name, ...args);\n story.addDecorator(insertAppLikeGlobalCSS);\n if (readme) {\n story = story.addDecorator(withReadme(readme));\n }\n story = story.addDecorator(knobs.withKnobs);\n return story;\n };\n\n const _storybook = Object.assign({}, storybook, { storiesOf });\n stories[modulePath].default(_storybook, addons);\n }", "function initializeExistingStoriesView(stories) {\n $(\"#stories\").html(story(stories));\n}", "constructor({\n storyStore\n } = {}) {\n this.facade = void 0;\n this.storyStore = void 0;\n this.addons = void 0;\n this.onImportFnChanged = void 0;\n this.lastFileName = 0;\n this.setAddon = deprecate(addon => {\n this.addons = Object.assign({}, this.addons, addon);\n }, dedent`\n \\`setAddon\\` is deprecated and will be removed in Storybook 7.0.\n\n https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-setaddon\n `);\n\n this.addDecorator = decorator => {\n this.facade.projectAnnotations.decorators.push(decorator);\n };\n\n this.clearDecorators = deprecate(() => {\n this.facade.projectAnnotations.decorators = [];\n }, dedent`\n \\`clearDecorators\\` is deprecated and will be removed in Storybook 7.0.\n\n https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-cleardecorators\n `);\n\n this.addParameters = (_ref) => {\n let {\n globals,\n globalTypes\n } = _ref,\n parameters = _objectWithoutPropertiesLoose(_ref, [\"globals\", \"globalTypes\"]);\n\n this.facade.projectAnnotations.parameters = combineParameters(this.facade.projectAnnotations.parameters, parameters);\n\n if (globals) {\n this.facade.projectAnnotations.globals = Object.assign({}, this.facade.projectAnnotations.globals, globals);\n }\n\n if (globalTypes) {\n this.facade.projectAnnotations.globalTypes = Object.assign({}, this.facade.projectAnnotations.globalTypes, normalizeInputTypes(globalTypes));\n }\n };\n\n this.addLoader = loader => {\n this.facade.projectAnnotations.loaders.push(loader);\n };\n\n this.addArgsEnhancer = enhancer => {\n this.facade.projectAnnotations.argsEnhancers.push(enhancer);\n };\n\n this.addArgTypesEnhancer = enhancer => {\n this.facade.projectAnnotations.argTypesEnhancers.push(enhancer);\n };\n\n this.storiesOf = (kind, m) => {\n if (!kind && typeof kind !== 'string') {\n throw new Error('Invalid or missing kind provided for stories, should be a string');\n }\n\n if (!m) {\n logger.warn(`Missing 'module' parameter for story with a kind of '${kind}'. It will break your HMR`);\n }\n\n if (m) {\n const proto = Object.getPrototypeOf(m);\n\n if (proto.exports && proto.exports.default) {\n // FIXME: throw an error in SB6.0\n logger.error(`Illegal mix of CSF default export and storiesOf calls in a single file: ${proto.i}`);\n }\n } // eslint-disable-next-line no-plusplus\n\n\n const baseFilename = m && m.id ? `${m.id}` : (this.lastFileName++).toString();\n let fileName = baseFilename;\n let i = 1; // Deal with `storiesOf()` being called twice in the same file.\n // On HMR, `this.csfExports[fileName]` will be reset to `{}`, so an empty object is due\n // to this export, not a second call of `storiesOf()`.\n\n while (this.facade.csfExports[fileName] && Object.keys(this.facade.csfExports[fileName]).length > 0) {\n i += 1;\n fileName = `${baseFilename}-${i}`;\n }\n\n if (m && m.hot && m.hot.accept) {\n // This module used storiesOf(), so when it re-runs on HMR, it will reload\n // itself automatically without us needing to look at our imports\n m.hot.accept();\n m.hot.dispose(() => {\n this.facade.clearFilenameExports(fileName); // We need to update the importFn as soon as the module re-evaluates\n // (and calls storiesOf() again, etc). We could call `onImportFnChanged()`\n // at the end of every setStories call (somehow), but then we'd need to\n // debounce it somehow for initial startup. Instead, we'll take advantage of\n // the fact that the evaluation of the module happens immediately in the same tick\n\n setTimeout(() => {\n var _this$onImportFnChang;\n\n (_this$onImportFnChang = this.onImportFnChanged) === null || _this$onImportFnChang === void 0 ? void 0 : _this$onImportFnChang.call(this, {\n importFn: this.importFn.bind(this)\n });\n }, 0);\n });\n }\n\n let hasAdded = false;\n const api = {\n kind: kind.toString(),\n add: () => api,\n addDecorator: () => api,\n addLoader: () => api,\n addParameters: () => api\n }; // apply addons\n\n Object.keys(this.addons).forEach(name => {\n const addon = this.addons[name];\n\n api[name] = (...args) => {\n addon.apply(api, args);\n return api;\n };\n });\n const meta = {\n id: sanitize(kind),\n title: kind,\n decorators: [],\n loaders: [],\n parameters: {}\n }; // We map these back to a simple default export, even though we have type guarantees at this point\n\n this.facade.csfExports[fileName] = {\n default: meta\n };\n let counter = 0;\n\n api.add = (storyName, storyFn, parameters = {}) => {\n hasAdded = true;\n\n if (typeof storyName !== 'string') {\n throw new Error(`Invalid or missing storyName provided for a \"${kind}\" story.`);\n }\n\n if (!storyFn || Array.isArray(storyFn) || invalidStoryTypes.has(typeof storyFn)) {\n throw new Error(`Cannot load story \"${storyName}\" in \"${kind}\" due to invalid format. Storybook expected a function/object but received ${typeof storyFn} instead.`);\n }\n\n const {\n decorators,\n loaders,\n component,\n args,\n argTypes\n } = parameters,\n storyParameters = _objectWithoutPropertiesLoose(parameters, [\"decorators\", \"loaders\", \"component\", \"args\", \"argTypes\"]); // eslint-disable-next-line no-underscore-dangle\n\n\n const storyId = parameters.__id || toId(kind, storyName);\n const csfExports = this.facade.csfExports[fileName]; // Whack a _ on the front incase it is \"default\"\n\n csfExports[`story${counter}`] = {\n name: storyName,\n parameters: Object.assign({\n fileName,\n __id: storyId\n }, storyParameters),\n decorators,\n loaders,\n args,\n argTypes,\n component,\n render: storyFn\n };\n counter += 1;\n this.facade.stories[storyId] = {\n id: storyId,\n title: csfExports.default.title,\n name: storyName,\n importPath: fileName\n };\n return api;\n };\n\n api.addDecorator = decorator => {\n if (hasAdded) throw new Error(`You cannot add a decorator after the first story for a kind.\nRead more here: https://github.com/storybookjs/storybook/blob/master/MIGRATION.md#can-no-longer-add-decoratorsparameters-after-stories`);\n meta.decorators.push(decorator);\n return api;\n };\n\n api.addLoader = loader => {\n if (hasAdded) throw new Error(`You cannot add a loader after the first story for a kind.`);\n meta.loaders.push(loader);\n return api;\n };\n\n api.addParameters = (_ref2) => {\n let {\n component,\n args,\n argTypes\n } = _ref2,\n parameters = _objectWithoutPropertiesLoose(_ref2, [\"component\", \"args\", \"argTypes\"]);\n\n if (hasAdded) throw new Error(`You cannot add parameters after the first story for a kind.\nRead more here: https://github.com/storybookjs/storybook/blob/master/MIGRATION.md#can-no-longer-add-decoratorsparameters-after-stories`);\n meta.parameters = combineParameters(meta.parameters, parameters);\n if (component) meta.component = component;\n if (args) meta.args = Object.assign({}, meta.args, args);\n if (argTypes) meta.argTypes = Object.assign({}, meta.argTypes, argTypes);\n return api;\n };\n\n return api;\n };\n\n this.getStorybook = () => {\n const {\n stories\n } = this.storyStore.storyIndex;\n const kinds = {};\n Object.entries(stories).forEach(([storyId, {\n title,\n name,\n importPath\n }]) => {\n if (!kinds[title]) {\n kinds[title] = {\n kind: title,\n fileName: importPath,\n stories: []\n };\n }\n\n const {\n storyFn\n } = this.storyStore.fromId(storyId);\n kinds[title].stories.push({\n name,\n render: storyFn\n });\n });\n return Object.values(kinds);\n };\n\n this.raw = () => {\n return this.storyStore.raw();\n };\n\n this.facade = new StoryStoreFacade();\n this.addons = {};\n this.storyStore = storyStore;\n singleton = this;\n }", "stories() {\n return this._stories;\n }", "function getStorylinesSlugs(storyPath, storylinesFolder) {\n var dir = path.join(storyPath, storylinesFolder);\n if (!isValidDir(dir)) {\n throw new Error(`'${dir}' is not a valid directory`);\n }\n return fs.readdirSync(dir).filter(name => helpers.isSlug(name) && (fs.lstatSync(path.join(dir, name)).isDirectory()));\n}", "function loadStories() {\n loadContext(introContext);\n loadContext(libraryContext);\n}", "getStory(slug) {\n return this.storyapi\n .get('cdn/stories/' + slug, {\n version,\n })\n .catch((error) => console.log(error));\n }", "get(storyId) {\n return this._get(`/stories/${storyId}/`)\n }", "function loadStories() {\n req.keys().forEach(filename => req(filename));\n}", "function Stories(props) {\n return (\n <div>\n stories component\n </div>\n )\n}", "function loadStories() {\n req.keys().forEach((filename) => req(filename));\n}", "async function generateStories() {\n // get an instance of StoryList\n const storyListInstance = await StoryList.getStories();\n // update our global variable\n storyList = storyListInstance;\n // empty out that part of the page\n $allStoriesList.empty();\n\n // loop through all stories and generate HTML for them, adding appropriate star class as necessary\n starClassForStories(storyList.stories, $allStoriesList);\n }", "async webpackFinal(config) {\n\n // Uncomment the following statement to log the full webpack config\n // or add ```--debug-webpack``` to the npm script ```build-storybook```\n // console.dir(config, { depth: null }) || config\n\n config.module.rules = removeStyleLoaderFile(config.module.rules);\n\n // source-maps\n config.devtool = false;\n\n // Configure splitChunks plugin\n config.optimization.splitChunks = {\n chunks: 'all',\n minSize: 30000,\n maxSize: 100 * 1000,\n minChunks: 1,\n maxAsyncRequests: 6,\n maxInitialRequests: 4,\n automaticNameDelimiter: '~',\n automaticNameMaxLength: 30,\n cacheGroups: {\n defaultVendors: {\n test: /[\\\\/]node_modules[\\\\/]/,\n priority: -10\n },\n default: {\n minChunks: 2,\n priority: -20,\n reuseExistingChunk: true\n }\n }\n };\n\n config.entry.push(path.join(__dirname, OUTPUT_DIR, `${PROJECT_NAME}.js`));\n fs.readdirSync(path.join(__dirname, OUTPUT_DIR, 'collection/components')).map(file => {\n const jsFilePath = path.join(__dirname, OUTPUT_DIR, `collection/components/${file}/${file}.js`);\n try {\n if (fs.existsSync(jsFilePath)) {\n config.entry.push(jsFilePath);\n }\n } catch (err) {\n console.error(err);\n }\n\n // Add CSS\n let cssFilePath = path.join(\n __dirname,\n OUTPUT_DIR,\n `collection/components/${file}/${file}.css`\n );\n try {\n if (fs.existsSync(cssFilePath)) {\n config.entry.push(cssFilePath);\n }\n } catch (err) {\n console.error(err);\n }\n });\n\n // Add all static files to Storybook\n config.plugins.push(\n new CopyPlugin([\n {\n from: '**/*',\n to: './',\n context: 'dist',\n },\n ])\n );\n\n // Write the files to disk and not to memory\n config.plugins.push(new WriteFilePlugin());\n\n return config;\n }", "function navAllStories (evt) {\n\tconsole.debug('navAllStories', evt);\n\thidePageComponents(); // located in main.js\n\tputStoriesOnPage(); // located in stories.js\n\tupdateNavOnLogin();\n}", "function getSourceFiles(src, middlemanSrc) {\n\n var sourceFile = grunt.file.read(src, {\n encoding: 'utf-8'\n }),\n requires = sourceFile.split(/= require/i).filter(function (str) {\n return str.match(/\"/);\n }).map(function (str) {\n\n var filepath = middlemanSrc + str.split('\\\"')[1] + (str.indexOf('.js') === -1 ? '.js' : ''),\n exists = grunt.file.exists(filepath);\n\n grunt.log.writeln('parsed file: \\\"' + filepath + '\\\"');\n if (!exists) {\n grunt.fail.warn('\\\"' + filepath + '\\\" doesn\\'t exists!');\n }\n return filepath;\n });\n\n grunt.log.ok();\n\n return requires;\n }", "function getSourceFiles(src, middlemanSrc) {\n\n var sourceFile = grunt.file.read(src, {\n encoding: \"utf-8\"\n }),\n requires = sourceFile.split(/= require/i).filter(function (str) {\n return str.match(/\"/);\n }).map(function (str) {\n\n var filepath = middlemanSrc + str.split(\"\\\"\")[1] + (str.indexOf('.js') === -1 ? '.js' : ''),\n exists = grunt.file.exists(filepath);\n\n grunt.log.writeln(\"parsed file: \\\"\" + filepath + \"\\\"\");\n if (!exists) {\n grunt.fail.warn(\"\\\"\" + filepath + \"\\\" doesn't exists!\");\n }\n return filepath;\n });\n\n grunt.log.ok();\n\n return requires;\n }", "async function generateStories() {\n // get an instance of StoryList\n const storyListInstance = await StoryList.getStories();\n // update our global variable\n storyList = storyListInstance;\n // empty out that part of the page\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const result = generateStoryHTML(story, false);\n $allStoriesList.append(result);\n }\n }", "function getEventsSlugs(storyPath, storylinesFolder, storylineSlug) {\n var dir = path.join(storyPath, storylinesFolder, storylineSlug);\n\n if (!helpers.isSlug(storylineSlug)) {\n throw new Error(`'${storylineSlug}' is not a slug`);\n }\n\n if (!isValidDir(dir)) {\n throw new Error(`'${dir}' is not a valid directory`);\n }\n\n return fs.readdirSync(`${storyPath}/${storylinesFolder}/${storylineSlug}`).filter(function(name) {\n var nameParts = name.split('.');\n return (nameParts.length === 2 && helpers.isSlug(nameParts[0]) && nameParts[1] === 'md');\n }).map(name => name.split('.')[0]);\n}", "addOwnStory(story) {\n console.log(this.ownStories)\n this.ownStories.push(story)\n }", "function navAllStories(evt) {\n // * returns: jQuery.Event {originalEvent: MouseEvent, type: \"click\", target:\n //* a#nav-all.nav-link, currentTarget: a#nav-all.nav-link, isDefaultPrevented: ƒ, …}\n console.debug('navAllStories', evt)\n hidePageComponents() //main.js (hides forms and storylist)\n putStoriesOnPage() //stories.js (haven't revied this js file yet but assume it is conected to storylist)\n}", "async function generateStories() {\n // get an instance of StoryList\n const storyListInstance = await StoryList.getStories();\n // update our global variable\n storyList = storyListInstance;\n // empty out that part of the page\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const result = generateStoryHTML(story);\n $allStoriesList.append(result);\n }\n }", "async function generateStories() {\n // get an instance of StoryList\n const storyListInstance = await StoryList.getStories();\n // update our global variable\n storyList = storyListInstance;\n // empty out that part of the page\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const result = generateStoryHTML(story);\n $allStoriesList.append(result);\n }\n }", "async function generateStories() {\n // get an instance of StoryList\n const storyListInstance = await StoryList.getStories();\n // update our global variable\n storyList = storyListInstance;\n // empty out that part of the page\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const result = generateStoryHTML(story);\n $allStoriesList.append(result);\n }\n }", "async function generateStories() {\n // get an instance of StoryList\n const storyListInstance = await StoryList.getStories();\n // update our global variable\n storyList = storyListInstance;\n // empty out that part of the page\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n storyList.stories.forEach(function(story) {\n const result = generateStoryHTML(story);\n $allStoriesList.append(result);\n });\n }", "async function startTrackingInFolder() {\n //check to see if there is a .storyteller directory \n const projectExists = fs.existsSync(path.join(vscode.workspace.workspaceFolders[0].uri.fsPath, '.storyteller'));\n \n //if a folder is open and there is not a .storyteller directory in it\n if(vscode.workspace.workspaceFolders && projectExists === false) {\n //create and store the global project manager in the opened directory\n projectManager = new ProjectManager(vscode.workspace.workspaceFolders[0].uri.fsPath);\n\n //ask for any discrepancies between the open project and the file system\n const discrepancies = projectManager.reconciler.findDiscrepancies();\n //holds the number of existing files and directories in the new project\n const existingFilesDirs = discrepancies.fullDirPathsPresentButNotTracked.length + discrepancies.fullFilePathsPresentButNotTracked.length;\n //if there are any files/dirs in the new project\n if(existingFilesDirs > 0) {\n //add them to the project\n projectManager.reconciler.addExistingFilesDirs(discrepancies);\n }\n //add the description comment to the end of the events\n projectManager.addDescriptionComment();\n \n //turn on file watching\n turnOnFSWatcherAndTextHandler();\n\n //prompt for the first developer's info\n createFirstDeveloper();\n\n //update the status bar\n updateStorytellerStatusBar('Start Playback', 'Start a Storyteller playback in the browser', 'storyteller.startPlaybackNoComment');\n }\n}", "function resolveToSrc() {\n return path.join(rootDir, 'src');\n}", "getAllPosts() {\n return this.storyapi\n .get('cdn/stories', {\n starts_with: 'posts/',\n version,\n })\n .catch((error) => console.log(error));\n }", "srcFiles(cb) {\n if (!fs.existsSync(srcDir)) {\n return cb(new Error(col.error(\n `Template directory \"${col.bold(srcDir)}\" does not exist.`)));\n }\n return dstate(srcDir, (err, files) => cb(err, files));\n }", "function findStoryFromStoryId(storyId) {\n for (let story of storyList.stories) {\n if (story.storyId === storyId) {\n return story;\n }\n }\n}", "function srcPath(src) {\n return path.join(snowpackOutDir, 'src', src);\n}", "addStoriesFromExports(fileName, fileExports) {\n // if the export haven't changed since last time we added them, this is a no-op\n if (this.csfExports[fileName] === fileExports) {\n return;\n } // OTOH, if they have changed, let's clear them out first\n\n\n this.clearFilenameExports(fileName);\n\n const {\n default: defaultExport,\n __namedExportsOrder\n } = fileExports,\n namedExports = _objectWithoutPropertiesLoose(fileExports, [\"default\", \"__namedExportsOrder\"]); // eslint-disable-next-line prefer-const\n\n\n let {\n id: componentId,\n title\n } = defaultExport || {};\n title = title || autoTitle(fileName, (global.STORIES || []).map(specifier => Object.assign({}, specifier, {\n importPathMatcher: new RegExp(specifier.importPathMatcher)\n })));\n\n if (!title) {\n logger.info(`Unexpected default export without title in '${fileName}': ${JSON.stringify(fileExports.default)}`);\n return;\n }\n\n this.csfExports[fileName] = Object.assign({}, fileExports, {\n default: Object.assign({}, defaultExport, {\n title\n })\n });\n let sortedExports = namedExports; // prefer a user/loader provided `__namedExportsOrder` array if supplied\n // we do this as es module exports are always ordered alphabetically\n // see https://github.com/storybookjs/storybook/issues/9136\n\n if (Array.isArray(__namedExportsOrder)) {\n sortedExports = {};\n\n __namedExportsOrder.forEach(name => {\n const namedExport = namedExports[name];\n if (namedExport) sortedExports[name] = namedExport;\n });\n }\n\n Object.entries(sortedExports).filter(([key]) => isExportStory(key, defaultExport)).forEach(([key, storyExport]) => {\n var _storyExport$paramete, _storyExport$story;\n\n const exportName = storyNameFromExport(key);\n const id = ((_storyExport$paramete = storyExport.parameters) === null || _storyExport$paramete === void 0 ? void 0 : _storyExport$paramete.__id) || toId(componentId || title, exportName);\n const name = typeof storyExport !== 'function' && storyExport.name || storyExport.storyName || ((_storyExport$story = storyExport.story) === null || _storyExport$story === void 0 ? void 0 : _storyExport$story.name) || exportName;\n this.stories[id] = {\n id,\n name,\n title,\n importPath: fileName\n };\n });\n }", "async function getAndShowStoriesOnStart() {\n storyList = await StoryList.getStories();\n $storiesLoadingMsg.remove();\n\n putStoriesOnPage(storyList.stories);\n}", "generateApiList() {\n return _globby(this.destinationPath('templates/'), {\n onlyDirectories: true,\n deep: false\n }).then((dirList) => {\n this._apiList = dirList.map((dir) => _path.basename(dir));\n if(this._apiList.length <= 0) {\n this.env.error('This project does not have any APIs to assign hooks to');\n }\n });\n }", "function navAllStories(evt) {\n console.debug(\"navAllStories\");\n hidePageComponents();\n putStoriesOnPage();\n // addStarToStories();\n}", "ls(){\n return super.ls()\n .filter(isNotIgnored)\n .map(f => new (f instanceof Dir? Part: Article)(f.path))\n .filter(f => f instanceof Article? f.ext === '.md': f);\n }", "_fetchModules(){\n var directories = fs.readdirSync('./features/');\n for (let directory of directories){\n if (!directory.includes('.')) { //means is a directory\n this._requireModules('./features/' + directory, directory);\n }\n }\n }", "function loadStories() {\n require(\"./welcome\")\n req.keys().forEach(req)\n}", "function getAllDirPaths() {\n\t\t\n //holds all the dir paths being tracked by storyteller\n var allDirPaths = [];\n \n //go through each file/dir mapping\n for(var dirPath in pathToIdMap) {\n if(pathToIdMap.hasOwnProperty(dirPath)) {\n \n //if the dir exists in the allDirs collection we know it is a dir\n if(allDirs[getIdFromDirPath(dirPath)]) {\n allDirPaths.push(dirPath); \n }\n }\n }\n \n return allDirPaths;\n}", "function loadContext(context) {\n const stories = [];\n let indexStory = null;\n\n // Load files from the library context\n context.keys().forEach(filename => {\n if (/index\\.stories\\.ts/.test(filename)) {\n indexStory = filename;\n } else {\n stories.push(filename);\n }\n });\n\n stories.sort();\n\n if (indexStory) {\n stories.unshift(indexStory);\n }\n\n stories.forEach(filename => context(filename));\n}", "function setStories(stories){\n const set = new Set(stories.map(s => s.storyId));\n return set;\n }", "static async getStories() {\n // query the /stories endpoint (no auth required)\n const response = await axios.get(`${BASE_URL}/stories`);\n\n // turn the stories object into an instance of Story for easier reading\n const stories = response.data.stories.map(story => new Story(story));\n\n // build an instance of our own class using the new array of stories\n const storyList = new StoryList(stories);\n return storyList;\n }", "getStoriesJSON() {\n return this._storiesJSON;\n }", "function putStoriesOnPage() {\n console.debug(\"putStoriesOnPage\");\n $allStoriesList.empty();\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const $story = generateStoryMarkup(story);\n $allStoriesList.append($story);\n }\n $allStoriesList.show();\n}", "async function getAndShowStoriesOnStart() {\n console.debug(\"getAndShowStoriesOnStart\");\n storyList = await StoryList.getStories();\n $storiesLoadingMsg.remove();\n\n putStoriesOnPage();\n}", "static async getStories() {\n // query the /stories endpoint (no auth required)\n const response = await axios.get(`${BASE_URL}/stories`);\n\n // turn plain old story objects from API into instances of Story class\n const stories = response.data.stories.map(story => new Story(story));\n\n // build an instance of our own class using the new array of stories\n return new StoryList(stories);\n }", "async function getAndShowStoriesOnStart() {\n storyList = await StoryList.getStories();\n $storiesLoadingMsg.remove();\n putStoriesOnPage();\n}", "function isEnded(story) {\n if (story.paths)\n return false;\n return true;\n }", "static async getStories() {\n // query the /stories endpoint (no auth required)\n const response = await axios({\n url: `${BASE_URL}/stories`,\n method: \"GET\",\n });\n\n // turn plain old story objects from API into instances of Story class\n const stories = response.data.stories.map(story => new Story(story));\n\n // build an instance of our own class using the new array of stories\n return new StoryList(stories);\n }", "function putStoriesOnPage() {\n console.debug(\"putStoriesOnPage\");\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const $story = generateStoryMarkup(story);\n $allStoriesList.append($story);\n }\n\n $allStoriesList.show();\n}", "getSrcFilesToCopy () {\n const filesToCopy = [`${settings.paths.src.root}/**/*`]\n const ignore = [\n settings.paths.src.components,\n settings.paths.src.js,\n settings.paths.src.sass,\n settings.paths.src.iconSpriteIn,\n settings.paths.src.componentDocs\n ]\n\n ignore.forEach((ignoreValue) => {\n filesToCopy.push(`!${ignoreValue}`, `!${ignoreValue}/**`)\n })\n\n if (settings.ignoreToCopy.length) {\n const customIgnored = this.extendArrayWithPaths(settings.ignoreToCopy, settings.paths.src.root)\n customIgnored.forEach((customIgnoreValue) => {\n filesToCopy.push('!' + customIgnoreValue)\n })\n }\n\n return filesToCopy\n }", "scanAppDir() {\n return glob.sync(path.resolve(this.app.appPath, '**'), {\n nodir: true,\n });\n }", "async function navAllStories(evt) {\n console.debug(\"navAllStories\", evt);\n storyList = await StoryList.getStories();\n hidePageComponents();\n putStoriesOnPage(storyList);\n \n\n}", "async function getAndShowStoriesOnStart() {\n storyList = await StoryList.getStories();\n $storiesLoadingMsg.remove();\n\n putStoriesOnPage();\n}", "async function getAndShowStoriesOnStart() {\n storyList = await StoryList.getStories();\n $storiesLoadingMsg.remove();\n\n putStoriesOnPage();\n}", "async function getAndShowStoriesOnStart() {\n storyList = await StoryList.getStories();\n $storiesLoadingMsg.remove();\n\n putStoriesOnPage();\n}", "async function getAndShowStoriesOnStart() {\n storyList = await StoryList.getStories();\n $storiesLoadingMsg.remove();\n\n putStoriesOnPage();\n}", "async function getAndShowStoriesOnStart() {\n storyList = await StoryList.getStories();\n $storiesLoadingMsg.remove();\n\n putStoriesOnPage();\n}", "async function getAndShowStoriesOnStart() {\n storyList = await StoryList.getStories();\n $storiesLoadingMsg.remove();\n\n putStoriesOnPage();\n}", "async function getAndShowStoriesOnStart() {\n storyList = await StoryList.getStories();\n $storiesLoadingMsg.remove();\n\n putStoriesOnPage();\n}", "async function getAndShowStoriesOnStart() {\n storyList = await StoryList.getStories();\n $storiesLoadingMsg.remove();\n\n putStoriesOnPage();\n}", "async function getAndShowStoriesOnStart() {\n storyList = await StoryList.getStories();\n $storiesLoadingMsg.remove();\n\n putStoriesOnPage();\n}", "function getSourceLangResourceFiles() {\n var resources = [];\n grunt.file.recurse(SOURCE_LANG_STRINGS_PATH, function(abspath, rootdir, subdir, filename) { \n if (filename.match(/\\.resjson$/)) {\n resources.push(filename);\n }\n });\n return resources;\n }", "function isEnded(story) {\r\n if (story.paths) return false;\r\n return true;\r\n }", "function putStoriesOnPage() {\n console.debug(\"putStoriesOnPage\");\n\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const $story = generateStoryMarkup(story);\n $allStoriesList.append($story);\n }\n\n $allStoriesList.show();\n}", "function putStoriesOnPage() {\n console.debug(\"putStoriesOnPage\");\n\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const $story = generateStoryMarkup(story);\n $allStoriesList.append($story);\n }\n\n $allStoriesList.show();\n}", "function putStoriesOnPage() {\n console.debug(\"putStoriesOnPage\");\n\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const $story = generateStoryMarkup(story);\n $allStoriesList.append($story);\n }\n\n $allStoriesList.show();\n}", "function putStoriesOnPage() {\n console.debug(\"putStoriesOnPage\");\n\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const $story = generateStoryMarkup(story);\n $allStoriesList.append($story);\n }\n\n $allStoriesList.show();\n}", "function putStoriesOnPage() {\n console.debug(\"putStoriesOnPage\");\n\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const $story = generateStoryMarkup(story);\n $allStoriesList.append($story);\n }\n\n $allStoriesList.show();\n}", "function putStoriesOnPage() {\n console.debug(\"putStoriesOnPage\");\n\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const $story = generateStoryMarkup(story);\n $allStoriesList.append($story);\n }\n\n $allStoriesList.show();\n}", "function putStoriesOnPage() {\n console.debug(\"putStoriesOnPage\");\n\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const $story = generateStoryMarkup(story);\n $allStoriesList.append($story);\n }\n\n $allStoriesList.show();\n}", "getOwnStoryIds() {\n return this.ownStories.map(s => s.storyId);\n }", "prerender(app, tree) {\n let storybookAddon = app.project.addons.find(\n ({ name }) => name === '@storybook/ember-cli-storybook'\n );\n\n if (!storybookAddon) {\n throw new Error(\n \"Could not find initialized ember-cli-storybook addon. It must be part of your app's dependencies!\"\n );\n }\n\n return storybookAddon._prerenderTree(tree);\n }", "function htmls () {\n return gulp.src(['app/*.htm']) // stream all the '.htm' files\n // replace %TEMPLATE% with 'MyWebsite'\n .pipe($.replace('%TEMPLATE%', 'MyWebsite'))\n // rename all the extension 'htm' -> 'html'\n .pipe($.rename(function (path) {\n path.extname = '.html'\n }))\n .pipe(gulp.dest('dist'));\n}", "function loadSourceFiles(srcDir) {\n\t\t\tit('should load all source files under ' + srcDir, function (done) {\n\t\t\t\tglob(srcDir + '/*.js', function (err, files) {\n\t\t\t\t\tfiles.forEach(function (filename) {\n\t\t\t\t\t\tif (~EXCLUDE.indexOf(filename)) {\n\t\t\t\t\t\t\tdebug('skipping:', filename);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tload(filename);\n\t\t\t\t\t});\n\t\t\t\t\tsetImmediate(done);\n\t\t\t\t});\n\t\t\t});\n\t\t}", "function ignoredDir(base ,output, dir) {\n\treturn `${dir}`.startsWith(base + output)\n}", "function getAllFilePaths() {\n \n //holds all the file paths being tracked by storyteller\n var allFilePaths = [];\n \n //go through each file/dir mapping\n for(var filePath in pathToIdMap) {\n if(pathToIdMap.hasOwnProperty(filePath)) {\n \n //if the file exists in the allFiles collection we know it is a file\n if(allFiles[getIdFromFilePath(filePath)]) {\n allFilePaths.push(filePath); \n }\n }\n }\n \n return allFilePaths;\n}", "function navAllStories(evt) {\n\tconsole.debug('navAllStories', evt);\n\thidePageComponents();\n\tputStoriesOnPage();\n}", "function startStoryteller() {\n //st is already active\n if(isStorytellerCurrentlyActive) {\n //let them know about the current state\n storytellerState();\n } else { //st is not active\n //if there is an open workspace\n if(vscode.workspace.workspaceFolders) {\n //check to see if there is a .storyteller directory before creating \n //the project manager\n const projectExists = fs.existsSync(path.join(vscode.workspace.workspaceFolders[0].uri.fsPath, '.storyteller'));\n\n //if this is an existing project\n if(projectExists === true) {\n //resume working on an existing project\n resumeExistingProject();\n } else { //this is a brand new project\n //start tracking changes in this folder\n startTrackingInFolder();\n }\n } else { //there is no open workspace\n //tell the user they need to open a workspace in order to use Storyteller\n promptInformingAboutUsingStoryteller(true);\n }\n }\n}", "addSources(contents) {}", "function identify_src(){\n\t\t\t\tvar all_imgs = Y.one('#story-content').all('img');\n\t\t\t\t\n\t\t\t\tvar src = \"\";\n\t\t\t\tvar length = 0;\n\t\t\t\tall_imgs.each(function(node){\n\t\t\t\t\t\n\t\t\t\t\t/*\n\t\t\t\t\t * to get the part behind the last \"/\"\n\t\t\t\t\t * /pg_designer/ .... /bpb1040120.jpg\n\t\t\t\t\t */\n\t\t\t\t\tsrc = node.get('src');\n\t\t\t\t\tsrc = src.split('/');\n\t\t\t\t\t\n\t\t\t\t\tlength = src.length - 1\n\t\t\t\t\t\n\t\t\t\t\t/*\n\t\t\t\t\t * issue: somehow we can't process the class name with a dot(.)\n\t\t\t\t\t * so we have to replace '.' with a '-'\n\t\t\t\t\t */\n\t\t\t\t\tsrc = src[length];\n\t\t\t\t\tsrc = src.replace('.', '-');\n\t\t\t\t\tnode.addClass(src);\n\t\t\t\t\t\n\t\t\t\t});\n\t\t\t}", "static async getStories() {\n // query the /stories endpoint (no auth required)\n const response = await axios.get(`${BASE_URL}/stories`);\n\n // turn the plain old story objects from the API into instances of the Story class\n const stories = response.data.stories.map(story => new Story(story));\n\n // build an instance of our own class using the new array of stories\n const storyList = new StoryList(stories);\n return storyList;\n }", "function getPath() {\n let i = 1\n let repeat = true;\n while (repeat) {\n if (fs.existsSync(`./dist/Team-${i}.html`)) {\n i++\n }\n else {\n return `./dist/Team-${i}.html`\n }\n }\n}", "static async getStories() {\n try {\n // query the /stories endpoint (no auth required)\n const response = await axios.get(`${BASE_URL}/stories`);\n\n // turn the story objects from the API into instances of the Story class\n const stories = response.data.stories.map(story => new Story(story));\n\n // build an instance of our own class using the new array of stories\n const storyList = new StoryList(stories);\n return storyList;\n }\n catch(e) {\n alert(\"Cannot get stories\");\n return null;\n }\n }", "function loadFeaturedStorySlider() {\n var homeStories = document.querySelector('.home-features-stories-cont');\n if (homeStories !== null) {\n var featuredStoriesLoaded = false;\n var featuredStoryCheck = setInterval(function () {\n if (featuredStoriesLoaded === false) {\n var featuredStoryContainer = document.querySelector('.featured-story-slider');\n if (featuredStoryContainer !== null) {\n startFeaturedStorySlider();\n featuredStoriesLoaded = true;\n clearTimeout(featuredStoryCheck);\n }\n }\n }, 100);\n }\n}", "indexOfOwnStory(story) {\n for (let i = 0; i < this.ownStories.length; i++) {\n if (this.ownStories[i].storyId === story.storyId) {\n return i\n }\n }\n return -1\n }", "get sources() {\n var source = this.sourceRepo;\n var local = this.localSource;\n var system = this.systemSource;\n\n var root = path.join(this.baseDir, \"savers\");\n \n var folders = [];\n\n // if we're pulling savers from a git repo, this is where\n // they will be located\n if ( source !== undefined && source !== \"\" ) {\n folders.push(root);\n }\n\n // if there's a local source, use that\n if ( local !== \"\" && fs.existsSync(local)) {\n folders = folders.concat( local );\n }\n\n \n folders = folders.concat( system );\n\n return folders;\n }", "async function getStories () {\n if (cache.stories) return cache.stories;\n cache.stories = await fetch('/api/getStories')\n .then(response => response.json())\n .catch(err => console.log(err));\n if (timers.stories === false) {\n timers.stories = true;\n setTimeout(() => {\n cache.stories = null;\n timers.stories = false;\n }, 480000);\n }\n return cache.stories;\n}", "function jekyllThemeSupport(sources){\n sources.forEach(function(source){\n let newSource = themePath + \"/\" + source;\n sources.push(newSource);\n console.log(newSource);\n });\n return sources;\n}", "function filterStories(id, label) {\n return new Promise((resolve, reject) => {\n tracker\n .project(id)\n .stories\n .all({\n with_label: label\n }, (err, stories) => {\n if(err || !stories) {\n reject('No such project')\n }\n resolve(stories)\n })\n })\n}", "function watchHtml() {\n const watchDirectories = config.html.sources;\n if (config.html.twig.enabled) {\n watchDirectories.push(config.html.twig.baseDir + '**/*.twig');\n watchDirectories.push(config.html.twig.dataSrc + '**/*.json');\n }\n return gulp.watch(watchDirectories, gulp.series('compile:html', 'validate:html'));\n }", "function putStoriesOnPage() {\n console.debug(\"putStoriesOnPage\");\n\n $allStoriesList.empty();\n\n // loop through all of our stories and generate HTML for them\n for (let story of storyList.stories) {\n const $story = generateStoryMarkup(story);\n $allStoriesList.append($story);\n }\n $favoriteStoriesList.hide();\n $allStoriesList.show();\n}" ]
[ "0.73268574", "0.72863346", "0.724253", "0.70414096", "0.69892466", "0.6905347", "0.6499714", "0.5854654", "0.5812476", "0.5608716", "0.54625857", "0.543285", "0.53899676", "0.53851503", "0.5384343", "0.5267367", "0.5193101", "0.51910317", "0.51756597", "0.51421094", "0.5141544", "0.50556195", "0.50123066", "0.5010856", "0.5003735", "0.49903265", "0.49868745", "0.49832058", "0.496848", "0.49663886", "0.49663886", "0.49663886", "0.4951846", "0.49489242", "0.4927911", "0.49267286", "0.49073166", "0.48912454", "0.48779175", "0.4875668", "0.48558262", "0.48384637", "0.4827936", "0.48268023", "0.48261496", "0.48034433", "0.47804344", "0.47461447", "0.47459102", "0.47448534", "0.474321", "0.47071582", "0.47070175", "0.4706732", "0.47058883", "0.4704943", "0.47039905", "0.47031143", "0.47004098", "0.4698912", "0.46935", "0.46912706", "0.46912706", "0.46912706", "0.46912706", "0.46912706", "0.46912706", "0.46912706", "0.46912706", "0.46912706", "0.46871227", "0.46868044", "0.46812847", "0.46812847", "0.46812847", "0.46812847", "0.46812847", "0.46812847", "0.46812847", "0.4678141", "0.4674115", "0.46730644", "0.46723577", "0.4668871", "0.46663186", "0.46650878", "0.46535212", "0.46437782", "0.46431267", "0.4639124", "0.46386176", "0.46248594", "0.46246076", "0.4615963", "0.46153137", "0.4613275", "0.4610673", "0.4607449", "0.46067807", "0.4606103" ]
0.63767487
7
options can be: Local options: lineRegex: defaults to /[\n\r]/. Better know what your doing if you change it. Parent options: decodeStrings: If you want strings to be buffered (Default: true) highWaterMark: Memory for internal buffer of stream (Default: 16kb) objectMode: Streams convert your data into binary, you can opt out of by setting this to true (Default: false)
constructor(options) { super(options); this._lineRegex = (is.notNil(options) && is.notNil(options.lineRegex)) ? options.lineRegex : DEFAULT_LINE_REGEX; this._last = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(options) {\n this.context = options.context;\n this.dryRun = options.dryRun;\n this.logger = options.logger;\n this.encoding = options.encoding || 'utf-8';\n }", "function Source(obj, options) {\n Readable.call(this, options);\n this.obj = obj;\n this.arrLen = this.arrInd = 0;\n this.keys = Object.keys(obj);\n this.keysLen = this.keys.length;\n this.keyInd = -1;\n}", "function parseLineOptions(options) {\n let typeFlag;\n if (typeof options === \"object\") {\n const {\n color = \"white\",\n length = 59,\n character = \"-\",\n quantity = 1\n } = options;\n typeFlag = \"object\";\n return [\n typeFlag,\n {\n color,\n length,\n character,\n quantity\n }\n ];\n } else if (typeof options === \"string\") {\n typeFlag = \"string\";\n let color = options;\n return [typeFlag, color];\n }\n}", "function Stream(options) {\n Scriptum.call(this);\n options = options || {};\n this._stream = options.stream || null; // a writable stream\n this.addNewLine = options.addNewLine || false; // adds new line at each write\n}", "constructor(source, options = {}) {\n super();\n this.avroPaused = true;\n this.source = source;\n this.onProgress = options.onProgress;\n this.onError = options.onError;\n this.avroReader = new AvroReader(new AvroReadableFromStream(this.source));\n this.avroIter = this.avroReader.parseObjects({ abortSignal: options.abortSignal });\n }", "constructor(source, options = {}) {\n super();\n this.avroPaused = true;\n this.source = source;\n this.onProgress = options.onProgress;\n this.onError = options.onError;\n this.avroReader = new AvroReader(new AvroReadableFromStream(this.source));\n this.avroIter = this.avroReader.parseObjects({ abortSignal: options.abortSignal });\n }", "function UseDeserialization(options = {}) {\n return UsePipe(exports.DeserializerPipe, options);\n}", "function makeLineReader( filepath, options ) {\n options = options || {};\n var readBufferSize = 128000;\n\n var lineBufLength = options.lineBufLength || 5;\n\n var rl, stream = options.stream;\n var reader = { lines: [], _eof: true, error: undefined };\n\n function reopen() {\n reader._eof = false;\n stream = stream || fs.createReadStream(filepath, { highWaterMark: readBufferSize, start: options.start || 0 });\n stream.on('error', function(err) { reader.error || (reader.error = err) });\n rl = readline.createInterface(stream, { console: false, isTTY: false });\n rl.on('close', function() { reader._eof = true; emitBufferedLine(rl) });\n rl.on('line', function(line) {\n // tracking the byte offset drops read speed 25%, from 3.2m/s to 2.6m/s\n reader.lines.push(trimTrailingNewline(line));\n if (reader.lines.length >= lineBufLength) reader.pause() });\n rl.pause();\n reader.rl = rl;\n }\n\n reader = {\n _eof: false,\n paused: true,\n lines: new Array(),\n error: reader.error,\n rl: rl,\n gets: function gets() {\n return reader.lines.length ? reader.lines.shift() : ((!reader.error && !reader._eof && reader.resume()), undefined) },\n flush: function flush() { var lines = reader.lines; reader.lines = new Array(); return lines },\n reopen: function _reopen() { reader._eof = false; return reopen() },\n pause: function pause() { if (!reader.paused) reader.rl.pause(); reader.paused = true },\n resume: function resume() { if (reader.paused) reader.rl.resume(); reader.paused = false },\n isEof: function isEof() { return !!(!reader.lines.length && (reader._eof || reader.error)) },\n };\n // Object.defineProperty(reader, 'eof', { get: function() { return reader.isEof() } });\n\n reader.reopen();\n return reader;\n}", "function IconvLiteDecoderStream(conv, options) {\n }", "function IconvLiteDecoderStream(conv, options) {\n }", "decode(input, options = {}) {\n let more = \"stream\" in options ? options.stream : false;\n // There are cases where this is called without input.\n if (!input) {\n return \"\";\n }\n this.collectInput += bytesToString(input);\n if (more) {\n return \"\";\n }\n return this.manager.utf7ToUnicode(this.collectInput);\n }", "constructor(options = {}) {\n this.options = getOptions(options);\n\n // Construct regexes for reserved words, according to settings\n this.keywordsJs = keywordRegexp([].concat(keywords));\n this.keywords = keywordRegexp([].concat(keywords, reservedWords.tacoscript));\n this.reservedWords = keywordRegexp(reservedWords.es2015);\n this.reservedWordsStrict = keywordRegexp([].concat(reservedWords.es2015, reservedWords.strict));\n this.reservedWordsStrictBind = keywordRegexp([].concat(reservedWords.es2015, reservedWords.strict, reservedWords.strictBind))\n\n // These will be populated by `open()`\n this.file = this.input = this.state = null;\n }", "function VFile(options) {\n var prop\n var index\n var length\n\n if (!options) {\n options = {}\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options}\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options)\n }\n\n this.data = {}\n this.messages = []\n this.history = []\n this.cwd = process.cwd()\n\n // Set path related properties in the correct order.\n index = -1\n length = order.length\n\n while (++index < length) {\n prop = order[index]\n\n if (own.call(options, prop)) {\n this[prop] = options[prop]\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop]\n }\n }\n}", "initialize(options={}) {\n this._files = [];\n this._editor = null;\n this._prevClientHeight = null;\n\n this.options = _.defaults(options, this.defaultOptions);\n this.richText = !!this.options.richText;\n this._dropTarget = null;\n this._value = this.options.text || '';\n this._richTextDirty = false;\n\n if (this.options.bindRichText) {\n this.bindRichTextAttr(this.options.bindRichText.model,\n this.options.bindRichText.attrName);\n }\n\n /*\n * If the user is defaulting to rich text, we're going to want to\n * show the rich text UI by default, even if any bound rich text\n * flag is set to False.\n *\n * This requires cooperation with the template or API results\n * that end up backing this TextEditor. The expectation is that\n * those will be providing escaped data for any plain text, if\n * the user's set to use rich text by default. If this expectation\n * holds, the user will have a consistent experience for any new\n * text fields.\n */\n if (RB.UserSession.instance.get('defaultUseRichText')) {\n this.setRichText(true);\n }\n }", "function VFile(options) {\n var prop\n var index\n\n if (!options) {\n options = {}\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options}\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options)\n }\n\n this.data = {}\n this.messages = []\n this.history = []\n this.cwd = proc.cwd()\n\n // Set path related properties in the correct order.\n index = -1\n\n while (++index < order.length) {\n prop = order[index]\n\n if (own.call(options, prop)) {\n this[prop] = options[prop]\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order.indexOf(prop) < 0) {\n this[prop] = options[prop]\n }\n }\n}", "function VFile(options) {\n var prop\n var index\n\n if (!options) {\n options = {}\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options}\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options)\n }\n\n this.data = {}\n this.messages = []\n this.history = []\n this.cwd = proc.cwd()\n\n // Set path related properties in the correct order.\n index = -1\n\n while (++index < order.length) {\n prop = order[index]\n\n if (own.call(options, prop)) {\n this[prop] = options[prop]\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order.indexOf(prop) < 0) {\n this[prop] = options[prop]\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "function VFile(options) {\n var prop;\n var index;\n var length;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options;\n }\n\n if (!(this instanceof VFile)) {\n return new VFile(options);\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = process.cwd();\n\n /* Set path related properties in the correct order. */\n index = -1;\n length = order.length;\n\n while (++index < length) {\n prop = order[index];\n\n if (own.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n /* Set non-path related properties. */\n for (prop in options) {\n if (order.indexOf(prop) === -1) {\n this[prop] = options[prop];\n }\n }\n}", "constructor(options) {\n options = options || {};\n options.objectMode = true;\n super(options);\n }", "parse(arrayBuffer, options = {}) {\n return this.parseSync(arrayBuffer, options);\n }", "constructor(options) {\n this._cleared = new Signal(this);\n this._disposed = new Signal(this);\n this._editor = null;\n this._inspected = new Signal(this);\n this._isDisposed = false;\n this._pending = 0;\n this._standby = true;\n this._connector = options.connector;\n this._rendermime = options.rendermime;\n this._debouncer = new Debouncer(this.onEditorChange.bind(this), 250);\n }", "static readFile(filePath, options) {\n return FileSystem._wrapException(() => {\n options = Object.assign(Object.assign({}, READ_FILE_DEFAULT_OPTIONS), options);\n let contents = FileSystem.readFileToBuffer(filePath).toString(options.encoding);\n if (options.convertLineEndings) {\n contents = Text_1.Text.convertTo(contents, options.convertLineEndings);\n }\n return contents;\n });\n }", "function add_to_buffer(data, callback){\n\t\t\tif(!options.to || options.to === 'undefined'){\n\t\t\t\tlog.error('undefined to');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlog.trace('add_to_buffer data', data);\n\n\t\t\tvar new_data_obj = [];\n\n\t\t\tfunction split_string(str){\n\t\t\t\tif(options.join !== '\\n' && options.skip_verify !== true) str = x.verify_string(str);\n\t\t\t\tvar pat = new RegExp('.{' + _this.max_str_len + '}\\w*\\W*|.*.', 'g');\n\t\t\t\tstr.match(pat).forEach(function(entry) {\n\t\t\t\t\tif(entry === '' || entry === null || entry === undefined) return;\n\t\t\t\t\tentry = options.skip_verify ? entry : x.verify_string(entry);\n\t\t\t\t\tnew_data_obj.push(entry);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif(data === undefined || data === null || data === false || data === '' || data.length < 1){ //no data\n\t\t\t\tnew_data_obj = [];\n\t\t\t} else if (typeof data === 'string'){ //string\n\t\t\t\tsplit_string(data);\n\t\t\t} else if(typeof data === 'object' && Array.isArray(data)){ //array\n\t\t\t\tdata.forEach(function(item, i){\n\t\t\t\t\tsplit_string(item);\n\t\t\t\t});\n\t\t\t} else if(typeof data === 'object' && !Array.isArray(data)){ //object\n\t\t\t\toptions.join = '\\n';\n\t\t\t\tvar data_arr = format_obj(data);\n\t\t\t\tdata_arr.forEach(function(item, i){\n\t\t\t\t\tsplit_string(item);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlog.error('verify_string: str is a', typeof data, data)\n\t\t\t\tsplit_string(JSON.stringify(data));\n\t\t\t}\n\n\t\t\tlog.trace('add_to_buffer new_data_obj', new_data_obj);\n\n\t\t\tif(new_data_obj.length <= options.lines){\n\t\t\t\toptions.ellipsis = false;\n\t\t\t\tcallback(new_data_obj.join(options.join + '\\u000f'));\n\t\t\t} else {\n\t\t\t\tnew_data_obj.unshift({\n\t\t\t\t\tfirst_len: new_data_obj.length,\n\t\t\t\t\tjoin: options.join,\n\t\t\t\t\tid: x.guid(),\n\t\t\t\t\tellipsis: options.ellipsis\n\t\t\t\t});\n\n\t\t\t\tlog.trace('adding buffer to', '/buffer/' + options.to, new_data_obj.slice(0,3), '...');\n\t\t\t\tdb.update('/buffer/' + options.to, new_data_obj, true, function(act){\n\t\t\t\t\tif(act === 'add'){\n\t\t\t\t\t\tpage_buffer(function(data){\n\t\t\t\t\t\t if(options.is_pm){\n\t\t\t\t\t\t\t\tdata = _this.t.highlight('To page through buffer, type ' + config.command_prefix + 'next. (type ' + config.command_prefix + 'next help for more info)\\n') + data;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlog.trace('added to ' + options.to + '\\'s buffer!')\n\t\t\t\t\t\t\tcallback(data);\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.trace('cleared ' + options.to + '\\'s buffer!')\n\t\t\t\t\t}\n\t\t\t\t}, options.to);\n\t\t\t}\n\t\t}", "constructor(options) {\n this.options = options;\n this.configureMonacoEditor();\n\n if (this.options.isMarkdown) {\n this.fetchMarkdownExtension();\n }\n\n this.initModePanesAndLinks();\n this.initFileSelectors();\n this.initSoftWrap();\n this.editor.focus();\n }", "static isSmartBufferOptions(options) {\n const castOptions = options;\n return castOptions && (castOptions.encoding !== undefined || castOptions.size !== undefined || castOptions.buff !== undefined);\n }", "_transform( data, encoding, streamCallback )\n {\n // convert buffer to string\n const text = data.toString( this.stringEncoding )\n\n // split data at newline\n const lines = text.split( this.newlineCharacter )\n\n // prepend previously buffered data to first line\n lines[0] = this.lineBuffer + lines[0]\n\n // last \"line\" is probably not a complete line,\n // remove it from the processing array and store it for next time\n this.lineBuffer = lines.pop()\n\n // process and push data with adding newline back\n this.handleLines( streamCallback, this.transformCallback, lines, this.newlineCharacter )\n }", "static isSmartBufferOptions(options) {\n const castOptions = options;\n return (castOptions &&\n (castOptions.encoding !== undefined || castOptions.size !== undefined || castOptions.buff !== undefined));\n }", "function ReadableState(options, stream) {\n\toptions = options || {};\n\n\t//convert value into boolean value\n\tthis.objectMode = !!objectMode;\n\n\tif(stream instanceof Stream.Duplex){\n\t\tthis.objectMode = this.objectMode || !!options.readableObjectMode;\n\t}\n\n\t//set High Water Mark of current Readable instance\n\tvar hwm = options.highWaterMark;\n\tvar defaultHwm = this.objectMode ? 16 : 16*1024;\n\tthis.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;\n\tthis.highWaterMark = ~~this.highWaterMark;\n\n\tthis.buffer = new BufferList();\n\tthis.length = 0;\n\tthis.pipe = null;\n\tthis.pipesCount = 0;\n\tthis.flowing = null;\n\tthis.ended = false;\n\tthis.endEmitted = false;\n\tthis.reading = false;\n\n\tthis.sync = true;\n\n\tthis.needReadable = false;\n\tthis.emittedReadable = false;\n\tthis.readableListening = false;\n\tthis.resumeScheduled = false;\n\n\tthis.defaultEncoding = options.defaultEncoding || 'utf8';\n\n\tthis.ranout = false;\n\n\tthis.awaitDrain = 0;\n\n\tthis.readingMore = false;\n\n\tthis.decoder = null;\n\tthis.encoding = null;\n\tif(options.encoding){\n\t\tif(!StringDecoder){\n\t\t\tStringDecoder = require('string_decoder').StringDecoder;\n\t\t}\n\t\tthis.decoder = new StringDecoder(options.encoding);\n\t\tthis.encoding = options.encoding;\n\t}\n}", "transformer (source, name, filename, options) {\n return (size) => {\n let readStream;\n readStream = fs.createReadStream(filename);\n this.state(name, { sync: true }) // update header\n// // Since the function is not immediately invoked,\n// // the source stream (chain file) may have already closed\n// // by the time this function is called. \n// // Therefore check if it's already closed\n// // If already closed, create a normal stream\n// // If stil open (still writing, in case of a large file), create a tailstream\n// if (!source || source.writableFinished) {\n// readStream = fs.createReadStream(filename);\n// this.state(name, { sync: true }) // update header\n// } else {\n// readStream = ts.createReadStream(filename, { waitForCreate: true })\n// source.on(\"close\", () => {\n// this.state(name, { sync: true }) // update header\n// readStream.on(\"eof\", () => { readStream.end() }) // close tail stream\n// })\n// }\n let stx = readStream.pipe(es.split()).pipe(es.map((item, cb) => {\n this.parse(item, options).then((data) => {\n cb(null, data);\n })\n }))\n if (this.filter) stx = stx.pipe(es.filterSync(this.filter))\n if (this.map) stx = stx.pipe(es.mapSync((e) => {\n let mapped = this.map(e)\n let res = Object.assign({\"$\": mapped}, {tx: e.tx})\n if (e.blk) res.blk = e.blk\n return res\n }))\n // If 'size' is specified, create a batch stream\n if (size) {\n let batch = new BatchStream({ size : size });\n stx = stx.pipe(batch)\n }\n return stx;\n }\n }", "function rawbreaks(input, options) {\n options || (options = {});\n\n if (!isReadableStream(input)) {\n\n /**\n * if sam format, then use master-worker\n **/\n if (options.format == \"sam\") {\n if (options.parallel) {\n options.parallel = Number(options.parallel);\n }\n\n var parallel = (isNaN(options.parallel) || !options.parallel) ? 8 : options.parallel;\n\n var mw = new MasterWorker.processLines({\n parallel: parallel,\n file: input,\n each: callRawBreaksImpl,\n requires: {\n SamAlignment: [\"samreader\", \"SamAlignment\"],\n dna: \"dna\"\n },\n master: function(i) {\n return {\n noN: false,\n pad: pad\n };\n }\n\n }, function(results) {\n var total = results.reduce(function(total, v, k) {\n return total + v.total;\n },0);\n });\n }\n }\n}", "constructor(source, options) {\t\t\r\n\t\tvar options = Object.assign({}, Console.defaultOptions, options);\r\n\t\tif (typeof options.minLevel === 'string')\r\n\t\t\toptions.minLevel = options.levels[options.minLevel].n;\r\n\t\tsuper(options.stdio.out, options.stdio.err);\r\n\t\tthis.options = options;\r\n\t\tthis.source = source;\r\n\t\t// this.messages = [];\t\t\t// TODO : Log messages as array of arrays (or objects?)\r\n\r\n\t\t/*\r\n\t\t// Probably abstract out to a listener class/type/whatev.\r\n\t\t// By default any new console unless spec'd otherwise in options has one listener - \r\n\t\t// which takes the log message array/object item and writes to stdio.\r\n\t\t// Maybe this Console class can just deal with listeners and not have to handle stdio directly?\r\n\t\t// Listeners more than likely will use EventEmitter base type or data member \r\n\t\t// TODO: ** Perfect example on nodejs api docs see util.inherits for EventEmitter based 'MyStream' object\r\n\t\t// could also have level option on source (ie keep this class as is) and also have level filter in listener.\r\n\t\t// or listener is just a fn? just ideas\r\n\t\t*/\r\n\t\t// this\t\t//this.options.source?\"'\"+this.options.source+\"'\":\"\"})`);\r\n\t\tif (!defaultConsole)\r\n\t\t\tdefaultConsole = this;\r\n\t\t\r\n\t\t// for each defined level, give the Console class a memr with that name that outputs at that level\r\n\t\tObject.keys(options.levels).forEach((level) => {\r\n\t\t\tthis[level] = _log.bind(this, this.options.levels[level]);\r\n\t\t});\r\n\r\n\t\t// defaultConsole.verbose(`new Console('${source}', ${util.inspect(options)})`);\r\n\t\t// this.debug(util.inspect(this));\r\n\t\tif (options.testLevels)\r\n\t\t\tthis.testLevels();\r\n\t}", "constructor(options, options2){\n super(options); //Passing options to native class constructor. (REQUIRED)\n this.count = options2.count; //A self declared variable to limit the data which is to be read.\n this.factor = options2.theta;\n this.chunk = options2.chunk;\n\n this.debug_count = 0;\n this.phase = 0;\n\n\n // dv.setFloat64(0, number, false);\n\n // 8 is for bytes per float, 2 is for real/imag\n this.thebuffer = new ArrayBuffer(this.chunk*8*2); // in bytes\n this.uint8_view = new Uint8Array(this.thebuffer);\n this.uint32_view = new Uint32Array(this.thebuffer);\n this.float64_view = new Float64Array(this.thebuffer);\n // this.dv = new DataView(this.thebuffer);\n\n for(let i = 0; i < this.chunk; i++) {\n this.uint32_view[i] = i;\n }\n\n\n }", "function RenderedText(options) {\n var _this = _super.call(this) || this;\n var source = Private.getSource(options);\n var data = ansi_up_1.escape_for_html(source);\n var pre = document.createElement('pre');\n pre.innerHTML = ansi_up_1.ansi_to_html(data);\n _this.node.appendChild(pre);\n _this.addClass(TEXT_CLASS);\n if (options.mimeType === 'application/vnd.jupyter.stderr') {\n _this.addClass(ERROR_CLASS);\n }\n return _this;\n }", "function modeRaw(options) {\n options = options || {};\n this.name = \"\";\n this.cipher = options.cipher;\n this.blockSize = options.blockSize || 16;\n this._blocks = this.blockSize / 4;\n this._inBlock = new Array(this._blocks);\n this._outBlock = new Array(this._blocks);\n}", "set options(options) {\n const {\n debug = false,\n clientId,\n endpoint = 'https://stream.bionic-app.com/flags',\n } = options;\n this._options = {\n debug,\n clientId,\n endpoint,\n };\n }", "serializeApiCallOptions(options, headers) {\n // The following operation both flattens complex objects into a JSON-encoded strings and searches the values for\n // binary content\n let containsBinaryData = false;\n const flattened = Object.entries(options)\n .map(([key, value]) => {\n if (value === undefined || value === null) {\n return [];\n }\n let serializedValue = value;\n if (Buffer.isBuffer(value) || is_stream_1.default(value)) {\n containsBinaryData = true;\n }\n else if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean') {\n // if value is anything other than string, number, boolean, binary data, a Stream, or a Buffer, then encode it\n // as a JSON string.\n serializedValue = JSON.stringify(value);\n }\n return [key, serializedValue];\n });\n // A body with binary content should be serialized as multipart/form-data\n if (containsBinaryData) {\n this.logger.debug('request arguments contain binary data');\n const form = flattened.reduce((form, [key, value]) => {\n if (Buffer.isBuffer(value) || is_stream_1.default(value)) {\n const options = {};\n options.filename = (() => {\n // attempt to find filename from `value`. adapted from:\n // tslint:disable-next-line:max-line-length\n // https://github.com/form-data/form-data/blob/028c21e0f93c5fefa46a7bbf1ba753e4f627ab7a/lib/form_data.js#L227-L230\n // formidable and the browser add a name property\n // fs- and request- streams have path property\n const streamOrBuffer = value;\n if (typeof streamOrBuffer.name === 'string') {\n return path_1.basename(streamOrBuffer.name);\n }\n if (typeof streamOrBuffer.path === 'string') {\n return path_1.basename(streamOrBuffer.path);\n }\n return defaultFilename;\n })();\n form.append(key, value, options);\n }\n else if (key !== undefined && value !== undefined) {\n form.append(key, value);\n }\n return form;\n }, new form_data_1.default());\n // Copying FormData-generated headers into headers param\n // not reassigning to headers param since it is passed by reference and behaves as an inout param\n for (const [header, value] of Object.entries(form.getHeaders())) {\n headers[header] = value;\n }\n return form;\n }\n // Otherwise, a simple key-value object is returned\n headers['Content-Type'] = 'application/x-www-form-urlencoded';\n const initialValue = {};\n return querystring_1.stringify(flattened.reduce((accumulator, [key, value]) => {\n if (key !== undefined && value !== undefined) {\n accumulator[key] = value;\n }\n return accumulator;\n }, initialValue));\n }", "function ChunkStreamer(config) {\n this._handle = null;\n this._finished = false;\n this._completed = false;\n this._input = null;\n this._baseIndex = 0;\n this._partialLine = '';\n this._rowCount = 0;\n this._start = 0;\n this._nextChunk = null;\n this.isFirstChunk = true;\n this._completeResults = {\n data: [],\n errors: [],\n meta: {},\n };\n replaceConfig.call(this, config);\n\n this.parseChunk = function(chunk, isFakeChunk) {\n // First chunk pre-processing\n if (this.isFirstChunk && isFunction(this._config.beforeFirstChunk)) {\n var modifiedChunk = this._config.beforeFirstChunk(chunk);\n if (modifiedChunk !== undefined) chunk = modifiedChunk;\n }\n this.isFirstChunk = false;\n\n // Rejoin the line we likely just split in two by chunking the file\n var aggregate = this._partialLine + chunk;\n this._partialLine = '';\n\n var results = this._handle.parse(\n aggregate,\n this._baseIndex,\n !this._finished\n );\n\n if (this._handle.paused() || this._handle.aborted()) return;\n\n var lastIndex = results.meta.cursor;\n\n if (!this._finished) {\n this._partialLine = aggregate.substring(lastIndex - this._baseIndex);\n this._baseIndex = lastIndex;\n }\n\n if (results && results.data) this._rowCount += results.data.length;\n\n var finishedIncludingPreview =\n this._finished ||\n (this._config.preview && this._rowCount >= this._config.preview);\n\n if (IS_PAPA_WORKER) {\n global.postMessage({\n results: results,\n workerId: Papa.WORKER_ID,\n finished: finishedIncludingPreview,\n });\n } else if (isFunction(this._config.chunk) && !isFakeChunk) {\n this._config.chunk(results, this._handle);\n if (this._handle.paused() || this._handle.aborted()) return;\n results = undefined;\n this._completeResults = undefined;\n }\n\n if (!this._config.step && !this._config.chunk) {\n this._completeResults.data = this._completeResults.data.concat(\n results.data\n );\n this._completeResults.errors = this._completeResults.errors.concat(\n results.errors\n );\n this._completeResults.meta = results.meta;\n }\n\n if (\n !this._completed &&\n finishedIncludingPreview &&\n isFunction(this._config.complete) &&\n (!results || !results.meta.aborted)\n ) {\n this._config.complete(this._completeResults, this._input);\n this._completed = true;\n }\n\n if (!finishedIncludingPreview && (!results || !results.meta.paused))\n this._nextChunk();\n\n return results;\n };\n\n this._sendError = function(error) {\n if (isFunction(this._config.error)) this._config.error(error);\n else if (IS_PAPA_WORKER && this._config.error) {\n global.postMessage({\n workerId: Papa.WORKER_ID,\n error: error,\n finished: false,\n });\n }\n };\n\n function replaceConfig(config) {\n // Deep-copy the config so we can edit it\n var configCopy = copy(config);\n configCopy.chunkSize = parseInt(configCopy.chunkSize); // parseInt VERY important so we don't concatenate strings!\n if (!config.step && !config.chunk) configCopy.chunkSize = null; // disable Range header if not streaming; bad values break IIS - see issue #196\n this._handle = new ParserHandle(configCopy);\n this._handle.streamer = this;\n this._config = configCopy; // persist the copy to the caller\n }\n }", "constructor(options) {\n this.closed = false;\n this.options = options;\n this.disableSourceMaps = options.disableSourceMaps || false;\n this.client = new BrowserClient(options);\n this.logger = new Logger();\n this.context = new Context(options.context);\n this.enhancer = new CodeEnhancer();\n this.filters = new Filters(options);\n\n this.processors = [new Location(), new UserAgent()];\n\n this.groupProcessor = new AssignGroup();\n }", "constructor(options) {\n\t\tthis.options = options;\n\t}", "function SerializedStructure(text, options){\n var parsed = syntactic.parse(text);\n this.structure = parsed.structure;\n this.hints = parsed.comments;\n this.ignore = options && options.ignore ? options.ignore : null;\n this.serialized = {};\n\n // do the serialization\n this._serialize(this.structure, '');\n }", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n }", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n }", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n }", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n }", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n }", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n }", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n }", "function TextBuffer( options = {} ) {\n\tthis.ScreenBuffer = options.ScreenBuffer || ( options.dst && options.dst.constructor ) || termkit.ScreenBuffer ;\n\n\t// a screenBuffer\n\tthis.dst = options.dst ;\n\tthis.palette = options.palette || ( this.dst && this.dst.palette ) ;\n\n\t// virtually infinity by default\n\tthis.width = options.width || Infinity ;\t// not used except by the blitter\n\tthis.height = options.height || Infinity ;\t// not used except by the blitter\n\tthis.dstClipRect = options.dstClipRect ? new termkit.Rect( options.dstClipRect ) : null ;\n\n\tthis.x = options.x || 0 ;\n\tthis.y = options.y || 0 ;\n\n\tthis.firstLineRightShift = options.firstLineRightShift || 0 ;\n\n\tthis.cx = 0 ;\n\tthis.cy = 0 ;\n\tthis.ch = false ;\t// cursor hidden\n\n\tthis.voidTextBuffer = null ;\t// Another TextBuffer used as fallback for empty cells, usefull for placeholder/hint/etc\n\n\tthis.defaultAttr = this.ScreenBuffer.prototype.DEFAULT_ATTR ;\n\tthis.voidAttr = this.ScreenBuffer.prototype.DEFAULT_ATTR ;\n\tthis.preserveMarkupFormat = this.ScreenBuffer.prototype.preserveMarkupFormat ;\n\tthis.markupToAttrObject = this.ScreenBuffer.prototype.markupToAttrObject ;\n\n\tthis.hidden = false ;\n\n\tthis.tabWidth = + options.tabWidth || 4 ;\n\tthis.forceInBound = !! options.forceInBound ;\n\n\t// If set to a number, force line-splitting when exceeding that width\n\tthis.lineWrapWidth = options.lineWrapWidth || null ;\n\n\t// If true, force word-aware line-splitting\n\tthis.wordWrap = !! options.wordWrap ;\n\n\t// DEPRECATED but kept for backward compatibility.\n\tif ( options.wordWrapWidth ) {\n\t\tthis.lineWrapWidth = options.wordWrapWidth ;\n\t\tthis.wordWrap = true ;\n\t}\n\n\tthis.selectionRegion = null ;\n\n\tthis.buffer = [ [] ] ;\n\n\tthis.stateMachine = options.stateMachine || null ;\n\n\tif ( options.hidden ) { this.setHidden( options.hidden ) ; }\n}", "constructor(options) {\n const opts = options || {};\n super(opts);\n\n this.simplex = opts.simplex || false;\n this.stem_width = opts.stem_width || 0.006;\n }", "function FrameStreamingParser (options) {\n Writable.call(this, options);\n //frames that are streaming, indexed by id\n this.frames = {};\n}", "function processLine (context, line) {\n const object = parseJSON(line)\n if (object == null) return\n\n context.buffer.objects.push(object)\n\n if (!shouldProcessBuffer(context)) return\n\n processBuffer(context)\n}", "function IconvLiteDecoderStream(conv, options) {\n\t this.conv = conv;\n\t options = options || {};\n\t options.encoding = this.encoding = 'utf8'; // We output strings.\n\t Transform.call(this, options);\n\t}", "function IconvLiteDecoderStream(conv, options) {\n\t this.conv = conv;\n\t options = options || {};\n\t options.encoding = this.encoding = 'utf8'; // We output strings.\n\t Transform.call(this, options);\n\t}", "constructor(content, options) {\n this.options = options || {};\n this.content = Array.isArray(content) ? content : [content];\n }", "constructor(content, options) {\n this.options = options || {};\n this.content = Array.isArray(content) ? content : [content];\n }", "function _setOptions(obj, options) {\n options = options || {};\n obj.separator = (typeof options.separator !== 'undefined') ? options.separator : ',';\n obj.quotechar = (typeof options.quote !== 'undefined') ? options.quote : '\"';\n obj.escapechar = (typeof options.escape !== 'undefined') ? options.escape : '\"';\n obj.commentchar = (typeof options.comment !== 'undefined') ? options.comment : '';\n obj.columnNames = (typeof options.columnNames !== 'undefined') ? options.columnNames : [];\n obj.columnsFromHeader = (typeof options.columnsFromHeader !== 'undefined') ? options.columnsFromHeader : false;\n obj.nestedQuotes = (typeof options.nestedQuotes !== 'undefined') ? options.nestedQuotes : false;\n obj.escapeFormulas = (typeof options.escapeFormulas !== 'undefined') ? options.escapeFormulas : false;\n}", "constructor(options) {\n this.config = Object.assign({\n channelMap: ChannelMap.Default,\n renderingMode: RenderingMode.Ambisonic,\n }, options);\n if (this.config.channelMap instanceof Array\n && this.config.channelMap.length !== 4) {\n throw new Error('FOARenderer: Invalid channel map. (got ' + this.config.channelMap\n + ')');\n }\n if (this.config.hrirPathList && this.config.hrirPathList.length !== 2) {\n throw new Error('FOARenderer: Invalid HRIR URLs. It must be an array with ' +\n '2 URLs to HRIR files. (got ' + this.config.hrirPathList + ')');\n }\n this.buildAudioGraph();\n }", "function ChunkStreamer(config)\n\t{\n\t\tthis._handle = null;\n\t\tthis._paused = false;\n\t\tthis._finished = false;\n\t\tthis._input = null;\n\t\tthis._baseIndex = 0;\n\t\tthis._partialLine = \"\";\n\t\tthis._rowCount = 0;\n\t\tthis._start = 0;\n\t\tthis._nextChunk = null;\n\t\tthis._completeResults = {\n\t\t\tdata: [],\n\t\t\terrors: [],\n\t\t\tmeta: {}\n\t\t};\n\t\treplaceConfig.call(this, config);\n\n\t\tthis.parseChunk = function(chunk)\n\t\t{\n\t\t\t// Rejoin the line we likely just split in two by chunking the file\n\t\t\tvar aggregate = this._partialLine + chunk;\n\t\t\tthis._partialLine = \"\";\n\n\t\t\tvar results = this._handle.parse(aggregate, this._baseIndex, !this._finished);\n\t\t\t\n\t\t\tif (this._handle.paused() || this._handle.aborted())\n\t\t\t\treturn;\n\t\t\t\n\t\t\tvar lastIndex = results.meta.cursor;\n\t\t\t\n\t\t\tif (!this._finished)\n\t\t\t{\n\t\t\t\tthis._partialLine = aggregate.substring(lastIndex - this._baseIndex);\n\t\t\t\tthis._baseIndex = lastIndex;\n\t\t\t}\n\n\t\t\tif (results && results.data)\n\t\t\t\tthis._rowCount += results.data.length;\n\n\t\t\tvar finishedIncludingPreview = this._finished || (this._config.preview && this._rowCount >= this._config.preview);\n\n\t\t\tif (IS_WORKER)\n\t\t\t{\n\t\t\t\tglobal.postMessage({\n\t\t\t\t\tresults: results,\n\t\t\t\t\tworkerId: Papa.WORKER_ID,\n\t\t\t\t\tfinished: finishedIncludingPreview\n\t\t\t\t});\n\t\t\t}\n\t\t\telse if (isFunction(this._config.chunk))\n\t\t\t{\n\t\t\t\tthis._config.chunk(results, this._handle);\n\t\t\t\tif (this._paused)\n\t\t\t\t\treturn;\n\t\t\t\tresults = undefined;\n\t\t\t\tthis._completeResults = undefined;\n\t\t\t}\n\n\t\t\tif (!this._config.step && !this._config.chunk) {\n\t\t\t\tthis._completeResults.data = this._completeResults.data.concat(results.data);\n\t\t\t\tthis._completeResults.errors = this._completeResults.errors.concat(results.errors);\n\t\t\t\tthis._completeResults.meta = results.meta;\n\t\t\t}\n\n\t\t\tif (finishedIncludingPreview && isFunction(this._config.complete) && (!results || !results.meta.aborted))\n\t\t\t\tthis._config.complete(this._completeResults);\n\n\t\t\tif (!finishedIncludingPreview && (!results || !results.meta.paused))\n\t\t\t\tthis._nextChunk();\n\n\t\t\treturn results;\n\t\t};\n\n\t\tthis._sendError = function(error)\n\t\t{\n\t\t\tif (isFunction(this._config.error))\n\t\t\t\tthis._config.error(error);\n\t\t\telse if (IS_WORKER && this._config.error)\n\t\t\t{\n\t\t\t\tglobal.postMessage({\n\t\t\t\t\tworkerId: Papa.WORKER_ID,\n\t\t\t\t\terror: error,\n\t\t\t\t\tfinished: false\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tfunction replaceConfig(config)\n\t\t{\n\t\t\t// Deep-copy the config so we can edit it\n\t\t\tvar configCopy = copy(config);\n\t\t\tconfigCopy.chunkSize = parseInt(configCopy.chunkSize);\t// VERY important so we don't concatenate strings!\n\t\t\tthis._handle = new ParserHandle(configCopy);\n\t\t\tthis._handle.streamer = this;\n\t\t\tthis._config = configCopy;\t// persist the copy to the caller\n\t\t}\n\t}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n Transform.call(this, options);\n}", "function ZXYStream(source, options) {\n if (!source) throw new TypeError('MBTiles source required');\n\n options = options || {};\n\n this.source = source;\n this.batch = options.batch || 1000;\n\n stream.Readable.call(this);\n}", "function IconvLiteDecoderStream(conv, options) {\n this.conv = conv;\n options = options || {};\n options.encoding = this.encoding = 'utf8'; // We output strings.\n\n Transform.call(this, options);\n}", "function ChunkStreamer(config)\n\t\t{\n\t\t\tthis._handle = null;\n\t\t\tthis._finished = false;\n\t\t\tthis._completed = false;\n\t\t\tthis._halted = false;\n\t\t\tthis._input = null;\n\t\t\tthis._baseIndex = 0;\n\t\t\tthis._partialLine = '';\n\t\t\tthis._rowCount = 0;\n\t\t\tthis._start = 0;\n\t\t\tthis._nextChunk = null;\n\t\t\tthis.isFirstChunk = true;\n\t\t\tthis._completeResults = {\n\t\t\t\tdata: [],\n\t\t\t\terrors: [],\n\t\t\t\tmeta: {}\n\t\t\t};\n\t\t\treplaceConfig.call(this, config);\n\n\t\t\tthis.parseChunk = function(chunk, isFakeChunk)\n\t\t\t{\n\t\t\t\t// First chunk pre-processing\n\t\t\t\tif (this.isFirstChunk && isFunction(this._config.beforeFirstChunk))\n\t\t\t\t{\n\t\t\t\t\tvar modifiedChunk = this._config.beforeFirstChunk(chunk);\n\t\t\t\t\tif (modifiedChunk !== undefined)\n\t\t\t\t\t\tchunk = modifiedChunk;\n\t\t\t\t}\n\t\t\t\tthis.isFirstChunk = false;\n\t\t\t\tthis._halted = false;\n\n\t\t\t\t// Rejoin the line we likely just split in two by chunking the file\n\t\t\t\tvar aggregate = this._partialLine + chunk;\n\t\t\t\tthis._partialLine = '';\n\n\t\t\t\tvar results = this._handle.parse(aggregate, this._baseIndex, !this._finished);\n\n\t\t\t\tif (this._handle.paused() || this._handle.aborted()) {\n\t\t\t\t\tthis._halted = true;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar lastIndex = results.meta.cursor;\n\n\t\t\t\tif (!this._finished)\n\t\t\t\t{\n\t\t\t\t\tthis._partialLine = aggregate.substring(lastIndex - this._baseIndex);\n\t\t\t\t\tthis._baseIndex = lastIndex;\n\t\t\t\t}\n\n\t\t\t\tif (results && results.data)\n\t\t\t\t\tthis._rowCount += results.data.length;\n\n\t\t\t\tvar finishedIncludingPreview = this._finished || (this._config.preview && this._rowCount >= this._config.preview);\n\n\t\t\t\tif (IS_PAPA_WORKER)\n\t\t\t\t{\n\t\t\t\t\tglobal.postMessage({\n\t\t\t\t\t\tresults: results,\n\t\t\t\t\t\tworkerId: Papa.WORKER_ID,\n\t\t\t\t\t\tfinished: finishedIncludingPreview\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse if (isFunction(this._config.chunk) && !isFakeChunk)\n\t\t\t\t{\n\t\t\t\t\tthis._config.chunk(results, this._handle);\n\t\t\t\t\tif (this._handle.paused() || this._handle.aborted()) {\n\t\t\t\t\t\tthis._halted = true;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tresults = undefined;\n\t\t\t\t\tthis._completeResults = undefined;\n\t\t\t\t}\n\n\t\t\t\tif (!this._config.step && !this._config.chunk) {\n\t\t\t\t\tthis._completeResults.data = this._completeResults.data.concat(results.data);\n\t\t\t\t\tthis._completeResults.errors = this._completeResults.errors.concat(results.errors);\n\t\t\t\t\tthis._completeResults.meta = results.meta;\n\t\t\t\t}\n\n\t\t\t\tif (!this._completed && finishedIncludingPreview && isFunction(this._config.complete) && (!results || !results.meta.aborted)) {\n\t\t\t\t\tthis._config.complete(this._completeResults, this._input);\n\t\t\t\t\tthis._completed = true;\n\t\t\t\t}\n\n\t\t\t\tif (!finishedIncludingPreview && (!results || !results.meta.paused))\n\t\t\t\t\tthis._nextChunk();\n\n\t\t\t\treturn results;\n\t\t\t};\n\n\t\t\tthis._sendError = function(error)\n\t\t\t{\n\t\t\t\tif (isFunction(this._config.error))\n\t\t\t\t\tthis._config.error(error);\n\t\t\t\telse if (IS_PAPA_WORKER && this._config.error)\n\t\t\t\t{\n\t\t\t\t\tglobal.postMessage({\n\t\t\t\t\t\tworkerId: Papa.WORKER_ID,\n\t\t\t\t\t\terror: error,\n\t\t\t\t\t\tfinished: false\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tfunction replaceConfig(config)\n\t\t\t{\n\t\t\t\t// Deep-copy the config so we can edit it\n\t\t\t\tvar configCopy = copy(config);\n\t\t\t\tconfigCopy.chunkSize = parseInt(configCopy.chunkSize);\t// parseInt VERY important so we don't concatenate strings!\n\t\t\t\tif (!config.step && !config.chunk)\n\t\t\t\t\tconfigCopy.chunkSize = null; // disable Range header if not streaming; bad values break IIS - see issue #196\n\t\t\t\tthis._handle = new ParserHandle(configCopy);\n\t\t\t\tthis._handle.streamer = this;\n\t\t\t\tthis._config = configCopy;\t// persist the copy to the caller\n\t\t\t}\n\t\t}", "function ChunkStreamer(config)\n\t{\n\t\tthis._handle = null;\n\t\tthis._paused = false;\n\t\tthis._finished = false;\n\t\tthis._input = null;\n\t\tthis._baseIndex = 0;\n\t\tthis._partialLine = \"\";\n\t\tthis._rowCount = 0;\n\t\tthis._start = 0;\n\t\tthis._nextChunk = null;\n\t\tthis.isFirstChunk = true;\n\t\tthis._completeResults = {\n\t\t\tdata: [],\n\t\t\terrors: [],\n\t\t\tmeta: {}\n\t\t};\n\t\treplaceConfig.call(this, config);\n\n\t\tthis.parseChunk = function(chunk)\n\t\t{\n\t\t\t// First chunk pre-processing\n\t\t\tif (this.isFirstChunk && isFunction(this._config.beforeFirstChunk))\n\t\t\t{\n\t\t\t\tvar modifiedChunk = this._config.beforeFirstChunk(chunk);\n\t\t\t\tif (modifiedChunk !== undefined)\n\t\t\t\t\tchunk = modifiedChunk;\n\t\t\t}\n\t\t\tthis.isFirstChunk = false;\n\n\t\t\t// Rejoin the line we likely just split in two by chunking the file\n\t\t\tvar aggregate = this._partialLine + chunk;\n\t\t\tthis._partialLine = \"\";\n\n\t\t\tvar results = this._handle.parse(aggregate, this._baseIndex, !this._finished);\n\t\t\t\n\t\t\tif (this._handle.paused() || this._handle.aborted())\n\t\t\t\treturn;\n\t\t\t\n\t\t\tvar lastIndex = results.meta.cursor;\n\t\t\t\n\t\t\tif (!this._finished)\n\t\t\t{\n\t\t\t\tthis._partialLine = aggregate.substring(lastIndex - this._baseIndex);\n\t\t\t\tthis._baseIndex = lastIndex;\n\t\t\t}\n\n\t\t\tif (results && results.data)\n\t\t\t\tthis._rowCount += results.data.length;\n\n\t\t\tvar finishedIncludingPreview = this._finished || (this._config.preview && this._rowCount >= this._config.preview);\n\n\t\t\tif (IS_PAPA_WORKER)\n\t\t\t{\n\t\t\t\tglobal.postMessage({\n\t\t\t\t\tresults: results,\n\t\t\t\t\tworkerId: Papa.WORKER_ID,\n\t\t\t\t\tfinished: finishedIncludingPreview\n\t\t\t\t});\n\t\t\t}\n\t\t\telse if (isFunction(this._config.chunk))\n\t\t\t{\n\t\t\t\tthis._config.chunk(results, this._handle);\n\t\t\t\tif (this._paused)\n\t\t\t\t\treturn;\n\t\t\t\tresults = undefined;\n\t\t\t\tthis._completeResults = undefined;\n\t\t\t}\n\n\t\t\tif (!this._config.step && !this._config.chunk) {\n\t\t\t\tthis._completeResults.data = this._completeResults.data.concat(results.data);\n\t\t\t\tthis._completeResults.errors = this._completeResults.errors.concat(results.errors);\n\t\t\t\tthis._completeResults.meta = results.meta;\n\t\t\t}\n\n\t\t\tif (finishedIncludingPreview && isFunction(this._config.complete) && (!results || !results.meta.aborted))\n\t\t\t\tthis._config.complete(this._completeResults);\n\n\t\t\tif (!finishedIncludingPreview && (!results || !results.meta.paused))\n\t\t\t\tthis._nextChunk();\n\n\t\t\treturn results;\n\t\t};\n\n\t\tthis._sendError = function(error)\n\t\t{\n\t\t\tif (isFunction(this._config.error))\n\t\t\t\tthis._config.error(error);\n\t\t\telse if (IS_PAPA_WORKER && this._config.error)\n\t\t\t{\n\t\t\t\tglobal.postMessage({\n\t\t\t\t\tworkerId: Papa.WORKER_ID,\n\t\t\t\t\terror: error,\n\t\t\t\t\tfinished: false\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tfunction replaceConfig(config)\n\t\t{\n\t\t\t// Deep-copy the config so we can edit it\n\t\t\tvar configCopy = copy(config);\n\t\t\tconfigCopy.chunkSize = parseInt(configCopy.chunkSize);\t// parseInt VERY important so we don't concatenate strings!\n\t\t\tif (!config.step && !config.chunk)\n\t\t\t\tconfigCopy.chunkSize = null; // disable Range header if not streaming; bad values break IIS - see issue #196\n\t\t\tthis._handle = new ParserHandle(configCopy);\n\t\t\tthis._handle.streamer = this;\n\t\t\tthis._config = configCopy;\t// persist the copy to the caller\n\t\t}\n\t}", "function VFile$1(options) {\n var prop;\n var index;\n\n if (!options) {\n options = {};\n } else if (typeof options === 'string' || buffer$1(options)) {\n options = {contents: options};\n } else if ('message' in options && 'messages' in options) {\n return options\n }\n\n if (!(this instanceof VFile$1)) {\n return new VFile$1(options)\n }\n\n this.data = {};\n this.messages = [];\n this.history = [];\n this.cwd = proc$1.cwd();\n\n // Set path related properties in the correct order.\n index = -1;\n\n while (++index < order$3.length) {\n prop = order$3[index];\n\n if (own$c.call(options, prop)) {\n this[prop] = options[prop];\n }\n }\n\n // Set non-path related properties.\n for (prop in options) {\n if (order$3.indexOf(prop) < 0) {\n this[prop] = options[prop];\n }\n }\n}" ]
[ "0.598805", "0.5458345", "0.53923386", "0.53203326", "0.5241645", "0.5241645", "0.5212115", "0.51200736", "0.51083565", "0.51083565", "0.50362635", "0.5031804", "0.50278515", "0.5024184", "0.5013628", "0.5013628", "0.50017864", "0.50017864", "0.50017864", "0.50017864", "0.50017864", "0.50017864", "0.49733877", "0.49626094", "0.49511814", "0.49485794", "0.49387798", "0.4937403", "0.4908389", "0.49075368", "0.49068788", "0.49009994", "0.48587918", "0.48404267", "0.48352268", "0.48298413", "0.48133534", "0.48063594", "0.48007184", "0.4772981", "0.4771519", "0.47634012", "0.47517887", "0.47513056", "0.4740268", "0.4731951", "0.4731951", "0.4731951", "0.4731951", "0.4731951", "0.4731951", "0.47224176", "0.47053975", "0.4692621", "0.46875238", "0.46797186", "0.46797186", "0.4679698", "0.4679698", "0.4668997", "0.4665357", "0.46455437", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46319723", "0.46236312", "0.46193263", "0.46189448", "0.46021086", "0.45997143" ]
0.63171875
0
Base pairs are a pair of AT and CG. pairElement("ATCGA") should return [["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]]. pairElement("TTGAG") should return [["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]]. pairElement("CTCTA") should return [["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]]. split("") the str to turn into an array create a for loop for the newly created array create the switch() statement for each iterated element. case "A" : ["A", "T"]; break; case "C" : newArr.push(["C", "G"]); break; return newArr;
function pairElement(str) { let arr = str.split(""); let newArr = []; let len = arr.length; for (let i = 0; i < len; i++) { switch(arr[i]) { case 'A': newArr.push(['A', 'T']); break; case 'T': newArr.push(['T', 'A']); break; case 'C': newArr.push(['C', 'G']); break; case 'G': newArr.push(['G','C']); break; } } return newArr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pairElement(str) {\n let at = ['A','T'];\n let ta = ['T','A'];\n let gc = ['G','C'];\n let cg = ['C','G'];\n let returnArr = [];\n let arr = str.split(\"\");\n \n arr.map(k => {\n if(k === \"A\") {\n returnArr.push(at);\n } else if(k === \"T\") {\n returnArr.push(ta);\n } else if(k === \"G\") {\n returnArr.push(gc);\n } else {\n returnArr.push(cg);\n } \n })\n return returnArr;\n}", "function pairElement(str) {\n var result = [];\n var twoDeeArray = [];\n for (var x = 0; x < str.length; x++){\n switch(str[x].toUpperCase()){\n case \"A\":\n twoDeeArray.push(\"A\");\n twoDeeArray.push(\"T\");\n result.push(twoDeeArray);\n twoDeeArray = [];\n break;\n case \"C\":\n twoDeeArray.push(\"C\");\n twoDeeArray.push(\"G\");\n result.push(twoDeeArray);\n twoDeeArray = [];\n break;\n case \"G\":\n twoDeeArray.push(\"G\");\n twoDeeArray.push(\"C\");\n result.push(twoDeeArray);\n twoDeeArray = [];\n break;\n case \"T\":\n twoDeeArray.push(\"T\");\n twoDeeArray.push(\"A\");\n result.push(twoDeeArray);\n twoDeeArray = [];\n break;\n default:\n break;\n }\n }\n return result;\n}", "function pairElement(str) {\n let arr = str.split('');\n let newArr = []\n //console.log(arr)\n for (let i = 0; i < arr.length; i++){\n if(arr[i] == 'G'){\n newArr.push(['G', 'C']); \n } else if (arr[i] == 'C'){\n newArr.push(['C', 'G']);\n } else if (arr[i] == 'A'){\n newArr.push(['A', 'T']);\n } else if (arr[i] == 'T'){\n newArr.push(['T', 'A']);\n }\n }\n return newArr\n}", "function pairElement(str) {\n var charArray = str.split(\"\");\n console.log(charArray);\n // var firstChar = charArray[1];\n // console.log(charArray[1]);\n var pairArray = [];\n console.log(pairArray);\n for (var i = 0; i < charArray.length; i++) {\n if (charArray[i] === \"G\") {\n pairArray.push([\"G\", \"C\"]);\n console.log(pairArray);\n }\n else if (charArray[i] == \"C\") {\n pairArray.push([\"C\", \"G\"]);\n console.log(pairArray);\n }\n else if (charArray[i] === \"A\") {\n pairArray.push([\"A\", \"T\"]);\n console.log(pairArray);\n }\n else if (charArray[i] === \"T\") {\n pairArray.push([\"T\", \"A\"]);\n console.log(pairArray);\n }\n }\n return pairArray;\n\n //return str;\n}", "function pairElement(str) {\r\n let arr=str.split('')\r\n\r\n for(var i = 0; i< arr.length; i++){\r\n if(arr[i] === 'C'){\r\n arr[i]=['C','G']\r\n }else if(arr[i] === 'G'){\r\n arr[i]=['G','C']\r\n }else if(arr[i] === 'A'){\r\n arr[i]=['A','T'] \r\n }else if(arr[i] === 'T'){\r\n arr[i]=['T', 'A']\r\n }\r\n }\r\n return arr;\r\n}", "function pairElement(str) {\n // array that will hold base pair arrays\n var dnaPairs = [];\n /* basePairs object that holds (ATGC) and their appropriate pairs. \n Used to return correct pair based on input. */ \n var basePairs = {\n \"A\" : \"T\",\n \"T\" : \"A\",\n \"G\" : \"C\",\n \"C\" : \"G\"\n };\n // Iterating through each character of str\n for (var character of str) {\n // Pair array where original char and it's pair will be pushed onto\n var pair = [];\n // Push onto pair -- the original character and value from basePairs that corresponds to that char.\n pair.push(character , basePairs[character]);\n // Push pair onto dnaPairs\n dnaPairs.push(pair);\n }\n\n return dnaPairs;\n }", "function pairElement6(str) {\n let newArr = [];\n\n for (let i = 0; i < str.length; i++) {\n switch (str[i]) {\n case \"A\":\n newArr.push([\"A\", \"T\"]);\n break;\n case \"T\":\n newArr.push([\"T\", \"A\"]);\n break;\n case \"C\":\n newArr.push([\"C\", \"G\"]);\n break;\n case \"G\":\n newArr.push([\"G\", \"C\"]);\n break;\n }\n };\n\n return newArr;\n}", "function pairElement(str) {\n var paired = [];\n \n var search = function(char){\n switch(char){\n case \"A\":\n paired.push(['A', 'T']);\n break;\n \n case \"T\":\n paired.push(['T', 'A']);\n break;\n case \"C\":\n paired.push([\"C\", \"G\"]);\n break;\n case \"G\":\n paired.push([\"G\", \"C\"]);\n break;\n }\n };\n \n for(var i = 0; i < str.length; i++){\n search(str[i])\n }\n return paired;\n }", "function pairElement(str) {\n var a = [];\n var pairs = {\n \"T\": \"A\",\n \"A\": \"T\",\n \"G\": \"C\",\n \"C\": \"G\"\n };\n for(i=0; i<str.length; i++){\n var temp = [];\n temp.push(str.charAt(i));\n temp.push(pairs[str.charAt(i)]);\n a.push(temp);\n }\n return a;\n}", "function pair(str) {\r\n\tvar pair1 = [\"A\", \"T\"];\r\n\tvar pair2 = [\"C\", \"G\"];\r\n\tvar toPair = str.split(\"\");\r\n\tvar result = [];\r\n\tfor(var i = 0; i < toPair.length; i++) {\r\n\t\tvar arr = [];\r\n\t\tarr.push(toPair[i]);\r\n\t\tif(pair1[0] === toPair[i]) {\r\n\t\t\tarr.push(pair1[1]);\r\n\t\t}\r\n\t\telse if(pair1[1] === toPair[i]) {\r\n\t\t\tarr.push(pair1[0]);\r\n\t\t}\r\n\r\n\t\telse if(pair2[0] === toPair[i]) {\r\n\t\t\tarr.push(pair2[1]);\r\n\t\t}\r\n\t\telse if(pair2[1] === toPair[i]) {\r\n\t\t\tarr.push(pair2[0]);\r\n\t\t}\r\n\t\tresult.push(arr);\r\n\r\n\t}\t\r\n\tconsole.log(result);\r\n return result;\r\n}", "function pairElement(str) {\r\n var paired = [];\r\n str = str.split(\"\");\r\n for (let i = 0; i < str.length; i++) {\r\n if (str[i] === \"G\") {\r\n paired.push([\"G\", \"C\"]);\r\n } else if (str[i] === \"C\") {\r\n paired.push([\"C\", \"G\"]);\r\n } else if (str[i] === \"A\") {\r\n paired.push([\"A\", \"T\"]);\r\n } else if (str[i] === \"T\") {\r\n paired.push([\"T\", \"A\"]);\r\n } \r\n }\r\n console.table(paired);\r\n}", "function pairElement(str) {\n let pairArray = str.split(\"\");\n let newArray = [];\n //console.log(pairArray);\n\n //encapsulate each individual item in its own array\n for (let i = 0; i < pairArray.length; i++) {\n newArray.push([pairArray[i]]);\n }\n\n for (let i = 0; i < newArray.length; i++) {\n //access first element of index i array and check its first letter, based on first\n //letter decide what character needs to be added to complete pair.\n if (newArray[i][0] === \"T\") {\n console.log(\"yes\");\n newArray[i].push(\"A\");\n } else if (newArray[i][0] === \"A\") {\n console.log(\"yes\");\n newArray[i].push(\"T\");\n } else if (newArray[i][0] === \"C\") {\n console.log(\"yes\");\n newArray[i].push(\"G\");\n } else if (newArray[i][0] === \"G\") {\n console.log(\"yes\");\n newArray[i].push(\"C\");\n }\n console.log(newArray[0][i]);\n }\n console.log(newArray);\n return newArray;\n}", "function pairElement(str){\n var str = str.split(\"\");\n var newStr = [];\n var pairs = {\n A: \"T\",\n T: \"A\",\n C: \"G\",\n G: \"C\"\n }\n for(var i = 0; i < str.length; i++){\n newStr.push([str[i], pairs[str[i]]]);\n }\n return newStr;\n}", "function pairElement(str) {\n\tlet parts = Array.from(str);\n\n\t// mapping of pairs to other half\n\tconst getOtherHalf = function(character) {\n\t\tlet pair = [];\n\n\t\tswitch (character) {\n\t\t case 'T':\n\t\t pair.push(character, 'A');\n\t\t break;\n\n\t\t case 'A':\n\t\t \tpair.push(character, 'T');\n\t\t \tbreak;\n\n\t\t case 'G':\n\t\t \tpair.push(character, 'C');\n\t\t break;\n\n\t\t default:\n\t\t \t// possibly bit bad practice to set an option here as default!\n\t\t \tpair.push(character, 'G');\n\t\t}\n\t\treturn pair;\n\t}\n\n\tlet pairs = parts.map(halfpair => getOtherHalf(halfpair));\n return pairs;\n}", "function pairElement(str) {\n\treturn str\n\t\t.split('')\n\t\t.map((letter) =>\n\t\t\tletter === 'A'\n\t\t\t\t? ['A', 'T']\n\t\t\t\t: letter === 'T'\n\t\t\t\t? ['T', 'A']\n\t\t\t\t: letter === 'C'\n\t\t\t\t? ['C', 'G']\n\t\t\t\t: ['G', 'C']\n\t\t);\n}", "static pairElement(str) {\n\n const Pair = {\n A() {return \"T\";},\n T() {return \"A\";},\n C() {return \"G\";},\n G() {return \"C\";} \n };\n let singleElements = str.split(\"\");\n return singleElements.map(element => [element, Pair[element]()]);\n }", "function pairElement(str) {\n let dnaArr = [...str];\n let finalArr = [];\n for(let i = 0; i < dnaArr.length; i++){\n var paired;\n switch (dnaArr[i]){\n case \"C\":\n paired = \"G\";\n break;\n case \"A\":\n paired = \"T\";\n break;\n case \"G\":\n paired = \"C\";\n break;\n case \"T\":\n paired = \"A\";\n break;\n default:\n paired = \"N/A\";\n }\n finalArr.push([dnaArr[i], paired]);\n }\n return finalArr;\n}", "function pair(str) {\n // get length of str and loop through\n var len = str.length,\n counter = 0,\n list = str.split('');\n\n for (var i = 0; i < len; i++) {\n switch (list[i]) {\n case 'A':\n list.push(['A', 'T']);\n break;\n case 'C':\n list.push(['C', 'G']);\n break;\n case 'T':\n list.push(['T', 'A']);\n break;\n case 'G':\n list.push(['G', 'C']);\n break;\n }\n }\n while (counter < len) {\n list.shift();\n counter++;\n }\n console.log(list);\n return list;\n}", "function pairElement(str) {\n // Return each strand as an array of two elements, the original and the pair.\n var paired = [];\n\n // Function to check with strand to pair.\n var search = function(char) {\n switch (char) {\n case \"A\":\n paired.push([\"A\", \"T\"]);\n break;\n case \"T\":\n paired.push([\"T\", \"A\"]);\n break;\n case \"C\":\n paired.push([\"C\", \"G\"]);\n break;\n case \"G\":\n paired.push([\"G\", \"C\"]);\n break;\n }\n };\n\n // Loops through the input and pair.\n for (var i = 0; i < str.length; i++) {\n search(str[i]);\n }\n\n return paired;\n}", "function pairElement(str) {\n let result = \"\"\n for (let i = 0; i < str.length; i++) {\n // if (str[i] == 'A') {\n // result = result + 'T'\n // } else if (str[i] == 'T') {\n // result = result + 'A'\n // } else if (str[i] == 'C') {\n // result = result + 'G'\n // } else if (str[i] == 'G') {\n // result = result + 'C'\n // }\n switch (str[i]) {\n case 'A':\n result = result + 'T'\n break\n case 'T':\n result = result + 'A'\n break;\n case 'C':\n result = result + 'G'\n break\n case 'G':\n result = result + 'C'\n break\n }\n }\n return result;\n}", "function pair(str) {\n //define a map object with all pair possibilities\n var map = {T:'A', A:'T', G:'C', C:'G'};\n //split str into a char Array\n strArr = str.split('');\n //replace each Array item with a 2d Array using map\n for (var i=0;i<strArr.length;i++){\n strArr[i]=[strArr[i], map[strArr[i]]];\n }\n return strArr;\n}", "function pairElement(str) {\r\n return str.split(\"\").map(p => [p, pairs[p]]);\r\n}", "function pairDNA(str) {\r\n var pairs = {\r\n A: \"T\",\r\n T: \"A\",\r\n C: \"G\",\r\n G: \"C\"\r\n };\r\n return str.split(\"\").map(x => [x, pairs[x]]);\r\n}", "function pairElement(str) {\n let dnaPairs = {\n A: ['A', 'T'],\n T: ['T', 'A'],\n C: ['C', 'G'],\n G: ['G', 'C'],\n }\n return str.split('').map(dnaCharacter => dnaPairs[dnaCharacter]);\n}", "function pairElement7(str) {\n const pairs = {\n A: \"T\",\n T: \"A\",\n C: \"G\",\n G: \"C\"\n };\n const arr = str.split(\"\");\n return arr.map(char => [char, pairs[char]]);\n}", "function dnaPair(str){\n var pairs = {\n \"A\": \"T\",\n \"T\": \"A\",\n \"C\": \"G\",\n \"G\": \"C\"\n }\n var arr = str.split(\"\");\n return arr.map(x => [x , pairs[x]]);\n}", "function stringCreation(str) {\n var pair = \"\";\n for(var i = 0; i <= str.length; i++){\n if(str[i] === \"C\"){\n pair = pair + \"G\";\n } else if(str[i] === \"G\"){\n pair = pair + \"C\";\n } else if (str[i] === \"A\"){\n pair = pair + \"T\";\n } else if (str[i] === \"T\"){\n pair = pair + \"A\";\n }\n }\n return pair;\n}", "function pairDna(str){\n let dnaArr = [...str];\n let dnaObj = {\n \"A\": \"T\",\n \"T\": \"A\",\n \"C\": \"G\",\n \"G\": \"C\"\n }\n let finalArr = [];\n for(let i = 0; i < dnaArr.length; i++){\n finalArr.push([dnaArr[i], dnaObj[dnaArr[i]]]);\n }\n return finalArr;\n}", "function splitPairs(input) {\n\n //for even lengths:\n //split into pairs of characters\n if (input.length % 2 === 0) {\n input = input.split('')\n }\n\n let newStrEven = [];\n if (input.length % 2 === 0) {\n for (let i = 0; i < input.length; i++) {\n newStrEven.push(input[i] + input[i + 1]) //ok\n input = input.slice(1) //[a, y]\n }\n return newStrEven\n }\n// newStrEven = newStrEven.toString()\nlet newStrOdd = [];\n if (input.length % 2 !== 0) {\n for (let j = 0; j < input.length; j++) {\n if (input.length >= 2) {\n if (input[j] === input[input.length - 1] && input[j] !== input[0]) {\n newStrOdd.push(input[j] + \"_\")\n } else {\n newStrOdd.push(input[j] + input[j + 1])\n input = input.slice(1)\n // console.log(input)\n }\n }\n }\n return newStrOdd\n }\n}", "function arrayPairs(arr) {\n // YOUR WORK HERE\n let result = [];\n function pairArr(i) {\n if (i >= arr.length) return;\n result.push([arr[i], arr[i + 1]]);\n pairArr(i + 2);\n }\n pairArr(0);\n return result;\n}", "function allPairings(list) {\r\n\t// Base case: a list with two elements' only pairing is itself.\r\n\tif (list.length == 2) {\r\n\t\treturn [[list]]\r\n\t}\r\n\t\r\n\t// Recursive case: take each possible pair of elements (i,j) and then\r\n\t// recursively pair the remaining elements.\r\n\tlet pairings = [];\r\n\tlet i = 0;\r\n\t\r\n\tfor (let j = 1; j < list.length; j++) {\r\n\t\tlet remaining = list.concat()\r\n\t\tremaining.splice(i,1)\r\n\t\tremaining.splice(j-1,1)\r\n\t\t\r\n\t\tallPairings(remaining).forEach(p => {\r\n\t\t\tlet pairing = [[list[i], list[j]]]\r\n\t\t\tpairing.push(...p)\r\n\t\t\tpairings.push(pairing)\r\n\t\t})\r\n\t}\r\n\t\r\n\treturn pairings;\r\n}", "function unpackDNA(dataView: DataView, startBasePair: number, numBasePairs: number): Array<string> {\n var basePairs: Array<string> = [];\n basePairs.length = dataView.byteLength * 4; // pre-allocate\n var basePairIdx = -startBasePair;\n for (var i = 0; i < dataView.byteLength; i++) {\n var packed = dataView.getUint8(i);\n for (var shift = 6; shift >= 0; shift -= 2) {\n var bp = BASE_PAIRS[(packed >> shift) & 3];\n if (startBasePair >= 0) {\n basePairs[basePairIdx] = bp;\n }\n basePairIdx++;\n }\n }\n // Remove base pairs from the end if the sequence terminated mid-byte.\n basePairs.length = numBasePairs;\n return basePairs;\n}", "function generateCombinations(string) {\n let result = [];\n\n for (let i = 0; i < string.length; i++) { //d\n let character = string.charAt(i);\n let temporaryArray = [character];//[d]\n\n for (let j = 0; j < result.length; j++) {\n temporaryArray.push(result[j] + character);//[o;g]\n }\n result = result.concat(temporaryArray);\n // result = [...result, ...temporaryArray]; //[] + [d, o, g]\n }\n\n return result;\n}", "function regroup(pairs_list){\n var mapping = { 'a-e': [],\n 'f-j': [],\n 'k-o': [],\n 'p-t': [],\n 'u-z': []};\n for (var i in pairs_list){\n var pairs = pairs_list[i];\n for (var j in pairs){\n var p = pairs[j];\n var firstLetterASCII = p[0].charCodeAt(0);\n if((97 <= firstLetterASCII) && (firstLetterASCII <= 101)){\n mapping['a-e'].push(p);\n } else if ((102 <= firstLetterASCII) && (firstLetterASCII <= 106)){\n mapping['f-j'].push(p);\n } else if ((107 <= firstLetterASCII) && (firstLetterASCII <= 111)) {\n mapping['k-o'].push(p);\n } else if ((112 <= firstLetterASCII) && (firstLetterASCII <= 116)) {\n mapping['p-t'].push(p);\n } else if ((117 <= firstLetterASCII) && (firstLetterASCII <= 122)) {\n mapping['u-z'].push(p);\n } else {}\n }\n }\n return mapping;\n}", "function DNAStrand(str){\n let tempArray = str.split(\"\").map(el => {\n switch (el) {\n case 'A': return 'T';\n case 'T': return 'A';\n case 'C': return 'G';\n case 'G': return 'C';\n case ' ': return ' ';\n }\n });\n\n // console.log(tempArray.join(\"\"));\n return tempArray.join(\"\");\n}", "function DNAStrand(dna) { \n let vr1 = dna.split(''); \n let vr2 = []; \n vr1.forEach(element => { \n switch (element) { \n case 'A': \n vr2.push('T'); \n break; \n case 'T': \n vr2.push('A'); \n break; \n case 'C': \n vr2.push('G'); \n break; \n case 'G': \n vr2.push('C'); \n break; \n } \n }); \n vr2 = vr2.join(''); \n return vr2; \n}", "function removePairs(char = '', char2 = '') {\n let res = [];\n\n for (let i = 0; i < string.length - 1; i++) {\n if (string[i] === char || string[i] === char2) continue;\n\n res.push(string[i]);\n if (res.length > 1) {\n let len = res.length;\n let currChar = res[len - 1].charCodeAt();\n let prevChar = res[len - 2].charCodeAt();\n\n //AZaz char codes are 65,90,97,122\n //Lower case and upper case are in different ranges and are off by 32\n if (\n (currChar >= 97 && currChar <= 122 && currChar === prevChar + 32) ||\n (currChar >= 65 && currChar <= 90 && currChar === prevChar - 32)\n )\n res.length = len - 2;\n }\n }\n\n //Input has a blank space at the end\n return res.length;\n}", "function meleeRangedGrouping(str) {\n //your code here\n\n // +++++++ MANUAL +++++++++++\n // let temp = []\n // let strTemp = ''\n // for (let i = 0; i < str.length; i++) {\n // // console.log(str[i] !== ',' && str[i] !== '-')\n // if (str[i] !== ',' && str[i] !== '-') {\n // strTemp += str[i]\n // } else {\n // temp.push(strTemp)\n // strTemp = ''\n // }\n // }\n // temp.push(strTemp)\n // // console.log(temp)\n\n // let temp2 = []\n // for (let i = 0; i < temp.length; i += 2) {\n // if (temp[i + 1] !== undefined) {\n // temp2.push([temp[i], temp[i + 1]])\n // }\n // }\n // // console.log(temp2)\n\n // let ranger = []\n // let melee = []\n // for (let i = 0; i < temp2.length; i++) {\n // switch (temp2[i][1].toLowerCase()) {\n // case 'ranged':\n // ranger.push(temp2[i][0])\n // break\n // case 'melee':\n // melee.push(temp2[i][0])\n // break\n // }\n // }\n // // console.log(ranger, melee)\n // let result = []\n // result.push(ranger, melee)\n // // console.log(result)\n // return str.length === 0 ? [] : result\n\n\n // +++++++++++ MENGGUNAKAN SPLIT +++++++++++++\n if (str.length === 0) {\n return []\n } else {\n let ranged = []\n let melee = []\n for (let i = 0; i < str.split(',').length; i++) {\n // console.log(str.split(',')[i].split('-')[1])\n\n switch (str.split(',')[i].split('-')[1].toLowerCase()) {\n case 'ranged':\n ranged.push(str.split(',')[i].split('-')[0])\n break\n case 'melee':\n melee.push(str.split(',')[i].split('-')[0])\n break\n }\n }\n let result = []\n result.push(ranged, melee)\n return result\n }\n}", "function getAllPairs(skill_array) {\n var pair_array = [];\n for (var i=0;i<skill_array.length;i++){\n for (var j=0;j<skill_array.length;j++){\n if(i > j){\n if(j%2){\n pair_array.push({\"label\":skill_array[i] + \" or \" +skill_array[j], \"param1\":skill_array[i], \"param2\":skill_array[j]});\n }\n else {\n pair_array.push({\"label\":skill_array[j] + \" or \" +skill_array[i], \"param1\":skill_array[j], \"param2\":skill_array[i]});\n }\n }\n }\n }\n return pair_array;\n}", "getPair(str) {\n const indexOfEquals = str.indexOf(\"=\");\n const key = str.substr(0, indexOfEquals);\n const value = str.substr(indexOfEquals + 1);\n return [key, value];\n }", "function unpackDNA(dataView, startBasePair, numBasePairs) {\n // TODO: use jBinary bitfield for this\n var basePairs = [];\n basePairs.length = dataView.byteLength * 4; // pre-allocate\n var basePairIdx = -startBasePair;\n for (var i = 0; i < dataView.byteLength; i++) {\n var packed = dataView.getUint8(i);\n for (var shift = 6; shift >= 0; shift -= 2) {\n var bp = BASE_PAIRS[packed >> shift & 3];\n if (startBasePair >= 0) {\n basePairs[basePairIdx] = bp;\n }\n basePairIdx++;\n }\n }\n // Remove base pairs from the end if the sequence terminated mid-byte.\n basePairs.length = numBasePairs;\n return basePairs;\n}", "function flipPairs(string) {\n\tvar newString = [];\n\tfor (var i = 0; i < string.length; i += 2) {\n\t\t//console.log(string[i]);\n\t\tnewString.push(string[i + 1], string[i]);\n\t\tconsole.log(newString);\n\t}\n\treturn newString.join('');\n}", "function separateChart(str, delimiter){\r\n\tlet separates = []\r\n\tvar separatesTemp = []\r\n\tfor(i in str){\r\n\t if(str[i]==delimiter){\r\n\t\tseparates.push(separatesTemp)\t\r\n\t\tvar separatesTemp = []\r\n\t }else{\r\n\t\t separatesTemp.push(str[i])\r\n\t }\r\n\t}\r\nseparates.push(separatesTemp)\r\nreturn separates\r\n}", "function combinations(str) {\n var fn = function(active, rest, a) {\n if (!active && !rest)\n return;\n if (!rest) {\n a.push(active);\n } else {\n fn(active + rest[0], rest.slice(1), a);\n fn(active, rest.slice(1), a);\n }\n return a;\n }\n return fn(\"\", str, []);\n}", "function combo(insertString){\n var strArr = insertString.split(\"\");\n var temp = \"\";\n for(var i = 0; i < strArr.length; i++){\n temp = strArr[i];\n console.log(\"ovo je i \"+temp);\n for(var j = i + 1; j < strArr.length; j++){\n temp += strArr[j];\n console.log(\"ovo je j \"+temp);\n }\n }\n }", "function DNAStrand(dna){\n let arr = dna.split(\"\")\n console.log(arr)\n let newarr = []\n for(var i=0;i<arr.length;i++){\n if(arr[i] == \"A\"){\n newarr.push(\"T\")\n } else if (arr[i] == \"T\"){\n newarr.push(\"A\")\n } else if (arr[i] == \"C\"){\n newarr.push(\"G\")\n } else if (arr[i] == \"G\"){\n newarr.push(\"C\")\n }\n }\n console.log(newarr)\n return newarr.join(\"\")\n }", "function giveAllPossibleCombinations(inputString) {\n let possibleCombinationsArray = [];\n for (let i = 1; i < inputString.length; i++)\n {\n inputString += inputString[0];\n inputString = inputString.slice(1,inputString.length);\n possibleCombinationsArray.push(inputString);\n }\n // if (possibleCombinations.length)\n return possibleCombinationsArray.length ? possibleCombinationsArray : [\"\"];\n}", "function combinations(str) {\n const r = (active, rest, a) => {\n if (!active && !rest) return;\n if (!rest) {\n a.push(active);\n } else {\n r(active + rest[0], rest.slice(1), a);\n r(active, rest.slice(1), a);\n }\n return a;\n };\n return r('', str, []);\n}", "permutationString(string) {\n var results = [];\n console.log(\"Now a String:\" + string)\n console.log(\"String length:\" + string.length)\n\n\n if (string.length === 1) {\n results.push(string);\n return results;\n }\n\n for (var i = 0; i < string.length; i++) {\n var firstChar = string[i];\n console.log(\"Now First char:\" + firstChar)\n var otherChar = string.substring(0, i) + string.substring(i + 1);\n console.log(\"now other char:\" + otherChar)\n var otherPermutations = this.permutationString(otherChar);\n\n for (var j = 0; j < otherPermutations.length; j++) {\n results.push(firstChar + otherPermutations[j]);\n console.log(\"char in array:\" + results)\n }\n }\n return results;\n\n\n\n\n }", "verifyCurrencyPairs(pairs) {\n const DEFAULT_CURRENCY_PAIR = { source: 'BTC', dest: 'USD' }\n\n var self = this\n var returnPairs = pairs.slice()\n\n pairs.forEach( function(input, index, array) {\n var isAllowed = false\n for ( let i = 0 ; i < self.allowedPairs.length ; i++ ) {\n let allowedPair = self.allowedPairs[i]\n if ( input.source == allowedPair[0] && input.dest == allowedPair[1] ) {\n isAllowed = true\n break\n }\n }\n\n // if it got here then it's not allowed - override with default\n if ( ! isAllowed ) {\n returnPairs[index] = DEFAULT_CURRENCY_PAIR\n }\n })\n return returnPairs\n }", "function putzolo_getTheCheesyPairs(){\n var pairs = [];\n pairs.push({\n killIf: [\n \"kar\"+String.fromCharCode(225)+\"csony\", \n \"karacsony\"\n ],\n butKeepIf: [\n \"kar\"+String.fromCharCode(225)+\"csonyi zsolt\", \n \"kar\"+String.fromCharCode(225)+\"csony ben\", \n \"zsolt kar\", \n \"karacsony beno\", \n \"csonyi zsolt\", \n \"halmaz\" \n ]\n })\n pairs.push({\n killIf: [\"christmas\"],\n butKeepIf: [\"last christmas\", \"apod\", \"cluster\"]\n })\n pairs.push({\n killIf: [\n String.fromCharCode(252)+\"nnepek\", \n \"husvet\", \n \"h\"+String.fromCharCode(250)+\"sv\"+String.fromCharCode(233)+\"t\", \n \"happy new year\",\n \"isten \"+String.fromCharCode(233)+\"ltessen\", \n \"isten eltessen\", \n \"boldog szuletesnapot\", \n \"boldog sz\"+String.fromCharCode(252)+\"let\"+String.fromCharCode(233)+\"snapot\", \n \"boldog szulinapot\", \n \"boldog sz\"+String.fromCharCode(252)+\"linapot\"\n ]\n });\n return pairs;\n }", "function uniquePairs(cats) { // cats = ['Paprika', 'Whiskers', 'Garfield']\n const pairs = [];\n for (let i = 0; i < cats.length; i++) { // i = 2\n for (let j = i + 1; j < cats.length; j++) { // j = 3\n const cat1 = cats[i]; // 'Whiskers'\n const cat2 = cats[j]; // 'Garfield'\n const pair = [cat1, cat2]; // ['Whiskers', 'Garfield']\n pairs.push(pair);\n }\n }\n return pairs; // [['Paprika', 'Whiskers'], ['Paprika', 'Garfield'], ['Whiskers', 'Garfield']]\n}", "function dnaStrand(strDna) {\n const arr = [];\n let char = ''; \n for(let i = 0; i < strDna.length; i++) {\n char = strDna.charAt(i);\n switch(char) {\n case 'G':\n arr.push('C', char);\n break;\n case 'T':\n arr.push('A', char);\n break;\n case 'g':\n arr.push('C', char.toUpperCase());\n break;\n case 't':\n arr.push('A', char.toUpperCase());\n break;\n default:\n break;\n }\n }\n return arr;\n}", "function createPairs(arr) {\n for (let i = 0; i < arr.length; i++) {\n for(let j = i + 1; j < arr.length; j++) {\n console.log(arr[i] + \", \" + arr[j] );\n }\n }\n}", "function createPairs(arr) {\n for (let i = 0; i < arr.length; i++) {\n for(let j = i + 1; j < arr.length; j++) {\n console.log(arr[i] + \", \" + arr[j] );\n }\n }\n}", "function createPairs(arr) {\n for (let i = 0; i < arr.length; i++) {\n for(let j = i + 1; j < arr.length; j++) {\n console.log(arr[i] + \", \" + arr[j] );\n }\n }\n }", "function createPairs(arr) {\n for (let i = 0; i < arr.length; i++) {\n for(let j = i+1; j < arr.length; j++) {\n console.log(arr[i] + \", \" + arr[j] );\n }\n }\n}", "function pairInArray(array) {\n let result = [];\n for (let i = 0; i < array.length; i++) {\n for (let j = i + 1; j < array.length; j++) {\n if (array[i] + array[j] === 10) {\n let arr = [array[i], array[j]];\n result.push(arr);\n }\n }\n }\n return result;\n}", "function createPairs(arr) {\n\t// Unsure about this one, but again\n\t// the presence of nested loops leads me to guess\n\t// polynomial. I am not sure how to distinguish \n\t// between polynomial and exponential time by \n\t// reading the code\n for (let i = 0; i < arr.length; i++) {\n for(let j = i+1; j < arr.length; j++) {\n console.log(arr[i] + \", \" + arr[j] );\n }\n }\n}", "function createPairs(arr) {\n for (let i = 0; i < arr.length; i++) {\n for(let j = i+1; j < arr.length; j++) {\n console.log(arr[i] + ', ' + arr[j] );\n }\n }\n}", "function createPairs(arr) {\n for (let i = 0; i < arr.length; i++) {\n for(let j = i+1; j < arr.length; j++) {\n console.log(arr[i] + ', ' + arr[j] );\n }\n }\n}", "function allCombinations(temp, str) {\n // for all available characters\n for (let i = 0; i < str.length; i++) {\n // only continue if the character is already in the string\n if (temp.indexOf(str[i]) === -1) {\n // add the character to the string\n temp += str[i];\n // if this combination already exists, end here\n if (tracker[temp]) {\n return;\n // if this is a new combination\n } else {\n // add it to the tracker\n tracker[temp] = true;\n // add it to the results\n results.push(temp);\n // recursively call the function with the str starting at the next letter\n allCombinations(temp, str.slice(i + 1));\n }\n }\n // take off the letter just added and restart the loop to add a new letter\n temp = temp.slice(0, -1);\n }\n }", "function anagramGroup(arr){\n const newArray=[];\n const anagramDB = new HashMap();\n arr.forEach(word=>{\n let wordVal=0;\n for(let letter of word){\n wordVal += letter.charCodeAt(0); \n }\n try{\n anagramDB.set(wordVal, [word, ...anagramDB.get(wordVal)]);\n }catch(error){\n anagramDB.set(wordVal, [word]);\n }\n wordVal=0;\n });\n\n anagramDB.slots.forEach(slot=>{\n newArray.push(slot.value);\n });\n\n\nconsole.log(newArray);\n\n}", "function generatePairs(array, visitor) {\n if (visitor) {\n for (let leftIx = 0 ; leftIx < (array.length - 1) ; leftIx++) {\n for (let rightIx = leftIx + 1; rightIx < array.length ; rightIx++) {\n const pair = [array[leftIx], array[rightIx]]\n const result = visitor(pair)\n if (result) {\n return result\n }\n }\n }\n }\n}", "function combinations(str)\n{\nvar array1 = [];\n for (var x = 0, y=1; x < str1.length; x++,y++) \n {\n array1[x]=str1.substring(x, y);\n }\nvar combi = [];\nvar temp= \"\";\nvar slent = Math.pow(2, array1.length);\n\nfor (var i = 0; i < slent ; i++)\n{\n temp= \"\";\n for (var j=0;j<array1.length;j++) {\n if ((i & Math.pow(2,j))){ \n temp += array1[j];\n }\n }\n if (temp !== \"\")\n {\n combi.push(temp);\n }\n}\n return combi.join(\"\\n\");\n}", "function separateArr(arr) {\n const letters = []; \n const numbers = []; \n\n arr.forEach(element => {\n if(typeof element === String) {\n letters.push(element)\n } else {\n numbers.push(element)\n }\n })\n}", "function customed_check_pair_array(pair_array) {\n var valid_pair_array = [];\n _.forEach(pair_array, function(pair) {\n if (customed_check_pair(pair[0], pair[1])) {\n valid_pair_array.push(pair);\n }\n });\n return valid_pair_array;\n }", "function generateAll(str) {\n //build an output\n //separate chars into 1 and 1, 2 and 2 and so on\n let myStr = [];\n //separated 1 and 1\n for (let i = 0, j = 1; i < str.length; i++, j++) {\n // myStr.push(str[i]);\n myStr[i] = str.substring(i, j);\n }\n let kosing = [];\n let temp = \"\";\n let sizes = Math.pow(2, myStr.length);\n\n for (let j = 0; j < sizes; j++) {\n temp = \"\";\n for (let k = 0; k < myStr.length; k++) {\n if ((j & Math.pow(2, k))) {\n temp += myStr[k];\n }\n\n }\n if (temp !== \"\") {\n kosing.push(temp);\n }\n // str[j];\n\n }\n kosing.join(\"\\n\");\n return kosing;\n}", "function parseThrough(stringToParse) {\n //on chrome the wrong information is being stored as an enzyme\n try {\n var tmpArr = stringToParse.split(\">\");\n } catch (e) {\n return null\n }\n var newArr = tmpArr[1].split(\"<\");\n var evenNewer = newArr[1].split(\";\");\n // fullArr now contains\n // [0]: substrates (inputs)\n // [1]: enzyme\n // [2]: products (outputs)\n // [3]: reversible? (boolean)\n fullArr = [tmpArr[0], newArr[0], evenNewer[0], evenNewer[1]];\n subsArr = fullArr[0].split(\"+\");\n prodArr = fullArr[2].split(\"+\");\n return [subsArr, fullArr[1], prodArr, fullArr[3]]\n}", "function genCharArray(charA, charZ) {\n var a = [], i = charA.charCodeAt(0), j = charZ.charCodeAt(0);\n for (i = charA.charCodeAt(0); i <= j; i++) {\n console.log(i);\n a.push(String.fromCharCode(i));\n }\n return a;\n}", "function stringToEdgePair(edge) {\n return edge.split(',');\n}", "function genCharArray(charA, charZ){\n\t\tvar a = [\n\t\t], i = charA.charCodeAt(0), j = charZ.charCodeAt(0);\n\t\tfor(; i <= j; ++i) {\n\t\t\ta.push(String.fromCharCode(i));\n\t\t}\n\t\treturn a;\n\t}", "function combination_variations (str) {\n const vars = []\n\n function recurse(chars, rest) {\n if (rest.length === 1) {\n vars.push(chars + rest)\n return\n }\n\n for (let i = 0; i < rest.length; i++) {\n char = rest[i]\n newChars = chars + char\n newRest = rest.slice(0, i) + rest.slice(i + 1)\n recurse(newChars, newRest)\n }\n }\n\n recurse('', str)\n\n return vars\n}", "function createPairs(arr) {\n for (let i = 0; i < arr.length; i++) {\n // O(n)\n for (let j = i + 1; j < arr.length; j++) {\n // O(n^2)\n console.log(arr[i] + \", \" + arr[j]);\n }\n }\n}", "function letterCombinations(arr) {\n // ...\n}", "function getCombinations(chars) {\n var result = [];\n var f = function(prefix, chars) {\n for (var i = 0; i < chars.length; i++) {\n result.push(prefix + chars[i]);\n f(prefix + chars[i], chars.slice(i + 1));\n }\n }\n f('', chars);\n return result;\n}", "function flipPairs(str) {\n let workingCopy = str;\n let stringWithPairsReversed = '';\n // turn string into array\n let workingCopyArr = [...str];\n if (workingCopyArr.length % 2 === 1) {\n workingCopyArr.push(' ');\n }\n // loop\n do {\n let pair = workingCopyArr[1] + workingCopyArr[0];\n stringWithPairsReversed += pair;\n workingCopyArr.shift();\n workingCopyArr.shift();\n } while (workingCopyArr.length > 0);\n return stringWithPairsReversed;\n // read first two characters from array then remove from the array\n\n // flip the two characters' order and construct a new \"pair\"\n // insert the new pair into a new string\n // return the completed new string\n}", "function switcheroo(x){\n\n const arr = x.split(\"\")\n \n for(let i = 0; i < arr.length; i++){\n if (arr[i] == 'a') arr[i]='b'\n else if(arr[i] =='b')arr[i] = 'a'\n \n }\n return arr.join('')\n \n \n}", "function getTradingPairs() {\n return axios\n .get(`${process.env.GEMINI_REST}/symbols`)\n .then((res) => {\n //Returns a plain array of trading pairs\n return res.data\n })\n .catch((err) => {\n console.log(err)\n console.log(err.message, '\\n^^ GEMINI REST (TRADING PAIRS)')\n })\n /*\n [\n 'btcusd',\n 'ethbtc',\n 'ethusd',\n 'bchusd',\n 'bchbtc',\n 'bcheth',\n 'ltcusd',\n 'ltcbtc',\n 'ltceth',\n 'ltcbch',\n 'zecusd',\n 'zecbtc',\n 'zeceth',\n 'zecbch',\n 'zecltc'\n ]\n */\n}", "function letterCombinations(digits) {\n if (!digits.length) {\n return [];\n }\n let combinations = [\"\"];\n let newCombinations = [];\n for (const digit of digits) {\n for (const letter of letters[Number.parseInt(digit)]) {\n newCombinations.push(...combinations.map((com) => com + letter));\n }\n combinations = newCombinations;\n newCombinations = [];\n }\n return combinations;\n}", "function myStringToArrayWithSeperator(inputString, strSeperator) {\r\n\tvar strArray = [];\r\n\tvar tmpStr = \"\";\r\n\tfor (var i = 0; i < inputString.length; i++) {\r\n\t\tif (inputString.charAt(i) == strSeperator) {\r\n\t\t\t//strArray.push(tmpStr);\r\n\t\t\tmyArrayPush(tmpStr, strArray);\r\n\t\t\ttmpStr = \"\";\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\ttmpStr += inputString.charAt(i);\r\n\t}\r\n\t//strArray.push(tmpStr);\r\n\tmyArrayPush(tmpStr, strArray);\r\n\treturn strArray;\r\n\r\n}", "function flipPairs(input){\n\t// Create Output String\n\tvar output = \"\";\n\t// Iterate through the string every 2nd character\n\tfor(var i = 0; i < input.length; i += 2){\n\t\t// Iterate through the string backwards, starting at 0. (2 - 1) is to convert to the index\n\t\tfor(var j = 2 - 1; j >= 0; j--){\n\t\t\t// Assign the first character + the second character to the output\n\t\t\toutput += input[i+j]\n\t\t}\n\t}\n\t// Return Output\n\treturn output;\n}", "function buyFruit(fruitPairs) {\n let items = [];\n\n fruitPairs.forEach(el => {\n for (let times = 0; times < el[1]; times += 1) {\n items.push(el[0]);\n }\n })\n\n return items;\n}", "function stringConverter(a,b){\n // first we initialize an array of 2 arrays.\n let mylists = [[],[]];\n // for the index of each character in the first string.\n for (let i = 0; i < String(a).length; i++){\n // push each character of 'a' to the first array\n mylists[0].push(String(a)[i]);\n // push each character of 'b' to the second array\n mylists[1].push(String(b)[i]);\n };\n // return both arrays, as an array.\n return mylists;\n}", "function makePair(num1, num2){\n return [num1, num2];\n }", "function splitString(givenString){\nfor (var i = 0; i < givenString.length; i++) {\n\n if (givenString[i] != splitchar) {\n\n str += givenString[i];\n }\n else {\n outArray.push(str);\n str = \"\";\n }\n}\noutArray.push(str);\nconsole.log(outArray)\nreturn splitString;\n}", "complementStrand() {\n const complementaryDnaStrand = [];\n this.dna.forEach(base => {\n let compBase;\n switch(base) {\n case 'A':\n compBase = 'T';\n break;\n case 'T':\n compBase = 'A';\n break;\n case 'C':\n compBase = 'G';\n break;\n case 'G':\n compBase = 'C';\n break;\n }\n complementaryDnaStrand.push(compBase);\n });\n return complementaryDnaStrand;\n }", "manipulateString() {\n let myArray = Array.from(gatherInput().toLowerCase(), x => {\n switch (x) {\n case 'a':\n return 1\n break;\n case 'b':\n return 2\n break;\n case 'c':\n return 3\n break;\n case 'd':\n return 4\n break;\n case 'e':\n return 5\n break;\n case 'f':\n return 6\n break;\n case 'g':\n return 7\n break;\n case 'h':\n return 8\n break;\n case 'i':\n return 9\n break;\n case 'j':\n return 10\n break;\n case 'k':\n return 11\n break;\n case 'l':\n return 12\n break;\n case 'm':\n return 13\n break;\n case 'n':\n return 14\n break;\n case 'o':\n return 15\n break;\n case 'p':\n return 16\n break;\n case 'q':\n return 17\n break;\n case 'r':\n return 18\n break;\n case 's':\n return 19\n break;\n case 't':\n return 20\n break;\n case 'u':\n return 21\n break;\n case 'v':\n return 22\n break;\n case 'w':\n return 23\n break;\n case 'x':\n return 24\n break;\n case 'y':\n return 25\n break;\n case 'z':\n return 26\n break;\n case ',':\n return ','\n break;\n case '!':\n return '!'\n break;\n case '?':\n return '?'\n break;\n case '.':\n return '.'\n break;\n case ' ':\n return ' '\n break;\n case 'á':\n return '1(á)'\n break;\n case 'ã':\n return '1(ã)'\n break;\n case 'ó':\n return '15(ó)'\n break;\n case 'õ':\n return '15(õ)'\n break;\n case 'ô':\n return '15ô'\n break;\n case 'é':\n return '5(é)'\n break;\n case 'ê':\n return '5(ê)'\n break;\n case 'ç':\n return '3(ç)'\n break;\n case ',':\n return ','\n break;\n case '0':\n return 'Num(0)'\n break;\n case '1':\n return 'Num(1)'\n break;\n case '2':\n return 'Num(2)'\n break;\n case '3':\n return 'Num(3)'\n break;\n case '4':\n return 'Num(4)'\n break;\n case '5':\n return 'Num(5)'\n break;\n case '6':\n return 'Num(6)'\n break;\n case '7':\n return 'Num(7)'\n break;\n case '8':\n return 'Num(8)'\n break;\n case '9':\n return 'Num(9)'\n break;\n default:\n return 404;\n }\n })\n\n return myArray\n }", "complementStrand(){\n const complementaryStrand=[]\n for (let base of this.dna){\n if(base==='A'){\n complementaryStrand.push('T');\n }else if(base==='T'){\n complementaryStrand.push('A')\n }else if(base==='C'){\n complementaryStrand.push('G')\n }else{\n complementaryStrand.push('C')\n }\n }\n return complementaryStrand;\n }", "function createPairs(arr) {\n for (let i = 0; i < arr.length; i++) { // --> polynomial O(n^2) quadratic\n for (let j = i + 1; j < arr.length; j++) { // --> polynomial 0(n^2) quadratic\n console.log(arr[i] + ', ' + arr[j]); //--> constant\n }\n }\n}", "function makePairs(names) {\n\tlet result = [];\n\tlet pairs = [];\n\n\twhile(names.length > 1) {\n\t\tpairs.push(names.pop());\n\t\tpairs.push(names.pop());\n\t\tresult.push(pairs);\n\t\tpairs = [];\n\t}\n\n\tif (names.length) {\n\t\tresult.push([names.pop()])\n\t}\n\n\treturn result;\n}", "function getDna(dna) {\n let complements = ''\n for (let i = 0; i <dna.length; i++){\n switch (dna[i]){\n case \"A\":\n complements += \"T\"\n break;\n case \"T\":\n complements += \"A\"\n break;\n case \"C\":\n complements += \"G\"\n break;\n case \"G\":\n complements += \"C\"\n break\n }\n }\n return complements\n}", "function StringChallenge(str) {\n let obj = {\n 'ab': 'c',\n 'ba':'c',\n 'bc': 'a',\n 'cb': 'a',\n 'ac': 'b',\n 'ca': 'b',\n }\n\n let array = str.split('');\n let newarray = [];\n\n for(var i = 0; i<array.length; i += 2){\n if(obj[array[i]+array[i+1]]){\n let value = obj[array[i]+array[i+1]]\n array = array.slice(2, array.length);\n newarray.push(value);\n i = -2;\n } else if (array.length > 2) {\n newarray.push(array[i]);\n newarray.push(array[i+1]);\n array = array.slice(2, array.length)\n } else {\n newarray.push(array[i]);\n array = array.slice(1)\n }\n\n if(array.length === 0){\n StringChallenge(newarray.join(''))\n }\n }\n\n // code goes here\n return newarray.length - 1;\n\n}", "function anagramGroup(arr){\n let charHash = new HashMap;\n let results = [];\n \n for(const word of arr) {\n let charSorted = word.split('').sort().join('');\n try{\n let group = charHash.get(charSorted);\n group.push(word);\n } \n catch (error){\n results.push(charSorted);\n charHash.set(charSorted, [word]);\n }\n }\n \n let newArray = results.map(group =>{\n return charHash.get(group);\n });\n\n return newArray;\n\n}", "function pairs(array) {\n let newArray = [];\n for (var i = 0; i < array.length; i++) {\n if (array[i] % 2 === 0) {\n let a = array[i];\n newArray = [...newArray, a];\n }\n }\n return newArray;\n}", "permutationOfString(str)\n{\n var arr = str.split(\"\");\n console.log(arr);\n var arr1=[];\n const c =str.length;\n for(let i =0 ;i<arr.length;i++)\n {\n var str1=\"\";\n for(let j = i; j<c ; j++)\n {\n\n str1=str1+arr[j];\n var s = str.length-str1.length;\n }\n if(str1.length<str.length)\n {\n str1 = str1+str.substring(0,s);\n }\n if(!arr1.includes(str1))\n {\n arr1.push(str1);\n }\n }\n console.log(arr1)\n}", "function letterCombinations(digits) {\n if(digits === '') return [];\n const chosen = [];\n let letters = digits.split('').map(digit => map.get(digit).split(''));\n helper(letters, [], chosen);\n return chosen;\n}", "function pair(x, xs) {\n return [x, xs];\n}", "function choose2(inputArr) {\n var len = inputArr.length;\n \n function combine(arr) {\n var cur = [];\n var result = [];\n\n for (var i = 0; i < len; i++) {\n for (var j = i + 1; j < len; j++) {\n cur = [arr[i], arr[j]];\n result.push(cur);\n }\n }\n return result;\n }\n\n return combine(inputArr);\n}", "function tagsToArray(tagString){\n if ((tagString != undefined) && (tagString != \"\")) {\n var newArray =[];\n var tagArray = tagString.split(','); // create an array\n for (var i = 0; i < tagArray.length; i++) {\n tmpTag = tagArray[i].trim();\n tmpTag = tmpTag.toLowerCase();\n if(tmpTag != \"\") newArray.push(tmpTag);\n }\n return newArray;\n } else\n return \"\";\n}" ]
[ "0.8297701", "0.82293373", "0.820291", "0.8188886", "0.8101683", "0.7922902", "0.7810319", "0.7804721", "0.77858955", "0.77729666", "0.77284795", "0.7638515", "0.7618238", "0.7614296", "0.75772583", "0.7571956", "0.7476376", "0.74648416", "0.739352", "0.7204998", "0.719899", "0.7125688", "0.69753844", "0.69051707", "0.6898468", "0.651129", "0.6445357", "0.5861952", "0.5744374", "0.5680821", "0.55729985", "0.5544394", "0.5484808", "0.5464546", "0.5460116", "0.54361963", "0.541697", "0.5374062", "0.53585076", "0.5293976", "0.5275388", "0.5264343", "0.51939434", "0.5193289", "0.5192989", "0.51908106", "0.5167754", "0.5151678", "0.5141756", "0.513406", "0.51243997", "0.5120479", "0.5092272", "0.50645995", "0.50645995", "0.5060671", "0.50531596", "0.5052713", "0.50495", "0.5031155", "0.5031155", "0.4990057", "0.49806112", "0.49799272", "0.49718523", "0.4966827", "0.49607444", "0.49577713", "0.49383664", "0.4933236", "0.49160883", "0.48975563", "0.48689693", "0.48622766", "0.48615637", "0.4858565", "0.48539487", "0.4843064", "0.48366374", "0.4828831", "0.48207116", "0.48125055", "0.4812038", "0.48113844", "0.48095012", "0.4803191", "0.48002344", "0.47836915", "0.4782378", "0.47800663", "0.4778554", "0.47773612", "0.4768334", "0.47501358", "0.47470954", "0.47468665", "0.47421414", "0.47293606", "0.47281533", "0.47250608" ]
0.83368564
0
const allTotals = orderTotals.reduce(tallyTotal, 0); console.log(allTotals);
function inventoryReducer(totals, item){ // totals[item.type] ? totals[item.type]+= 1 : totals[item.type] = 1; totals[item.type] = totals[item.type] + 1 || 1; return totals; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "calculateTotals(data) {\n let calculate = (acc, current) => acc + current;\n let total = data.reduce(calculate);\n return total;\n }", "function branchestotal() {\n let arraytotal = [];\n\n for (let i = 0; i < hours.length; i++) {\n let sum = Seattle.salesbyhour[i] + Tokyo.salesbyhour[i] + Dubai.salesbyhour[i] +\n Paris.salesbyhour[i] + Lima.salesbyhour[i];\n arraytotal.push(sum);\n }\n\n return arraytotal;\n\n}", "function getTotals(refs) {\n frefs.reduce(getSum); //Getting the sum of refugees year wise\n console.log(total);\n\n }", "determineTotals(receipt) {\n let total = 0;\n receipt.inventories.forEach(inventory => {\n total += inventory.buyAmount;\n });\n return total;\n }", "getOrderTotal() {\n\n return Object.values(this.lineItems).reduce(\n (total, {product, sku, quantity}) =>\n total + quantity * this.plans[0].amount,\n 0\n );\n }", "totalSpent(){\n return this.meals().reduce((a,b)=>(a += b.price), 0);\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 }", "subtotal() {\n return this.state.dishes\n .map(dish => (dish.price.num))\n .reduce(Utils.sumFunc, 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 }", "rawTotal() {\n return this._checkoutProducts\n .map((checkoutProduct) => checkoutProduct.count * checkoutProduct.price.value)\n .reduce((total, productPrice) => total + productPrice, 0);\n }", "function createHourlyTotals() {\n var hourlyTotals = [];\n for (var n = 0; n < salesHours.length - 1; n++) {\n var tempHourTotal = 0;\n for (var m = 0; m < storesToUse.length; m++) {\n tempHourTotal = tempHourTotal + storesToUse[m].salesByHour[n];\n console.log('tempHourTotal', tempHourTotal);\n }\n hourlyTotals.push(tempHourTotal);\n }\n return hourlyTotals;\n}", "function calculateHourlyTotal(){\n var theArr = [];\n\n\n for (var index = 0; index < hours.length; index++){\n var currentTotal = 0;\n for (var loc = 0; loc < allStores.length; loc++){\n\n currentTotal += allStores[loc].cookies[index];\n\n }\n theArr[index] = currentTotal;\n console.log(theArr[index]);\n }\n return theArr;\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}", "calcBetAmount() {\n let total = this.chipTotalAmount.reduce((a, b) => {\n return a + b;\n });\n return total;\n }", "function sumHourlyTotals(){\n for (var i = 0; i < storesHours.length; i++){\n var hourlySum = 0;\n for (var j = 0; j < allStores.length; j++){\n hourlySum += allStores[j].hourlySales[i];\n }\n hourlyTotals[i] = hourlySum;\n grandTotal += hourlySum;\n }\n}", "function getTotal() {\n\t\treturn cart.reduce((current, next) => {\n\t\t\treturn current + next.price * next.count;\n\t\t}, 0);\n\t}", "function shoppingSpree(arr) {\n return arr.reduce((total, curr) => {\n return total + curr.price;\n }, 0);\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 pollTotals()\n{\n totalOfTotals = 0;\n totalOfStaffTotals = 0;\n //Fill string with blank values\n for(var k = 0; k < hours.length; k++)\n {\n var blank = 0;\n hourlyTotal[k] = blank;\n staffTotal[k] = blank;\n }\n for(var i = 0; i < hours.length; i++)\n {\n for(var j = 0; j < locations.length; j++)\n {\n hourlyTotal[i] = hourlyTotal[i] + locations[j].cookiesHourly[i];\n // console.log (`${hourlyTotal} += ${locations[0].cookiesHourly[i]}`)\n staffTotal[i] = staffTotal[i] + locations[j].staffNeeded[i];\n // console.log (`${hourlyTotal} += ${locations[0].cookiesHourly[i]}`)\n }\n totalOfTotals += hourlyTotal[i]\n totalOfStaffTotals += staffTotal[i]\n }\n return(totalOfTotals, totalOfStaffTotals);\n}", "function shoppingSpree(arr) {\n return arr.reduce((total, curr) => {\n return total + curr.price;\n }, 0);\n}", "totalSpent() {\n return this.meals().reduce(function(sum, meal) {\n return sum + meal.price;\n }, 0);\n }", "totalSpent() {\n return this.meals().reduce(function(sum, meal) {\n return sum + meal.price;\n }, 0);\n }", "function getTotal() {\n let total = 0;\n\n shoppingCart.forEach(product => {\n total += product.price * product.stock_quantity;\n });\n console.log(\"this is the total\", total);\n return total;\n }", "function totalSalaries(employees) \n{\n let totale= employees.reduce((a,b)=>a+b.salary,0)\n return totale \n}", "function calcTotalHourlyCookieSales() {\r\n var hourlyTotals = [];\r\n var grandTotal = 0;\r\n for (var i = 0; i < hours.length; i ++){\r\n hourlyTotals.push(0);\r\n for (var j = 0; j < allStores.length; j++) {\r\n hourlyTotals[i] += allStores[j].cookiesPerHour[i];\r\n };\r\n grandTotal += hourlyTotals[i];\r\n };\r\n return [hourlyTotals, grandTotal];\r\n}", "function getSums (arr){\n var result = []\n if(!arr.length) return result\n\n var totalSum = arr.reduce(function (previous, current){\n result.push(previous)\n return previous + current\n })\n result.push(totalSum) //without this line the last element of the work reduce will not be displayed\n return result\n}", "function CalculateAllTotals() {\n //use temp variables to prevent multiple dom updates\n var wt = 0;\n var dt = 0;\n var gt = 0;\n for (var i = 0; i < vm.territorySalesNumbers.length; i++) {\n wt += vm.territoryWritten[i];\n dt += vm.territoryDelivered[i];\n gt += vm.goals[i];\n }\n\n vm.writtenTotal = Round(wt, 2);\n vm.deliveredTotal = Round(dt, 2);\n vm.goalsTotal = Round(gt, 2);\n vm.goalsWrittenDifference = Round(vm.writtenTotal - vm.goalsTotal, 2);\n\n if (vm.goalsWrittenDifference > 0)\n vm.goalsWrittenDifference = '+' + vm.goalsWrittenDifference;\n\n }", "render() {\n const orderIds = Object.keys(this.props.order)\n const total = orderIds.reduce((prevTotal, key)=> {\n const fish = this.props.fishes[key];\n const count = this.props.order[key];\n const isAvailable = (fish && fish.status === 'available');\n if(isAvailable) {\n return prevTotal + (count * fish.price || 0)\n }\n return prevTotal;\n }, 0);\n\n return (\n <div className=\"order-wrap\">\n <h2> Your Order </h2>\n <ul className=\"order\">\n {orderIds.map(key => this.renderOrder(key))}\n <li className=\"total\">\n <strong>Total:</strong>\n {formatPrice(total)}\n </li>\n </ul>\n </div>\n );\n }", "function findTotal() {\n monthlyTotal = 0;\n for (let employee of employeeInfo) {\n monthlyTotal += employee.annualSalary /12;\n\n }\n\n bleedingCash();\n\n}", "function shoppingSpree(arr) {\n return arr.reduce((acc, el) => acc + el.price, 0) \n}", "allStock(state) {\r\n return state.juegos.reduce((acumulador, juego) => {\r\n acumulador = acumulador + juego.stock;\r\n console.log(acumulador);\r\n return acumulador;\r\n }, 0);\r\n }", "function getTotal() {\n const { cart } = state;\n\n const res = cart.reduce((prev, product) => {\n return (prev + (product.price * product.count));\n }, 0);\n\n dispatch({\n type: 'TOTAL',\n payload: res\n });\n }", "function totalIncome() {\n //FUNCTION THAT CALCULATES ALL THE INCOMES\n const total = incomes.reduce((acc, curr) => {\n return acc + curr.amount;\n }, 0);\n return total;\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 getTotalEarningsFrom(sales) {\n return sales.reduce(function (totalAmount, sale) {\n totalAmount += sale.amount;\n return totalAmount;\n }, 0);\n}", "function calcTotalTotal() {\n totalTotal = 0;\n for (var i = 0; i < hours.length; i++) {\n totalTotal += combinedHourlyCookies[i];\n }\n}", "function totalTotalSum(){\n totalTurtle = 0;\n for (var i in allStoreTotals){\n totalTurtle += allStoreTotals[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}", "getTotal() {\n //Creating variable total with value of 0.\n let total = 0;\n // using built-in forEach(), calculate the total using the price field of each object.\n let beverageTotal = this._beverages.forEach(function(beverage) {\n total += parseFloat(beverage.price);\n });\n let appetizerTotal = this._appetizers.forEach(function(appetizer) {\n total += parseFloat(appetizer.price);\n });\n let mainCourseTotal = this._mainCourses.forEach(function(mainCourse) {\n total += parseFloat(mainCourse.price);\n });\n let dessertTotal = this._desserts.forEach(function(dessert) {\n total += parseFloat(dessert.price);\n });\n console.log(`The total is ${total}`);\n //Return the total variable and set its precisions to two decimal places.\n return total.toFixed(2);\n }", "inventoryValue() {\n return this.inventory.reduce(total, book) => {\n total += book.price;\n }", "function calcTotal() {\n let total = 0;\n for (let item of itemList) {\n total += Number(item.price);\n }\n console.log(\"this is the total\", total);\n return total;\n }", "totalSpent(){\n let sum = 0;\n for(const meal of this.meals()){\n sum += meal.price;\n }\n return sum;\n\n \n }", "function orderTotal(order){\n let total= order.order.reduce((acc, nextVal) => {\n return acc + nextVal.price;\n },0);\n\n return total;\n}", "function calcTotals() {\n var incomes = 0;\n var expenses = 0;\n var budget;\n // calculate total income\n data.allItems.inc.forEach(function(item) {\n incomes+= item.value;\n })\n //calculate total expenses\n data.allItems.exp.forEach(function(item) {\n expenses+= item.value;\n })\n //calculate total budget\n budget = incomes - expenses;\n // Put them in our data structure\n data.total.exp = expenses;\n data.total.inc = incomes;\n //Set Budget\n data.budget = budget;\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}", "function getOrderTotal(products) {\n return products.reduce((total, product) => {\n total += product.price * product.orderProduct.quantity\n return total\n }, 0)\n}", "function total(arr) {\n return arr.reduce(function (final, num) {\n return (final += num);\n });\n}", "function shoppingSpree(arr) {\n return arr.reduce((a, b) => a + b.price, 0)\n}", "inventoryValue() {\n return this.inventory.reduce((total, book) => total + book.price, 0);\n }", "function calculateTotalPrice(arr){\n return arr.reduce((a, cv) => a + cv, 0);\n}", "function calcAll() {\n let subTotal = 0;\n [...cart.children].forEach(product => subTotal += updateSubtot(product));\n document.querySelector('h2 > span').innerHTML = subTotal;\n}", "function subTotalAmt(dishTotals) {\n let subTotal = 0;\n for (let i = 0; i < dishTotals.length; i++) {\n subTotal += dishTotals[i];\n }\n return subTotal;\n}", "function totalPrice2(arr) {\n let sum = arr.reduce((total, item) => (total += item), 10);\n return \"Total value is $\" + sum * pricePerCoffee;\n}", "function returnOftotals () {\n return {\n billCallTotal,\n billSMSTotal,\n billTotalTotal,\n currentValueOfCall,\n currentValueOfSMS,\n costWarning,\n costCritical,\n levels\n\n }\n }", "function shoppingSpree(arr) {\n let sum = arr.reduce((a, {price}) => a + price, 0);\n return sum;\n }", "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 getTotals(table){\n var totals = [];\n for (var i = 0; i < (hours.length + 1); i++) {\n var hourlyTotal = 0;\n for(var j = 0; j < allLocationObjects.length; j++) {\n if (table === 'cookieChart'){\n hourlyTotal += allLocationObjects[j].cookieArray[i];\n } else if (table === 'cookieStaff') {\n hourlyTotal += allLocationObjects[j].staffNeededArray[i];\n }\n }\n totals.push(hourlyTotal);\n }\n return totals;\n}", "function getTotalPrice(shoppingCart){\n return shoppingCart.reduce((sum, current) => sum + current.price * current.quantity, 0);\n}", "getStakeOutsTotal() {\n let val = new bn_js_1.default(0);\n for (let i = 0; i < this.stakeOuts.length; i++) {\n val = val.add(this.stakeOuts[i].getOutput().getAmount());\n }\n return val;\n }", "function total(arr) {\n return arr.reduce((acc, el) => acc + el)\n}", "addUpSubTotal(arrayOfAllTripInCart, promoCodeObjFromServer) {\n arrayOfAllTripInCart = this.props.order.trips;\n promoCodeObjFromServer = this.props.promoCode;\n let subTotalPercentage = 100;\n if (\n !promoCodeObjFromServer.error &&\n promoCodeObjFromServer.percentage !== undefined\n ) {\n subTotalPercentage = promoCodeObjFromServer.percentage;\n // alert('Coupon has been successfully applied to the following events');\n }\n let subTotal = arrayOfAllTripInCart.reduce((prev, curr) => {\n return +prev + +curr.price * curr.tripOrder.numberOfGuests;\n }, 0);\n\n return subTotal * (subTotalPercentage / 100);\n }", "function sum(){\r\n var sumArray = array.reduce((total,num)=>{return total + num;});\r\n console.log(sumArray);\r\n}", "function payMeterDailyTallies() {\n arrCounts = [0, 0, 0, 0, 0, 0, 0]\n\n for (var i = 0; i < dataArray.length; i++) {\n var arr = payMeterDailyTally(i)\n for (var j = 0; j < 7; j++) {\n if (arrCounts[j] == null) {\n k = 0\n }\n else arrCounts[j] += arr[j]\n }\n }\n\n return arrCounts\n\n}", "function calculateTotals(expenses) {\n return expenses.reduce((totals, currentExpense) => {\n let {category, amount} = currentExpense\n amount = Number(amount)\n totals[category] = (totals[category] ? totals[category] + amount : amount);\n return totals\n }, {})\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 compute_subtotal(items) {\n\t$(\".wddp-shopping-cart\").text(\"Shopping cart total: $\" + Object.values(items).reduce((x, y) => (x + y), 0));\n}", "function totalBill()\n{\n var result = 0.00;\n\n for (var i = 0; i < outstandingBill.length; i++)\n {\n result += outstandingBill[i].cost;\n }\n\n //console.log(\"bill total = \" + result);\n return result;\n}", "function total(arr) {\n return arr.reduce((a, b) => a + b);\n}", "function sumarTotal(){\n let boxTotal = document.getElementById(`reduce`)\n let sumaReduce = carrito.reduce((acc, item)=> {return acc + item.precio},0)\n\n boxTotal.innerHTML=`<h2>Total: $${sumaReduce}</h2>`\n\n console.log(sumaReduce)\n}", "function salesReport() {\n var totalSales = 0;\n \n // [ [ 102, 103, 104 ], [ 106, 107 ], [], [], [] ]\n for(var i = 0; i < bookedRooms.length; i++) {\n totalSales += bookedRooms[i].length * roomPrices[i]\n \n }\n \n return totalSales;\n}", "incomes() {\n let income = 0;\n transactions.forEach(transaction => {\n if (transaction.amount > 0){\n income += transaction.amount;\n }\n })\n return income;\n }", "returnTotalScore(numAnswered){\n let currentScores = 0; \n if(numAnswered > 0) {\n currentScores = this.props.getLocalScores().reduce((a, b)=>{\n return a + b;\n }, 0);\n return currentScores;\n } else {\n return 0;\n }\n }", "function getTotalQuantity(items) {\n return _.reduce(items, function(memo, item) {\n return memo + item.quantity;\n }, 0);\n }", "function hourlyTotals () {\r\n var hourlyTotal=0;\r\n var grandTotal = 0;\r\n for( var i =0; i < hours.length; i++) {\r\n for( var j=0; j < cityArray.length; j++) {\r\n hourlyTotal = hourlyTotal + cityArray[j].cookiesSoldPerHour[i];\r\n }\r\n grandTotal = grandTotal + hourlyTotal;\r\n }\r\n}", "function totalHomeGoals(data) {\nconst totalGoals = data.reduce(function(accumulator,item){\nreturn accumulator + item['Home Team Goals'];\n},0);\nreturn totalGoals;\n}", "function total(arr) {\n return arr.reduce((a, b) => a + b, 0);\n}", "function calculateTotal() {\n calculateSubtotals();\n for (var x in subtotal) {\n preuTotal+=subtotal[x].value;\n }\n console.log('Total: '+preuTotal);\n}", "function calcSubtotal() {\n const sub = Object.keys(lineStates)\n .reduce((acum, lineKey) => {\n if (lineKey === 'shippingState') {\n return acum;\n } else {\n const {liveQuantity, unitPrice} = lineStates[lineKey].getState();\n const nextAcum = acum + (liveQuantity * unitPrice);\n return nextAcum;\n }\n }, 0);\n getElements.subtotalPrice().innerHTML = formatMoney(sub, theme.moneyFormat);\n return sub;\n}", "function addTotal(arr){\n arr.forEach(function(ele){\n let total=0;\n total=ele.science+ele.maths+ele.english\n ele.total=total;\n })\n }", "function calculate () {\n const finalPrice = priceArray.reduce(getSum);\n priceDisplay.textContent = 'Total - Price $' + finalPrice;\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 calcularTotal(carrito) {\r\n //Recorrer el array de productos en el carrito, calcular su precio final y sumarlo todo\r\n let precioTotal = 0;\r\n for (const producto of carrito) {\r\n precioTotal += producto.precioFinal();\r\n }\r\n return precioTotal;\r\n}", "function getTotal(){\n\t\t\treturn total;\n\t\t}", "function callTotal() {\n var totRow = document.getElementById('timeTot');\n\n // Make sure our row is empty\n while (totRow.lastChild) {\n totRow.removeChild(totRow.lastChild);\n }\n\n var totLabel = document.createElement('th');\n totLabel.textContent = 'Hourly Totals';\n totRow.appendChild(totLabel);\n\n var grandTotal = 0;\n\n for (var k = 0; k < hours.length - 1; k++) {\n\n var currentHour = hours[k]; // e.g. \"8:00AM\";\n var currentHourSales = [];\n\n for (var l = 0; l < data.length; l++) {\n var currentStore = data[l];\n currentHourSales.push(currentStore.sales[currentHour]);\n }\n\n // currentHourSales.push(pike.stats[k], seaTac.stats[k], seaCtr.stats[k], capHill.stats[k], alki.stats[k]);\n\n var sum = currentHourSales.reduce(function (a, b) { return a + b; }, 0);\n grandTotal += sum;\n\n var tot = document.createElement('td');\n tot.textContent = Math.round(sum);\n totRow.appendChild(tot);\n domTable.appendChild(totRow);\n }\n //var allTots = [];\n //allTots.push(pike.sums, seaTac.sums, seaCtr.sums, capHill.sums, alki.sums);\n\n //console.log('parseint' + allTots);\n //var sums = parseInt(allTots[0]) + parseInt(allTots[1]) + parseInt(allTots[2]) + parseInt(allTots[3]) + parseInt(allTots[4]);\n\n //console.log(sums);\n\n var grandTotalElement = document.createElement('td');\n grandTotalElement.textContent = Math.round(grandTotal);\n totRow.appendChild(grandTotalElement);\n}", "function totalSales(companysSales) {\n var sum = 0;\n for (var i = 0; i < companysSales.length; i++) {\n sum += companysSales[i];\n }\n return sum;\n}", "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 calculateTotalMontlyPay(loans) {\n const total = loans.reduce(function (sum, currentElement) {\n if (!currentElement.closed) {\n return sum + currentElement.perMonth.value;\n }\n return sum;\n }, 0);\n\n return total;\n}", "function totals(number) {\n total = 0;\n for (let i = 0; i < number.length; i++) {\n total = total + number[i];\n }\n console.log(total);\n return total;\n}", "function totalOfArray(arr) {\n const result = arr.reduce(function(finalAddition, num) {\n finalAddition = finalAddition + num;\n return finalAddition;\n });\n return result;\n}", "function sumAll( ) {\n let sum = 0;\n // TODO: loop to add items\n return sum;\n}", "populateTotalPricing(basketArr = []) {\n return basketArr.map((eachItem) => {\n let totalPrice = eachItem.quantity * (eachItem.product ? eachItem.product.price : eachItem.promotionPrice);\n let originalPrice = null;\n if (eachItem.promotion) {\n originalPrice = totalPrice;\n totalPrice *= 1 - eachItem.promotion.discount / 100;\n }\n\n return {...eachItem, originalPrice, totalPrice};\n })\n }", "calculateTotal() {\n let products = this.state.invoiceItems;\n let total = 0;\n products.forEach((el) => {\n total += el.price * el.quantity\n });\n\n if (this.state.discount) {\n total *= (100 - this.state.discount) / 100;\n }\n\n this.setState({\n total: (total).toFixed(2)\n }, this.updateInvoiceAPI);\n }", "totalSizes(itemQuantities) {\n // console.log('start totalSizes', itemQuantities);\n let total = 0;\n Object.values(itemQuantities).map( sizeQuantity => total = total + sizeQuantity);\n return total;\n }", "function totalSalary() {\n return people.reduce((total, p) => total + p.salary, 0);\n}", "function sum(arr){\n\nresult = arr.reduce((total, elem)=>{\n return total += elem;\n })\n return result}", "function getTotalPrice(items) {\n return _.reduce(items, function(memo, item) {\n return memo + item.quantity * item.price;\n }, 0);\n }", "function calcTotal(basket) {\n return parseFloat(\n basket\n .reduce((acc, next) => {\n if (next.name === \"Motion Sensor\" && next.quantity >= 3) {\n return (\n acc +\n Math.floor(next.quantity / 3) * 65 +\n (next.quantity % 3) * next.price\n );\n } else if (next.name === \"Smoke Sensor\" && next.quantity >= 2) {\n return (\n acc +\n Math.floor(next.quantity / 2) * 35 +\n (next.quantity % 2) * next.price\n );\n } else {\n return acc + next.price * next.quantity;\n }\n }, 0)\n .toFixed(2)\n );\n}", "function calculateSummary() {\n let subtotal = 0;\n for (var i = 0; i < elements.length; i++) {\n let item = elements[i];\n subtotal = subtotal + prices.prices[item.id];\n }\n subtotal = parseFloat(subtotal.toFixed(2));\n let tax = parseFloat((0.06 * subtotal).toFixed(2));\n let total = parseFloat((subtotal + 5.99 + tax).toFixed(2));\n return { subtotal, tax, total };\n }", "function getTot(){\n let total = 0;\n for(let i = 0; i < cart.length; i += 1){\n total += cart[i].price * cart[i].qty\n }\n return total.toFixed(2)\n}", "getTotalCalories() {\n return this.state.breakfast.reduce((accumulator, elem) => parseInt(elem.calories) + accumulator, 0)\n + this.state.lunch.reduce((accumulator, elem) => parseInt(elem.calories) + accumulator, 0)\n + this.state.dinner.reduce((accumulator, elem) => parseInt(elem.calories) + accumulator, 0)\n + this.state.snacks.reduce((accumulator, elem) => parseInt(elem.calories) + accumulator, 0);\n }", "function sumAll(arr) {\r\n return arr.reduce((a, b) => {\r\n return a + b;\r\n });\r\n}" ]
[ "0.7326449", "0.6930972", "0.69220483", "0.6861372", "0.682198", "0.68217546", "0.6781276", "0.67359465", "0.673043", "0.6714041", "0.6685003", "0.66444325", "0.6633071", "0.6631445", "0.66283816", "0.6615619", "0.6598131", "0.6589962", "0.6586849", "0.6558342", "0.65088177", "0.65088177", "0.6507384", "0.6494036", "0.64916915", "0.6471061", "0.6441242", "0.6411345", "0.6371005", "0.6370751", "0.63658965", "0.6360092", "0.634647", "0.6333884", "0.63231844", "0.63202906", "0.6314526", "0.62988263", "0.62866914", "0.62859625", "0.62852573", "0.628232", "0.6281972", "0.6280544", "0.6269743", "0.6264565", "0.62526983", "0.62444127", "0.6234018", "0.6231956", "0.6212354", "0.6197917", "0.6193772", "0.6192063", "0.61830056", "0.6182081", "0.61744004", "0.6172357", "0.6168227", "0.61515164", "0.614744", "0.61449075", "0.6144834", "0.610896", "0.6104476", "0.6088379", "0.6088195", "0.60810405", "0.60755235", "0.6074694", "0.6074416", "0.6067979", "0.6064513", "0.606288", "0.60594547", "0.6055921", "0.6046581", "0.6038369", "0.6033685", "0.6013183", "0.6009764", "0.6009762", "0.5999346", "0.59913874", "0.59863544", "0.5985764", "0.5978529", "0.5971845", "0.59673953", "0.5963169", "0.59620357", "0.5951371", "0.5950755", "0.59387386", "0.59329385", "0.59259063", "0.59242517", "0.5923746", "0.59234554", "0.5923069", "0.59218127" ]
0.0
-1
takes a JSON or YAML string, returns YAML string
function load(string) { var jsonError, yamlError; if (!angular.isString(string)) { throw new Error('load function only accepts a string'); } // Try figuring out if it's a JSON string try { JSON.parse(string); } catch (error) { jsonError = error; } // if it's a JSON string, convert it to YAML string and return it if (!jsonError) { return jsyaml.dump(JSON.parse(string)); } // Try parsing the string as a YAML string and capture the error try { jsyaml.load(string); } catch (error) { yamlError = error; } // If there was no error in parsing the string as a YAML string // return the original string if (!yamlError) { return string; } // If it was neither JSON or YAML, throw an error throw new Error('load function called with an invalid string'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function yamlString2JsonObject (data) {\n // 1. Render YAML template\n // nunjucks.configure({ autoescape: false });\n // const contents = nunjucks.renderString(template, params);\n // 2. Convert YAML text to JSON Object\n return yaml.load(data);\n}", "function yaml(hljs) {\n var LITERALS = 'true false yes no null';\n\n // Define keys as starting with a word character\n // ...containing word chars, spaces, colons, forward-slashes, hyphens and periods\n // ...and ending with a colon followed immediately by a space, tab or newline.\n // The YAML spec allows for much more than this, but this covers most use-cases.\n var KEY = {\n className: 'attr',\n variants: [\n { begin: '\\\\w[\\\\w :\\\\/.-]*:(?=[ \\t]|$)' },\n { begin: '\"\\\\w[\\\\w :\\\\/.-]*\":(?=[ \\t]|$)' }, //double quoted keys\n { begin: '\\'\\\\w[\\\\w :\\\\/.-]*\\':(?=[ \\t]|$)' } //single quoted keys\n ]\n };\n\n var TEMPLATE_VARIABLES = {\n className: 'template-variable',\n variants: [\n { begin: '\\{\\{', end: '\\}\\}' }, // jinja templates Ansible\n { begin: '%\\{', end: '\\}' } // Ruby i18n\n ]\n };\n var STRING = {\n className: 'string',\n relevance: 0,\n variants: [\n {begin: /'/, end: /'/},\n {begin: /\"/, end: /\"/},\n {begin: /\\S+/}\n ],\n contains: [\n hljs.BACKSLASH_ESCAPE,\n TEMPLATE_VARIABLES\n ]\n };\n\n var DATE_RE = '[0-9]{4}(-[0-9][0-9]){0,2}';\n var TIME_RE = '([Tt \\\\t][0-9][0-9]?(:[0-9][0-9]){2})?';\n var FRACTION_RE = '(\\\\.[0-9]*)?';\n var ZONE_RE = '([ \\\\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?';\n var TIMESTAMP = {\n className: 'number',\n begin: '\\\\b' + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + '\\\\b',\n };\n\n return {\n name: 'YAML',\n case_insensitive: true,\n aliases: ['yml', 'YAML'],\n contains: [\n KEY,\n {\n className: 'meta',\n begin: '^---\\s*$',\n relevance: 10\n },\n { // multi line string\n // Blocks start with a | or > followed by a newline\n //\n // Indentation of subsequent lines must be the same to\n // be considered part of the block\n className: 'string',\n begin: '[\\\\|>]([0-9]?[+-])?[ ]*\\\\n( *)[\\\\S ]+\\\\n(\\\\2[\\\\S ]+\\\\n?)*',\n },\n { // Ruby/Rails erb\n begin: '<%[%=-]?', end: '[%-]?%>',\n subLanguage: 'ruby',\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n },\n { // local tags\n className: 'type',\n begin: '!' + hljs.UNDERSCORE_IDENT_RE,\n },\n { // data type\n className: 'type',\n begin: '!!' + hljs.UNDERSCORE_IDENT_RE,\n },\n { // fragment id &ref\n className: 'meta',\n begin: '&' + hljs.UNDERSCORE_IDENT_RE + '$',\n },\n { // fragment reference *ref\n className: 'meta',\n begin: '\\\\*' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // array listing\n className: 'bullet',\n // TODO: remove |$ hack when we have proper look-ahead support\n begin: '\\\\-(?=[ ]|$)',\n relevance: 0\n },\n hljs.HASH_COMMENT_MODE,\n {\n beginKeywords: LITERALS,\n keywords: {literal: LITERALS}\n },\n TIMESTAMP,\n // numbers are any valid C-style number that\n // sit isolated from other words\n {\n className: 'number',\n begin: hljs.C_NUMBER_RE + '\\\\b'\n },\n STRING\n ]\n };\n}", "function yamlParse(input) {\n return jsYaml.load(input, { schema: schema });\n}", "function YAMLParser(data) {\n return yaml.safeLoad(data, 'utf8');\n}", "function yaml(hljs) {\n var LITERALS = 'true false yes no null';\n\n // YAML spec allows non-reserved URI characters in tags.\n var URI_CHARACTERS = '[\\\\w#;/?:@&=+$,.~*\\'()[\\\\]]+';\n\n // Define keys as starting with a word character\n // ...containing word chars, spaces, colons, forward-slashes, hyphens and periods\n // ...and ending with a colon followed immediately by a space, tab or newline.\n // The YAML spec allows for much more than this, but this covers most use-cases.\n var KEY = {\n className: 'attr',\n variants: [\n { begin: '\\\\w[\\\\w :\\\\/.-]*:(?=[ \\t]|$)' },\n { begin: '\"\\\\w[\\\\w :\\\\/.-]*\":(?=[ \\t]|$)' }, // double quoted keys\n { begin: '\\'\\\\w[\\\\w :\\\\/.-]*\\':(?=[ \\t]|$)' } // single quoted keys\n ]\n };\n\n var TEMPLATE_VARIABLES = {\n className: 'template-variable',\n variants: [\n { begin: /\\{\\{/, end: /\\}\\}/ }, // jinja templates Ansible\n { begin: /%\\{/, end: /\\}/ } // Ruby i18n\n ]\n };\n var STRING = {\n className: 'string',\n relevance: 0,\n variants: [\n { begin: /'/, end: /'/ },\n { begin: /\"/, end: /\"/ },\n { begin: /\\S+/ }\n ],\n contains: [\n hljs.BACKSLASH_ESCAPE,\n TEMPLATE_VARIABLES\n ]\n };\n\n // Strings inside of value containers (objects) can't contain braces,\n // brackets, or commas\n var CONTAINER_STRING = hljs.inherit(STRING, {\n variants: [\n { begin: /'/, end: /'/ },\n { begin: /\"/, end: /\"/ },\n { begin: /[^\\s,{}[\\]]+/ }\n ]\n });\n\n var DATE_RE = '[0-9]{4}(-[0-9][0-9]){0,2}';\n var TIME_RE = '([Tt \\\\t][0-9][0-9]?(:[0-9][0-9]){2})?';\n var FRACTION_RE = '(\\\\.[0-9]*)?';\n var ZONE_RE = '([ \\\\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?';\n var TIMESTAMP = {\n className: 'number',\n begin: '\\\\b' + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + '\\\\b'\n };\n\n var VALUE_CONTAINER = {\n end: ',',\n endsWithParent: true,\n excludeEnd: true,\n contains: [],\n keywords: LITERALS,\n relevance: 0\n };\n var OBJECT = {\n begin: /\\{/,\n end: /\\}/,\n contains: [VALUE_CONTAINER],\n illegal: '\\\\n',\n relevance: 0\n };\n var ARRAY = {\n begin: '\\\\[',\n end: '\\\\]',\n contains: [VALUE_CONTAINER],\n illegal: '\\\\n',\n relevance: 0\n };\n\n var MODES = [\n KEY,\n {\n className: 'meta',\n begin: '^---\\\\s*$',\n relevance: 10\n },\n { // multi line string\n // Blocks start with a | or > followed by a newline\n //\n // Indentation of subsequent lines must be the same to\n // be considered part of the block\n className: 'string',\n begin: '[\\\\|>]([1-9]?[+-])?[ ]*\\\\n( +)[^ ][^\\\\n]*\\\\n(\\\\2[^\\\\n]+\\\\n?)*'\n },\n { // Ruby/Rails erb\n begin: '<%[%=-]?',\n end: '[%-]?%>',\n subLanguage: 'ruby',\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n },\n { // named tags\n className: 'type',\n begin: '!\\\\w+!' + URI_CHARACTERS\n },\n // https://yaml.org/spec/1.2/spec.html#id2784064\n { // verbatim tags\n className: 'type',\n begin: '!<' + URI_CHARACTERS + \">\"\n },\n { // primary tags\n className: 'type',\n begin: '!' + URI_CHARACTERS\n },\n { // secondary tags\n className: 'type',\n begin: '!!' + URI_CHARACTERS\n },\n { // fragment id &ref\n className: 'meta',\n begin: '&' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // fragment reference *ref\n className: 'meta',\n begin: '\\\\*' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // array listing\n className: 'bullet',\n // TODO: remove |$ hack when we have proper look-ahead support\n begin: '-(?=[ ]|$)',\n relevance: 0\n },\n hljs.HASH_COMMENT_MODE,\n {\n beginKeywords: LITERALS,\n keywords: { literal: LITERALS }\n },\n TIMESTAMP,\n // numbers are any valid C-style number that\n // sit isolated from other words\n {\n className: 'number',\n begin: hljs.C_NUMBER_RE + '\\\\b',\n relevance: 0\n },\n OBJECT,\n ARRAY,\n STRING\n ];\n\n var VALUE_MODES = [...MODES];\n VALUE_MODES.pop();\n VALUE_MODES.push(CONTAINER_STRING);\n VALUE_CONTAINER.contains = VALUE_MODES;\n\n return {\n name: 'YAML',\n case_insensitive: true,\n aliases: ['yml', 'YAML'],\n contains: MODES\n };\n}", "function yaml(hljs) {\n var LITERALS = 'true false yes no null';\n\n // YAML spec allows non-reserved URI characters in tags.\n var URI_CHARACTERS = '[\\\\w#;/?:@&=+$,.~*\\'()[\\\\]]+';\n\n // Define keys as starting with a word character\n // ...containing word chars, spaces, colons, forward-slashes, hyphens and periods\n // ...and ending with a colon followed immediately by a space, tab or newline.\n // The YAML spec allows for much more than this, but this covers most use-cases.\n var KEY = {\n className: 'attr',\n variants: [\n { begin: '\\\\w[\\\\w :\\\\/.-]*:(?=[ \\t]|$)' },\n { begin: '\"\\\\w[\\\\w :\\\\/.-]*\":(?=[ \\t]|$)' }, // double quoted keys\n { begin: '\\'\\\\w[\\\\w :\\\\/.-]*\\':(?=[ \\t]|$)' } // single quoted keys\n ]\n };\n\n var TEMPLATE_VARIABLES = {\n className: 'template-variable',\n variants: [\n { begin: /\\{\\{/, end: /\\}\\}/ }, // jinja templates Ansible\n { begin: /%\\{/, end: /\\}/ } // Ruby i18n\n ]\n };\n var STRING = {\n className: 'string',\n relevance: 0,\n variants: [\n { begin: /'/, end: /'/ },\n { begin: /\"/, end: /\"/ },\n { begin: /\\S+/ }\n ],\n contains: [\n hljs.BACKSLASH_ESCAPE,\n TEMPLATE_VARIABLES\n ]\n };\n\n // Strings inside of value containers (objects) can't contain braces,\n // brackets, or commas\n var CONTAINER_STRING = hljs.inherit(STRING, {\n variants: [\n { begin: /'/, end: /'/ },\n { begin: /\"/, end: /\"/ },\n { begin: /[^\\s,{}[\\]]+/ }\n ]\n });\n\n var DATE_RE = '[0-9]{4}(-[0-9][0-9]){0,2}';\n var TIME_RE = '([Tt \\\\t][0-9][0-9]?(:[0-9][0-9]){2})?';\n var FRACTION_RE = '(\\\\.[0-9]*)?';\n var ZONE_RE = '([ \\\\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?';\n var TIMESTAMP = {\n className: 'number',\n begin: '\\\\b' + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + '\\\\b'\n };\n\n var VALUE_CONTAINER = {\n end: ',',\n endsWithParent: true,\n excludeEnd: true,\n contains: [],\n keywords: LITERALS,\n relevance: 0\n };\n var OBJECT = {\n begin: /\\{/,\n end: /\\}/,\n contains: [VALUE_CONTAINER],\n illegal: '\\\\n',\n relevance: 0\n };\n var ARRAY = {\n begin: '\\\\[',\n end: '\\\\]',\n contains: [VALUE_CONTAINER],\n illegal: '\\\\n',\n relevance: 0\n };\n\n var MODES = [\n KEY,\n {\n className: 'meta',\n begin: '^---\\\\s*$',\n relevance: 10\n },\n { // multi line string\n // Blocks start with a | or > followed by a newline\n //\n // Indentation of subsequent lines must be the same to\n // be considered part of the block\n className: 'string',\n begin: '[\\\\|>]([1-9]?[+-])?[ ]*\\\\n( +)[^ ][^\\\\n]*\\\\n(\\\\2[^\\\\n]+\\\\n?)*'\n },\n { // Ruby/Rails erb\n begin: '<%[%=-]?',\n end: '[%-]?%>',\n subLanguage: 'ruby',\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n },\n { // named tags\n className: 'type',\n begin: '!\\\\w+!' + URI_CHARACTERS\n },\n // https://yaml.org/spec/1.2/spec.html#id2784064\n { // verbatim tags\n className: 'type',\n begin: '!<' + URI_CHARACTERS + \">\"\n },\n { // primary tags\n className: 'type',\n begin: '!' + URI_CHARACTERS\n },\n { // secondary tags\n className: 'type',\n begin: '!!' + URI_CHARACTERS\n },\n { // fragment id &ref\n className: 'meta',\n begin: '&' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // fragment reference *ref\n className: 'meta',\n begin: '\\\\*' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // array listing\n className: 'bullet',\n // TODO: remove |$ hack when we have proper look-ahead support\n begin: '-(?=[ ]|$)',\n relevance: 0\n },\n hljs.HASH_COMMENT_MODE,\n {\n beginKeywords: LITERALS,\n keywords: { literal: LITERALS }\n },\n TIMESTAMP,\n // numbers are any valid C-style number that\n // sit isolated from other words\n {\n className: 'number',\n begin: hljs.C_NUMBER_RE + '\\\\b',\n relevance: 0\n },\n OBJECT,\n ARRAY,\n STRING\n ];\n\n var VALUE_MODES = [...MODES];\n VALUE_MODES.pop();\n VALUE_MODES.push(CONTAINER_STRING);\n VALUE_CONTAINER.contains = VALUE_MODES;\n\n return {\n name: 'YAML',\n case_insensitive: true,\n aliases: ['yml', 'YAML'],\n contains: MODES\n };\n}", "function yaml(hljs) {\n var LITERALS = 'true false yes no null';\n\n // YAML spec allows non-reserved URI characters in tags.\n var URI_CHARACTERS = '[\\\\w#;/?:@&=+$,.~*\\\\\\'()[\\\\]]+';\n\n // Define keys as starting with a word character\n // ...containing word chars, spaces, colons, forward-slashes, hyphens and periods\n // ...and ending with a colon followed immediately by a space, tab or newline.\n // The YAML spec allows for much more than this, but this covers most use-cases.\n var KEY = {\n className: 'attr',\n variants: [\n { begin: '\\\\w[\\\\w :\\\\/.-]*:(?=[ \\t]|$)' },\n { begin: '\"\\\\w[\\\\w :\\\\/.-]*\":(?=[ \\t]|$)' }, // double quoted keys\n { begin: '\\'\\\\w[\\\\w :\\\\/.-]*\\':(?=[ \\t]|$)' } // single quoted keys\n ]\n };\n\n var TEMPLATE_VARIABLES = {\n className: 'template-variable',\n variants: [\n { begin: '{{', end: '}}' }, // jinja templates Ansible\n { begin: '%{', end: '}' } // Ruby i18n\n ]\n };\n var STRING = {\n className: 'string',\n relevance: 0,\n variants: [\n { begin: /'/, end: /'/ },\n { begin: /\"/, end: /\"/ },\n { begin: /\\S+/ }\n ],\n contains: [\n hljs.BACKSLASH_ESCAPE,\n TEMPLATE_VARIABLES\n ]\n };\n\n // Strings inside of value containers (objects) can't contain braces,\n // brackets, or commas\n var CONTAINER_STRING = hljs.inherit(STRING, {\n variants: [\n { begin: /'/, end: /'/ },\n { begin: /\"/, end: /\"/ },\n { begin: /[^\\s,{}[\\]]+/ }\n ]\n });\n\n var DATE_RE = '[0-9]{4}(-[0-9][0-9]){0,2}';\n var TIME_RE = '([Tt \\\\t][0-9][0-9]?(:[0-9][0-9]){2})?';\n var FRACTION_RE = '(\\\\.[0-9]*)?';\n var ZONE_RE = '([ \\\\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?';\n var TIMESTAMP = {\n className: 'number',\n begin: '\\\\b' + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + '\\\\b'\n };\n\n var VALUE_CONTAINER = {\n end: ',',\n endsWithParent: true,\n excludeEnd: true,\n contains: [],\n keywords: LITERALS,\n relevance: 0\n };\n var OBJECT = {\n begin: '{',\n end: '}',\n contains: [VALUE_CONTAINER],\n illegal: '\\\\n',\n relevance: 0\n };\n var ARRAY = {\n begin: '\\\\[',\n end: '\\\\]',\n contains: [VALUE_CONTAINER],\n illegal: '\\\\n',\n relevance: 0\n };\n\n var MODES = [\n KEY,\n {\n className: 'meta',\n begin: '^---\\s*$',\n relevance: 10\n },\n { // multi line string\n // Blocks start with a | or > followed by a newline\n //\n // Indentation of subsequent lines must be the same to\n // be considered part of the block\n className: 'string',\n begin: '[\\\\|>]([0-9]?[+-])?[ ]*\\\\n( *)[\\\\S ]+\\\\n(\\\\2[\\\\S ]+\\\\n?)*'\n },\n { // Ruby/Rails erb\n begin: '<%[%=-]?',\n end: '[%-]?%>',\n subLanguage: 'ruby',\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n },\n { // named tags\n className: 'type',\n begin: '!\\\\w+!' + URI_CHARACTERS\n },\n // https://yaml.org/spec/1.2/spec.html#id2784064\n { // verbatim tags\n className: 'type',\n begin: '!<' + URI_CHARACTERS + \">\"\n },\n { // primary tags\n className: 'type',\n begin: '!' + URI_CHARACTERS\n },\n { // secondary tags\n className: 'type',\n begin: '!!' + URI_CHARACTERS\n },\n { // fragment id &ref\n className: 'meta',\n begin: '&' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // fragment reference *ref\n className: 'meta',\n begin: '\\\\*' + hljs.UNDERSCORE_IDENT_RE + '$'\n },\n { // array listing\n className: 'bullet',\n // TODO: remove |$ hack when we have proper look-ahead support\n begin: '\\\\-(?=[ ]|$)',\n relevance: 0\n },\n hljs.HASH_COMMENT_MODE,\n {\n beginKeywords: LITERALS,\n keywords: { literal: LITERALS }\n },\n TIMESTAMP,\n // numbers are any valid C-style number that\n // sit isolated from other words\n {\n className: 'number',\n begin: hljs.C_NUMBER_RE + '\\\\b'\n },\n OBJECT,\n ARRAY,\n STRING\n ];\n\n var VALUE_MODES = [...MODES];\n VALUE_MODES.pop();\n VALUE_MODES.push(CONTAINER_STRING);\n VALUE_CONTAINER.contains = VALUE_MODES;\n\n return {\n name: 'YAML',\n case_insensitive: true,\n aliases: ['yml', 'YAML'],\n contains: MODES\n };\n}", "function yamlDump(input) {\n return jsYaml.dump(input, { schema: schema });\n}", "cleanYaml(yaml, mode = 'edit') {\n try {\n const obj = jsyaml.load(yaml);\n\n if (mode !== 'edit') {\n this.$dispatch(`cleanForNew`, obj);\n }\n\n if (obj._type) {\n obj.type = obj._type;\n delete obj._type;\n }\n const out = jsyaml.dump(obj, { skipInvalid: true });\n\n return out;\n } catch (e) {\n return null;\n }\n }", "function $ce6ca07b3ed13bb6$var$yaml(hljs) {\n var LITERALS = \"true false yes no null\";\n // YAML spec allows non-reserved URI characters in tags.\n var URI_CHARACTERS = \"[\\\\w#;/?:@&=+$,.~*'()[\\\\]]+\";\n // Define keys as starting with a word character\n // ...containing word chars, spaces, colons, forward-slashes, hyphens and periods\n // ...and ending with a colon followed immediately by a space, tab or newline.\n // The YAML spec allows for much more than this, but this covers most use-cases.\n var KEY = {\n className: \"attr\",\n variants: [\n {\n begin: \"\\\\w[\\\\w :\\\\/.-]*:(?=[ \t]|$)\"\n },\n {\n begin: '\"\\\\w[\\\\w :\\\\/.-]*\":(?=[ \t]|$)'\n },\n {\n begin: \"'\\\\w[\\\\w :\\\\/.-]*':(?=[ \t]|$)\"\n } // single quoted keys\n ]\n };\n var TEMPLATE_VARIABLES = {\n className: \"template-variable\",\n variants: [\n {\n begin: /\\{\\{/,\n end: /\\}\\}/\n },\n {\n begin: /%\\{/,\n end: /\\}/\n } // Ruby i18n\n ]\n };\n var STRING = {\n className: \"string\",\n relevance: 0,\n variants: [\n {\n begin: /'/,\n end: /'/\n },\n {\n begin: /\"/,\n end: /\"/\n },\n {\n begin: /\\S+/\n }\n ],\n contains: [\n hljs.BACKSLASH_ESCAPE,\n TEMPLATE_VARIABLES\n ]\n };\n // Strings inside of value containers (objects) can't contain braces,\n // brackets, or commas\n var CONTAINER_STRING = hljs.inherit(STRING, {\n variants: [\n {\n begin: /'/,\n end: /'/\n },\n {\n begin: /\"/,\n end: /\"/\n },\n {\n begin: /[^\\s,{}[\\]]+/\n }\n ]\n });\n var DATE_RE = \"[0-9]{4}(-[0-9][0-9]){0,2}\";\n var TIME_RE = \"([Tt \\\\t][0-9][0-9]?(:[0-9][0-9]){2})?\";\n var FRACTION_RE = \"(\\\\.[0-9]*)?\";\n var ZONE_RE = \"([ \\\\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\";\n var TIMESTAMP = {\n className: \"number\",\n begin: \"\\\\b\" + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + \"\\\\b\"\n };\n var VALUE_CONTAINER = {\n end: \",\",\n endsWithParent: true,\n excludeEnd: true,\n contains: [],\n keywords: LITERALS,\n relevance: 0\n };\n var OBJECT = {\n begin: /\\{/,\n end: /\\}/,\n contains: [\n VALUE_CONTAINER\n ],\n illegal: \"\\\\n\",\n relevance: 0\n };\n var ARRAY = {\n begin: \"\\\\[\",\n end: \"\\\\]\",\n contains: [\n VALUE_CONTAINER\n ],\n illegal: \"\\\\n\",\n relevance: 0\n };\n var MODES = [\n KEY,\n {\n className: \"meta\",\n begin: \"^---\\\\s*$\",\n relevance: 10\n },\n {\n // Blocks start with a | or > followed by a newline\n //\n // Indentation of subsequent lines must be the same to\n // be considered part of the block\n className: \"string\",\n begin: \"[\\\\|>]([1-9]?[+-])?[ ]*\\\\n( +)[^ ][^\\\\n]*\\\\n(\\\\2[^\\\\n]+\\\\n?)*\"\n },\n {\n begin: \"<%[%=-]?\",\n end: \"[%-]?%>\",\n subLanguage: \"ruby\",\n excludeBegin: true,\n excludeEnd: true,\n relevance: 0\n },\n {\n className: \"type\",\n begin: \"!\\\\w+!\" + URI_CHARACTERS\n },\n // https://yaml.org/spec/1.2/spec.html#id2784064\n {\n className: \"type\",\n begin: \"!<\" + URI_CHARACTERS + \">\"\n },\n {\n className: \"type\",\n begin: \"!\" + URI_CHARACTERS\n },\n {\n className: \"type\",\n begin: \"!!\" + URI_CHARACTERS\n },\n {\n className: \"meta\",\n begin: \"&\" + hljs.UNDERSCORE_IDENT_RE + \"$\"\n },\n {\n className: \"meta\",\n begin: \"\\\\*\" + hljs.UNDERSCORE_IDENT_RE + \"$\"\n },\n {\n className: \"bullet\",\n // TODO: remove |$ hack when we have proper look-ahead support\n begin: \"-(?=[ ]|$)\",\n relevance: 0\n },\n hljs.HASH_COMMENT_MODE,\n {\n beginKeywords: LITERALS,\n keywords: {\n literal: LITERALS\n }\n },\n TIMESTAMP,\n // numbers are any valid C-style number that\n // sit isolated from other words\n {\n className: \"number\",\n begin: hljs.C_NUMBER_RE + \"\\\\b\",\n relevance: 0\n },\n OBJECT,\n ARRAY,\n STRING\n ];\n var VALUE_MODES = [\n ...MODES\n ];\n VALUE_MODES.pop();\n VALUE_MODES.push(CONTAINER_STRING);\n VALUE_CONTAINER.contains = VALUE_MODES;\n return {\n name: \"YAML\",\n case_insensitive: true,\n aliases: [\n \"yml\",\n \"YAML\"\n ],\n contains: MODES\n };\n}", "function loadYaml (filename) {\n const file = findFile(`${filename}.yml`)\n return file ? YAML.parse(fs.readFileSync(file, 'utf8')) : {}\n }", "function yaml(c) {\n return c.pushWhitespaceInsignificantSingleLine().one(value);\n}", "function readInputConfigFileReturnJSON(file) {\n 'use strict';\n let yamlConfig = fs.readFileSync(file).toString();\n return yaml.safeLoad(yamlConfig);\n}", "getLanguageName() {\n return \"YAML\";\n }", "getConfig() {\n try {\n let contents = fs.readFileSync(this.getFilePath(), 'utf8');\n return yaml.load(contents);\n }\n catch (err) {\n console.log(err.stack || String(err));\n }\n }", "function parseJsonSchema(schema) {\n // we use the presence of the double quoted string to differentiate JSON from YAML\n if (schema.indexOf('\"$schema\"') !== -1) {\n return JSON.parse(schema)\n } else {\n return yaml.safeLoad(schema)\n }\n}", "function yamlConfig() {\n var Parser = this.Parser\n var Compiler = this.Compiler\n var parser = Parser && Parser.prototype.blockTokenizers\n var compiler = Compiler && Compiler.prototype.visitors\n\n if (parser && parser.yamlFrontMatter) {\n parser.yamlFrontMatter = factory(parser.yamlFrontMatter)\n }\n\n if (compiler && compiler.yaml) {\n compiler.yaml = factory(compiler.yaml)\n }\n}", "function YAMLDumper(dataObj) {\n return yaml.safeDump(dataObj);\n}", "function jsonize(str) {\n try {\n JSON.parse(str);\n return str;\n }\n catch (e) {\n return str\n .replace(/([\\$\\w]+)\\s*:/g, // wrap keys without double quote\n function (_, $1) {\n return '\"' + $1 + '\":';\n })\n .replace(/'([^']+)'/g, // replacing single quote to double quote\n function (_, $1) {\n return '\"' + $1 + '\"';\n });\n }\n}", "loadConfig() {\n // TODO: Make Private\n const configPath = path.join(__dirname, '../config.yml');\n return yaml.safeLoad(fs.readFileSync(configPath));\n }", "function readYAMLFile(filePath, isEncrypted) {\n const cleanedPath = filePath.replace(/\\//g, '\\\\/');\n let results;\n if (isEncrypted) {\n results = execSync(`sops --decrypt ${cleanedPath}`);\n } else {\n // Don't try to change this to `fs.readFileSync` to avoid the useless cat:\n // readFileSync can't find this path, cat can.\n results = execSync(`cat ${cleanedPath}`);\n }\n return YAML.parse(results.toString());\n}", "function yamlTheme() {\n return gulp.src('src/yml/theme.yml')\n .pipe(yaml({ schema: 'DEFAULT_SAFE_SCHEMA' }))\n .pipe(gulp.dest('src/tmp/'));\n}", "function validateYaml(filename, content) {\n if (!content.hasOwnProperty('name')) {\n console.error(`Missing 'name' in ${filename}`)\n }\n if (!content.hasOwnProperty('blip')) {\n console.error(`Missing 'blip' in ${filename}`)\n }\n if (!Array.isArray(content.blip)) {\n console.error(`'blip' is not an array in ${filename}`)\n }\n for (var blip of content.blip) {\n if (!blip.hasOwnProperty('version')) {\n console.error(`Missing 'blip[*].version' in ${filename}`)\n }\n if (!blip.hasOwnProperty('ring')) {\n console.error(`Missing 'blip[*].ring' in ${filename}`)\n }\n }\n if (!content.hasOwnProperty('description')) {\n console.error(`Missing 'description' in ${filename}`)\n }\n}", "function JSONize(str) {\r\n return str\r\n // Wrap keys without quote with double quotes\r\n .replace(/([\\$\\w]+)\\s*:/g, function (_, $1) { return '\"' + $1 + '\":' })\r\n // Replace single quote wrapped ones to double quotes\r\n .replace(/'([^']+)'/g, function (_, $1) { return '\"' + $1 + '\"' })\r\n}", "function parseAsStory(jsonString) {\n let json = null;\n\n try {\n json = JSON.parse(jsonString);\n\n // Handle standard reelyActive API response case\n if(json.hasOwnProperty('stories')) {\n let storyId = Object.keys(json.stories)[0];\n let story = json.stories[storyId];\n return story;\n }\n }\n catch(e) { }\n\n return json;\n }", "function yaml2json() {\n console.log(\"Converting YAML to JSON...\");\n let addresses = {};\n let ips = {};\n let blacklist = [];\n let whitelist = [];\n fs.readFile(\"./_data/archive_compiled.yaml\", function(err, archive) {\n var archive = yaml.safeLoad(archive);\n Object.keys(legiturls).forEach(function(key) {\n whitelist.push(legiturls[key]['url'].toLowerCase().replace('www.', '').replace(/(^\\w+:|^)\\/\\//, ''));\n whitelist.push('www.' + legiturls[key]['url'].toLowerCase().replace('www.', '').replace(/(^\\w+:|^)\\/\\//, ''));\n });\n Object.keys(data).reverse().forEach(function(key) {\n if ('addresses' in data[key]) {\n data[key]['addresses'].forEach(function(addr) {\n if (!(addr in addresses)) {\n addresses[addr] = [];\n }\n addresses[addr].unshift(data[key]['id']);\n });\n }\n if ('url' in data[key]) {\n blacklist.push(data[key]['url'].toLowerCase().replace(/(^\\w+:|^)\\/\\//, ''));\n blacklist.push('www.' + data[key]['url'].toLowerCase().replace(/(^\\w+:|^)\\/\\//, ''));\n }\n if (data[key]['id'] in archive) {\n if (\"ip\" in archive[data[key]['id']]) {\n if (!(archive[data[key]['id']]['ip'] in ips)) {\n ips[archive[data[key]['id']]['ip']] = [];\n }\n ips[archive[data[key]['id']]['ip']].unshift(data[key]['id']);\n data[key]['ip'] = archive[data[key]['id']]['ip'];\n }\n if (\"nameservers\" in archive[data[key]['id']]) {\n data[key]['nameservers'] = archive[data[key]['id']]['nameservers'];\n }\n if (\"status\" in archive[data[key]['id']]) {\n data[key]['status'] = archive[data[key]['id']]['status'];\n }\n }\n });\n if (job == \"build\" || job == false) {\n if (!fs.existsSync(\"./_site\")) {\n fs.mkdirSync(\"./_site/\");\n }\n if (!fs.existsSync(\"./_site/data\")) {\n fs.mkdirSync(\"./_site/data\");\n }\n }\n fs.writeFile(\"./_site/data/scams.json\", JSON.stringify(data), function(err) {\n console.log(\"Scam file compiled.\");\n fs.writeFile(\"./_site/data/addresses.json\", JSON.stringify(addresses), function(err) {\n console.log(\"Address file compiled.\");\n fs.writeFile(\"./_site/data/ips.json\", JSON.stringify(ips), function(err) {\n console.log(\"IPs file compiled.\");\n fs.writeFile(\"./_site/data/blacklist.json\", JSON.stringify(blacklist, null, \" \"), function(err) {\n console.log(\"Blacklist file compiled.\");\n fs.writeFile(\"./_site/data/whitelist.json\", JSON.stringify(whitelist, null, \" \"), function(err) {\n console.log(\"Whitelist file compiled.\");\n if (job == \"build\" || job == false) {\n generatestatic();\n } else if (job == \"update\") {\n finish(\"updating\");\n } else if (job == \"archive\") {\n archiveorg();\n }\n });\n });\n });\n });\n });\n });\n}", "function yamlparser(filep, field) {\n try {\n var src = fs.readFileSync(filep,'utf8')\n var doc = yaml.safeLoad(src)\n if (!doc[field]) {\n console.log('Error in ',field,' data:',doc)\n return null\n } else {\n const keyn = slugify(doc[field]).toLowerCase()\n return {\n [keyn]: doc\n }\n }\n }\n catch (e) {\n console.log('Cannot read', filep, \"\\n\", e)\n return null\n }\n}", "function processYAML(yamlFile) {\n try {\n console.log('convert Yaml file', yamlFile);\n // Get document, or throw exception on error\n var yamlObject = yaml.safeLoad(fs.readFileSync(yamlFile, 'utf8'));\n //console.log('yaml json string', JSON.stringify(yamlObject));\n console.log('processYAML', yamlObject);\n yamlObject.application.java.tomcat.components.forEach(function(e) {\n downloadFile(e.artifact, false)\n });\n } catch (e) {\n console.log(e);\n }\n}", "function parse(data, options) {\n // Allow the initial '---' to be omitted.\n // Note: this hack does not allow the block\n // to contain blank lines, although YAML\n // does support such expressions!\n var view = lodash__WEBPACK_IMPORTED_MODULE_3___default.a.assign({}, options);\n\n var dataStr = data;\n\n if (!dataStr.match(/^---/) && dataStr.match(/^([\\s\\S]*)[\\r\\n]+---/)) {\n dataStr = '---\\n' + dataStr;\n }\n\n var references = view.references;\n view = lodash__WEBPACK_IMPORTED_MODULE_3___default.a.assign({}, view, gray_matter__WEBPACK_IMPORTED_MODULE_0___default()(dataStr));\n var props = view.data;\n view = lodash__WEBPACK_IMPORTED_MODULE_3___default.a.assign(view, props);\n\n if (references) {\n // the YAML 'references' property uses a format that is\n // different from markdown-it's 'references' object\n view.references = references;\n }\n\n view.content = Object(_markdown__WEBPACK_IMPORTED_MODULE_5__[\"markdown\"])(view.content, view);\n return view;\n}", "function blowUpHierarchy(yamlLines) {\n var fullKey = \"\";\n var indent = 0;\n var currentIndent = 0;\n var indentSteps = [];\n var postLines = [];\n\n for (var index = 0; index < yamlLines.length; null) {\n var line = yamlLines[index];\n\n var match = line.trim().match(\".*:\");\n currentIndent = yamlLines[index].search(/\\S|$/);\n\n // We're in a list, simply push the content\n if (line.trim().indexOf(\"- \") === 0) {\n while (index < yamlLines.length && (yamlLines[index].trim().indexOf(\"- \") === 0 || yamlLines[index].search(/\\S|$/) > currentIndent)) {\n postLines.push(yamlLines[index]);\n index++;\n }\n continue;\n }\n\n // Down the tree\n if (match && (currentIndent > indent)) {\n if (currentIndent !== 0) {\n fullKey += DOT;\n } else {\n fullKey = \"\";\n }\n fullKey += match[0].replace(/:.*/, \"\");\n if ((currentIndent - indent) > 0) {\n indentSteps.push(currentIndent - indent);\n }\n }\n\n // Up the tree or peer property\n if (match && (currentIndent <= indent)) {\n if (currentIndent === 0) {\n fullKey = \"\";\n }\n\n var keyArr = fullKey.split(DOT);\n keyArr.pop();\n\n var steps = 0;\n // Get the number of steps to travel up the hierarchy tree\n while (indent > currentIndent) {\n indent -= indentSteps.pop();\n keyArr.pop();\n steps++;\n }\n\n fullKey = keyArr.join(DOT);\n if (currentIndent !== 0) {\n fullKey += DOT;\n }\n fullKey += match[0].replace(/:.*/, \"\");\n }\n\n if (line.trim().match(/.*:/)) {\n postLines.push(line.replace(line.split(\":\")[0], fullKey));\n } else {\n postLines.push(line);\n }\n\n indent = currentIndent;\n index++;\n }\n return postLines;\n}", "function valuify(string) {\n if (JSON_STRING.test(string)) {\n return JSON.parse(string);\n }\n return string;\n }", "function parseYamlBoolean(input) {\n if (['true', 'True', 'TRUE', 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON'].lastIndexOf(input) >= 0) {\n return true;\n }\n else if (['false', 'False', 'FALSE', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'].lastIndexOf(input) >= 0) {\n return false;\n }\n throw `Invalid boolean \"${input}\"`;\n}", "function processMarkupContent(data) {\n //strip out json front-matter\n var parts = data.split(/---/);\n var jsonFM;\n if (parts[0].length < 1) {\n throw new Error(\"missing frontmatter\");\n }\n try {\n jsonFM = JSON.parse(parts[0]);\n } catch(e) {\n console.error(\"[frontmatter] err parsing json:\"+parts[0], e);\n }\n parts.shift();\n return {\n frontmatter : jsonFM,\n content: parts.join('---')\n };\n}", "function generateMarkdown(data) {`\n## Project Title\n\n# ${data.title}\n\n## Project Description\n${data.description}\n\n## Project Link\n${data.project-link}\n\n## :brain: Table Of Contents (TOC)\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [License](#license)\n4. [Contributing](#contributing)\n5. [Tech](#tech)\n6. [Tests](#tests)\n\n${data.tableOfContents}\n\n## Installation\n\n${data.installation}\n\n## Usage\n\n${data.usage}\n\n${data.photos}\n\n## License\n\n${data.license}\n[![GitHub license] (https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/Naereen/StrapDown.js/blob/master/LICENSE)\n\n## Contributing\n${data.contributers}\n\n## Tech\n${data.technologies}\n\n## Tests\n${data.tests}\n\n## Questions\n${data.questions}\n${data.contact}\n\n`;\n}", "function readYml(file, fn) {\n\n var m;\n var api = {};\n var resource = yaml.safeLoad(fs.readFileSync(file, 'utf8'));\n var paths = Object.keys(resource.paths);\n _.each(paths, function(path) {\n if (options.apiPrefix && path.indexOf(options.apiPrefix) === 0){\n path = path.replace(options.apiPrefix, \"\");\n }\n api.resourcePath = path;\n api.description = resource.description || \"\";\n descriptor.paths[path] = resource.paths[path];\n\n // append definitions\n if (descriptor.definitions && Object.keys(descriptor.definitions).length) {\n m = _.merge(descriptor.definitions, resource.definitions);\n descriptor.definitions = m;\n } else {\n descriptor.definitions = resource.definitions;\n }\n });\n\n fn();\n}", "function generateMarkdown(data) {\n console.log(data)\n\nreturn `\n# ${data.title} \n \n![license](https://img.shields.io/badge/License-${data.license.split(' ').join('%20')}-blue?style=for-the-badge)\n\n \n## Description\n${data.description}\n\n${data.motivation}\n\n\n## Table of Contents\n \n* [Description](#description)\n* [Features](#features)\n* [Languages](#languages)\n* [Link](#link)\n* [Usage](#usage)\n* [Installation](#installation)\n* [Screenshots](#screenshots)\n* [Questions](#questions)\n* [License](#license)\n${contributeLink(data.contribute)}\n${testLink(data.test)}\n\n\n${generateFeatures(data.features)}\n \n\n## Languages\n\n${data.languages.join(', ')}\n\n\n## Link \n\n[${data.title} Deployed Page](${data.link})\n\n\n## Usage\n\n${data.usage}\n\n\n${generateInstructions(data.instructions)}\n\n\n${generatePics(data.screenShot)}\n\n## Credits\n\n${generateAuthors(data.authors)}\n\n\n## Questions\n\nFind my [GitHub Link](${data.userGithub}) here!\n \nIf you have any questions send me an email at [${data.email}](mailto:${data.email})\n\n\n## License\n\nThis project is covered under ${data.license}\n\n\n${generateContribute(data.contribute)}\n \n\n${generateTest(data.test)}\n\n`;\n}", "validation(model) {\n return model.replace(/models(.*)\\.yaml/g, 'validation$1.data.js');\n }", "function jsonPrettyFromString(string) {\n if (string === undefined || string === \"\") {\n return \"\";\n }\n const json = JSON.parse(string);\n return JSON.stringify(json, undefined, 2);\n}", "function jsonStr2RB(str) {\n let rb = JSON.parse(str);\n for (let r of rb[\"rules\"]) {\n let ifs = [];\n let builtIns = [];\n for (let a of r[\"if\"]) {\n ifs.push(a.split(' '));\n }\n //for builtIn\n for (let i = ifs.length - 1; i >= 0; i--) {\n if (isBuiltIn(ifs[i])) {\n builtIns.push(ifs[i]);\n ifs.splice(i, 1);\n }\n }\n r[\"if\"] = ifs;\n r[\"if-built-in\"] = builtIns;\n\n let thens = [];\n for (let a of r[\"then\"]) {\n thens.push(a.split(' '));\n }\n r[\"then\"] = thens;\n }\n\n return rb;\n}", "function buildFromYaml(rootObj) {\n const builder = new ConfigBuilder();\n\n const processEventDirectives = (loggerNS, eventName, obj) => {\n\n };\n\n const walkLoggerNamespace = (loggerNS) => {\n\n };\n\n\n return builder.finalize();\n}", "function generateMarkdown(payload) {\n return `# Title: ${payload.title} ${makeBadge(\"license\", payload.license)}\n\n## License\nThis project is under the ${payload.license} license\n\n## Table of Contents\n* [Installation](#installation)\n* [Usage](#usage)\n* [License](#license)\n* [Contributing](#contributing)\n* [Test](#test)\n* [Questions](#questions)\n\n## Description\n${payload.description}\n\n## Installation\n${payload.installation}\n\n## Usage\n${payload.usage}\n\n## Contributing\n${payload.contribution}\n\n## Test\n${payload.test}\n\n## Questions\nI learned programming language at ${payload.question} UWA. If you have any questions, please contact me at the Info below\n\n## GitHub\n${payload.username}\n![GitHub license](https://img.shields.io/badge/license-MIT-orange.svg)\nhttps://github.com/${payload.username}/${payload.title}\n\n## Email address\n${payload.email}\n\n`\n}", "function loadDocumentSync(file) {\n return YAML.load(file);\n}", "hugJSON(string) {\n// Parse data....\n let modules = JSON.parse(string)\n// Go through modules...... If we find a module with a .json ext.....\n for (const module of modules) {\n if (this.jsonFileRE.test(module.file)) {\n// Wrap the source code (json) with parens.....\n module.source = `(${module.source})`\n }\n }\n// Return altered json.....\n return modules\n }", "function identifyJSONString(str, opts) {\n var maxChars = 1000;\n var fmt = null;\n if (str.length > maxChars) str = str.substr(0, maxChars);\n str = str.replace(/\\s/g, '');\n if (opts && opts.json_path) {\n fmt = 'json'; // TODO: make json_path compatible with other types\n } else if (/^\\[[{\\]]/.test(str)) {\n // empty array or array of objects\n fmt = 'json';\n } else if (/\"arcs\":\\[|\"objects\":\\{|\"transform\":\\{/.test(str)) {\n fmt = 'topojson';\n } else if (/^\\{\"/.test(str)) {\n fmt = 'geojson';\n }\n return fmt;\n }", "function parseStageNames(stages) {\n\t\t_.each(stages, function(stage) {\n\t\t\t_.each(stage, function(value, key) {\n\t\t\t\tif (typeof value == 'string') {\n\t\t\t\t\tstage[key] = _.template(value, { config : config });\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\treturn stages;\n\t}", "function generateMarkdown(data) {\n return `# ${data.title}\n\n## Table Of Contents \n * [Description](#description)\n * [Installation](#installation) \n * [Usage](#usage) \n * [License](#license) \n * [Contribution](#contribution)\n * [Testing](#testing)\n * [Questions](#questions)\n\n## Visual Presentation\n\nvideo:\n\nhttps://drive.google.com/file/d/1DCuXCwPPzWO1wcOrtFcD3mUfUTQAY8QF/view\n\nScreenshot:\n\n<img width=\"721\" alt=\"Terminal Input\" src=\"https://user-images.githubusercontent.com/82979870/123585993-f035f180-d798-11eb-91f2-1cc9f12b6acd.png\">\n \n## Description\n ${data.description}\n\n## Installation\n ${data.installation}\n\n## Usage\n ${data.usage}\n\n## License \n ${renderLicenseBadge(data.license)} \n ${renderLicenseLink(data.license)}\n ${renderLicenseSection(data.license)}\n\n## Contribution\n ${data.contribution}\n\n## Test\n ${data.test}\n\n## Questions\n * For further information, please send email to ${data.email}\n * Check for details on Github at [${data.github}](https://github.com/${\n data.github\n })\n`;\n}", "function sampleConfig() {\n return \"\\\n---\\n\\\n# Configuration sample file for Jingo (YAML)\\n\\\napplication:\\n\\\n title: \\\"CartoWiki\\\"\\n\\\nserver:\\n\\\n hostname: \\\"localhost\\\"\\n\\\n port: 6067\\n\\\n localOnly: false\\n\\\n baseUrl: \\\"http://localhost:6067\\\"\\n\\\nauthentication:\\n\\\n google:\\n\\\n enabled: true\\n\\\n\ttwitter:\\n\\\n\t enabled: true\\n\\\n\t oauthkeys:\\n\\\n consumerKey : ''\\n\\\n consumerSecret : ''\\n\\\n cacheExpire: 3600000\\n\\\n\tfacebook:\\n\\\n\t enabled: true\\n\\\n\t oauthkeys:\\n\\\n clientID : ''\\n\\\n clientSecret : ''\\n\\\n alone:\\n\\\n enabled: false\\n\\\n username: \\\"\\\"\\n\\\n passwordHash: \\\"\\\"\\n\\\n email: \\\"\\\"\\n\\\ntwitterClient:\\n\\\n consumerKey : ''\\n\\\n consumerSecret : ''\\n\\\n accessTokenKey : ''\\n\\\n accessTokenSecret : ''\\n\\\n\";\n }", "function convertMarkdownToHtml(data, string) {\r\n\t//convert markdown to html\r\n\tif (string === \"answer\") {\r\n\t\tvar converter = new showdown.Converter(),\r\n\t\t text = faqData[i].markdownAnswer,\r\n\t\t html = converter.makeHtml(text);\r\n\t\t return html\r\n\t} else {\r\n\t\tvar converter = new showdown.Converter(),\r\n\t\t text = faqData[i].markdownQuestion,\r\n\t\t html = converter.makeHtml(text);\r\n\t\t return html\r\n\t}\r\n}", "function cleanupJSON(str) {\n str = str.replace(/ \"rules\": \\[/g, ' rules: [');\n str = str.replace(/ \"inclusive\": /g, ' inclusive: ');\n return str;\n }", "function cleanupJSON(str) {\n str = str.replace(/ \"rules\": \\[/g, ' rules: [');\n str = str.replace(/ \"inclusive\": /g, ' inclusive: ');\n return str;\n }", "function PostToHTML(relpath, markdown_body) {\n var callback = function (text) {\n\n /* circumvent github's auto-meta parsing */\n text = text.replace(\"(((\",'---');\n text = text.replace(\")))\",'---');\n\n /* write some HTML to format the data */\n var body = document.getElementById(markdown_body);\n var post_head = document.createElement('div');\n var post_body = document.createElement('div');\n body.appendChild(post_head);\n body.appendChild(post_body);\n\n if ((isBlank(text)) || (text == null) || (text == 'null') || (typeof text === 'undefined')) {\n post_head.innerHTML = 'Unable to load text for: '+relpath;\n return;\n }\n\n /* parse YAML header */\n var obj = jsyaml.loadFront(text)\n\n /* check for post meta data */\n var date = typeof obj.Date !== 'undefined' ? obj.Date.toDateString() : '';\n var author = typeof obj.Author !== 'undefined' ? obj.Author : '';\n var summary = typeof obj.Summary !== 'undefined' ? obj.Summary : '';\n var title = typeof obj.Title !== 'undefined' ? obj.Title : '';\n\n /* write some HTML to format the data */\n post_head.innerHTML = '<b>'+title+'</b><br> &nbsp; &nbsp; '+author+\n ' | <small>'+date+'</small><br><br>';\n\n /* convert the unparsed content as markdown */\n post_body.innerHTML = Showdown(obj.__content);\n $('.linenums').removeClass('linenums');\n prettyPrint();\n };\n getFile(relpath, callback);\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n\n## Description\n\n${data.description}\n\n## Table of Contents\n\n* [Description](#description)\n* [Installation](#installation)\n* [Contributors](#contributors)\n* [Test](#test)\n* [Username](#username)\n* [Email](#email)\n* [Questions](#questions)\n \n## Installation\n\n${data.installation}\n\n## Contributors\n\n${data.contributors}\n\n## Test\n\n${data.test}\n\n## Username\n\n${data.username}\n\n## Email\n\n${data.email}\n\n## Questions\n\n${data.questions}\n<br>\nGithub link: https://github.com/${data.username} \\t Email: ${data.email}\n`;\n}", "function strToJson(str) {\n\tvar inputSplitted, inputParsed;\n\tinputSplitted = str.split('\\n'); // Split the entire input in lines of string json\n\tinputSplitted = inputSplitted.filter(el => el.trim()); // Remove empty and only whitespaces lines\n\tinputParsed = inputSplitted.map((el) => JSON.parse(JSON.stringify(eval(\"(\" + el + \")\")))); // Parse JSON\n\treturn inputParsed;\n}", "function jsonToObj(str) {\n\t\tif (!$.isString(str)) { return str; }\n\t\t// Fix. Complete these checks.\n\t\tvar obj = JSON.parse(str);\n\t\treturn $.isPlainObject(obj) ? obj : str;\n\t}", "function recursive_nested_json_2(json_string){\n function run_recursive_nested_json(json_string, prev_key, output) {\n try {\n json_obj = JSON.parse(json_string);\n for (let key in json_obj) {\n val = json_obj[key];\n new_key = (prev_key != \"\") ? `${prev_key}.${key}` : key;\n if (val instanceof Object) {\n output = recursive_nested_json_2(json_string=JSON.stringify(val), prev_key=new_key, output=output);\n }\n else {\n output[new_key] = val;\n }\n }\n return output;\n }\n catch (e) {\n return null;\n }\n }\n output = {};\n run_recursive_nested_json(json_string=json_string, prev_key=\"\", output=output);\n return JSON.stringify(output)\n // return output\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n## Table of Contents\n## 1.[Installation](#installation)\n## 2.[Usage](#usage)\n## 3.[License](#license)\n## 4.[Contributing](#contributing)\n## 5.[Tests](#tests)\n## 6.[Questions](#questions)\n## 7.[Description](#description)\n \n<a name=\"installation\"></a>\n# Installation\n${data.install}\n\n<a name=\"usage\"></a>\n# Usage\n${data.usage}\n\n<a name=\"license\"></a>\n# License\n${data.badge}\n\n<a name=\"contributing\"></a>\n# Contributing\n${data.contributors}\n\n<a name=\"tests\"></a>\n# Tests\n${data.tests}\n\n<a name=\"questions\"></a>\n# Questions\n* ${data.Email}\n* https://github.com/${data.Github}\n\n<a name=\"description\"></a>\n# Description\n${data.description}\n\n`\n}", "function handleJSON(str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return str;\n }\n return JSON.stringify(str);\n}", "function convertMarkdownChoiceBlocks(text, convert) {\n $.each({ checkbox: '[]', radio: '()' }, function(type, chars) {\n // one choice is: open char + maybe x + close char + indented lines\n var singleChoice = '^\\\\' + chars[0] + '([ x])\\\\' + chars[1] + '(.+$(\\n .*)*)';\n var multipleChoices = '(' + singleChoice + '\\n)+';\n // find blocks of choices\n text = text.replace(new RegExp(multipleChoices, 'gm'), function(choices) {\n this.convertedChoiceBlocks = (this.convertedChoiceBlocks || 0) + 1;\n \n // convert individual choices\n var convertedChoices = 0;\n choices = choices.replace(new RegExp(singleChoice, 'gm'), function(choice, checked, label) {\n var id = 'md_converted_choice_' + this.convertedChoiceBlocks + '_' + convertedChoices++;\n var attrs = ' type=\"' + type + '\" id=\"' + id + '\"';\n if (/\\S/.test(checked)) {\n attrs += ' data-form-value=\"check\"';\n }\n if (type == 'radio') {\n // radio buttons must share the name attribute in order to enforce single selection\n attrs += ' name=\"' + 'md_converted_radio_' + this.convertedChoiceBlocks + '\"';\n }\n // de-block recursive conversion of choice label\n label = convert(label).replace(/<p>([^]*)<\\/p>/, '$1');\n return '<div class=\"' + type + '\"><label for=\"' + id + '\"><input' + attrs + '>' + label + '</label></div>';\n });\n // result of converting block is choices wrapped in a div\n return '<div class=\"form-group\">' + choices + '</div>';\n });\n });\n return text;\n}", "function getFrontmatter(/** @type {string} */ content) {\n\tconst frontMatterCharCodes = [];\n\tconst result = { data: {}, content, rawData: '' }\n\n\t// if the file begins with a yaml separator\n\tif (isSeparator(content, 0)) {\n\t\t// collect all contents before the next yaml separator\n\t\tfor (let i = 3; i < content.length; ++i) {\n\t\t\tconst code = content.charCodeAt(i);\n\n\t\t\t// if the next line begins with a yaml separator\n\t\t\tif (isLineFeed(code) && isSeparator(content, i + 1)) {\n\t\t\t\t// the remaining contents are the markdown content\n\t\t\t\tresult.content = content.slice(i + 4);\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// all prior code is the data\n\t\t\tfrontMatterCharCodes.push(code);\n\t\t}\n\n\t\tresult.rawData = String.fromCharCode(...frontMatterCharCodes)\n\n\t\ttry {\n\t\t\tresult.data = parseAsYaml(result.rawData)\n\t\t} catch (error) {}\n\t}\n\n\treturn result\n}", "function convert(str)\n {\n if (! /['\"]/.test(str))\n {\n return str;\n } else\n {\n var foo = str.\n // Use [\\s\\S] instead of . to match any characters _including newlines_\n replace(/([\\s\\S])?'/,\n replaceQuotesFromContext(constants.openSingleCurly, constants.closeSingleCurly)).\n replace(/([\\s\\S])?\"/,\n replaceQuotesFromContext(constants.openDoubleCurly, constants.closeDoubleCurly));\n return convert(foo);\n }\n }", "function getTranslationString_JSON(obj) {\n\tfor (key in obj) {\n\t obj[key].description = addSlashes(obj[key].description);\n\t obj[key].value = addSlashes(obj[key].value);\n }\n return FormatJSON(obj);\n}", "function prettifyJSON(str) {\n try {\n return JSON.stringify(JSON.parse(str), null, 2);\n }\n catch (err) {\n return str;\n }\n }", "function generateMarkdown(data) {\n return `\n \n#Title\n#${data.Title}\n\n\n\n#description\n#${data.description}\n\n\n#toc\n#${data.toc}\n\n\n#install\n\\`\\`\\` \n${data.install}\n\\`\\`\\` \n\n#license\n#${data.license}\n\n\n#email\n[${data.email}](mailto:${data.email})\n\n\n\n#contributor\n#${data.contributor}\n\n\n#test\n#${data.test}\n\n\n\n#random\n#${data.random}\n\n`;\n}", "function generateMarkdown(data) {\n\n return `\n${generateBadges(data)}\n\n# ${data.title}\n\n## Description\n\n${data.description}\n\n## Table of Contents\n \n* [Installation](#installation)\n* [Usage](#usage)\n* [Credits](#credits)\n* [License](#license)\n* [Contributing](#contributing)\n* [Tests](#tests)\n* [Questions](#questions)\n \n## Installation\n\n${data.installation}\n\n## Usage\n\n${data.usage}\n\n## Credits\n\n${data.credits}\n\n## License\n\n${data.license}\n\n## Contributing\n\n${data.contributions}\n\n## Tests\n\n${data.tests}\n\n## Questions\n\nContact me at ${data.email}\n\nWork with me at ![${data.github}](https://github.com/${data.github})\n\nProject by ${data.name}\n\n\n\n\nThis ReadMe.md file was generated with the help of ![DevelopedByDay](https://github.com/DevelopedByDay)\n`;\n}", "function prettyJSONString(inputString) {\n\treturn JSON.stringify(JSON.parse(inputString), null, 2);\n}", "function prettyJSON(text, step) {\r\n\r\n var step = step ? step : 3;\r\n\r\n if (typeof JSON === 'undefined') return text;\r\n try {\r\n if (typeof text === \"string\") return JSON.stringify(JSON.parse(text), null, step);\r\n if (typeof text === \"object\") return JSON.stringify(text, null, step);\r\n }\r\n catch (e) { }\r\n return text; // text is not string nor object\r\n}", "function generateMarkdown(data) {\n return `\n# ${data.title}\n \n## License:\n![license](https://img.shields.io/badge/license-MIT-blue)\n \n\n## Table of Contents\n* [Description](#description)\n* [Usage](#usage)\n* [Contribution](#contribution)\n* [Installation](#installation)\n* [Questions](#questions)\n* [License](#license)\n \n\n\n## Description\n${data.description}\n\n## Usage\n${data.usage}\n\n## Contribution\n${data.contribution}\n\n## Installation\n${data.installation}\n\n## Questions\nPlease contact me at:\n\ngitHub:[${data.gitHub}](https://github.com/dtm5169)\nEmail:[${data.email}]([email protected])\n\n## License\n${data.license} \n\n\n\n`;\n}", "function decode(payload) {\n try {\n return JSON.parse(payload);\n } catch (e) {\n return payload;\n }\n}", "transformMarkdown(params) {\n if (!params.markdown) {\n return { __html: '' };\n }\n return { __html: markdownIt.render(params.markdown) };\n }", "function deserializeTextFormat(str) {\n const tags = new tag_map_1.TagMap();\n if (!str)\n return tags;\n const listOfTags = str.split(TAG_DELIMITER);\n listOfTags.forEach(tag => {\n const keyValuePair = tag.split(TAG_KEY_VALUE_DELIMITER);\n if (keyValuePair.length !== 2)\n throw new Error(`Malformed tag ${tag}`);\n const [name, value] = keyValuePair;\n tags.set({ name }, { value }, UNLIMITED_PROPAGATION_MD);\n });\n return tags;\n}", "function generateMarkdown(data) {\n return `\n ## Github\n ${data.Github}\n\n ## Email\n ${data.email}\n\n ## URL\n ${data.url}\n\n ## Title\n ${data.title}\n\n ## Description\n ${data.description}\n\n ## Table of Contents \n\n * [Description](#Description)\n * [License](#License)\n * [Installation](#Install)\n * [Test](#Test)\n * [Questions](#Questions)\n * [Contributing](#Contributing)\n\n ## License\n ${data.license} <br />\n ${badgeChange(data.license)} \n \n\n ## Install\n ${data.install}\n\n ## Test\n ${data.test}\n\n ## Questions\n ${data.questions}\n\n ## Contributing\n ${data.contributing}\n \n \n`;\n}", "function extractYaml(files) {\n for (const name in files) {\n if (files.hasOwnProperty(name) && files[name].mimetype === mimetype) {\n log.info(`file found: ${name}`);\n return files[name];\n }\n }\n return null;\n}", "function toNormalizedJsonString(payload) {\n const payloadString = JSON.stringify(payload);\n return payloadString.replace(/[^\\\\]\\\\u[\\da-f]{4}/g, s => {\n return s.substr(0, 3) + s.substr(3).toUpperCase();\n });\n}", "function deserialize(data) {\n var value;\n if (typeof data === 'string') {\n value = JSON.parse(data);\n }\n else {\n value = deserializeBinary(data);\n }\n return value;\n}", "function generateMarkdown(data) {\n\t//console.log(Object.entries(data));\n\n\treturn `\n# ${data.title} ${renderLicenseBadge(data.License)}\n\n${getSection(\"Description\", data.desc)}\n\n## Table Of Contents \n${generateTableOfContents(data)}\n\n${getSection(\"Installation\", data.Installation)}\n\n${getSection(\"Usage\", data.Usage)}\n\n${getImageRefs(data.images)}\n\n${getSection(\"Credits\", data.Credits)}\n\n${renderLicenseSection(data.License)}\n\n${getSection(\"Contributing\", data.Contributing)}\n\n${getSection(\"Tests\", data.Tests)}\n\n${getQuestionsSection(\"Questions\", data.email, data.github)}\n\n \n `;\n}", "function encodedJson(matcher) {\n return annotateMatcher({ $encodedJson: matcher }, (value, failure) => {\n if (typeof value !== 'string') {\n failure.failureReason = `Expected a string, but got '${typeof value}'`;\n return false;\n }\n let decoded;\n try {\n decoded = JSON.parse(value);\n }\n catch (e) {\n failure.failureReason = `String is not JSON: ${e}`;\n return false;\n }\n return matcherFrom(matcher)(decoded, failure);\n });\n}", "function bodyToStr(str) {\n if (str == \"\") {\n return str;\n }\n\n try {\n tmpJson = JSON.parse(str);\n tmp = JSON.stringify(tmpJson, undefined, 2);\n } catch (e) {\n tmp = str;\n }\n\n return tmp;\n}", "function _toObjectIfJSONString(str) {\n try {\n str = JSON.parse(str);\n } catch (err) {\n // ignore error\n }\n\n return str;\n}", "function parse_dc_config(path) {\n return __awaiter(this, void 0, void 0, function* () {\n const yaml = yield docker_compose_1.config({\n config: path,\n }).catch(console.log);\n return js_yaml_1.load(yaml.out);\n });\n}", "function generateMarkdown(data) {\n\tvar {\n\t\ttitle,\n\t\tdescription,\n\t\tinstallation,\n\t\tusage,\n\t\tcontribution,\n\t\ttesting,\n\t\tlicense,\n\t\tauthorUsername,\n\t\tauthorEmail,\n\t} = data\n\treturn `\n# ${title} ${renderLicenseBadge(license)}\n\n${description}\n\n## Table of Contents:\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [License](#license)\n- [Contributing](#contributing)\n- [Tests](#tests)\n- [Questions](#questions)\n\n### Installation:\n\nIn order to install the necessary dependencies mentioned in package.json, use:\n\n\\t${installation}\n\n### Usage:\n\n${usage}\n\n${renderLicenseSection(license)}\n\n### Contributing:\n\n${contribution}\n\n### Tests:\n\nto perform tests -\n\n\\t${testing}\n\n### Questions:\n\nFor any inquiries please feel free to contact on ${authorEmail}\n\n![picture](https://github.com/${authorUsername}.png?size=80)[Github](\"https://github.com/${authorUsername}\")\n\n`\n}", "function parseUserEventInput(data){\n \n var split = /^(.+)\\n\\-{3,6}\\n(.+)$/s.exec(data);\n if(!split) throw Error(\"完全看不懂!\");\n\n try{\n var yamldoc = yaml.parse(split[1].trim());\n } catch(e){\n throw Error(\"格式写错了!\");\n }\n var description = split[2].trim();\n\n if(!(\n yamldoc.name &&\n _.isString(yamldoc.name) &&\n yamldoc.name.length <= 100 &&\n yamldoc.name.length >= 3\n )){\n throw Error(\"活动名字要在3到100个字之间!\");\n }\n\n const isPublicTranslation = {\n \"y\": true, \"yes\": true, \"是\": true, \"公开\": true, \"true\": true,\n \"1\": true,\n\n \"n\": false, \"no\": false, \"否\": false, \"不公开\": false,\n \"false\": false, \"私有\": false, \"私密\": false, \"0\": false,\n };\n\n if(isPublicTranslation[yamldoc.public] === undefined){\n throw Error(\"要决定是不是公开分享!\");\n }\n yamldoc.public = isPublicTranslation[yamldoc.public];\n\n \n return {\n name: yamldoc.name,\n public: yamldoc.public,\n description: description,\n }\n}", "function generateMarkdown(data) {\n return `# ${data.name}\n# Table of Contents: \n * [Title](#title)\n * [Description](#description)\n * [Installation](#installation)\n * [Usage](#usage)\n * [Contribution](#contribution)\n * [Tests](#tests)\n * [Questions](#questions)\n * [License](#license)\n * [Email](#email)\n * [GitHub](#github)\n\n# Title: \n${data.title}\n\n# Description:\n${data.description}\n---\n# Installation:\n${data.installation}\n\n# Usage:\n${data.usage}\n\n# Contribution:\n${data.contributors}\n\n# Tests:\n${data.test}\n\n# Questions:\n${data.questions}\n\n# License:\n${badge(data.license)}\n\n# Email:\n${data.email}\n\n# GitHub:\n${data.github}`\n}", "function parseConfigFileTextToJson(fileName, jsonText) {\n try {\n var jsonTextWithoutComments = removeComments(jsonText);\n return { config: /\\S/.test(jsonTextWithoutComments) ? JSON.parse(jsonTextWithoutComments) : {} };\n }\n catch (e) {\n return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) };\n }\n }", "function sanitizeJSON(jsonString) {\n\t\tif (!jsonString) return;\n\n\t\tvar JSON_parts = jsonString.split(\",\\\\\\\"\");\n\t\tvar last_element = JSON_parts[JSON_parts.length - 1];\n\n\t\tlast_element = last_element.replace(/[\\\"]/g,\"'\");\n\t\tjsonString = '';\n\n\t\tjsonString = jsonString + JSON_parts[0];\n\n\t\tfor(var i = 1; i <= JSON_parts.length - 2; i++) {\n\t\t\tjsonString = jsonString + \",\\\"\" + JSON_parts[i];\n\t\t}\n\t\tlast_element = last_element.replace(/\\'/, \"\\\"\").replace(/'}/, \"\\\"}\").replace(/\\\\/g, \"\");\n\t\tjsonString = jsonString + \",\\\"\" + last_element;\n\t\tjsonString = jsonString.replace(/\\\\\\\":/g, \"\\\":\").replace(/{\\\\\\\"/, \"{\\\"\").replace(/\\\":\\'/, \"\\\":\\\"\");\n\n\t\treturn jsonString;\n\t}", "function generateMarkdown(data) {\n return `\n # Title \n ${data.title}\n \n \n # Table of contents\n 1. [Description](#description)\n 2. [Installation](#installation)\n 3. [Usage](#usage)\n 4. [Contribution](#contribution)\n 5. [Testing](#testing)\n 6. [Licensing](#licensing)\n 7. [Questions](#questions)\n \n \n \n\n \n## Description <a name=\"description\"></a>\n${data.description}\n\n## Installation <a name=\"installation\"></a>\n${data.installation}\n\n## Usage <a name=\"usage\"></a>\n${data.usage}\n\n## Contribution <a name=\"contribution\"></a>\n${data.contribution}\n\n## Testing <a name=\"testing\"></a>\n${data.testing}\n\n## Licensing <a name=\"licensing\"></a>\n${data.licensing}\n\n## Questions <a name=\"questions\"></a>\n<https://github.com/${data.questions}>\n\n## Questionss\n<${data.questionss}>\n`;\n}", "function parseMarkdown(str) {\r\n const results = {};\r\n if (str) {\r\n // Some stuff can break this, so try/catching it if needed.\r\n try {\r\n const res = md.parseInline(str, {});\r\n let url;\r\n if (res[0] && res[0].children) {\r\n url = res[0].children.find((child) => (child.type === 'link_open' && child.attrs\r\n && child.attrs[0] && child.attrs[0][0] === 'href'));\r\n }\r\n results.url = (url && url.attrs) ? url.attrs[0][1] : undefined;\r\n results.str = remove_markdown_1.default(str);\r\n }\r\n catch (err) {\r\n // return nothing\r\n }\r\n }\r\n return results;\r\n}", "extend(config, ctx) {\n config.module.rules.push({\n test: /\\.ya?ml$/,\n use: 'js-yaml-loader',\n })\n }", "parse(value, exceptionOnInvalidType = false, objectDecoder = null) {\n var alias, allowOverwrite, block, c, context, data, e, first, i, indent, isRef, j, k, key, l, lastKey, len, len1, len2, len3, lineCount, m, matches, mergeNode, n, name, parsed, parsedItem, parser, ref, ref1, ref2, refName, refValue, val, values;\n this.currentLineNb = -1;\n this.currentLine = '';\n this.lines = this.cleanup(value).split(\"\\n\");\n data = null;\n context = this.CONTEXT_NONE;\n allowOverwrite = false;\n while (this.moveToNextLine()) {\n if (this.isCurrentLineEmpty()) {\n continue;\n }\n // Tab?\n if (\"\\t\" === this.currentLine[0]) {\n throw new ParseException('A YAML file cannot contain tabs as indentation.', this.getRealCurrentLineNb() + 1, this.currentLine);\n }\n isRef = mergeNode = false;\n if (values = this.PATTERN_SEQUENCE_ITEM.exec(this.currentLine)) {\n if (this.CONTEXT_MAPPING === context) {\n throw new ParseException('You cannot define a sequence item when in a mapping');\n }\n context = this.CONTEXT_SEQUENCE;\n if (data == null) {\n data = [];\n }\n if ((values.value != null) && (matches = this.PATTERN_ANCHOR_VALUE.exec(values.value))) {\n isRef = matches.ref;\n values.value = matches.value;\n }\n // Array\n if (!(values.value != null) || '' === Utils.trim(values.value, ' ') || Utils.ltrim(values.value, ' ').indexOf('#') === 0) {\n if (this.currentLineNb < this.lines.length - 1 && !this.isNextLineUnIndentedCollection()) {\n c = this.getRealCurrentLineNb() + 1;\n parser = new Parser(c);\n parser.refs = this.refs;\n data.push(parser.parse(this.getNextEmbedBlock(null, true), exceptionOnInvalidType, objectDecoder));\n } else {\n data.push(null);\n }\n } else {\n if (((ref = values.leadspaces) != null ? ref.length : void 0) && (matches = this.PATTERN_COMPACT_NOTATION.exec(values.value))) {\n // This is a compact notation element, add to next block and parse\n c = this.getRealCurrentLineNb();\n parser = new Parser(c);\n parser.refs = this.refs;\n block = values.value;\n indent = this.getCurrentLineIndentation();\n if (this.isNextLineIndented(false)) {\n block += \"\\n\" + this.getNextEmbedBlock(indent + values.leadspaces.length + 1, true);\n }\n data.push(parser.parse(block, exceptionOnInvalidType, objectDecoder));\n } else {\n data.push(this.parseValue(values.value, exceptionOnInvalidType, objectDecoder));\n }\n }\n } else if ((values = this.PATTERN_MAPPING_ITEM.exec(this.currentLine)) && values.key.indexOf(' #') === -1) {\n if (this.CONTEXT_SEQUENCE === context) {\n throw new ParseException('You cannot define a mapping item when in a sequence');\n }\n context = this.CONTEXT_MAPPING;\n if (data == null) {\n data = {};\n }\n // Force correct settings\n Inline.configure(exceptionOnInvalidType, objectDecoder);\n try {\n key = Inline.parseScalar(values.key);\n } catch (error) {\n e = error;\n e.parsedLine = this.getRealCurrentLineNb() + 1;\n e.snippet = this.currentLine;\n throw e;\n }\n if ('<<' === key) {\n mergeNode = true;\n allowOverwrite = true;\n if (((ref1 = values.value) != null ? ref1.indexOf('*') : void 0) === 0) {\n refName = values.value.slice(1);\n if (this.refs[refName] == null) {\n throw new ParseException('Reference \"' + refName + '\" does not exist.', this.getRealCurrentLineNb() + 1, this.currentLine);\n }\n refValue = this.refs[refName];\n if (typeof refValue !== 'object') {\n throw new ParseException('YAML merge keys used with a scalar value instead of an object.', this.getRealCurrentLineNb() + 1, this.currentLine);\n }\n if (refValue instanceof Array) {\n// Merge array with object\n for (i = j = 0, len = refValue.length; j < len; i = ++j) {\n value = refValue[i];\n if (data[name = String(i)] == null) {\n data[name] = value;\n }\n }\n } else {\n// Merge objects\n for (key in refValue) {\n value = refValue[key];\n if (data[key] == null) {\n data[key] = value;\n }\n }\n }\n } else {\n if ((values.value != null) && values.value !== '') {\n value = values.value;\n } else {\n value = this.getNextEmbedBlock();\n }\n c = this.getRealCurrentLineNb() + 1;\n parser = new Parser(c);\n parser.refs = this.refs;\n parsed = parser.parse(value, exceptionOnInvalidType);\n if (typeof parsed !== 'object') {\n throw new ParseException('YAML merge keys used with a scalar value instead of an object.', this.getRealCurrentLineNb() + 1, this.currentLine);\n }\n if (parsed instanceof Array) {\n// If the value associated with the merge key is a sequence, then this sequence is expected to contain mapping nodes\n// and each of these nodes is merged in turn according to its order in the sequence. Keys in mapping nodes earlier\n// in the sequence override keys specified in later mapping nodes.\n for (l = 0, len1 = parsed.length; l < len1; l++) {\n parsedItem = parsed[l];\n if (typeof parsedItem !== 'object') {\n throw new ParseException('Merge items must be objects.', this.getRealCurrentLineNb() + 1, parsedItem);\n }\n if (parsedItem instanceof Array) {\n// Merge array with object\n for (i = m = 0, len2 = parsedItem.length; m < len2; i = ++m) {\n value = parsedItem[i];\n k = String(i);\n if (!data.hasOwnProperty(k)) {\n data[k] = value;\n }\n }\n } else {\n// Merge objects\n for (key in parsedItem) {\n value = parsedItem[key];\n if (!data.hasOwnProperty(key)) {\n data[key] = value;\n }\n }\n }\n }\n } else {\n// If the value associated with the key is a single mapping node, each of its key/value pairs is inserted into the\n// current mapping, unless the key already exists in it.\n for (key in parsed) {\n value = parsed[key];\n if (!data.hasOwnProperty(key)) {\n data[key] = value;\n }\n }\n }\n }\n } else if ((values.value != null) && (matches = this.PATTERN_ANCHOR_VALUE.exec(values.value))) {\n isRef = matches.ref;\n values.value = matches.value;\n }\n if (mergeNode) {\n\n // Merge keys\n } else if (!(values.value != null) || '' === Utils.trim(values.value, ' ') || Utils.ltrim(values.value, ' ').indexOf('#') === 0) {\n // Hash\n // if next line is less indented or equal, then it means that the current value is null\n if (!(this.isNextLineIndented()) && !(this.isNextLineUnIndentedCollection())) {\n // Spec: Keys MUST be unique; first one wins.\n // But overwriting is allowed when a merge node is used in current block.\n if (allowOverwrite || data[key] === void 0) {\n data[key] = null;\n }\n } else {\n c = this.getRealCurrentLineNb() + 1;\n parser = new Parser(c);\n parser.refs = this.refs;\n val = parser.parse(this.getNextEmbedBlock(), exceptionOnInvalidType, objectDecoder);\n // Spec: Keys MUST be unique; first one wins.\n // But overwriting is allowed when a merge node is used in current block.\n if (allowOverwrite || data[key] === void 0) {\n data[key] = val;\n }\n }\n } else {\n val = this.parseValue(values.value, exceptionOnInvalidType, objectDecoder);\n // Spec: Keys MUST be unique; first one wins.\n // But overwriting is allowed when a merge node is used in current block.\n if (allowOverwrite || data[key] === void 0) {\n data[key] = val;\n }\n }\n } else {\n // 1-liner optionally followed by newline\n lineCount = this.lines.length;\n if (1 === lineCount || (2 === lineCount && Utils.isEmpty(this.lines[1]))) {\n try {\n value = Inline.parse(this.lines[0], exceptionOnInvalidType, objectDecoder);\n } catch (error) {\n e = error;\n e.parsedLine = this.getRealCurrentLineNb() + 1;\n e.snippet = this.currentLine;\n throw e;\n }\n if (typeof value === 'object') {\n if (value instanceof Array) {\n first = value[0];\n } else {\n for (key in value) {\n first = value[key];\n break;\n }\n }\n if (typeof first === 'string' && first.indexOf('*') === 0) {\n data = [];\n for (n = 0, len3 = value.length; n < len3; n++) {\n alias = value[n];\n data.push(this.refs[alias.slice(1)]);\n }\n value = data;\n }\n }\n return value;\n } else if ((ref2 = Utils.ltrim(value).charAt(0)) === '[' || ref2 === '{') {\n try {\n return Inline.parse(value, exceptionOnInvalidType, objectDecoder);\n } catch (error) {\n e = error;\n e.parsedLine = this.getRealCurrentLineNb() + 1;\n e.snippet = this.currentLine;\n throw e;\n }\n }\n throw new ParseException('Unable to parse.', this.getRealCurrentLineNb() + 1, this.currentLine);\n }\n if (isRef) {\n if (data instanceof Array) {\n this.refs[isRef] = data[data.length - 1];\n } else {\n lastKey = null;\n for (key in data) {\n lastKey = key;\n }\n this.refs[isRef] = data[lastKey];\n }\n }\n }\n if (Utils.isEmpty(data)) {\n return null;\n } else {\n return data;\n }\n }", "buildPrintOrg() {\n let configtx = this._buildApplication();\n let yamlData = yaml.safeDump(configtx);\n return yamlData;\n }", "draft() {\n return require.context(\n 'json!yaml-frontmatter!./drafts',\n false,\n /^\\.\\/.*\\.md$/\n );\n }", "function generateMarkdown(data) {\n return `# ${data.title}\n \n${renderLicenseBadge(data)} \n\n## Description\n\n${data.description}\n\n## Table of Contents\n\n* [License](#license)\n\n* [Installation](#installation)\n\n* [Tests](#tests)\n\n* [Usage](#usage)\n\n* [Contributing](#contributing)\n\n* [Questions](#questions)\n\n## License\n\n${data.license}\n\n${renderLicenseSection(data)} \n> ${renderLicenseLink(data)}\n\n## Installation\n\nTo install dependencies use the following in the command line: \n\n\\`\\`\\`\n${data.dependencies}\n\\`\\`\\`\n\n## Tests\n\nTo test: \n\n\\`\\`\\`\n${data.tests}\n\\`\\`\\`\n\n## Usage\n\n\\`\\`\\`\n${data.repoUse}\n\\`\\`\\`\n\n## Contributing\n\n${data.repoContribute}\n\nCheck out my other repos at: <https://github.com/${data.username}>\n\n## Questions\n\nIf you have any questions, please contact me at: ${data.email}\n \n`\n}", "function prettify(str) {\n let tmpStr = str;\n let str1 = '';\n let str2 = '';\n let level = 0;\n let i = 0;\n\n while(tmpStr[i]) {\n if(tmpStr[i] == '{') {\n level++;\n str1 = tmpStr.slice(0,i);\n str2 = tmpStr.slice(i+1, tmpStr.length);\n\n var spaces = ' '.repeat(level);\n\n tmpStr = str1 + '{\\n' + spaces + str2;\n }\n if(tmpStr[i] == '}') {\n level--;\n str1 = tmpStr.slice(0,i);\n str2 = tmpStr.slice(i+1, tmpStr.length);\n\n var spaces = ' '.repeat(level);\n\n tmpStr = str1 + '\\n' + spaces + '}' + str2;\n i = i + spaces.length + 1;\n }\n if(tmpStr[i] == ',' && tmpStr[i+1] == '\"') {\n str1 = tmpStr.slice(0,i);\n str2 = tmpStr.slice(i+1, tmpStr.length);\n\n var spaces = ' '.repeat(level);\n\n tmpStr = str1 + ',\\n' + spaces + str2;\n }\n\n i++;\n }\n\n return tmpStr;\n}", "function generateMarkdown(data) {\n return `\n# ${data.title}\n\n ![${data.licenseResponse}](${renderLicenseBadge(data)})\n\n## Description\n${data.descript}\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Contributions](#contributions)\n- [Testing](#testing)\n- [License](#license)\n- [Questions](#questions)\n- [Screenshots](#screenshots)\n- [Links](#links)\n\n## Installation\n${data.install}\n\n## Usage\n${data.usage}\n\n## Contributions\n${data.contrib}\n\n## Testing\n${data.test}\n\n## License\n**${renderLicenseLink(data)}**\n\n## Questions\nMy github username is: ${data.github} and the repository for this project is: ${data.repo}\n\nIf you have any questions please contact me at: ${data.email}\n\n## Screenshots\nScreenshot of the deployed project:\n\n![screenshot](${data.images})\n\n\n## Links \nLinks to the deployed project and Github Repository\n\nRepository: **${data.linkRepo}**\n\nDeployed Project: **${data.linkDeploy}**\n`;}", "function jsonToHTML (data) {\n \n var html;\n \n \n \n return html;\n}", "static ppJSON(theJSON) {\nreturn Pretty.json(theJSON);\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n \n ## Description\n ${data.Description}\n \n ## License\n under${data.License}license\n ![github license](https://img.shields.io/badge/%3Clicense%3E-%3CMIT%3E-brightgreen%3E\t\n )\n \n \n ## Table of contents\n ${data.TableOfContents}\n \n ## Installation\n ${data.Installation}\n \n ## Usage\n ${data.Usage}\n \n ## Credits\n ${data.Credits}\n \n ## Test\n ${data.Test}\n \n ## Questions\n ${data.Questions}\n \n ## Username\n ${data.Username}\n \n ## Email\n ${data.Email}\n \n `;\n }", "function generateMarkdown(data) {\n return `# ${data.name}\n ## Description \n${data.description}\n## Table of Contents\n*[License]\n*[test]\n*[contributors]\n*[user story]\n\n# User Story \n${data.userstory}\n# Contributors\n${data.contributors}\n# Test \n${data.test}\n#Features\n${data.features}\n# License\n${renderLicenseBadge(data.license)}\n${renderLicenseSection(data.license)}\n${renderLicenseLink(data.license)}\n`;\n}", "function parseJSON( path, content ) {\n\n return JSON.parse( content, function( key, value ) {\n\n if ( options.stripComments && key === \"{{comment}}\" ) return undefined;\n\n // Replace variables in their values\n\n if ( Object.keys( options.variables ).length && typeof value === \"string\" ) {\n value = replaceVariables( value );\n }\n\n var match = ( typeof value === \"string\" ) ? value.match( options.parsePattern ) : null;\n\n if ( match ) {\n var folderPath = getFolder( path ) || \".\";\n var fullPath = folderPath + \"/\" + match[ 1 ];\n\n return isDirectory( fullPath ) ? parseDirectory( fullPath ) : parseFile( fullPath );\n }\n\n return value;\n\n } );\n }", "function myParseJSON(data) {\n data = data.substr(data.indexOf('{'));\n while (data.substr(data.length-1)=='\\n')\n data = data.substr(0, data.length - 1);\n data = data.split(\"\\n\").join(\"<br/>\");\n data = data.split(\"\\r\").join(\"\");\n \n return jQuery.parseJSON(data);\n}", "function stringifyString( v , runtime , isTemplateSentence ) {\n\tvar maybeDollar = '' ;\n\n\tif ( isTemplateSentence ) {\n\t\tif ( v.key ) {\n\t\t\tv = v.key ;\n\t\t\tmaybeDollar = '$' ;\n\t\t}\n\t\telse {\n\t\t\truntime.str += runtime.depth ? ' <Sentence>' : '<Sentence>' ;\n\t\t\treturn ;\n\t\t}\n\t}\n\n\tif ( runtime.preferQuotes ) {\n\t\treturn stringifyStringMaybeQuotes( v , runtime , maybeDollar ) ;\n\t}\n\n\treturn stringifyStringMaybeStringLine( v , runtime , maybeDollar ) ;\n\n}" ]
[ "0.7436097", "0.63431114", "0.62323123", "0.6145358", "0.6144687", "0.6144687", "0.6138018", "0.5777885", "0.5621768", "0.5467203", "0.54542303", "0.538984", "0.52895117", "0.523634", "0.52218056", "0.5184282", "0.5152882", "0.5137597", "0.5083414", "0.50124794", "0.50003785", "0.4966437", "0.4869989", "0.4857552", "0.48565143", "0.48551264", "0.48325795", "0.47543663", "0.47007883", "0.46653003", "0.4618861", "0.45636222", "0.45225015", "0.4518868", "0.45135587", "0.45027724", "0.44943455", "0.44854128", "0.4467238", "0.44415575", "0.4437924", "0.43893397", "0.43824622", "0.43740994", "0.43685526", "0.43614632", "0.43463382", "0.4341104", "0.43285966", "0.43285966", "0.42696613", "0.4263255", "0.42592943", "0.42565578", "0.42541558", "0.42493054", "0.42418554", "0.42408794", "0.42339522", "0.42287657", "0.42278767", "0.42114505", "0.4191192", "0.41905943", "0.41854557", "0.41796786", "0.41780707", "0.4176006", "0.41502473", "0.41480324", "0.41336727", "0.41320628", "0.4117759", "0.40919346", "0.40916744", "0.40902826", "0.40901062", "0.40881237", "0.408647", "0.40861326", "0.40807196", "0.40729925", "0.4072843", "0.40710926", "0.40568727", "0.40565586", "0.40563115", "0.40543312", "0.4053816", "0.40533757", "0.40518764", "0.40512636", "0.40507808", "0.40505034", "0.40481326", "0.40470156", "0.40466544", "0.40452692", "0.4045058", "0.4043395" ]
0.7127248
1
calcule de la moyenne des notes de l'eleve avec les coefficients
static moyenneNote(tableauNotes,idStagiaire = -1) { // sommes des notes*coef // sommes des coef let sommeNoteCoef = 0 let sommeCoef = 0 tableauNotes.forEach(function(element) { if (element.id === idStagiaire || idStagiaire === -1) { sommeNoteCoef += element.note * element.coef sommeCoef += element.coef } }); if (sommeCoef != 0 && tableauNotes.length !=0) { return sommeNoteCoef /sommeCoef } else { return -1 } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "pow22523(z) {\r\n const t0 = new FieldElement();\r\n const t1 = new FieldElement();\r\n const t2 = new FieldElement();\r\n let i;\r\n t0.square(z);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n t1.square(t0);\r\n for (i = 1; i < 2; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(z, t1);\r\n t0.mul(t0, t1);\r\n t0.square(t0);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 5; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 10; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(t1, t0);\r\n t2.square(t1);\r\n for (i = 1; i < 20; i++) {\r\n t2.square(t2);\r\n }\r\n t1.mul(t2, t1);\r\n t1.square(t1);\r\n for (i = 1; i < 10; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t1.square(t0);\r\n for (i = 1; i < 50; i++) {\r\n t1.square(t1);\r\n }\r\n t1.mul(t1, t0);\r\n t2.square(t1);\r\n for (i = 1; i < 100; i++) {\r\n t2.square(t2);\r\n }\r\n t1.mul(t2, t1);\r\n t1.square(t1);\r\n for (i = 1; i < 50; i++) {\r\n t1.square(t1);\r\n }\r\n t0.mul(t1, t0);\r\n t0.square(t0);\r\n for (i = 1; i < 2; i++) {\r\n t0.square(t0);\r\n }\r\n this.mul(t0, z);\r\n }", "function simplificationSysteme()\n\t{\n\t var i = null; //variables de boucles\n\t var j = null;\n\t var premiere_ligne_ok = false; //variable indiquant si la premiere ligne de la matrice est bien traité (premier coeff egal à 1)\n\t var colonne_full_zero = false; //variable indiquant si la colonne en cours est uniquement constitué de 0\n\t var sous_systeme = null;\n\t \n\t for(i = 0; i < this.matrice_systeme.length; i++) //on parcourt la matrice du systeme\n\t {\n\t if(this.matrice_systeme[i][0] == 1) //si le premier coefficient de la ligne i vaut 1\n\t {\n\t this.P(i, 0); //on place la ligne i en premiere position\n\t premiere_ligne_ok = true; //on indique que la premiere ligne est bien traité\n\t break; //on casse la boucle\n\t }\n\t }\n\t \n\t if(premiere_ligne_ok == false) //si la premiere ligne n'a pas été bien traité\n\t {\n\t for(i = 0; i < this.matrice_systeme.length; i++) //on parcourt la matrice du systeme\n\t {\n\t if(this.matrice_systeme[i][0] != 0) //des que le premier coefficient d'une est non nul\n\t {\n\t this.P(i, 0); //on place cette ligne en premiere position\n\t\t this.M(0, 1/this.matrice_systeme[0][0]); //on divise cette ligne par le premier coefficient pour reduire celui ci à 1\n\t\t premiere_ligne_ok = true; //on indique que la premiere ligne est bien traité\n\t\t break; //on casse la boucle\n\t }\n\t else //si apres avoir parcouru la matrice aucun premier coefficient non nul n'a été trouvé\n\t {\n\t if(i == this.matrice_systeme.length - 1)\n\t\t{\n\t\t colonne_full_zero = true; //on indique que la colonne est rempli de 0\n\t\t}\n\t }\n\t }\n\t }\n\t \n\t if(this.matrice_systeme.length != 1) //si la matrice du systeme n'est pas une matrice ligne\n\t {\n\t for(i = 1; i < this.matrice_systeme.length; i++) //on parcourt toutes les lignes en dessous de la premiere\n\t {\n\t if(this.matrice_systeme[i][0] != 0) //si le premier coeff est non nul\n\t {\n\t this.S(0, i, -this.matrice_systeme[i][0]); //on lui ajoute/retire une combinaison lineaire de la premiere ligne pr reduire son premier coeff à 0\n\t }\n\t }\n\t \n\t sous_systeme = new Array(); //on crée la matrice du sous systeme de notre systeme\n\t sous_systeme[0] = new Array();\n\t sous_systeme[1] = new Array();\n\t \n\t for(i = 0; i < this.matrice_systeme.length - 1; i++) //on remplit les lignes du sous systeme \n\t {\n\t sous_systeme[0][i] = new Array(); //on crée une matrice ligne pr chaque ligne\n\t sous_systeme[1][i] = this.second_membre[i+1]; //on remplit le second membre\n\t \n\t for(j = 0; j < this.matrice_systeme[i].length - 1; j++) //on remplit chaque case de la matrice du systeme du sous systeme\n\t {\n\t sous_systeme[0][i][j] = this.matrice_systeme[i+1][j+1];\n\t }\n\t }\n\t \n\t sous_systeme = new systeme(sous_systeme); //on instance le sous systeme comme une instance de la classe systeme\n\t sous_systeme.simplificationSysteme(); //on simplifie le sous systeme\n\t \n\t for(i = 0; i < this.matrice_systeme.length - 1; i++) //on recupere le sous systeme simplifié dans notre systeme actuel\n\t {\n\t this.second_membre[i+1] = sous_systeme.second_membre[i];\n\t \n\t for(j = 0; j < this.matrice_systeme[i].length - 1; j++)\n\t {\n\t this.matrice_systeme[i+1][j+1] = sous_systeme.matrice_systeme[i][j];\n\t }\n\t }\n\t }\n\t \n\t this.systeme_simplifie = true;\n\t}", "Cr(){\n return 0.721 + 0.00725*(this.Lj*12/this.Dj)\n }", "Fj(){\n return 0.18*Math.pow(386/this.Deff(),0.5)\n }", "calcularIMC() {\n const peso = this.peso;\n const altura = this.altura;\n return (peso / altura * altura)\n }", "function coefficient([n00, n01, n10, n11]) {\n return (n11 * n00 - n10 * n01) /\n Math.sqrt((n10 + n11) * (n00 + n01) * (n01 + n11) * (n00 + n10));\n}", "Deff(){\n return 5*(this.wt()*this.Sj/(12*12))*Math.pow(this.Lj,4)*Math.pow(12,4)/(384*29000000*this.Ieff())\n }", "function getPelnas(pajamos, mokesciai, mokesciai2){\nvar pelnas = (pajamos - (pajamos * mokesciai)) - (pajamos - (pajamos * mokesciai)) * mokesciai2;\n return pelnas;\n}", "function IMC(peso,altura) {\n\n indice = peso/(Math.pow(altura,2));\n imc = indice.toFixed(2);\n console.log(`El IMC es de: ${imc}.`);\n //return imc;\n}", "function m_ln(x){ // x>0\r\n var xx=x;\r\n var xxabs = Number(m_abs(xx)); //轉數字\r\n\r\n\r\n if ( xx == 0){ var ans_t = message_1(13); return ans_t; }\r\n if ( xx < 0) { var ans_t =message_1(5); return ans_t; }\r\n\r\n\r\n \r\n\r\n var ee = 2.718281828459045235360287471353; //常數\r\n var count_m = m_cut_nub_m(xxabs); // count 整數位數 >0 位數 , 含 -符號\r\n \r\n\r\n var count_p = m_cut_nub_p(xxabs); // count 小數位數 <0 位數 , 不含 -符號 不含 point\r\n \r\n\r\n var count_t = count_m+count_p+1;\r\n var ans_0 = 0;\r\n\r\n \r\n\r\n var ee_10 =m_pow_m(ee,10); //ee 10次方 = 22026.465794806707\r\n var ee_7 =m_pow_m(ee,7); // ee 7次方 = 1096.633158428458\r\n var ee_5 =m_pow_m(ee,5); // ee 5次方 = 148.4131591025766\r\n var ee_3 =m_pow_m(ee,3); //ee 3次方 = 20.08553692318766 //ee =2.718281828459045\r\n\r\n \r\n\r\n while(xxabs >= ee_10){\r\n //快數取出10 的指數部分 \r\n xxabs = xxabs/ee_10;\r\n ans_0=ans_0+10;\r\n \r\n }\r\n\r\n\r\n while(xxabs >= ee_7){\r\n //快數取出10 的指數部分 \r\n xxabs = xxabs/ee_7;\r\n ans_0=ans_0+7;\r\n \r\n \r\n }\r\n\r\n while(xxabs >= ee_5){\r\n //快數取出5 的指數部分 \r\n xxabs = xxabs/ee_5;\r\n ans_0=ans_0+5;\r\n \r\n }\r\n\r\n while(xxabs >= ee_3){\r\n //快數取出5 的指數部分 \r\n xxabs = xxabs/ee_3;\r\n ans_0=ans_0+3;\r\n \r\n }\r\n\r\n\r\n\r\n while(xxabs >= ee){ //ee=2.718281828459045\r\n //取出1 的指數部分 +5 增加回圈數\r\n xxabs = xxabs/ee;\r\n ans_0=ans_0+1;\r\n \r\n }\r\n\r\n\r\n while(xxabs > 1.5 && xxabs < ee){ \r\n \r\n //取出1 的指數部分\r\n xxabs = (xxabs)/(ee); \r\n ans_0=ans_0 + 1;\r\n \r\n }\r\n\r\n \r\n \r\n\r\n\r\n\r\n while(xxabs < 0.00005 ){ \r\n //取出1 的指數部分\r\n xxabs = (xxabs)*(ee_10); \r\n ans_0=ans_0 - 10;\r\n \r\n }\r\n\r\n\r\n\r\n\r\n\r\n while(xxabs < 0.5 ){ \r\n //取出1 的指數部分\r\n xxabs = (xxabs)*(ee); \r\n ans_0=ans_0 - 1;\r\n\r\n }\r\n\r\n\r\n\r\n\r\n var ans_1 = m_series_ln_a_z(xxabs) ; //由公式作法 0.5 < xxabs <1.5 \r\n \r\n \r\n var ans_t =ans_0 + ans_1;\r\n\r\n if(xx<0){ //負值\r\n ans_t=1.0/ans_t; \r\n }\r\n \r\n\r\n \r\n return ans_t;\r\n}", "function Metallic() {\n var a = [\n 0, -0.7, -0.4, -0.6,\n -0.45, -0.1, -0.3, -0.35,\n 0.4, 0.6, 0.7, 0.5,\n 0.3, 0.2, -0.13, -0.07,\n 0, -0.06, -0.12, -0.18\n\n -0.2, -0.18, -0.1, -0.03,\n 0.25, 1, 0, -0.05,\n -0.15, -0.2, -0.25, -0.3,\n -0.32, -0.33, -0.33, -0.32,\n -0.25, -0.2, -0.15, -0.1\n ];\n var b = [\n 0, -0.1, -0.2, -0.3,\n 0, 0.5, 1, 0.5,\n -0.4, -0.6, -0.7, -0.6,\n -0.4, -0.6, -0.7, -0.8,\n -0.9, -0.6, -0.2, -0.1,\n\n 0, 0.1, 0.2, 0.3,\n 0, -0.5, -1, -0.5,\n 0.4, 0.6, 0.7, 0.6,\n 0.4, 0.6, 0.7, 0.6,\n 0.25, 0.2, 0.15, 0.1\n ];\n var c = [\n 0, 0.1, -0.05, 0.08,\n -0.12, 0, -0.12, 0,\n -0.15, -0.4, -0.9, -0.95,\n -1, -1, -0.5, -0.4,\n -0.1, -0.3, -0.2, -0.3,\n -0.65, -0.6, -0.7, -0.3,\n -0.1, -0.2, 0, 0.2,\n 0.1, 0.2, 0.16, 0.7,\n 0.6, 0.3, 0.3, 0.05,\n 0.3, 0.6, 1, 0.95,\n 0.9, 0.7, 0.8, 0.1\n ];\n this.waveforms = [b, c];\n}", "function prix() {\n return 50 * (nbMultiplicateur * nbMultiplicateur * 0.2);\n}", "function kelimasKvadratu(skaicius) {\n // atsakymas = skaicius * skaicius;\n atsakymas = Math.pow(skaicius, 2);\n console.log(atsakymas);\n}", "Exp() {\n if (options.dual) {\n var f = Math.exp(this.s);\n return this.map((x, i) => i ? x * f : f);\n }\n if (r == 1 && tot <= 4 && Math.abs(this[0]) < 1E-9 && !options.over) {\n var u = Math.sqrt(Math.abs(this.Dot(this).s));\n if (Math.abs(u) < 1E-5) {\n return this.Add(Element.Scalar(1));\n }\n var v = this.Wedge(this).Scale(-1 / (2 * u));\n var res2 = Element.Add(\n Element.Sub(Math.cos(u), v.Scale(Math.sin(u))), Element.Div(Element.Mul((Element.Add(Math.sin(u), v.Scale(Math.cos(u)))), this),\n (Element.Add(u, v)))\n );\n return res2;\n }\n var res = Element.Scalar(1);\n var y = 1;\n var M = this.Scale(1);\n var N = this.Scale(1);\n for (var x = 1; x < 15; x++) {\n res = res.Add(M.Scale(1 / y));\n M = M.Mul(N);\n y = y * (x + 1);\n }\n return res;\n }", "function calculateM() {\n return d['T'] * (d['L'] / d['v'] + d['B']) / d['H']\n}", "Ec(){\n return 1.35*Math.pow(145,1.5)*Math.pow(this.Fc,0.5)\n }", "function e$j(){return [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}", "function eqsol(anno){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) ottobre 2010.\n // calcola la data degli equinozi e dei solstizi per l'anno indicato nel parametro.\n\n\nvar Y=anno;\nvar y1=Y/1000;\n\nvar jd1=1721139.2855+365.2421376*Y+0.0679190*y1*y1-0.0027879*y1*y1*y1; // EQUINOZIO DI MARZO\n\nvar jd2=1721233.2486+365.2417284*Y-0.0530180*y1*y1+0.0093320*y1*y1*y1; // SOLSTIZIO DI GIUGNO\n\nvar jd3=1721325.6978+365.2425055*Y-0.1266890*y1*y1+0.0019401*y1*y1*y1; // EQUINOZIO DI SETTEMBRE\n\nvar jd4=1721414.3920+365.2428898*Y-0.0109650*y1*y1-0.0084885*y1*y1*y1; // SOLSTIZIO DI DICEMBRE\n\nvar tempi= new Array(jd1,jd2,jd3,jd4);\n\nreturn tempi;\n\n\n}", "function moons_jup(jd){\n\n // funzione per il calcolo della posizione dei satelliti medicei di Giove\n // by Salvatore Ruiu -05-2012 Irgoli (Sardegna)\n // jd= numero del giorno giuliano per la data.\n\n var d=jd-2415020; // numero di giorni dal 31-12-1899 \n var V=134.63+0.00111587*d; // argomento del termine a lungo periodo.\n var M=358.476+0.9856003*d;\n var N=225.328+0.0830853*d+0.33*Math.sin(Rad(V));\n\n var J=221.647+0.9025179*d-0.33*Math.sin(Rad(V));\n\n var A=1.916*Math.sin(Rad(M))+0.020*Math.sin(Rad(2*M));\n var B=5.552*Math.sin(Rad(N))+0.167*Math.sin(Rad(2*N));\n\n var K=J+A-B;\n\n var R=1.00014-0.01672*Math.cos(Rad(M))-0.00014*Math.cos(Rad(2*M)); // raggio vettore della Terra.\n\n var RJ=5.20867-0.25192*Math.cos(Rad(N))-0.00610*Math.cos(Rad(2*N)); // raggio vettore di Giove.\n\n var dist=Math.sqrt(RJ*RJ+R*R-2*RJ*R*Math.cos(Rad(K))); // distanza Terra-Giove.\n\n // phi=angolo di fase in radianti.\n\n var phi=Math.asin(R*Math.sin(Rad(K))/dist); \n\n phi=Rda(phi); // angolo di fase in gradi.\n\n var LON_ELIOC=238.05+0.083091*d+0.33*Math.sin(Rad(V))+B;\n\n var Ds=3.07*Math.sin(Rad(LON_ELIOC+44.5));\n var De=Ds-2.15*Math.sin(Rad(phi))*Math.cos(Rad(LON_ELIOC+24))-1.31*((RJ-dist)/dist)*Math.sin(Rad(LON_ELIOC-99.4));\n\n // *** posizione dei satelliti di Giove - inizio.\n\n var u1= 84.5506+203.4058630*(d-dist/173)+phi-B; // Io.\n var u2= 41.5015+101.2916323*(d-dist/173)+phi-B; // Europa.\n var u3=109.9770+ 50.2345169*(d-dist/173)+phi-B; // Ganimede.\n var u4=176.3586+ 21.4879802*(d-dist/173)+phi-B; // Callisto.\n\n var G=187.3+50.310674*(d-dist/173);\n var H=311.1+21.569229*(d-dist/173);\n\n // correzioni\n\n var delta_u1=0.472*Math.sin(Rad(2*(u1-u2)));\n var delta_u2=1.073*Math.sin(Rad(2*(u2-u3)));\n var delta_u3=0.174*Math.sin(Rad(G));\n var delta_u4=0.845*Math.sin(Rad(H));\n\n // distanze dei satelliti dal centro di Giove, in unità del raggio equatoriale di Giove.\n\n var r1= 5.9061-0.0244*Math.cos(Rad(2*(u1-u2)));\n var r2= 9.3972-0.0889*Math.cos(Rad(2*(u2-u3)));\n var r3=14.9894-0.0227*Math.cos(Rad(G));\n var r4=26.3649-0.1944*Math.cos(Rad(H));\n\n // u1,u2,u3,u4 corretti\n\n u1=gradi_360(u1+delta_u1);\n u2=gradi_360(u2+delta_u2);\n u3=gradi_360(u3+delta_u3);\n u4=gradi_360(u4+delta_u4);\n\n // coordinate apparenti rettangolari dei satelliti di Giove\n\n X1=r1*Math.sin(Rad(u1)); Y1=-r1*Math.cos(Rad(u1))*Math.sin(Rad(De));\n X2=r2*Math.sin(Rad(u2)); Y2=-r2*Math.cos(Rad(u2))*Math.sin(Rad(De));\n X3=r3*Math.sin(Rad(u3)); Y3=-r3*Math.cos(Rad(u3))*Math.sin(Rad(De));\n X4=r4*Math.sin(Rad(u4)); Y4=-r4*Math.cos(Rad(u4))*Math.sin(Rad(De));\n \n// Meridiano centrale di Giove: sistema II\n\n var long_m2=290.28+870.1869088*(d-dist/173)+phi-B;\n\n long_m2=gradi_360(long_m2);\n\n // *** posizione dei satelliti di Giove - fine. \n // \n // u=0-360 corrisponde alla congiunzione inferiore del satellite (transita sul disco del pianeta se X,Y<1).\n // u= 90 corrisponde all'elongazione massima occidentale.\n // u= 180 corriponde alla congiunzione superiore.\n // u= 270 corriponde all'elongazione massima orintale.\n\nvar pos_sat= new Array(X1,Y1,u1,X2,Y2,u2,X3,Y3,u3,X4,Y4,u4,long_m2,De);\n\nreturn pos_sat;\n\n}", "function montaConjuntos(){\r\n\treturn quantidadeDeLinha() / valorDeN();\r\n}", "recalculate () {\n const n = this.knots.length\n\n this.curves = []\n if (n < 3) return\n\n let k = new Array(n)\n for (let i = 1; i < n - 1; ++i) {\n k[i] = Array.isArray(this.weights) ? this.weights[i] : this.weights(i, this.knots)\n }\n\n let a = new Array(n - 1)\n let b = new Array(n - 1)\n let c = new Array(n - 1)\n let d = new Array(n - 1)\n\n a[0] = 0\n b[0] = 2\n c[0] = k[1]\n d[0] = this.knots[0].plus(this.knots[1].times(1 + k[1]))\n for (let i = 1; i < n - 2; ++i) {\n a[i] = 1\n b[i] = 2 * (k[i] + (k[i] * k[i]))\n c[i] = k[i + 1] * k[i] * k[i]\n d[i] = this.knots[i].times(1 + (2 * k[i]) + (k[i] * k[i]))\n .plus(this.knots[i + 1].times(1 + k[i + 1]).times(k[i] * k[i]))\n }\n a[n - 2] = 1\n b[n - 2] = (2 * k[n - 2]) + (1.5 * k[n - 2] * k[n - 2])\n c[n - 2] = 0\n d[n - 2] = this.knots[n - 2].times(1 + (2 * k[n - 2]) + (k[n - 2] * k[n - 2]))\n .plus(this.knots[n - 1].times(0.5 * k[n - 2] * k[n - 2]))\n\n let p1s = thomas(a, b, c, d)\n let p2s = []\n for (let i = 0; i < n - 2; ++i) {\n p2s.push(this.knots[i + 1].minus(p1s[i + 1].minus(this.knots[i + 1]).times(k[i + 1])))\n }\n p2s.push(this.knots[n - 1].plus(p1s[n - 2]).times(0.5))\n\n for (let i = 0; i < n - 1; ++i) {\n this.curves.push(new BezierCurve([this.knots[i], p1s[i], p2s[i], this.knots[i + 1]]))\n }\n }", "function Co(t,e,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c=\"undefined\"!==typeof Float32Array;if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if(\"number\"!==typeof arguments[d]||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;t=Math.min(t,1),n=Math.min(n,1),t=Math.max(t,0),n=Math.max(n,0);var h=c?new Float32Array(l):new Array(l);function f(t,e){return 1-3*e+3*t}function p(t,e){return 3*e-6*t}function v(t){return 3*t}function g(t,e,n){return((f(e,n)*t+p(e,n))*t+v(e))*t}function m(t,e,n){return 3*f(e,n)*t*t+2*p(e,n)*t+v(e)}function y(e,r){for(var a=0;a<i;++a){var o=m(r,t,n);if(0===o)return r;var s=g(r,t,n)-e;r-=s/o}return r}function b(){for(var e=0;e<l;++e)h[e]=g(e*u,t,n)}function x(e,r,i){var a,l,u=0;do{l=r+(i-r)/2,a=g(l,t,n)-e,a>0?i=l:r=l}while(Math.abs(a)>o&&++u<s);return l}function _(e){for(var r=0,i=1,o=l-1;i!==o&&h[i]<=e;++i)r+=u;--i;var s=(e-h[i])/(h[i+1]-h[i]),c=r+s*u,d=m(c,t,n);return d>=a?y(e,c):0===d?c:x(e,r,r+u)}var w=!1;function M(){w=!0,t===e&&n===r||b()}var S=function(i){return w||M(),t===e&&n===r?i:0===i?0:1===i?1:g(_(i),e,r)};S.getControlPoints=function(){return[{x:t,y:e},{x:n,y:r}]};var O=\"generateBezier(\"+[t,e,n,r]+\")\";return S.toString=function(){return O},S}", "function eq_tempo(){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) ottobre 2011.\n // funzione per il calcolo del valore dell'equazione del tempo per la data odierna.\n // algoritmo di P.D. SMITH.\n \nvar njd=calcola_jd(); // giorno giuliano in questo istante a Greenwich.\n njd=jdHO(njd)+0.5; // g. g. a mezzogiorno di Greenwich.\n\nvar ar_sole=pos_sole(njd); // calcolo dell'ascensione retta del sole.\nvar anno=jd_data(njd); // anno di riferimento.\n\nvar Tempo_medio_Greenw=tsg_tmg_data(ar_sole[0],anno[2],njd); // tempo medio di Greenwich.\nvar valore_et=12-Tempo_medio_Greenw; // valore dell'equazione del tempo.\n\n valore_et=valore_et*60; // valore in minuti.\n\n valore_et=valore_et.toFixed(6);\n\n\n\nreturn valore_et\n\n}", "function obli_ecli(njd){\n\n // calcola l'obliquità dell'eclittica.\n // per l'equinozio della data.\n // T= numero di secoli giuliani dallo 0.5 gennaio 1900.\n\n var T=(njd-2415020.0)/36525;\n\n var obli_eclittica=23.452294-0.0130125*T-0.00000164*T*T+0.000000503*T*T*T;\n\nreturn obli_eclittica; //obliquità in gradi\n\n}", "determinant() {\n return (\n this.a00*this.adj(0, 0)\n +this.a01*this.adj(0, 1)\n +this.a02*this.adj(0, 2)\n +this.a03*this.adj(0, 3)\n );\n }", "function JJPower() {\n JJPower.easeArray = [0, 0.004, 0.008, 0.013, 0.019, 0.026, 0.033, 0.041, 0.05, 0.06, 0.071, 0.082, 0.095, 0.108, 0.122, 0.137, 0.152, 0.169, 0.185, 0.203, 0.221, 0.239, 0.257, 0.276, 0.295, 0.314, 0.333, 0.352, 0.371, 0.39, 0.409, 0.427, 0.445, 0.462, 0.48, 0.497, 0.513, 0.53, 0.545, 0.561, 0.576, 0.591, 0.605, 0.619, 0.632, 0.645, 0.658, 0.67, 0.683, 0.694, 0.706, 0.717, 0.727, 0.738, 0.748, 0.758, 0.767, 0.776, 0.785, 0.794, 0.802, 0.811, 0.818, 0.826, 0.834, 0.841, 0.848, 0.855, 0.861, 0.867, 0.874, 0.879, 0.885, 0.891, 0.896, 0.901, 0.906, 0.911, 0.916, 0.92, 0.925, 0.929, 0.933, 0.937, 0.941, 0.944, 0.948, 0.951, 0.954, 0.958, 0.96, 0.963, 0.966, 0.969, 0.971, 0.973, 0.976, 0.978, 0.98, 0.982, 0.983, 0.985, 0.987, 0.988, 0.99, 0.991, 0.992, 0.993, 0.994, 0.995, 0.996, 0.997, 0.998, 0.998, 0.999, 0.999, 0.999, 1, 1, 1, 1];\n JJPower.isMobile = false;\n\n /** Prep Static Functions **/\n JJPower.enhance = function (element) {\n if (element) {\n Object.assign(element, JJPower.prototype);\n }\n return element;\n };\n\n JJPower.query = function () {\n const queryText = getGeneratedQueryText(...arguments);\n\n const element = document.querySelector(queryText);\n\n JJPower.enhance(element);\n return element;\n };\n\n JJPower.jjCreateElement = function (tagName) {\n var element;\n if (tagName.toUpperCase() == 'SVG') {\n element = document.createElementNS('http://www.w3.org/2000/svg', tagName);\n } else {\n element = document.createElement(tagName);\n }\n return JJPower.enhance(element);\n };\n\n /** *Commonly used****/\n JJPower.prototype.jjWidth = function () {\n return this.getBoundingClientRect().width;\n };\n\n JJPower.prototype.jjAppend = function (tagName) {\n const me = this;\n let child;\n if (isSVGElement(tagName)) {\n child = document.createElementNS('http://www.w3.org/2000/svg', tagName);\n } else {\n child = document.createElement(tagName);\n }\n JJPower.enhance(child);\n\n this.appendChild(child);\n return child;\n\n\n // Inner functions\n // Either the tag itself is SVG, or it's parent (this) is an SVG element\n function isSVGElement(tagName) {\n const isIt = (tagName.toUpperCase() == 'SVG' || (me instanceof SVGElement));\n return isIt;\n }\n };\n\n JJPower.prototype.jjQuery = function () {\n const queryText = getGeneratedQueryText(...arguments);\n\n const element = this.querySelector(queryText);\n JJPower.enhance(element);\n return element;\n };\n\n JJPower.prototype.jjQueryAll = function () {\n const queryText = getGeneratedQueryText(...arguments);\n\n let elements = this.querySelectorAll(queryText);\n elements = Array.from(elements);\n elements.forEach(JJPower.enhance);\n return elements;\n };\n\n JJPower.prototype.jjGetChildren = function () {\n let elements = this.children || this.childNodes;\n elements = Array.from(elements);\n elements.forEach(JJPower.enhance);\n return elements;\n };\n\n JJPower.prototype.jjStyle = function (styleMap) {\n const keys = Object.keys(styleMap);\n for (const key of keys) {\n this.style[key] = styleMap[key];\n }\n return this;\n };\n\n JJPower.prototype.jjAttr = function (attrMap) {\n const keys = Object.keys(attrMap);\n let val;\n for (const key of keys) {\n val = attrMap[key];\n this.setAttribute(key, attrMap[key]);\n if (!val) {\n this.removeAttribute(key);\n }\n }\n return this;\n };\n\n JJPower.prototype.jjAddEventListener = function (eventName, callBack, useCapture) {\n let jjEventName = eventName;\n if (JJPower.isMobile) {\n jjEventName = getMobileEventName(eventName, this);\n }\n if (jjEventName) {\n this.addEventListener(jjEventName, callBack, useCapture);\n }\n\n return this;\n };\n\n JJPower.prototype.jjRemoveEventListener = function (eventName, callBack, useCapture) {\n let jjEventName = eventName;\n if (JJPower.isMobile) {\n jjEventName = getMobileEventName(eventName, this);\n }\n if (jjEventName) {\n this.removeEventListener(jjEventName, callBack, useCapture);\n }\n\n return this;\n };\n\n JJPower.prototype.jjAddClass = function () {\n try { // If the user gives bad dataList (eg. empty string) don't overreact, stay cool\n const styleModuleObject = arguments[0];\n if (typeof styleModuleObject === 'string') { // This means we're in sandbox\n this.classList.add(...arguments);\n } else { // this means we're using css modules\n let className;\n for (let i = 1; i < arguments.length; i++) {\n className = arguments[i];\n this.classList.add(styleModuleObject[className]);\n }\n }\n } catch (e) {\n }\n\n return this;\n };\n\n JJPower.prototype.jjRemoveClass = function () {\n const styleModuleObject = arguments[0];\n if (typeof styleModuleObject === 'string') { // This means we're in sandbox\n this.classList.remove(...arguments);\n } else { // this means we're using css modules\n let className;\n for (let i = 1; i < arguments.length; i++) {\n className = arguments[i];\n this.classList.remove(styleModuleObject[className]);\n }\n }\n\n return this;\n };\n\n JJPower.prototype.jjToggleClass = function () {\n const styleModuleObject = arguments[0];\n let hasStyleModuleObject = false;\n let startIndex = 0;\n let className;\n if (typeof styleModuleObject !== 'string') { // this means we're using css modules\n hasStyleModuleObject = true;\n startIndex = 1;\n }\n\n for (let i = startIndex; i < arguments.length; i++) {\n className = (hasStyleModuleObject ? styleModuleObject[arguments[i]] : arguments[i]);\n if (this.classList.contains(className)) {\n this.classList.remove(className);\n } else {\n this.classList.add(className);\n }\n }\n\n return this;\n };\n\n JJPower.prototype.jjContainsClass = function () {\n let className = getGeneratedClassName(...arguments);\n let classList = this.classList;\n return classList.contains(className);\n };\n\n\n JJPower.prototype.jjClear = function () {\n while (this.firstChild) { // If the user gives bad dataList (eg. empty string) don't overreact, stay cool\n this.removeChild(this.firstChild);\n }\n return this;\n };\n\n JJPower.prototype.jjRemoveMe = function () {\n let parentNode = this.parentNode;\n if (parentNode) {\n parentNode.removeChild(this);\n }\n };\n\n JJPower.prototype.jjText = function (textContent) {\n this.textContent = textContent;\n return this;\n };\n\n JJPower.prototype.jjAddText = function (textContent) {\n let textNode = document.createTextNode(textContent);\n this.appendChild(textNode);\n return this;\n };\n\n JJPower.prototype.jjAddBoldText = function (textContent) {\n this.jjAppend(\"b\")\n .jjText(textContent);\n return this;\n };\n\n JJPower.prototype.jjAddTextBreak = function () {\n this.jjAppend(\"br\");\n return this;\n };\n\n JJPower.prototype.jjClone = function (isDeep) {\n const element = this.cloneNode(isDeep);\n JJPower.enhance(element);\n return element;\n };\n\n JJPower.prototype.jjSetData = function (dataObject) {\n this.__data__ = dataObject;\n return this;\n };\n\n JJPower.prototype.jjGetData = function () {\n return this.__data__;\n };\n\n JJPower.prototype.jjSetIndex = function (index) {\n this.setAttribute('jjIndex', index);\n return this;\n };\n\n JJPower.prototype.jjGetIndex = function () {\n return +this.getAttribute('jjIndex');\n };\n\n //Returns null if no papa found\n JJPower.prototype.jjGetClosestPapaWithClass = function () {\n const className = getGeneratedClassName(...arguments);\n let bingoPapa = this.closest(\".\" + className);\n return JJPower.enhance(bingoPapa);\n };\n\n //Returns null if no papa found\n JJPower.prototype.jjClosest = function () {\n const selectorStr = getGeneratedQueryText(...arguments);\n let bingoPapa = this.closest(selectorStr);\n return JJPower.enhance(bingoPapa);\n };\n\n JJPower.prototype.jjIsAncestor = function (ancestor) {\n let papa = this;\n while (papa && (papa !== ancestor)) {\n papa = papa.parentNode;\n }\n return papa;\n };\n\n\n JJPower.prototype.jjGetStylePixelNumberValue = function (styleName) {\n let strOrig = this.style[styleName];\n let numStr = strOrig.replace(\"px\", \"\");\n return +numStr;\n };\n\n /** Measurements Calculations **/\n //This is expensive! Uses getBoundingClientRect\n JJPower.prototype.jjMouseCoordinatesRelativeToMe = function (event) {\n let clientRect = this.getBoundingClientRect();\n let x = event.clientX - clientRect.left;\n let y = event.clientY - clientRect.top;\n\n return {\n x: x,\n y: y,\n rect: clientRect\n }\n };\n\n /** Inline Style **/\n JJPower.prototype.jjApplyTransform = function (x, y, rotation, rotateFirst, translateUnit) {\n let hasTranslate = (x !== undefined || y !== undefined);\n\n if (!y) {\n y = 0;\n }\n if (!x) {\n x = 0;\n }\n if (!translateUnit) {\n translateUnit = \"px\";\n }\n\n let transformStr = \"\";\n let isSVG = this instanceof SVGElement;\n\n let translateStr = \"\";\n let rotateStr = \"\";\n\n if (hasTranslate) {\n translateStr = getTranslateStr();\n }\n if (rotation) {\n rotateStr = getRotateStr();\n }\n\n if (rotateFirst) {\n transformStr = rotateStr + \" \" + translateStr;\n } else {\n transformStr = translateStr + \" \" + rotateStr;\n }\n transformStr.trim();\n\n\n if (isSVG) {\n this.setAttribute(\"transform\", transformStr);\n } else {\n this.style.transform = transformStr;\n }\n\n this.jjTotallyUnreliableY = y; //Ugly workaround for specific issue\n this.jjTotallyUnreliableX = x; //Ugly workaround for specific issue\n\n return this;\n\n //Inner functions\n function getTranslateStr() {\n let translateStr;\n if (isSVG) {\n translateStr = `translate(${x}, ${y})`;\n } else {\n translateStr = `translate(${x}${translateUnit}, ${y}${translateUnit})`;\n }\n return translateStr;\n }\n\n function getRotateStr() {\n let rotateStr;\n if (isSVG) {\n rotateStr = `rotate(${rotation})`;\n } else {\n rotateStr = `rotate(${rotation}deg)`;\n }\n return rotateStr;\n }\n };\n\n /** Animation **/\n JJPower.prototype.jjAnimate = function (frameFunction, animationDuration, endFunction, isLinear, timingArr) { // Frame function runs each frame, and takes the current progress param!\n timingArr = timingArr || JJPower.easeArray;\n let timingLen = timingArr.length - 1;\n let me = this;\n let animationObj = {stopNow: false, t: 0};\n\n const startTime = new Date().getTime();\n isLinear = isLinear || animationDuration > 4000;\n\n\n if (!me.animationList) {\n me.animationList = [];\n }\n me.animationList.push(animationObj);\n\n requestAnimationFrame(repeatAnimation);\n\n return animationObj;\n\n /* Inner Functions */\n function repeatAnimation() {\n if (animationObj.stopNow) { //It hurts my soul to return in the middle of a function, but had to. God forgive me.\n return;\n }\n\n const nowTime = new Date().getTime();\n let progressTime = nowTime - startTime;\n progressTime = Math.min(animationDuration, progressTime);\n\n let t = progressTime / animationDuration;\n if (!isLinear) {\n t = JJPower.easeInTiming(t, timingArr, timingLen);\n }\n\n frameFunction(t);\n\n if (t < 1) {\n requestAnimationFrame(repeatAnimation);\n } else if (endFunction) {\n endFunction();\n }\n\n animationObj.t = t;\n }\n };\n\n JJPower.easeInTiming = function (t, timingArr, timingLen) {\n let real = t * timingLen;\n let base = Math.floor(real);\n let next = Math.ceil(real);\n let retT = getValueByProgress(timingArr[base], timingArr[next], real - base);\n return retT;\n\n /* Inner Function */\n function getValueByProgress(startValue, endValue, t){\n return startValue + (endValue - startValue) * t;\n }\n };\n\n JJPower.prototype.jjStopAnimation = function () {\n let me = this;\n if (me.animationList) {\n for (let animationObj of me.animationList) {\n animationObj.stopNow = true;\n }\n }\n return me;\n };\n\n /** *Awful but necessary *****/\n // Used to time css animations. We need to assign the animation start state, then reflow so it will be set, and then assign the end state\n JJPower.prototype.jjForceStyleRecalc = function () {\n let computedStyle = window.getComputedStyle(this);\n return computedStyle.transform;\n };\n\n /******* Private Functions ******/\n\n /** Mobile **/\n function getMobileEventName(origEventName, element) {\n if (element == document && origEventName == \"click\") {\n return \"touchstart\";\n }\n\n switch (origEventName) {\n case \"mousedown\":\n return \"touchstart\";\n case \"mousemove\":\n return \"touchmove\";\n case \"mouseup\":\n return \"touchend\";\n case \"mouseenter\":\n return \"\";\n case \"mouseleave\":\n return \"\";\n case \"mouseover\":\n return \"\";\n case \"mouseout\":\n return \"\";\n default:\n return origEventName\n }\n }\n\n /** CSS Modules **/\n function getGeneratedClassName() {\n let className;\n const param1 = arguments[0];\n const param2 = arguments[1];\n\n if (!param2) { // This means we received only a string representing the selector\n className = param1;\n } else { // this means we're using css modules, and also received the styles object\n className = param2;\n const stylesObject = param1;\n className = stylesObject[className] || param2;\n }\n\n return className;\n };\n\n function getGeneratedQueryText() {\n let queryText;\n const param1 = arguments[0];\n const param2 = arguments[1];\n const stylesObject = param1;\n\n if (!param2) { // This means we received only a string representing the selector\n queryText = param1;\n } else { // this means we're using css modules, and also received the styles object\n queryText = param2;\n queryText = queryText.replace(/(\\.[a-zA-Z0-9]+)/g, replaceFunction);\n }\n return queryText;\n\n\n /* Inner Function */\n function getStyleObjectClassSelector(origQueryText) {\n let classSelector = origQueryText.replace('.', '');\n classSelector = stylesObject[classSelector];\n if (!classSelector) {\n classSelector = origQueryText.replace('.', '');\n }\n classSelector = `.${classSelector}`;\n\n return classSelector;\n }\n\n function replaceFunction(match, p1) {\n let classSelector = getStyleObjectClassSelector(p1, stylesObject);\n return classSelector;\n }\n };\n\n /** Finally. Enhance the document (mainly for attaching mobile friendly event listeners) **/\n JJPower.enhance(document);\n}", "function telMutaties(){\n\t\t// - Tel de mutaties in tabel 'trLine' per grootboekrekening 'accID'. Update velden aantMut, debet en credit.\n\t\t// - Grootboekrekening is positie 9-1=8\n\t\t// - Bedrag is positie 13-1=12\n\t\t// - DC is positie 14-1=13\n\t\tvar bronTabel = document.getElementById('trLine');\n\t\tvar aantalRijen = bronTabel.rows.length;\n\t\tfor (var i = 1; i < aantalRijen; i++){\n\t\t\tvar rekening = bronTabel.rows.item(i).cells.item(8).innerHTML;\n\t\t\tvar bedrag = parseFloat(bronTabel.rows.item(i).cells.item(12).innerHTML);\n\t\t\tvar dc = bronTabel.rows.item(i).cells.item(13).innerHTML;\n\t\t\tvar debet = 0.0;\n\t\t\tvar credit = 0.0;\n\t\t\tif (dc===\"C\"){ credit+=bedrag; } else {debet+=bedrag;}\n\t\t\tvar positie=rekeningIndex.indexOf(rekening);\n\t\t\tif (positie<0){\n\t\t\t\t// Nog niet aanwezig, toevoegen\n\t\t\t\trekeningIndex.push(rekening);\n\t\t\t\tmatrix.push(new legeMatrix(rekening));\n\t\t\t\tpositie=rekeningIndex.indexOf(rekening);\n\t\t\t}\n\t\t\t// Optellen\n\t\t\tmatrix[positie].aantMut+=1;\n\t\t\tmatrix[positie].debet+=debet;\n\t\t\tmatrix[positie].credit+=credit;\n\t\t}\n\t}", "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}", "get imc() {\n const IMC = this.peso / (this.altura ** 2);\n return IMC.toFixed(2);\n }", "function MiePotential (r) {\n return 10*(4*epsilon)*(Math.pow((sigma/r), 12) - Math.pow((sigma/r), 6));\n}", "function calculateMoon() {\n\t// Mean longitude of the moon\n\tlet Lmm = Utils.norm360Deg(218.3164591 + 481267.88134236 * TE - 0.0013268 * TE2 + TE3 / 538841 - TE4 / 65194000);\n\n\t// Mean elongation of the moon\n\tlet D = Utils.norm360Deg(297.8502042 + 445267.1115168 * TE - 0.00163 * TE2 + TE3 / 545868 - TE4 / 113065000);\n\n\t// Mean anomaly of the sun\n\tlet Msm = Utils.norm360Deg(357.5291092 + 35999.0502909 * TE - 0.0001536 * TE2 + TE3 / 24490000);\n\n\t// Mean anomaly of the moon\n\tlet Mmm = Utils.norm360Deg(134.9634114 + 477198.8676313 * TE + 0.008997 * TE2 + TE3 / 69699 - TE4 / 14712000);\n\n\t// Mean distance of the moon from ascending node\n\tlet F = Utils.norm360Deg(93.2720993 + 483202.0175273 * TE - 0.0034029 * TE2 - TE3 / 3526000 + TE4 / 863310000);\n\n\t// Corrections\n\tlet A1 = Utils.norm360Deg(119.75 + 131.849 * TE);\n\tlet A2 = Utils.norm360Deg(53.09 + 479264.29 * TE);\n\tlet A3 = Utils.norm360Deg(313.45 + 481266.484 * TE);\n\tlet fE = 1 - 0.002516 * TE - 0.0000074 * TE2;\n\tlet fE2 = fE * fE;\n\n\t// Periodic terms for the moon:\n\n\t// Longitude and distance\n\tlet ld = [\n\t\t[ 0, 0, 1, 0, 6288774, -20905355 ],\n\t\t[ 2, 0, -1, 0, 1274027, -3699111 ],\n\t\t[ 2, 0, 0, 0, 658314, -2955968 ],\n\t\t[ 0, 0, 2, 0, 213618, -569925 ],\n\t\t[ 0, 1, 0, 0, -185116, 48888 ],\n\t\t[ 0, 0, 0, 2, -114332, -3149 ],\n\t\t[ 2, 0, -2, 0, 58793, 246158 ],\n\t\t[ 2, -1, -1, 0, 57066, -152138 ],\n\t\t[ 2, 0, 1, 0, 53322, -170733 ],\n\t\t[ 2, -1, 0, 0, 45758, -204586 ],\n\t\t[ 0, 1, -1, 0, -40923, -129620 ],\n\t\t[ 1, 0, 0, 0, -34720, 108743 ],\n\t\t[ 0, 1, 1, 0, -30383, 104755 ],\n\t\t[ 2, 0, 0, -2, 15327, 10321 ],\n\t\t[ 0, 0, 1, 2, -12528, 0 ],\n\t\t[ 0, 0, 1, -2, 10980, 79661 ],\n\t\t[ 4, 0, -1, 0, 10675, -34782 ],\n\t\t[ 0, 0, 3, 0, 10034, -23210 ],\n\t\t[ 4, 0, -2, 0, 8548, -21636 ],\n\t\t[ 2, 1, -1, 0, -7888, 24208 ],\n\t\t[ 2, 1, 0, 0, -6766, 30824 ],\n\t\t[ 1, 0, -1, 0, -5163, -8379 ],\n\t\t[ 1, 1, 0, 0, 4987, -16675 ],\n\t\t[ 2, -1, 1, 0, 4036, -12831 ],\n\t\t[ 2, 0, 2, 0, 3994, -10445 ],\n\t\t[ 4, 0, 0, 0, 3861, -11650 ],\n\t\t[ 2, 0, -3, 0, 3665, 14403 ],\n\t\t[ 0, 1, -2, 0, -2689, -7003 ],\n\t\t[ 2, 0, -1, 2, -2602, 0 ],\n\t\t[ 2, -1, -2, 0, 2390, 10056 ],\n\t\t[ 1, 0, 1, 0, -2348, 6322 ],\n\t\t[ 2, -2, 0, 0, 2236, -9884 ],\n\t\t[ 0, 1, 2, 0, -2120, 5751 ],\n\t\t[ 0, 2, 0, 0, -2069, 0 ],\n\t\t[ 2, -2, -1, 0, 2048, -4950 ],\n\t\t[ 2, 0, 1, -2, -1773, 4130 ],\n\t\t[ 2, 0, 0, 2, -1595, 0 ],\n\t\t[ 4, -1, -1, 0, 1215, -3958 ],\n\t\t[ 0, 0, 2, 2, -1110, 0 ],\n\t\t[ 3, 0, -1, 0, -892, 3258 ],\n\t\t[ 2, 1, 1, 0, -810, 2616 ],\n\t\t[ 4, -1, -2, 0, 759, -1897 ],\n\t\t[ 0, 2, -1, 0, -713, -2117 ],\n\t\t[ 2, 2, -1, 0, -700, 2354 ],\n\t\t[ 2, 1, -2, 0, 691, 0 ],\n\t\t[ 2, -1, 0, -2, 596, 0 ],\n\t\t[ 4, 0, 1, 0, 549, -1423 ],\n\t\t[ 0, 0, 4, 0, 537, -1117 ],\n\t\t[ 4, -1, 0, 0, 520, -1571 ],\n\t\t[ 1, 0, -2, 0, -487, -1739 ],\n\t\t[ 2, 1, 0, -2, -399, 0 ],\n\t\t[ 0, 0, 2, -2, -381, -4421 ],\n\t\t[ 1, 1, 1, 0, 351, 0 ],\n\t\t[ 3, 0, -2, 0, -340, 0 ],\n\t\t[ 4, 0, -3, 0, 330, 0 ],\n\t\t[ 2, -1, 2, 0, 327, 0 ],\n\t\t[ 0, 2, 1, 0, -323, 1165 ],\n\t\t[ 1, 1, -1, 0, 299, 0 ],\n\t\t[ 2, 0, 3, 0, 294, 0 ],\n\t\t[ 2, 0, -1, -2, 0, 8752 ]\n\t];\n\n\tlet lat = [\n\t\t[ 0, 0, 0, 1, 5128122 ],\n\t\t[ 0, 0, 1, 1, 280602 ],\n\t\t[ 0, 0, 1, -1, 277693 ],\n\t\t[ 2, 0, 0, -1, 173237 ],\n\t\t[ 2, 0, -1, 1, 55413 ],\n\t\t[ 2, 0, -1, -1, 46271 ],\n\t\t[ 2, 0, 0, 1, 32573 ],\n\t\t[ 0, 0, 2, 1, 17198 ],\n\t\t[ 2, 0, 1, -1, 9266 ],\n\t\t[ 0, 0, 2, -1, 8822 ],\n\t\t[ 2, -1, 0, -1, 8216 ],\n\t\t[ 2, 0, -2, -1, 4324 ],\n\t\t[ 2, 0, 1, 1, 4200 ],\n\t\t[ 2, 1, 0, -1, -3359 ],\n\t\t[ 2, -1, -1, 1, 2463 ],\n\t\t[ 2, -1, 0, 1, 2211 ],\n\t\t[ 2, -1, -1, -1, 2065 ],\n\t\t[ 0, 1, -1, -1, -1870 ],\n\t\t[ 4, 0, -1, -1, 1828 ],\n\t\t[ 0, 1, 0, 1, -1794 ],\n\t\t[ 0, 0, 0, 3, -1749 ],\n\t\t[ 0, 1, -1, 1, -1565 ],\n\t\t[ 1, 0, 0, 1, -1491 ],\n\t\t[ 0, 1, 1, 1, -1475 ],\n\t\t[ 0, 1, 1, -1, -1410 ],\n\t\t[ 0, 1, 0, -1, -1344 ],\n\t\t[ 1, 0, 0, -1, -1335 ],\n\t\t[ 0, 0, 3, 1, 1107 ],\n\t\t[ 4, 0, 0, -1, 1021 ],\n\t\t[ 4, 0, -1, 1, 833 ],\n\t\t[ 0, 0, 1, -3, 777 ],\n\t\t[ 4, 0, -2, 1, 671 ],\n\t\t[ 2, 0, 0, -3, 607 ],\n\t\t[ 2, 0, 2, -1, 596 ],\n\t\t[ 2, -1, 1, -1, 491 ],\n\t\t[ 2, 0, -2, 1, -451 ],\n\t\t[ 0, 0, 3, -1, 439 ],\n\t\t[ 2, 0, 2, 1, 422 ],\n\t\t[ 2, 0, -3, -1, 421 ],\n\t\t[ 2, 1, -1, 1, -366 ],\n\t\t[ 2, 1, 0, 1, -351 ],\n\t\t[ 4, 0, 0, 1, 331 ],\n\t\t[ 2, -1, 1, 1, 315 ],\n\t\t[ 2, -2, 0, -1, 302 ],\n\t\t[ 0, 0, 1, 3, -283 ],\n\t\t[ 2, 1, 1, -1, -229 ],\n\t\t[ 1, 1, 0, -1, 223 ],\n\t\t[ 1, 1, 0, 1, 223 ],\n\t\t[ 0, 1, -2, -1, -220 ],\n\t\t[ 2, 1, -1, -1, -220 ],\n\t\t[ 1, 0, 1, 1, -185 ],\n\t\t[ 2, -1, -2, -1, 181 ],\n\t\t[ 0, 1, 2, 1, -177 ],\n\t\t[ 4, 0, -2, -1, 176 ],\n\t\t[ 4, -1, -1, -1, 166 ],\n\t\t[ 1, 0, 1, -1, -164 ],\n\t\t[ 4, 0, 1, -1, 132 ],\n\t\t[ 1, 0, -1, -1, -119 ],\n\t\t[ 4, -1, 0, -1, 115 ],\n\t\t[ 2, -2, 0, 1, 107 ]\n\t];\n\n\t// Reading periodic terms\n\tlet fD, fD2, fM, fM2, fMm, fMm2, fF, fF2, coeffs, coeffs2, coeffc, f, f2, sumL = 0, sumR = 0, sumB = 0, x = 0;\n\n\twhile (x < lat.length) {\n\t\tfD = ld[x][0];\n\t\tfM = ld[x][1];\n\t\tfMm = ld[x][2];\n\t\tfF = ld[x][3];\n\t\tcoeffs = ld[x][4];\n\t\tcoeffc = ld[x][5];\n\t\tif (fM === 1 || fM === -1) {\n\t\t\tf = fE;\n\t\t} else if (fM === 2 || fM === -2) {\n\t\t\tf = fE2;\n\t\t} else {\n\t\t\tf = 1;\n\t\t}\n\t\tsumL += f * coeffs * Utils.sind(fD * D + fM * Msm + fMm * Mmm + fF * F);\n\t\tsumR += f * coeffc * Utils.cosd(fD * D + fM * Msm + fMm * Mmm + fF * F);\n\t\tfD2 = lat[x][0];\n\t\tfM2 = lat[x][1];\n\t\tfMm2 = lat[x][2];\n\t\tfF2 = lat[x][3];\n\t\tcoeffs2 = lat[x][4];\n\t\tif (fM2 === 1 || fM2 === -1) {\n\t\t\tf2 = fE;\n\t\t} else if (fM2 === 2 || fM2 === -2) {\n\t\t\tf2 = fE2;\n\t\t} else {\n\t\t\tf2 = 1;\n\t\t}\n\t\tsumB += f2 * coeffs2 * Utils.sind(fD2 * D + fM2 * Msm + fMm2 * Mmm + fF2 * F);\n\t\tx++;\n\t}\n\n\t// Corrections\n\tsumL = sumL + 3958 * Utils.sind(A1) + 1962 * Utils.sind(Lmm - F) + 318 * Utils.sind(A2);\n\tsumB = sumB - 2235 * Utils.sind(Lmm) + 382 * Utils.sind(A3) + 175 * Utils.sind(A1 - F) + 175 * Utils.sind(A1 + F) + 127 * Utils.sind(Lmm - Mmm) - 115 * Utils.sind(Lmm + Mmm);\n\n\t// Longitude of the moon\n\tlet lambdaMm = Utils.norm360Deg(Lmm + sumL / 1000000);\n\n\t// Latitude of the moon\n\tlet betaM = sumB / 1000000;\n\n\t// Distance earth-moon\n\tlet dEM = 385000.56 + sumR / 1000;\n\n\t// Apparent longitude of the moon\n\tlambdaMapp = lambdaMm + deltaPsi;\n\n\t// Right ascension of the moon, apparent\n\tRAMoon = Math.toDegrees(Utils.norm2PiRad(Math.atan2((Utils.sind(lambdaMapp) * Utils.cosd(eps) - Utils.tand(betaM) * Utils.sind(eps)), Utils.cosd(lambdaMapp))));\n\n\t// Declination of the moon\n\tDECMoon = Math.toDegrees(Math.asin(Utils.sind(betaM) * Utils.cosd(eps) + Utils.cosd(betaM) * Utils.sind(eps) * Utils.sind(lambdaMapp)));\n\n\t// GHA of the moon\n\tGHAMoon = Utils.norm360Deg(GHAAtrue - RAMoon);\n\n\t// Horizontal parallax of the moon\n\tHPMoon = Math.toDegrees(3600 * Math.asin(6378.14 / dEM));\n\n\t// Semi-diameter of the moon\n\tSDMoon = Math.toDegrees(3600 * Math.asin(1738 / dEM));\n\n\t// Geocentric angular distance between moon and sun\n\tLDist = Math.toDegrees(Math.acos(Utils.sind(DECMoon) * Utils.sind(DECSun) + Utils.cosd(DECMoon) * Utils.cosd(DECSun) * Utils.cosd(RAMoon - RASun)));\n\n\t//Phase angle\n\tlet i = Math.atan2(dES * Utils.sind(LDist), (dEM - dES * Utils.cosd(LDist)));\n\n\t//Illumination of the moon's disk\n\tlet k = 100 * (1 + Math.cos(i)) / 2;\n\tillumMoon = k; // Math.round(10 * k) / 10;\n}", "function CO(x) {\n return (brick + joint) * x\n }", "function eq_tempo_data2(anno,njd){\n\n // funzione per il calcolo dell'equazione del tempo.\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) gennaio 2012.\n // algoritmo di MEEUS.\n \n njd=jdHO(njd); // riporta il g.g. all'ora H0(zero) del giorno. \n \nvar ar_sole=pos_sole(njd); // calcolo dell'ascensione retta del sole.\nvar ar_sole_app=pos_app(njd,ar_sole[0],ar_sole[1]);\nvar TSG=temposid_app(njd);\nvar valore_et=0;\nvar h=TSG-ar_sole_app[0];\n \nif(h<0 ) {valore_et=12+h;}\nif(h>0 ) {valore_et=h-12;}\n \n valore_et=valore_et*60; // valore in minuti.\n\n valore_et=valore_et.toFixed(6);\n\nreturn valore_et\n\n}", "function compute () {\n var ts = 24*3600;\n var n = m.length;\n var all_forces = [];\n for(var ii = 0; ii < n; ii++) {\n\tvar tot_fx = 0;\n\tvar tot_fy = 0;\n\tfor(var jj = 0; jj < n; jj++) {\n\t if(ii == jj) {\n\t\tcontinue;\n\t }\n\t var my_forces = forces(ii,jj);\n\t tot_fx += my_forces[0];\n\t tot_fy += my_forces[1];\n\t all_forces.push([tot_fx,tot_fy]);\n\t}\n }\n\n for(var ii = 0; ii < n; ii++) {\n\tvx[ii] += (all_forces[ii][0]/m[ii])*ts;\n\tvy[ii] += (all_forces[ii][1]/m[ii])*ts;\n\tx[ii] += vx[ii]*ts;\n\ty[ii] += vy[ii]*ts;\n }\n\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 hitungLuasLingkaran(jariJari){\n return 3.14 * jariJari ^ 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 couleur()\n {\n\treturn 25000 * (0|pos_actuelle()/5 + 1);\n }", "gainMult() { // Calculate the multiplier for main currency from bonuses\r\n mult = new ExpantaNum(1)\r\n return mult\r\n }", "function simplesMontante(capital, taxa, tempo){\n let juros = capital * taxa * tempo\n let montanteSimples = capital + juros\n console.log(`O montante é: ${montanteSimples.toFixed(2)}`)\n}", "calcularMCC() {\n var TP = this.darTP;\n var TN = this.darTN;\n var FP = this.darFP;\n var FN = this.darFN;\n return (((TP * TN) - (FP * FN)) / (Math.sqrt((TP + FP) * (TP + FN) * (TN + FP) * (TN + FN))))\n }", "multiply(mat) {\n const m00 = this.v[0] * mat.v[0] + this.v[4] * mat.v[1] + this.v[8] * mat.v[2] + this.v[12] * mat.v[3];\n const m01 = this.v[0] * mat.v[4] + this.v[4] * mat.v[5] + this.v[8] * mat.v[6] + this.v[12] * mat.v[7];\n const m02 = this.v[0] * mat.v[8] + this.v[4] * mat.v[9] + this.v[8] * mat.v[10] + this.v[12] * mat.v[11];\n const m03 = this.v[0] * mat.v[12] + this.v[4] * mat.v[13] + this.v[8] * mat.v[14] + this.v[12] * mat.v[15];\n const m10 = this.v[1] * mat.v[0] + this.v[5] * mat.v[1] + this.v[9] * mat.v[2] + this.v[13] * mat.v[3];\n const m11 = this.v[1] * mat.v[4] + this.v[5] * mat.v[5] + this.v[9] * mat.v[6] + this.v[13] * mat.v[7];\n const m12 = this.v[1] * mat.v[8] + this.v[5] * mat.v[9] + this.v[9] * mat.v[10] + this.v[13] * mat.v[11];\n const m13 = this.v[1] * mat.v[12] + this.v[5] * mat.v[13] + this.v[9] * mat.v[14] + this.v[13] * mat.v[15];\n const m20 = this.v[2] * mat.v[0] + this.v[6] * mat.v[1] + this.v[10] * mat.v[2] + this.v[14] * mat.v[3];\n const m21 = this.v[2] * mat.v[4] + this.v[6] * mat.v[5] + this.v[10] * mat.v[6] + this.v[14] * mat.v[7];\n const m22 = this.v[2] * mat.v[8] + this.v[6] * mat.v[9] + this.v[10] * mat.v[10] + this.v[14] * mat.v[11];\n const m23 = this.v[2] * mat.v[12] + this.v[6] * mat.v[13] + this.v[10] * mat.v[14] + this.v[14] * mat.v[15];\n const m30 = this.v[3] * mat.v[0] + this.v[7] * mat.v[1] + this.v[11] * mat.v[2] + this.v[15] * mat.v[3];\n const m31 = this.v[3] * mat.v[4] + this.v[7] * mat.v[5] + this.v[11] * mat.v[6] + this.v[15] * mat.v[7];\n const m32 = this.v[3] * mat.v[8] + this.v[7] * mat.v[9] + this.v[11] * mat.v[10] + this.v[15] * mat.v[11];\n const m33 = this.v[3] * mat.v[12] + this.v[7] * mat.v[13] + this.v[11] * mat.v[14] + this.v[15] * mat.v[15];\n return this.setComponents(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33);\n }", "get m(){ return this.density * this.volume;}", "function multKey(id, isMaj){\n var notes;\n switch(id){\n case \"1\":\n notes = multByVal(1, isMaj);\n break;\n case \"2\":\n notes = multByVal(halfStep, isMaj);\n break;\n case \"3\":\n notes = multByVal(Math.pow(halfStep, 2), isMaj);\n break;\n case \"4\":\n notes = multByVal(Math.pow(halfStep, 3), isMaj);\n break;\n case \"5\":\n notes = multByVal(Math.pow(halfStep, 4), isMaj);\n break;\n case \"6\":\n notes = multByVal(Math.pow(halfStep, 5), isMaj);\n break;\n case \"7\":\n notes = multByVal(Math.pow(halfStep, 6), isMaj);\n break;\n case \"8\":\n notes = multByVal(Math.pow(halfStep, 7), isMaj);\n break;\n case \"9\":\n notes = multByVal(Math.pow(halfStep, 8), isMaj);\n break;\n case \"10\":\n notes = multByVal(Math.pow(halfStep, 9), isMaj);\n break;\n case \"11\":\n notes = multByVal(Math.pow(halfStep, 10), isMaj);\n break;\n case \"12\":\n notes = multByVal(Math.pow(halfStep, 11), isMaj);\n break;\n default:\n notes = multByVal(1, isMaj);\n break;\n }\n return notes;\n}", "function potencia(b,e) {//b = base, e = expoente\n return b ** e\n}", "exponent() { return new Decimal(((Array.isArray(tmp.ma.mastered))?tmp.ma.mastered.includes(this.layer):false)?.025:.02) }", "exponent() { return new Decimal(((Array.isArray(tmp.ma.mastered))?tmp.ma.mastered.includes(this.layer):false)?1.07:1.1) }", "function calculate() {\r\n\r\n //Old Formula Below\r\n //const interest = (amount * (interestrate * 0.01)) / months;\r\n //let payment = ((amount / months) + interest).toFixed(0);\r\n\r\n\r\n let amount=document.querySelector('#amount').value;\r\n let interestrate=document.querySelector('#interestrate').value;\r\n let months=document.querySelector('#months').value;\r\n\r\n if (amount=='' || interestrate==''|| months=='') {\r\n document.querySelector('#final').innerHTML=`<h4 style='color:#ef5350'>Enter Values</h4>`;\r\n }\r\n\r\n else {\r\n const interest = interestrate/1200;\r\n \r\n let top = Math.pow((1+interest),months);\r\n let bottom = top - 1;\r\n let ratio = top/bottom;\r\n let emi = (amount * interest * ratio).toFixed(0);\r\n\r\n document.querySelector('#final').innerHTML=`Your EMI is ${emi}`; \r\n \r\n console.log(amount, interestrate, months);\r\n }\r\n\r\n \r\n}", "function coefficientToExpression(coeffs, operators){\r\n\ttoReturn = operators[0];\r\n\tfor(i=0; i<operators.length-1; i++){\r\n\t\ttoReturn += coeffs[i] + operators[i+1];\r\n\t}\r\n\ttoReturn = toReturn.replace(\" 0x +\",\"\");\r\n\tfor(i=0; i<4; i++){\r\n\t\ttoReturn = toReturn.replace(\" 1x\",\" x\");\r\n\t\ttoReturn = toReturn.replace(\"(1x\",\"(x\");\r\n\t\ttoReturn = toReturn.replace(\"-1x\",\"-x\");\r\n\t}\r\n\treturn toReturn;\r\n}", "exponent() { return new Decimal(((Array.isArray(tmp.ma.mastered))?tmp.ma.mastered.includes(this.layer):false)?1.4:1.85) }", "function NeurolaxTerm(){}", "_calculateExponentAndMantissa(float){\n let integral2 = toBinaryX(parseInt(float, 10), EXP, '0');//on prends uniquement le chiffre avant la virgule en base 2\n let fractional10 = this._getDecimal(float);//on prends uniquement les chiffres après la virgule en base 10\n let fractional2 = ''; //contient les chiffres apres la virgule en base 2\n\n //la fraction est multiplié par 2 tant qu'elle n'est pas egal à 0 et que 23 itération ne se sont pas écoulé\n // si la fraction est plus grande que 1 on enleve le chiffre avant la virgule\n let i = 0;\n //127 + 23 permet de ne perdre aucune précision, en effet si on prends le cas extreme qui serait un nombre entre -1 et 1 tres tres petit, le nombre de décalage maximum\n //serait de 127 etant donné que l'exposant = 127 + décalge, apres 127 décalge il faut encore récupérer la valeur de mantisse donc 23 bit.\n //(cette exemple est pour la version 32 bit mais marche avec les autres version)\n while(fractional10 != 0 && i < D_ + MAN)\n {\n fractional10 = fractional10 * 2;\n if(fractional10 >= 1)\n {\n fractional2 += '1';\n }\n else\n {\n fractional2 += '0';\n }\n fractional10 = this._getDecimal(fractional10);\n i++;\n }\n\n let number2 = (integral2 + '.' + fractional2).split('');//nombre en binaire avec la notation scientifique mais non somplifié (2^0)\n\n let pointIndex = integral2.length;//index du point dans le chiffre\n\n //on itere dans le nombre jusqu'a trouver un 1, on effectue encore une fois j++ pour se placer juste apres le 1, car c'est ici que l'on veut placer la virgule\n let j = 0;\n while(number2[j] != 1)\n {\n j++;\n }\n j++;\n\n let power = 0;\n this.mantissa = (integral2 + fractional2).split('');\n //si le nombre n'est pas compris entre -1 et 1, on regarde de combien on a décalé la virgule,\n //pour la mantisse on enleve les 0 inutile et le 1er 1\n if(float <= -1 || float >= 1)\n {\n power = pointIndex - j;\n this.mantissa.splice(0,j);\n }\n //si le nombre est compris entre -1 et 1, on regarde de combien on a decalé la virgule\n //(+1 car si le nombre est comrpis entre - 1 et 1 on a compté la virgule dans le calcul et il faut enlever)\n //pour la mantisse on enleve les 0 inutile et le 1er 1\n else\n {\n power = pointIndex - j + 1;\n this.mantissa.splice(0, j - 1);\n }\n this.exponent = toBinaryX(D_ + power, EXP, '0');//on calcule l'exposant qu'on converti en binaire\n this.mantissa = fillWithX(this.mantissa.splice(0, MAN).join(\"\"), '0');//on prends les 23 premier bit de la mantisse[splice()], on converti le tableau en string[join()], on remplie la droite de la mantisse avec des 0[fillWith0()]\n }", "calculeazaMediaMiu(m, s) {\n\t\t\treturn ( Math.log(m) - (1/2) * Math.log((s / Math.pow(m, 2)) + 1) );\n\t\t}", "function calculate(){\n var potential_energy= Math.round((1/2)*tracker*k.textContent*k.textContent);\n potential.textContent = potential_energy;\n\n}", "function eq_tempo_data(anno,njd){\n\n // funzione per il calcolo dell'equazione del tempo.\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) dicembre 2009\n // algoritmo di P.D. SMITH.\n\n njd=jdHO(njd)+0.5; // riporta il g.g. della data al mezzogiorno. \n \nvar ar_sole=pos_sole(njd); // calcolo dell'ascensione retta del sole.\nvar Tempo_medio_Greenw=tsg_tmg_data(ar_sole[0],anno,njd); // tempo medio di Greenwich.\nvar valore_et=12-Tempo_medio_Greenw; // valore dell'equazione del tempo.\n\n valore_et=valore_et*60; // valore in minuti.\n\n valore_et=valore_et.toFixed(6);\n\nreturn valore_et\n\n}", "function M(t,n,r){return c$7(O,n,t),c$7(V,r,t),s$5(_$1(O,O,V))/2}", "function SE0001() {\n calculatefor(new Array(\n// 1 6 10\n1721583.780743, 7.0, -4.0, 4.0, 10519.6, 10519.6,\n 0.1477500, 0.5736369, 5.800e-06, -9.270e-06,\n 0.3635400, 0.0040918, -1.800e-04, 3.000e-08,\n 22.9475498, 0.0041820, -5.000e-06,\n 286.5210266, 14.9997044, 0.000e-00,\n 0.5344440, -0.0000878, -1.230e-05,\n -0.0116350, -0.0000873, -1.230e-05,\n 0.0045954, 0.0045725,\n// 1 12 3\n1721760.337249, 20.0, -4.0, 4.0, 10514.8, 10514.8,\n -0.0513860, 0.5271225, -7.800e-06, -6.710e-06,\n -0.0373330, -0.0245871, 1.576e-04, 2.200e-07,\n -22.2319603, -0.0061610, 6.000e-06,\n 121.6283569, 14.9970083, 0.000e-00,\n 0.5635840, 0.0001153, -1.080e-05,\n 0.0173600, 0.0001147, -1.080e-05,\n 0.0047596, 0.0047358,\n// 2 5 30\n1721938.323419, 20.0, -4.0, 4.0, 10509.9, 10509.9,\n 0.1617630, 0.5407725, 2.140e-05, -7.420e-06,\n -0.4052900, 0.0430046, -1.180e-04, -5.000e-07,\n 21.5032101, 0.0069200, -5.000e-06,\n 121.8688202, 15.0004883, 0.000e-00,\n 0.5479280, -0.0001248, -1.110e-05,\n 0.0017810, -0.0001241, -1.100e-05,\n 0.0045954, 0.0045725,\n// 2 11 23\n1722114.712677, 5.0, -4.0, 4.0, 10505.0, 10505.0,\n 0.0206060, 0.5574679, 3.000e-07, -8.510e-06,\n 0.6499520, -0.0682870, 1.132e-04, 9.600e-07,\n -20.1964607, -0.0091500, 5.000e-06,\n 257.6219177, 14.9983244, 0.000e-00,\n 0.5477450, 0.0001099, -1.220e-05,\n 0.0015990, 0.0001094, -1.220e-05,\n 0.0047579, 0.0047342,\n// 3 5 20\n1722292.570492, 2.0, -4.0, 4.0, 10500.1, 10500.1,\n 0.3375130, 0.5075921, 1.450e-05, -5.940e-06,\n -1.1953150, 0.0753864, -6.420e-05, -8.000e-07,\n 19.3034306, 0.0094340, -4.000e-06,\n 211.9496613, 15.0015306, 0.000e-00,\n 0.5616390, -0.0000788, -9.900e-06,\n 0.0154240, -0.0000784, -9.900e-06,\n 0.0045980, 0.0045752,\n// 3 10 14\n1722439.890267, 9.0, -4.0, 4.0, 10496.0, 10496.0,\n -0.6101660, 0.5560249, 5.240e-05, -9.400e-06,\n -1.2564350, -0.1713964, 1.178e-04, 2.830e-06,\n -7.3252702, -0.0157210, 1.000e-06,\n 318.0282593, 15.0033312, 0.000e-00,\n 0.5376170, -0.0000203, -1.300e-05,\n -0.0084780, -0.0000202, -1.300e-05,\n 0.0047289, 0.0047054,\n// 3 11 12\n1722469.317008, 20.0, -4.0, 4.0, 10495.2, 10495.2,\n 0.4633450, 0.5717677, -5.300e-06, -9.690e-06,\n 1.2171381, -0.1085856, 5.400e-05, 1.760e-06,\n -17.4847507, -0.0116100, 4.000e-06,\n 123.2411880, 14.9998140, 0.000e-00,\n 0.5386090, 0.0000132, -1.310e-05,\n -0.0074920, 0.0000132, -1.310e-05,\n 0.0047535, 0.0047298,\n// 4 4 8\n1722616.985578, 12.0, -4.0, 4.0, 10491.1, 10491.1,\n -0.0858200, 0.4906042, 5.700e-06, -5.750e-06,\n 0.8786310, 0.1517656, -7.430e-05, -1.700e-06,\n 6.4469299, 0.0152520, -1.000e-06,\n 359.7265930, 15.0049486, 0.000e-00,\n 0.5633320, 0.0000640, -1.000e-05,\n 0.0171090, 0.0000636, -1.000e-05,\n 0.0046280, 0.0046049,\n// 4 10 2\n1722794.494728, 0.0, -4.0, 4.0, 10486.2, 10486.2,\n -0.1582700, 0.5325559, 2.950e-05, -8.010e-06,\n -0.7231220, -0.1713059, 4.950e-05, 2.510e-06,\n -3.1366899, -0.0162420, 0.000e-00,\n 182.4269867, 15.0039873, 0.000e-00,\n 0.5467070, -0.0001107, -1.200e-05,\n 0.0005660, -0.0001101, -1.200e-05,\n 0.0047167, 0.0046932,\n// 5 3 28\n1722971.224694, 17.0, -4.0, 4.0, 10481.4, 10481.4,\n -0.2271410, 0.5166893, -2.100e-06, -7.120e-06,\n 0.0095610, 0.1669294, -2.050e-05, -2.220e-06,\n 2.2266500, 0.0157860, -1.000e-06,\n 73.6928177, 15.0052166, 0.000e-00,\n 0.5501050, 0.0001256, -1.120e-05,\n 0.0039480, 0.0001250, -1.110e-05,\n 0.0046403, 0.0046172,\n// 5 9 22\n1723148.862771, 9.0, -4.0, 4.0, 10476.5, 10476.5,\n 0.1378580, 0.5002483, 7.000e-06, -6.290e-06,\n -0.0751820, -0.1618195, -1.030e-05, 1.960e-06,\n 1.2201200, -0.0162770, 0.000e-00,\n 316.6747131, 15.0042295, 0.000e-00,\n 0.5614690, -0.0001112, -1.060e-05,\n 0.0152550, -0.0001106, -1.060e-05,\n 0.0047031, 0.0046797,\n// 6 3 18\n1723325.753583, 6.0, -4.0, 4.0, 10471.6, 10471.6,\n 0.1556960, 0.5457429, -2.310e-05, -8.830e-06,\n -0.6397400, 0.1770635, 4.220e-05, -2.790e-06,\n -1.9548900, 0.0158740, 0.000e-00,\n 267.6932983, 15.0050783, 0.000e-00,\n 0.5373150, 0.0000789, -1.250e-05,\n -0.0087790, 0.0000785, -1.240e-05,\n 0.0046539, 0.0046307,\n// 6 9 11\n1723502.941905, 11.0, -4.0, 4.0, 10466.7, 10466.7,\n 0.4000290, 0.4822544, -2.110e-05, -5.400e-06,\n 0.6135880, -0.1504661, -5.660e-05, 1.620e-06,\n 5.6251898, -0.0157920, -1.000e-06,\n 345.8679810, 15.0040894, 0.000e-00,\n 0.5707200, -0.0000313, -9.800e-06,\n 0.0244600, -0.0000312, -9.800e-06,\n 0.0046880, 0.0046647,\n// 7 2 6\n1723651.058330, 13.0, -4.0, 4.0, 10462.7, 10462.7,\n -0.4871880, 0.5636266, 1.270e-05, -9.250e-06,\n 1.1944730, 0.1187640, 4.650e-05, -1.880e-06,\n -16.3175106, 0.0121820, 4.000e-06,\n 10.6870604, 15.0010834, 0.000e-00,\n 0.5389800, -0.0000606, -1.270e-05,\n -0.0071220, -0.0000603, -1.270e-05,\n 0.0047090, 0.0046855,\n// 7 3 7\n1723680.436740, 22.0, -4.0, 4.0, 10461.9, 10461.9,\n 0.1352560, 0.5564197, -1.870e-05, -9.480e-06,\n -1.3630260, 0.1754102, 1.166e-04, -2.900e-06,\n -6.0585299, 0.0155390, 1.000e-06,\n 146.8084869, 15.0045033, 0.000e-00,\n 0.5339450, -0.0000087, -1.290e-05,\n -0.0121320, -0.0000086, -1.290e-05,\n 0.0046682, 0.0046450,\n// 7 8 1\n1723827.335369, 20.0, -4.0, 4.0, 10457.8, 10457.8,\n -0.2508930, 0.5192351, -2.330e-05, -6.510e-06,\n -1.4247210, -0.0819566, -5.180e-05, 9.400e-07,\n 19.0020905, -0.0098450, -5.000e-06,\n 119.2963104, 15.0010958, 0.000e-00,\n 0.5575310, 0.0001106, -1.050e-05,\n 0.0113370, 0.0001101, -1.040e-05,\n 0.0046329, 0.0046098,\n// 7 8 31\n1723856.941619, 11.0, -4.0, 4.0, 10457.0, 10457.0,\n 0.5851760, 0.4922707, -4.940e-05, -5.730e-06,\n 1.2912199, -0.1416734, -1.039e-04, 1.600e-06,\n 9.8561201, -0.0147800, -2.000e-06,\n 345.1435852, 15.0036097, 0.000e-00,\n 0.5663670, 0.0000691, -1.000e-05,\n 0.0201290, 0.0000687, -1.000e-05,\n 0.0046720, 0.0046487,\n// 8 1 27\n1724005.595400, 2.0, -4.0, 4.0, 10452.9, 10452.9,\n -0.2460020, 0.5405931, 9.900e-06, -7.590e-06,\n 0.5817410, 0.0798825, 1.056e-04, -1.050e-06,\n -19.2383003, 0.0100110, 5.000e-06,\n 205.9786835, 14.9994297, 0.000e-00,\n 0.5528290, -0.0001172, -1.150e-05,\n 0.0066580, -0.0001166, -1.140e-05,\n 0.0047230, 0.0046994,\n// 8 7 21\n1724181.727862, 5.0, -4.0, 4.0, 10448.1, 10448.1,\n -0.3171140, 0.5571292, -1.440e-05, -8.370e-06,\n -0.6082380, -0.0493122, -1.097e-04, 6.400e-07,\n 21.2855797, -0.0073000, -5.000e-06,\n 254.4908600, 15.0001974, 0.000e-00,\n 0.5417140, 0.0001242, -1.180e-05,\n -0.0044010, 0.0001236, -1.170e-05,\n 0.0046205, 0.0045975,\n// 9 1 15\n1724359.839530, 8.0, -4.0, 4.0, 10443.2, 10443.2,\n -0.0692250, 0.5132652, 4.900e-06, -6.080e-06,\n -0.1003230, 0.0385289, 1.488e-04, -3.700e-07,\n -21.5647602, 0.0072590, 5.000e-06,\n 296.7083740, 14.9978333, 0.000e-00,\n 0.5686410, -0.0000860, -1.030e-05,\n 0.0223910, -0.0000855, -1.020e-05,\n 0.0047358, 0.0047122,\n// 9 7 10\n1724536.370239, 21.0, -4.0, 4.0, 10438.4, 10438.4,\n 0.0685720, 0.5823288, -1.160e-05, -9.850e-06,\n 0.1250290, -0.0094509, -1.702e-04, 5.000e-08,\n 22.8116608, -0.0045540, -5.000e-06,\n 134.9048767, 14.9995270, 0.000e-00,\n 0.5315620, 0.0000348, -1.280e-05,\n -0.0145030, 0.0000347, -1.270e-05,\n 0.0046107, 0.0045877,\n// 10 1 4\n1724713.829523, 8.0, -4.0, 4.0, 10433.5, 10433.5,\n 0.0413750, 0.5034579, -2.000e-06, -5.600e-06,\n -0.7916870, -0.0029327, 1.842e-04, 1.200e-07,\n -23.1018295, 0.0039900, 6.000e-06,\n 297.8305359, 14.9966326, 0.000e-00,\n 0.5749010, 0.0000080, -9.900e-06,\n 0.0286200, 0.0000079, -9.800e-06,\n 0.0047463, 0.0047227,\n// 10 6 30\n1724891.084146, 14.0, -4.0, 4.0, 10428.6, 10428.6,\n -0.0607460, 0.5774612, 2.210e-05, -9.550e-06,\n 0.8624740, 0.0331130, -2.177e-04, -6.800e-07,\n 23.5901794, -0.0016480, -6.000e-06,\n 30.4601097, 14.9991560, 0.000e-00,\n 0.5329070, -0.0000624, -1.260e-05,\n -0.0131640, -0.0000621, -1.250e-05,\n 0.0046033, 0.0045803,\n// 10 11 24\n1725038.188019, 17.0, -4.0, 4.0, 10424.6, 10424.6,\n 0.6969420, 0.5122303, -6.200e-06, -6.790e-06,\n 1.3378479, -0.1616266, 7.620e-05, 2.320e-06,\n -20.5376205, -0.0085060, 5.000e-06,\n 77.5096436, 14.9980116, 0.000e-00,\n 0.5588340, 0.0001106, -1.120e-05,\n 0.0126330, 0.0001101, -1.110e-05,\n 0.0047585, 0.0047348,\n// 10 12 24\n1725067.853854, 8.0, -4.0, 4.0, 10423.7, 10423.7,\n -0.3844260, 0.5187439, 1.450e-05, -6.350e-06,\n -1.4095210, -0.0469118, 2.236e-04, 6.600e-07,\n -23.6869202, 0.0004460, 6.000e-06,\n 299.1918030, 14.9961252, 0.000e-00,\n 0.5666640, 0.0001104, -1.050e-05,\n 0.0204240, 0.0001099, -1.050e-05,\n 0.0047537, 0.0047300,\n// 11 5 21\n1725216.241056, 18.0, -4.0, 4.0, 10419.7, 10419.7,\n 0.4299160, 0.5035133, 3.840e-05, -6.510e-06,\n -0.8922830, 0.1742631, -7.350e-05, -2.390e-06,\n 19.6933804, 0.0088180, -4.000e-06,\n 91.9571304, 15.0013361, 0.000e-00,\n 0.5523490, -0.0001196, -1.070e-05,\n 0.0061800, -0.0001191, -1.060e-05,\n 0.0045972, 0.0045743,\n// 11 11 14\n1725392.645134, 3.0, -4.0, 4.0, 10414.8, 10414.8,\n 0.0143580, 0.5306380, 3.060e-05, -8.380e-06,\n 0.7908800, -0.2082504, 7.900e-05, 3.490e-06,\n -17.8641891, -0.0110700, 4.000e-06,\n 228.1855927, 14.9995222, 0.000e-00,\n 0.5438280, 0.0001021, -1.260e-05,\n -0.0022980, 0.0001016, -1.250e-05,\n 0.0047542, 0.0047305,\n// 12 5 9\n1725570.406918, 22.0, -4.0, 4.0, 10410.0, 10410.0,\n 0.1989070, 0.4695761, 3.780e-05, -5.290e-06,\n -0.1683890, 0.1952628, -8.320e-05, -2.350e-06,\n 16.9254799, 0.0110520, -4.000e-06,\n 151.7776642, 15.0024471, 0.000e-00,\n 0.5642780, -0.0000528, -9.800e-06,\n 0.0180500, -0.0000526, -9.700e-06,\n 0.0046021, 0.0045791,\n// 12 11 2\n1725747.283772, 19.0, -4.0, 4.0, 10405.1, 10405.1,\n 0.1249630, 0.5304235, 3.720e-05, -8.940e-06,\n 0.0078300, -0.2418299, 9.280e-05, 4.290e-06,\n -14.6475801, -0.0130780, 3.000e-06,\n 108.4609375, 15.0009880, 0.000e-00,\n 0.5380960, -0.0000114, -1.310e-05,\n -0.0080020, -0.0000113, -1.310e-05,\n 0.0047477, 0.0047241,\n// 13 4 28\n1725924.427984, 22.0, -4.0, 4.0, 10400.3, 10400.3,\n -0.3517510, 0.4606972, 3.960e-05, -5.210e-06,\n 0.4190160, 0.2183339, -9.030e-05, -2.620e-06,\n 13.5530596, 0.0128770, -3.000e-06,\n 151.2751007, 15.0035439, 0.000e-00,\n 0.5641090, 0.0000580, -9.800e-06,\n 0.0178820, 0.0000577, -9.800e-06,\n 0.0046092, 0.0045863,\n// 13 10 23\n1726101.910217, 10.0, -4.0, 4.0, 10395.4, 10395.4,\n -0.2055610, 0.5057967, 5.800e-05, -7.800e-06,\n -0.6024530, -0.2549777, 9.190e-05, 4.150e-06,\n -10.9533005, -0.0145920, 2.000e-06,\n 333.3776550, 15.0022507, 0.000e-00,\n 0.5447880, -0.0001004, -1.240e-05,\n -0.0013430, -0.0000999, -1.230e-05,\n 0.0047391, 0.0047155,\n// 14 3 19\n1726249.151669, 16.0, -4.0, 4.0, 10391.4, 10391.4,\n 0.8724770, 0.4831192, -6.180e-05, -6.880e-06,\n -1.1613491, 0.2683584, 5.880e-05, -4.040e-06,\n -1.3741200, 0.0156690, 0.000e-00,\n 57.8264809, 15.0049810, 0.000e-00,\n 0.5463870, 0.0001059, -1.160e-05,\n 0.0002480, 0.0001054, -1.150e-05,\n 0.0046523, 0.0046291,\n// 14 4 18\n1726278.612392, 3.0, -4.0, 4.0, 10390.5, 10390.5,\n -0.4317970, 0.4762812, 3.190e-05, -6.220e-06,\n 1.1916740, 0.2454006, -1.120e-04, -3.350e-06,\n 9.8100004, 0.0142110, -2.000e-06,\n 225.5100250, 15.0044422, 0.000e-00,\n 0.5523060, 0.0001078, -1.080e-05,\n 0.0061380, 0.0001073, -1.080e-05,\n 0.0046183, 0.0045953,\n// 14 9 13\n1726426.703452, 5.0, -4.0, 4.0, 10386.5, 10386.5,\n 0.7742070, 0.4537856, -3.400e-05, -5.370e-06,\n 1.2834359, -0.2492931, -8.430e-05, 3.100e-06,\n 4.9200401, -0.0156730, -1.000e-06,\n 255.9995270, 15.0040693, 0.000e-00,\n 0.5645970, -0.0000904, -1.030e-05,\n 0.0183670, -0.0000900, -1.020e-05,\n 0.0046901, 0.0046668,\n// 14 10 12\n1726456.336230, 20.0, -4.0, 4.0, 10385.7, 10385.7,\n -0.6885720, 0.4698096, 6.690e-05, -6.040e-06,\n -1.2057600, -0.2519280, 8.530e-05, 3.450e-06,\n -6.8556499, -0.0156110, 1.000e-06,\n 122.9712524, 15.0032234, 0.000e-00,\n 0.5593480, -0.0001130, -1.100e-05,\n 0.0131440, -0.0001124, -1.090e-05,\n 0.0047283, 0.0047048,\n// 15 3 9\n1726603.739031, 6.0, -4.0, 4.0, 10381.6, 10381.6,\n 0.4555870, 0.5082808, -4.910e-05, -8.360e-06,\n -0.5152520, 0.2779885, 5.770e-05, -4.790e-06,\n -5.5217800, 0.0153670, 1.000e-06,\n 266.9093933, 15.0044880, 0.000e-00,\n 0.5356110, 0.0000459, -1.280e-05,\n -0.0104750, 0.0000457, -1.270e-05,\n 0.0046664, 0.0046432,\n// 15 9 2\n1726780.732303, 6.0, -4.0, 4.0, 10376.8, 10376.8,\n 0.5668920, 0.4467416, -4.640e-05, -4.900e-06,\n 0.6204310, -0.2341313, -7.110e-05, 2.730e-06,\n 9.1805201, -0.0147630, -2.000e-06,\n 270.2530518, 15.0036135, 0.000e-00,\n 0.5703970, -0.0000021, -9.800e-06,\n 0.0241390, -0.0000021, -9.700e-06,\n 0.0046745, 0.0046512,\n// 16 2 26\n1726958.427827, 22.0, -4.0, 4.0, 10372.0, 10372.0,\n -0.1549390, 0.5150110, -1.420e-05, -8.530e-06,\n -0.0390200, 0.2677361, 6.020e-05, -4.640e-06,\n -9.5069399, 0.0146460, 2.000e-06,\n 146.1893768, 15.0035734, 0.000e-00,\n 0.5358830, -0.0000429, -1.290e-05,\n -0.0102040, -0.0000427, -1.280e-05,\n 0.0046813, 0.0046580,\n// 16 8 21\n1727134.773296, 7.0, -4.0, 4.0, 10367.1, 10367.1,\n 0.2367730, 0.4679930, -5.630e-05, -5.570e-06,\n -0.0356590, -0.2246969, -6.490e-05, 2.850e-06,\n 13.1183100, -0.0133370, -3.000e-06,\n 284.6757812, 15.0028791, 0.000e-00,\n 0.5623090, 0.0000889, -1.030e-05,\n 0.0160900, 0.0000885, -1.020e-05,\n 0.0046586, 0.0046354,\n// 17 2 15\n1727313.021350, 13.0, -4.0, 4.0, 10362.3, 10362.3,\n -0.0866320, 0.5011933, -1.420e-05, -7.270e-06,\n 0.8131210, 0.2380546, 4.330e-05, -3.660e-06,\n -13.2590303, 0.0134710, 3.000e-06,\n 10.7622604, 15.0022697, 0.000e-00,\n 0.5476060, -0.0001306, -1.180e-05,\n 0.0014610, -0.0001300, -1.170e-05,\n 0.0046967, 0.0046733,\n// 17 8 10\n1727489.088708, 14.0, -4.0, 4.0, 10357.5, 10357.5,\n -0.3280760, 0.5082117, -4.280e-05, -7.260e-06,\n -0.5941960, -0.2145195, -6.390e-05, 3.230e-06,\n 16.5272007, -0.0114790, -4.000e-06,\n 29.3468094, 15.0019836, 0.000e-00,\n 0.5463420, 0.0001239, -1.150e-05,\n 0.0002040, 0.0001232, -1.150e-05,\n 0.0046437, 0.0046205,\n// 18 1 6\n1727637.634096, 3.0, -4.0, 4.0, 10353.4, 10353.4,\n 0.1814760, 0.4980552, -2.970e-05, -5.680e-06,\n -1.4094660, 0.1041378, 2.076e-04, -1.300e-06,\n -22.9104404, 0.0043100, 6.000e-06,\n 222.6302185, 14.9967718, 0.000e-00,\n 0.5721700, -0.0000601, -1.000e-05,\n 0.0259030, -0.0000598, -1.000e-05,\n 0.0047448, 0.0047212,\n// 18 2 4\n1727667.347617, 20.0, -4.0, 4.0, 10352.6, 10352.6,\n -0.7576560, 0.4814118, 6.100e-06, -5.810e-06,\n 1.3633130, 0.1992530, 4.350e-05, -2.590e-06,\n -16.7244091, 0.0117280, 4.000e-06,\n 115.7001724, 15.0006676, 0.000e-00,\n 0.5640390, -0.0000977, -1.050e-05,\n 0.0178120, -0.0000973, -1.040e-05,\n 0.0047121, 0.0046886,\n// 18 7 1\n1727814.385177, 21.0, -4.0, 4.0, 10348.6, 10348.6,\n 0.0262010, 0.5784653, -2.840e-05, -9.870e-06,\n 1.1656539, -0.0845000, -2.359e-04, 1.580e-06,\n 23.5308895, -0.0017660, -5.000e-06,\n 135.3731384, 14.9991856, 0.000e-00,\n 0.5303750, 0.0000152, -1.280e-05,\n -0.0156840, 0.0000151, -1.280e-05,\n 0.0046038, 0.0045809,\n// 18 7 31\n1727843.682809, 4.0, -4.0, 4.0, 10347.8, 10347.8,\n -0.6658450, 0.5457336, -1.690e-05, -9.010e-06,\n -1.2105300, -0.1929035, -5.550e-05, 3.340e-06,\n 19.3162498, -0.0092800, -5.000e-06,\n 239.2991333, 15.0010366, 0.000e-00,\n 0.5337800, 0.0000692, -1.270e-05,\n -0.0122960, 0.0000689, -1.260e-05,\n 0.0046303, 0.0046072,\n// 18 12 26\n1727991.596793, 2.0, -4.0, 4.0, 10343.7, 10343.7,\n -0.0706650, 0.5018580, -2.360e-05, -5.640e-06,\n -0.7657990, 0.0614052, 1.883e-04, -8.100e-07,\n -23.6598206, 0.0007790, 6.000e-06,\n 208.9697571, 14.9961185, 0.000e-00,\n 0.5741770, 0.0000467, -1.000e-05,\n 0.0279000, 0.0000465, -9.900e-06,\n 0.0047530, 0.0047293,\n// 19 6 21\n1728169.086314, 14.0, -4.0, 4.0, 10338.9, 10338.9,\n -0.0096800, 0.5706401, 8.000e-07, -9.130e-06,\n 0.4394070, -0.0406790, -1.907e-04, 7.600e-07,\n 23.6425400, 0.0011850, -6.000e-06,\n 30.9593792, 14.9991961, 0.000e-00,\n 0.5352940, -0.0000837, -1.230e-05,\n -0.0107890, -0.0000833, -1.220e-05,\n 0.0045985, 0.0045756,\n// 19 12 15\n1728345.685005, 4.0, -4.0, 4.0, 10334.0, 10334.0,\n -0.2313650, 0.5291065, -1.420e-05, -6.800e-06,\n -0.0507340, 0.0186091, 1.680e-04, -3.500e-07,\n -23.4156799, -0.0027990, 6.000e-06,\n 240.3764343, 14.9962645, 0.000e-00,\n 0.5626130, 0.0001240, -1.090e-05,\n 0.0163930, 0.0001234, -1.080e-05,\n 0.0047576, 0.0047339,\n// 20 6 10\n1728523.611520, 3.0, -4.0, 4.0, 10329.2, 10329.2,\n 0.1766330, 0.5403103, 1.080e-05, -7.330e-06,\n -0.3373250, 0.0028510, -1.349e-04, 6.000e-08,\n 22.9709892, 0.0041170, -5.000e-06,\n 226.4960327, 14.9996033, 0.000e-00,\n 0.5489350, -0.0001254, -1.100e-05,\n 0.0027830, -0.0001248, -1.090e-05,\n 0.0045960, 0.0045731,\n// 20 12 3\n1728700.076262, 14.0, -4.0, 4.0, 10324.4, 10324.4,\n 0.1256900, 0.5625687, -1.390e-05, -8.650e-06,\n 0.6401650, -0.0263285, 1.320e-04, 3.100e-07,\n -22.2507095, -0.0061160, 6.000e-06,\n 31.6289597, 14.9970903, 0.000e-00,\n 0.5471240, 0.0000998, -1.230e-05,\n 0.0009820, 0.0000993, -1.220e-05,\n 0.0047588, 0.0047351,\n// 21 5 30\n1728877.838799, 8.0, -4.0, 4.0, 10319.5, 10319.5,\n 0.0259520, 0.5102401, 1.880e-05, -5.920e-06,\n -1.1503770, 0.0414177, -8.430e-05, -4.000e-07,\n 21.4866104, 0.0069470, -5.000e-06,\n 301.8609619, 15.0004187, 0.000e-00,\n 0.5621590, -0.0000639, -9.900e-06,\n 0.0159420, -0.0000636, -9.800e-06,\n 0.0045961, 0.0045732,\n// 21 10 24\n1729025.251281, 18.0, -4.0, 4.0, 10315.5, 10315.5,\n -0.3870800, 0.5603748, 4.810e-05, -9.450e-06,\n -1.3374749, -0.1544222, 1.503e-04, 2.540e-06,\n -11.4565697, -0.0146610, 2.000e-06,\n 93.4089584, 15.0022316, 0.000e-00,\n 0.5384240, -0.0000349, -1.300e-05,\n -0.0076760, -0.0000347, -1.300e-05,\n 0.0047398, 0.0047162,\n// 21 11 23\n1729054.686593, 4.0, -4.0, 4.0, 10314.7, 10314.7,\n -0.1197030, 0.5778267, 2.070e-05, -9.820e-06,\n 1.3041910, -0.0713331, 7.490e-05, 1.120e-06,\n -20.2718506, -0.0090500, 5.000e-06,\n 242.6079407, 14.9983377, 0.000e-00,\n 0.5386620, 0.0000301, -1.310e-05,\n -0.0074380, 0.0000299, -1.310e-05,\n 0.0047573, 0.0047336,\n// 22 4 19\n1729202.265747, 18.0, -4.0, 4.0, 10310.7, 10310.7,\n -0.4417320, 0.4957266, 2.300e-05, -5.860e-06,\n 0.8479920, 0.1400533, -9.680e-05, -1.580e-06,\n 10.4049501, 0.0142740, -2.000e-06,\n 90.6399765, 15.0043716, 0.000e-00,\n 0.5619500, 0.0000839, -1.000e-05,\n 0.0157340, 0.0000835, -1.000e-05,\n 0.0046173, 0.0045943,\n// 22 10 14\n1729379.842277, 8.0, -4.0, 4.0, 10305.9, 10305.9,\n -0.3339410, 0.5335091, 4.560e-05, -7.940e-06,\n -0.6882710, -0.1619416, 7.490e-05, 2.350e-06,\n -7.4625001, -0.0157130, 1.000e-06,\n 303.0452881, 15.0032530, 0.000e-00,\n 0.5482360, -0.0001052, -1.200e-05,\n 0.0020870, -0.0001047, -1.190e-05,\n 0.0047293, 0.0047057,\n// 23 4 9\n1729556.528577, 1.0, -4.0, 4.0, 10301.0, 10301.0,\n 0.1221930, 0.5209391, -9.300e-06, -7.250e-06,\n 0.1847390, 0.1609480, -5.180e-05, -2.160e-06,\n 6.4242001, 0.0152370, -1.000e-06,\n 194.7207642, 15.0050163, 0.000e-00,\n 0.5485110, 0.0001100, -1.120e-05,\n 0.0023620, 0.0001095, -1.120e-05,\n 0.0046279, 0.0046049,\n// 23 10 3\n1729734.188215, 17.0, -4.0, 4.0, 10296.2, 10296.2,\n 0.2238960, 0.4989476, 1.160e-05, -6.210e-06,\n -0.1302420, -0.1596346, 1.680e-05, 1.920e-06,\n -3.1785800, -0.0162640, 0.000e-00,\n 77.4351501, 15.0039043, 0.000e-00,\n 0.5631170, -0.0001129, -1.060e-05,\n 0.0168950, -0.0001123, -1.050e-05,\n 0.0047172, 0.0046937,\n// 24 3 28\n1729911.077996, 14.0, -4.0, 4.0, 10291.4, 10291.4,\n 0.2561180, 0.5472324, -1.900e-05, -8.920e-06,\n -0.5518380, 0.1771834, 1.250e-05, -2.810e-06,\n 2.3340299, 0.0157550, -1.000e-06,\n 28.7158699, 15.0052834, 0.000e-00,\n 0.5359980, 0.0000689, -1.250e-05,\n -0.0100890, 0.0000685, -1.250e-05,\n 0.0046398, 0.0046167,\n// 24 9 21\n1730088.248003, 18.0, -4.0, 4.0, 10286.6, 10286.6,\n 0.2281590, 0.4800190, -8.800e-06, -5.360e-06,\n 0.6271310, -0.1551940, -3.290e-05, 1.670e-06,\n 1.3114100, -0.0162840, 0.000e-00,\n 91.6604309, 15.0041866, 0.000e-00,\n 0.5718910, -0.0000188, -9.800e-06,\n 0.0256250, -0.0000187, -9.800e-06,\n 0.0047030, 0.0046796,\n// 25 2 16\n1730236.405566, 22.0, -4.0, 4.0, 10282.6, 10282.6,\n -0.1788950, 0.5564766, 1.000e-07, -9.090e-06,\n 1.2941220, 0.1450130, 1.490e-05, -2.310e-06,\n -12.7721500, 0.0138900, 3.000e-06,\n 145.8039246, 15.0025949, 0.000e-00,\n 0.5386330, -0.0000824, -1.270e-05,\n -0.0074670, -0.0000820, -1.260e-05,\n 0.0046943, 0.0046709,\n// 25 3 18\n1730265.770592, 6.0, -4.0, 4.0, 10281.7, 10281.7,\n 0.1312690, 0.5540464, -9.400e-06, -9.420e-06,\n -1.3236150, 0.1818243, 8.790e-05, -3.000e-06,\n -1.7969800, 0.0158660, 0.000e-00,\n 267.7253723, 15.0051098, 0.000e-00,\n 0.5333100, -0.0000143, -1.290e-05,\n -0.0127640, -0.0000142, -1.280e-05,\n 0.0046533, 0.0046301,\n// 25 8 12\n1730412.632450, 3.0, -4.0, 4.0, 10277.8, 10277.8,\n -0.4100360, 0.5154275, -1.920e-05, -6.530e-06,\n -1.4477160, -0.1116237, -2.790e-05, 1.320e-06,\n 16.0611000, -0.0120250, -4.000e-06,\n 224.3803711, 15.0021572, 0.000e-00,\n 0.5574360, 0.0001167, -1.060e-05,\n 0.0112420, 0.0001161, -1.050e-05,\n 0.0046461, 0.0046230,\n// 25 9 10\n1730442.246916, 18.0, -4.0, 4.0, 10277.0, 10277.0,\n 0.4420220, 0.4896715, -3.920e-05, -5.730e-06,\n 1.2832670, -0.1534926, -7.960e-05, 1.750e-06,\n 5.7453599, -0.0157600, -1.000e-06,\n 90.8485489, 15.0041008, 0.000e-00,\n 0.5667030, 0.0000805, -1.010e-05,\n 0.0204630, 0.0000801, -1.010e-05,\n 0.0046872, 0.0046638,\n// 26 2 6\n1730590.935367, 10.0, -4.0, 4.0, 10272.9, 10272.9,\n -0.3692110, 0.5332307, 1.230e-05, -7.410e-06,\n 0.5713430, 0.1114026, 8.190e-05, -1.480e-06,\n -16.2327805, 0.0122500, 4.000e-06,\n 325.6834106, 15.0010424, 0.000e-00,\n 0.5529350, -0.0001142, -1.140e-05,\n 0.0067630, -0.0001136, -1.130e-05,\n 0.0047094, 0.0046860,\n// 26 8 1\n1730767.038714, 13.0, -4.0, 4.0, 10268.1, 10268.1,\n -0.0677330, 0.5544004, -3.150e-05, -8.400e-06,\n -0.6918970, -0.0865298, -8.560e-05, 1.220e-06,\n 18.9728603, -0.0098560, -4.000e-06,\n 14.2936201, 15.0011997, 0.000e-00,\n 0.5415780, 0.0001093, -1.190e-05,\n -0.0045370, 0.0001088, -1.180e-05,\n 0.0046321, 0.0046090,\n// 27 1 26\n1730945.168213, 16.0, -4.0, 4.0, 10263.3, 10263.3,\n -0.0076950, 0.5081990, -5.300e-06, -5.980e-06,\n -0.0790110, 0.0743899, 1.284e-04, -8.000e-07,\n -19.2407093, 0.0100200, 5.000e-06,\n 55.9828987, 14.9993343, 0.000e-00,\n 0.5685330, -0.0000845, -1.020e-05,\n 0.0222840, -0.0000841, -1.020e-05,\n 0.0047242, 0.0047006,\n// 27 7 22\n1731121.686884, 4.0, -4.0, 4.0, 10258.5, 10258.5,\n -0.2762910, 0.5805693, -4.000e-06, -9.850e-06,\n 0.0854060, -0.0521184, -1.532e-04, 7.800e-07,\n 21.2168808, -0.0073840, -5.000e-06,\n 239.4707336, 15.0002956, 0.000e-00,\n 0.5317910, 0.0000444, -1.280e-05,\n -0.0142750, 0.0000442, -1.270e-05,\n 0.0046200, 0.0045970,\n// 28 1 15\n1731299.155917, 16.0, -4.0, 4.0, 10253.7, 10253.7,\n 0.1865460, 0.5024675, -1.910e-05, -5.600e-06,\n -0.7652620, 0.0369945, 1.697e-04, -3.400e-07,\n -21.6100407, 0.0071860, 5.000e-06,\n 56.7394409, 14.9977598, 0.000e-00,\n 0.5741910, 0.0000096, -9.900e-06,\n 0.0279140, 0.0000096, -9.800e-06,\n 0.0047369, 0.0047133,\n// 28 7 10\n1731476.395056, 21.0, -4.0, 4.0, 10248.8, 10248.8,\n -0.2611180, 0.5769556, 1.920e-05, -9.480e-06,\n 0.8027070, -0.0118140, -2.074e-04, 7.000e-08,\n 22.7631092, -0.0046600, -5.000e-06,\n 134.8751526, 14.9995451, 0.000e-00,\n 0.5338460, -0.0000559, -1.250e-05,\n -0.0122300, -0.0000556, -1.250e-05,\n 0.0046106, 0.0045876,\n// 28 12 5\n1731623.541193, 1.0, -4.0, 4.0, 10244.8, 10244.8,\n 0.3434690, 0.5247629, 1.900e-06, -7.050e-06,\n 1.4429910, -0.1226163, 8.940e-05, 1.820e-06,\n -22.4677601, -0.0054200, 6.000e-06,\n 196.4756012, 14.9968519, 0.000e-00,\n 0.5579830, 0.0001211, -1.130e-05,\n 0.0117860, 0.0001205, -1.120e-05,\n 0.0047593, 0.0047356,\n// 29 1 3\n1731653.194448, 17.0, -4.0, 4.0, 10244.1, 10244.1,\n 0.1665430, 0.5224628, -2.070e-05, -6.450e-06,\n -1.4285160, -0.0026229, 2.192e-04, 1.000e-07,\n -23.1210098, 0.0039140, 6.000e-06,\n 72.8674469, 14.9966574, 0.000e-00,\n 0.5655690, 0.0000952, -1.060e-05,\n 0.0193350, 0.0000948, -1.050e-05,\n 0.0047466, 0.0047229,\n// 29 6 1\n1731801.523383, 1.0, -4.0, 4.0, 10240.0, 10240.0,\n 0.5050500, 0.5121680, 3.180e-05, -6.560e-06,\n -0.9698500, 0.1391727, -8.930e-05, -1.910e-06,\n 21.7767696, 0.0062660, -5.000e-06,\n 196.8140106, 15.0002623, 0.000e-00,\n 0.5531610, -0.0001216, -1.060e-05,\n 0.0069890, -0.0001210, -1.060e-05,\n 0.0045955, 0.0045726,\n// 29 11 24\n1731978.010655, 12.0, -4.0, 4.0, 10235.2, 10235.2,\n 0.0853910, 0.5444922, 2.730e-05, -8.680e-06,\n 0.7518040, -0.1729151, 1.051e-04, 2.950e-06,\n -20.5715199, -0.0084310, 5.000e-06,\n 2.5073500, 14.9980764, 0.000e-00,\n 0.5434720, 0.0000920, -1.260e-05,\n -0.0026530, 0.0000915, -1.260e-05,\n 0.0047578, 0.0047341,\n// 30 5 21\n1732155.674271, 4.0, -4.0, 4.0, 10230.4, 10230.4,\n 0.0176140, 0.4794125, 4.370e-05, -5.390e-06,\n -0.3315700, 0.1674474, -9.750e-05, -2.020e-06,\n 19.6521301, 0.0088730, -4.000e-06,\n 241.9401855, 15.0012894, 0.000e-00,\n 0.5644170, -0.0000378, -9.700e-06,\n 0.0181890, -0.0000376, -9.700e-06,\n 0.0045980, 0.0045751,\n// 30 11 14\n1732332.650990, 4.0, -4.0, 4.0, 10225.6, 10225.6,\n 0.2276390, 0.5426727, 3.770e-05, -9.160e-06,\n -0.0199290, -0.2123159, 1.218e-04, 3.780e-06,\n -17.9784603, -0.0109630, 4.000e-06,\n 243.1780548, 14.9994993, 0.000e-00,\n 0.5384830, -0.0000224, -1.310e-05,\n -0.0076160, -0.0000222, -1.310e-05,\n 0.0047538, 0.0047302,\n// 31 5 10\n1732509.699197, 5.0, -4.0, 4.0, 10220.8, 10220.8,\n -0.0682200, 0.4715584, 3.350e-05, -5.380e-06,\n 0.4543810, 0.1967275, -1.126e-04, -2.390e-06,\n 16.8396206, 0.0111060, -4.000e-06,\n 256.7541504, 15.0024738, 0.000e-00,\n 0.5632260, 0.0000547, -9.900e-06,\n 0.0170030, 0.0000544, -9.800e-06,\n 0.0046027, 0.0045798,\n// 31 11 3\n1732687.268581, 18.0, -4.0, 4.0, 10216.0, 10216.0,\n -0.4868430, 0.5144726, 8.020e-05, -7.870e-06,\n -0.4645990, -0.2330619, 1.122e-04, 3.780e-06,\n -14.7569704, -0.0130370, 3.000e-06,\n 93.4678421, 15.0009079, 0.000e-00,\n 0.5460080, -0.0000893, -1.230e-05,\n -0.0001290, -0.0000889, -1.230e-05,\n 0.0047479, 0.0047242,\n// 32 3 29\n1732834.465288, 23.0, -4.0, 4.0, 10212.0, 10212.0,\n 0.6376400, 0.4857558, -3.940e-05, -7.010e-06,\n -1.3472670, 0.2680119, 4.540e-05, -4.090e-06,\n 2.8930099, 0.0154910, -1.000e-06,\n 163.8529053, 15.0051279, 0.000e-00,\n 0.5446460, 0.0001167, -1.160e-05,\n -0.0014850, 0.0001161, -1.160e-05,\n 0.0046387, 0.0046156,\n// 32 4 28\n1732863.904284, 10.0, -4.0, 4.0, 10211.2, 10211.2,\n -0.3593520, 0.4867085, 3.660e-05, -6.440e-06,\n 1.1371510, 0.2293782, -1.321e-04, -3.180e-06,\n 13.5205698, 0.0128650, -3.000e-06,\n 331.2571106, 15.0036077, 0.000e-00,\n 0.5508080, 0.0001095, -1.090e-05,\n 0.0046470, 0.0001090, -1.080e-05,\n 0.0046092, 0.0045863,\n// 32 9 23\n1733012.018446, 12.0, -4.0, 4.0, 10207.2, 10207.2,\n 0.5507820, 0.4501988, -1.450e-05, -5.270e-06,\n 1.4507260, -0.2521089, -6.790e-05, 3.110e-06,\n 0.5848000, -0.0160840, 0.000e-00,\n 1.7929000, 15.0040998, 0.000e-00,\n 0.5662530, -0.0000753, -1.030e-05,\n 0.0200150, -0.0000749, -1.020e-05,\n 0.0047048, 0.0046814,\n// 32 10 23\n1733041.675323, 4.0, -4.0, 4.0, 10206.4, 10206.4,\n -0.7151450, 0.4749952, 7.840e-05, -6.050e-06,\n -1.1822760, -0.2378021, 1.089e-04, 3.240e-06,\n -11.0012503, -0.0146130, 2.000e-06,\n 243.3869629, 15.0021667, 0.000e-00,\n 0.5608800, -0.0001091, -1.090e-05,\n 0.0146690, -0.0001085, -1.080e-05,\n 0.0047394, 0.0047158,\n// 33 3 19\n1733189.069631, 14.0, -4.0, 4.0, 10202.4, 10202.4,\n 0.5167240, 0.5063596, -3.850e-05, -8.370e-06,\n -0.5322390, 0.2835480, 3.490e-05, -4.900e-06,\n -1.2530900, 0.0156340, 0.000e-00,\n 27.8544407, 15.0050411, 0.000e-00,\n 0.5344390, 0.0000387, -1.280e-05,\n -0.0116400, 0.0000385, -1.270e-05,\n 0.0046517, 0.0046286,\n// 33 9 12\n1733366.032991, 13.0, -4.0, 4.0, 10197.6, 10197.6,\n 0.5062520, 0.4413944, -3.480e-05, -4.830e-06,\n 0.7001150, -0.2436079, -5.200e-05, 2.840e-06,\n 5.0248599, -0.0156660, -1.000e-06,\n 15.9756699, 15.0040379, 0.000e-00,\n 0.5713270, 0.0000082, -9.800e-06,\n 0.0250630, 0.0000081, -9.700e-06,\n 0.0046896, 0.0046663,\n// 34 3 9\n1733543.764401, 6.0, -4.0, 4.0, 10192.8, 10192.8,\n -0.1734850, 0.5081745, -6.000e-07, -8.380e-06,\n -0.1003600, 0.2790387, 3.870e-05, -4.810e-06,\n -5.3717699, 0.0153830, 1.000e-06,\n 266.9438477, 15.0045090, 0.000e-00,\n 0.5354330, -0.0000463, -1.280e-05,\n -0.0106520, -0.0000461, -1.270e-05,\n 0.0046662, 0.0046430,\n// 34 9 1\n1733720.077991, 14.0, -4.0, 4.0, 10188.0, 10188.0,\n 0.1149140, 0.4611528, -4.400e-05, -5.530e-06,\n 0.0756240, -0.2413870, -4.630e-05, 3.070e-06,\n 9.2782402, -0.0147140, -2.000e-06,\n 30.2306309, 15.0036364, 0.000e-00,\n 0.5624360, 0.0000993, -1.040e-05,\n 0.0162170, 0.0000988, -1.030e-05,\n 0.0046735, 0.0046503,\n// 35 2 26\n1733898.354095, 20.0, -4.0, 4.0, 10183.2, 10183.2,\n -0.5855850, 0.4908816, 1.700e-05, -7.030e-06,\n 0.5294880, 0.2549306, 3.200e-05, -3.860e-06,\n -9.3948298, 0.0147070, 2.000e-06,\n 116.2121201, 15.0035381, 0.000e-00,\n 0.5477270, -0.0001090, -1.170e-05,\n 0.0015810, -0.0001084, -1.160e-05,\n 0.0046818, 0.0046585,\n// 35 8 21\n1734074.405444, 22.0, -4.0, 4.0, 10178.5, 10178.5,\n -0.1332570, 0.4992453, -4.510e-05, -7.180e-06,\n -0.6237440, -0.2389855, -3.850e-05, 3.610e-06,\n 13.1095104, -0.0133040, -3.000e-06,\n 149.6710815, 15.0029640, 0.000e-00,\n 0.5462970, 0.0001136, -1.160e-05,\n 0.0001580, 0.0001131, -1.160e-05,\n 0.0046577, 0.0046345,\n// 36 1 17\n1734222.963093, 11.0, -4.0, 4.0, 10174.4, 10174.4,\n 0.3460650, 0.4877053, -4.430e-05, -5.520e-06,\n -1.3917340, 0.1424142, 1.906e-04, -1.740e-06,\n -21.2740307, 0.0074460, 5.000e-06,\n 341.5905457, 14.9979591, 0.000e-00,\n 0.5719750, -0.0000579, -1.000e-05,\n 0.0257090, -0.0000576, -1.000e-05,\n 0.0047348, 0.0047113,\n// 36 2 16\n1734252.669206, 4.0, -4.0, 4.0, 10173.6, 10173.6,\n -0.6794950, 0.4699687, 8.600e-06, -5.620e-06,\n 1.3645180, 0.2219666, 2.020e-05, -2.850e-06,\n -13.2535400, 0.0135120, 3.000e-06,\n 235.7666168, 15.0021877, 0.000e-00,\n 0.5638970, -0.0001004, -1.040e-05,\n 0.0176710, -0.0000999, -1.030e-05,\n 0.0046977, 0.0046743,\n// 36 7 12\n1734399.698976, 5.0, -4.0, 4.0, 10169.6, 10169.6,\n 0.3986930, 0.5701323, -5.850e-05, -9.710e-06,\n 1.1652100, -0.1293177, -2.258e-04, 2.360e-06,\n 22.5979900, -0.0047700, -5.000e-06,\n 254.8091583, 14.9996080, 0.000e-00,\n 0.5307550, -0.0000029, -1.280e-05,\n -0.0153060, -0.0000029, -1.280e-05,\n 0.0046116, 0.0045886,\n// 36 8 10\n1734429.005847, 12.0, -4.0, 4.0, 10168.9, 10168.9,\n -0.5808460, 0.5344691, -1.840e-05, -8.850e-06,\n -1.1721630, -0.2245951, -3.400e-05, 3.890e-06,\n 16.4364204, -0.0115110, -4.000e-06,\n 359.3515625, 15.0020857, 0.000e-00,\n 0.5340910, 0.0000577, -1.270e-05,\n -0.0119870, 0.0000574, -1.270e-05,\n 0.0046432, 0.0046201,\n// 37 1 5\n1734576.928496, 10.0, -4.0, 4.0, 10164.9, 10164.9,\n 0.0145890, 0.4957318, -3.940e-05, -5.580e-06,\n -0.7735480, 0.1033635, 1.796e-04, -1.300e-06,\n -22.9436207, 0.0042130, 6.000e-06,\n 327.6674500, 14.9967346, 0.000e-00,\n 0.5733560, 0.0000504, -1.000e-05,\n 0.0270830, 0.0000501, -9.900e-06,\n 0.0047454, 0.0047217,\n// 37 7 1\n1734754.391246, 21.0, -4.0, 4.0, 10160.1, 10160.1,\n -0.1427590, 0.5639420, -5.700e-06, -8.930e-06,\n 0.5403670, -0.0856349, -1.942e-04, 1.480e-06,\n 23.5102596, -0.0018780, -6.000e-06,\n 135.3463287, 14.9991608, 0.000e-00,\n 0.5363170, -0.0000799, -1.220e-05,\n -0.0097720, -0.0000795, -1.220e-05,\n 0.0046040, 0.0045811,\n// 37 12 25\n1734931.033039, 13.0, -4.0, 4.0, 10155.3, 10155.3,\n 0.1147000, 0.5273421, -4.200e-05, -6.820e-06,\n -0.0321690, 0.0640379, 1.670e-04, -9.600e-07,\n -23.6623707, 0.0007230, 6.000e-06,\n 13.9952698, 14.9961796, 0.000e-00,\n 0.5615740, 0.0001108, -1.090e-05,\n 0.0153590, 0.0001102, -1.090e-05,\n 0.0047527, 0.0047291,\n// 38 6 21\n1735108.898800, 10.0, -4.0, 4.0, 10150.5, 10150.5,\n 0.2111530, 0.5366938, -2.900e-06, -7.190e-06,\n -0.2757520, -0.0394820, -1.444e-04, 6.400e-07,\n 23.6476402, 0.0011130, -6.000e-06,\n 330.9389954, 14.9991035, 0.000e-00,\n 0.5500880, -0.0001262, -1.090e-05,\n 0.0039310, -0.0001256, -1.080e-05,\n 0.0045991, 0.0045762,\n// 38 12 14\n1735285.440050, 23.0, -4.0, 4.0, 10145.8, 10145.8,\n 0.2249120, 0.5643765, -3.160e-05, -8.740e-06,\n 0.6511180, 0.0201065, 1.414e-04, -4.200e-07,\n -23.4265003, -0.0027440, 6.000e-06,\n 165.3644562, 14.9963493, 0.000e-00,\n 0.5463600, 0.0000895, -1.240e-05,\n 0.0002210, 0.0000890, -1.230e-05,\n 0.0047570, 0.0047333,\n// 39 6 10\n1735463.107152, 15.0, -4.0, 4.0, 10140.9, 10140.9,\n 0.2261260, 0.5107550, 1.800e-06, -5.890e-06,\n -1.0640540, 0.0034311, -1.005e-04, 5.000e-08,\n 22.9611607, 0.0041410, -6.000e-06,\n 46.4870186, 14.9995337, 0.000e-00,\n 0.5627130, -0.0000686, -9.900e-06,\n 0.0164930, -0.0000683, -9.800e-06,\n 0.0045965, 0.0045736,\n// 39 11 5\n1735610.615502, 3.0, -4.0, 4.0, 10136.9, 10136.9,\n -0.1837390, 0.5659793, 4.140e-05, -9.520e-06,\n -1.3948380, -0.1295628, 1.818e-04, 2.110e-06,\n -15.2170496, -0.0130330, 3.000e-06,\n 228.4554443, 15.0008440, 0.000e-00,\n 0.5391490, -0.0000474, -1.300e-05,\n -0.0069540, -0.0000472, -1.300e-05,\n 0.0047486, 0.0047249,\n// 39 12 4\n1735640.057090, 13.0, -4.0, 4.0, 10136.2, 10136.2,\n -0.1548020, 0.5817335, 1.370e-05, -9.890e-06,\n 1.2869220, -0.0276504, 9.530e-05, 3.700e-07,\n -22.3000507, -0.0060090, 6.000e-06,\n 16.6034107, 14.9971066, 0.000e-00,\n 0.5386400, 0.0000212, -1.320e-05,\n -0.0074610, 0.0000211, -1.310e-05,\n 0.0047586, 0.0047349,\n// 40 4 30\n1735787.543947, 1.0, -4.0, 4.0, 10132.2, 10132.2,\n -0.2658700, 0.5021674, 1.920e-05, -5.990e-06,\n 0.9747890, 0.1219846, -1.245e-04, -1.380e-06,\n 14.0595598, 0.0128630, -3.000e-06,\n 196.3448334, 15.0034904, 0.000e-00,\n 0.5607100, 0.0000827, -1.010e-05,\n 0.0145000, 0.0000823, -1.000e-05,\n 0.0046083, 0.0045854,\n// 40 10 24\n1735965.193016, 17.0, -4.0, 4.0, 10127.4, 10127.4,\n -0.0039130, 0.5364241, 3.720e-05, -7.920e-06,\n -0.7965020, -0.1450738, 1.071e-04, 2.080e-06,\n -11.5799904, -0.0146370, 2.000e-06,\n 78.4268417, 15.0021372, 0.000e-00,\n 0.5495850, -0.0001217, -1.190e-05,\n 0.0034300, -0.0001211, -1.190e-05,\n 0.0047403, 0.0047167,\n// 41 4 19\n1736141.829698, 8.0, -4.0, 4.0, 10122.6, 10122.6,\n -0.0099350, 0.5270184, 2.000e-06, -7.420e-06,\n 0.2114310, 0.1484462, -7.720e-05, -2.010e-06,\n 10.4017897, 0.0142550, -2.000e-06,\n 300.6283569, 15.0044451, 0.000e-00,\n 0.5468920, 0.0001151, -1.130e-05,\n 0.0007510, 0.0001145, -1.120e-05,\n 0.0046170, 0.0045940,\n// 41 10 14\n1736319.518067, 0.0, -4.0, 4.0, 10117.8, 10117.8,\n -0.2387260, 0.4997629, 3.590e-05, -6.150e-06,\n -0.0076240, -0.1507881, 3.810e-05, 1.790e-06,\n -7.4843702, -0.0157330, 1.000e-06,\n 183.0547180, 15.0031691, 0.000e-00,\n 0.5647670, -0.0000912, -1.050e-05,\n 0.0185360, -0.0000907, -1.050e-05,\n 0.0047298, 0.0047062,\n// 42 4 8\n1736496.397560, 22.0, -4.0, 4.0, 10113.1, 10113.1,\n 0.4135440, 0.5508521, -1.840e-05, -9.040e-06,\n -0.4424930, 0.1702941, -1.790e-05, -2.720e-06,\n 6.5284400, 0.0151950, -1.000e-06,\n 149.7399445, 15.0050697, 0.000e-00,\n 0.5348070, 0.0000557, -1.250e-05,\n -0.0112740, 0.0000554, -1.250e-05,\n 0.0046275, 0.0046044,\n// 42 10 3\n1736673.560732, 1.0, -4.0, 4.0, 10108.3, 10108.3,\n -0.0254180, 0.4799129, 6.700e-06, -5.340e-06,\n 0.6768950, -0.1536090, -1.010e-05, 1.650e-06,\n -3.0691800, -0.0162800, 1.000e-06,\n 197.4226074, 15.0038786, 0.000e-00,\n 0.5729330, -0.0000034, -9.800e-06,\n 0.0266620, -0.0000034, -9.800e-06,\n 0.0047168, 0.0046933,\n// 43 2 28\n1736821.746147, 6.0, -4.0, 4.0, 10104.3, 10104.3,\n -0.3288940, 0.5502128, 1.330e-05, -8.920e-06,\n 1.2927560, 0.1635472, -1.170e-05, -2.590e-06,\n -8.8507004, 0.0150560, 2.000e-06,\n 266.3013000, 15.0038280, 0.000e-00,\n 0.5383800, -0.0000826, -1.260e-05,\n -0.0077190, -0.0000822, -1.250e-05,\n 0.0046796, 0.0046563,\n// 43 3 29\n1736851.098880, 14.0, -4.0, 4.0, 10103.5, 10103.5,\n 0.1818370, 0.5538748, -2.600e-06, -9.390e-06,\n -1.2558711, 0.1810363, 5.840e-05, -2.980e-06,\n 2.4904399, 0.0157350, -1.000e-06,\n 28.7496395, 15.0052881, 0.000e-00,\n 0.5327920, -0.0000233, -1.280e-05,\n -0.0132800, -0.0000232, -1.280e-05,\n 0.0046398, 0.0046167,\n// 43 8 23\n1736997.936695, 10.0, -4.0, 4.0, 10099.6, 10099.6,\n -0.6422640, 0.5115024, -8.400e-06, -6.550e-06,\n -1.4326169, -0.1353771, -3.700e-06, 1.640e-06,\n 12.5858498, -0.0137780, -3.000e-06,\n 329.7385864, 15.0031252, 0.000e-00,\n 0.5573470, 0.0001260, -1.070e-05,\n 0.0111530, 0.0001254, -1.060e-05,\n 0.0046599, 0.0046367,\n// 43 9 22\n1737027.559179, 1.0, -4.0, 4.0, 10098.8, 10098.8,\n 0.2021870, 0.4889527, -2.410e-05, -5.760e-06,\n 1.3202890, -0.1589790, -5.670e-05, 1.830e-06,\n 1.4362900, -0.0162610, 0.000e-00,\n 196.6412811, 15.0042229, 0.000e-00,\n 0.5669430, 0.0000951, -1.020e-05,\n 0.0207020, 0.0000946, -1.010e-05,\n 0.0047016, 0.0046782,\n// 44 2 17\n1737176.268591, 18.0, -4.0, 4.0, 10094.8, 10094.8,\n -0.4009750, 0.5257639, 1.500e-05, -7.240e-06,\n 0.5835390, 0.1357644, 5.590e-05, -1.810e-06,\n -12.6927605, 0.0139450, 3.000e-06,\n 85.8156281, 15.0025368, 0.000e-00,\n 0.5529940, -0.0001145, -1.130e-05,\n 0.0068220, -0.0001139, -1.120e-05,\n 0.0046952, 0.0046718,\n// 44 8 11\n1737352.355524, 21.0, -4.0, 4.0, 10090.0, 10090.0,\n 0.1004050, 0.5503082, -4.080e-05, -8.410e-06,\n -0.7863060, -0.1181112, -5.740e-05, 1.710e-06,\n 16.0134506, -0.0120330, -4.000e-06,\n 134.3795471, 15.0022678, 0.000e-00,\n 0.5415280, 0.0000974, -1.200e-05,\n -0.0045870, 0.0000969, -1.190e-05,\n 0.0046451, 0.0046219,\n// 45 2 5\n1737530.489917, 0.0, -4.0, 4.0, 10085.3, 10085.3,\n 0.1318920, 0.5019051, -1.350e-05, -5.870e-06,\n -0.0251030, 0.1041509, 1.032e-04, -1.150e-06,\n -16.2381306, 0.0122640, 4.000e-06,\n 175.6912079, 15.0009499, 0.000e-00,\n 0.5682730, -0.0000860, -1.010e-05,\n 0.0220250, -0.0000856, -1.010e-05,\n 0.0047106, 0.0046871,\n// 45 8 1\n1737707.007292, 12.0, -4.0, 4.0, 10080.5, 10080.5,\n -0.1010190, 0.5762281, -1.880e-05, -9.800e-06,\n 0.0146960, -0.0903696, -1.292e-04, 1.440e-06,\n 18.8822994, -0.0099250, -4.000e-06,\n 359.2861633, 15.0012951, 0.000e-00,\n 0.5322320, 0.0000306, -1.290e-05,\n -0.0138360, 0.0000304, -1.280e-05,\n 0.0046318, 0.0046087,\n// 46 1 25\n1737884.477267, 23.0, -4.0, 4.0, 10075.7, 10075.7,\n -0.1184070, 0.4991272, -1.710e-05, -5.580e-06,\n -0.7810720, 0.0721662, 1.502e-04, -7.400e-07,\n -19.3172607, 0.0099480, 5.000e-06,\n 161.0124207, 14.9992580, 0.000e-00,\n 0.5732570, 0.0000288, -9.900e-06,\n 0.0269840, 0.0000287, -9.800e-06,\n 0.0047250, 0.0047015,\n// 46 7 22\n1738061.708700, 5.0, -4.0, 4.0, 10070.9, 10070.9,\n 0.0637560, 0.5731184, -7.000e-06, -9.360e-06,\n 0.7306180, -0.0539993, -1.895e-04, 7.700e-07,\n 21.1324406, -0.0074930, -5.000e-06,\n 254.4490051, 15.0003157, 0.000e-00,\n 0.5349070, -0.0000725, -1.250e-05,\n -0.0111750, -0.0000722, -1.240e-05,\n 0.0046205, 0.0045975,\n// 46 12 16\n1738208.894945, 9.0, -4.0, 4.0, 10067.0, 10067.0,\n -0.0397640, 0.5349277, 6.600e-06, -7.290e-06,\n 1.5029600, -0.0790635, 9.670e-05, 1.230e-06,\n -23.5141201, -0.0020210, 7.000e-06,\n 315.1882629, 14.9962234, 0.000e-00,\n 0.5569300, 0.0001318, -1.140e-05,\n 0.0107380, 0.0001312, -1.130e-05,\n 0.0047569, 0.0047332,\n// 47 1 15\n1738238.532045, 1.0, -4.0, 4.0, 10066.2, 10066.2,\n 0.2253650, 0.5227410, -3.550e-05, -6.510e-06,\n -1.3998210, 0.0389260, 2.039e-04, -4.300e-07,\n -21.6488094, 0.0071120, 5.000e-06,\n 191.7726440, 14.9977818, 0.000e-00,\n 0.5641900, 0.0000994, -1.060e-05,\n 0.0179620, 0.0000990, -1.060e-05,\n 0.0047368, 0.0047132,\n// 47 6 12\n1738386.804425, 7.0, -4.0, 4.0, 10062.2, 10062.2,\n 0.0595340, 0.5190567, 4.090e-05, -6.580e-06,\n -1.1628180, 0.1002260, -9.550e-05, -1.380e-06,\n 23.1231709, 0.0034330, -6.000e-06,\n 286.4073792, 14.9994488, 0.000e-00,\n 0.5542330, -0.0001027, -1.050e-05,\n 0.0080550, -0.0001022, -1.050e-05,\n 0.0045965, 0.0045736,\n// 47 7 11\n1738416.264460, 18.0, -4.0, 4.0, 10061.4, 10061.4,\n -0.1492470, 0.5458096, 1.900e-05, -7.620e-06,\n 1.5393831, -0.0141326, -2.287e-04, 7.000e-08,\n 22.7274303, -0.0047330, -5.000e-06,\n 89.8503265, 14.9994841, 0.000e-00,\n 0.5473950, -0.0001098, -1.120e-05,\n 0.0012510, -0.0001093, -1.110e-05,\n 0.0046112, 0.0045883,\n// 47 12 5\n1738563.378173, 21.0, -4.0, 4.0, 10057.5, 10057.5,\n 0.1272420, 0.5573069, 1.920e-05, -8.960e-06,\n 0.7316570, -0.1310577, 1.255e-04, 2.280e-06,\n -22.4943504, -0.0053300, 6.000e-06,\n 136.4568634, 14.9969206, 0.000e-00,\n 0.5429870, 0.0000828, -1.270e-05,\n -0.0031360, 0.0000824, -1.260e-05,\n 0.0047586, 0.0047349,\n// 48 5 31\n1738740.938972, 11.0, -4.0, 4.0, 10052.7, 10052.7,\n 0.3356200, 0.4890004, 2.850e-05, -5.490e-06,\n -0.3313840, 0.1344581, -1.150e-04, -1.640e-06,\n 21.7454605, 0.0063210, -5.000e-06,\n 346.8052063, 15.0002193, 0.000e-00,\n 0.5645900, -0.0000433, -9.700e-06,\n 0.0183600, -0.0000431, -9.700e-06,\n 0.0045960, 0.0045731,\n// 48 11 24\n1738918.020940, 12.0, -4.0, 4.0, 10047.9, 10047.9,\n -0.2589850, 0.5552968, 6.220e-05, -9.370e-06,\n 0.1518440, -0.1757147, 1.381e-04, 3.160e-06,\n -20.6506100, -0.0083170, 5.000e-06,\n 2.4798501, 14.9980555, 0.000e-00,\n 0.5388070, -0.0000053, -1.310e-05,\n -0.0072950, -0.0000053, -1.310e-05,\n 0.0047577, 0.0047340,\n// 49 5 20\n1739094.968345, 11.0, -4.0, 4.0, 10043.2, 10043.2,\n -0.2349340, 0.4832540, 3.900e-05, -5.570e-06,\n 0.2978070, 0.1696581, -1.268e-04, -2.090e-06,\n 19.5806408, 0.0089360, -4.000e-06,\n 346.9313354, 15.0013313, 0.000e-00,\n 0.5623510, 0.0000701, -9.900e-06,\n 0.0161330, 0.0000697, -9.900e-06,\n 0.0045980, 0.0045751,\n// 49 11 14\n1739272.629824, 3.0, -4.0, 4.0, 10038.4, 10038.4,\n -0.2854470, 0.5250742, 7.570e-05, -7.990e-06,\n -0.5556250, -0.2036950, 1.437e-04, 3.300e-06,\n -18.0716896, -0.0109040, 4.000e-06,\n 228.1641083, 14.9994040, 0.000e-00,\n 0.5470320, -0.0001011, -1.230e-05,\n 0.0008890, -0.0001006, -1.220e-05,\n 0.0047544, 0.0047307,\n// 50 5 9\n1739449.194292, 17.0, -4.0, 4.0, 10033.7, 10033.7,\n -0.2548090, 0.4990364, 3.690e-05, -6.690e-06,\n 1.0883300, 0.2071315, -1.523e-04, -2.910e-06,\n 16.8098507, 0.0110980, -4.000e-06,\n 76.7424698, 15.0025511, 0.000e-00,\n 0.5494330, 0.0001100, -1.100e-05,\n 0.0032790, 0.0001094, -1.090e-05,\n 0.0046022, 0.0045793,\n// 50 11 3\n1739627.017964, 12.0, -4.0, 4.0, 10028.9, 10028.9,\n -0.7700630, 0.4828314, 8.810e-05, -6.100e-06,\n -1.1572720, -0.2170413, 1.334e-04, 2.950e-06,\n -14.7988195, -0.0130490, 3.000e-06,\n 3.4739699, 15.0008125, 0.000e-00,\n 0.5622800, -0.0001032, -1.080e-05,\n 0.0160620, -0.0001026, -1.080e-05,\n 0.0047485, 0.0047248,\n// 51 3 30\n1739774.396608, 22.0, -4.0, 4.0, 10025.0, 10025.0,\n 0.6178790, 0.5079639, -2.980e-05, -8.430e-06,\n -0.5352910, 0.2825232, 1.200e-05, -4.900e-06,\n 3.0321600, 0.0154440, -1.000e-06,\n 148.8769836, 15.0051718, 0.000e-00,\n 0.5333700, 0.0000292, -1.280e-05,\n -0.0127040, 0.0000290, -1.270e-05,\n 0.0046382, 0.0046151,\n// 51 9 23\n1739951.339181, 20.0, -4.0, 4.0, 10020.2, 10020.2,\n 0.3780820, 0.4391982, -1.970e-05, -4.800e-06,\n 0.8155720, -0.2473063, -3.430e-05, 2.880e-06,\n 0.6962800, -0.0160860, 0.000e-00,\n 121.7768173, 15.0040846, 0.000e-00,\n 0.5721600, 0.0000208, -9.800e-06,\n 0.0258930, 0.0000207, -9.800e-06,\n 0.0047041, 0.0046807,\n// 52 3 19\n1740129.096751, 14.0, -4.0, 4.0, 10015.4, 10015.4,\n -0.1376250, 0.5047349, 1.140e-05, -8.280e-06,\n -0.1356700, 0.2835549, 1.680e-05, -4.860e-06,\n -1.0946300, 0.0156380, 0.000e-00,\n 27.8799305, 15.0050402, 0.000e-00,\n 0.5350560, -0.0000523, -1.270e-05,\n -0.0110270, -0.0000520, -1.260e-05,\n 0.0046518, 0.0046286,\n// 52 9 11\n1740305.389306, 21.0, -4.0, 4.0, 10010.7, 10010.7,\n -0.0779840, 0.4569846, -2.670e-05, -5.530e-06,\n 0.2295960, -0.2521176, -2.970e-05, 3.230e-06,\n 5.1328802, -0.0156230, -1.000e-06,\n 135.9595642, 15.0040770, 0.000e-00,\n 0.5625160, 0.0001127, -1.050e-05,\n 0.0162960, 0.0001122, -1.040e-05,\n 0.0046884, 0.0046650,\n// 53 3 9\n1740483.680090, 4.0, -4.0, 4.0, 10005.9, 10005.9,\n -0.4926130, 0.4834910, 2.440e-05, -6.850e-06,\n 0.5289480, 0.2650959, 8.700e-06, -3.960e-06,\n -5.2501302, 0.0154340, 1.000e-06,\n 236.9631195, 15.0044613, 0.000e-00,\n 0.5477330, -0.0001143, -1.160e-05,\n 0.0015870, -0.0001137, -1.150e-05,\n 0.0046669, 0.0046436,\n// 53 9 1\n1740659.728912, 5.0, -4.0, 4.0, 10001.2, 10001.2,\n -0.5080390, 0.4922797, -1.930e-05, -7.160e-06,\n -0.3804000, -0.2570181, -2.540e-05, 3.920e-06,\n 9.2718000, -0.0146740, -2.000e-06,\n 255.2335358, 15.0037203, 0.000e-00,\n 0.5461760, 0.0001301, -1.180e-05,\n 0.0000380, 0.0001295, -1.170e-05,\n 0.0046724, 0.0046491,\n// 54 1 27\n1740808.286083, 19.0, -4.0, 4.0, 9997.3, 9997.3,\n 0.5668550, 0.4761293, -5.540e-05, -5.350e-06,\n -1.3424700, 0.1753958, 1.675e-04, -2.110e-06,\n -18.8465900, 0.0101420, 4.000e-06,\n 100.9322433, 14.9994774, 0.000e-00,\n 0.5716110, -0.0000581, -1.000e-05,\n 0.0253460, -0.0000578, -9.900e-06,\n 0.0047228, 0.0046993,\n// 54 2 26\n1740837.983046, 12.0, -4.0, 4.0, 9996.5, 9996.5,\n -0.4967490, 0.4606482, 1.040e-05, -5.470e-06,\n 1.4207840, 0.2380460, -4.900e-06, -3.020e-06,\n -9.3753595, 0.0147550, 2.000e-06,\n 356.2219543, 15.0034609, 0.000e-00,\n 0.5636930, -0.0001063, -1.030e-05,\n 0.0174680, -0.0001058, -1.030e-05,\n 0.0046830, 0.0046596,\n// 54 7 23\n1740985.016972, 12.0, -4.0, 4.0, 9992.5, 9992.5,\n 0.1466860, 0.5592299, -5.260e-05, -9.510e-06,\n 1.3006010, -0.1698759, -2.163e-04, 3.050e-06,\n 20.8767796, -0.0075610, -5.000e-06,\n 359.4074707, 15.0004025, 0.000e-00,\n 0.5312950, 0.0000072, -1.290e-05,\n -0.0147690, 0.0000072, -1.280e-05,\n 0.0046215, 0.0045985,\n// 54 8 21\n1741014.335090, 20.0, -4.0, 4.0, 9991.7, 9991.7,\n -0.5619020, 0.5240852, -1.210e-05, -8.700e-06,\n -1.1223940, -0.2497113, -1.190e-05, 4.330e-06,\n 13.0031700, -0.0133210, -3.000e-06,\n 119.6780777, 15.0030603, 0.000e-00,\n 0.5344870, 0.0000498, -1.280e-05,\n -0.0115930, 0.0000495, -1.270e-05,\n 0.0046571, 0.0046339,\n// 55 1 16\n1741162.255368, 18.0, -4.0, 4.0, 9987.8, 9987.8,\n 0.1542880, 0.4870323, -5.280e-05, -5.490e-06,\n -0.7625330, 0.1419828, 1.626e-04, -1.750e-06,\n -21.3338108, 0.0073570, 5.000e-06,\n 86.6296463, 14.9979124, 0.000e-00,\n 0.5723510, 0.0000518, -1.000e-05,\n 0.0260830, 0.0000516, -9.900e-06,\n 0.0047354, 0.0047118,\n// 55 7 13\n1741339.699340, 5.0, -4.0, 4.0, 9983.0, 9983.0,\n 0.2518610, 0.5538384, -3.500e-05, -8.690e-06,\n 0.5406210, -0.1289933, -1.844e-04, 2.160e-06,\n 22.5462894, -0.0048830, -5.000e-06,\n 254.7753143, 14.9995966, 0.000e-00,\n 0.5374160, -0.0000984, -1.220e-05,\n -0.0086780, -0.0000979, -1.210e-05,\n 0.0046119, 0.0045890,\n// 56 1 5\n1741516.378811, 21.0, -4.0, 4.0, 9978.3, 9978.3,\n -0.0369920, 0.5219941, -4.870e-05, -6.800e-06,\n -0.0616910, 0.1082909, 1.584e-04, -1.560e-06,\n -22.9596691, 0.0041510, 6.000e-06,\n 132.6976929, 14.9967861, 0.000e-00,\n 0.5602530, 0.0001180, -1.100e-05,\n 0.0140450, 0.0001174, -1.090e-05,\n 0.0047452, 0.0047216,\n// 56 7 1\n1741694.186085, 16.0, -4.0, 4.0, 9973.5, 9973.5,\n -0.2745440, 0.5296872, 3.900e-06, -6.980e-06,\n -0.1413830, -0.0815967, -1.491e-04, 1.190e-06,\n 23.4989891, -0.0019460, -6.000e-06,\n 60.3205299, 14.9990797, 0.000e-00,\n 0.5514960, -0.0001050, -1.080e-05,\n 0.0053320, -0.0001045, -1.080e-05,\n 0.0046047, 0.0045817,\n// 56 12 25\n1741870.803158, 7.0, -4.0, 4.0, 9968.8, 9968.8,\n -0.2319960, 0.5622042, -2.460e-05, -8.780e-06,\n 0.6150920, 0.0681598, 1.431e-04, -1.190e-06,\n -23.6584206, 0.0007560, 7.000e-06,\n 283.9906006, 14.9962740, 0.000e-00,\n 0.5453590, 0.0001033, -1.240e-05,\n -0.0007750, 0.0001028, -1.240e-05,\n 0.0047521, 0.0047285,\n// 57 6 20\n1742048.374498, 21.0, -4.0, 4.0, 9964.1, 9964.1,\n -0.0641840, 0.5083673, -3.000e-07, -5.820e-06,\n -0.9788160, -0.0365335, -1.101e-04, 5.200e-07,\n 23.6431198, 0.0011460, -6.000e-06,\n 135.9382477, 14.9990339, 0.000e-00,\n 0.5634560, -0.0000539, -9.800e-06,\n 0.0172320, -0.0000536, -9.800e-06,\n 0.0045997, 0.0045768,\n// 57 11 15\n1742195.982863, 12.0, -4.0, 4.0, 9960.1, 9960.1,\n -0.0002610, 0.5717561, 3.100e-05, -9.590e-06,\n -1.4255140, -0.0969646, 2.109e-04, 1.550e-06,\n -18.4545097, -0.0108320, 4.000e-06,\n 3.0989101, 14.9993277, 0.000e-00,\n 0.5397560, -0.0000579, -1.300e-05,\n -0.0063510, -0.0000576, -1.290e-05,\n 0.0047545, 0.0047308,\n// 57 12 14\n1742225.427467, 22.0, -4.0, 4.0, 9959.4, 9959.4,\n -0.1956770, 0.5821730, 3.100e-06, -9.900e-06,\n 1.2704800, 0.0203768, 1.071e-04, -4.700e-07,\n -23.4470692, -0.0026320, 7.000e-06,\n 150.3306427, 14.9963884, 0.000e-00,\n 0.5384670, 0.0000122, -1.320e-05,\n -0.0076330, 0.0000121, -1.310e-05,\n 0.0047564, 0.0047327,\n// 58 5 11\n1742372.818939, 8.0, -4.0, 4.0, 9955.4, 9955.4,\n -0.0295810, 0.5091601, 9.800e-06, -6.130e-06,\n 1.1024430, 0.0977963, -1.514e-04, -1.090e-06,\n 17.2713203, 0.0110360, -4.000e-06,\n 301.7907715, 15.0023947, 0.000e-00,\n 0.5595940, 0.0000798, -1.010e-05,\n 0.0133900, 0.0000794, -1.010e-05,\n 0.0046019, 0.0045790,\n// 58 11 5\n1742550.548001, 1.0, -4.0, 4.0, 9950.6, 9950.6,\n -0.2522420, 0.5404588, 5.120e-05, -7.900e-06,\n -0.7415090, -0.1210097, 1.325e-04, 1.710e-06,\n -15.3148899, -0.0129950, 3.000e-06,\n 198.4557953, 15.0007439, 0.000e-00,\n 0.5509330, -0.0001117, -1.190e-05,\n 0.0047710, -0.0001111, -1.180e-05,\n 0.0047489, 0.0047253,\n// 59 4 30\n1742727.128176, 15.0, -4.0, 4.0, 9945.9, 9945.9,\n -0.1056820, 0.5343768, 9.400e-06, -7.620e-06,\n 0.2585480, 0.1293206, -1.033e-04, -1.760e-06,\n 14.0555601, 0.0128490, -3.000e-06,\n 46.3357582, 15.0035639, 0.000e-00,\n 0.5454000, 0.0001185, -1.140e-05,\n -0.0007340, 0.0001179, -1.130e-05,\n 0.0046080, 0.0045851,\n// 59 10 25\n1742904.851966, 8.0, -4.0, 4.0, 9941.2, 9941.2,\n -0.2483720, 0.5024480, 4.150e-05, -6.120e-06,\n -0.0277390, -0.1350827, 6.510e-05, 1.580e-06,\n -11.5861502, -0.0146560, 3.000e-06,\n 303.4307861, 15.0020542, 0.000e-00,\n 0.5661990, -0.0000885, -1.050e-05,\n 0.0199610, -0.0000881, -1.040e-05,\n 0.0047408, 0.0047172,\n// 60 4 19\n1743081.714033, 5.0, -4.0, 4.0, 9936.4, 9936.4,\n 0.0542460, 0.5563007, 6.200e-06, -9.190e-06,\n -0.4848850, 0.1564606, -4.110e-05, -2.510e-06,\n 10.4999704, 0.0142050, -2.000e-06,\n 255.6409454, 15.0044918, 0.000e-00,\n 0.5336690, 0.0000656, -1.260e-05,\n -0.0124070, 0.0000653, -1.250e-05,\n 0.0046164, 0.0045934,\n// 60 10 13\n1743258.879062, 9.0, -4.0, 4.0, 9931.7, 9931.7,\n 0.1303930, 0.4819250, 7.900e-06, -5.350e-06,\n 0.6013960, -0.1455812, 1.710e-05, 1.550e-06,\n -7.3932700, -0.0157610, 2.000e-06,\n 318.0519409, 15.0031471, 0.000e-00,\n 0.5738660, -0.0000052, -9.800e-06,\n 0.0275900, -0.0000052, -9.800e-06,\n 0.0047297, 0.0047062,\n// 61 3 10\n1743407.080831, 14.0, -4.0, 4.0, 9927.8, 9927.8,\n -0.3864340, 0.5455990, 2.400e-05, -8.790e-06,\n 1.3201760, 0.1746288, -3.910e-05, -2.760e-06,\n -4.6798701, 0.0157100, 1.000e-06,\n 27.0817299, 15.0047064, 0.000e-00,\n 0.5381300, -0.0000862, -1.250e-05,\n -0.0079680, -0.0000857, -1.240e-05,\n 0.0046644, 0.0046412,\n// 61 4 8\n1743436.421899, 22.0, -4.0, 4.0, 9927.0, 9927.0,\n 0.2859030, 0.5558366, 9.000e-07, -9.400e-06,\n -1.1634300, 0.1731722, 2.790e-05, -2.840e-06,\n 6.6804800, 0.0151580, -2.000e-06,\n 149.7674255, 15.0050640, 0.000e-00,\n 0.5323570, -0.0000354, -1.280e-05,\n -0.0137120, -0.0000353, -1.270e-05,\n 0.0046271, 0.0046040,\n// 61 10 2\n1743612.878791, 9.0, -4.0, 4.0, 9922.3, 9922.3,\n 0.3503640, 0.4903137, -2.210e-05, -5.810e-06,\n 1.2392780, -0.1580959, -2.960e-05, 1.830e-06,\n -2.9587700, -0.0162730, 1.000e-06,\n 317.4127197, 15.0039206, 0.000e-00,\n 0.5672160, 0.0000924, -1.020e-05,\n 0.0209730, 0.0000920, -1.020e-05,\n 0.0047159, 0.0046924,\n// 62 2 28\n1743761.595446, 2.0, -4.0, 4.0, 9918.3, 9918.3,\n -0.3494780, 0.5192309, 1.750e-05, -7.080e-06,\n 0.6296920, 0.1528953, 2.850e-05, -2.030e-06,\n -8.7629604, 0.0151030, 2.000e-06,\n 206.3136444, 15.0037689, 0.000e-00,\n 0.5530030, -0.0001178, -1.120e-05,\n 0.0068310, -0.0001172, -1.110e-05,\n 0.0046803, 0.0046569,\n// 62 8 23\n1743937.678496, 4.0, -4.0, 4.0, 9913.6, 9913.6,\n -0.3567030, 0.5460720, -1.730e-05, -8.440e-06,\n -0.7283320, -0.1431860, -3.410e-05, 2.120e-06,\n 12.5321798, -0.0137770, -3.000e-06,\n 239.7412872, 15.0032291, 0.000e-00,\n 0.5414480, 0.0001127, -1.210e-05,\n -0.0046670, 0.0001122, -1.200e-05,\n 0.0046590, 0.0046358,\n// 63 2 17\n1744115.805443, 7.0, -4.0, 4.0, 9908.8, 9908.8,\n -0.1591830, 0.4955901, -2.600e-06, -5.760e-06,\n -0.0602490, 0.1271059, 7.960e-05, -1.410e-06,\n -12.7120199, 0.0139590, 3.000e-06,\n 280.8152466, 15.0024452, 0.000e-00,\n 0.5680100, -0.0000699, -1.010e-05,\n 0.0217640, -0.0000695, -1.000e-05,\n 0.0046965, 0.0046731,\n// 63 8 12\n1744292.333033, 20.0, -4.0, 4.0, 9904.2, 9904.2,\n -0.0077140, 0.5704963, -2.500e-05, -9.720e-06,\n -0.0559270, -0.1225714, -1.015e-04, 2.000e-06,\n 15.9034300, -0.0120850, -4.000e-06,\n 119.3800583, 15.0023623, 0.000e-00,\n 0.5327670, 0.0000200, -1.290e-05,\n -0.0133040, 0.0000199, -1.280e-05,\n 0.0046446, 0.0046215,\n// 64 2 6\n1744469.794388, 7.0, -4.0, 4.0, 9899.4, 9899.4,\n 0.1151360, 0.4945118, -2.850e-05, -5.540e-06,\n -0.7215810, 0.1019662, 1.248e-04, -1.080e-06,\n -16.3295193, 0.0122130, 4.000e-06,\n 280.6957092, 15.0008726, 0.000e-00,\n 0.5722260, 0.0000264, -9.900e-06,\n 0.0259580, 0.0000262, -9.800e-06,\n 0.0047119, 0.0046884,\n// 64 8 1\n1744647.025149, 13.0, -4.0, 4.0, 9894.7, 9894.7,\n 0.3315020, 0.5668475, -2.620e-05, -9.200e-06,\n 0.6289020, -0.0911548, -1.644e-04, 1.380e-06,\n 18.7700996, -0.0100190, -4.000e-06,\n 14.2764702, 15.0013237, 0.000e-00,\n 0.5360810, -0.0000872, -1.240e-05,\n -0.0100060, -0.0000868, -1.240e-05,\n 0.0046320, 0.0046089,\n// 64 12 26\n1744794.247905, 18.0, -4.0, 4.0, 9890.8, 9890.8,\n 0.1175300, 0.5416097, -1.310e-05, -7.460e-06,\n 1.4760610, -0.0330862, 9.840e-05, 5.900e-07,\n -23.6166191, 0.0015000, 7.000e-06,\n 88.8104477, 14.9962645, 0.000e-00,\n 0.5558550, 0.0001192, -1.140e-05,\n 0.0096690, 0.0001186, -1.140e-05,\n 0.0047518, 0.0047282,\n// 65 1 25\n1744823.866318, 9.0, -4.0, 4.0, 9890.0, 9890.0,\n 0.3097710, 0.5204406, -4.690e-05, -6.540e-06,\n -1.3625730, 0.0760905, 1.818e-04, -9.100e-07,\n -19.3613205, 0.0098940, 5.000e-06,\n 311.0293274, 14.9992762, 0.000e-00,\n 0.5626850, 0.0001019, -1.070e-05,\n 0.0164650, 0.0001013, -1.060e-05,\n 0.0047252, 0.0047017,\n// 65 6 22\n1744972.084859, 14.0, -4.0, 4.0, 9886.0, 9886.0,\n 0.1186110, 0.5233346, 2.750e-05, -6.580e-06,\n -1.2313280, 0.0586643, -1.003e-04, -8.300e-07,\n 23.6769791, 0.0004080, -6.000e-06,\n 30.8330593, 14.9990406, 0.000e-00,\n 0.5553190, -0.0001050, -1.050e-05,\n 0.0091360, -0.0001045, -1.040e-05,\n 0.0045999, 0.0045770,\n// 65 7 22\n1745001.561916, 1.0, -4.0, 4.0, 9885.2, 9885.2,\n -0.1177410, 0.5410379, 7.000e-06, -7.460e-06,\n 1.4917589, -0.0533872, -2.123e-04, 6.200e-07,\n 21.0851898, -0.0075530, -5.000e-06,\n 194.4337463, 15.0002613, 0.000e-00,\n 0.5489530, -0.0001064, -1.110e-05,\n 0.0028020, -0.0001059, -1.110e-05,\n 0.0046210, 0.0045980,\n// 65 12 16\n1745148.744811, 6.0, -4.0, 4.0, 9881.3, 9881.3,\n 0.1799920, 0.5674547, 5.400e-06, -9.190e-06,\n 0.7233670, -0.0844923, 1.373e-04, 1.520e-06,\n -23.5236092, -0.0019230, 6.000e-06,\n 270.1665955, 14.9963036, 0.000e-00,\n 0.5423520, 0.0000729, -1.280e-05,\n -0.0037670, 0.0000725, -1.270e-05,\n 0.0047561, 0.0047324,\n// 66 6 11\n1745326.203550, 17.0, -4.0, 4.0, 9876.6, 9876.6,\n 0.1530600, 0.4970473, 2.610e-05, -5.580e-06,\n -0.4773160, 0.0976392, -1.226e-04, -1.210e-06,\n 23.1038704, 0.0034880, -6.000e-06,\n 76.4030609, 14.9994020, 0.000e-00,\n 0.5649330, -0.0000294, -9.700e-06,\n 0.0187010, -0.0000292, -9.700e-06,\n 0.0045969, 0.0045740,\n// 66 12 5\n1745503.391077, 21.0, -4.0, 4.0, 9871.9, 9871.9,\n -0.2031570, 0.5668099, 5.300e-05, -9.570e-06,\n 0.1176980, -0.1325397, 1.604e-04, 2.410e-06,\n -22.5420094, -0.0052080, 6.000e-06,\n 136.4275513, 14.9969158, 0.000e-00,\n 0.5389770, -0.0000144, -1.310e-05,\n -0.0071250, -0.0000143, -1.310e-05,\n 0.0047583, 0.0047346,\n// 67 5 31\n1745680.237752, 18.0, -4.0, 4.0, 9867.2, 9867.2,\n 0.0729730, 0.4947936, 2.370e-05, -5.750e-06,\n 0.3018020, 0.1370308, -1.442e-04, -1.720e-06,\n 21.6944008, 0.0063910, -5.000e-06,\n 91.7960434, 15.0002565, 0.000e-00,\n 0.5616670, 0.0000656, -9.900e-06,\n 0.0154530, 0.0000652, -9.900e-06,\n 0.0045961, 0.0045732,\n// 67 11 25\n1745857.991719, 12.0, -4.0, 4.0, 9862.4, 9862.4,\n -0.0783840, 0.5360440, 6.530e-05, -8.110e-06,\n -0.6250410, -0.1674363, 1.720e-04, 2.720e-06,\n -20.7263393, -0.0082320, 5.000e-06,\n 2.4633400, 14.9979601, 0.000e-00,\n 0.5479130, -0.0001121, -1.220e-05,\n 0.0017660, -0.0001116, -1.210e-05,\n 0.0047580, 0.0047343,\n// 68 5 19\n1746034.483580, 0.0, -4.0, 4.0, 9857.7, 9857.7,\n -0.1349430, 0.5122801, 3.230e-05, -6.970e-06,\n 1.0351570, 0.1787130, -1.712e-04, -2.560e-06,\n 19.5655804, 0.0089260, -4.000e-06,\n 181.9208527, 15.0014067, 0.000e-00,\n 0.5481950, 0.0001098, -1.100e-05,\n 0.0020470, 0.0001092, -1.100e-05,\n 0.0045976, 0.0045747,\n// 68 11 13\n1746212.363135, 21.0, -4.0, 4.0, 9853.0, 9853.0,\n -0.3509870, 0.4925433, 7.560e-05, -6.190e-06,\n -1.3314350, -0.1892849, 1.659e-04, 2.570e-06,\n -18.1046906, -0.0109070, 4.000e-06,\n 138.1697998, 14.9993048, 0.000e-00,\n 0.5634030, -0.0001174, -1.080e-05,\n 0.0171790, -0.0001168, -1.070e-05,\n 0.0047549, 0.0047312,\n// 69 4 10\n1746359.717557, 5.0, -4.0, 4.0, 9849.1, 9849.1,\n 0.2770600, 0.5130118, 2.000e-07, -8.560e-06,\n -0.7896270, 0.2749774, 2.300e-06, -4.800e-06,\n 7.1833701, 0.0148140, -2.000e-06,\n 254.8890228, 15.0049038, 0.000e-00,\n 0.5323740, 0.0000414, -1.280e-05,\n -0.0136950, 0.0000412, -1.270e-05,\n 0.0046258, 0.0046027,\n// 69 10 4\n1746536.652763, 4.0, -4.0, 4.0, 9844.4, 9844.4,\n 0.5974880, 0.4403191, -1.560e-05, -4.810e-06,\n 0.7271810, -0.2452389, -9.100e-06, 2.860e-06,\n -3.6980300, -0.0160110, 1.000e-06,\n 242.5314636, 15.0037107, 0.000e-00,\n 0.5729310, 0.0000170, -9.800e-06,\n 0.0266600, 0.0000169, -9.800e-06,\n 0.0047182, 0.0046947,\n// 70 3 30\n1746714.422211, 22.0, -4.0, 4.0, 9839.7, 9839.7,\n -0.0159830, 0.5048202, 1.910e-05, -8.240e-06,\n -0.1292550, 0.2814943, -6.700e-06, -4.800e-06,\n 3.1826501, 0.0154330, -1.000e-06,\n 148.9159851, 15.0051537, 0.000e-00,\n 0.5347580, -0.0000622, -1.260e-05,\n -0.0113230, -0.0000619, -1.260e-05,\n 0.0046382, 0.0046151,\n// 70 9 23\n1746890.708419, 5.0, -4.0, 4.0, 9835.0, 9835.0,\n 0.0961640, 0.4559232, -2.130e-05, -5.550e-06,\n 0.1728510, -0.2569139, -5.000e-06, 3.320e-06,\n 0.7885100, -0.0160550, 0.000e-00,\n 256.7572632, 15.0041342, 0.000e-00,\n 0.5626600, 0.0001087, -1.050e-05,\n 0.0164400, 0.0001082, -1.050e-05,\n 0.0047031, 0.0046797,\n// 71 3 20\n1747068.999165, 12.0, -4.0, 4.0, 9830.2, 9830.2,\n -0.3102650, 0.4794062, 2.900e-05, -6.730e-06,\n 0.5759060, 0.2687812, -1.580e-05, -3.980e-06,\n -0.9752400, 0.0156760, 0.000e-00,\n 357.9114685, 15.0049801, 0.000e-00,\n 0.5477650, -0.0001229, -1.150e-05,\n 0.0016190, -0.0001223, -1.140e-05,\n 0.0046524, 0.0046292,\n// 71 9 12\n1747245.059423, 13.0, -4.0, 4.0, 9825.5, 9825.5,\n -0.4647320, 0.4880011, -9.100e-06, -7.160e-06,\n -0.3518260, -0.2686969, -2.700e-06, 4.130e-06,\n 5.1095800, -0.0155830, -1.000e-06,\n 15.9635201, 15.0041590, 0.000e-00,\n 0.5461980, 0.0001268, -1.190e-05,\n 0.0000600, 0.0001262, -1.180e-05,\n 0.0046874, 0.0046641,\n// 72 2 8\n1747393.604223, 2.0, -4.0, 4.0, 9821.6, 9821.6,\n 0.3585030, 0.4648397, -4.700e-05, -5.190e-06,\n -1.4617190, 0.2019501, 1.482e-04, -2.400e-06,\n -15.7670898, 0.0123110, 3.000e-06,\n 205.6879883, 15.0010710, 0.000e-00,\n 0.5711550, -0.0000404, -9.900e-06,\n 0.0248920, -0.0000402, -9.900e-06,\n 0.0047093, 0.0046859,\n// 72 3 8\n1747423.290564, 19.0, -4.0, 4.0, 9820.8, 9820.8,\n -0.6824810, 0.4540910, 2.710e-05, -5.340e-06,\n 1.2790350, 0.2478337, -2.150e-05, -3.110e-06,\n -5.2426200, 0.0154770, 1.000e-06,\n 101.9626617, 15.0043859, 0.000e-00,\n 0.5635280, -0.0000943, -1.020e-05,\n 0.0173040, -0.0000938, -1.020e-05,\n 0.0046678, 0.0046446,\n// 72 8 2\n1747570.337612, 20.0, -4.0, 4.0, 9816.9, 9816.9,\n 0.4173020, 0.5468771, -6.810e-05, -9.270e-06,\n 1.2814810, -0.2053873, -1.938e-04, 3.660e-06,\n 18.4316101, -0.0100440, -4.000e-06,\n 119.2759399, 15.0014076, 0.000e-00,\n 0.5319830, -0.0000067, -1.290e-05,\n -0.0140840, -0.0000066, -1.280e-05,\n 0.0046333, 0.0046102,\n// 72 9 1\n1747599.668992, 4.0, -4.0, 4.0, 9816.1, 9816.1,\n -0.5865020, 0.5157395, -2.000e-07, -8.590e-06,\n -1.0583570, -0.2679922, 9.600e-06, 4.650e-06,\n 9.1427402, -0.0146810, -2.000e-06,\n 240.2562256, 15.0038033, 0.000e-00,\n 0.5349760, 0.0000446, -1.290e-05,\n -0.0111060, 0.0000443, -1.280e-05,\n 0.0046720, 0.0046488,\n// 73 1 27\n1747747.579497, 2.0, -4.0, 4.0, 9812.2, 9812.2,\n 0.3181860, 0.4770079, -6.180e-05, -5.380e-06,\n -0.7287190, 0.1756591, 1.398e-04, -2.150e-06,\n -18.9248695, 0.0100690, 4.000e-06,\n 205.9447327, 14.9994278, 0.000e-00,\n 0.5711830, 0.0000519, -1.000e-05,\n 0.0249200, 0.0000517, -1.000e-05,\n 0.0047234, 0.0046999,\n// 73 7 23\n1747925.008891, 12.0, -4.0, 4.0, 9807.5, 9807.5,\n 0.0777260, 0.5413622, -3.340e-05, -8.390e-06,\n 0.6586990, -0.1678781, -1.740e-04, 2.750e-06,\n 20.7992001, -0.0076640, -5.000e-06,\n 359.3951721, 15.0003958, 0.000e-00,\n 0.5387590, -0.0000915, -1.210e-05,\n -0.0073420, -0.0000910, -1.200e-05,\n 0.0046220, 0.0045990,\n// 74 1 16\n1748101.722028, 5.0, -4.0, 4.0, 9802.8, 9802.8,\n -0.1510560, 0.5138208, -5.230e-05, -6.750e-06,\n -0.1103670, 0.1492823, 1.426e-04, -2.120e-06,\n -21.3599892, 0.0072990, 5.000e-06,\n 251.6417847, 14.9979582, 0.000e-00,\n 0.5587800, 0.0001238, -1.110e-05,\n 0.0125790, 0.0001232, -1.100e-05,\n 0.0047353, 0.0047117,\n// 74 7 12\n1748279.474981, 23.0, -4.0, 4.0, 9798.1, 9798.1,\n -0.2319500, 0.5196463, -8.300e-06, -6.760e-06,\n -0.0547690, -0.1219835, -1.438e-04, 1.720e-06,\n 22.5261192, -0.0049400, -5.000e-06,\n 164.7614746, 14.9995222, 0.000e-00,\n 0.5529150, -0.0001044, -1.070e-05,\n 0.0067440, -0.0001039, -1.070e-05,\n 0.0046125, 0.0045895,\n// 75 1 5\n1748456.164602, 16.0, -4.0, 4.0, 9793.4, 9793.4,\n -0.1009430, 0.5560003, -4.290e-05, -8.730e-06,\n 0.6242060, 0.1155223, 1.321e-04, -1.960e-06,\n -22.9394798, 0.0041900, 6.000e-06,\n 57.6851006, 14.9968843, 0.000e-00,\n 0.5443450, 0.0000912, -1.250e-05,\n -0.0017840, 0.0000907, -1.240e-05,\n 0.0047448, 0.0047212,\n// 75 7 2\n1748633.643596, 3.0, -4.0, 4.0, 9788.7, 9788.7,\n -0.3602060, 0.5028460, -2.600e-06, -5.710e-06,\n -0.8538290, -0.0767809, -1.134e-04, 9.800e-07,\n 23.5047207, -0.0019190, -6.000e-06,\n 225.3142853, 14.9990149, 0.000e-00,\n 0.5642610, -0.0000383, -9.800e-06,\n 0.0180340, -0.0000381, -9.700e-06,\n 0.0046048, 0.0045818,\n// 75 11 26\n1748781.350985, 20.0, -4.0, 4.0, 9784.8, 9784.8,\n -0.3843730, 0.5762515, 4.370e-05, -9.620e-06,\n -1.3779891, -0.0578236, 2.327e-04, 8.900e-07,\n -21.0051098, -0.0081140, 5.000e-06,\n 122.3503036, 14.9978952, 0.000e-00,\n 0.5403220, -0.0000418, -1.300e-05,\n -0.0057870, -0.0000416, -1.290e-05,\n 0.0047580, 0.0047343,\n// 75 12 26\n1748810.796375, 7.0, -4.0, 4.0, 9784.0, 9784.0,\n -0.2184630, 0.5784017, -9.700e-06, -9.820e-06,\n 1.2562160, 0.0700308, 1.084e-04, -1.330e-06,\n -23.6481800, 0.0008780, 7.000e-06,\n 283.9544067, 14.9963217, 0.000e-00,\n 0.5382110, 0.0000023, -1.320e-05,\n -0.0078870, 0.0000022, -1.310e-05,\n 0.0047520, 0.0047283,\n// 76 5 21\n1748958.094301, 14.0, -4.0, 4.0, 9780.1, 9780.1,\n -0.2881810, 0.5157693, 1.460e-05, -6.270e-06,\n 1.1384920, 0.0680702, -1.734e-04, -7.400e-07,\n 19.9277592, 0.0088110, -4.000e-06,\n 31.9114704, 15.0012417, 0.000e-00,\n 0.5584800, 0.0000971, -1.020e-05,\n 0.0122810, 0.0000966, -1.010e-05,\n 0.0045974, 0.0045745,\n// 76 11 15\n1749135.904674, 10.0, -4.0, 4.0, 9775.4, 9775.4,\n 0.0293880, 0.5447248, 3.750e-05, -7.900e-06,\n -0.8001760, -0.0895110, 1.615e-04, 1.230e-06,\n -18.5331497, -0.0107790, 4.000e-06,\n 333.0960693, 14.9992180, 0.000e-00,\n 0.5520400, -0.0001242, -1.180e-05,\n 0.0058730, -0.0001236, -1.170e-05,\n 0.0047551, 0.0047314,\n// 77 5 10\n1749312.424736, 22.0, -4.0, 4.0, 9770.7, 9770.7,\n -0.1705450, 0.5422439, 1.230e-05, -7.830e-06,\n 0.3230100, 0.1036238, -1.294e-04, -1.410e-06,\n 17.2699203, 0.0110230, -4.000e-06,\n 151.7738342, 15.0024767, 0.000e-00,\n 0.5440480, 0.0001206, -1.140e-05,\n -0.0020790, 0.0001200, -1.140e-05,\n 0.0046013, 0.0045784,\n// 77 11 4\n1749490.189335, 17.0, -4.0, 4.0, 9766.0, 9766.0,\n 0.2088940, 0.5063864, 2.720e-05, -6.130e-06,\n -0.1502890, -0.1123214, 9.580e-05, 1.290e-06,\n -15.3303699, -0.0130050, 4.000e-06,\n 78.4684601, 15.0006552, 0.000e-00,\n 0.5673670, -0.0001049, -1.050e-05,\n 0.0211230, -0.0001044, -1.040e-05,\n 0.0047494, 0.0047257,\n// 78 4 30\n1749667.027443, 13.0, -4.0, 4.0, 9761.3, 9761.3,\n 0.2890370, 0.5629754, -1.200e-06, -9.360e-06,\n -0.3558470, 0.1355534, -7.240e-05, -2.170e-06,\n 14.1571598, 0.0127860, -3.000e-06,\n 16.3429699, 15.0035954, 0.000e-00,\n 0.5327670, 0.0000483, -1.260e-05,\n -0.0133040, 0.0000481, -1.250e-05,\n 0.0046078, 0.0045849,\n// 78 10 24\n1749844.202404, 17.0, -4.0, 4.0, 9756.6, 9756.6,\n 0.2241530, 0.4857641, 9.600e-06, -5.390e-06,\n 0.5565640, -0.1309126, 4.390e-05, 1.390e-06,\n -11.5002899, -0.0146920, 3.000e-06,\n 78.4359512, 15.0020475, 0.000e-00,\n 0.5746090, -0.0000048, -9.900e-06,\n 0.0283300, -0.0000048, -9.800e-06,\n 0.0047404, 0.0047168,\n// 79 3 21\n1749992.409110, 22.0, -4.0, 4.0, 9752.7, 9752.7,\n -0.3463640, 0.5430418, 3.080e-05, -8.690e-06,\n 1.3856410, 0.1784799, -6.750e-05, -2.800e-06,\n -0.3975100, 0.0158880, 0.000e-00,\n 148.0470428, 15.0051661, 0.000e-00,\n 0.5379620, -0.0000933, -1.240e-05,\n -0.0081350, -0.0000929, -1.230e-05,\n 0.0046503, 0.0046272,\n// 79 4 20\n1750021.740716, 6.0, -4.0, 4.0, 9751.9, 9751.9,\n 0.4340210, 0.5595811, 7.000e-07, -9.430e-06,\n -1.0583410, 0.1582786, -3.100e-06, -2.570e-06,\n 10.6556101, 0.0141520, -2.000e-06,\n 270.6669617, 15.0044584, 0.000e-00,\n 0.5320780, -0.0000500, -1.270e-05,\n -0.0139890, -0.0000498, -1.270e-05,\n 0.0046166, 0.0045936,\n// 79 10 13\n1750198.205242, 17.0, -4.0, 4.0, 9747.2, 9747.2,\n 0.4048670, 0.4938365, -1.730e-05, -5.890e-06,\n 1.1968290, -0.1505327, -3.300e-06, 1.750e-06,\n -7.2860699, -0.0157630, 2.000e-06,\n 78.0460205, 15.0032101, 0.000e-00,\n 0.5673450, 0.0000927, -1.030e-05,\n 0.0211010, 0.0000922, -1.030e-05,\n 0.0047285, 0.0047050,\n// 80 3 10\n1750346.914862, 10.0, -4.0, 4.0, 9743.3, 9743.3,\n -0.2036950, 0.5143249, 1.820e-05, -6.950e-06,\n 0.7203250, 0.1629482, -1.000e-07, -2.140e-06,\n -4.5896902, 0.0157490, 1.000e-06,\n 327.1010132, 15.0046358, 0.000e-00,\n 0.5530010, -0.0001245, -1.110e-05,\n 0.0068290, -0.0001239, -1.100e-05,\n 0.0046653, 0.0046421,\n// 80 9 2\n1750523.007658, 12.0, -4.0, 4.0, 9738.6, 9738.6,\n -0.3381100, 0.5425843, -1.230e-05, -8.460e-06,\n -0.7710550, -0.1615313, -5.700e-06, 2.420e-06,\n 8.6244297, -0.0150770, -2.000e-06,\n 0.3400800, 15.0039482, 0.000e-00,\n 0.5415390, 0.0001073, -1.220e-05,\n -0.0045760, 0.0001067, -1.210e-05,\n 0.0046739, 0.0046506,\n// 81 2 27\n1750701.113570, 15.0, -4.0, 4.0, 9733.9, 9733.9,\n 0.1282950, 0.4901919, -8.900e-06, -5.670e-06,\n 0.0604460, 0.1434967, 5.080e-05, -1.590e-06,\n -8.7863197, 0.0151200, 2.000e-06,\n 41.3161812, 15.0036850, 0.000e-00,\n 0.5675720, -0.0000771, -1.000e-05,\n 0.0213270, -0.0000767, -1.000e-05,\n 0.0046813, 0.0046580,\n// 81 8 23\n1750877.663876, 4.0, -4.0, 4.0, 9729.2, 9729.2,\n 0.0111570, 0.5645813, -2.330e-05, -9.630e-06,\n -0.1116520, -0.1479229, -7.280e-05, 2.430e-06,\n 12.3930998, -0.0138210, -3.000e-06,\n 239.7539673, 15.0033083, 0.000e-00,\n 0.5334280, 0.0000124, -1.290e-05,\n -0.0126460, 0.0000124, -1.290e-05,\n 0.0046590, 0.0046358,\n// 82 2 16\n1751055.104457, 15.0, -4.0, 4.0, 9724.5, 9724.5,\n 0.4137790, 0.4898362, -3.810e-05, -5.500e-06,\n -0.6119060, 0.1253557, 9.640e-05, -1.350e-06,\n -12.8052502, 0.0139260, 3.000e-06,\n 40.8169594, 15.0023899, 0.000e-00,\n 0.5710600, 0.0000208, -9.900e-06,\n 0.0247990, 0.0000207, -9.800e-06,\n 0.0046972, 0.0046738,\n// 82 8 12\n1751232.346015, 20.0, -4.0, 4.0, 9719.9, 9719.9,\n -0.0383270, 0.5593930, -1.000e-05, -9.000e-06,\n 0.6425110, -0.1218114, -1.412e-04, 1.860e-06,\n 15.7807503, -0.0121590, -3.000e-06,\n 119.3833237, 15.0023737, 0.000e-00,\n 0.5374780, -0.0000743, -1.240e-05,\n -0.0086170, -0.0000739, -1.230e-05,\n 0.0046452, 0.0046221,\n// 83 1 7\n1751379.599335, 2.0, -4.0, 4.0, 9715.9, 9715.9,\n -0.2425490, 0.5444649, -1.100e-05, -7.590e-06,\n 1.4769440, 0.0122245, 8.860e-05, -5.000e-08,\n -22.7739906, 0.0048960, 6.000e-06,\n 207.5325165, 14.9969883, 0.000e-00,\n 0.5544930, 0.0001282, -1.150e-05,\n 0.0083140, 0.0001276, -1.140e-05,\n 0.0047440, 0.0047203,\n// 83 2 5\n1751409.196419, 17.0, -4.0, 4.0, 9715.2, 9715.2,\n 0.4260430, 0.5167810, -5.470e-05, -6.560e-06,\n -1.3087630, 0.1074552, 1.554e-04, -1.320e-06,\n -16.3852100, 0.0121630, 4.000e-06,\n 70.7068100, 15.0008965, 0.000e-00,\n 0.5610630, 0.0001020, -1.070e-05,\n 0.0148500, 0.0001015, -1.070e-05,\n 0.0047119, 0.0046884,\n// 83 7 3\n1751557.365622, 21.0, -4.0, 4.0, 9711.2, 9711.2,\n 0.1600260, 0.5243533, 1.360e-05, -6.530e-06,\n -1.3146420, 0.0166648, -9.670e-05, -2.900e-07,\n 23.4016609, -0.0026600, -6.000e-06,\n 135.2153320, 14.9991159, 0.000e-00,\n 0.5565240, -0.0001068, -1.040e-05,\n 0.0103350, -0.0001063, -1.030e-05,\n 0.0046056, 0.0045827,\n// 83 8 2\n1751586.862003, 9.0, -4.0, 4.0, 9710.5, 9710.5,\n 0.3967530, 0.5341346, -2.080e-05, -7.300e-06,\n 1.3681639, -0.0881941, -1.879e-04, 1.100e-06,\n 18.7086296, -0.0100760, -4.000e-06,\n 314.2698975, 15.0012703, 0.000e-00,\n 0.5505030, -0.0001235, -1.110e-05,\n 0.0043440, -0.0001229, -1.100e-05,\n 0.0046325, 0.0046095,\n// 83 12 27\n1751734.111071, 15.0, -4.0, 4.0, 9706.6, 9706.6,\n 0.2380840, 0.5737751, -1.140e-05, -9.360e-06,\n 0.7301370, -0.0356869, 1.382e-04, 7.100e-07,\n -23.6033306, 0.0015930, 6.000e-06,\n 43.7841492, 14.9963579, 0.000e-00,\n 0.5416100, 0.0000625, -1.280e-05,\n -0.0045060, 0.0000622, -1.270e-05,\n 0.0047512, 0.0047275,\n// 84 6 21\n1751911.468113, 23.0, -4.0, 4.0, 9701.9, 9701.9,\n -0.0504770, 0.5026544, 2.140e-05, -5.630e-06,\n -0.5964280, 0.0582853, -1.247e-04, -7.600e-07,\n 23.6702900, 0.0004730, -6.000e-06,\n 165.8379669, 14.9989958, 0.000e-00,\n 0.5653460, -0.0000153, -9.700e-06,\n 0.0191130, -0.0000153, -9.600e-06,\n 0.0046000, 0.0045771,\n// 84 12 16\n1752088.761524, 6.0, -4.0, 4.0, 9697.2, 9697.2,\n -0.1489960, 0.5754910, 3.850e-05, -9.720e-06,\n 0.0925750, -0.0848193, 1.741e-04, 1.580e-06,\n -23.5394402, -0.0017930, 6.000e-06,\n 270.1206055, 14.9963102, 0.000e-00,\n 0.5390370, -0.0000232, -1.310e-05,\n -0.0070650, -0.0000231, -1.300e-05,\n 0.0047561, 0.0047324,\n// 85 6 11\n1752265.506938, 0.0, -4.0, 4.0, 9692.5, 9692.5,\n -0.1196820, 0.5048669, 2.170e-05, -5.930e-06,\n 0.1625680, 0.1003398, -1.515e-04, -1.300e-06,\n 23.0727291, 0.0035660, -5.000e-06,\n 181.4095764, 14.9994440, 0.000e-00,\n 0.5610170, 0.0000807, -1.000e-05,\n 0.0148050, 0.0000803, -9.900e-06,\n 0.0045965, 0.0045736,\n// 85 12 5\n1752443.354816, 21.0, -4.0, 4.0, 9687.8, 9687.8,\n 0.1253320, 0.5457766, 4.900e-05, -8.220e-06,\n -0.6656310, -0.1252498, 1.942e-04, 2.060e-06,\n -22.5890808, -0.0051060, 6.000e-06,\n 136.3946228, 14.9968252, 0.000e-00,\n 0.5486500, -0.0001222, -1.210e-05,\n 0.0024990, -0.0001216, -1.210e-05,\n 0.0047588, 0.0047351,\n// 86 5 31\n1752619.773460, 7.0, -4.0, 4.0, 9683.2, 9683.2,\n -0.0201850, 0.5252439, 2.330e-05, -7.240e-06,\n 0.9695440, 0.1445320, -1.867e-04, -2.110e-06,\n 21.6827297, 0.0063860, -5.000e-06,\n 286.7860718, 15.0003376, 0.000e-00,\n 0.5471040, 0.0001095, -1.110e-05,\n 0.0009620, 0.0001090, -1.110e-05,\n 0.0045955, 0.0045727,\n// 86 11 25\n1752797.709264, 5.0, -4.0, 4.0, 9678.5, 9678.5,\n -0.4155400, 0.5024886, 7.600e-05, -6.270e-06,\n -1.3033630, -0.1554723, 1.882e-04, 2.120e-06,\n -20.7422009, -0.0082350, 5.000e-06,\n 257.4657288, 14.9978628, 0.000e-00,\n 0.5644640, -0.0001093, -1.070e-05,\n 0.0182350, -0.0001088, -1.070e-05,\n 0.0047587, 0.0047350,\n// 87 4 21\n1752945.036194, 13.0, -4.0, 4.0, 9674.6, 9674.6,\n 0.4662750, 0.5210880, 2.000e-06, -8.730e-06,\n -0.7604800, 0.2608436, -2.240e-05, -4.570e-06,\n 11.1261501, 0.0137500, -2.000e-06,\n 15.7620001, 15.0042677, 0.000e-00,\n 0.5315620, 0.0000266, -1.280e-05,\n -0.0145030, 0.0000264, -1.270e-05,\n 0.0046152, 0.0045923,\n// 87 10 15\n1753121.971853, 11.0, -4.0, 4.0, 9669.9, 9669.9,\n 0.3023400, 0.4448073, 5.000e-06, -4.870e-06,\n 0.9146260, -0.2371937, 7.100e-06, 2.770e-06,\n -7.9820900, -0.0154140, 2.000e-06,\n 348.1339417, 15.0029345, 0.000e-00,\n 0.5735330, 0.0000353, -9.900e-06,\n 0.0272590, 0.0000351, -9.800e-06,\n 0.0047307, 0.0047071,\n// 88 4 10\n1753299.743548, 6.0, -4.0, 4.0, 9665.2, 9665.2,\n 0.1564130, 0.5082910, 2.340e-05, -8.260e-06,\n -0.1024290, 0.2729570, -3.120e-05, -4.630e-06,\n 7.3489099, 0.0147840, -2.000e-06,\n 269.9133606, 15.0048656, 0.000e-00,\n 0.5345590, -0.0000744, -1.260e-05,\n -0.0115210, -0.0000740, -1.250e-05,\n 0.0046258, 0.0046028,\n// 88 10 3\n1753476.033866, 13.0, -4.0, 4.0, 9660.5, 9660.5,\n 0.1957010, 0.4583149, -1.290e-05, -5.630e-06,\n 0.1491930, -0.2556092, 1.860e-05, 3.330e-06,\n -3.6018500, -0.0159880, 1.000e-06,\n 17.5228500, 15.0037737, 0.000e-00,\n 0.5627240, 0.0001074, -1.060e-05,\n 0.0165030, 0.0001069, -1.060e-05,\n 0.0047170, 0.0046935,\n// 89 3 30\n1753654.312013, 19.0, -4.0, 4.0, 9655.9, 9655.9,\n -0.5258000, 0.4786328, 5.010e-05, -6.640e-06,\n 0.3949990, 0.2663059, -2.990e-05, -3.900e-06,\n 3.2883000, 0.0154590, -1.000e-06,\n 103.9343872, 15.0050812, 0.000e-00,\n 0.5479660, -0.0001116, -1.140e-05,\n 0.0018190, -0.0001111, -1.130e-05,\n 0.0046388, 0.0046157,\n// 89 9 22\n1753830.396712, 22.0, -4.0, 4.0, 9651.2, 9651.2,\n -0.0115510, 0.4870227, -1.570e-05, -7.190e-06,\n -0.5664430, -0.2738670, 3.110e-05, 4.230e-06,\n 0.7497000, -0.0160110, 0.000e-00,\n 151.7673340, 15.0042133, 0.000e-00,\n 0.5463160, 0.0001032, -1.200e-05,\n 0.0001770, 0.0001026, -1.190e-05,\n 0.0047021, 0.0046787,\n// 90 2 18\n1753978.914355, 10.0, -4.0, 4.0, 9647.3, 9647.3,\n 0.6928600, 0.4548790, -5.270e-05, -5.060e-06,\n -1.3534271, 0.2223751, 1.206e-04, -2.630e-06,\n -12.1664495, 0.0139380, 2.000e-06,\n 325.8775330, 15.0025358, 0.000e-00,\n 0.5705510, -0.0000461, -9.900e-06,\n 0.0242920, -0.0000458, -9.800e-06,\n 0.0046949, 0.0046715,\n// 90 3 20\n1754008.589809, 2.0, -4.0, 4.0, 9646.5, 9646.5,\n -0.7524340, 0.4506509, 4.030e-05, -5.260e-06,\n 1.1830890, 0.2516351, -3.920e-05, -3.130e-06,\n -0.9847300, 0.0157190, 0.000e-00,\n 207.9086304, 15.0049019, 0.000e-00,\n 0.5633710, -0.0000860, -1.020e-05,\n 0.0171480, -0.0000856, -1.010e-05,\n 0.0046536, 0.0046304,\n// 90 8 14\n1754155.664003, 4.0, -4.0, 4.0, 9642.6, 9642.6,\n 0.5962460, 0.5345642, -7.390e-05, -9.030e-06,\n 1.2663790, -0.2345150, -1.692e-04, 4.140e-06,\n 15.3580799, -0.0121410, -3.000e-06,\n 239.4182892, 15.0024500, 0.000e-00,\n 0.5327870, -0.0000170, -1.290e-05,\n -0.0132840, -0.0000169, -1.280e-05,\n 0.0046465, 0.0046233,\n// 90 9 12\n1754185.009733, 12.0, -4.0, 4.0, 9641.8, 9641.8,\n -0.6820610, 0.5102613, 1.770e-05, -8.520e-06,\n -0.9625200, -0.2794619, 2.930e-05, 4.860e-06,\n 4.9724102, -0.0155730, -1.000e-06,\n 0.9887800, 15.0042295, 0.000e-00,\n 0.5354960, 0.0000435, -1.290e-05,\n -0.0105880, 0.0000433, -1.290e-05,\n 0.0046869, 0.0046635,\n// 91 2 7\n1754332.897725, 10.0, -4.0, 4.0, 9637.9, 9637.9,\n 0.5395280, 0.4671043, -6.760e-05, -5.290e-06,\n -0.6595910, 0.2033500, 1.135e-04, -2.470e-06,\n -15.8527098, 0.0122580, 3.000e-06,\n 325.6979370, 15.0010281, 0.000e-00,\n 0.5698930, 0.0000493, -1.000e-05,\n 0.0236370, 0.0000490, -1.000e-05,\n 0.0047101, 0.0046867,\n// 91 8 3\n1754510.322290, 20.0, -4.0, 4.0, 9633.3, 9633.3,\n 0.3950920, 0.5276768, -4.960e-05, -8.090e-06,\n 0.6149040, -0.2016107, -1.513e-04, 3.250e-06,\n 18.3274097, -0.0101380, -4.000e-06,\n 119.2648392, 15.0014086, 0.000e-00,\n 0.5401260, -0.0001063, -1.210e-05,\n -0.0059810, -0.0001057, -1.200e-05,\n 0.0046336, 0.0046105,\n// 92 1 27\n1754687.061201, 13.0, -4.0, 4.0, 9628.6, 9628.6,\n -0.2085140, 0.5041690, -5.260e-05, -6.680e-06,\n -0.1625670, 0.1851514, 1.218e-04, -2.630e-06,\n -18.9631500, 0.0100110, 5.000e-06,\n 10.9604197, 14.9994669, 0.000e-00,\n 0.5571950, 0.0001273, -1.110e-05,\n 0.0110030, 0.0001267, -1.110e-05,\n 0.0047235, 0.0047000,\n// 92 7 23\n1754864.766107, 6.0, -4.0, 4.0, 9623.9, 9623.9,\n -0.2064410, 0.5074441, -1.600e-05, -6.510e-06,\n 0.0284040, -0.1584920, -1.322e-04, 2.180e-06,\n 20.7683201, -0.0077230, -5.000e-06,\n 269.3822937, 15.0003290, 0.000e-00,\n 0.5544540, -0.0001024, -1.070e-05,\n 0.0082750, -0.0001019, -1.060e-05,\n 0.0046225, 0.0045994,\n// 93 1 16\n1755041.522594, 1.0, -4.0, 4.0, 9619.3, 9619.3,\n 0.0769690, 0.5467121, -5.880e-05, -8.620e-06,\n 0.6683910, 0.1592019, 1.108e-04, -2.680e-06,\n -21.3192406, 0.0073350, 5.000e-06,\n 191.6360016, 14.9980659, 0.000e-00,\n 0.5432010, 0.0000767, -1.250e-05,\n -0.0029230, 0.0000763, -1.240e-05,\n 0.0047348, 0.0047112,\n// 93 7 12\n1755218.914073, 10.0, -4.0, 4.0, 9614.6, 9614.6,\n -0.1551430, 0.4944543, -1.990e-05, -5.580e-06,\n -0.8032400, -0.1154932, -1.065e-04, 1.430e-06,\n 22.5427399, -0.0049170, -5.000e-06,\n 329.7610168, 14.9994516, 0.000e-00,\n 0.5651550, -0.0000416, -9.800e-06,\n 0.0189220, -0.0000414, -9.700e-06,\n 0.0046128, 0.0045898,\n// 93 12 7\n1755366.720517, 5.0, -4.0, 4.0, 9610.7, 9610.7,\n -0.1995130, 0.5781965, 2.270e-05, -9.610e-06,\n -1.4079560, -0.0126165, 2.516e-04, 1.200e-07,\n -22.7595596, -0.0049460, 6.000e-06,\n 256.2430115, 14.9968033, 0.000e-00,\n 0.5406910, -0.0000508, -1.290e-05,\n -0.0054200, -0.0000505, -1.290e-05,\n 0.0047582, 0.0047345,\n// 94 1 5\n1755396.163219, 16.0, -4.0, 4.0, 9609.9, 9609.9,\n -0.2102310, 0.5705442, -2.190e-05, -9.670e-06,\n 1.2512480, 0.1183307, 9.860e-05, -2.170e-06,\n -22.8971004, 0.0043020, 6.000e-06,\n 57.6573181, 14.9969568, 0.000e-00,\n 0.5378130, -0.0000090, -1.310e-05,\n -0.0082840, -0.0000089, -1.310e-05,\n 0.0047443, 0.0047206,\n// 94 6 1\n1755543.369116, 21.0, -4.0, 4.0, 9606.1, 9606.1,\n -0.0050710, 0.5209853, -4.400e-06, -6.390e-06,\n 1.2480119, 0.0328998, -1.942e-04, -3.000e-07,\n 21.9388008, 0.0062240, -5.000e-06,\n 136.7379456, 15.0001793, 0.000e-00,\n 0.5576040, 0.0000935, -1.020e-05,\n 0.0114100, 0.0000931, -1.020e-05,\n 0.0045959, 0.0045730,\n// 94 7 1\n1755572.935839, 10.0, -4.0, 4.0, 9605.3, 9605.3,\n -0.4609350, 0.5043404, -1.360e-05, -5.780e-06,\n -1.5052520, -0.0748881, -8.670e-05, 9.500e-07,\n 23.5185795, -0.0018360, -6.000e-06,\n 330.3193359, 14.9990129, 0.000e-00,\n 0.5634670, 0.0000693, -9.800e-06,\n 0.0172430, 0.0000690, -9.800e-06,\n 0.0046046, 0.0045816,\n// 94 11 26\n1755721.262969, 18.0, -4.0, 4.0, 9601.4, 9601.4,\n -0.2446220, 0.5477648, 4.280e-05, -7.850e-06,\n -0.7689480, -0.0518382, 1.834e-04, 6.800e-07,\n -21.0644207, -0.0080410, 5.000e-06,\n 92.3304291, 14.9977913, 0.000e-00,\n 0.5531060, -0.0001120, -1.170e-05,\n 0.0069340, -0.0001114, -1.170e-05,\n 0.0047583, 0.0047346,\n// 95 5 22\n1755897.720769, 5.0, -4.0, 4.0, 9596.7, 9596.7,\n -0.2188040, 0.5496174, 1.060e-05, -8.030e-06,\n 0.3992830, 0.0716519, -1.540e-04, -9.500e-07,\n 19.9339294, 0.0087960, -4.000e-06,\n 256.9008179, 15.0013189, 0.000e-00,\n 0.5428510, 0.0001221, -1.150e-05,\n -0.0032700, 0.0001215, -1.150e-05,\n 0.0045971, 0.0045742,\n// 95 11 16\n1756075.529898, 1.0, -4.0, 4.0, 9592.0, 9592.0,\n 0.1269180, 0.5104743, 2.840e-05, -6.130e-06,\n -0.1295660, -0.0829906, 1.204e-04, 9.300e-07,\n -18.5364609, -0.0107900, 5.000e-06,\n 198.1007843, 14.9991293, 0.000e-00,\n 0.5684700, -0.0000986, -1.040e-05,\n 0.0222210, -0.0000981, -1.040e-05,\n 0.0047557, 0.0047320,\n// 96 5 10\n1756252.338216, 20.0, -4.0, 4.0, 9587.4, 9587.4,\n -0.0031780, 0.5700342, 1.420e-05, -9.530e-06,\n -0.3487340, 0.1079181, -9.700e-05, -1.720e-06,\n 17.3566093, 0.0109500, -4.000e-06,\n 121.7714310, 15.0025082, 0.000e-00,\n 0.5319440, 0.0000545, -1.260e-05,\n -0.0141230, 0.0000543, -1.260e-05,\n 0.0046008, 0.0045779,\n// 96 11 4\n1756429.530559, 1.0, -4.0, 4.0, 9582.7, 9582.7,\n 0.2579450, 0.4908096, 1.050e-05, -5.440e-06,\n 0.5403530, -0.1094933, 6.970e-05, 1.150e-06,\n -15.2418003, -0.0130600, 4.000e-06,\n 198.4779663, 15.0006542, 0.000e-00,\n 0.5752080, -0.0000023, -9.900e-06,\n 0.0289250, -0.0000023, -9.800e-06,\n 0.0047495, 0.0047258,\n// 97 4 1\n1756577.731869, 6.0, -4.0, 4.0, 9578.8, 9578.8,\n -0.2190610, 0.5426674, 3.340e-05, -8.620e-06,\n 1.4845710, 0.1753128, -9.710e-05, -2.740e-06,\n 3.8725100, 0.0156060, -1.000e-06,\n 269.0757446, 15.0052137, 0.000e-00,\n 0.5378390, -0.0001034, -1.230e-05,\n -0.0082570, -0.0001029, -1.220e-05,\n 0.0046366, 0.0046135,\n// 97 4 30\n1756607.055424, 13.0, -4.0, 4.0, 9578.0, 9578.0,\n 0.0656030, 0.5644798, 2.390e-05, -9.470e-06,\n -1.0873801, 0.1364825, -2.750e-05, -2.200e-06,\n 14.2832003, 0.0127210, -3.000e-06,\n 16.3571701, 15.0035591, 0.000e-00,\n 0.5319670, -0.0000415, -1.270e-05,\n -0.0141000, -0.0000413, -1.260e-05,\n 0.0046075, 0.0045846,\n// 97 10 24\n1756783.537631, 1.0, -4.0, 4.0, 9573.4, 9573.4,\n 0.3757850, 0.4992216, -1.110e-05, -5.990e-06,\n 1.1879770, -0.1360842, 2.220e-05, 1.580e-06,\n -11.4010601, -0.0147120, 3.000e-06,\n 198.4346161, 15.0021162, 0.000e-00,\n 0.5673520, 0.0000954, -1.040e-05,\n 0.0211080, 0.0000950, -1.030e-05,\n 0.0047397, 0.0047161,\n// 98 3 21\n1756932.227434, 17.0, -4.0, 4.0, 9569.5, 9569.5,\n -0.4819590, 0.5113708, 3.690e-05, -6.830e-06,\n 0.6854130, 0.1662337, -2.310e-05, -2.170e-06,\n -0.3208400, 0.0159160, 0.000e-00,\n 73.0597229, 15.0050898, 0.000e-00,\n 0.5531340, -0.0001123, -1.100e-05,\n 0.0069610, -0.0001118, -1.090e-05,\n 0.0046509, 0.0046278,\n// 98 9 13\n1757108.343422, 20.0, -4.0, 4.0, 9564.9, 9564.9,\n -0.3954540, 0.5406694, -1.600e-06, -8.500e-06,\n -0.7856650, -0.1728571, 2.160e-05, 2.620e-06,\n 4.4265699, -0.0159080, -1.000e-06,\n 121.0907974, 15.0043325, 0.000e-00,\n 0.5416490, 0.0001054, -1.230e-05,\n -0.0044660, 0.0001049, -1.220e-05,\n 0.0046888, 0.0046655,\n// 99 3 10\n1757286.415685, 22.0, -4.0, 4.0, 9560.2, 9560.2,\n -0.0093370, 0.4863868, 1.600e-06, -5.590e-06,\n 0.0696240, 0.1532170, 2.610e-05, -1.700e-06,\n -4.6254902, 0.0157710, 1.000e-06,\n 147.0865936, 15.0045528, 0.000e-00,\n 0.5671790, -0.0000668, -1.000e-05,\n 0.0209360, -0.0000664, -9.900e-06,\n 0.0046666, 0.0046433,\n// 99 9 3\n1757462.999480, 12.0, -4.0, 4.0, 9555.5, 9555.5,\n -0.0352120, 0.5595322, -1.480e-05, -9.540e-06,\n -0.1442400, -0.1660665, -4.460e-05, 2.740e-06,\n 8.4751101, -0.0151000, -2.000e-06,\n 0.3657000, 15.0040178, 0.000e-00,\n 0.5341410, 0.0000078, -1.300e-05,\n -0.0119370, 0.0000078, -1.290e-05,\n 0.0046736, 0.0046503,\n// 100 2 27\n1757640.409833, 22.0, -4.0, 4.0, 9550.8, 9550.8,\n 0.2633870, 0.4861132, -2.940e-05, -5.480e-06,\n -0.6052410, 0.1420664, 7.130e-05, -1.540e-06,\n -8.8987303, 0.0151000, 2.000e-06,\n 146.2949524, 15.0036316, 0.000e-00,\n 0.5698170, 0.0000329, -9.900e-06,\n 0.0235610, 0.0000327, -9.800e-06,\n 0.0046825, 0.0046592,\n// 100 8 23\n1757817.671005, 4.0, -4.0, 4.0, 9546.2, 9546.2,\n 0.0885860, 0.5518702, -1.380e-05, -8.800e-06,\n 0.5675470, -0.1458914, -1.123e-04, 2.230e-06,\n 12.2560396, -0.0138770, -3.000e-06,\n 239.7739258, 15.0033150, 0.000e-00,\n 0.5388780, -0.0000835, -1.240e-05,\n -0.0072240, -0.0000831, -1.230e-05,\n 0.0046593, 0.0046361\n));\n}", "null_basis(a0, v1, v2, v3, epsi) {\n let me = this.icn3dui\n let k, k0, spec\n let a11, a12, a13, a21, a22, a23, a31, a32, a33\n let b22, b23, b32, b33\n let q, t, mx0\n\n // initialization\n a11 = a0[0]\n a12 = a0[1]\n a13 = a0[2]\n a21 = a0[3]\n a22 = a0[4]\n a23 = a0[5]\n a31 = a0[6]\n a32 = a0[7]\n a33 = a0[8]\n\n // scale the matrix, so find the max entry\n mx0 = Math.abs(a11)\n if (Math.abs(a12) > mx0) mx0 = Math.abs(a12)\n if (Math.abs(a13) > mx0) mx0 = Math.abs(a13)\n if (Math.abs(a21) > mx0) mx0 = Math.abs(a21)\n if (Math.abs(a22) > mx0) mx0 = Math.abs(a22)\n if (Math.abs(a23) > mx0) mx0 = Math.abs(a23)\n if (Math.abs(a31) > mx0) mx0 = Math.abs(a31)\n if (Math.abs(a32) > mx0) mx0 = Math.abs(a32)\n if (Math.abs(a33) > mx0) mx0 = Math.abs(a33)\n\n if (mx0 < 1.0e-10) {\n // interpret this as the matrix of all 0's\n k0 = 3\n return {k: k0, v1: v1, v2: v2, v3: v3}\n }\n\n spec = 0\n a11 /= mx0\n a12 /= mx0\n a13 /= mx0\n a21 /= mx0\n a22 /= mx0\n a23 /= mx0\n a31 /= mx0\n a32 /= mx0\n a33 /= mx0\n\n if (Math.abs(a11) < epsi && Math.abs(a21) < epsi && Math.abs(a31) < epsi) {\n // let x1 is independent\n k = 1\n v1[0] = 1.0\n v1[1] = 0.0\n v1[2] = 0.0\n\n if (Math.abs(a12) < epsi && Math.abs(a22) < epsi && Math.abs(a32) < epsi) {\n // let x2 is independent\n k = 2\n v2[0] = 0.0\n v2[1] = 1.0\n v2[2] = 0.0\n\n if (Math.abs(a13) < epsi && Math.abs(a23) < epsi && Math.abs(a33) < epsi) {\n // let x3 is independent\n k = 3\n v3[0] = 0.0\n v3[1] = 0.0\n v3[2] = 1.0\n }\n\n // else, we must have x3 = 0.0, so we're done\n } else {\n // reorder so that a12 is maximized\n mx0 = Math.abs(a12)\n\n if (Math.abs(a22) > mx0) {\n // swap rows 1 and 2\n t = a11\n a11 = a21\n a21 = t\n t = a12\n a12 = a22\n a22 = t\n t = a13\n a13 = a23\n a23 = t\n mx0 = Math.abs(a12)\n }\n\n if (Math.abs(a32) > mx0) {\n // swap rows 1 and 3\n t = a11\n a11 = a31\n a31 = t\n t = a12\n a12 = a32\n a32 = t\n t = a13\n a13 = a33\n a33 = t\n }\n\n // let x2 is dependent, x2 = -a13/a12*x3\n b32 = a23 - (a22 * a13) / a12\n b33 = a33 - (a32 * a13) / a12\n\n if (Math.abs(b32) < epsi && Math.abs(b33) < epsi) {\n //* let x3 is independent\n k = 2\n v2[0] = 0.0\n v2[1] = -a13 / a12\n v2[2] = 1.0\n spec = 1\n }\n\n // else, we must have x3 = x2 = 0.0, so we're done\n }\n } else {\n // reorder so that a11 is maximized\n mx0 = Math.abs(a11)\n\n if (Math.abs(a12) > mx0) {\n // swap rows 1 and 2\n t = a11\n a11 = a21\n a21 = t\n t = a12\n a12 = a22\n a22 = t\n t = a13\n a13 = a23\n a23 = t\n mx0 = Math.abs(a11)\n }\n\n if (Math.abs(a13) > mx0) {\n // swap rows 1 and 3\n t = a11\n a11 = a31\n a31 = t\n t = a12\n a12 = a32\n a32 = t\n t = a13\n a13 = a33\n a33 = t\n }\n\n // let x1 is dependent, x1 = -a12/a11*x2 - a13/a11*x3\n b22 = a22 - (a21 * a12) / a11\n b23 = a23 - (a21 * a13) / a11\n b32 = a32 - (a31 * a12) / a11\n b33 = a33 - (a31 * a13) / a11\n\n if (Math.abs(b22) < epsi && Math.abs(b32) < epsi) {\n // let x2 is independent\n k = 1\n v1[0] = -a12 / a11\n v1[1] = 1.0\n v1[2] = 0.0\n\n if (Math.abs(b23) < epsi && Math.abs(b33) < epsi) {\n // let x3 is independent\n k = 2\n v2[0] = -a13 / a11\n v2[1] = 0.0\n v2[2] = 1.0\n spec = 2\n }\n\n // else, we must have x3 = 0.0, so we're done\n } else {\n // reorder so that b22 is maximized\n if (Math.abs(b22) < Math.abs(b32)) {\n t = b22\n b22 = b32\n b32 = t\n t = b23\n b23 = b33\n b33 = t\n }\n\n // let x2 is dependent, x2 = -b23/b22*x3\n if (Math.abs(b33 - (b23 * b32) / b22) < epsi) {\n // let x3 is independent\n k = 1\n v1[0] = (a12 / a11) * (b23 / b22) - a13 / a11\n v1[1] = -b23 / b22\n v1[2] = 1.0\n spec = 3\n } else {\n // the null space contains only the zero vector\n k0 = 0\n v1[0] = 0.0\n v1[1] = 0.0\n v1[2] = 0.0\n //return;\n return {k: k0, v1: v1, v2: v2, v3: v3}\n }\n }\n }\n\n k0 = k\n\n if (spec > 0) {\n // special cases, basis should be orthogonalized\n if (spec == 1) {\n // 2nd vector must be normalized\n a11 = v2[0]\n a12 = v2[1]\n a13 = v2[2]\n t = Math.sqrt(a11 * a11 + a12 * a12 + a13 * a13)\n v2[0] = a11 / t\n v2[1] = a12 / t\n v2[2] = a13 / t\n } else if (spec == 2) {\n // 1st, 2nd vectors must be orthogonalized\n a11 = v1[0]\n a12 = v1[1]\n a13 = v1[2]\n a21 = v2[0]\n a22 = v2[1]\n a23 = v2[2]\n t = a11 * a21 + a12 * a22 + a13 * a23\n\n if (Math.abs(t) >= epsi) {\n q = -(a11 * a11 + a12 * a12 + a13 * a13) / t\n v2[0] = a11 + t * a21\n v2[1] = a12 + t * a22\n v2[2] = a13 + t * a23\n a21 = v2[0]\n a22 = v2[1]\n a23 = v2[2]\n }\n\n // normalize the vectors\n t = Math.sqrt(a11 * a11 + a12 * a12 + a13 * a13)\n v1[0] = a11 / t\n v1[1] = a12 / t\n v1[2] = a13 / t\n t = Math.sqrt(a21 * a21 + a22 * a22 + a23 * a23)\n v2[0] = a21 / t\n v2[1] = a22 / t\n v2[2] = a23 / t\n } else {\n // 1st vector must be normalized\n a11 = v1[0]\n a12 = v1[1]\n a13 = v1[2]\n t = Math.sqrt(a11 * a11 + a12 * a12 + a13 * a13)\n v1[0] = a11 / t\n v1[1] = a12 / t\n v1[2] = a13 / t\n }\n }\n\n return {k: k0, v1: v1, v2: v2, v3: v3}\n }", "function earth_ecc(obs) {\n var T=(jd(obs)-2451545.0)/36525;\n var T2=T*T;\n var T3=T2*T;\n var e=0.016708617-0.000042037*T-0.0000001236*T2;\n return e;\n}", "_evol_CC(times) {\n\t if ( this.sfh == 'exp' )\n\t\treturn times.map(t => 1.-Math.exp(-t/this._tau_dep_SFH));\n\t else \n\t\treturn times.map(t => (1.-this._tau_dep_SFH/t\n\t\t\t\t *(1.-Math.exp(-t/this._tau_dep_SFH))));\n\t}", "fRn(){\n return 0.25*this.fm*this.b*this.Lbrg\n }", "wu_nc(){\n return (1.2*this.DL + 1.6*this.CL)*(this.Sj/12)\n }", "exponent() { return new Decimal(((Array.isArray(tmp.ma.mastered))?tmp.ma.mastered.includes(this.layer):false)?.008:.0075) }", "function getcoefs(curvename, numsteps) {\n let coefs = new Array(numsteps).fill(0);\n\n switch (curvename) {\n case \"CONCAVA\":\n coefs = coefs.map((coef, i) => {\n return (\n 4 -\n (12 * (i + 0.5)) / numsteps +\n (12 * (i + 0.5) * (i + 0.5)) / (numsteps * numsteps)\n );\n });\n break;\n case \"CONVEXA\":\n coefs = coefs.map((coef, i) => {\n return (\n 1 +\n (12 * (i + 0.5)) / numsteps -\n (12 * (i + 0.5) * (i + 0.5)) / (numsteps * numsteps)\n );\n });\n break;\n case \"CRECIENTE\":\n coefs = coefs.map((coef, i) => {\n return i;\n });\n break;\n case \"DECRECIENTE\":\n coefs = coefs.map((coef, i) => {\n return numsteps - 1 - i;\n });\n break;\n default:\n // CONSTANTE y otros\n coefs = coefs.map(() => {\n return 1.0;\n });\n }\n\n const areanorm = coefs.reduce((a, b) => a + b, 0);\n coefs = coefs.map(coef => coef / areanorm);\n\n return coefs;\n}", "function ResultadoInteresCompuestoConCap(C, i, r, n) {\n var x = (i / r); \n var y = (1 + x);\n var z = (C * y);\n var w = (n * r);\n var resultado = Math.pow(z, w); \n return resultado;\n}", "function geometricJacobian(mua){\n /*\n //example of usage: three-link planar arm\n //example from - REF: Robotics Modelling, Planning and Control, Page 143 (section 3.7.5)\n var ai = 500.0; //units mm\n var vi1 = Math.PI; //units radians\n var vi2 = -1.0*Math.PI/2.0;\n var vi3 = -1.0*Math.PI/2.0;\n var Links = [\n [ai, 0.0, 0.0, vi1],\n [ai, 0.0, 0.0, vi2],\n [ai, 0.0, 0.0, vi3]\n ];\n var Jaco = geometricJacobian(Links);\n console.log(Jaco);\n\n Jaco = \n [\n [[-500.0], [-500.0], [0.0]],\n [[ 0.0], [ 500.0], [500.0]],\n [[ 0.0], [ 0.0], [ 0.0]],\n [[ 0.0], [ 0.0], [ 0.0]],\n [[ 0.0], [ 0.0], [ 0.0]],\n [[ 1.0], [ 1.0], [ 1.0]]\n ]\n */\n \n // geometric Jacobian depends on:\n // - the manipulator configuration\n // - the frame in which the end-effector velocity is expressed\n \n /*\n - -\n - - |zi-1| for a prismatic joint\n |JPi| | 0|\n | | - -\n | | = Equ. 3.30\n | | - -\n |JOi| |zi-1 x (pe - pi-1)| for a revolute joint\n - - | zi-1|\n - -\n \n where:\n zi-1 = R0,1(q1)...Ri-2,i-1(qi-1)z0, z0 = [0 0 1]T Equ. 3.31\n pe~ = A0,1(q1)...An-1,n(qn)p0~, p0~ = [0 0 0 1]T Equ. 3.32\n pi-1~ = A0,1(q1)...Ai-2,i-1(qi-1)P0~ Equ. 3.33\n \n These equations are for the computation of the geometric Jacobian with respect to the base frame.\n \n REF: Robotics Modelling, Planning and Control, Page 112\n */\n \n var debug = 0;\n \n var Li = mua.DH;\n var n = Li.length;\n var jt = []; //joint type\n for(var i=1;i<=n;i=i+1) jt[i] = mua.jt[i-1];\n \n if(debug){\n var Ri_neg1i = \"R0,\" + n + \" = \"; //Ri-1,i for i = 1 o n, transforms a vector from frame {i} to frame {i-1} (base frame)\n for(var i=1;i<=n;i=i+1){\n Ri_neg1i = Ri_neg1i + \"R\" + (i-1) + \",\" + i;\n if(i != n) Ri_neg1i = Ri_neg1i + \" * \";\n }\n console.log(Ri_neg1i);\n }\n \n var J = []; //the Jacobian matrix\n var z0 = [[0.0],[0.0],[1.0]]; //Allows selection of the third column - (equ. 3.31).\n var p0 = [[0.0],[0.0],[0.0],[1.0]]; //Allows the selection of the fourth column - (equ. 3.32).\n //REF: Robotics Modelling, Planning and Control, page 112 .\n \n //calc. pe (Equ. 3.32 REF: Robotics Modelling, Planning and Control, Page 112)\n for(var i=0;i<n;i=i+1){ //for all links\n if(i == 0) var T0n = mcht.Aij(Li[i]);\n else T0n = hlao.matrix_multiplication(T0n,mcht.Aij(Li[i])); //Aij - transforms a vector from frame {j} to frame {i}\n } //T0n - transforms a vector from frame {n} (link n) to frame {0} (link 0)\n var pe = hlao.matrix_multiplication(T0n,p0);\n //only select the first three\n pe.pop();\n if(debug) console.log(pe);\n //console.log(pe);\n \n for(var j=1;j<=n;j=j+1){ //for all links (start at link i+1)\n //calc. Ai-1,i as the following is based on this calculation:\n // - zi-1\n // - pi-1\n \n var R0ineg1 = hlao.identity_matrix(3);\n var A0ineg1 = hlao.identity_matrix(4);\n \n for(var i=0;i<j;i=i+1){ //now look at link i\n if(i == 0) var T0n = mcht.Aij(Li[i]);\n else T0n = hlao.matrix_multiplication(T0n,mcht.Aij(Li[i])); //Aij - transforms a vector from frame {j} to frame {i}\n if(i == (j - 2)){ //T0n - transforms a vector from frame {n} (link n) to frame {0} (link 0)\n var R0ineg1 = [ //R0,i-1\n [T0n[0][0],T0n[0][1],T0n[0][2]],\n [T0n[1][0],T0n[1][1],T0n[1][2]],\n [T0n[2][0],T0n[2][1],T0n[2][2]]\n ];\n var A0ineg1 = T0n; //A0,i-1\n }\n } \n \n var zineg1 = hlao.matrix_multiplication(R0ineg1,z0); //zi-1 (Equ. 3.31 REF: Robotics Modelling, Planning and Control, Page 112)\n var pineg1 = hlao.matrix_multiplication(A0ineg1,p0); //pi-1 (Equ. 3.33 REF: Robotics Modelling, Planning and Control, Page 113)\n //console.log(j);\n //console.log(T0n);\n \n //only select the first three\n pineg1.pop();\n \n if(debug){\n console.log(zineg1);\n console.log(pineg1);\n }\n \n // - revolute\n if(jt[j].includes('R')){\n J[j-1] = hlao.vector_cross(zineg1,hlao.matrix_arithmetic(pe,pineg1,'-'));\n for(var i=0;i<3;i=i+1) J[j-1].push([zineg1[i][0]]);\n }\n // - prismatic\n if(jt[j].includes('P')){\n J[j-1] = zineg1;\n for(var i=0;i<3;i=i+1) J[j-1].push([0.0]);\n }\n if(debug) console.log(J[j-1]);\n }\n \n J = hlao.matrix_transpose(J);\n //if(debug) console.log(size(J));\n return J;\n}", "bouger()\r\n {\r\n this.gauche += Math.cos(this.angle) * this.vitesseX;\r\n this.haut += Math.sin(this.angle) * this.vitesseY;\r\n\r\n //Fonctions annexes\r\n this.limite();\r\n this.majHTML();\r\n }", "function e0fn(x){return(1.0-0.25*x*(1.0+x/16.0*(3.0+1.25*x)));}", "function teoremaPitagoras(){\n var a = 8;\n var b = 4;\n var c;\n //Formula para calcular teorema de pitagoras.\n console.log(\"Calculo de teorema de Pitagoras: \")\n console.log(c = (a*2) + (b*2));\n\n}", "function nutazione(njd){\n // calcola i parametri da utilizzare per la nutazione\n\n var T=(njd-2415020.0)/36525;\n\n var L=279.6967+36000.7689*T+0.000303*T*T;\n var L1=270.4342+481267.8831*T-0.001133*T*T;\n var M=358.4758+ 35999.0498*T-0.000150*T*T;\n var M1=296.1046+477198.8491*T+0.009192*T*T;\n var LN=259.1833-1934.1420*T+0.002078*T*T;\n\n var DELTA_FI=-(17.2327+0.01737*T)*Math.sin(Rad(LN))\n -(1.2729+0.000130*T)*Math.sin(Rad(2*L))\n +0.2088*Math.sin(Rad(2*LN))\n -0.2037*Math.sin(Rad(2*L1))\n +(0.1261-0.00031*T)*Math.sin(Rad(M))\n +0.0675*Math.sin(Rad(M1))\n -(0.0497-0.00012*T)*Math.sin(Rad(2*L+M))\n -0.0342*Math.sin(Rad(2*L1-LN))\n -0.0261*Math.sin(Rad(2*L1+M1))\n +0.0214*Math.sin(Rad(2*L-M))\n -0.0149*Math.sin(Rad(2*L-2*L1+M1))\n +0.0124*Math.sin(Rad(2*L-LN))\n +0.0114*Math.sin(Rad(2*L1-M1));\n\n var DELTA_EP=(9.2100+0.00091*T)*Math.cos(Rad(LN))\n +(0.5522-0.00029*T)*Math.cos(Rad(2*L))\n -0.0904*Math.cos(Rad(2*LN))\n +0.0884*Math.cos(Rad(2*L1))\n +0.0216*Math.cos(Rad(2*L+M))\n +0.0183*Math.cos(Rad(2*L1-LN))\n +0.0113*Math.cos(Rad(2*L1+M1))\n -0.0093*Math.cos(Rad(2*L-M))\n -0.0066*Math.cos(Rad(2*L-LN));\n\n\n\nvar parametri=new Array (DELTA_FI,DELTA_EP);\n\nreturn parametri;\n\n}", "Ec(){\r\n return 57*Math.pow(this.fc,0.5)\r\n }", "function getDiferencias(option){\r\n\tvar matriz=new Array();\r\n\tvar F=(2*n-3)+2; //Filas de la Matriz de Diferenciales\r\n\tvar C=(n-1);//Columnas de la Matriz de Diferenciales\r\n\tfor(var i=0;i<F;i++){\r\n\t\tmatriz[i]=new Array();\r\n\t\tfor(var j=0;j<C;j++){\r\n\t\t\tmatriz[i][j]=0;\r\n\t\t}\r\n\t}\r\n\r\n\tvar aux=0;\r\n\tfor(var j=0;j<C;j++){\r\n\t\taux=j;\r\n\t\tfor(var i=j+1;i<F-(j+1);i+=2){\r\n\t\t\tif(j==0){\r\n\t\t\t\tmatriz[i][j]=(ry[aux+1]-ry[aux]).toPrecision(pre);\r\n\t\t\t\taux++;\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tmatriz[i][j]=(matriz[aux+2][j-1]-matriz[aux][j-1]).toPrecision(1);\r\n\t\t\t\taux=aux+2;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tvar flag=true;\r\n\tstringRespuesta = \"<center> <h2>Esquema de Diferenciales Con Operador Central</h2><table border=1><tr>\";\r\n\tfor(var i=0;i<n-1;i++){\r\n\t\tif(i==0){\r\n\t\t\tstringRespuesta+=\"<td>n</td><td>x</td><td>y</td><td>&delta;^\"+(i+1)+\"</td>\";\r\n\t\t}\r\n\t\telse{\r\n\t\t\tstringRespuesta+=\"<td>&delta;^\"+(i+1)+\"</td>\";\r\n\t\t}\r\n\t}\r\n\tstringRespuesta+=\"</tr>\"\r\n\tvar c=0;\r\n\tfor(var i=0;i<F;i++){\r\n\r\n\t\tif(flag){\r\n\t\t\tstringRespuesta+=\"<tr><td>\"+c+\"</td><td>\"+rx[c]+\"</td><td>\"+ry[c]+\"</td>\";\r\n\t\t\tc++;\r\n\t\t\tflag=false;\r\n\t\t}\r\n\t\telse{\r\n\t\t\tstringRespuesta+=\"<tr><td></td><td></td><td></td>\";\r\n\t\t\tflag=true;\r\n\t\t}\r\n\t\tfor(var j=0;j<C;j++){\r\n\t\t\tstringRespuesta+=\"<td>\"+matriz[i][j]+\"</td>\";\r\n\t\t}\r\n\t\tstringRespuesta+=\"</tr>\";\r\n\r\n\t}\r\n\tstringRespuesta+=\"</table><br><br>\";\r\n\tswitch(option){\r\n\t\tcase 1:{gauss1(matriz);break;}\r\n\t\tcase 2:{gauss2(matriz);break;}\r\n\t\tcase 3:{everett(matriz);break;}\r\n\t\tcase 4:{steffensen(matriz);break;}\r\n\t\tcase 10:{operadorCentral(matriz);break;}\r\n\t\tcase 11:{segundaDerivada(matriz);break;}\r\n\t\tcase 12:{everettDer(matriz);break;}\r\n\t\tdefault:{break;}\r\n\r\n\t}\r\n}", "function hitungLuasSegiEmpat(sisi){\n //tidak ada nilai balik\n var luas = sisi * sisi\n return luas\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 }", "static get T() {\n return [\n [1, 0],\n [0, math.pow(math.e, (math.multiply(i, math.pi / 4)))]\n ];\n }", "solve() {\n for (let i = -this.x; i < this.x; i += 0.1) {\n this.values.cos.y.push(Math.cos(i));\n this.values.taylor.y.push(this.taylor(i));\n this.values.firstDerivative.y.push(this.firstDerivative(i));\n this.values.secondDerivative.y.push(this.secondDerivative(i));\n this.values.x.push(i);\n }\n }", "function elevadoCient(valor) {\n var numeroCient = document.getElementById(\"inputCient\").innerHTML;\n\n document.getElementById(\"inputCient\").innerHTML = Math.pow(numeroCient, valor);\n}", "function jesusSolve() {\n\n}", "function imc(peso,altura){\n var imc = peso/(altura*altura);\n return imc\n}", "oblivionFactor() {\n return Math.pow(2, - this.timestep / this.HALFTIME);\n }", "function moon_facts()\n{\n with (Math) {\n\n var dt_as_str, mm, yy, i, tmp, k, t;\n var M, M1, F, NM_FM, FQ_LQ, RAD = 180 / PI;\n var jd_temp, d_of_w, dow_str, zz, ff, alpha;\n var aa, bb, cc, dd, ee, calendar_day, month;\n var calendar_month, int_day, hours, minutes;\n\n moon_data = \"\";\n phase[0] = \"New Moon \";\n phase[1] = \"Moon at first quarter \";\n phase[2] = \"Full Moon \";\n phase[3] = \"Moon at last quarter \";\n\n dt_as_str = document.planets.date_txt.value;\n yy = eval(dt_as_str.substring(6,10));\n mm = eval(dt_as_str.substring(0,2));\n dd = eval(dt_as_str.substring(3,5));\n\n tmp = floor(((yy + (mm - 1) / 12 + dd / 365.25) - 1900.0) * 12.3685);\n\n for (i=0; i<4; i++)\n {\n k = tmp + i * 0.25;\n t = k / 1236.85;\n M = proper_ang(359.2242 + 29.10535608 * k - 0.0000333 * pow(t,2) - 0.00000347 * pow(t,3)) / RAD;\n M1 = proper_ang(306.0253 + 385.81691806 * k + 0.0107306 * pow(t,2) + 0.00001236 * pow(t,3)) / RAD;\n F = proper_ang(21.2964 + 390.67050646 * k - 0.0016528 * pow(t,2) - 0.00000239 * pow(t,3)) / RAD;\n NM_FM = (0.1734 - 0.000393 * t) * sin(M) + 0.0021 * sin(2 * M) - 0.4068 * sin(M1) + 0.0161 * sin(2 * M1) - 0.0004 * sin(3 * M1) + 0.0104 * sin(2 * F) - 0.0051 * sin(M + M1) - 0.0074 * sin(M - M1) + 0.0004 * sin(2 * F + M) - 0.0004 * sin(2 * F - M) - 0.0006 * sin(2 * F + M1) + 0.0010 * sin(2 * F - M1) + 0.0005 * sin(M + 2 * M1);\n FQ_LQ = (0.1721 - 0.0004 * t) * sin(M) + 0.0021 * sin(2 * M) - 0.628 * sin(M1) + 0.0089 * sin(2 * M1) - 0.0004 * sin(3 * M1) + 0.0079 * sin(2 * F) - 0.0119 * sin(M + M1) - 0.0047 * sin(M - M1) + 0.0003 * sin(2 * F + M) - 0.0004 * sin(2 * F - M) - 0.0006 * sin(2 * F + M1) + 0.0021 * sin(2 * F - M1) + 0.0003 * sin(M + 2 * M1) + 0.0004 * sin(M - 2 * M1) - 0.0003 * sin(2 * M + M1);\n phases[i] = 2415020.75933 + 29.53058868 * k + 0.0001178 * pow(t,2) - 0.000000155 * pow(t,3) + 0.00033 * sin(2.907 + 2.319 * t - 1.6e-4 * pow(t,2));\n if (i == 0 || i == 2) phases[i] += NM_FM;\n if (i == 1) phases[i] = phases[i] + FQ_LQ + 0.0028 - 0.0004 * cos(M) + 0.0003 * cos(M1);\n if (i == 3) phases[i] = phases[i] + FQ_LQ - 0.0028 + 0.0004 * cos(M) - 0.0003 * cos(M1);\n }\n new_moon = phases[0];\n\n for (i=0; i<4; i++)\n {\n jd_temp = phases[i] + 0.5;\n\n d_of_w = floor(jd_temp + 1.0) % 7;\n if (d_of_w == 0) dow_str = \"Sun.\";\n if (d_of_w == 1) dow_str = \"Mon.\";\n if (d_of_w == 2) dow_str = \"Tue.\";\n if (d_of_w == 3) dow_str = \"Wed.\";\n if (d_of_w == 4) dow_str = \"Thu.\";\n if (d_of_w == 5) dow_str = \"Fri.\";\n if (d_of_w == 6) dow_str = \"Sat.\";\n\n zz = floor(jd_temp);\n ff = jd_temp - zz;\n alpha = floor((zz - 1867216.25) / 36524.25);\n aa = zz + 1 + alpha - floor(alpha / 4);\n bb = aa + 1524;\n cc = floor((bb - 122.1) / 365.25);\n dd = floor(365.25 * cc);\n ee = floor((bb - dd) / 30.6001);\n calendar_day = bb - dd - floor(30.6001 * ee) + ff;\n calendar_month = ee;\n if (ee < 13.5) calendar_month = ee - 1;\n if (ee > 13.5) calendar_month = ee - 13;\n calendar_year = cc;\n if (calendar_month > 2.5) calendar_year = cc - 4716;\n if (calendar_month < 2.5) calendar_year = cc - 4715;\n int_day = floor(calendar_day);\n hours = (calendar_day - int_day) * 24;\n minutes = floor((hours - floor(hours)) * 60 + 0.5);\n hours = floor(hours);\n if (minutes > 59)\n {minutes = 0; hours = hours + 1;}\n if (hours < 10) hours = \"0\" + hours;\n if (minutes < 10) minutes = \"0\" + minutes;\n if (int_day < 10) int_day = \"0\" + int_day;\n\n if (calendar_month == 1) month = \"Jan.\";\n if (calendar_month == 2) month = \"Feb.\";\n if (calendar_month == 3) month = \"Mar.\";\n if (calendar_month == 4) month = \"Apr.\";\n if (calendar_month == 5) month = \"May \";\n if (calendar_month == 6) month = \"Jun.\";\n if (calendar_month == 7) month = \"Jul.\";\n if (calendar_month == 8) month = \"Aug.\";\n if (calendar_month == 9) month = \"Sep.\";\n if (calendar_month == 10) month = \"Oct.\";\n if (calendar_month == 11) month = \"Nov.\";\n if (calendar_month == 12) month = \"Dec.\";\n\n moon_data += dow_str + \" \" + month + \" \" + int_day + \", \" + calendar_year + \" \" + phase[i] + \"(\" + hours + \":\" + minutes + \" UT)\";\n\n if (i == 1 || i == 3)\n {\n moon_data += \"\\n\"\n }\n else\n {\n moon_data += \" \";\n }\n\n }\n\n }\n}", "calculate() {\n\treturn this.exercise.calculate(this.weight, this.distance, this.time);\n }", "function equationOfTime(jd)\n{\n var alpha, deltaPsi, E, epsilon, L0, tau\n\n tau = (jd - J2000) / JulianMillennium;\n//document.debug.log.value += \"equationOfTime. tau = \" + tau + \"\\n\";\n L0 = 280.4664567 + (360007.6982779 * tau) +\n (0.03032028 * tau * tau) +\n ((tau * tau * tau) / 49931) +\n (-((tau * tau * tau * tau) / 15300)) +\n (-((tau * tau * tau * tau * tau) / 2000000));\n//document.debug.log.value += \"L0 = \" + L0 + \"\\n\";\n L0 = fixangle(L0);\n//document.debug.log.value += \"L0 = \" + L0 + \"\\n\";\n alpha = sunpos(jd)[10];\n//document.debug.log.value += \"alpha = \" + alpha + \"\\n\";\n deltaPsi = nutation(jd)[0];\n//document.debug.log.value += \"deltaPsi = \" + deltaPsi + \"\\n\";\n epsilon = obliqeq(jd) + nutation(jd)[1];\n//document.debug.log.value += \"epsilon = \" + epsilon + \"\\n\";\n E = L0 + (-0.0057183) + (-alpha) + (deltaPsi * dcos(epsilon));\n//document.debug.log.value += \"E = \" + E + \"\\n\";\n E = E - 20.0 * (Math.floor(E / 20.0));\n//document.debug.log.value += \"Efixed = \" + E + \"\\n\";\n E = E / (24 * 60);\n//document.debug.log.value += \"Eday = \" + E + \"\\n\";\n\n return E;\n}", "exponent() { return new Decimal(((Array.isArray(tmp.ma.mastered))?tmp.ma.mastered.includes(this.layer):false)?.2:.125) }", "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 fnImc(){//peso entre la altura al cuadrado\n var wheight = $('#doubWeight').val();\n var height = $('#doubHeight').val();\n var imc = wheight / Math.pow(height,2);\n $(\"#doubTotal\").val(imc);\n }", "m(v) { return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2)); }", "function moyenne (n) {\n\tfor (var i = 0; i < n; i++) {\n\t\tnote = parseInt(prompt(\"Entrez vos notes\"));\n\t\tmoyenne_total = moyenne_total + note;\n\t\tmoyenne_general = moyenne_total/i;\n\t\t\n\t}\n\talert(\"Votre moyenne est de :\" + \" \"+ moyenne_general);\n}", "function Co(t,e){0}", "function elevar_al_cuadrado(numero)\n{\n return numero * numero;\n}", "function ca(a){this.c=Math.exp(Math.log(.5)/a);this.a=this.b=0}", "exponent() { return ((Array.isArray(tmp.ma.mastered))?tmp.ma.mastered.includes(this.layer):false)?new Decimal(1.4):new Decimal(1.85) }", "function eq_keplero(M,ecc_orbita){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) dicembre 2009\n // funzione per il calcolo dell'equazione di Keplero.\n // M= anomalia media in gradi sessadecimali.\n // ecc_orbita= eccentricità dell'orbita.\n // Math.abs restituisce il valore assoluto.\n\n M=M/180*Math.PI;\nvar E=M;\nvar E1=M;\nvar delta_E=1;\n\nwhile (delta_E>0.000000000001){\n\n E=E1;\n E1=M+ecc_orbita*Math.sin(E);\n\n delta_E=Math.abs(E-E1); // calcola il valore assoluto del numero.\n\n}\n\n var anomalia_vera1= Math.sqrt((1+ecc_orbita)/(1-ecc_orbita));\n var anomalia_vera2= anomalia_vera1*Math.tan(E/2);\n var anomalia_vera = 2*Math.atan(anomalia_vera2); // in radianti.\n\n var anomalie=new Array(E,anomalia_vera); // in radianti. \n\nreturn anomalie; \n\n}", "trace() {\n return this.$matrix.m11 + this.$matrix.m22 + this.$matrix.m33 + this.$matrix.m44;\n }", "function calculateResult(array) {\n let answer1 = array[0] * 12;\n let answerModified = turnToNumber(1);\n console.log(\"answerModified\", answerModified);\n let answer2 = (answer1 * answerModified) / 100 + answer1;\n console.log(\"answer2\", answer2);\n let terminalValue = answer2 * 2;\n console.log(\"treminalValue\", terminalValue);\n let postMV = terminalValue / 20;\n console.log(\"postMV\", postMV);\n let preMV = postMV - array[0];\n console.log(\"preMV\", preMV);\n let answerThreeModified = turnIndexToNumber(2);\n let answer3 = (answerThreeModified * 30) / 10000;\n console.log(\"answer3\", answer3);\n let answerFourModified = turnIndexToNumber(3);\n let answer4 = (answerFourModified * 25) / 10000;\n let answerFiveModified = turnIndexToNumber(4);\n let answer5 = (answerFiveModified * 15) / 10000;\n let answerSixModified = turnIndexToNumber(5);\n let answer6 = (answerSixModified * 10) / 10000;\n let answerSeventhModified = turnIndexToNumber(6);\n let answer7 = (answerSeventhModified * 10) / 10000;\n // //figure out how to make it prettier\n let answer81 = (answerSeventhModified * 100) / array[0];\n let answer8 = (answer81 * 5) / 10000;\n let answer9 = (array[8] * 5) / 10000;\n let sumOfFactors =\n answer3 + answer4 + answer5 + answer6 + answer7 + answer8 + answer9;\n let preFinalResult = sumOfFactors * preMV;\n //this is THE RESULT\n let finalResult = parseFloat(preFinalResult.toFixed(2));\n // console.log(\"sumOfFactors\", sumOfFactors)\n return finalResult;\n}", "UCB(c){\n //console.log(\"Victorias simulacion: \" + this.numVictoriasSimulacion + \"jugadas finales \" + this.numJugadasSimulacion + \"jugadas padre \" + this.padre.numJugadasSimulacion + \" jugadas simuladas \" + this.numJugadasSimulacion)\n return (this.numVictoriasSimulacion / this.numJugadasSimulacion) + c * Math.sqrt(Math.log(this.padre.numJugadasSimulacion) / this.numJugadasSimulacion)\n }", "function Ca(b) { this.c = Math.exp(Math.log(.5) / b); this.b = this.a = 0 }", "function ca(a){this.c=Math.exp(Math.log(.5)/a);this.b=this.a=0}", "function ca(a){this.c=Math.exp(Math.log(.5)/a);this.b=this.a=0}", "function Calsimulation (price,iva,interest,numfee){\n console.log(\"price :\",price,\" iva:\",iva,\" interes:\",interest,\" cuotas:\",numfee);\n var monthInterest=0, j=0, fee=0;\n if(interest > 0){\n monthInterest = (Math.pow((1+(interest/100)),(1/12))-1);\n console.log(\"cuota interes mensual:\", monthInterest);\n j = (monthInterest*(1+(iva/100)));\n console.log(\"valor j:\",j);\n fee =(price*((j*Math.pow((1+j),numfee))/(Math.pow((1+j),numfee)-1)));\n console.log(\"valor de la cuota: \", fee);\n return fee;\n } \n else if (interest == 0 )\n {\n fee=price/numfee;\n console.log(\"fee\",fee);\n return fee;\n }\n \n }" ]
[ "0.6165908", "0.59032685", "0.5873705", "0.5796195", "0.57925344", "0.5783441", "0.57514644", "0.5713553", "0.5702795", "0.56911266", "0.5604644", "0.55746", "0.55706394", "0.55626744", "0.554239", "0.5528351", "0.5527571", "0.55149704", "0.5494513", "0.5465213", "0.5457862", "0.5456239", "0.5442834", "0.54379886", "0.54287386", "0.54137105", "0.54065144", "0.54027927", "0.5393485", "0.5393236", "0.53848046", "0.53835857", "0.53752774", "0.5374499", "0.5369032", "0.5359345", "0.5347294", "0.53449863", "0.53372705", "0.5329066", "0.5321656", "0.53157145", "0.53154886", "0.5312988", "0.5306243", "0.5301611", "0.52992123", "0.5285962", "0.52559257", "0.5255863", "0.52550477", "0.5245327", "0.52450204", "0.52427757", "0.5238578", "0.523668", "0.5231928", "0.5229783", "0.5228467", "0.52085894", "0.52084136", "0.5205649", "0.520441", "0.51933455", "0.5175587", "0.51716995", "0.5170354", "0.5166848", "0.51668084", "0.51608646", "0.5151076", "0.5149819", "0.5148697", "0.51483023", "0.51454145", "0.51404834", "0.51397586", "0.51374835", "0.51294434", "0.5128491", "0.5127328", "0.5126782", "0.512577", "0.5120938", "0.5117612", "0.51162857", "0.5113561", "0.51100075", "0.50942296", "0.5090561", "0.50827914", "0.50811565", "0.5080241", "0.5078002", "0.50757515", "0.5075702", "0.507478", "0.50732934", "0.50732934", "0.50702405" ]
0.6571702
0
Method to load a random card (callable from any component)
loadRandomCard(currentCardId, a) { //document.getElementById(card.id).title = "test test test"; document.getElementById("frontface").style.display = "block"; //card.testest(); // Remove current card so we don't randomly select it const cards = this.get('cards').filter(card => card.id !== currentCardId) const card = cards[Math.floor(Math.random() * cards.length)] this.set({ currentCard: card.id, }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newRndCard() {\n $.getJSON('https://api.scryfall.com/cards/random?q=-type%3Aland+legal%3Alegacy+not%3Atoken+not%3Asplit+not%3Atransform', function (data) {\n saveCard(data);\n })\n }", "function newRandomCard() {\n currentCard = getRandomCard(cardList);\n // ignore transform and meld cards for now\n while (currentCard.layout == \"transform\" || currentCard.layout == \"meld\") {\n currentCard = getRandomCard(cardList);\n }\n displayCurrentCard(currentCard);\n displayDefaultText(currentCard);\n}", "function randomCard(){\n let randomIndex = Math.floor(Math.random()*13);\n return blackjackGame.cards[randomIndex];\n}", "getRandomCard (currentCards) {\n var card = currentCards[Math.floor(Math.random() * currentCards.length)];\n return (card);\n }", "function getCard() {\n const randomIndex = Math.floor(Math.random() * deck.length);\n let card = deck[randomIndex];\n return card;\n}", "function randomCard(){\n let randomIndex = Math.floor(Math.random()*13)\n return blackjackGame['cards'][randomIndex]\n}", "function selectRandomCard(cards) {\n const card = cards[ Math.floor(Math.random()*cards.length) ];\n if(card) return card;\n return null;\n}", "function randomCards() {\n let randomIndex = Math.floor(Math.random() * 13);\n return BlackJack['cards'][randomIndex];\n\n}", "function getCard() {\n return {\n value: VALUES[getRandom(VALUES)],\n suit: SUITS[getRandom(SUITS)]\n };\n}", "function pick(cards) {\n\treturn cards[Math.floor(Math.random()*cards.length)];\n }", "function randomCard() {\r\n var randCard = shuffledDeck.pop();\r\n return randCard;\r\n }", "function randomCard() {\n return getRandomCard(state).back;\n }", "draw(){\n let cardNumber = Math.round(Math.random() * 77);\n return this.cards[cardNumber];\n }", "function generate_card() {\n var card_pos = Math.floor(Math.random() * deck.length);\n var card = deck[card_pos];\n deck.splice(card_pos, 1); // Remove the card from deck\n scriptProperties.setProperty('Deck', JSON.stringify(deck)); // Save the updated deck to prevent duplicates\n return card;\n}", "function initializeCard() {\n var cardInfo = getStats();\n cardInfo.push(getRandomImage());\n cardInfo.push(getRandomName());\n enemyCards.push(cardInfo);\n}", "function addCardsObject(randomNumber) {\n return cards[randomNumber] = {\n id: randomNumber,\n elementId: `card_${randomNumber}`,\n img: `./img/${randomNumber}.jpg`,\n active: false\n }\n}", "componentWillMount() {\n if(!this.state.card) {\n this.getRandomCard();\n }\n }", "function selectRandom(cards){\n // we need an integer in [0,cards.length]\n index=Math.floor(Math.random()*cards.length); // multiply by cards.length and floor\n return cards[index]; // return card at that index\n}", "static load(){\n var suit = String();\n var value = String();\n \n // Loop 4 times, once for each suit\n for(let i = 1; i <= 4; i++){\n \n // Determine suit\n switch (i){\n case 1:\n suit = 'C';\n break;\n\n case 2:\n suit = 'D';\n break;\n\n case 3:\n suit = 'H';\n break;\n\n case 4:\n suit = 'S';\n break;\n\n default:\n }\n\n // Loop 13 times, once for each card for this suit\n for(let h = 1; h <= 13; h++){\n \n // Determine card number\n switch (h){\n case 1:\n value = 'A';\n break;\n \n case 11:\n value = 'J';\n break;\n \n case 12:\n value = 'Q';\n break;\n \n case 13:\n value = 'K';\n break;\n \n default:\n value = h;\n }\n }\n\n // Add this card to our deck\n let card = new Card(value, suit);\n this.deck.push(card);\n }\n\n return this;\n }", "function shuffleCard(cards){\n return cards[Math.floor(Math.random() * cards.length)];\n }", "loadCards(){\n let cards = require(\"C:\\\\Users\\\\Tony\\\\Desktop\\\\Programming\\\\Yugiosu\\\\Yugiosu - Python (Discord)\\\\yugiosu discord bot\\\\cogs\\\\Yugiosu\\\\cards.json\");\n for(let card of cards){\n this.cards[card[\"id\"]] = new Card(card['id'], card[\"name\"], card[\"cardtype\"], card[\"copies\"], card[\"description\"], card[\"properties\"]);\n }\n }", "function getCard() {\n\tvar i = Math.floor(Math.random() * cardsArray.length);\n\tvar c = cardsArray[i];\n\n\t// remove card from array, so that every card can be chosen only once\n\tcardsArray.splice(i, 1);\n\treturn c;\n}", "function getPlayerCard() {\n \n}", "componentWillMount() {\n this.randomizeCards();\n }", "function Card (seed) {\n\n this.rarita=seed%19;//rarita della carta\n this.name=getName(seed);//generazione nome carta\n this.tipo=getTypeImage(seed%3);//recupero simbolo del tipo\n this.attacco=1000+100*(seed%20);//calcolo attacco\n this.img=getImage(seed%3,this.rarita);//recupero illustrazione\n this.seed=seed;//seme carta\n}", "getNextCard() {\n // If the Deck is empty, null is returned.\n if (this.numCardsRemaining() == 0) {\n return null;\n }\n \n // Get a random value between 0 and the length of the array of Card objects minus 1. \n let randomCardIndex = Deck.getRandomInt(this.cards.length);\n // Use that random value as an index into the array of Card objects to get one random Card object.\n let card = this.cards[randomCardIndex];\n // Remove that Card object from the array of Card objercts.\n this.cards.splice(randomCardIndex, 1);\n // Return the Card object.\n return card;\n }", "function use_card(num_card)\n{\n\tthis.carte[num_card].use();\n}", "function getPlayerCards() {\n //Randomly select player cards\n var selectFirstPlayerCard = possibleCards[Math.floor(Math.random() * possibleCards.length)];\n var selectSecondPlayerCard = possibleCards[Math.floor(Math.random() * possibleCards.length)];\n //Display player cards in document\n document.getElementById('card1').innerHTML = selectFirstPlayerCard;\n document.getElementById('card2').innerHTML = selectSecondPlayerCard;\n }", "function getRandomCard() {\n var deck = 'A23456789TJQK';\n return deck[Math.floor(Math.random() * (12 - 0 + 1))];\n}", "randomPlayerCard () {\n return Math.floor(Math.random() * this.cardsInDeck.length)\n }", "function getCard() {\n getButton.style.transform = \"translate(3px, -3px)\";\n genRandomPair();\n cardDrawnContainer.style.background = \"none\";\n // console.log(randomCard);\n cardDrawnContainer.style.transform = \"scale(0.7)\";\n cardDrawnContainer.style.background = \"url('./files/my-order/\" + randomCard[0] + \"_of_\" + randomCard[1] + \".png') no-repeat 0 0\";\n hitMe();\n setTimeout(function () {\n getButton.style.transform = \"translate(-4px, 4px)\";\n }, 200);\n}", "function shuffleCards(){\n\tmemoryCards = shuffle(memoryCards);\n\tfor (var i=0; i < 12; i++){\n\t\tvar item = document.getElementById(i);\n\t\titem.src = card;\n\t}\n}", "function load() {\n shuffle();\n var shuffledDeck = deck.slice(0, 5);\n checkPoints(shuffledDeck);\n}", "function getRand(card) {\n return Math.random() * (card.length - 0) + 0;\n}", "function loadScrypt(_str)\n{\n clearAllFlashCards(\"cardWrapperMainStyle\");\n var _icons;\n switch (_str)\n {\n case \"ACTIONSCRIPT 3\":\n _str = \"AS3\";\n _icons = dlIcons;\n break;\n case \"ACTIONSCRIPT 2\":\n _str = \"AS2\";\n _icons = dlIcons;\n break;\n case \"JAVASCRIPT\":\n _str = \"JS\";\n _icons = dlIcons;\n break;\n case \"Creative Interface\":\n _str = \"ftEdu\";\n _icons = dlIcons;\n break;\n case \"HTML5\":\n _str = \"HTML5\";\n _icons = dlIcons;\n break;\n case \"watchHeader\":\n _cards = watchCards;\n _str = _currentScript;\n _icons = wlIcons;\n break;\n case \"tutHeader\":\n _cards = tutCards;\n _str = \"ftEdu\";\n _icons = dlIcons;\n break;\n }\n _currentScript = _str;\n console.log(_icons);\n for(var i = 0; i < _cards[_currentScript].length; i++)\n {\n _tutorialCard(\"tutorials\", _str, i, _icons);\n }\n}", "function getCard(card) {\n //Determine what the card is with if statement\n // If cloze then is cloze card\n if (card.type === 'Cloze') {\n var selection = new ClozeCard(card.fullText, card.cloze)\n // Have to return a specific part so that cardInPlay is a simple message\n return selection.partial()\n }\n else {\n var selection = new BasicCard(card.front, card.back)\n // Have to return a specific part so that cardInPlay is a simple message\n return selection.front\n }\n}", "populateDeck()\n {\n this.cards = [];\n //jack 11\n //queen 12\n //king 13\n //ace 14\n\n for (let i = 2; i < 15; i++)\n {\n let card = new Card(\"Spades\", i, `./assets/Playing Cards/Playing Cards (.SVG)/${i}_of_spades.svg`);\n this.cards.push(card);\n }\n\n for (let i = 2; i < 15; i++)\n {\n let card = new Card(\"Clubs\", i, `./assets/Playing Cards/Playing Cards (.SVG)/${i}_of_clubs.svg`);\n this.cards.push(card);\n }\n\n for (let i = 2; i < 15; i++)\n {\n let card = new Card(\"Hearts\", i, `./assets/Playing Cards/Playing Cards (.SVG)/${i}_of_hearts.svg`);\n this.cards.push(card);\n }\n\n for (let i = 2; i < 15; i++)\n {\n let card = new Card(\"Diamonds\", i, `./assets/Playing Cards/Playing Cards (.SVG)/${i}_of_diamonds.svg`);\n this.cards.push(card);\n }\n this.shuffleDeck();\n }", "function playACard(){\n const randomIdx = Math.floor(Math.random() * game.state.home.decks.length);\n const randomCard = game.state.home.decks[randomIdx];\n game.state.home.cards.push(randomCard);\n game.trigger('update');\n }", "function loadCard(card) {\n currentOpenCards.push(card);\n if (duplicates()) {\n currentOpenCards.pop();\n deck.addEventListener('click', flipCard);\n } else if (currentOpenCards.length === 1) {\n card.classList.add('open', 'show');\n } else if (currentOpenCards.length === 2) {\n card.classList.add('open', 'show');\n deck.removeEventListener('click', flipCard);\n checkForMatch(card);\n }\n}", "function getCard() {\n\t\tif (!localStorage) {\n\t\t\t// throw error\n\t\t}\n\t\tcardPile = JSON.parse(localStorage.getItem('cardPile'));\n\t\t\n\t\tif (cardPile && cardPile.length > 0) {\n\t\t\tif (config.cardFactor > Math.random()) {\n\t\t\t\tif((new Date()) > (new Date(cardPile[0].showNext))) {\n\t\t\t\t\treturn cardPile[0];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tdataPointer = localStorage.getItem('dataPointer');\n\t\tif (!dataPointer) {\n\t\t\tlocalStorage.setItem('dataPointer', 1);\n\t\t}\n\t\treturn datasource.next();\n\t}", "function loadCards() {\n\tfs.readFile(cardsFile, 'utf8', function(err, contents) {\n\t\tif (err) {\n\t\t\treturn console.log('Failed to read card tokens from disk: ' + err);\n\t\t}\n\t\ttry {\n\t\t\tcards = contents ? JSON.parse(contents) : {};\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log('Failed to parse card tokens data: ' + err);\n\t\t}\n\t});\n}", "function CardPicker() {\n var para = document.getElementById('CJ');\n var img = document.createElement('img');\n var path = randomOne(player_score, player_cards, \"texte2\");\n img.src = path;\n para.appendChild(img);\n if (player_score[0] > 21) {\n display_res(\"Vous avez perdu\");\n }\n}", "function getPlayerRandomCard() {\nlet plrandomNumber = Math.floor(Math.random() * 13) + 1\nif(plrandomNumber > 10){\n return 10\n} else if (plrandomNumber === 1) {\n return 11\n} else {\n return plrandomNumber\n}\n}", "draw(){\r\n this.hand = [];\r\n let cardNames = Object.keys(this.deck);\r\n let numCardsInDeck = cardNames.length;\r\n for (let i = 0; i < this.handSize ; i++){\r\n // Pick a random card from the deck\r\n let pick = cardNames[Math.floor(Math.random()*numCardsInDeck)];\r\n this.hand[i] = this.deck[pick];\r\n }\r\n }", "function dealRandomCard() {\n let deck = cards.slice(0);\n let shuffledDeck = shuffleDeck(deck);\n let randomCard = shuffledDeck.shift();\n let printed = printName(randomCard);\n return printed;\n}", "function dealCard(){\r\n \r\n cards.push(card[Math.floor(Math.random()*card.length)])\r\n}", "function drawRandomCard() {\n var drawnCard;\n var cardNum = Math.floor(Math.random() * deck.length);\n drawnCard = deck[cardNum];\n deleteCard(cardNum);\n return drawnCard;\n}", "function getNextCard(){\n let random = Math.trunc(Math.random() * deck.length);\n let card = deck[random];\n deck.splice(random, 1);\n return card;\n}", "function drawRandomCard(deck){\r\n\tvar rand = Math.floor(Math.random() * 52);\r\n\t\r\n\treturn deck[rand];\r\n}", "preload(){ \n for(let i = 0; i<10; i++){\n this.load.image(`card${i+1}`, `../static/Clovers_${i+1}_white.png`);\n }\n this.load.image(`back-card`, '../static/Clovers_King_black.png');\n }", "onLoadCardImage(){\n // console.log(\"load\", this.props.card.id);\n this.props.onLoadCardImage(this.props.card.id);\n }", "function genRandomPair() {\n randomCard = [Math.floor(Math.random() * 13) + 1, Math.floor(Math.random() * 4) + 1];\n}", "async function generateGameCards() {\n const nums = [...Array(10).keys()];\n nums.shift();\n nums.splice(4, 1);\n const random = Math.floor(Math.random() * nums.length);\n nums.splice(random, 0, 5);\n\n const template = document.getElementById('card-template');\n const output = document.getElementById('card');\n\n return nums.forEach((num) => {\n let clone = template.content.cloneNode(true);\n let img = clone.querySelector('.content img');\n img.src = img.src.replace('__value', num);\n output.appendChild(clone);\n });\n}", "randomShuffle() {\n const shuffled = [];\n const unshuffled = this.cards.slice();\n\n while (unshuffled.length > 0) {\n const randomCard = Math.floor(Math.random() * unshuffled.length);\n shuffled.push(unshuffled.splice(randomCard, 1)[0]);\n }\n\n this.cards = shuffled;\n }", "function generateCards(){\n shuffle(cardList.concat(cardList)).forEach(createCard);\n}", "function showCards() {\n scoore()\n let cardsRandomNumbers = []\n while (cardsRandomNumbers.length < cardsNumber) {\n const randomNumber = getRandomNumber()\n if (cardsRandomNumbers.length <= 0 || cardsRandomNumbers.indexOf(randomNumber) === -1) {\n cardsRandomNumbers.push(randomNumber)\n const card = addCardsObject(randomNumber)\n createElement(card.elementId, card.img)\n }\n }\n}", "function randomPokemon() {\n selector = Math.floor(Math.random()* 781) + 26 //Random number between 26 and 809\n getAPIData(`https://pokeapi.co/api/v2/pokemon/${selector}`).then((pokeData) => {\n populatePokeCards(pokeData)\n })\n}", "function randomUnoCard(cardnames, addorreplace, element, styles, ammount, player) {\n\tif (player === 1) {\n\t\tif (player1cardsArray.length > 8) {\n\t\t\tPID(\"player1cards\").style.padding = -1 * (player1cardsArray.length * 100) + \"px\";\n\t\t}\n\t} else if (player === 2) {\n\t\tif (player2cardsArray.length > 8) {\n\t\t\tPID(\"player2cards\").style.padding = -1 * (player2cardsArray.length * 100) + \"px\";\n\t\t}\n\t}\n\tvar cards = [];\n\t// if statement to check addorreplace\n\tif (addorreplace == \"add\") {\n\t\t//for loop ammounts time\n\t\tfor (var i = 0; i < ammount; i++) {\n\n\t\t\t// chooses the card\n\t\t\tvar card = cardnames[Math.floor(cardnames.length * Math.random())];\n\n\t\t\t// runs helper function to add elements.\n\t\t\tPutCardInElement(element, addorreplace, card, player, styles);\n\n\t\t\t// adds card to array\n\t\t\tif (player === 0) {} else {\n\t\t\t\tcards.push(PID(\"player\" + player + PID(\"curcardsholder\" + player).innerHTML));\n\t\t\t}\n\t\t}\n\t} else {\n\n\t\t//chooses the card\t\t\n\t\tvar card = cardnames[Math.floor(cardnames.length * Math.random())];\n\n\t\t//runs helper function\n\t\tPutCardInElement(element, addorreplace, card, player, styles);\n\n\t\t//checks if its player0/middle\n\t\tif (player === 0) {} else {\n\t\t\tcards.push(PID(\"player\" + player + PID(\"curcardsholder\" + player).innerHTML));\n\t\t}\n\t}\n\t// returns cards array\n\treturn cards;\n\n}", "static loadCards() {\n // get languages array from api\n fetch(\"http://localhost:3000/languages\")\n .then(function (response) {\n return response.json();\n })\n .then(function (languages) {\n // save the language object as global variable\n\n compileCards(languages);\n });\n }", "function getCard (index) {\n\t\t\tloading = true;\n\t\t\tvar card = getbyId(index, cards);\n\t\t\tloading = false;\n\n\t\t\treturn card;\n\t\t}", "function initGame() //function that calls the functions and variables that need to be loaded when the page opens\n{\n\tgenerateCardNumbers(); //calls the generateCardNumbers function\n}", "function loadDefaultListOfCards() {\n const xhr = new XMLHttpRequest();\n xhr.addEventListener(\"readystatechange\", function() {\n if (xhr.readyState === 4) {\n if (xhr.status >= 200 && xhr.status < 300) {\n constructCardList(JSON.parse(xhr.responseText).cards);\n // remove the overlay\n let loadOverlay = document.getElementById(\"load-overlay\");\n fadeOutElement(loadOverlay);\n } else {\n console.error(\"failure: \" + xhr.responseText);\n }\n }\n });\n xhr.open(\"GET\", baseUrlCard);\n xhr.send();\n }", "initCards() {\n let allCards = [\n { value: \"A\", matched: false},\n { value: \"A\", matched: false},\n { value: \"B\", matched: false},\n { value: \"B\", matched: false},\n { value: \"C\", matched: false},\n { value: \"C\", matched: false},\n { value: \"D\", matched: false},\n { value: \"D\", matched: false},\n { value: \"E\", matched: false},\n { value: \"E\", matched: false},\n { value: \"F\", matched: false},\n { value: \"F\", matched: false},\n { value: \"G\", matched: false},\n { value: \"G\", matched: false},\n { value: \"H\", matched: false},\n { value: \"H\", matched: false}\n ];\n this.shuffle(allCards);\n return allCards;\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 }", "componentDidMount() {\n this.shuffleCards();\n }", "function preload() {\n for (var x = 0; x < lato; x++) {\n cards[x] = []\n for (var y = 0; y < altezza; y++) {\n cards[x][y] = new Card((x * 350) + 180, (y * 350) + 130, x + '' + y + '.mp3', x + '' + y + '.png')\n }\n }\n}", "loadList() {\n let deck2 = shuffle(newDeck());\n this.setState({ cards: deck2 });\n }", "function getCard() {\n const deck = {\n suits: ['Clubs', 'Spades', 'Spades', 'Hearts','Diamonds'],\n cards: {\n '1': 'A',\n '2': '2',\n '3': '3',\n '4': '4',\n '5': '5',\n '6': '6',\n '7': '7',\n '8': '8',\n '9': '9',\n '10': '10',\n '11': 'J',\n '12': 'Q',\n '13': 'K',\n }\n }\n let randomCard = (Math.floor(Math.random() * 12 + 1))\n let randomSuit = (Math.floor(Math.random() * 4))\n console.log(`You drew a ${deck.cards[randomCard]} of ${deck.suits[randomSuit]}`)\n}", "function Card(num, suit) {\n this.num = num;\n this.suit = suit;\n this.fname = sDir + this.num + this.suit + \".gif\";\n}", "function createCard(cards, card, variant) {\n return {\n matchingId: cards.indexOf(card) + 1,\n uniqueId: `${cards.indexOf(card) + 1}${variant}`,\n imgFilename: card,\n randomFactor: Math.floor(Math.random() * 100) + 1, //To make sure cards are located at different positions. Based on the random factor they get ordered in the grid\n matched: false,\n flipped: false,\n };\n}", "static generateRandomCardIndex() {\n return Math.floor(Math.random() * Math.floor(maxCard));\n }", "shuffle() {\n let len = this.cards.length;\n while(len) {\n // randomly choose a card and move it to the end\n // of the deck\n this.cards.push(\n this.cards.splice( Math.floor( Math.random() * len ), 1 )[0]\n )\n len -= 1\n }\n }", "pickCard() {\n //logit('PICK CARD MARKER');\n index1 = Math.floor(this.cardsLeft.length * Math.random());\n let card1 = this.cardsLeft.splice(index1,1)[0];\n this.playedCards.push(card1);\n return card1;\n }", "turnCard(pickedCard){\n let img = this.cards[pickedCard].getImage();\n this.images[pickedCard].innerHTML = \"<img id='img\" + pickedCard + \"' src='./images/\" + img + \"'/>\";\n }", "shuffleCards() {\n let random = 0;\n let temp = 0;\n for (i = 1; i < game.cards.length; i++) {\n random = Math.round(Math.random() * i);\n temp = game.cards[i];\n game.cards[i] = game.cards[random];\n game.cards[random] = temp;\n }\n game.assignData();\n \n }", "function generateRandomCard(){\r\n var randomNum = Math.floor(Math.random()*13)+1;\r\n //A=1 J=11 Q=12 K=13\r\n switch(randomNum){\r\n case 1: randomNum=\"A\";\r\n break;\r\n case 11:randomNum=\"J\";\r\n break;\r\n case 12:randomNum=\"Q\";\r\n break;\r\n case 13:randomNum=\"K\";\r\n break;\r\n }\r\n\r\n var randomSymb= Math.floor(Math.random()*4)+1;\r\n //1=C 2=D 3=H 4=S\r\n switch(randomSymb){\r\n case 1:randomSymb=\"C\";\r\n break;\r\n case 2:randomSymb=\"D\";\r\n break;\r\n case 3:randomSymb=\"H\";\r\n break;\r\n case 4:randomSymb=\"S\";\r\n break;\r\n }\r\n randomCardsSrc=randomNum+randomSymb;\r\n\r\n if(cardsInGame.includes(randomCardsSrc)){\r\n generateRandomCard();\r\n }\r\n\r\n return randomCardsSrc;\r\n \r\n}", "function random_selector(x) {\n var randomCard = x[Math.floor(Math.random() * x.length)];\n console.log(randomCard);\n}", "componentDidMount() {\n this.loadCards();\n }", "function setMainCard(){\n randMain = [Math.floor(Math.random() * x)];\n mainNums.push(randMain);\n mainCard.src = `images/${gameData.mainCards[randMain]}`;\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 deal() {\n\t\tvar suit = Math.floor((Math.random()*4) + 1);\n\t\tvar number = Math.floor((Math.random()*13) + 1);\n\t\treturn new Card(suit,number);\n}", "function getNewCard() {\r\n // Set index of next card from deck\r\n let nextCardIndex = shuffledDeck[shuffledDeckIndex];\r\n\r\n // Get next card number and suit from deck\r\n const nextCardNumber = deck[nextCardIndex].cardNumber;\r\n const nextCardSuit = deck[nextCardIndex].cardSuit;\r\n\r\n // Create new card object with next card number and suit\r\n const nextCard = new Card(nextCardNumber, nextCardSuit);\r\n\r\n // Render next card on the 'front' of the next card\r\n nextCard.render();\r\n\r\n shuffledDeckIndex++;\r\n\r\n // Re-shuffle cards when all cards from deck have been used\r\n if (shuffledDeckIndex > 51) {\r\n shuffledDeckIndex = 0;\r\n shuffledDeck = shuffle(numbersToShuffle);\r\n\r\n // Remove all played cards from Played Cards area\r\n while (playedCardArea.lastElementChild) {\r\n playedCardArea.removeChild(playedCardArea.lastElementChild);\r\n }\r\n console.log(shuffledDeck);\r\n }\r\n showLastPlayed();\r\n}", "function getCard(card){\n return card.getElementsByClassName('deck-card')[0].src;\n}", "function exploKitt() {\n const explodingKitten = new Card ('Exploding Kitten', 'explodyKit1','images/explodingkittencard.png')\n deck.push(explodingKitten);\n shuffle(deck);\n}", "componentWillMount(){\n this.rand_gen(); // start the game with one tile\n }", "updateCard () {\n const currentCards = this.state.cards;\n this.setState({\n currentCard: this.getRandomCard(currentCards)\n });\n }", "function deal() {\n var suit = Math.floor(Math.random() * 4 + 1);\n var number = Math.floor(Math.random() * 13 + 1);\n return new Card(suit, number);\n}", "function loadObject(obj, defaultScale = 0.2, defaultStick = false) {\n let entity = new CardEntity(resources.textures[obj.card].paperTexture);\n\n let scale = defaultScale;\n if (obj.scale != null) scale = obj.scale;\n if (obj.children != null) {\n for (let i = 0; i < obj.children.length; ++i) {\n entity.addChild(loadObject(obj.children[i], 1, false));\n }\n }\n if (obj.cardAction != null) entity.action = obj.cardAction;\n entity.transform = transformMatMat(\n entity.transform,\n getScaling(new vec3(scale, scale, scale))\n );\n // CAN_BE_REMOVED\n // the random part avoids having cards touch\n let translation = new vec3(0, 0, Math.random() * 0.01);\n if (obj.cardTransform != null)\n entity.transform = transformMatMat(entity.transform, obj.cardTransform);\n if ((obj.stick == null && defaultStick) || (obj.stick && obj.stick != null)) {\n entity = createCardWithStick(entity);\n translation = new vec3(0, -stickHeight);\n }\n if (obj.transform != null) entity.transform = obj.transform;\n if (obj.translation != null) {\n entity.transform = transformMatMat(\n getTranslation(\n new vec3(obj.translation[0], obj.translation[1], obj.translation[2])\n ),\n entity.transform\n );\n }\n entity.transform = transformMatMat(\n getTranslation(translation),\n entity.transform\n );\n if (obj.action != null) entity.action = obj.action;\n entity.id = obj.id;\n return entity;\n}", "function getQuestion(card) {\n if (card.type === \"BasicCard\") { \n//libCard becomes a new card of BasicCard constuctor \n libCard = new BasicCard(card.front, card.back); \n return libCard.front; \n } else if (card.type === \"ClozeCard\") { \n//libCard becomes a new card of ClozeCard constuctor \n libCard = new ClozeCard(card.text, card.cloze) \n return libCard.clozeRemoved(); \n }\n}", "function getRandomSuit() {\n\tvar s = Math.floor((Math.random() * 3) + 0); \n\treturn cards[s][0];\n}", "function getCard() {\n if (!this.classList.contains(\"unfound\")) {\n let id = this.id;\n let url = \"https://webster.cs.washington.edu/pokedex/pokedex.php?pokemon=\" + id;\n fetch(url)\n .then(checkStatus)\n .then(JSON.parse)\n .then(myCard);\n }\n }", "function createCard(context, elem, randomColor, randomShape, randomNum) { \n \n // Declare a variable that temporarily stores the properties of the new play card\n let cardResults = [randomColor, randomShape, randomNum];\n\n // If the play card properties are not prespecified, draw them randomly by drawing random numbers\n if(randomColor == null && randomShape == null && randomNum == null){\n do{\n randomColor = randomNumber(0, 3);\n randomShape = randomNumber(0, 3);\n randomNum = randomNumber(0, 3);\n\n cardResults = [randomColor, randomShape, randomNum];\n }\n // Keep doing this for as long as the properties of this new card match the properties of the previous card or one of the key cards\n while(compareArrays(cardResults,result) == true || compareArrays(cardResults,cardOne) == true || compareArrays(cardResults,cardTwo) == true || compareArrays(cardResults,cardThree) == true || compareArrays(cardResults,cardFour) == true);;\n }\n\n // Translate the numbers in the matching color, shape, number from the allCards array\n let color = allCards[0][randomColor];\n let shape = allCards[1][randomShape];\n let number = allCards[2][randomNum];\n \n // Draw a blank card\n drawCard(context, elem, 0, 0, \"white\")\n \n // Draw the shape that is chosen, in the chosen quantity\n // First check shape, than number\n context.beginPath();\n switch (shape) {\n case \"circle\":\n switch (number) {\n case 1:\n drawCircle(context, elem, 50,50,15);\n break;\n case 2:\n drawCircle(context, elem, 50,25,15);\n drawCircle(context, elem, 50,70,15);\n break;\n case 3:\n drawCircle(context, elem, 75,25,15);\n drawCircle(context, elem, 50,50,15);\n drawCircle(context, elem, 25,75,15);\n break;\n case 4:\n drawCircle(context, elem, 25,20,15);\n drawCircle(context, elem, 25,80,15);\n drawCircle(context, elem, 75,80,15);\n drawCircle(context, elem, 75,20,15);\n break;\n } \n break;\n \n case \"square\":\n switch (number) {\n case 1:\n drawSquare(context, elem, 36,38,26,23);\n break;\n case 2:\n drawSquare(context, elem, 36,15,26,23);\n drawSquare(context, elem, 36,65,26,23);\n break;\n case 3:\n drawSquare(context, elem, 65,10,26,23);\n drawSquare(context, elem, 36,40,26,23);\n drawSquare(context, elem, 10,70,26,23);\n break;\n case 4:\n drawSquare(context, elem, 10,10,26,23);\n drawSquare(context, elem, 65,10,26,23);\n drawSquare(context, elem, 10,70,26,23);\n drawSquare(context, elem, 65,70,26,23);\n break;\n } \n break;\n \n case \"triangle\":\n switch (number) {\n case 1:\n drawTriangle(context, elem, 30, 32, 18);\n break;\n case 2:\n drawTriangle(context, elem, 30, 10, 18);\n drawTriangle(context, elem, 30, 60, 18);\n break;\n case 3:\n drawTriangle(context, elem, 60, 8, 18);\n drawTriangle(context, elem, 32, 35, 18);\n drawTriangle(context, elem, 5, 62, 18);\n break;\n case 4:\n drawTriangle(context, elem, 5, 5, 18);\n drawTriangle(context, elem, 58, 5, 18);\n drawTriangle(context, elem, 5, 65, 18);\n drawTriangle(context, elem, 58, 65, 18);\n break;\n }\n break;\n\n case \"heart\":\n switch (number) {\n case 1:\n drawHeart(context, elem, 48, 38, 32, 27)\n break;\n case 2:\n drawHeart(context, elem, 48, 15, 32, 27)\n drawHeart(context, elem, 48, 60, 32, 27)\n break;\n case 3:\n drawHeart(context, elem, 75, 10, 32, 27)\n drawHeart(context, elem, 48, 36, 32, 27)\n drawHeart(context, elem, 25, 65, 32, 27)\n break;\n case 4:\n drawHeart(context, elem, 22, 10, 32, 27)\n drawHeart(context, elem, 75, 10, 32, 27)\n drawHeart(context, elem, 22, 65, 32, 27)\n drawHeart(context, elem, 75, 65, 32, 27)\n break;\n }\n break;\n }\n \n // Fill the drawing with the prespecified color\n context.closePath();\n context.fillStyle = color;\n context.fill();\n \n // Store the properties of the new play card in the results variable\n result = cardResults;\n}", "getCardFromDeck() {\n const { deck } = this.state;\n if (!deck.length) {\n return null;\n }\n\n const cardIndex = this.getRandomInt(0, deck.length - 1);\n const card = deck[cardIndex];\n\n // Remove from deck\n deck.splice(cardIndex, 1);\n this.setState({ deck });\n\n return card;\n }", "function loadPhotoCardBasedOnUrl() {\n var photoId = getUrlParam(\"photo\");\n loadInfo(photoId, \"showPhotoCard\");\n }", "function createCards() {\n for (let i = 0; i < imgList.length; i += 1) {\n const cards = document.createElement('div');\n cards.classList.add('card');\n cards.innerHTML = `<div class='back'>${imgList[i]}</div>\n <div class='front'><i class=\"fa fa-line-chart\" style=\"font-size:2em;color:#ffffff;\"></i></div>`;\n cardArray.push(cards);\n }\n // Loops and Shuffles Card Array\n for (let i = cardArray.length - 1; i >= 0; i -= 1) {\n const randomIndex = Math.floor(Math.random() * (i + 1));\n const itemAtIndex = cardArray[randomIndex];\n cardArray[randomIndex] = cardArray[i];\n cardArray[i] = itemAtIndex;\n }\n }", "function getRandomCar() {\n // Pick a random car.\n const car = cars[Math.floor(Math.random() * cars.length)];\n\n const carContainer = document.getElementById('js-car-container');\n const carView = buildCarView(car);\n carContainer.replaceWith(carView);\n}", "function loadRound(){\n\tenableButtons();\n\tupdateScore();\n\tunbindHandlers();\n\tshuffle();\n\n\tsetGame(0);\n\tsetGame(1);\n\tsetGame(2);\n\tbindSelectors();\n}", "generateRandomCardSet() {\n // clone card list\n let cards = this.cards.slice()\n // shuffle cards\n cards = this.shuffle(cards)\n // pick n number of cards then duplicate\n const tmp = cards.slice(0, 20)\n return this.shuffle(tmp.concat(tmp.slice()))\n }", "function showCard(cardNum, cardName) {\r\n\tflipCardSnd.play();\r\n\t$(\"#cardImg\" + cardNum).attr(\"src\", \"/Resources/deck/\" + cardName + \".gif\");\r\n}", "function SetUpFirstCard() {\n var song = songData[Math.floor(Math.random() * songData.length)];\n\n var img = currCard.getElementsByTagName('img')[0];\n img.setAttribute('draggable', 'false');\n img.setAttribute('src', song.imgUrl);\n img.setAttribute('alt', song.name);\n\n var url = img.getAttribute('src');\n cardShadow.style.backgroundImage = 'url(../'+url+')';\n\n heart = currCard.getElementsByTagName('span')[0];\n heart.setAttribute('id', 'heart');\n\n // Track Details\n var title = document.getElementById('panel_details-title');\n var artist = document.getElementById('panel_details-artist');\n\n title.innerHTML = song.name;\n artist.innerHTML = song.artist;\n}" ]
[ "0.6958431", "0.6816011", "0.6625624", "0.6609234", "0.6605706", "0.6546299", "0.6516402", "0.6473475", "0.6454191", "0.641102", "0.63849986", "0.6367232", "0.63656986", "0.6342588", "0.63051146", "0.62916833", "0.62818265", "0.62649316", "0.62610537", "0.62522215", "0.6237639", "0.6223769", "0.6223712", "0.6219415", "0.620252", "0.61984885", "0.6155319", "0.6131842", "0.61289006", "0.6128337", "0.6063374", "0.6043234", "0.6043002", "0.6032774", "0.6009254", "0.60085213", "0.5995353", "0.5980473", "0.5972227", "0.5958434", "0.5946699", "0.5931365", "0.59239167", "0.5916014", "0.5914085", "0.5904049", "0.5899724", "0.5885708", "0.58538437", "0.5836163", "0.5825041", "0.5823287", "0.5817796", "0.58157307", "0.58135474", "0.58035326", "0.5803271", "0.57956034", "0.5788901", "0.57875055", "0.5783173", "0.5779772", "0.5759907", "0.5755576", "0.5753858", "0.5753498", "0.5752621", "0.57495886", "0.57493967", "0.57491505", "0.5748232", "0.5744544", "0.5741794", "0.57415605", "0.57413685", "0.5739473", "0.5729746", "0.5712779", "0.5705184", "0.56833166", "0.5677251", "0.5673404", "0.566556", "0.5647086", "0.56376946", "0.56275654", "0.56274515", "0.56206465", "0.5614741", "0.5610635", "0.56046396", "0.5600241", "0.55844194", "0.5581373", "0.5580484", "0.5578724", "0.5578476", "0.5577781", "0.55775166", "0.55764306" ]
0.7514743
0
Method to load a StaticActivity (callable from any component) PhilD
loadStaticActivity(e) { var myClick = document.getElementById('filterText'); myClick.value = e; myClick.addEventListener('change',function(){ this.store.set({ filter: e }) }); myClick.dispatchEvent(new Event('change')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function activity() {\n dynamicActivity();\n }", "function dynamicActivity() {\n regularActivityMonitor();\n }", "static load() {\n\t\t\treturn loader().then(ResolvedComponent => {\n\t\t\t\tComponent = ResolvedComponent.default || ResolvedComponent\n\t\t\t})\n\t\t}", "static function Initialize() {\n\t\tvar unityPlayer = new AndroidJavaClass(\"com.unity3d.player.UnityPlayer\");\n\t\tvar activity = unityPlayer.GetStatic.<AndroidJavaObject>(\"currentActivity\");\n\t\t\n\t\tactivity.Call(\"runOnUiThread\", new AndroidJavaRunnable(function()\n \t{\n\t\t\tvar presageClass = new AndroidJavaClass(WPRESAGE_ID);\n\t\t\tvar presage = presageClass.CallStatic.<AndroidJavaObject> (\"getInstance\");\n\t\t\tpresage.Call(\"setContext\", activity);\n\t\t\tpresage.Call(\"start\");\n\t\t}));\n\t}", "static loadComponent() {\n return Component;\n }", "function initActivity(){\n\tinitElementGroupFilter();\t\n\tdisplayDetailViewMsg();\n\tdisplayItemDetailView();\n\trenderImages();\n}", "static load(gameInstance) {}", "injectWidget(){\n var id = parseInt(this.state.id)-1;\n const script = document.createElement(\"script\");\n script.src = \"https://test-ancil-overlay.herokuapp.com/v1/funnel/display.js?agent_id=test&session_id=\"+id;\n console.log(script.src)\n script.async = true;\n document.body.appendChild(script);\n }", "LoadAsset() {}", "static Instantiate() {}", "static Instantiate() {}", "static Instantiate() {}", "static Instantiate() {}", "static Instantiate() {}", "static Instantiate() {}", "injectInteractionScript(){\n let script = document.createElement('script');\n script.src = apis.extension.getURL(INJECTION_SCRIPT_FILENAME);\n (document.head||document.documentElement).appendChild(script);\n script.onload = () => script.remove();\n }", "static LoadFromFile() {}", "static LoadFromFileAsync() {}", "init() {\n\t\tthis.#activateNew('Loading');\n\t}", "function chromeos(){\n\n \n \nvar activity = new Activity(\"folderview\")\nactivity.name = i18n(\"ChromeOs Activity\")\n\n\n\n}", "function load (component) {\n // '@' is aliased to src/components\n return () => import(`src/views/${component}.vue`)\n}", "static define() {\n Akili.component('component', Component);\n }", "__init() {this.activities = {};}", "__init() {this.activities = {};}", "__init() {this.activities = {};}", "function loadActivist (prefix, options, rsrc) {\n var config = {};\n var defaultConfig = require('./src/config');\n for (var i in defaultConfig) {\n if (defaultConfig.hasOwnProperty(i) && !options[i]) {\n config[i] = defaultConfig[i];\n } else if (options[i]) {\n config[i] = options[i];\n }\n }\n config.url = prefix + '.js';\n config.frame = prefix + '.html';\n config.offline = prefix + '-offline.html';\n\n rsrc.type = 'text/javascript';\n packager(config, function (data) {\n rsrc.body = data;\n rsrc.headers = {\n 'Cache-Control': 'public, max-age=' + Math.floor(rsrc.maxAge / 1000),\n 'ETag': etag(data)\n };\n });\n}", "function initialize(instance) {\n var service = instance.lookup('service:asset-loader');\n service.pushManifest(_assetManifest.default);\n }", "function initialize(instance) {\n var service = instance.lookup('service:asset-loader');\n service.pushManifest(_assetManifest.default);\n }", "lateLoad() {\n\n }", "function staticJSLoad(js) {\n\tvar addJs = document.createElement(\"script\");\n\taddJs.setAttribute(\"type\",\"text/javascript\");\n\taddJs.setAttribute(\"src\",js);\n\tdocument.body.appendChild(addJs);\n}", "static loadScript() {\n //Si notre script n'est pas en train de charger\n if (!Video.scriptIsLoading) {\n Video.scriptIsLoading = true; //Charger le script\n\n const script = document.createElement('script'); //Crée la balise script\n script.src = 'https://www.youtube.com/iframe_api'; //Changer sa propriété src pour celui du youtube\n document.body.appendChild(script); //Injecter la balise script dans le body\n }\n }", "constructor () {\n // define satellite load priority.\n this.loadPriority = 10\n }", "function WixActivity() {\n\n /**\n * Updates to the existing contact that performed this activity. The structure of this object should match the schema for Contact, with the relevant fields updated.\n * @member\n * @type {Object}\n */\n this.contactUpdate = schemaFactory(this.TYPES.CONTACT_CREATE.name);\n /**\n * Configures this Activity with a given type\n * @param {ActivityType} type the type of the Activity to create\n * @returns {WixActivity}\n */\n this.withActivityType = function(type) {\n this.activityType = type.name;\n this.activityInfo = schemaFactory(type.name);\n return this;\n };\n\n /**\n * Configures the activityLocationUrl of this Activity\n * @param {string} url The URL of the Activities location\n * @returns {WixActivity}\n */\n this.withLocationUrl = function(url) {\n this.activityLocationUrl = url;\n return this;\n };\n\n /**\n * Configures the details of this Activity\n * @param {string} summary A summary of this Activity\n * @param {string} additionalInfoUrl a link to additional information about this Activity\n * @returns {WixActivity}\n */\n this.withActivityDetails = function(summary, additionalInfoUrl) {\n if(summary !== null && summary !== undefined) {\n this.activityDetails.summary = summary;\n }\n if(additionalInfoUrl !== null && additionalInfoUrl !== undefined) {\n this.activityDetails.additionalInfoUrl = additionalInfoUrl;\n }\n return this;\n };\n\n var readOnlyTypes = [\n this.TYPES.CONTACT_CREATE.name\n ];\n this.isWritable = function() {\n return (readOnlyTypes.indexOf(this.activityType) == -1);\n };\n\n this.isValid = function() {\n //TODO provide slightly better validation\n return this.activityLocationUrl !== null\n && this.activityType !== null\n && this.activityDetails.summary !== null\n && this.createdAt !== null\n && this.activityDetails.additionalInfoUrl !== null;\n };\n\n /**\n * Posts the Activity to Wix. Returns a Promise for an id\n * @param {string} sessionToken The current session token for the active Wix site visitor\n * @param {Wix} wix A Wix API object\n * @returns {Promise.<string, error>} A new id, or an error\n */\n this.post = function(sessionToken, wix) {\n return wix.Activities.postActivity(this, sessionToken);\n };\n\n function removeNulls(obj){\n var isArray = obj instanceof Array;\n for (var k in obj){\n if (obj[k]===null) isArray ? obj.splice(k,1) : delete obj[k];\n else if (typeof obj[k]==\"object\") removeNulls(obj[k]);\n }\n }\n\n this.toJSON = function() {\n var _this = this;\n removeNulls(_this.contactUpdate);\n removeNulls(_this.activityInfo);\n return {\n createdAt : _this.createdAt,\n activityType : _this.activityType,\n contactUpdate : _this.contactUpdate,\n activityLocationUrl : _this.activityLocationUrl,\n activityDetails : _this.activityDetails,\n activityInfo: _this.activityInfo\n };\n };\n}", "function startStatic() {\n\t isStatic = true;\n\t}", "constructor(activity) {\n this.toString = () => {\n return `${this.activity.text}`;\n };\n this.activity = activity;\n }", "function LocalLoader() { }", "function loadLinkedActivities( itcb ) {\n // skip this step if configured\n if( options.withoutActivities ) {\n return itcb( null );\n }\n\n Y.log( 'getPopulatedActivities: loadLinkedActivities ' + (new Date().getTime()), 'debug', NAME );\n Y.doccirrus.mongodb.getModel( user, 'activity', migrate, onActivityModelReady );\n\n function onActivityModelReady( err, model ) {\n if( err ) {\n Y.log( \"Error getActivitiesPopulated (modCallback 1): \\n\" + err, 'error', NAME );\n return itcb( err );\n }\n Y.log( 'getActivitiesPopulated: populating linked activities of ' + activities.length + ' activities', 'debug', NAME );\n populateActivities( model, activities, options, itcb );\n }\n\n }", "function initializeLoadSequence(){\r\n $.logEvent('[dataVisualization.core.initializeLoadSequence]');\r\n \r\n // Initialize the first component within the configuration\r\n var toInitializeObj = dataVisualization.configuration.loadSequence[0];\r\n \r\n // Initialize the required functionality for the desired module\r\n dataVisualization.dispatcher.moduleInitialize(toInitializeObj);\r\n }", "componentDidMount(){\n //check if UnityLoader is already loaded, if not build and load UnityLoader script\n if( !(typeof(UnityLoader)==='object') ){\n //create script element\n const UnityLoader_script = document.createElement('script');\n\n //add script attributes\n UnityLoader_script.onload = (response) => (this.load(response));\n UnityLoader_script.onerror = (response) => (this.error(response));\n UnityLoader_script.src = \"./assets/unity/UnityLoader.js\";\n \n //load script directly on to DOM\n document.body.appendChild(UnityLoader_script);\n }\n }", "function translateLoaderFactory(http) {\n return new __WEBPACK_IMPORTED_MODULE_4__src_translate_service__[\"b\" /* TranslateStaticLoader */](http);\n}", "_onScriptLoad() {\n const JitsiMeetExternalAPI = window.JitsiMeetExternalAPI;\n\n const api = new JitsiMeetExternalAPI(config.defaultDomain);\n const iframe = api.getIFrame();\n\n setupScreenSharingForWindow(iframe);\n new RemoteControl(iframe); // eslint-disable-line no-new\n setupAlwaysOnTopRender(api);\n setupWiFiStats(iframe);\n }", "static DontDestroyOnLoad() {}", "static DontDestroyOnLoad() {}", "static DontDestroyOnLoad() {}", "static DontDestroyOnLoad() {}", "static DontDestroyOnLoad() {}", "static DontDestroyOnLoad() {}", "function loadInterface() {\n var fireaddr, ismoderator, hasmwindow,\n element = document.getElementById(\"firesidechat\");\n\n fireaddr = element.getAttribute(\"data-fireaddr\");\n \n var moderator = element.getAttribute(\"data-moderatormode\");\n ismoderator = false;\n if (moderator == \"true\") {\n ismoderator = true;\n }\n\n var mwindow = element.getAttribute(\"data-moderatorwindow\");\n hasmwindow = false;\n if (mwindow == \"true\") {\n hasmwindow = true;\n }\n\n var readonly = element.getAttribute(\"data-readonly\");\n var isreadonly = false;\n if (readonly == \"true\") {\n isreadonly = true;\n }\n\n React.render(<Master fireaddr={fireaddr} ismoderator={ismoderator} hasmwindow={hasmwindow} readOnly={isreadonly} />, element);\n}", "load (context, actions) {\n console.log(`Loading module ${this.name} finished`)\n }", "function loadActivity(el, props, dest) {\r\n if ($('i' + dest)) return false//use once\r\n var myFx = new Fx.Scroll($('body'), {\r\n wait: false,\r\n duration: 750,\r\n offset: {\r\n 'x': 0, 'y': 0\r\n },\r\n transition: Fx.Transitions.Quad.easeInOut\r\n });\r\n var myy = $(dest).getPosition($('oli-container')).y;\r\n myFx.start(0, myy);\r\n $(dest).setStyles('width', '100%');\r\n //margin:30px -10px 10px;border-width:1px 0;display:block;\r\n var cell = $(dest).getElement('.iframe');\r\n cell.setProperty('class', 'loading');\r\n var myIFrame = new IFrame({\r\n src: el,\r\n id: 'i' + dest,\r\n 'class': 'loading',\r\n styles: {\r\n width: '100%',\r\n border: '0'\r\n },\r\n frameborder: 0,\r\n events: {\r\n load: function () {\r\n //if(debug) alert('8: ' +this.getScrollSize().y);\r\n //this.contentWindow.document.body.getElement('#pagetitle').setStyle('display','none');\r\n cell.setProperty('class', 'loaded');\r\n this.setProperty('class', 'loaded');\r\n if (parent.location.protocol == 'https:') {\r\n var d = util_selectiframe(this);\r\n d.className = d.className + ' iframe';\r\n $('i' + dest).setStyle('height', d.scrollHeight);\r\n }\r\n myFx.start(0, myy);\r\n }\r\n }\r\n });\r\n $(dest).setStyle('width', '100%');\r\n myIFrame.inject(cell);\r\n return false;\r\n}", "LoadAssetAsync() {}", "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}", "getStaticAssetManifest() {\n return RouteGroup_1.staticAssetManifest;\n }", "function coreLoadAndBootstrap(injector, componentType) {\n var appRef = injector.get(ApplicationRef);\n return appRef.run(function () {\n var componentResolver = injector.get(component_resolver_1.ComponentResolver);\n return async_1.PromiseWrapper.all([componentResolver.resolveComponent(componentType), appRef.waitForAsyncInitializers()]).then(function (arr) {\n return appRef.bootstrap(arr[0]);\n });\n });\n}", "function InitAdapter() {\n // get current page\n if (!this.parent.course.currentPopupPageId)\n launchData.CurrentPage = this.parent.course.getCurrentPage();\n else\n launchData.CurrentPage = this.parent.courseController.getPageFromId(this.parent.course.currentPopupPageId);\n\n if (!launchData.CurrentPage.MagazineCourseUrl) {\n // get the item tag from the imsmanifest.xml file\n var itemTag = readManifest();\n\n // return if we could not get a valid item tag because of an imsmanifest.xml format problem\n if (!itemTag) return;\n\n // see what SCORM version we have\n if (launchData.ScormVersion == \"1.2\") {\n // we have SCORM 1.2, init the SCORM 1.2 object\n window.API = new Object;\n\n // an <item> tag may contain these tags\n /*\n <adlcp:maxtimeallowed>00:30:00</adlcp:maxtimeallowed>\n <adlcp:timelimitaction>exit,no message</adlcp:timelimitaction>\n <adlcp:datafromlms>Some information about the learning resource</adlcp:datafromlms>\n <adlcp:masteryscore>90</adlcp:masteryscore>\n */\n\n // get the data if these tags exist\n var maxtimeallowed = $(itemTag).find(\"adlcp\\\\:maxtimeallowed\").text();\n var timelimitaction = $(itemTag).find(\"adlcp\\\\:timelimitaction\").text();\n var datafromlms = $(itemTag).find(\"adlcp\\\\:datafromlms\").text();\n var masteryscore = $(itemTag).find(\"adlcp\\\\:masteryscore\").text();\n\n // init the SCORM 1.2 data\n initSCORM12API(API, launchData.UserID, launchData.FirstName, launchData.LastName, maxtimeallowed, timelimitaction, datafromlms, masteryscore);\n } else {\n // we have SCORM 2004, init the SCORM 2004 object\n window.API_1484_11 = new Object;\n\n // an <item> tag may contain these tags\n /*\n <adlcp:completionThreshold completedByMeasure=\"true\" minProgressMeasure=\"0.8\" />\n <adlcp:timeLimitAction>exit,no message</adlcp:timeLimitAction>\n <adlcp:dataFromLMS>Some SCO Information</adlcp:dataFromLMS>\n */\n\n // get the data if these tags exist\n var completionThreshold = $(itemTag).find(\"adlcp\\\\:completionThreshold\");\n if (completionThreshold.length)\n var minProgressMeasure = completionThreshold.attr(\"minProgressMeasure\");\n else\n var minProgressMeasure = \"\";\n var timeLimitAction = $(itemTag).find(\"adlcp\\\\:timeLimitAction\").text();\n var dataFromLMS = $(itemTag).find(\"adlcp\\\\:dataFromLMS\").text();\n\n // init the SCORM 1.2 data\n initSCORM2004API(API_1484_11, launchData.UserID, launchData.FirstName, launchData.LastName, minProgressMeasure, timeLimitAction, dataFromLMS);\n }\n\n // restore the SCORM data from the previous launch\n getAllLMSData();\n\n // launch the SCO\n launchIt(launchData.CourseLocation + \"/\" + launchData.LaunchURL);\n }\n else {\n // restore the SCORM data from the previous launch\n getAllLMSData();\n\n // launch the course from magazine\n launchIt(launchData.CurrentPage.MagazineCourseUrl);\n }\n}", "function ComponentLoader(props) {\n if (!props.system) {\n return <h2>No system props specified</h2>;\n }\n\n if (!props.system.version) {\n return <h2>No version specified</h2>;\n }\n\n if (!props.manifestModule) {\n return <h2>No module specified</h2>;\n }\n\n if (!FluentManifest[props.system.version]) {\n return <h2>{FluentScope} {props.manifestModule} {props.system.version} not available</h2>;\n }\n\n const url = `http://localhost:${FluentManifest[props.system.version]}/remoteEntry.js`;\n const scope = FluentScope;\n\n const { ready, failed } = useDynamicScript({ url });\n\n if (!ready) {\n return <h2>Loading dynamic script: {url}</h2>;\n }\n\n if (failed) {\n // TODO: this doesn't seem to work on failure, doesn't work in original example either\n return <h2>Failed to load dynamic script: {url}</h2>;\n }\n\n const Component = React.lazy(\n loadComponent(FluentScope, props.manifestModule)\n );\n\n return (\n <React.Suspense>\n {props.system.version}\n <Component {...props} />\n </React.Suspense>\n );\n}", "function asiCallOnload(){\n var SDM_noasci = ['meinauto'];\n var asi_p = 'IpZElE,Rdkg7V,NkqpjZ,acWaVx,RmJKxA,BnG7vD,oeu2b6,foY3mB'; //Produktion\n var asiPqTag = false; //Initialisierung, Antwort setzt auf true\n try {\n if ((sdm_vers >= 1) && !SDM_head.isinarray(SDM_noasci, SDM_resource)) {\n fXm_Head.create.twin(escape('//pq-direct.revsci.net/pql?placementIdList=' + asi_p), SDM_head.prep.asigmd, true);\n }\n } catch (ignore) {}\n\n // Audience Science Data Sharing\n if (!SDM_head.isinarray(SDM_noasci, SDM_resource)) {\n fXm_Head.create.script('//js.revsci.net/gateway/gw.js?csid=F09828&auto=t&bpid=Stroer');\n }\n}", "function loadScript() {\n var tag = document.createElement('script');\n\n tag.src = \"https://www.youtube.com/iframe_api\";\n var firstScriptTag = document.getElementsByTagName('script')[0];\n firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n }", "function initPageLoadCall() {\n if(options.page_paths != {} && options.call_page_tags) {\n var page = options.page_paths[path()];\n if(page !== undefined) {\n fireTag(\"view\", {\n \"page_type\": \"marketing\",\n \"page_name\": page\n });\n }\n }\n }", "function injectContent() {\r\n\tvar data = require(\"sdk/self\").data;\r\n\trequire('sdk/page-mod').PageMod({\r\n\t\tinclude: [\"*.gaiamobile.org\"],\r\n\t\tcontentScriptFile: [\r\n\t\t\tdata.url(\"ffos_runtime.js\"),\r\n\t\t\tdata.url(\"hardware.js\"),\r\n\r\n\t\t\tdata.url(\"lib/activity.js\"),\r\n\t\t\tdata.url(\"lib/apps.js\"),\r\n\t\t\tdata.url(\"lib/bluetooth.js\"),\r\n\t\t\tdata.url(\"lib/cameras.js\"),\r\n\t\t\tdata.url(\"lib/idle.js\"),\r\n\t\t\tdata.url(\"lib/keyboard.js\"),\r\n\t\t\tdata.url(\"lib/mobile_connection.js\"),\r\n\t\t\tdata.url(\"lib/power.js\"),\r\n\t\t\tdata.url(\"lib/set_message_handler.js\"),\r\n\t\t\tdata.url(\"lib/settings.js\"),\r\n\t\t\tdata.url(\"lib/wifi.js\")\r\n\t\t],\r\n\t\tcontentScriptWhen: \"start\",\r\n\t\tattachTo: ['existing', 'top', 'frame']\r\n\t})\r\n\r\n\trequire('sdk/page-mod').PageMod({\r\n\t\tinclude: [\"*.homescreen.gaiamobile.org\"],\r\n\t\tcontentScriptFile: [\r\n\t\t\tdata.url(\"apps/homescreen.js\")\r\n\t\t],\r\n\t\tcontentScriptWhen: \"start\",\r\n\t\tattachTo: ['existing', 'top', 'frame']\r\n\t})\r\n\r\n}", "function XLoader() {\r\n return __loadScript(\"YLoader\", 2);\r\n}", "function WebCom_ComponentLoader() {\n\n var components = [];\n \n /*public void*/function initComponent(name, version, className, data, onRenderComplete) {\n if(name) {\n //Add component to queue for init\n components.push({\n 'name': name, \n 'className': className,\n 'version': version, \n 'data': data,\n 'onRenderComplete': onRenderComplete\n });\n //Load the component JS file\n WebCom.ResourceLoader.loadLib(name, version, true);\n }\n };\n \n /*public void*/function flushQueue() {\n for(var i=0;i<components.length;i++) {\n startComponent(components[i].className, components[i].data, components[i].onRenderComplete);\n }\n components = [];\n }\n \n /*private void*/function startComponent(className, data, onRenderComplete) {\n var componentClass = eval(className);\n \n if (componentClass && typeof(componentClass.initInstances) == 'function') {\n componentClass.initInstances(data , {listeners: {'renderComplete' : {handler: function() { if(typeof(onRenderComplete) == 'function') { onRenderComplete();}} }}});\n }\n }\n \n this.initComponent = initComponent;\n this.flushQueue = flushQueue;\n \n return this;\n }", "function triggerCrawlGoogleActivity(){\r\n\tconsole.log(\"Crawling Google Activity\");\r\n\t// chrome.tabs.create(tab.id, {\"url\": \"https://myactivity.google.com/item\"}, function(tab){})\r\n\tchrome.tabs.create({\r\n\t\turl: \"https://myactivity.google.com/item\",\r\n\t\tactive: false\r\n\t }, function(tab) {\r\n\t\tgoogleActivityTabId = tab.id;\r\n\t});\r\n}", "load(type, ...args) {\n if (!actions[type] || !actions[type].load) {\n throw new Error(`no associated load action for ${type}`);\n }\n\n return actions[type].load(...args);\n }", "function LoadModule(menu) {\n\tthis.menu = menu;\n\t// this.menu.requestParams = GetUrlRequestParamsObject(menu.url)\n}", "get assetImporter() {}", "static get instance() {\n if (!this[_contentLoaderSingleton]) {\n this[_contentLoaderSingleton] = new ContentLoaderSingleton(_contentLoaderSingleton);\n }\n\n return this[_contentLoaderSingleton];\n }", "initScript() {\n if (!this.element.dataset.scripturl) {\n return;\n }\n\n const cachebuster = new Date().getTime();\n const url = `${this.element.dataset.scripturl}?component_id=${this.id}#${cachebuster}`\n const newScriptTag = document.createElement('script');\n newScriptTag.setAttribute('defer', '');\n newScriptTag.setAttribute('type', 'module');\n newScriptTag.setAttribute('src', url);\n \n\n this.script = document.head.appendChild(newScriptTag);\n }", "localDeeplink(activity: Activity): Deeplink {\n const activityType = sanitizeActivityType(activity.type);\n if (!activityType) return null;\n let resource = activity.resource;\n\n switch (activityType) {\n case 'comments': {\n if (resource) {\n let {id, type} = resource;\n return `${Config.SERVER_URL}${sanitizeActivityType(type)}/${id}/comments`\n }\n break;\n }\n default:\n if (resource) {\n let {id, type} = resource;\n return `${Config.SERVER_URL}${sanitizeActivityType(type)}/${id}`\n }\n }\n }", "@api invoke() {\n console.log(\"Hi, I'm an action. INVOKE HEADLESS\");\n let event = new ShowToastEvent({\n title: 'I am a headless action!',\n message: 'Hi there! Starting...',\n });\n this.dispatchEvent(event);\n // this[NavigationMixin.Navigate]({\n // type: 'standard__objectPage',\n // attributes: {\n // objectApiName: 'Contact',\n // actionName: 'home',\n // },\n // });\n }", "function init() {\r\n\taddListeners();\r\n\t// Polite loading\r\n\tif (Enabler.isPageLoaded()) {\r\n\t\tshow();\r\n\t}\r\n\telse {\r\n\t\tEnabler.addEventListener(studio.events.StudioEvent.PAGE_LOADED, show);\r\n\t\t//Enabler.addEventListener(studio.events.StudioEvent.VISIBLE, show);\r\n\t}\r\n}", "function WikiActivity( opts ) { \n\t\t// Sets the current instance to a variable\n\t\tconst wka = this;\n\t\t\n\t\t// The current version of the script\n\t\twka.VERSION = \"v1.5\";\n\t\t\n\t\t// The current script name\n\t\twka.NAME = \"WikiActivity\";\n\t\t\n\t\t// Scripts dependent on running WikiActivity\n\t\twka.SCRIPTS = Object.freeze( { \n\t\t\t\"i18n\": \"u:dev:MediaWiki:I18n-js/code.js\",\n\t\t\t\"wds\": \"u:dev:MediaWiki:WDSIcons/code.js\",\n\t\t\t\"dorui\": \"u:dev:MediaWiki:Dorui.js\",\n\t\t\t\"colors\": \"u:dev:MediaWiki:Colors/code.js\"\n\t\t} );\n\t\t\n\t\t// Stylesheets for the WikiActivity script\n\t\twka.STYLESHEETS = Object.freeze( [\n\t\t\t\"u:dev:MediaWiki:WikiActivity.css\", // Root stylesheet\n\t\t\t\"u:dev:MediaWiki:WikiActivity/legacy.css\"\n\t\t] );\n\t\t\n\t\t// MediaWiki modules to check for\n\t\twka.MODULES = Object.freeze( [ \n\t\t\t\"mediawiki.api\",\n\t\t\t\"mediawiki.Title\",\n\t\t\t\"mediawiki.Uri\"\n\t\t] );\n\t\t\n\t\t// The setters object\n\t\twka.SETTERS = Object.freeze( { \n\t\t\t// Determines whether to debug the script\n\t\t\tdebug: \"DEBUG\",\n\t\t\t// The current theme name for the script\n\t\t\tthemeName: \"THEME_NAME\",\n\t\t\t// Determines whether to show bot edits\n\t\t\tshowBotEdits: \"SHOW_BOT_EDITS\",\n\t\t\t// Determines whether the Recent Changes link should be changed to WikiActivity\n\t\t\theaderLink: \"HEADER_LINK\",\n\t\t\t// Determines whether the activity feed should be loaded on a module\n\t\t\tloadModule: \"LOAD_MODULE\",\n\t\t\t// Allows for custom rendering when a theme is set\n\t\t\tcustomRendering: function( value ) { \n\t\t\t\tObject\n\t\t\t\t\t.getOwnPropertyNames( value )\n\t\t\t\t\t.forEach( function( property ) { \n\t\t\t\t\t\twka.CUSTOM_RENDERING[ property ] = value[ property ];\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\t// Determines whether the activity feed should automatically refresh\n\t\t\trefresh: \"REFRESH\",\n\t\t\t// The delay for refreshing the activity feed (in minutes)\n\t\t\trefreshDelay: function( v ) { \n\t\t\t\tif ( isNaN( v ) || !isFinite( v ) ) { \n\t\t\t\t\twka.REFRESH_DELAY = 300000;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\twka.REFRESH_DELAY = v * 60000;\n\t\t\t}\n\t\t} );\n\t\t\n\t\t// Default configuration object\n\t\twka.DEFAULTS = Object.freeze( { } );\n\t\t\n\t\t// Create the logger object\n\t\twka.LOGGER = new Logger( wka.NAME, wka.DEBUG );\n\t\t\n\t\t// The main loader for the WikiActivity script\n\t\twka.LOADER = new Loader( { \n\t\t\tSCRIPTS: wka.SCRIPTS,\n\t\t\tSTYLESHEETS: wka.STYLESHEETS,\n\t\t\tMODULES: wka.MODULES\n\t\t}, wka.init, wka );\n\t\t\n\t\t// Initializes the loader\n\t\twka.LOADER.init( );\n\t\t\n\t\treturn wka;\n\t}", "function iabLoadStart(event) {\n \n }", "function menuLoader(extension) {\n return Promise.resolve(MENU);\n}", "function c(a){var b=a.href;\n// Note: If |gAsyncResourceLoading| is false, then the following callbacks\n// are synchronously called.\nthis.load=function(a,c){j(b,a,c,function(){console.warn(b+\" not found.\"),\n// lang not found, used default resource instead\nconsole.warn('\"'+a+'\" resource not found'),w=\"\",\n// Resource not loaded, but we still need to call the callback.\nc()})}}", "onContentLoading() {\r\n // Stub\r\n }", "function Component(module, name, type){\n\t\n this.import = {\n module: module,\n name: name\n };\n \n this.action = function(){\n \talert(\"I'm defined to do \"+type+\" actions\");\n };\n}", "_manifestChanged(newValue,oldValue){if(newValue&&newValue.metadata&&newValue.items){// ensure there's a dynamicELementLoader defined\n// @todo this could also be a place to mix in criticals\n// that are system required yet we lazy load like grid-plate\nif(!newValue.metadata.dynamicElementLoader){newValue.metadata.dynamicElementLoader={\"a11y-gif-player\":\"@lrnwebcomponents/a11y-gif-player/a11y-gif-player.js\",\"citation-element\":\"@lrnwebcomponents/citation-element/citation-element.js\",\"hero-banner\":\"@lrnwebcomponents/hero-banner/hero-banner.js\",\"image-compare-slider\":\"@lrnwebcomponents/image-compare-slider/image-compare-slider.js\",\"license-element\":\"@lrnwebcomponents/license-element/license-element.js\",\"lrn-aside\":\"@lrnwebcomponents/lrn-aside/lrn-aside.js\",\"lrn-calendar\":\"@lrnwebcomponents/lrn-calendar/lrn-calendar.js\",\"lrn-math\":\"@lrnwebcomponents/lrn-math/lrn-math.js\",\"lrn-table\":\"@lrnwebcomponents/lrn-table/lrn-table.js\",\"lrn-vocab\":\"@lrnwebcomponents/lrn-vocab/lrn-vocab.js\",\"lrndesign-blockquote\":\"@lrnwebcomponents/lrndesign-blockquote/lrndesign-blockquote.js\",\"magazine-cover\":\"@lrnwebcomponents/magazine-cover/magazine-cover.js\",\"media-behaviors\":\"@lrnwebcomponents/media-behaviors/media-behaviors.js\",\"media-image\":\"@lrnwebcomponents/media-image/media-image.js\",\"meme-maker\":\"@lrnwebcomponents/meme-maker/meme-maker.js\",\"multiple-choice\":\"@lrnwebcomponents/multiple-choice/multiple-choice.js\",\"paper-audio-player\":\"@lrnwebcomponents/paper-audio-player/paper-audio-player.js\",\"person-testimonial\":\"@lrnwebcomponents/person-testimonial/person-testimonial.js\",\"place-holder\":\"@lrnwebcomponents/place-holder/place-holder.js\",\"q-r\":\"@lrnwebcomponents/q-r/q-r.js\",\"full-width-image\":\"@lrnwebcomponents/full-width-image/full-width-image.js\",\"self-check\":\"@lrnwebcomponents/self-check/self-check.js\",\"simple-concept-network\":\"@lrnwebcomponents/simple-concept-network/simple-concept-network.js\",\"stop-note\":\"@lrnwebcomponents/stop-note/stop-note.js\",\"tab-list\":\"@lrnwebcomponents/tab-list/tab-list.js\",\"task-list\":\"@lrnwebcomponents/task-list/task-list.js\",\"video-player\":\"@lrnwebcomponents/video-player/video-player.js\",\"wave-player\":\"@lrnwebcomponents/wave-player/wave-player.js\",\"wikipedia-query\":\"@lrnwebcomponents/wikipedia-query/wikipedia-query.js\"}}_haxcmsSiteStore.store.manifest=newValue;this.dispatchEvent(new CustomEvent(\"json-outline-schema-changed\",{bubbles:!0,composed:!0,cancelable:!1,detail:newValue}))}}", "function loadInpage() {\n // check if already initialized - just in case these scripts were loaded multiple times\n var bootstrapper = new _bootstrap_bootstrap__WEBPACK_IMPORTED_MODULE_0__[\"BootstrapInPage\"]();\n bootstrapper.initialize();\n _quick_edit_quick_e__WEBPACK_IMPORTED_MODULE_8__[\"QuickE\"].start();\n /** this enhances the $2sxc client controller with stuff only needed when logged in */\n if (!_interfaces_window_in_page__WEBPACK_IMPORTED_MODULE_6__[\"windowInPage\"].$2sxc.system)\n _interfaces_window_in_page__WEBPACK_IMPORTED_MODULE_6__[\"windowInPage\"].$2sxc.system = new _system__WEBPACK_IMPORTED_MODULE_9__[\"SystemUpgrader\"]();\n /** Connect DNN action mapper to this module instance */\n _interfaces_window_in_page__WEBPACK_IMPORTED_MODULE_6__[\"windowInPage\"].$2sxcActionMenuMapper = function (moduleId) {\n return new _dnn__WEBPACK_IMPORTED_MODULE_3__[\"DnnActionMenu\"](moduleId);\n };\n}", "function _ActivityTracker() \n{\n\t/* Public methods to add activity (page browse, product browse, quickview product\n\tbrowse that is later sent up to Listrak via client side JS calls. */\n \n /* Adds a product browse activity to be sent up to Listrak later via client side JS. */\n this.AddProductBrowse = function(Sku, Data) {\n if (typeof Sku == \"string\") {\n Sku = Sku.trim();\n if (Sku.length > 0) {\n session.custom.ProdBrowse = Sku; \n }\n }\n };\n\t\n\t/* Adds a quickview product browse activity to a sku array to be sent up to Listrak later via JS. */\n\tthis.AddProductQuickBrowse = function(Sku, Data) {\n\t\tif (typeof Sku == \"string\") {\n Sku = Sku.trim();\n if (Sku.length > 0) {\n \tvar quickViews = session.custom.QuickViewSkus;\n \t\n \tif (quickViews != null && quickViews.length > 0)\n \t\tsession.custom.QuickViewSkus = quickViews + ',' + Sku;\n \telse \n \t\tsession.custom.QuickViewSkus = Sku; \n }\n }\n\t};\t\n}", "function loadRawActivities( itcb ) {\n Y.log( 'getPopulatedActivities: loadRawActivities ' + (new Date().getTime()), 'debug', NAME );\n\n function onRawActivitiesLoaded( err, result ) {\n if( err ) {\n return itcb( err );\n }\n result = result.result ? result.result : result;\n\n // Add all activities to cache\n result.forEach( function actToCache( obj ) {\n //mongooselean.toObject\n obj = obj.toObject ? obj.toObject() : obj;\n activities.push( obj );\n objCacheSet( 'activity', obj._id, obj );\n } );\n\n itcb( null );\n }\n\n // If a set of activities was passed then don't bother to run the query\n if( data.activities ) {\n return onRawActivitiesLoaded( null, data.activities );\n }\n\n Y.doccirrus.mongodb.runDb( {\n user: user,\n model: 'activity',\n action: 'get',\n query: query, // for now accept the query, but in future\n migrate: migrate, // allow to use during migration\n options: options,\n callback: onRawActivitiesLoaded\n } );\n }", "function startLoading() {\n //TODO\n}", "function ActivityRun(C, A) {\n\n\t// If the player does the activity on herself or an NPC, we calculate the result right away\n\tif ((C.ArousalSettings.Active == \"Hybrid\") || (C.ArousalSettings.Active == \"Automatic\"))\n\t\tif ((C.ID == 0) || (C.AccountName.substring(0, 4) == \"NPC_\") || (C.AccountName.substring(0, 4) == \"NPC-\"))\n\t\t\tActivityEffect(Player, C, A);\n\n\t// The text result can be outputted in the chatroom or in the NPC dialog\n\tif (CurrentScreen == \"ChatRoom\") {\n\n\t\t// Publishes the activity as a regular chatroom action\n\t\tvar Dictionary = [];\n\t\tDictionary.push({Tag: \"SourceCharacter\", Text: Player.Name});\n\t\tDictionary.push({Tag: \"TargetCharacter\", Text: C.Name});\n\t\tServerSend(\"ChatRoomChat\", { Content: (C.ID == 0) ? \"ChatSelf-\" : \"ChatOther-\" + C.FocusGroup.Name + \"-\" + A.Name, Type: \"Action\", Dictionary: Dictionary} );\n\n\t}\n\t\n}", "init() {\n // Action to execute on load of the app\n }", "load() {\n\n }", "function startLoading() {\n logger.debug('Starting runtime init')\n\n if(!Module['preRun']) Module['preRun'] = [];\n\n Module['locateFile'] = () => {\n return './vendor/pocketsphinx.wasm';\n };\n\n Module['onRuntimeInitialized'] = () => {\n var SUCCESS = Module.ReturnType.SUCCESS,\n BAD_STATE = Module.ReturnType.BAD_STATE,\n BAD_ARGUMENT = Module.ReturnType.BAD_ARGUMENT,\n RUNTIME_ERROR = Module.ReturnType.RUNTIME_ERROR;\n RETURNTYPES = {\n SUCCESS : 'SUCCESS',\n BAD_STATE: 'BAD_STATE',\n BAD_ARGUMENT: 'BAD_ARGUMENT',\n RUNTIME_ERROR: 'RUNTIME_ERROR'\n }\n\n logger.debug('Runtime initialized')\n dispatch({success: true})\n };\n\n importScripts('./vendor/pocketsphinx.js');\n}", "function ActivityProxy() {\n debug(\"ActivityProxy\");\n this.activity = null;\n}", "static PushCamera() {}", "function loadSocialModule() \n\t{\n\t\tOO = window[_args[0]];\n\t\tOO.plugin(\"DellUIModule\", function(OO, _, $, W) {\n\t\t\tvar Plugin = {};\n\t\t\tPlugin.DellUIModule = function(mb, id) {\n\t\t\t\tthis.mb = mb;\n\t\t\t\tthis.id = id;\n\t\t\t\tthis.init();\n\t\t\t};\n\t\t\tPlugin.DellUIModule.prototype = \n\t\t\t{\n\t\t\t\tinit: function() {\n\t\t\t\t\tthis.mb.subscribe(OO.EVENTS.PLAYER_CREATED, 'socialUI', _.bind(this.onPlayerCreate, this));\n\t\t\t\t\tthis.mb.subscribe(OO.EVENTS.CONTENT_TREE_FETCHED, 'socialUI', _.bind(this.onContentTreeFetched, this));\n\t\t\t\t},\n\t\t\t\tonPlayerCreate: function(event, elementId, params) {\n\t\t\t\t\tthis.playerRoot = $(\"#\" + elementId);\n\n\t\t\t\t\t/* --------------- Social Media Share */\n\t\t\t\t\tthis.playerRoot = $(\"#\" + elementId);\n\t\t\t\t\tthis.playerRoot.find('.oo_controls_wrap').append('<div class=\"oo_share_container\"></div>');\n\t\t\t\t\tthis.playerRoot.find('.oo_share_container').append('<div class=\"oo_button oo_toolbar_item oo_fb_share oo_sms\"></div>');\n\t\t\t\t\t$('.oo_fb_share').click(function() {\n\t\t\t\t\t\tvar uf = location.href;\n\t\t\t\t\t\tvar tf = document.title;\n\t\t\t\t\t\twindow.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(uf) + '&t=' + encodeURIComponent(tf),'sharer','toolbar=0,status=0,width=600,height=400');return false;\n\t\t\t\t\t});\n\t\t\t\t\tthis.playerRoot.find('.oo_share_container').append('<div class=\"oo_button oo_toolbar_item oo_tw_share oo_sms\"></div>');\n\t\t\t\t\t$('.oo_tw_share').click(function() {\n\t\t\t\t\t\tvar ut = location.href;\n\t\t\t\t\t\tvar tt = document.title;\n\t\t\t\t\t\tvar maxLength = 140 - (ut.length + 1);\n\t\t\t\t\t\tif (tt.length > maxLength)\n\t\t\t\t\t\t\ttt = tt.substr(0, (maxLength - 3)) + '...';\n\t\t\t\t\t\twindow.open('http://twitter.com/home?status=' + encodeURIComponent(tt + ' ' + ut),'sharer','toolbar=0,status=0,width=600,height=400');return false;\n\t\t\t\t\t});\n\t\t\t\t\tvar hideTimer;\n\t\t\t\t\tfunction hideShareContainer() {$('.oo_share_container').slideUp(1000);}\n\t\t\t\t\tfunction showShareContainer() {\n\t\t\t\t\t\tclearTimeout(hideTimer);\n\t\t\t\t\t\t$('.oo_share_container').slideDown(500);\n\t\t\t\t\t}\n\t\t\t\t\t$('.oo_tap_panel').hover(\n\t\t\t\t\t\tfunction(){showShareContainer();},\n\t\t\t\t\t\tfunction(){hideTimer = setTimeout( hideShareContainer,1500);}\n\t\t\t\t\t);\n\t\t\t\t\t$('.oo_share_container').hover(\n\t\t\t\t\t\tfunction(){showShareContainer();},\n\t\t\t\t\t\tfunction(){hideTimer = setTimeout( hideShareContainer,1500);}\n\t\t\t\t\t);\n\t\t\t\t\t/* --------------- Social Media Share */\n\t\t\t\t},\n\t\t\t\tonContentTreeFetched: function(event, content) {},\n\t\t\t\t__end_marker: true\n\t\t\t};\n\t\t\treturn Plugin.DellUIModule;\n\t\t});\n\t}", "function Activities(wixApi) {\n\n if (!(wixApi instanceof Wix)){\n throw 'WixApi must be provided'\n }\n var wixApi = wixApi;\n this.wixApi = function() {\n return wixApi;\n };\n\n /**\n * Creates a new WixActivity for the given {@link ActivityType}\n * @method\n * @param {ActivityType} type the type of Activity\n * @returns {WixActivity} returns an empty Wix Activity\n */\n this.newActivity = function(type) {\n var wao = new WixActivity();\n extend(wao, new WixActivityData());\n return wao.withActivityType(type);\n };\n\n /**\n * Posts the Activity to Wix. Returns a Promise for an id\n * @param {WixActivity} activity the Activity to post to Wix\n * @param {string} userSessionToken The current session token for active Wix user\n * @returns {Promise.<string, error>} A new id, or an error\n */\n this.postActivity = function(activity, userSessionToken) {\n if(!(activity instanceof WixActivity)) {\n throw 'WixActivity must be provided'\n }\n if(!activity.isValid()) {\n throw 'WixActivity is missing required fields'\n }\n if(!activity.isWritable()){\n throw 'Cannot post read only Activities'\n }\n\n var deferred = q.defer();\n var request = this.createRequest(\"POST\", \"/v1/activities\");\n\n request.withPostData(JSON.stringify(activity.toJSON()));\n request.withQueryParam(\"userSessionToken\", userSessionToken);\n request.asWixQueryParams();\n var options = request.toHttpsOptions();\n rest.postJson('https://' + options.host + options.path, activity, {\n headers : options.headers\n }).on('complete', function(data, response) {\n if(response.statusCode === 200) {\n deferred.resolve(data.activityId);\n } else {\n deferred.reject(data);\n }\n\n }).on('error', function(data) {\n deferred.reject(data);\n });\n return deferred.promise;\n };\n /**\n * Returns an Activity by a given ID\n * @param {string} activityId The id of the Activity to return\n * @returns {Promise.<WixActivity, error>} An Activity, or an error\n */\n this.getActivityById = function(activityId) {\n if (activityId === undefined || activityId == null || activityId.length == 0){\n throw \"Activity Id must be provided\"\n }\n return this.resourceRequest(this.createRequest(\"GET\", \"/v1/activities/\").withPathSegment(activityId),\n function(data) {\n return new WixActivityData().init(data);\n });\n };\n\n /**\n * Get Activities Query Options\n * @typedef {Object} GetActivitiesOptions\n * @property {?Number} pageSize - The number of results to return per page of data. Valid options are: 25, 50 and 100. Defaults to 25\n * @property {?string} activityTypes - The activity types to filter against. Multiple activity types are separated by a comma\n * @property {?dateTime} until - The ending date for activities we want to return, as an ISO 8601 timestamp This field is only relevant when a cursor is not present\n * @property {?dateTime} from - The beginning date for activities we want to return, as an ISO 8601 timestamp. This field is only relevant when a cursor is not present\n * @property {?string} scope - The scope of the results to return, either for the entire site or limited to the current application. Can either be site or app. By default, all activities for the site will be returned\n */\n\n /**\n * Navigates the Activities found on the current site\n * @param {string} cursor The current cursor\n * @param options {GetActivitiesOptions} The Activity to post\n * @returns {Promise.<WixPagingData, error>} A promise for a {@link WixPagingData} object to navigate results, or an error\n */\n this.getActivities = function(cursor, options) {\n var request = this.createRequest(\"GET\", \"/v1/activities\");\n if(cursor !== undefined && cursor !== null) {\n request.withQueryParam(\"cursor\", cursor);\n }\n if(options !== undefined && options !== null) {\n if(options.from !== undefined && options.from !== null) {\n request.withQueryParam(\"from\", options.from);\n }\n if (options.until !== undefined && options.until !== null) {\n request.withQueryParam(\"until\", options.until);\n }\n if (options.scope !== undefined && options.scope !== null) {\n request.withQueryParam(\"scope\", options.scope);\n }\n if (options.activityTypes !== undefined && options.activityTypes !== null) {\n request.withQueryParam(\"activityTypes\", options.activityTypes);\n }\n if (options.pageSize !== undefined && options.pageSize !== null) {\n request.withQueryParam(\"pageSize\", options.pageSize);\n }\n }\n var wixApi = this;\n return this.resourceRequest(request, function(data) {\n return new WixPagingData(data, function(cursor) {\n return wixApi.getActivities(cursor, null);\n }, function(elem) {\n return new WixActivityData().init(elem);\n });\n });\n };\n\n /**\n * Returns a list of all activity types contained within the Wix system\n * @returns {Promise.<Array.<string>, error>} A promise for an array of strings\n */\n this.getTypes = function() {\n return this.resourceRequest(this.createRequest(\"GET\", \"/v1/activities/types\"), null);\n }\n}", "static defaultStart (component) {\n store.commit('START_PROCESS', 'vk')\n component.loading = true\n component.result = []\n }", "get loadType() {}", "static nameStatic() {\n console.log('static hey');\n }", "function loadScript() {\n var script = document.createElement('script');\n script.src = \"https://maps.googleapis.com/maps/api/js?key=AIzaSyAg67S7m3vG4o51-RyozMWZ1mtmzSIS-1o&callback=scriptLoaded\";\n\n document.head.appendChild(script);\n }", "function _useLoadUtil() {\n load(square.stage, app.stage);\n load(circle.stage, app.stage);\n}", "function forceLoad() {}", "function loadTracker() {\n // setup tracker\n ctracker = new clm.tracker();\n ctracker.init(pModel);\n ctracker.start(videoInput.elt);\n}", "function startServiceAsync(intineratyActivity, organizationId, forceStart, done) {\r\n try {\r\n var activity = intineratyActivity.activity;\r\n var itinerary = intineratyActivity.itinerary;\r\n\r\n if (activity.type === 'draw2d.Connection' || activity.type === 'LabelConnection') {\r\n done();\r\n return;\r\n }\r\n // used for addons\r\n let bindingGyp = {\r\n \"make_global_settings\": [\r\n {\r\n \"CXX\": [\"/snap/microservicebus-node/x1/usr/bin/g++\"],\r\n \"CC\": [\"/snap/microservicebus-node/x1/usr/bin/gcc\"]\r\n }],\r\n targets: []\r\n };\r\n async.waterfall([\r\n // Init\r\n function (callback) {\r\n try {\r\n var host = activity.userData.config.generalConfig.find(function (c) { return c.id === 'host'; }).value;\r\n\r\n var isEnabled = activity.userData.config.generalConfig.find(function (c) { return c.id === 'enabled'; }).value;\r\n\r\n var hosts = host.split(',');\r\n var a = hosts.indexOf(settingsHelper.settings.nodeName);\r\n\r\n var scriptFileUri = activity.userData.isCustom ?\r\n settingsHelper.settings.hubUri + '/api/Scripts/' + settingsHelper.settings.organizationId + '/' + activity.userData.type + '.js' :\r\n settingsHelper.settings.hubUri + '/api/Scripts/00000000-0000-0000-0000-000000000001/' + activity.userData.type + '.js';\r\n\r\n if (activity.userData.bindToVersion && activity.userData.version && settingsHelper.settings.coreVersion !== \"beta\") {\r\n scriptFileUri += \"/\" + activity.userData.version;\r\n }\r\n\r\n scriptFileUri = scriptFileUri.replace('wss://', 'https://');\r\n\r\n var integrationId = activity.userData.integrationId;\r\n\r\n var scriptfileName = activity.userData.type + '.js'\r\n\r\n var scriptVersion = activity.userData.bindToVersion && activity.userData.version ? activity.userData.version.yellow : \"Latest\".green;\r\n\r\n if (!isEnabled || (itinerary.enabled !== undefined && itinerary.enabled === false)) {\r\n var lineStatus = \"|\" + util.padRight(activity.userData.id, 39, ' ') + \"| \" + \"Disabled\".grey + \" |\" + util.padRight(itinerary.integrationName, 39, ' ') + \"|\";\r\n self.onLog(lineStatus);\r\n done();\r\n return;\r\n }\r\n var exist = _downloadedScripts.find(function (s) { return s.name === scriptfileName; }); // jshint ignore:line \r\n\r\n callback(null, exist, scriptFileUri, scriptfileName, scriptVersion, integrationId);\r\n }\r\n catch (error1) {\r\n self.onLog(error1.message);\r\n done();\r\n }\r\n },\r\n // Download \r\n function (exist, scriptFileUri, scriptfileName, scriptVersion, integrationId, callback) {\r\n try {\r\n var localFilePath = path.resolve(settingsHelper.serviceDirectory, scriptfileName);\r\n\r\n if (settingsHelper.isOffline) { // We're offline, and will load files from disk\r\n callback(null, localFilePath, integrationId, scriptfileName, scriptVersion);\r\n }\r\n else {\r\n let requestOptions = {\r\n maxAttempts: 3,\r\n retryDelay: 3000,\r\n url: scriptFileUri\r\n };\r\n \r\n webRequest(requestOptions, function (err, response, scriptContent) {\r\n if (response.statusCode != 200 || err != null) {\r\n if (activity.userData.bindToVersion && activity.userData.version) {\r\n self.onLog(\"Unable to get file: \" + scriptfileName + \" -version \" + activity.userData.version);\r\n }\r\n else {\r\n self.onLog(\"Unable to get file:\" + scriptfileName);\r\n\r\n }\r\n if (fs.existsSync(localFilePath)) {\r\n self.onLog(\"Local file already exists. Proceeding with potentially old version\");\r\n _downloadedScripts.push({ name: scriptfileName });\r\n callback(null, localFilePath, integrationId, scriptfileName);\r\n }\r\n var lineStatus = \"|\" + util.padRight(activity.userData.id, 39, ' ') + \"| \" + \"Not found\".red + \" |\" + util.padRight(itinerary.integrationName, 39, ' ') + \"|\";\r\n self.onLog(lineStatus);\r\n //done();\r\n }\r\n else {\r\n\r\n fs.writeFileSync(localFilePath, scriptContent);\r\n _downloadedScripts.push({ name: scriptfileName });\r\n callback(null, localFilePath, integrationId, scriptfileName, scriptVersion);\r\n }\r\n });\r\n }\r\n }\r\n catch (error2) {\r\n self.onLog(error2.message);\r\n done();\r\n }\r\n },\r\n // Create Service\r\n function (localFilePath, integrationId, scriptfileName, scriptVersion, callback) {\r\n var newMicroService = null;\r\n try {\r\n if (localFilePath == null) {\r\n callback(null, null);\r\n }\r\n // Load an instance of the base class\r\n newMicroService = new MicroService(reload(localFilePath));\r\n newMicroService.NodeName = settingsHelper.settings.nodeName;\r\n newMicroService.OrganizationId = organizationId;\r\n newMicroService.ItineraryId = itinerary.itineraryId;\r\n newMicroService.Id = activity.id;\r\n newMicroService.Name = activity.userData.id;\r\n newMicroService.Itinerary = itinerary;\r\n newMicroService.IntegrationId = activity.userData.integrationId;\r\n newMicroService.IntegrationName = itinerary.integrationName;\r\n newMicroService.Environment = itinerary.environment;\r\n newMicroService.Version = scriptVersion;\r\n newMicroService.TrackingLevel = itinerary.trackingLevel;\r\n newMicroService.Init(activity.userData.config);\r\n newMicroService.UseEncryption = settingsHelper.settings.useEncryption;\r\n newMicroService.ComSettings = _comSettings;\r\n newMicroService.baseType = activity.userData.baseType;\r\n newMicroService.Com = com;\r\n newMicroService.Orchestrator = _orchestrator;\r\n newMicroService.settingsHelper = settingsHelper;\r\n newMicroService.timezone = settingsHelper.settings.timezone;\r\n newMicroService.Converter = _unitConverter;\r\n newMicroService.getAllServices = function () {\r\n return self._microServices;\r\n };\r\n newMicroService.addonDirectory = path.resolve(settingsHelper.homeDirectory, \"addons/build/Release\");\r\n newMicroService.OnReceivedState(function (state, sender) {\r\n com.ChangeState(state, sender);\r\n });\r\n // Eventhandler for messages sent back from the service\r\n newMicroService.OnMessageReceived(function (integrationMessage, sender) {\r\n try {\r\n integrationMessage.OrganizationId = settingsHelper.settings.organizationId;\r\n\r\n if (integrationMessage.FaultCode != null) {\r\n trackException(integrationMessage,\r\n integrationMessage.LastActivity,\r\n \"Failed\",\r\n integrationMessage.FaultCode,\r\n integrationMessage.FaultDescripton);\r\n\r\n //self.onLog('Exception: '.red + integrationMessage.FaultDescripton);\r\n self.onLog(\"EXCEPTION: \".red + '['.gray + sender.Name + ']'.gray + '=>'.red + integrationMessage.FaultDescripton);\r\n return;\r\n }\r\n\r\n trackMessage(integrationMessage, integrationMessage.LastActivity, integrationMessage.IsFirstAction ? \"Started\" : \"Completed\");\r\n\r\n // Process the itinerary to find next service\r\n _orchestrator.getSuccessors(integrationMessage)\r\n .then(function (successors) {\r\n successors.forEach(function (successor) {\r\n integrationMessage.Sender = settingsHelper.settings.nodeName;\r\n\r\n // No correlation\r\n try {\r\n var messageString = '';\r\n if (integrationMessage.ContentType != 'application/json' && integrationMessage.ContentType != 'application/octet-stream') {\r\n var buf = new Buffer(integrationMessage._messageBuffer, 'base64');\r\n messageString = buf.toString('utf8');\r\n }\r\n\r\n var destination = sender.ParseString(successor.userData.host, messageString, integrationMessage);\r\n integrationMessage.isDynamicRoute = destination != successor.userData.host;\r\n destination.split(',').forEach(function (destinationNode) {\r\n\r\n // Encrypt?\r\n if (settingsHelper.settings.useEncryption == true) {\r\n var messageBuffer = new Buffer(integrationMessage._messageBuffer, 'base64');\r\n messageBuffer = util.encrypt(messageBuffer);\r\n integrationMessage.Encrypted = true;\r\n integrationMessage._messageBuffer = messageBuffer;\r\n // integrationMessage.MessageBuffer = messageBuffer;\r\n }\r\n\r\n if (destinationNode == settingsHelper.settings.nodeName || settingsHelper.settings.tags.find((i) => { return i === destinationNode; })) {\r\n receiveMessage(integrationMessage, successor.userData.id);\r\n }\r\n else {\r\n if (typeof integrationMessage._messageBuffer != \"string\") {\r\n integrationMessage._messageBuffer = integrationMessage._messageBuffer.toString('base64');\r\n //integrationMessage.MessageBuffer = integrationMessage._messageBuffer;\r\n }\r\n com.Submit(integrationMessage,\r\n destinationNode.toLowerCase(),\r\n successor.userData.id);\r\n }\r\n });\r\n\r\n }\r\n catch (err) {\r\n self.onLog(err);\r\n }\r\n });\r\n })\r\n .catch(function (err) {\r\n self.onLog(err);\r\n });\r\n\r\n\r\n }\r\n catch (generalEx) {\r\n self.onLog(generalEx.message);\r\n }\r\n });\r\n // [DEPRICATED]Eventhandler for any errors sent back from the service\r\n newMicroService.OnError(function (source, errorId, errorDescription) {\r\n self.onLog(\"The Error method is deprecated. Please use the ThrowError method instead.\".red);\r\n self.onLog(\"Error at: \".red + source);\r\n self.onLog(\"Error id: \".red + errorId);\r\n self.onLog(\"Error description: \".red + errorDescription);\r\n });\r\n // Eventhandler for any debug information sent back from the service\r\n newMicroService.OnDebug(function (source, info) {\r\n\r\n self.onLog(\"DEBUG: \".green + '['.gray + source.gray + ']'.gray + '=>'.green + info);\r\n\r\n if (settingsHelper.settings.debug != null && settingsHelper.settings.debug == true) {// jshint ignore:line \r\n _applicationinsights.trackEvent(\"Tracking\", { service: source, state: info });\r\n }\r\n });\r\n // Eventhander for reporting location \r\n newMicroService.OnReportLocation(function (location) {\r\n self.onReportLocation(location);\r\n });\r\n\r\n newMicroService.OnUnitTestComplete(function (result) {\r\n\r\n self.onUnitTestComplete(result);\r\n });\r\n\r\n callback(null, newMicroService, scriptfileName);\r\n }\r\n catch (error3) {\r\n if (!newMicroService) {\r\n self.onLog('Unable to load '.red + localFilePath.red + ' ' + error3);\r\n }\r\n else\r\n self.onLog('Unable to start service '.red + newMicroService.Name.red + ' ' + error3);\r\n\r\n done();\r\n }\r\n },\r\n // Start Service\r\n function (newMicroService, scriptfileName, callback) {\r\n if (newMicroService == null) {\r\n callback(null, null);\r\n }\r\n // Start the service\r\n try {\r\n self._microServices.push(newMicroService);\r\n if (activity.userData.isInboundREST || activity.userData.type === \"azureApiAppInboundService\") {\r\n if (!_startWebServer) {\r\n util.addNpmPackages('express,body-parser', false, function (err) {\r\n http = require('http');\r\n express = require('express');\r\n bodyParser = require('body-parser');\r\n app = express();\r\n _startWebServer = true;\r\n newMicroService.App = app;\r\n callback();\r\n });\r\n }\r\n else {\r\n newMicroService.App = app;\r\n callback();\r\n }\r\n }\r\n else {\r\n callback();\r\n }\r\n }\r\n catch (ex) {\r\n self.onLog('Unable to start service '.red + newMicroService.Name.red);\r\n if (typeof ex === 'object')\r\n self.onLog(ex.message.red);\r\n else\r\n self.onLog(ex.red);\r\n\r\n exceptionsLoadingItineraries++;\r\n callback(null, 'exception');\r\n }\r\n },\r\n // Download dependancies\r\n function (callback) {\r\n if (!activity.userData.config.dependenciesConfig ||\r\n !activity.userData.config.dependenciesConfig.length ||\r\n settingsHelper.isOffline) {\r\n callback(null, 'done');\r\n }\r\n else {\r\n self.onLog('Download dependancies');\r\n // Get List of all uri's\r\n var dependancyFilesURIs = activity.userData.config.dependenciesConfig.map(function (dependancyFile) {\r\n let dependancyFileUri = settingsHelper.settings.hubUri + '/api/Scripts/' + dependancyFile.organizationId + \"/\" + dependancyFile.name;\r\n dependancyFileUri = dependancyFileUri.replace('wss://', 'https://');\r\n return dependancyFileUri;\r\n });\r\n\r\n var addOnName = activity.userData.type;\r\n self.onLog('addOnName: ' + addOnName);\r\n // Create build directory\r\n var directory = path.resolve(settingsHelper.homeDirectory, \"addons\");\r\n\r\n // Download dependancy file\r\n let target = {\r\n target_name: addOnName,\r\n sources: []\r\n };\r\n\r\n let depCount = 0;\r\n async.forEach(dependancyFilesURIs, function (dependancyFileURI, done) {\r\n if (_downloadedDependancyFiles.find(fileUri => { return fileUri === dependancyFileURI; })) {\r\n done();\r\n }\r\n else {\r\n\r\n _downloadedDependancyFiles.push(dependancyFileURI);\r\n\r\n let requestOptions = {\r\n maxAttempts: 3,\r\n retryDelay: 3000,\r\n url: dependancyFileURI\r\n };\r\n // TEST\r\n webRequest(requestOptions, function (err, response, scriptContent) {\r\n var dependancyFileName = path.basename(dependancyFileURI);\r\n if (response.statusCode != 200 || err != null) {\r\n\r\n self.onLog(`Unable to get dependancy file: ${dependancyFileName}`);\r\n self.onLog(`Status code: ${response.statusCode}`);\r\n self.onLog(`URI: ${dependancyFileURI}`);\r\n\r\n if (fs.existsSync(localFilePath)) {\r\n self.onLog(\"Local file already exists. Proceeding with potentially old version\");\r\n done();\r\n }\r\n else {\r\n done(\"Local file does not exists. This will likely cause issues!. File:\" + dependancyFileName);\r\n }\r\n }\r\n else {\r\n var localFilePath = path.resolve(settingsHelper.serviceDirectory, dependancyFileName);\r\n\r\n if (path.extname(dependancyFilesURIs[0]) === '.js') {\r\n\r\n self.onLog('Saving JS file: ' + localFilePath);\r\n fs.writeFileSync(localFilePath, scriptContent);\r\n done();\r\n }\r\n else {\r\n // Create addOn directory\r\n self.onLog('Create directory: ' + directory);\r\n if (!fs.existsSync(directory)) {\r\n fs.mkdirSync(directory);\r\n }\r\n var localFilePath = path.resolve(directory, dependancyFileName);\r\n self.onLog('Saving addon file: ' + localFilePath);\r\n fs.writeFileSync(localFilePath, scriptContent);\r\n target.sources.push(dependancyFileName);\r\n done();\r\n }\r\n\r\n }\r\n });\r\n }\r\n }, function (err) {\r\n if (err) {\r\n self.onLog(err);\r\n callback(null, 'exception');\r\n }\r\n else if (target.sources.length) {\r\n bindingGyp.targets.push(target);\r\n callback(null, 'done', directory);\r\n }\r\n else\r\n callback(null, 'done');\r\n });\r\n }\r\n }\r\n\r\n ], function (x, status, directory) {\r\n\r\n if (bindingGyp.targets.length) {\r\n // Create binding file\r\n fs.writeFileSync(path.resolve(directory, \"binding.gyp\"), JSON.stringify(bindingGyp));\r\n // Create package file\r\n fs.writeFileSync(path.resolve(directory, \"package.json\"), '{\"name\":\"microServiceBus-addons\",\"version\":\"1.0.0\",\"description\":\"...\",\"dependencies\":{},\"devDependencies\":{},\"scripts\":{},\"author\":\"\",\"license\":\"MIT\",\"repository\":{},\"config\":{\"unsafe-perm\":true},\"gypfile\":true}');\r\n // BUILD\r\n self.onLog('Compiling addon...');\r\n util.compile(directory, function (err, data) {\r\n self.onLog('Done compiling...');\r\n if (err) {\r\n self.onLog('Unable to compile service.'.red);\r\n self.onLog('ERROR: '.red + err);\r\n\r\n }\r\n else {\r\n self.onLog('Service compiled successfully'.green);\r\n self.onLog('Response : ' + JSON.stringify(data));\r\n }\r\n done();\r\n });\r\n }\r\n else {\r\n done();\r\n }\r\n });\r\n }\r\n catch (ex2) {\r\n self.onLog('Unable to start service.'.red);\r\n self.onLog(ex2.message.red);\r\n }\r\n }", "function iabLoadStart(event) {\n\n}", "function loadWebComponent( location ){\n\n \tvar promise = new Promise(function(resolve, reject){\n\n\t \t//Load the Web Component\n\t\tvar link_tag = document.createElement('link');\n\t\tlink_tag.setAttribute('href', location);\n\t\tlink_tag.setAttribute('rel','import');\n\n\t\tlink_tag.onload = function(){\n\t\t\tresolve(location);\n\t\t\tconsole.log( 'Link load event');\n\t\t};\n\n\t\tdocument.head.appendChild(link_tag);\n\n\t});\n\n\treturn promise;\n\n }", "function presenterDeskshareHasStarted() {\n // references a functiion in the global namespace inside verto_extension.js\n // that we load dynamically\n vertoWatchVideo();\n}" ]
[ "0.63854283", "0.56858885", "0.5656677", "0.5606952", "0.5475662", "0.5402945", "0.5345644", "0.5342511", "0.52068734", "0.51373327", "0.51373327", "0.51373327", "0.51373327", "0.51373327", "0.51373327", "0.50948447", "0.50776845", "0.5030943", "0.5029737", "0.49863693", "0.49805325", "0.49405393", "0.4931898", "0.4931898", "0.4931898", "0.49277124", "0.48917818", "0.48917818", "0.48893124", "0.48418504", "0.48385084", "0.48227298", "0.48055992", "0.48028177", "0.47889248", "0.4784474", "0.47795787", "0.4779061", "0.47728926", "0.47628218", "0.47135717", "0.46943137", "0.46943137", "0.46943137", "0.46943137", "0.46943137", "0.46943137", "0.46912894", "0.46875814", "0.46850368", "0.46812811", "0.4673089", "0.4670649", "0.4668042", "0.46635163", "0.46540418", "0.46518064", "0.46356544", "0.46316832", "0.46247125", "0.46226296", "0.46221125", "0.46199685", "0.46154636", "0.46133977", "0.46107388", "0.46076107", "0.46059895", "0.46051848", "0.46029776", "0.46028686", "0.46027514", "0.4599058", "0.4585372", "0.4584884", "0.4573107", "0.4564848", "0.4563761", "0.4559793", "0.4549393", "0.45468193", "0.45346573", "0.4532856", "0.45321742", "0.45290464", "0.4528408", "0.4524661", "0.45179653", "0.45163286", "0.45154265", "0.45151535", "0.4512611", "0.45059052", "0.45057094", "0.45042017", "0.45000833", "0.44998294", "0.44967043", "0.44943792", "0.44936246", "0.449117" ]
0.0
-1
Method to stop video ac
stopVideo() { var myVideoac = document.getElementById("embedVideo-ac"); var myVideo = document.getElementById("embedVideo"); if(myVideoac) { $(myVideoac).attr("src", $(myVideoac).attr("src")); } if(myVideo) { $(myVideo).attr("src", $(myVideo).attr("src")); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stopVideo() {\r\n player.pauseVideo();\r\n }", "function stopVideo() {\n\tplayer.stopVideo();\n}", "function stopVideo() {\n player.stopVideo();\n clearInterval(videoProgress);\n }", "function stopVideo() {\n // Reset the time to zero\n video.currentTime = 0;\n video.pause();\n\n}", "function stopVideo() {\n //e.preventDefault()\n $play.setAttribute('disabled','disabled')\n video.status='pause'\n const message = video\n soc.emit('sendMessage', message, (error) => {\n $messageFormButton.removeAttribute('disabled')\n if(error) {\n return console.log(error)\n }\n player.playVideo();\n console.log('Video Play')\n })\n // player.stopVideo();\n }", "function stopVideo () {\n let tracks = videoStream.getTracks()\n tracks.forEach(function (track) {\n track.stop()\n })\n video.srcObject = null\n}", "stop(){\n this.state.video.pause();\n this.state.video2.pause();\n }", "function stop_Webcam(){\n\t\t let stream = document.querySelector('#vidDisplay').srcObject;\n\t\t let tracks = stream.getTracks();\n\n\t\t tracks.forEach(function(track) {\n\t\t\t track.stop();\n\t\t });\n\t }", "stop() {\n if(this._currentStream){\n this._currentStream.getVideoTracks()[0].stop();\n this._currentStream = null;\n }\n }", "function stopVideo() {\n let iframe = document.getElementById('video');\n iframe.src = iframe.src;\n}", "function stopVideo() {\n console.log(\"Inside stop video\");\n stream.getVideoTracks()[0].enabled = false;\n stream.getVideoTracks().forEach((track) => {\n track.stop();\n });\n\n stream.getAudioTracks().forEach((track) => {\n track.stop();\n });\n }", "function stop() {\n\t\t/* Make sure the user is recording. */\n\t\tif( _Nimbb.getState() != \"recording\" ) {\n\t\t \talert(\"You need to record a video.\");\n\t\t \treturn;\n\t\t}\n\n\t\t/* Stop timer. */\n\t\tclearTimeout(_Timer);\n\n\t\t/* Stop recording. */\n\t\t_Nimbb.stopVideo();\n\t}", "function stopVideo() {\n if (vid.currentTime >= stopTime && state == 1) {\n \tvid.pause();\n state = 0;\n }\n}", "stopVideo() {\n this.$viewElement.find(\"iframe\")[0].contentWindow.postMessage('{\"event\":\"command\",\"func\":\"' + 'stopVideo' + '\",\"args\":\"\"}', '*');\n }", "stop() {\n const tracks = this.stream.getTracks();\n tracks.forEach(track => track.stop());\n try {\n this.webcamVideoElement.srcObject = null;\n }\n catch (error) {\n console.log(error);\n this.webcamVideoElement.src = null;\n }\n this.isClosed = true;\n }", "stop() {\n const tracks = this.stream.getTracks();\n tracks.forEach(track => track.stop());\n try {\n this.webcamVideoElement.srcObject = null;\n }\n catch (error) {\n console.log(error);\n this.webcamVideoElement.src = null;\n }\n this.isClosed = true;\n }", "function stopVideo(i) {\n currentVid[i].pause();\n}", "function stopMovie(){\r\n mediaName = $('#MediaPlayer').attr('title') || \"USG Video\";\r\n s.Media.stop(mediaName,mediaOffset);\r\n}", "function CloseVideoScreen() {\n watchingVideo = false\n\n var videoElm = document.getElementById(\"vs-video\")\n\n videoElm.pause()\n videoElm.currentTime = 0\n document.getElementById(\"video-wrap\").classList.add(\"closed\")\n}", "stopDownload() {\n this.pauseDownload();\n // TODO also close down the child_process\n sendMessage({\n type: 'stop',\n message: video.unpipe()\n });\n }", "function stopMyVideoTrack() { myMediaStream.getVideoTracks()[0].stop(); }", "function stopVideoRecording() {\n if (!videoIsRecording) return;\n recorder.stop();\n videoRecordingComplete = true;\n videoIsRecording = false;\n // console.log(recordingInt); // fixme recording bugs\n clearInterval(recordingInt);\n videoButton.innerHTML = \"<i class='fas fa-download'></i> Video\";\n}", "stop() {\n player.src(player.src());\n }", "function stopCam(cont) {\n cont.stop;\n cont.srcObject = null;\n}", "function stopVideo(){\n var $frame = $('iframe#popupvieoSourch');\n // saves the current iframe source\n var vidsrc = $frame.attr('src');\n // sets the source to nothing, stopping the video\n $frame.attr('src',''); \n // sets it back to the correct link so that it reloads immediately on the next window open\n $frame.attr('src', vidsrc);\n }", "function stopVideo(){\n\t// Grab the element that houses the video\n\tvar div = document.getElementsByClassName(\"image\")[0];\n\n\t// Set the inner HTML back to the normal picture\n\tdiv.innerHTML = \"<img src=\\\"images/rickroll.jpg\\\" class=\\\"productpic\\\" alt=\\\"Rick Rolling\\\"/>\";\n\n\t// Add the rick roll button back\n\tvar rickRollButton = document.getElementById(\"rickrollbutton\");\n\trickRollButton.style.display = \"inline\";\n\n\t// Hide the stop button\n\tvar stopButton = document.getElementById(\"stop\");\n\tstopButton.style.display = \"none\";\n}", "stop() {\n this.player.stop();\n }", "function stopFunction() {\n if (interval) clearInterval(interval); // stop frame grabbing\n if (videoDevice) videoDevice.stop(); // turn off the camera\n }", "pause() {\n this.video.pause();\n }", "stopMedia() {\n\t\tif (this._hasPlayer()) {\n\t\t\tthis._player.unload();\n\t\t\tthis._onStopHandler();\n\t\t}\n\t}", "function videoStop($wrapper) {\n // if we're stopping all videos on page\n if (!$wrapper) {\n var $wrapper = $('.js-videoWrapper');\n var $iframe = $('.js-videoIframe');\n // if we're stopping a particular video\n } else {\n var $iframe = $wrapper.find('.js-videoIframe');\n }\n // reveal poster\n $wrapper.removeClass('videoWrapperActive');\n // remove youtube link, stopping the video from playing in the background\n $iframe.attr('src','');\n }", "function stop() {\r\n player.pause();\r\n player.currentTime = 0;\r\n init();\r\n }", "function videoStop($wrapper) {\n // if we're stopping all videos on page\n if (!$wrapper) {\n var $wrapper = $('.js-videoWrapper');\n var $iframe = $('.js-videoIframe');\n // if we're stopping a particular video\n } else {\n var $iframe = $wrapper.find('.js-videoIframe');\n }\n // reveal poster\n $wrapper.removeClass('videoWrapperActive');\n // remove youtube link, stopping the video from playing in the background\n $iframe.attr('src','');\n }", "function stopWebcam() {\n var vid = document.querySelector('video');\n vid.srcObject.getTracks().forEach((track) => {\n track.stop();\n });\n // disable snapshot button\n document.querySelector('#takeSnap').disabled = true;\n}", "function endMovie(){\r\n stopMovie();\r\n mediaName = $(\"#MediaPlayer\").attr(\"title\") || \"USG Video\";\r\n s.Media.close(mediaName); \r\n}", "Stop()\n {\n this._isPlaying = false;\n }", "stop() {\n if (this.state === _VideoSIPGWConstants__WEBPACK_IMPORTED_MODULE_3__[\"STATE_OFF\"] || this.state === _VideoSIPGWConstants__WEBPACK_IMPORTED_MODULE_3__[\"STATE_FAILED\"]) {\n logger.warn('Video SIP GW session already stopped or failed!');\n return;\n }\n\n this._sendJibriIQ('stop');\n }", "function stopBGAudio()\n\t{\n\n\t}", "function stopButtonPressed() {\n $('#finish').hide();\n $('#pause').hide();\n $('#start').hide();\n feelrecord.stop();\n feelrecord.save(subsToken);\n stopTimer();\n mediaRecorder.stop();\n // TODO use jquery\n videoElement.controls = true;\n mode = playMode;\n playMode.init();\n }", "exitVR () {\n this.enabled = false\n this.hideVideo()\n }", "function videoStop($wrapper) {\n // if we're stopping all videos on page\n if (!$wrapper) {\n var $wrapper = $('.js-videoWrapper');\n var $iframe = $('.js-videoIframe');\n // if we're stopping a particular video\n } else {\n var $iframe = $wrapper.find('.js-videoIframe');\n }\n // reveal poster\n $wrapper.removeClass('videoWrapperActive');\n // remove youtube link, stopping the video from playing in the background\n $iframe.attr('src','');\n}", "function videoStop($wrapper) {\n // if we're stopping all videos on page\n if (!$wrapper) {\n var $wrapper = $('.js-videoWrapper');\n var $iframe = $('.js-videoIframe');\n // if we're stopping a particular video\n } else {\n var $iframe = $wrapper.find('.js-videoIframe');\n }\n // reveal poster\n $wrapper.removeClass('videoWrapperActive');\n // remove youtube link, stopping the video from playing in the background\n $iframe.attr('src','');\n}", "function stop() {\n document.getElementById(\"aud-source\").pause();\n document.getElementById(\"aud-source\").currentTime = 0;\n document.getElementById(\"playBtn\").disabled = false;\n}", "function stopMedia(destiny){\n var panel = getSlideOrSection(destiny);\n\n //stopping HTML5 media elements\n $('video, audio', panel).forEach(function(element){\n if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {\n element.pause();\n }\n });\n\n //youtube videos\n $('iframe[src*=\"youtube.com/embed/\"]', panel).forEach(function(element){\n if( /youtube\\.com\\/embed\\//.test(element.getAttribute('src')) && !element.hasAttribute('data-keepplaying')){\n element.contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}','*');\n }\n });\n }", "function stopMedia(destiny){\n var panel = getSlideOrSection(destiny);\n\n //stopping HTML5 media elements\n $('video, audio', panel).forEach(function(element){\n if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {\n element.pause();\n }\n });\n\n //youtube videos\n $('iframe[src*=\"youtube.com/embed/\"]', panel).forEach(function(element){\n if( /youtube\\.com\\/embed\\//.test(element.getAttribute('src')) && !element.hasAttribute('data-keepplaying')){\n element.contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}','*');\n }\n });\n }", "function stopMedia(destiny){\n var panel = getSlideOrSection(destiny);\n\n //stopping HTML5 media elements\n $('video, audio', panel).forEach(function(element){\n if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {\n element.pause();\n }\n });\n\n //youtube videos\n $('iframe[src*=\"youtube.com/embed/\"]', panel).forEach(function(element){\n if( /youtube\\.com\\/embed\\//.test(element.getAttribute('src')) && !element.hasAttribute('data-keepplaying')){\n element.contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}','*');\n }\n });\n }", "resetVideo() {\n this.videoElt.pause();\n this.videoElt.currentTime = 0;\n this.videoElt.style.display = 'none';\n }", "function stopMedia(destiny){\r\n var panel = getSlideOrSection(destiny);\r\n\r\n //stopping HTML5 media elements\r\n $('video, audio', panel).forEach(function(element){\r\n if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {\r\n element.pause();\r\n }\r\n });\r\n\r\n //youtube videos\r\n $('iframe[src*=\"youtube.com/embed/\"]', panel).forEach(function(element){\r\n if( /youtube\\.com\\/embed\\//.test(element.getAttribute('src')) && !element.hasAttribute('data-keepplaying')){\r\n element.contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}','*');\r\n }\r\n });\r\n }", "function stopMedia(destiny){\r\n var panel = getSlideOrSection(destiny);\r\n\r\n //stopping HTML5 media elements\r\n $('video, audio', panel).forEach(function(element){\r\n if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {\r\n element.pause();\r\n }\r\n });\r\n\r\n //youtube videos\r\n $('iframe[src*=\"youtube.com/embed/\"]', panel).forEach(function(element){\r\n if( /youtube\\.com\\/embed\\//.test(element.getAttribute('src')) && !element.hasAttribute('data-keepplaying')){\r\n element.contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}','*');\r\n }\r\n });\r\n }", "function stopVideos(){\n\t$(\".video-actu iframe\").each(function(index) {\n\t $(this).attr('src', $(this).attr('src'));\n\t});\n}", "function videoPause() {\n video.pause();\n }", "function videoPause() {\n video.pause();\n }", "stop() {\n this.pause();\n this._playingState = 'idle';\n this.index = 0;\n }", "function stop(){\n p.currentTime = 0;\n p.pause();\n}", "function stopMedia(destiny){\n var destiny = getSlideOrSection(destiny);\n\n //stopping HTML5 media elements\n destiny.find('video, audio').each(function(){\n var element = $(this).get(0);\n\n if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {\n /* nectar addition */ \n //element.pause();\n }\n });\n\n //youtube videos\n destiny.find('.nectar-youtube-bg iframe[src*=\"youtube.com/embed/\"]').each(function(){\n var element = $(this).get(0);\n\n if( /youtube\\.com\\/embed\\//.test($(this).attr('src')) && !element.hasAttribute('data-keepplaying')){\n $(this).get(0).contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}','*');\n }\n });\n }", "pause () {\n if (this.current) {\n this.current.video.pause()\n }\n }", "function stopMedia(destiny){\n var panel = getSlideOrSection(destiny);\n\n //stopping HTML5 media elements\n panel.find('video, audio').each(function(){\n var element = $(this).get(0);\n\n if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {\n element.pause();\n }\n });\n\n //youtube videos\n panel.find('iframe[src*=\"youtube.com/embed/\"]').each(function(){\n var element = $(this).get(0);\n\n if( /youtube\\.com\\/embed\\//.test($(this).attr('src')) && !element.hasAttribute('data-keepplaying')){\n $(this).get(0).contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}','*');\n }\n });\n }", "function stopMedia(destiny){\n var panel = getSlideOrSection(destiny);\n\n //stopping HTML5 media elements\n panel.find('video, audio').each(function(){\n var element = $(this).get(0);\n\n if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {\n element.pause();\n }\n });\n\n //youtube videos\n panel.find('iframe[src*=\"youtube.com/embed/\"]').each(function(){\n var element = $(this).get(0);\n\n if( /youtube\\.com\\/embed\\//.test($(this).attr('src')) && !element.hasAttribute('data-keepplaying')){\n $(this).get(0).contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}','*');\n }\n });\n }", "function trackVideoEnd() {\n\n flushParams();\n correlateMediaPlaybackEvents();\n s.Media.stop(videoFileName, videoStreamLength);\n s.Media.close(videoFileName);\n }", "function stopper(){\n\t\tif(isPlaying){\n\t\t\t$('#play_video').attr('value', 'Play!');\n\t\t\tvid.pause();\n\t\t\tisPlaying = false;\n\t\t}\n\t\tvid.currentTime = 0;\n\t\t$('#note').text(\"\");\n\t}", "function stop() {\n console.log(\"Stop playing \" + this.recordingFilename);\n\n if (Recording.isPlaying()) {\n Recording.stopPlaying();\n\n // This looks like it's a platform bug that this can't be removed\n // Agent.isAvatar = false;\n }\n this.isPlayingRecording = false;\n }", "function stopMedia(destiny) {\n var panel = getSlideOrSection(destiny); //stopping HTML5 media elements\n\n $('video, audio', panel).forEach(function (element) {\n if (!element.hasAttribute('data-keepplaying') && typeof element.pause === 'function') {\n element.pause();\n }\n }); //youtube videos\n\n $('iframe[src*=\"youtube.com/embed/\"]', panel).forEach(function (element) {\n if (/youtube\\.com\\/embed\\//.test(element.getAttribute('src')) && !element.hasAttribute('data-keepplaying')) {\n element.contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}', '*');\n }\n });\n }", "function stopMedia(destiny){\r\n var panel = getSlideOrSection(destiny);\r\n\r\n //stopping HTML5 media elements\r\n panel.find('video, audio').each(function(){\r\n var element = $(this).get(0);\r\n\r\n if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {\r\n element.pause();\r\n }\r\n });\r\n\r\n //youtube videos\r\n panel.find('iframe[src*=\"youtube.com/embed/\"]').each(function(){\r\n var element = $(this).get(0);\r\n\r\n if( /youtube\\.com\\/embed\\//.test($(this).attr('src')) && !element.hasAttribute('data-keepplaying')){\r\n $(this).get(0).contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}','*');\r\n }\r\n });\r\n }", "function stopMedia(destiny){\r\n var panel = getSlideOrSection(destiny);\r\n\r\n //stopping HTML5 media elements\r\n panel.find('video, audio').each(function(){\r\n var element = $(this).get(0);\r\n\r\n if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {\r\n element.pause();\r\n }\r\n });\r\n\r\n //youtube videos\r\n panel.find('iframe[src*=\"youtube.com/embed/\"]').each(function(){\r\n var element = $(this).get(0);\r\n\r\n if( /youtube\\.com\\/embed\\//.test($(this).attr('src')) && !element.hasAttribute('data-keepplaying')){\r\n $(this).get(0).contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}','*');\r\n }\r\n });\r\n }", "function stopMedia(destiny){\r\n var panel = getSlideOrSection(destiny);\r\n\r\n //stopping HTML5 media elements\r\n panel.find('video, audio').each(function(){\r\n var element = $(this).get(0);\r\n\r\n if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {\r\n element.pause();\r\n }\r\n });\r\n\r\n //youtube videos\r\n panel.find('iframe[src*=\"youtube.com/embed/\"]').each(function(){\r\n var element = $(this).get(0);\r\n\r\n if( /youtube\\.com\\/embed\\//.test($(this).attr('src')) && !element.hasAttribute('data-keepplaying')){\r\n $(this).get(0).contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}','*');\r\n }\r\n });\r\n }", "function stopMedia(destiny){\n var destiny = getSlideOrSection(destiny);\n\n //stopping HTML5 media elements\n destiny.find('video, audio').each(function(){\n var element = $(this).get(0);\n\n if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {\n element.pause();\n }\n });\n\n //youtube videos\n destiny.find('iframe[src*=\"youtube.com/embed/\"]').each(function(){\n var element = $(this).get(0);\n\n if( /youtube\\.com\\/embed\\//.test($(this).attr('src')) && !element.hasAttribute('data-keepplaying')){\n $(this).get(0).contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}','*');\n }\n });\n }", "function hideVideo() {\n if (player != null) {\n player.stopVideo();\n }\n $('#yt-player-container').fadeOut();\n }", "stop() {\n this._source.pause();\n this._source.currentTime = 0;\n }", "function stopVideoStreaming(options) {\n options = utils.isObject(options) ? options : {};\n\n videoStream.stopVideoStreaming(options);\n }", "function stopMedia(destiny) {\n var panel = getSlideOrSection(destiny);\n\n //stopping HTML5 media elements\n panel.find('video, audio').each(function() {\n var element = $(this).get(0);\n\n if (!element.hasAttribute('data-keepplaying') && typeof element.pause === 'function') {\n element.pause();\n }\n });\n\n //youtube videos\n panel.find('iframe[src*=\"youtube.com/embed/\"]').each(function() {\n var element = $(this).get(0);\n\n if (/youtube\\.com\\/embed\\//.test($(this).attr('src')) && !element.hasAttribute('data-keepplaying')) {\n $(this).get(0).contentWindow.postMessage('{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}', '*');\n }\n });\n }", "function pauseCurrentVideo() {\n \tisPlaying = false;\n \tvideo.pauseVideo();\n }", "function stop() {\n\t\tclearInterval(timer);\n\t\tdocument.getElementById(\"display\").innerHTML = \"\";\n\t\t// go back to beginning so it doesn't function as a pause button\n\t\tframeIndex = 0;\n\t\tswitchEnabled();\n\t}", "function stopAutoplay()\n{\n var video = document.querySelector(\".html5-main-video\");\n\n // No video found\n if (video == null)\n {\n console.log(\"Waiting for video...\");\n return;\n }\n\n // Video not ready\n if (video.readyState == 0)\n {\n console.log(\"Video not ready...\");\n return;\n }\n\n // Video ready, pause it and stop interval\n console.log(\"Video ready!\");\n video.pause();\n clearOneInterval(\"stopAutoplay\");\n}", "function unmuteVideo() {\n if (currentCall) {\n currentCall.unmuteVideo();\n }\n}", "stop() {\n this.paused = true;\n }", "function stop(element){\r\n document.getElementById(element).pause();\r\n}", "stop() {\n\n // exit if no stream is active\n if (typeof this._stream === 'undefined') {\n return;\n }\n\n // loop through all stream tracks (audio + video) and stop them\n this._stream.getTracks().forEach(function(track) {\n track.stop();\n });\n\n // reset the media element\n this._media.srcObject = null;\n }", "function stopMedia() {\n target = this.classList[1] - 1;\n \n shownMedia[target].pause();\n shownMedia[target].currentTime = 0;\n playPauseBtn[target].textContent = 'Play';\n }", "function stop() {\n exec(null, null, \"Accelerometer\", \"stop\", []);\n running = false;\n}", "Stop() {}", "stop() {\r\n this.audio.pause();\r\n this.audio.currentTime = 0;\r\n }", "stop() {\n if(!this.controller) {\n return;\n }\n this._sendRemoteControlEvent(this.controller, {\n type: EVENT_TYPES.stop\n });\n this._stop();\n }", "function stop() {\n exec(null, null, \"Accelerometer\", \"stop\", []);\n accel = null;\n running = false;\n}", "stop() {\n this._playing = false;\n }", "function soundCtl() {\n if ($scope.soundStatus === 'stop') {\n stopVideo();\n }\n }", "function stop() {\n\t\tthis.audio.pause();\n\t}", "stop () {\n if (this.player) {\n this.player.stop().off().unload()\n this.player = null\n this.currentSong = null\n\n }\n }", "_pauseVideo() {\n this.e.target.pauseVideo();\n console.log('Pausing the video');\n }", "function stop() {\n isGameActive = false;\n }", "function piloteVideo2() {\r\n\t\tif (LCCMA.paused) {\r\n\t\t\tLCCMA.play();\r\n \r\n\t\t} else {\r\n\t\t\tLCCMA.pause();}\r\n }", "function stop() {\r\n audio.pause();\r\n}", "function stop() {\n let btn = document.getElementById(\"playPause\");\n btn.textContent = \"Play\";\n player.currentTime = 0;\n player.pause();\n}", "stop() {\n this.running = false;\n }", "function videoEnded() {\n // services.tablet.then(function(tablet) {\n // tablet.stopVideo();\n // });\n // if (cStatus.media.type == 'video' && !cStatus.story.spoken) {\n // displayMedia(videoURL);\n // }\n}", "function btnComenzar() {\n vid.currentTime = 0;\n vid.play();\n}", "stop() {\n\t\t// Is OBS Studio connected?\n\t\tif (!this.obs.connected()) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\treject(new Error(\"OBS Studio is not connected.\".lox()));\n\t\t\t});\n\t\t}\n\n\t\t// Is it currently inactive?\n\t\tif (!this.active) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\tresolve(true);\n\t\t\t});\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.obs.call(\"obs.frontend.virtualcam.stop\", (result, error) => {\n\t\t\t\tif (result !== undefined) {\n\t\t\t\t\tthis._active = result;\n\t\t\t\t\tthis._event_status();\n\t\t\t\t\tresolve(result);\n\t\t\t\t} else {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function stopPlay () {\n\t\tremoveWeenie();\n \tclearInterval(interval1);\n \tclearInterval(interval2);\n \tclearInterval(countdown);\n\t}", "function stop() {\n\t\trunning = false;\n\t}", "stop(){\n //TODO: implement me.\n }", "function stopAllVideo() {\n if (CONFIG.debug) {\n cozenEnhancedLogs.info.functionCalled('ChatCtrl', 'stopAllVideo');\n }\n vm.messages.forEach(function (message) {\n if (message.category == 'video') {\n message.content.API.stop();\n }\n });\n }" ]
[ "0.8309867", "0.8251166", "0.8140124", "0.779453", "0.7769203", "0.77488244", "0.7713133", "0.77080923", "0.76743215", "0.7667609", "0.7615451", "0.7608679", "0.760148", "0.7533969", "0.7527587", "0.7527587", "0.7525821", "0.7505799", "0.748565", "0.7287064", "0.72867334", "0.7217991", "0.7187224", "0.7180186", "0.7171759", "0.71554923", "0.71395665", "0.71177036", "0.7099608", "0.7017429", "0.70042694", "0.6995519", "0.69924736", "0.6990336", "0.6981194", "0.69683903", "0.69671595", "0.6957728", "0.6957393", "0.6952659", "0.6928491", "0.6928491", "0.69264644", "0.6891651", "0.6891651", "0.6891651", "0.68719923", "0.6866316", "0.6866316", "0.68646276", "0.6856262", "0.6856262", "0.6842143", "0.6841966", "0.68415636", "0.68401146", "0.683653", "0.683653", "0.6830875", "0.6830237", "0.6812111", "0.68051356", "0.6800447", "0.6800447", "0.6800447", "0.67974985", "0.67742985", "0.6771662", "0.6765032", "0.6758718", "0.6749365", "0.67435515", "0.6741244", "0.6737542", "0.6707144", "0.67066175", "0.6693173", "0.66892916", "0.6688745", "0.6674077", "0.6667272", "0.6666774", "0.66575", "0.6628556", "0.66217285", "0.6618851", "0.66108984", "0.66097385", "0.6609168", "0.6606044", "0.65960306", "0.65914714", "0.65830505", "0.6574661", "0.65719545", "0.65635175", "0.65597594", "0.6548356", "0.6538151", "0.6536714" ]
0.7148558
26
This function should say whether the answer it is given is very positive positive negative very negative This function should expect to be called with any value which was returned by the shakeBall function.
function checkAnswer(answer, answerSelection) { //Write your code in here // if the "veryPositive" values in the possibleAnswers object include the string assigned to "answer" at the index specified by "answerSelection", then return "very positive" if (possibleAnswers.veryPositive.includes(answer, [answerSelection])) { return "very positive"; } // if the "positive" values in the possibleAnswers object include the string assigned to "answer" at the index specified by "answerSelection", then return "positive" else if (possibleAnswers.positive.includes(answer, [answerSelection])) { return "positive"; } // if the "negative" values in the possibleAnswers object include the string assigned to "answer" at the index specified by "answerSelection", then return "negative" else if (possibleAnswers.negative.includes(answer, [answerSelection])) { return "negative"; } // if the "veryNegative" values in the possibleAnswers object include the string assigned to "answer" at the index specified by "answerSelection", then return "very negative" else if (possibleAnswers.veryNegative.includes(answer, [answerSelection])) { return "very negative"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isTie(score) { return score == -1000; }", "function negativeAmount() {\n if (userGuess / secretNumber === 1){\n setFeedback(\"You win\");\n finish = true;\n } else if ((userGuess - secretNumber) > 60.5){\n setFeedback(\"Wow! You are freezing!\");\n } else if ((userGuess - secretNumber) > 55.5){\n setFeedback(\"Wow! You better put on a jacket cause its super cold!\");\n } else if ((userGuess - secretNumber) > 50.5){\n setFeedback(\"Its is super cold man!\");\n } else if ((userGuess - secretNumber) > 40.5) {\n setFeedback(\"Now you are cold!\");\n } else if ((userGuess - secretNumber) > 30.5) {\n setFeedback(\"It's getting warm around here\");\n } else if((userGuess - secretNumber) > 20.5) {\n setFeedback(\"It's getting very warm in here!\");\n } else if((userGuess - secretNumber) > 15.5) {\n setFeedback(\"It's getting very very warm in here!\");\n } else if ((userGuess - secretNumber) > 7.5){\n setFeedback(\"It is hot!\");\n } else if ((userGuess - secretNumber) > 5.5){\n setFeedback(\"I am very hot here!!\");\n } else if((userGuess - userGuess) > 1.5){\n setFeedback(\"I am burning here!!\");\n }else if ((userGuess - secretNumber) > 0.5){\n setFeedback(\"Its is hotter than the sun!!!!!\");\n } else {\n }\n }", "function positiveAmount() {\n if (userGuess / secretNumber === 1){\n setFeedback(\"You win\");\n finish = true;\n } else if ((secretNumber - userGuess) > 60.5){\n setFeedback(\"Wow! You are freezing!\");\n } else if ((secretNumber - userGuess) > 55.5){\n setFeedback(\"Wow! You better put on a jacket cause its super cold!\");\n } else if ((secretNumber - userGuess) > 50.5){\n setFeedback(\"Its is super cold man!\");\n } else if ((secretNumber - userGuess) > 40.5) {\n setFeedback(\"Now you are cold!\");\n } else if ((secretNumber - userGuess) > 30.5) {\n setFeedback(\"It's getting warm around here\");\n } else if((secretNumber - userGuess) > 20.5) {\n setFeedback(\"It's getting very warm in here!\");\n } else if((secretNumber - userGuess) > 15.5) {\n setFeedback(\"It's getting very very warm in here!\");\n } else if ((secretNumber - userGuess) > 7.5){\n setFeedback(\"It's hot!\");\n } else if ((secretNumber - userGuess) > 5.5){\n setFeedback(\"It is very hot here!\");\n } else if ((secretNumber - userGuess) > 1.5){\n setFeedback(\"I am burning here!!\");\n } else if ((secretNumber - userGuess) > 0.5){\n setFeedback(\"Its is hotter than the sun!!!!!\");\n } else {\n }\n }", "function checkFuel(){\r\n if (fuel > 0){\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}", "function wrongAnswer(){\n if(score>0){\n score = score-penalty;\n $(\"#points-animation\").html(\"-\"+penalty).css(\"color\", \"#b20005\").show().delay(500).hide(\"drop\", {direction: \"up\"}, 1000);\n }\n\n $(\".score-img\").attr(\"src\", \"images/oppdrag1/sadpopcorn.png\").delay(500).effect(\"shake\", \"slow\");\n $(\"#correct-output\").html(\"Du svarte feil!\");\n $(\".points\").html(score);\n }", "function wrongAnswer() {\n activeArray[enlarged].heat += HEAT_PENALTY;\n onFire = 0;\n \n if(activeArray[enlarged].heat > 100) {\n activeArray[enlarged].heat = 100;\n } \n $('#inGame').effect(\"shake\", {times:4, distance:5}, 250);\n /* whatever sound / images for later */\n\n}", "function shakeBall() {\n //Write your code in here\n}", "function handleEightBallShake(){\n const result = getAnswer();\n resultElement.innerHTML = result;\n}", "isHurt() {\n return (this.currentInvincibility > 0);\n }", "function isGoodFreethrowShooter(number){\n if (0 < number < 0.65) return \"Horrible freethrow shooter\";\n if (0.65 <= number < 0.80) return \"Decent freethrow shooter\";\n if (0.80 <= number < 1.00) return \"Great freethrow shooter\";\n}", "function isUserWin(score) { return score < -50; }", "function isPositive(something) {\n if (something > 0) {\n return true;\n }\n}", "function checkHit(ballPos, ran) {\n logBall(ballPos, ran);\n if (playerPos === ballPos) {\n score++;\n showScore();\n asdf += 3.754;\n $(\".ball\" + ran).stop();\n } else {\n $(\".ball\" + ran).stop();\n gameOver();\n }\n}", "isGoal() {\n if (this.hamming == 0) {\n return true;\n }\n return false;\n }", "settled(arr) {\n for (let i = 0; i < arr.length; i++) {\n if (Math.abs(arr[i]) > 0.1) {\n return false;\n }\n }\n return true;\n }", "function gameOver(numberOfLives){\n if(numberOfLives <= 0){\n return true\n }else{\n return false\n }\n}", "function checkAnswer() {\n//if right, adjust score and start a new game\n if ($(answer).text() === correctAnimal) {\n setTimeout(newRound, 500);\n score++;\n updateScore();\n// if wrong, shake the guesses and reset score\n} else {\n $('.guess').effect('shake');\n sayBackwards(correctAnimal);\n score = 0;\n updateScore();\n }\n}", "function ifChuckSaysSo() {\n return !!0;\n}", "gameWon() {\n return this.y == -10;\n }", "function coinToss() {\n return (Math.floor(Math.random() * 2) === 0);\n}", "function lovefunc(flower1, flower2){\n if(flower1 % 2 === 0 && flower2 % 2 != 0){\n return true\n } else if (flower1 % 2 != 0 && flower2 % 2 === 0) {\n return true\n } else {\n return false\n }\n}", "notGlitch() {\n this._processArguments(arguments);\n this._printActualForFailure = false;\n\n let passed = true;\n let passDetail, failDetail;\n\n let actual = this._actual;\n let expected = this._expected;\n for (let index = 0; index < actual.length; ++index) {\n let diff = Math.abs(actual[index - 1] - actual[index]);\n if (diff >= expected) {\n passed = false;\n failDetail = '${actual} has a glitch at index ' + index +\n ' of size ' + diff + '.';\n }\n }\n\n passDetail =\n '${actual} has no glitch above the threshold of ${expected}.';\n\n return this._assert(passed, passDetail, failDetail);\n }", "function totalLoser(ball) {\n return ball >= canvasY;\n }", "isBust(){\n return (this.calculateHand() > 21);\n }", "function isSnakeEyes(x, y) {\n if (x == 1 && y == 1) {\n return \"Snake Eyes!\";\n }\n return \"Not Snake Eyes!\";\n\n\n}", "function madeIt( x, y) {\n if( y === 0 ) {\n return true\n }\n}", "function giveUp() {\n//give the right answer by shaking the answer\n $('div').each(function() {\n if ($(this).text() === correctAnimal) {\n $(this).effect('shake');\n };\n });\n//insult the player\n speakInsult();\n//start a new game\n setTimeout(newRound, 2500);\n}", "function caughtSpeeding(speed, isBirthday) {\n if (isBirthday) {\n speed -= 5;\n }\n let isTicket = 0;\n if (speed > 60 && speed <= 80) {\n isTicket = 1; }\n else if (speed > 80) {\n isTicket = 2;\n }\n return isTicket;\n}", "eat(pos){\n let detect = dist(this.x, this.y, pos.x, pos.y);\n if(detect < 1){\n this.score++\n return true;\n }\n else{\n return false;\n }\n\n }", "function isAGoodScore(score) {\n if (score >= 50) {\n return \"That is a good score!\";\n } else {\n return \"Keet training..\";\n }\n}", "function answerIsIncorrect () {\r\n feedbackForIncorrect();\r\n}", "function lovefunc(flower1, flower2) {\n if ((flower1 + flower2) % 2 != 0) {\n return true;\n } else return false;\n}", "function detect (heartX, heartY, heartRad, $badPeopleLeft, $badPeopleBottom, $badPeopleWidth, $badPeopleHeight) {\n if (\n heartX > $badPeopleLeft &&\n heartX + (2 * heartRad) < $badPeopleLeft + $badPeopleWidth &&\n heartY > $badPeopleBottom &&\n heartY + (2 * heartRad) < $badPeopleBottom + $badPeopleHeight\n ) {\n console.log('colission detected')\n return true\n\n heartSpeedY = -heartSpeedY\n } else {\n console.log('nope')\n return false\n }\n }", "function tryTheHolyTrinary(value) {\n\treturn (value > 50) ? \"success!\" : \"errr..\";\n}", "function coinFlip() {\r\n return Math.random() >= 0.5;\r\n}", "function tennisSet(score1, score2) {\n\n if (score1 < 5 && score2 < 5) {\n return false\n }\n\n\n if ((score1 - score2 <= 3 || score2 - score1 <= 3) &&(score1 - score2 > 0 || score2 - score1 > 0)&& (score1 >= 5 && score2 >= 5)) {\n console.log(\"RETRY here\")\n return true\n }\n \n if(score1 >= 5 || score2 >= 5){\n if(score1 - score2 == 3 || score2 - score1 == 3){\n console.log(\"return here\")\n return true\n }\n }\n\n return false\n\n}", "function test() {\n function square(x) {\n return Math.pow(x, 2);\n }\n function cube(x) {\n return Math.pow(x, 3);\n }\n function quad(x) {\n return Math.pow(x, 4);\n }\n if (square(2) !== 4 || cube (3) !== 27 || quad(4) !== 256) {\n console.log(\"check question 1\");\n }\n else {\n console.log(\"You are great at math!\");\n }\n}", "function checkAnswer(){\n trueAnswer = returnCorrectAnswer();\n userAnswer = getInput();\n// this if statement is stating if user inputs the right answer what happens and if not what happens\n if(userAnswer === trueAnswer){\n var messageCorrect = array[global_index].messageCorrect;\n score ++;\n swal({\n title: messageCorrect,\n text: \"You got \" + score + \" out of 8 correct.\",\n });\n }\n else{\n var messageIncorrect = array[global_index].messageIncorrect;\n swal({\n title: messageIncorrect,\n text: \"You got \" + score + \" out of 8 correct.\",\n });\n }\n }", "function sc_isPositive(x) {\n return (x > 0);\n}", "function healthcheck() {\n if (target.healthScore <= 0) {\n drawLoser();\n }\n}", "function checkMath() {\n var answer, text;\n\n // Takes the checked value and the answer to see if they are true\n answer = document.getElementById(\"numb\").value;\n\n // If answer is between 5 psi on either side of totalFriction\n if (answer == totalFriction() ||\n answer == totalFriction() - 5 ||\n answer == totalFriction() + 5 ||\n answer == totalFriction() - 4 ||\n answer == totalFriction() + 4 ||\n answer == totalFriction() - 3 ||\n answer == totalFriction() + 3 ||\n answer == totalFriction() - 2 ||\n answer == totalFriction() + 2 ||\n answer == totalFriction() - 1 ||\n answer == totalFriction() + 1)\n {\n text = \"This is the correct PSI\";\n } else {\n text = \"Nope, remember your training my young padawan!\";\n };\n document.getElementById(\"demo\").innerHTML = text;\n }", "function flipCoin() {\n // Meant to be Math.random()\n return Math.random < 0.5;\n}", "function sc_isNegative(x) {\n return (x < 0);\n}", "function answerIsCorrect () {\r\n feedbackForCorrect();\r\n updateScore();\r\n}", "isWinner() {\n return this.y<=0;\n }", "function extraYahtzee(yahtzeePoints) {\n\n for (var i = 0; i < diceArray.length; i++) {\n if (diceArray[i] !== diceArray[0]) {\n return 0;\n }\n }\n if (yahtzeePoints === \"50\") {\n return 100;\n } else if (yahtzeePoints === \"\") {\n alert(\"You must fill in yahtzee first\")\n submitCount++;\n } else {\n return 0;\n }\n}", "shakeGesture(ax) {\n const threshold = 5;\n const time = 1000;\n\n if((ax>threshold||ax<(-1)*threshold) && this.state.shake_capturing === false){\n this.setState({shake_capturing:true});\n this.setState({shake_dir:((ax>0)?1:-1)})\n setTimeout(this.capturingGesture.bind(this),time)\n }\n if(ax>threshold && this.state.shake_dir>0 && this.state.shake_capturing === true){\n this.setState({shook:true});\n }\n if(ax<threshold && this.state.shake_dir<0 && this.state.shake_capturing === true){\n this.setState({shook:true});\n }\n }", "function isCorrect(){\n score++;\n setScore();\n}", "shake(sprite, magnitude = 16, angular = false) {\n\n //Get a reference to this current object so that\n //it's easy to maintain scope in the nested sub-functions\n let self = this;\n\n //A counter to count the number of shakes\n let counter = 1;\n\n //The total number of shakes (there will be 1 shake per frame)\n let numberOfShakes = 10;\n\n //Capture the sprite's position and angle so you can\n //restore them after the shaking has finished\n let startX = sprite.x,\n startY = sprite.y,\n startAngle = sprite.rotation;\n\n //Divide the magnitude into 10 units so that you can \n //reduce the amount of shake by 10 percent each frame\n let magnitudeUnit = magnitude / numberOfShakes;\n \n //The `randomInt` helper function\n let randomInt = (min, max) => {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n };\n \n //Add the sprite to the `shakingSprites` array if it\n //isn't already there\n if(self.shakingSprites.indexOf(sprite) === -1) {\n\n self.shakingSprites.push(sprite);\n \n //Add an `updateShake` method to the sprite.\n //The `updateShake` method will be called each frame\n //in the game loop. The shake effect type can be either\n //up and down (x/y shaking) or angular (rotational shaking).\n sprite.updateShake = () => {\n if(angular) {\n angularShake();\n } else {\n upAndDownShake();\n }\n };\n }\n\n //The `upAndDownShake` function\n function upAndDownShake() {\n\n //Shake the sprite while the `counter` is less than \n //the `numberOfShakes`\n if (counter < numberOfShakes) {\n\n //Reset the sprite's position at the start of each shake\n sprite.x = startX;\n sprite.y = startY;\n\n //Reduce the magnitude\n magnitude -= magnitudeUnit;\n\n //Randomly change the sprite's position\n sprite.x += randomInt(-magnitude, magnitude);\n sprite.y += randomInt(-magnitude, magnitude);\n\n //Add 1 to the counter\n counter += 1;\n }\n\n //When the shaking is finished, restore the sprite to its original \n //position and remove it from the `shakingSprites` array\n if (counter >= numberOfShakes) {\n sprite.x = startX;\n sprite.y = startY;\n self.shakingSprites.splice(self.shakingSprites.indexOf(sprite), 1);\n }\n }\n \n //The `angularShake` function\n //First set the initial tilt angle to the right (+1) \n let tiltAngle = 1;\n\n function angularShake() {\n if (counter < numberOfShakes) {\n\n //Reset the sprite's rotation\n sprite.rotation = startAngle;\n\n //Reduce the magnitude\n magnitude -= magnitudeUnit;\n\n //Rotate the sprite left or right, depending on the direction,\n //by an amount in radians that matches the magnitude\n sprite.rotation = magnitude * tiltAngle;\n counter += 1;\n\n //Reverse the tilt angle so that the sprite is tilted\n //in the opposite direction for the next shake\n tiltAngle *= -1;\n }\n\n //When the shaking is finished, reset the sprite's angle and\n //remove it from the `shakingSprites` array\n if (counter >= numberOfShakes) {\n sprite.rotation = startAngle;\n self.shakingSprites.splice(self.shakingSprites.indexOf(sprite), 1);\n }\n }\n }", "function hasLost(){\n if (total_score > targetNumber){\n loss++;\n $(\".loss\").text(loss);\n $(\".reset_game\").show();\n $(\".clickImg\").off();\n console.log(\"you lost\");\n return true;\n }\n else{\n return false;\n }\n }", "checkHit(givenX, givenY){\n\n let xcoor = givenX - this.getX(); //move to center\n let ycoor = givenY - this.getY();\n let out = false;\n\n //simple square hit detection\n if(xcoor < VERT_RAD/2.0 && xcoor > -VERT_RAD/2.0 \n && ycoor < VERT_RAD/2.0 && ycoor > -VERT_RAD/2.0 ){\n out = true;\n }\n\n return out;\n }", "function bigDefPlay() {\n let yards = getRandomInt(8, 1)\n let roundedYards = Math.round(yards * 10) / 10;\n console.log(`Oooohh. The Vikings got blown up by a sack for a loss of ${roundedYards} yards!`)\n $(\"#in-game-message\").text(\"SACK!\");\n $(\"#in-game-yardage\").text(\"-\"+roundedYards+\" YARDS\");\n netYards -=roundedYards;\n possessionYards -=roundedYards;\n gameYards -= roundedYards;\n console.log(\"Pos Yards = \"+ possessionYards);\n passYardage -= roundedYards\n console.log(passYardage)\n return passYardage\n }", "bool() {\n return Math.random() > 0.5\n }", "function handleGuess() {\n if ($(this).text() === correctAnimal) {\n $('.guess').remove();\n setTimeout(newRound, 1000);\n score++;\n showScore();\n //return to score 0, and shake if not guessed correctly\n } else {\n $(this).effect('shake');\n sayBackwards(correctAnimal);\n score = 0;\n showScore();\n }\n}", "function checkGameOver() {\r\n if (lives == 0) {\r\n console.log(\"game over\");\r\n return true;\r\n }\r\n return false;\r\n}", "function shark(pontoonDistance, sharkDistance, youSpeed, sharkSpeed, dolphin){\n var timeToPontoon = pontoonDistance / youSpeed;\n sharkSpeed = dolphin ? (sharkSpeed / 2 ) : sharkSpeed;\n var timeToDie = sharkDistance / sharkSpeed;\n if(timeToPontoon > timeToDie)\n { return \"Shark Bait!\" }\n return \"Alive!\";\n \n}", "function caughtSpeeding (speed, birthday){\n if (speed <= 60 && birthday == false|| speed <= 65 && birthday == true ){\n return \"0\";\n } else {\n if (60 < speed && speed <= 80 || 65 < speed && speed <= 85 && birthday == true) {\n return \"1\";\n } else {\n if (81 <= speed){\n return \"2\";\n }\n }\n }\n}", "function positive(x) {\r\n return x > 0;\r\n}", "willAttackMiss (accuracy) {\r\n return Math.floor(Math.random() * 100) > accuracy;\r\n }", "function loseGame(guess_count){\n if (guess_count <= 0){\n $(\"#result\").text(\"The Answer is \" + answer_word);\n gameReset();\n return true;\n }\n return false;\n}", "function goalScored() {\n if (puckPosX + radius < 0) {\n awayScore += 1;\n document.getElementById(\"away\").innerHTML = \"AWAY \" + awayScore;\n return true;\n } else if (puckPosX - radius > c.width) {\n homeScore += 1;\n document.getElementById(\"home\").innerHTML = \"HOME \" + homeScore; \n document.getElementById(\"away\").innerHTML = \"AWAY \" + awayScore;\n return true;\n }\n }", "function checkFish(fish) {\n if (!fish.eaten) {\n let d = dist(bigFish.x, bigFish.y, fish.x, fish.y);\n if (d < bigFish.size / 2 + fish.size / 2) {\n counter++;\n fish.eaten = true;\n }\n }\n}", "function gameTips(x){\n if(x===randomNumber) {\n const message = \"HAS GANADO CAMPEONAA!!\";\n return paintGameTips(message);\n\n } else if((x>randomNumber) && (x<=100)) {\n const message = \"Demasiado alto...\";\n return paintGameTips(message);\n\n } else if ((x<randomNumber) && (x>0)){\n const message = \"Demasiado bajo...\"\n return paintGameTips(message);\n\n } else if((x>100) || (x<0)) {\n const message = \"Demasiado lejos...! Sólo números del 1 al 100!\";\n return paintGameTips(message);\n }\n}", "function comparisonAmount(){\n if (userGuess - secretNumber > 0) {\n negativeAmount();\n } else {\n positiveAmount();\n }\n }", "function flyingSquare() {\n a += xSpeed;\n b += ySpeed;\n if (b >= height - 75 || b <= 0) {\n ySpeed = ySpeed * -1;\n }\n else if (a >= width - 250 || a <= 0) {\n xSpeed = xSpeed * -1;\n }\n\n\n}", "function game() {\n\n var getal = Math.round(Math.random() * 10);\n console.log(getal);\n console.log(getal > 3);\n\n}", "function checkPass(result) {\n let labMarks = result.labMarks ? result.labMarks : 0;\n return result.theoryMarks + labMarks >= 50;\n }", "willLikelySurvive() {\n let returnPercentage = 0;\n this.dna.forEach(item => item === 'C' || item === 'G' ? returnPercentage += 1/this.dna.length : '');\n return returnPercentage >= .6 ? true : false;\n }", "function test23() {\n reset();\n check10Row();\n return score === 0;\n}", "function caughtSpeeding(speed, birthday){\n if (birthday == true){\n if (speed <= 65){\n return 0;\n } else if (65 < speed && speed <= 85){\n return 1;\n } else {\n return 2;\n }\n } else {\n if (speed <= 60){\n return 0;\n } else if (60 < speed && speed <= 80){\n return 1;\n } else {\n return 2;\n }\n }\n}", "function isNegative(x) {\n return x < 0;\n}", "function cheatDetector(min, max, guess, secretNumber, modifyRange) {\n //if the computer's guess is the secret number but the user has said no, the computer calls them out for cheating\n if (guess === secretNumber) {\n console.log(\n `\\nHmmm, is your name Mufasa, 'cause I think you're a-lying...\\n`\n );\n return true;\n } else {\n if (modifyRange === \"h\" || modifyRange === \"higher\") {\n //if the user indicates the number is higher but the guess is already the max included value ==> returns true\n if (guess + 1 > max) {\n console.log(\n `\\nLiar, liar pants on fire! You said the number was lower than ${\n max + 1\n }, so it can't also be higher than ${guess}...\\n`\n );\n return true;\n }\n }\n if (modifyRange === \"l\" || modifyRange === \"lower\") {\n //if the user indicates the number is lower but the guess is already the min included value ==> returns true\n if (guess - 1 < min) {\n console.log(\n `\\nCheater, cheater pumpkin eater! You said the number was higher than ${\n min - 1\n }, so it can't also be lower than ${guess}!\\n`\n );\n return true;\n }\n }\n return false;\n }\n }", "function monkey_trouble(a_smile, b_smile) {\n if (a_smile == true && b_smile == true || a_smile == false && b_smile == false){\n return (true);\n } else {\n return false;\n }\n}", "function raiseCheck(rawCards) {\n let cards = [];\n for (let card of rawCards) {\n cards.push({\n suit: card.suit,\n rank: CARD_RANKS[card.rank]\n });\n }\n let points = (cards[0].rank + cards[1].rank) || 32;\n for (let gameCaseFunc of GAME_CASES) {\n points += gameCaseFunc(cards[0], cards[1]) || 0;\n }\n console.log('HUTCHINSON POINTS', points, cards);\n if (points >= HUTCHINSON_CONST) {\n return points;\n }\n return false;\n}", "function isLie(cake){\nreturn cake === true;\n}", "function badScore(score) {\n // This threshold is very dependent on the method of scoring\n // TODO: Make the threshold user tunable.\n return score <= THRESHOLD;\n}", "function checkAnswer(answer) {\n clearTimeout(timer);\n // if the answer is correct\n if (answer === correctAnimal) {\n // next round\n timer = setTimeout(nextRound, saySomething(0));\n // update score\n score += 1;\n updateScore();\n // if not correct\n } else {\n // find the selected option\n $(\".guess\").each(function() {\n if ($(this).text() === answer) {\n // play the animation\n $(this).effect('shake').button(\"option\", \"disabled\", true);\n // say an insult\n timer = setTimeout(sayBackwards, saySomething(1), correctAnimal);\n // reset score\n score = 0;\n mistake = true;\n updateScore();\n }\n });\n }\n}", "function shake(fruit) {\r\n var makefruitfall = (accelerometer1 || 0) + (accelerometer2 || 0) + (accelerometer3 || 0) + (accelerometer4 || 0);\r\n \r\n if (makefruitfall > 0.30) { //change this value later!!!\r\n this.gravity = 5; //changes the speed of the fall\r\n fruit.y += this.gravity; //must continue shaking until the fruits fall all the way down\r\n \r\n fruit.y = constrain(fruit.y, 0, windowHeight*0.75);\r\n }\r\n }", "function playerIsBust() {\n var playerSum = getSum(playerHand);\n return playerSum ) 21;\n}", "function handleGuess() {\n//if right, adjust score and start a new game\n if ($(this).text() === correctAnimal) {\n setTimeout(newRound, 500);\n score++;\n updateScore();\n// if wrong, shake the guesses and reset score\n} else {\n $('.guess').effect('shake');\n sayBackwards(correctAnimal);\n score = 0;\n updateScore();\n }\n}", "function check_time(time){ // Input the unix difference\n // Condition if it is >= to 0(+)\n if(time >= 0){\n // Deployed\n return true\n // Condition if it is < 0(-)\n }else if(time < 0){\n // Mission Complete\n return false\n // When bad things happen\n }else{\n // Yelling\n console.log(\"Play it again, Sam.\")\n }\n }", "function checkPositive(arr) {\n\n let b = arr.every((args) => args > 0)\n if (b == true) {\n return 'yes';\n }\n return 'no';\n}", "function collisionWall() {\n return ballX <= 15;\n}", "function areYouStrong(force) { // Function qui calcule si une personne est forte ou non, avec un parametre \"force\"\n if (force >= 15) {\n return \"You're very strong !\";\n }\n else if(force >= 10) {\n return \"You're strong !\";\n }\n else if(force >= 5 && force < 10) {\n return \"You're bad..\";\n }\n else {\n return \"You're very bad......\";\n }\n}", "checkAnswer(answer) {\n let check = false;\n if (answer == this.rightAnswer)\n check = true;\n check ? console.log(`CORRECT`) : console.log(`INCORRECT`);\n return check;\n }", "function ballIsOutOfBounds() {\r\n // Check for ball going off the sides\r\n if (ball.x < 0 || ball.x > width) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}", "function game() {\n var score = Math.random() * 10;\n console.log(score >= 5);\n}", "function game() {\n var score = Math.random() * 10;\n console.log(score >= 5);\n}", "function checkAnswer() {\n let userAnswer = parseInt(document.getElementById(\"answer-box\").value);\n let calculatedAnswer = calculateCorrectAnswer();\n let isCorrect = userAnswer === calculatedAnswer[0];\n\n if (isCorrect) {\n alert(\"Hey! You got it right! :D\");\n incrementScore();\n } else {\n alert(`Awwww.....you answered ${userAnswer}. The correct answer was ${calculatedAnswer[0]}!`);\n incrementWrongAnswer();\n }\n\n runGame(calculatedAnswer[1]);\n\n\n}", "function check_score(){\n\t\tif (app.score >= app.base * 50){\n\t\t\tfor (i = 0; i < allStars.length; i++){\n\t\t\t\tallStars[i].render();\n\t\t\t\tallStars[i].update();\n\t\t\t}\n\t\t}\n\t\tif (allStars[0].pos_Y == 500){\n\t\t\tfor (i = 0; i < allStars.length; i++){\n\t\t\t\tallStars[i].reset();\n\t\t\t}\n\t\t\tapp.base = Math.round(app.score / 50) + 1;\n\t\t}\n\t}", "function check() {\n if ((correct+wrong) != 0) {\n score = \"\" + ((correct / (correct + wrong)) * 100);\n score = score.substring(0,4) + \"%\";\n alert(\"YOUR SCORE: \" + score + \"\\n\"\n + correct + \" correct\\n\"\n + wrong + \" incorrect\")\n }\n\n else alert(\"You haven't answered anything yet.\");\n}", "morto() {\r\n return this.hp <= 0;\r\n }", "function ifExample(score) {\n if (score >= 50) {\n return \"Good Job!\";\n } else {\n return \"That is No No\";\n }\n}", "checkResult(standing, hitting) {\n if (this.playerCardTotal < 16 && standing) {\n\n alert(\"Dealer wins.\");\n } else if (this.playerCardTotal <= 18 && standing) {\n alert(\"Push\");\n } else if (this.playerCardTotal > 21) {\n alert(\"Bust!\");\n } else if (this.playerCardTotal > 18 && standing || this.playerCardTotal === 21) {\n alert(\"You Win!!!\");\n } else {\n return;\n }\n }", "checkBallCollision(ball) {\r\n let a = this.x - ball.x\r\n let b = this.y - ball.y\r\n let c = Math.sqrt(a * a + b * b)\r\n let x = this.radius + ball.radius\r\n\r\n if (c <= x)\r\n return true;\r\n else\r\n return false;\r\n\r\n }", "function loveFunction(flower1, flower2) {\n return ((flower1 % 2) !== (flower2 % 2));\n}", "eats(point) {\n let d = p5.Vector.dist(this.pos, point.pos);\n if (d < this.r + point.r) {\n this.score += 1;\n return true;\n } else {\n return false;\n }\n }", "containsBall(b){\n let tempX, tempY;\n\n if(b.x < this.x){\n tempX = this.x\n }\n else if(b.x > this.x + this.w){\n tempX = this.x + this.w;\n }\n else{\n const condX = b.x + b.r > this.x && (b.x + b.r - (this.w + this.x) < 0 ||\n b.x - b.r - (this.w + this.x) < 0);\n\n const condY = b.y + b.r > this.y && (b.y + b.r - (this.h + this.y) < 0 ||\n b.y - b.r - (this.h + this.y) < 0);\n\n return condX && condY;\n\n }\n if(b.y < this.y){\n tempY = this.y;\n }\n else if(b.y > this.y + this.h){\n tempY = this.y + this.h;\n }\n return Math.sqrt((b.x - tempX) ** 2 + (b.y - tempY) ** 2) <= b.r;\n }", "function is_game_over () {\n if (round < questions.length) {\n return false; \n } else {\n return true;\n }\n}", "function randomTrueFalse(){\n return Math.random() < 0.5;\n}", "function appleHitsBasket(){\n if (appleY > basketY && appleX < basketX + basketSize/2 && appleX > basketX - basketSize/2){\n appleY = 200;\n speed += 0.3;\n score ++;\n mysound.play();\n choosingRandomAppleX();\n\n }\n}" ]
[ "0.65202147", "0.6217987", "0.61282986", "0.601345", "0.59856915", "0.5980099", "0.59718966", "0.5828195", "0.5761094", "0.5758021", "0.5742971", "0.5707891", "0.56992435", "0.5698446", "0.5668073", "0.5651108", "0.559075", "0.55286837", "0.5524491", "0.5518122", "0.5507059", "0.54853106", "0.5476421", "0.54755414", "0.5474776", "0.54692376", "0.54690367", "0.54615444", "0.5433481", "0.5407206", "0.5405463", "0.5398539", "0.53911585", "0.5383209", "0.5375396", "0.537494", "0.53717774", "0.53681624", "0.536505", "0.5359348", "0.53567415", "0.5353267", "0.53495896", "0.53487384", "0.5348363", "0.5348198", "0.53322124", "0.53272736", "0.53185666", "0.5309177", "0.5306325", "0.5290389", "0.52838385", "0.5271237", "0.5269819", "0.52683854", "0.52655375", "0.5265354", "0.52605444", "0.52601933", "0.52588534", "0.52544403", "0.5254046", "0.52518636", "0.5248567", "0.524788", "0.5245167", "0.5240128", "0.52396226", "0.5232394", "0.5229572", "0.52232105", "0.5218477", "0.5216859", "0.52167714", "0.52148205", "0.52075374", "0.52037734", "0.52018934", "0.5199263", "0.51900995", "0.5186172", "0.51809025", "0.5172312", "0.51713276", "0.51700354", "0.51666766", "0.51666766", "0.516378", "0.51575196", "0.5155905", "0.51552165", "0.5152731", "0.51523715", "0.5150463", "0.5147416", "0.5143857", "0.5142751", "0.5142678", "0.5135433", "0.5134694" ]
0.0
-1
change these to appropriate shape and predict to matMul for projection
function predict(x, y, z) { return tf.tidy(() => { return a.mul(x) .add(b.mul(y)) .add(c.mul(z)); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function predict(xs){\n //y = mx + b\n return xs.mul(m).add(b);\n }", "predict(rawImage) {\n const out = ms.tf.tidy(() => {\n const x = ms.tf.tensor4d(rawImage, [1, 64, 64, 1]);\n let h = ms.tf.conv2d(x, this.conv1Kernel, 2, 'valid');\n h = ms.tf.add(h, this.conv1Bias);\n h = ms.tf.relu(h);\n\n h = ms.tf.conv2d(h, this.conv2Kernel, 2, 'valid');\n h = ms.tf.add(h, this.conv2Bias);\n h = ms.tf.relu(h);\n\n h = ms.tf.conv2d(h, this.conv3Kernel, 2, 'valid');\n h = ms.tf.add(h, this.conv3Bias);\n h = ms.tf.relu(h);\n\n h = ms.tf.conv2d(h, this.conv4Kernel, 2, 'valid');\n h = ms.tf.add(h, this.conv4Bias);\n h = ms.tf.relu(h);\n\n const final = ms.tf.reshape(h, [1, 2*2*256]);\n const logits = ms.tf.add(ms.tf.matMul(final, this.outputKernel),\n this.outputBias).squeeze();\n\n return ms.tf.softmax(logits);\n\n });\n const probVector = new Float32Array(out.dataSync());\n out.dispose();\n return probVector;\n }", "function predict(p){\n var inputs = inputSingle(p);\n predicted_coords = where_net.activate(inputs);\n p.noisy_x = predicted_coords[0];\n p.noisy_y = predicted_coords[1];\n}", "predict(input=[]) {\r\n\t\tconst input_layer = input;\r\n\t\t//multiplica a entrada com o peso e soma os resultados\r\n\t\t// e mapeia esse retorno passando pela função de ativação\r\n\t\tconst hidden_layer = \r\n\t\tthis.math.multiply(input_layer, this.synapse0).map(v => this.activation(v, false));\r\n\t\t//multiplica o resultado com outro peso e passa novamente pela função de ativação\r\n\t\tconst output_layer =\r\n\t\tthis.math.multiply(hidden_layer, this.synapse1).map(v => this.activation(v, false));\r\n\t\treturn output_layer;\r\n\t}", "predict(inputs) {\n\n //transform input array into matrix\n inputs = math.matrix(inputs);\n\n //calculate signals into first hidden layer\n let h1_inputs = math.multiply(inputs, this.weights_i_h);\n h1_inputs = math.add(h1_inputs, this.bias_h1);\n let h1_outputs = h1_inputs.map(sigmoid);\n \n //calculate signals into second hidden layer if exists\n if(this.hn_2) {\n let h2_inputs = math.multiply(h1_outputs, this.weights_h1_h2);\n h2_inputs = math.add(h2_inputs, this.bias_h2);\n let h2_outputs = h2_inputs.map(sigmoid); \n \n //calculate signals into final output layer\n var final_inputs = math.multiply(h2_outputs, this.weights_h_o);\n final_inputs = math.add(final_inputs, this.bias_o); \n var final_outputs = final_inputs.map(sigmoid);\n } else {\n var final_inputs = math.multiply(h1_outputs, this.weights_h_o);\n final_inputs = math.add(final_inputs, this.bias_o); \n var final_outputs = final_inputs.map(sigmoid);\n }\n \n \n //return Array of outputs\n return final_outputs._data;\n }", "function predict(x) {\n const xs = tf.tensor1d(x); \n // y = mx + b\n const ys = xs.mul(m).add(b);\n return ys;\n }", "function multMatrix(m) {\n modelView = mult(modelView, m);\n}", "function multMatrix(m) {\n modelView = mult(modelView, m);\n}", "makeMat4x4() {\nvar m;\nm = new Float32Array(16);\nreturn this.convertToMat4x4(m);\n}", "function Mat22(a, b, c, d) {\n if (typeof a === \"object\" && a !== null) {\n this.ex = Vec2.clone(a);\n this.ey = Vec2.clone(b);\n } else if (typeof a === \"number\") {\n this.ex = Vec2.neo(a, c);\n this.ey = Vec2.neo(b, d);\n } else {\n this.ex = Vec2.zero();\n this.ey = Vec2.zero();\n }\n}", "function scale4(a, b, c) {\r\n var result = mat4();\r\n result[0][0] = a;\r\n result[1][1] = b;\r\n result[2][2] = c;\r\n return result;\r\n}", "function scale4(a, b, c) {\r\n\tconst result = mat4();\r\n\tresult[0][0] = a;\r\n\tresult[1][1] = b;\r\n\tresult[2][2] = c;\r\n\treturn result;\r\n}", "function scale4(a, b, c) {\n var result = mat4();\n result[0][0] = a;\n result[1][1] = b;\n result[2][2] = c;\n return result;\n}", "static makeIdMat4() {\nvar m;\n//----------\nm = new Float32Array(16);\nm[0] = m[5] = m[10] = m[15] = 1;\nreturn m;\n}", "function predict(x) {\r\n // y = a * x ^ 3 + b * x ^ 2 + c * x + d\r\n return tf.tidy(() => {\r\n return a.mul(x.pow(tf.scalar(3, 'int32')))\r\n .add(b.mul(x.square()))\r\n .add(c.mul(x))\r\n .add(d);\r\n });\r\n}", "function normalize(data) {\n var ret = { input: [], output: [] };\n\n\n for (var i = 0; i < data.length; i++) {\n var datum = data[i];\n\n ret.output.push(datum.output);\n ret.input.push(datum.input);\n }\n\n ret.output = Matrix(ret.output);\n ret.input = Matrix(ret.input);\n\n\n return ret;\n\n}", "function scale4(a, b, c) {\n var result = mat4();\n result[0][0] = a;\n result[1][1] = b;\n result[2][2] = c;\n return result;\n}", "function scale4(a, b, c) {\n var result = mat4();\n result[0][0] = a;\n result[1][1] = b;\n result[2][2] = c;\n return result;\n}", "predict(input) {\n // Keep a map of named activations for rendering purposes.\n const netout = this.math.scope((keep) => {\n // Preprocess the input.\n const preprocessedInput = this.math.subtract(this.math.arrayDividedByScalar(input, this.PREPROCESS_DIVISOR), this.ONE);\n const x1 = this.convBlock(preprocessedInput, [2, 2]);\n const x2 = this.depthwiseConvBlock(x1, [1, 1], 1);\n const x3 = this.depthwiseConvBlock(x2, [2, 2], 2);\n const x4 = this.depthwiseConvBlock(x3, [1, 1], 3);\n const x5 = this.depthwiseConvBlock(x4, [2, 2], 4);\n const x6 = this.depthwiseConvBlock(x5, [1, 1], 5);\n const x7 = this.depthwiseConvBlock(x6, [2, 2], 6);\n const x8 = this.depthwiseConvBlock(x7, [1, 1], 7);\n const x9 = this.depthwiseConvBlock(x8, [1, 1], 8);\n const x10 = this.depthwiseConvBlock(x9, [1, 1], 9);\n const x11 = this.depthwiseConvBlock(x10, [1, 1], 10);\n const x12 = this.depthwiseConvBlock(x11, [1, 1], 11);\n const x13 = this.depthwiseConvBlock(x12, [2, 2], 12);\n const x14 = this.depthwiseConvBlock(x13, [1, 1], 13);\n const x15 = this.math.conv2d(x14, this.variables['conv_23/kernel'], this.variables['conv_23/bias'], [1, 1], 'same');\n return x15.as4D(13, 13, 5, 6);\n });\n return netout;\n }", "function scale4(a, b, c) {\n var result = mat4();\n result[0][0] = a;\n result[1][1] = b;\n result[2][2] = c;\n return result;\n}", "function Mat33(a, b, c) {\n if (typeof a === \"object\" && a !== null) {\n this.ex = Vec3.clone(a);\n this.ey = Vec3.clone(b);\n this.ez = Vec3.clone(c);\n } else {\n this.ex = Vec3();\n this.ey = Vec3();\n this.ez = Vec3();\n }\n}", "function dot(a, b, activation, bias) {\n if ((a.rank < 2) || (b.rank < 2)) {\n throw new errors_1.NotImplementedError(\"dot requires both inputs to be rank >= 2\" +\n (\" but got x shape = \" + a.shape + \" and y shape = \" + b.shape));\n }\n if (b.rank >= 3) {\n var xLastDim = a.shape.slice(-1)[0];\n var ySecondLastDim = b.shape.slice(-2)[0];\n if (xLastDim !== ySecondLastDim) {\n throw new errors_1.NotImplementedError(\"If rank y >= 3, then the second last dim\" +\n (\" of y must equal the last dim of x but got x shape = \" + a.shape + \" and \") +\n (\" y shape = \" + b.shape));\n }\n }\n // Handle basic 2D x 2D case.\n if ((a.rank === 2) && (b.rank === 2)) {\n var transposeA = false;\n var transposeB = false;\n // tfc.fused.matMul only fuses certain activation functions. Unsupported\n // activation functions are treated as 'linear' activations, which is\n // equivalent to a no-op.\n return tfc.fused.matMul({\n a: a,\n b: b,\n transposeA: transposeA,\n transposeB: transposeB,\n bias: bias ? reshapeBias(a.rank, bias, common_2.imageDataFormat()) : null,\n activation: activation\n });\n }\n else {\n // Reshape x into the analogous 2D Tensor.\n var aFirstDims = a.shape.slice(); // Holds all but the last dim of x.\n var aLastDim = aFirstDims.pop();\n a = a.reshape([-1, aLastDim]);\n // Reshape y into the analogous 2D Tensor, and keep track of the\n // required dimensions to reproduce the output shape.\n var bShape = b.shape.slice();\n var bLastDim = bShape.pop();\n var ySecondLastDim = bShape.pop();\n var yOtherDims = bShape.concat([bLastDim]);\n // permutation should be like [r-2, 0, 1, 2, ... r-4, r-3, r-1]\n // where r is the rank of y.\n var perm = Array.from({ length: b.rank }, function (_, i) {\n if (i === 0) {\n return b.rank - 2;\n }\n else if (i <= b.rank - 2) {\n return i - 1;\n }\n return i;\n });\n b = b.transpose(perm).reshape([ySecondLastDim, -1]);\n // Multiply x and y as 2D Tensors, and then reshape back to original.\n var outputShape = aFirstDims.concat(yOtherDims);\n var transposeA = false;\n var transposeB = false;\n return tfc.fused\n .matMul({\n a: a,\n b: b,\n transposeA: transposeA,\n transposeB: transposeB,\n bias: bias ? reshapeBias(a.rank, bias, common_2.imageDataFormat()) : null,\n activation: activation\n })\n .reshape(outputShape);\n }\n}", "updateMatrices() {\n this.projection = perspective(this.fieldOfViewY, this.aspect, this.near, this.far);\n const up = vec3(0, 1, 0);\n this.view = lookAt(this.eye, this.at, up);\n this.viewProjection = mult(this.projection, this.view);\n }", "function communityRepresentation() {\n\nfunction convertToBinaryArray(coordinates) {\n\n\"use strict\";\n var coordInBinary = coordiates.toString(2); \n \n if(coordInBinary.length > 7) {\n return [1,1,1,1,1,1,1,1];\n\n }\n \n while(coordInBinary.length < 7) { \n coordInBinary = \"0\" + coordInBinary;\n }\n \n // Convert string to array\n return coordInBinary.split(\"\").map(function(i) {\n return parseInt(i); }\n );\n}\n\nvar predictr = new synaptic.Architect.Perceptron(\n\n/* Remember to change numbers of neurons. */\n 7, \n 3,\n 3, \n 0\n);\n\nvar trainingData = [];\n\nvar i;\n\nvar input;\n\nvar output;\n\n/* Add training data here. */\ninput = [0,0,0,0,0,0,0,1];\noutput = [1];\n \n trainingData.push({\n input: input,\n output: output\n });\n}", "proj(vec1,vec2){\n\t\tlet res = this.dot(vec1,vec2);\n\t\tlet proj = vec2.map(x => x*res);\n\t\treturn proj;\n\t}", "static apply__i0_i1__o0_o1__k0_k1() {\n this.output0.realTensor = this.input0.realTensor.clone();\n this.output1.realTensor = this.input1.realTensor.clone(); }", "transform(m) {\n const points = [];\n\n for (let i = 0; i < this.length; i++) {\n const point = this[i]; // Perform the matrix multiplication\n\n points.push([m.a * point[0] + m.c * point[1] + m.e, m.b * point[0] + m.d * point[1] + m.f]);\n } // Return the required point\n\n\n return new PointArray(points);\n }", "function createPositionDecodeMatrix(cfg, elements){\n var positionTranslate = elements.subarray(0,3);\n var positionScale = elements.subarray(3,6);\n var positionDecodeMatrix = mat4.create();\n\n mat4.fromScaling(positionScaleMat, positionScale);\n mat4.fromTranslation(positionTranslateMat, positionTranslate);\n mat4.multiply(positionDecodeMatrix, positionTranslateMat, positionScaleMat);\n\n // assign to config\n cfg.positionTranslate = positionTranslate;\n cfg.positionScale = positionScale;\n cfg.geometry.positionDecodeMat = positionDecodeMatrix;\n return cfg;\n }", "static makeMat4() {\nreturn new Float32Array(16);\n}", "reconfigure(model)\n { //\n let data = model.getWeights();\n //convert data.1dArray to 3darray\n let weightsForLayers = [];\n let volumes = [\n {x: 5, y: 5, z: 8},\n {x: 5, y: 5, z: 16},\n {x: 1, y: 10, z: 1},\n ];\n\n\n for(let l = 0; l < 3; l++)\n {\n let weights = [[[]]];\n let feed = 0;\n v3loop(volumes[l], (i,j,k) =>\n {\n\n weights[i][j][k] = data[feed];\n feed++;\n });\n weightsForLayers.push(weights);\n }\n\n let input = new Layer(\"input\", new THREE.Vector3(28,28,1), []/*DATA*/, 0); // 784\n let conv1 = new Convolution(new THREE.Vector3(5,5,8), weightsForLayers[0], LAYER_GAP, 1, 0, 1, \"relu\");\n\n let res1 = conv1.forward(input);\n let pool1 = new Pool(new THREE.Vector3(2,2,8),\n /*previous layer last node.position.z + */ LAYER_GAP*3, 2, \"max\");\n\n let res2 = pool1.forward(res1);\n let conv2 = new Convolution(new THREE.Vector3(5,5,16), weightsForLayers[1],\n /*previous layer last node.position.z + */ LAYER_GAP*5, 1, 0, 1, \"relu\");\n\n let res3 = conv2.forward(res2);\n let pool2 = new Pool(new THREE.Vector3(2,2,16),\n /*previous layer last node.position.z + */ LAYER_GAP*7, 2, \"max\");\n\n let res4 = pool2.forward(res3);\n //convert res4.weights to flattened volume\n let res4Flattened = new Layer(\"Flattened Layer\", new THREE.Vector3(1,256,1), converted.weights ,\n /*previous layer last node.position.z + */ LAYER_GAP*9);\n\n let out = new Dense(\"output\", new THREE.Vector3(1,10,1),weightsForLayers[2],\n /*previous layer last node.position.z + */ LAYER_GAP, \"tanh\");\n out.forward(res4Flattened);\n\n\n this.layers = [input, conv1, res1, pool1, res2, conv2, res3, pool2, res4, out]\n \n\n }", "function preprocess(data){\n\treturn tf.tidy(() =>{\n\t\t// step 1 - shuffle the data\n\t\ttf.util.shuffle(data);\n\t\t\n\t\t// step 2 - converting data to tensors\n\t\tconst x = data.map(d=>d.hp)\n\t\tconst y = data.map(d=>d.mpg)\n\t\t\n\t\tconst xtensor = tf.tensor2d(x, [x.length,1]);\n\t\tconst ytensor = tf.tensor2d(y, [y.length,1]);\n\t\t\n\t\t// step3 - data normalizing using MinMaxscaling\n\t\t\n\t\tconst xmin = xtensor.min();\n\t\tconst xmax = xtensor.max();\n\t\tconst ymin = ytensor.min();\n\t\tconst ymax = ytensor.max();\n\t\t\n\t\tconst xnorm = xtensor.sub(xmin).div(xmax.sub(xmin));\n\t\tconst ynorm = ytensor.sub(ymin).div(ymax.sub(ymin));\n\t\t\n\t\treturn {\n\t\t\tinputs:xnorm,\n\t\t\toutputs:ynorm,\n\t\t\txmin,xmax,ymin,ymax,\n\t\t}\n\t\t});\n}", "function predict_point(x, y, variogram) {\n\t\t\tvar i, k = Array(variogram.n);\n\t\t\tfor(i=0;i<variogram.n;i++)\n\t\t\t\tk[i] = variogram.model(Math.pow(Math.pow(x-variogram.x[i], 2)+\n\t\t\t\t\t Math.pow(y-variogram.y[i], 2), 0.5),\n\t\t\t\t\t variogram.nugget, variogram.range, \n\t\t\t\t\t variogram.sill, variogram.A);\n\t\t\treturn matrix_multiply(k, variogram.M, 1, variogram.n, 1)[0];\n\t\t}", "function dot(a, b, activation, bias) {\n if ((a.rank < 2) || (b.rank < 2)) {\n throw new _errors__WEBPACK_IMPORTED_MODULE_2__[\"NotImplementedError\"](`dot requires both inputs to be rank >= 2` +\n ` but got x shape = ${a.shape} and y shape = ${b.shape}`);\n }\n if (b.rank >= 3) {\n const xLastDim = a.shape.slice(-1)[0];\n const ySecondLastDim = b.shape.slice(-2)[0];\n if (xLastDim !== ySecondLastDim) {\n throw new _errors__WEBPACK_IMPORTED_MODULE_2__[\"NotImplementedError\"](`If rank y >= 3, then the second last dim` +\n ` of y must equal the last dim of x but got x shape = ${a.shape} and ` +\n ` y shape = ${b.shape}`);\n }\n }\n // Handle basic 2D x 2D case.\n if ((a.rank === 2) && (b.rank === 2)) {\n const transposeA = false;\n const transposeB = false;\n // tfc.fused.matMul only fuses certain activation functions. Unsupported\n // activation functions are treated as 'linear' activations, which is\n // equivalent to a no-op.\n return _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"fused\"].matMul({\n a,\n b: b,\n transposeA,\n transposeB,\n bias: bias ? reshapeBias(a.rank, bias, Object(_common__WEBPACK_IMPORTED_MODULE_4__[\"imageDataFormat\"])()) : null,\n activation\n });\n }\n else {\n // Reshape x into the analogous 2D Tensor.\n const aFirstDims = a.shape.slice(); // Holds all but the last dim of x.\n const aLastDim = aFirstDims.pop();\n a = a.reshape([-1, aLastDim]);\n // Reshape y into the analogous 2D Tensor, and keep track of the\n // required dimensions to reproduce the output shape.\n const bShape = b.shape.slice();\n const bLastDim = bShape.pop();\n const ySecondLastDim = bShape.pop();\n const yOtherDims = [...bShape, bLastDim];\n // permutation should be like [r-2, 0, 1, 2, ... r-4, r-3, r-1]\n // where r is the rank of y.\n const perm = Array.from({ length: b.rank }, (_, i) => {\n if (i === 0) {\n return b.rank - 2;\n }\n else if (i <= b.rank - 2) {\n return i - 1;\n }\n return i;\n });\n b = b.transpose(perm).reshape([ySecondLastDim, -1]);\n // Multiply x and y as 2D Tensors, and then reshape back to original.\n const outputShape = [...aFirstDims, ...yOtherDims];\n const transposeA = false;\n const transposeB = false;\n return _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"fused\"]\n .matMul({\n a,\n b,\n transposeA,\n transposeB,\n bias: bias ? reshapeBias(a.rank, bias, Object(_common__WEBPACK_IMPORTED_MODULE_4__[\"imageDataFormat\"])()) : null,\n activation\n })\n .reshape(outputShape);\n }\n}", "function preprocessImage(image, modelName) {\n\n // resize the input image to mobilenet's target size of (224, 224)\n let tensor = tf.fromPixels(image)\n .resizeNearestNeighbor([224, 224])\n .toFloat();\n \n // if model is not available, send the tensor with expanded dimensions\n if (modelName === undefined) {\n return tensor.expandDims();\n } \n \n // if model is mobilenet, feature scale tensor image to range [-1, 1]\n else if (modelName === \"mobilenet\") {\n let offset = tf.scalar(127.5);\n return tensor.sub(offset)\n .div(offset)\n .expandDims();\n } \n \n // else throw an error\n else {\n alert(\"Unknown model name..\")\n }\n }", "constructor(a, b, c) { \n // a: number of input nodes - or another neural network object (in that case, we don't need to specify b and c)\n // b: list of number of hidden nodes in each layer (as many array elements, as many hidden layers there are)\n // c: number of output nodes \n if (a instanceof NeuralNetwork) {\n this.input_nodes = a.input_nodes;\n \n this.hidden_nodes = []; \n for (let i = 0; i < a.hidden_nodes.length; i++)\n this.hidden_nodes.push(a.hidden_nodes[i]);\n\n this.output_nodes = a.output_nodes;\n\n this.weights_ih = a.weights_ih.copy();\n this.weights_hidden = [];\n for (let i = 0; i < a.weights_hidden.length; i++)\n this.weights_hidden[i] = a.weights_hidden[i].copy();\n this.weights_ho = a.weights_ho.copy();\n\n this.bias_hidden = [];\n for (let i = 0; i < a.bias_hidden.length; i++)\n this.bias_hidden[i] = a.bias_hidden[i].copy();\n this.bias_o = a.bias_o.copy();\n }\n else {\n this.input_nodes = a;\n this.hidden_nodes = [];\n for (let i = 0; i < b.length; i++)\n this.hidden_nodes.push(b[i]);\n this.output_nodes = c;\n\n this.weights_ih = new Matrix(this.hidden_nodes[0], this.input_nodes);\n this.weights_hidden = [];\n for (let i = 0; i < this.hidden_nodes.length - 1; i++) {\n this.weights_hidden[i] = new Matrix(this.hidden_nodes[i+1], this.hidden_nodes[i]);\n this.weights_hidden[i].randomize();\n }\n this.weights_ho = new Matrix(this.output_nodes, this.hidden_nodes[this.hidden_nodes.length - 1]);\n this.weights_ih.randomize();\n this.weights_ho.randomize();\n\n this.bias_hidden = [];\n for (let i = 0; i < b.length; i++) {\n this.bias_hidden[i] = new Matrix(this.hidden_nodes[i], 1);\n this.bias_hidden[i].randomize();\n }\n\n this.bias_o = new Matrix(this.output_nodes, 1);\n this.bias_o.randomize();\n }\n\n // TODO: copy these as well\n this.setLearningRate();\n this.setActivationFunction();\n }", "predict(input) {\n const preprocessedInput = tfc.div(\n tfc.sub(input.asType('float32'), PREPROCESS_DIVISOR),\n PREPROCESS_DIVISOR);\n const reshapedInput =\n preprocessedInput.reshape([1, ...preprocessedInput.shape]);\n const dict = {};\n dict[INPUT_NODE_NAME] = reshapedInput;\n return this.model.execute(dict, OUTPUT_NODE_NAME);\n }", "constructor(data){\r\n this.type = EEE.MATH_MATRIX4;\r\n this.data = data || new Float32Array(16);\r\n }", "getProjMatrix() {\nreturn this.projMat;\n}", "setWeights(newWeights) {\r\n\r\n let index = (this.inputSize + 1) * this.hiddenSize;\r\n let index2 = index + (this.hiddenSize * this.outputSize);\r\n\r\n this.w1 = nj.array(newWeights.slice(0, index)).reshape([this.inputSize + 1, this.hiddenSize]);\r\n\r\n this.w2 = nj.array(newWeights.slice(index, index2)).reshape([this.hiddenSize, this.outputSize]);\r\n }", "function predict() {\n regressor.predict(gotResults);\n}", "nnPrediction(data, theta1, theta2) {\n \t// add bias\n if (data.length == 400) data.unshift(1);\n if (theta1.length == 25) {\n const bias = Array(theta1[0].length).fill(1);\n theta1.unshift(bias);\n }\n\n // just some incomplete sanity checks to find the most obvious errors\n if (!Array.isArray(data) || data.length == 0 ||\n !Array.isArray(theta1) || theta1.length == 0 || !Array.isArray(theta1[0]) || data.length != theta1[0].length ||\n !Array.isArray(theta2) || theta2.length == 0 || !Array.isArray(theta2[0]) || theta1.length != theta2[0].length) {\n console.error('invalid parameters in nn function');\n return undefined;\n }\n\n const num_labels = theta2.length;\n let prediction = undefined;\n\n // compute layer2 output, units2 should be 1x26\n let units2 = Array(theta1.length).fill(0);\n for (let i=0; i<theta1.length; i++) {\n\n for (let j=0; j<theta1[i].length; j++) {\n units2[i] += data[j] * theta1[i][j];\n }\n units2[i] = 1 / (1 + Math.exp(-units2[i]));\n }\n\n //compute layer3 activation, units3 should be 1x10\n let units3 = Array(theta2.length).fill(0);\n for (let i=0; i<theta2.length; i++) {\n\n for (let j=0; j<theta2[i].length; j++) {\n units3[i] += units2[j] * theta2[i][j];\n }\n }\n\n const max = Math.max(...units3);\n return units3.findIndex(function(element, index, array){\n \treturn element == max;\n }) + 1;\n }", "reset() {\n let input = tf.input({shape: [this._inputSize]});\n let last = input;\n for (let i=0; i < this._numLayers; i++) {\n \tlast = tf.layers.dense({units: this._layout[i], activation: this._activation}).apply(last);\n }\n let output = tf.layers.dense({units: 1, activation: 'linear'}).apply(last);\n let model = tf.model({inputs: input, outputs: output});\n model.compile({loss: this._loss, optimizer: this._optimizer, metrics: ['mae']});\n this._model = model;\n\n this._training_x = [];\n this._training_y = [];\n }", "function makeCameraModel() {\n function setProjection(state, input) {\n var projection = _glMat2.default.perspective([], state.fov, input.width / input.height, // context.viewportWidth / context.viewportHeight,\n state.near, state.far);\n state.projection = projection;\n state.aspect = input.width / input.height;\n //state = Object.assign({}, state, update(settings, state)) // not sure\n return state;\n }\n\n function applyRotation(state, angles) {\n state = (0, _uscoOrbitControls.rotate)(settings, state, angles); // mutating, meh\n return state;\n }\n\n function applyZoom(state, zooms) {\n state = (0, _uscoOrbitControls.zoom)(settings, state, zooms); //, {adjustPlanes: true}) // mutating, meh\n return state;\n }\n\n function applyFocusOn(state, focuses) {\n state = (0, _uscoOrbitControls.setFocus)(settings, state, focuses); // mutating, meh\n return state;\n }\n\n function zoomToFit(state, input) {\n //console.log('zoomToFit', state.position, state.target, input)\n var camera = state;\n\n var bounds = input.bounds;\n var transforms = input.transforms;\n\n var offsetTargetAndPosition = (0, _uscoCameraUtils.cameraOffsetToEntityBoundsCenter)({ camera: camera, bounds: bounds, transforms: transforms, axis: 2 });\n camera = Object.assign({}, state, offsetTargetAndPosition);\n var phase2 = (0, _uscoCameraUtils.computeCameraToFitBounds)({ camera: camera, bounds: bounds, transforms: transforms });\n state.targetTgt = phase2.target;\n state.positionTgt = phase2.position;\n return state;\n //FIXME: just a test for zoomToFit for now\n //console.log('zoomToFit', state.position, state.target, input)\n /*camera.near = 0.01\n settings.limits.minDistance = 0\n let camera = state\n const {bounds, transforms} = input\n camera = Object.assign({}, state, cameraOffsetToEntityBoundsCenter({camera, bounds, transforms, axis: 2}))\n camera = Object.assign({}, state, computeCameraToFitBounds({camera, bounds, transforms}))\n return camera*/\n }\n\n //this is used for 'continuous updates' for things like spin effects, autoRotate etc\n function updateState(state) {\n return Object.assign({}, state, (0, _uscoOrbitControls.update)(settings, state));\n }\n\n var updateFunctions = {\n setProjection: setProjection,\n applyZoom: applyZoom,\n applyRotation: applyRotation,\n //applyFocusOn,\n zoomToFit: zoomToFit,\n updateState: updateState\n };\n var actions = {\n setProjection: projection$,\n applyZoom: zooms$,\n applyRotation: dragMoves$,\n //applyFocusOn: focuses$,\n zoomToFit: entityFocuses$,\n updateState: rate$\n };\n\n var cameraState$ = (0, _modelUtils.model)(camera, actions, updateFunctions);\n\n return cameraState$;\n }", "function mul( p0, p1 ) {\n return {x: p0.x * p1.x, y: p0.y * p1.y};\n}", "calculateModelView() {\n this.modelViewMatrix = this.camera.getViewTransform();\n }", "createModel(shape) {\n let model = tf.sequential();\n\n model.add(tf.layers.inputLayer({inputShape: [64]}));\n // hidden layers\n for (let i = 0; i < shape.length; i++) {\n model.add(tf.layers.dense({\n units: shape[i],\n kernelConstraint: tf.constraints.maxNorm(3),\n kernelInitializer: this.gInit\n }));\n model.add(tf.layers.batchNormalization());\n model.add(tf.layers.leakyReLU());\n }\n model.add(tf.layers.dense({units: 2, activation: 'softmax'}));\n\n model.compile({\n loss: 'categoricalCrossentropy',\n optimizer: tf.train.rmsprop(0.004),\n metrics: ['accuracy']\n });\n return model;\n }", "function createMatMult(size) {\n return gpu.createKernel(\n function(a, b) {\n var sum = 0;\n for (var i = 0; i < this.constants.size; i++) {\n sum += a[this.thread.y][i] * b[i][this.thread.x];\n }\n return sum;\n },\n {\n constants: { size: size },\n output: [size, size]\n }\n );\n}", "set modelViewMatrix(mvMat) { this._modelViewMatrix = mvMat; }", "function setUpProjectionMat() {\n let projectionMat = mat3.create();\n mat3.fromScaling(projectionMat, [2.0 / gl.drawingBufferWidth, 2.0 / gl.drawingBufferHeight]);\n gl.uniformMatrix3fv(context.uProjectionMatId, false, projectionMat);\n}", "function computeProjections() {\n for (var n = 0; n < roots.length; n++) {\n // compute projections and resize by 100 and translated by 300\n rootProj[n] = [dotprod(projMatrix[0], roots[n]) * zoom + translateX,\n dotprod(projMatrix[1], roots[n]) * zoom + translateY];\n }\n}", "static makeIdTRMat() {\nvar m;\n//---------\nm = new Float32Array(16);\nm[0] = m[5] = m[10] = m[15] = 1;\nreturn m;\n}", "async function predictDigit() {\n // Copy the digit canvas into a 28 by 28 image\n let inputs = [];\n const smaller = createImage(28, 28, RGB);\n const img = DIGIT_UI.get();\n DIGIT_UI.width;\n smaller.copy(\n img,\n 0,\n 0,\n DIGIT_UI.width,\n DIGIT_UI.height,\n\n 0,\n 0,\n smaller.width,\n smaller.height\n );\n // Get an array representing the smaller image\n smaller.loadPixels();\n for (var i = 0; i < smaller.pixels.length; i += 4) {\n // Just using the red channel since it's a greyscale image\n // Not so great to use inputs of 0 so smallest value is 0.01\n inputs[i / 4] = map(smaller.pixels[i], 0, 255, 0, 0.99) + 0.01;\n }\n console.log(inputs);\n // Get predictions based on that image\n let data = inferModel(inputs);\n PREDICTION_UI.setData(data);\n console.log(data);\n}", "train(data) {\n data.guess = this.guess([ data.x, data.y ]);\n\n let error = data.label - data.guess;\n\n let del_w0 = error * data.x * this.lr;\n let del_w1 = error * data.y * this.lr;\n let del_w2 = error * this.lr;\n\n this.weights[0] += del_w0;\n this.weights[1] += del_w1;\n this.weights[2] += del_w2;\n }", "function vec4multMat4(out, a, m) {\n\t var x = a[0], y = a[1], z = a[2], w = a[3];\n\t out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n\t out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n\t out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n\t out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\t return out;\n\t}", "function vec4multMat4(out, a, m) {\n\t var x = a[0], y = a[1], z = a[2], w = a[3];\n\t out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n\t out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n\t out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n\t out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\t return out;\n\t}", "function getModel(){\n const model=tf.sequential();\n\n//Each image is 28x28 in size and have 1 color channel as a grayscale image.\n const IMAGE_WIDTH=28;\n const IMAGE_HEIGHT=28;\n const IMAGE_CHANNELS=1;\n\n//here we are adding conv2d layer instead of fully connected layers\n//kernels are small input matrix used in cnn to extract features,which refers to the width height of the filter mask\n//filter size refers to the dimension of the filter in cnn\n//strides define the number of pixels shift over the input matrix.\n//kernel initializing method is for randomly initializing the model weights\nmodel.add(tf.layers.conv2d({\n inputShape: [IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_CHANNELS],\n kernelSize: 5,\n filters: 8,\n strides: 1,\n activation: 'relu',\n kernelInitializer: 'varianceScaling'\n }));\n/*Usually pooling will be used to remove the negative values\n*maxpooling will reduce the amount of computations\n*will sent only important data to the next layer\n*takes only larger value pixels among all pixels*/\n\nmodel.add(tf.layers.maxPooling2d({poolSize: [2, 2], strides: [2, 2]}))\n\n//we are adding more filters because cnn wil have number of filters\n\nmodel.add(tf.layers.conv2d({\n kernelSize: 5,\n filters: 16,\n strides: 1,\n activation: 'relu',\n kernelInitializer: 'varianceScaling'\n }));\n model.add(tf.layers.maxPooling2d({poolSize: [2, 2], strides: [2, 2]}));\n//flatten layer converts 2d image to 1d\n model.add(tf.layers.flatten());\n const NUM_OUTPUT_CLASSES = 10;\n model.add(tf.layers.dense({\n units: NUM_OUTPUT_CLASSES,\n kernelInitializer: 'varianceScaling',\n activation: 'softmax'\n }));\n const optimizer = tf.train.adam();\n model.compile({\n optimizer: optimizer,\n\n//Categoricalcrossentropy loss is used because here we are using 10 classes\n loss: 'categoricalCrossentropy',\n metrics: ['accuracy'],\n });\n\n return model;\n\n\n}", "function vec4multMat4(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}", "function vec4multMat4(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}", "function vec4multMat4(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}", "function reduction(a, b) {\n\t// create submatrices and multiply them\n\tlet Uk = numeric.getBlock(svd.U, [0, a - 1], [svd.U.length - 1, b - 1]);\n\tlet Sk = numeric.getBlock(svd.S, [a - 1, a - 1], [b - 1, b - 1]);\n\tlet Vk = numeric.getBlock(svd.V, [0, a - 1], [svd.V.length - 1, b - 1]);\n\tlet M = numeric.dot(Uk, numeric.dot(Sk, numeric.transpose(Vk)));\n\t// create buffer for image data\n\tconst width = canvas.width;\n\tconst height = canvas.height;\n\tlet buffer = new Uint8ClampedArray(width * height * 4);\n\tfor (let row = 0; row < height; row++) {\n\t\tfor (let col = 0; col < width; col++) {\n\t\t\tlet i = (row * (width * 4)) + (col * 4);\n\t\t\tlet value = Math.round(M[row][col] * 255);\n\t\t\tbuffer[i] = value;\n\t\t\tbuffer[i + 1] = value;\n\t\t\tbuffer[i + 2] = value;\n\t\t\tbuffer[i + 3] = 255;\n\t\t}\n\t}\n\t// put data on canvasSVD\n\tlet imgData = ctxSVD.createImageData(width, height);\n\timgData.data.set(buffer);\n\tctxSVD.putImageData(imgData, 0, 0);\n\timageSVD.src = canvasSVD.toDataURL();\n}", "makeModel () {\n const y = -0.3\n const segment = this.size / this.lod;\n for (let i = -this.lod / 2; i < this.lod / 2; i++) {\n for (let j = -this.lod / 2; j < this.lod / 2; j++) {\n this.mesh = this.mesh.concat([\n segment * i, y, segment * j,\n segment * (i + 1), y, segment * j,\n segment * i, y, segment * (j + 1),\n segment * (i + 1), y, segment * j,\n segment * i, y, segment * (j + 1),\n segment * (i + 1), y, segment * (j + 1),\n ]);\n }\n }\n\n for (let i = 0; i < this.lod * this.lod * 6; i++) {\n this.normals = this.normals.concat([ 0.0, 1.0, 0.0 ]);\n }\n\n for (let i = 0; i < this.lod * this.lod; i++) {\n this.textureCoordinates = this.normals.concat([\n 0.0, 1.0,\n 0.0, 0.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 1.0, 1.0,\n ])\n }\n\t}", "updateProjMat()\n {\n if ( this.proj_type_str == 'Perspective' )\n this.proj_mat = Mat4_Perspective( this.fovy_deg, this.viewport.ratio_yx, this.near, this.far )\n else if ( this.proj_type_str == 'Orthogonal' )\n {\n const near_adjust = 5.0 // this is used so the grid is not clipped\n this.proj_mat = Mat4_Orthogonal( this.viewport.ratio_yx, this.half_size_y, this.near-near_adjust, this.far ) \n }\n else \n throw new Error(`invalid string in 'proj_type'`)\n }", "adjust() {\n this.custom_adjust();\n glMatrix.mat4.perspective(this.projection_matrix, glMatrix.glMatrix.toRadian(tracker.camera.fovy), tracker.camera.aspect, tracker.camera.near, tracker.camera.far);\n glMatrix.mat4.lookAt(this.view_matrix, tracker.camera.eye_point, tracker.camera.aim_point, tracker.camera.up_vector);\n // glMatrix.mat4.identity(this.model_matrix);\n glMatrix.mat4.multiply(this._mvp_matrix, this.projection_matrix, this.view_matrix);\n }", "static prod(M1,M2) {\r\n if(!(M1 instanceof Matrix) || !(M2 instanceof Matrix)) {\r\n console.log(Matrix.wrong_type_error_message2());\r\n return null;\r\n }\r\n if(M1.cols != M2.rows) {\r\n console.log(Matrix.wrong_dim_error_message());\r\n return null;\r\n }\r\n let result = new Matrix(M1.rows,M2.cols);\r\n let helper = M2.transpose();\r\n result.data = result.data.map((rows,main_index) => {\r\n return rows.map((col,sub_index) => {\r\n return Matrix.array_mult(M1.data[main_index],helper.data[sub_index]);\r\n });\r\n });\r\n return result;\r\n }", "function update_model_view() {\r\n\tlet mv = mult(rotateZ(thetas[2]), mult(rotateY(thetas[1]), rotateX(thetas[0])));\r\n\tmv = mult(translate(position[0], position[1], position[2]), mv);\r\n\tmv = mult(scalem(cur_scale, cur_scale, cur_scale), mv);\r\n\tgl.uniformMatrix4fv(model_view_loc, false, flatten(mv));\r\n}", "function reshapeBias(xRank, bias, dataFormat) {\n var biasShape = bias.shape;\n if (bias.rank !== 1 && bias.rank !== xRank) {\n throw new errors_1.ValueError('Unexpected bias dimensions: ' + bias.rank +\n '; expected it to be 1 or ' + xRank);\n }\n if (xRank === 5) {\n if (dataFormat === 'channelsFirst') {\n if (biasShape.length === 1) {\n return bias.reshape([1, biasShape[0], 1, 1, 1]);\n }\n else {\n return bias.reshape([1, biasShape[3], biasShape[0], biasShape[1], biasShape[2]]);\n }\n }\n else if (dataFormat === 'channelsLast') {\n if (biasShape.length === 1) {\n return bias.reshape([1, 1, 1, 1, biasShape[0]]);\n }\n else {\n return bias.reshape([1].concat(biasShape));\n }\n }\n }\n else if (xRank === 4) {\n if (dataFormat === 'channelsFirst') {\n if (biasShape.length === 1) {\n return bias.reshape([1, biasShape[0], 1, 1]);\n }\n else {\n return bias.reshape([1, biasShape[2], biasShape[0], biasShape[1]]);\n }\n }\n else if (dataFormat === 'channelsLast') {\n if (biasShape.length === 1) {\n return bias.reshape([1, 1, 1, biasShape[0]]);\n }\n else {\n return bias.reshape([1].concat(biasShape));\n }\n }\n }\n else if (xRank === 3) {\n if (dataFormat === 'channelsFirst') {\n if (biasShape.length === 1) {\n return bias.reshape([1, biasShape[0], 1]);\n }\n else {\n return bias.reshape([1, biasShape[1], biasShape[0]]);\n }\n }\n else if (dataFormat === 'channelsLast') {\n if (biasShape.length === 1) {\n return bias.reshape([1, 1, biasShape[0]]);\n }\n else {\n return bias.reshape([1].concat(biasShape));\n }\n }\n }\n else if (xRank < 3) {\n return bias;\n }\n throw new errors_1.ValueError(\"Unsupported input rank by biasAdd: \" + bias.rank);\n}", "function getInputTensor(data) {\n return tf.tensor(data).asType(\"float32\").reshape([1, 28, 28, 1]);\n}", "function predict(_Xs) {\n return tf.dot(_Xs, globalWeightsTensorVar);\n}", "function reshapeBias(xRank, bias, dataFormat) {\n var biasShape = bias.shape;\n if (bias.rank !== 1 && bias.rank !== xRank) {\n throw new errors_1.ValueError(\"Unexpected bias dimensions: \" + bias.rank +\n (\"; expected it to be 1 or \" + xRank));\n }\n if (xRank === 5) {\n if (dataFormat === 'channelsFirst') {\n if (biasShape.length === 1) {\n return bias.reshape([1, biasShape[0], 1, 1, 1]);\n }\n else {\n return bias.reshape([1, biasShape[3], biasShape[0], biasShape[1], biasShape[2]]);\n }\n }\n else if (dataFormat === 'channelsLast') {\n if (biasShape.length === 1) {\n return bias.reshape([1, 1, 1, 1, biasShape[0]]);\n }\n else {\n return bias.reshape([1].concat(biasShape));\n }\n }\n }\n else if (xRank === 4) {\n if (dataFormat === 'channelsFirst') {\n if (biasShape.length === 1) {\n return bias.reshape([1, biasShape[0], 1, 1]);\n }\n else {\n return bias.reshape([1, biasShape[2], biasShape[0], biasShape[1]]);\n }\n }\n else if (dataFormat === 'channelsLast') {\n if (biasShape.length === 1) {\n return bias.reshape([1, 1, 1, biasShape[0]]);\n }\n else {\n return bias.reshape([1].concat(biasShape));\n }\n }\n }\n else if (xRank === 3) {\n if (dataFormat === 'channelsFirst') {\n if (biasShape.length === 1) {\n return bias.reshape([1, biasShape[0], 1]);\n }\n else {\n return bias.reshape([1, biasShape[1], biasShape[0]]);\n }\n }\n else if (dataFormat === 'channelsLast') {\n if (biasShape.length === 1) {\n return bias.reshape([1, 1, biasShape[0]]);\n }\n else {\n return bias.reshape([1].concat(biasShape));\n }\n }\n }\n else if (xRank < 3) {\n return bias;\n }\n throw new errors_1.ValueError(\"Unsupported input rank by biasAdd: \" + bias.rank);\n}", "function gScale(sx,sy,sz) {\n modelMatrix = mult(scale(sx,sy,sz), modelMatrix) ;\n}", "async function one2one() {\n console.log(kleur.bgGreen(kleur.black(\"one2one\")));\n let xInput = tf.tensor([0.0, 0.2, 0.4, 0.6, 0.8]);\n let yExpected = tf.tensor([0.1, 0.3, 0.5, 0.7, 0.9]);\n\n // Reshape\n xInput = xInput.reshape([5, 1, 1]);\n // xInput.print();\n console.log(xInput.shape);\n\n yExpected = yExpected.reshape([5, 1]);\n // yExpected.print();\n console.log(yExpected.shape);\n\n const length = 5;\n\n const numNeurons = length;\n const numBatch = length;\n const numEpoch = 1000;\n\n let model = tf.sequential();\n\n model.add(\n tf.layers.lstm({\n units: length,\n inputShape: [1, 1]\n })\n );\n\n model.add(tf.layers.dense({ units: 1 }));\n\n model.compile({ loss: \"meanSquaredError\", optimizer: \"adam\" });\n\n await model.fit(xInput, yExpected, {\n epochs: numEpoch,\n verbose: 0\n });\n\n const result = model.predict(\n tf.tensor3d([0.0, 0.2, 0.4, 0.6, 0.8], [5, 1, 1])\n );\n console.log(kleur.bgMagenta(kleur.black(`one2one prediction`)));\n console.log(result.shape);\n result.print();\n console.log(kleur.bgMagenta(kleur.black(`______________________________`)));\n}", "resetModel(newPositive, newNegative, shape = this.shape) {\n this.model = this.createModel(shape);\n this.putData(newPositive, newNegative);\n }", "function onReshape() {\n\n camera.aspect = window.innerWidth / window.innerHeight;\n camera.updateProjectionMatrix();\n renderer.setSize( window.innerWidth, window.innerHeight );\n\n}", "toTRMat4x4(m) {\nreturn RQ.setTRMat4x4FromQV(m, this.xyzw, true, false, true);\n}", "function predict(net,filenames,dir) {\n var predicted_score=0\n //fs.readdir(__dirname+'/'+dir,function(err,items){\n for(var x =0;x<filenames.length;x++) {\n var jpegData = fs.readFileSync(__dirname+'/'+dir+'/'+filenames[x])\n var rawImageData = jpeg.decode(jpegData,true)\n var mat = []\n //console.log(rawImageData.data[0])\n //var index = indices[x]\n var direction = filenames[x].split('-')[0]\n var dint;\n //console.log(direction)\n if(direction[0] ==='l') {\n dint = 0\n }\n else if(direction[0]==='s') {\n dint = 1\n }\n else if(direction[0] === 'r') {\n dint = 2\n }\n else {\n continue\n }\n // for(var i =0;i<24;i++) {\n // mat.push([])\n // for(var j=0;j<32;j++) {\n // //var row = i*51200\n // //mat[i].push([])\n // mat[i].push(rawImageData.data[i*32*4+j*4])\n // }\n // }\n for(var i =0;i<24;i++) {\n //mat.push([])\n for(var j=0;j<32;j++) {\n //var row = i*51200\n //mat[i].push([])\n mat.push(rawImageData.data[i*32*4+j*4])\n }\n }\n //console.log('predict='+mat)\n //console.log('\\n\\n\\n')\n var vol = new convnetjs.Vol(32,24,1)\n //console.log(x)\n vol.w = mat\n var prob = net.forward(vol)\n //console.log(prob.w+' '+filenames[x])\n if(prob.w[dint]>=prob.w[0]&&prob.w[dint]>=prob.w[1]&&prob.w[dint]>=prob.w[2]){\n //console.log(prob.w+' '+filenames[x])\n predicted_score++\n }\n else{\n console.log(prob.w+' '+filenames[x])\n //console.log(filenames[x])\n }\n }\n return predicted_score\n //})\n}", "function reshapeBias(xRank, bias, dataFormat) {\n const biasShape = bias.shape;\n if (bias.rank !== 1 && bias.rank !== xRank) {\n throw new _errors__WEBPACK_IMPORTED_MODULE_2__[\"ValueError\"](`Unexpected bias dimensions: ${bias.rank}` +\n `; expected it to be 1 or ${xRank}`);\n }\n if (xRank === 5) {\n if (dataFormat === 'channelsFirst') {\n if (biasShape.length === 1) {\n return bias.reshape([1, biasShape[0], 1, 1, 1]);\n }\n else {\n return bias.reshape([1, biasShape[3], biasShape[0], biasShape[1], biasShape[2]]);\n }\n }\n else if (dataFormat === 'channelsLast') {\n if (biasShape.length === 1) {\n return bias.reshape([1, 1, 1, 1, biasShape[0]]);\n }\n else {\n return bias.reshape([1].concat(biasShape));\n }\n }\n }\n else if (xRank === 4) {\n if (dataFormat === 'channelsFirst') {\n if (biasShape.length === 1) {\n return bias.reshape([1, biasShape[0], 1, 1]);\n }\n else {\n return bias.reshape([1, biasShape[2], biasShape[0], biasShape[1]]);\n }\n }\n else if (dataFormat === 'channelsLast') {\n if (biasShape.length === 1) {\n return bias.reshape([1, 1, 1, biasShape[0]]);\n }\n else {\n return bias.reshape([1].concat(biasShape));\n }\n }\n }\n else if (xRank === 3) {\n if (dataFormat === 'channelsFirst') {\n if (biasShape.length === 1) {\n return bias.reshape([1, biasShape[0], 1]);\n }\n else {\n return bias.reshape([1, biasShape[1], biasShape[0]]);\n }\n }\n else if (dataFormat === 'channelsLast') {\n if (biasShape.length === 1) {\n return bias.reshape([1, 1, biasShape[0]]);\n }\n else {\n return bias.reshape([1].concat(biasShape));\n }\n }\n }\n else if (xRank < 3) {\n return bias;\n }\n throw new _errors__WEBPACK_IMPORTED_MODULE_2__[\"ValueError\"](`Unsupported input rank by biasAdd: ${bias.rank}`);\n}", "train(inputArray, targets_array) {\n //Feedforward\n let inputs = Matrix.fromArray(inputArray);\n\n let hidden = Matrix.multiply(this.weights_ih, inputs);\n hidden.add(this.bias_h);\n hidden.sigmoid();\n\n let outputs = Matrix.multiply(this.weights_ho, hidden);\n outputs.add(this.bias_o);\n outputs.sigmoid();\n\n let targets = Matrix.fromArray(targets_array);\n\n //Backpropagation\n //--- Calcular output error -------------------------------------\n //Error = Answer - Outputs\n let output_errors = Matrix.subtract(targets, outputs);\n //Gradiente output = lr * Errores * (sigmoid(wo) * (1 - sigmoid(wo)) * wh)\n //let gradient = outputs\n\n //Calcular gradiente output\n let gradients = outputs.copy();\n gradients.dsigmoid();\n gradients.multiply(output_errors);\n gradients.multiply(this.learning_rate);\n\n\n //Calcular deltas hidden->output\n let hidden_T = Matrix.transpose(hidden);\n let weight_ho_deltas = Matrix.multiply(gradients, hidden_T);\n this.weights_ho.add(weight_ho_deltas);\n this.bias_o.add(gradients);\n\n //--- Calcular hidden layers errors ------------------------------\n let who_t = Matrix.transpose(this.weights_ho);\n let hidden_errors = Matrix.multiply(who_t, output_errors);\n\n //Calcular gradiente hidden\n let hidden_gradient = hidden.copy();\n hidden_gradient.dsigmoid();\n hidden_gradient.multiply(hidden_errors);\n hidden_gradient.multiply(this.learning_rate);\n\n //Calcular deltas input->hidden\n let inputs_t = Matrix.transpose(inputs);\n let weight_ih_deltas = Matrix.multiply(hidden_gradient, inputs_t);\n this.weights_ih.add(weight_ih_deltas);\n this.bias_h.add(hidden_gradient);\n\n // outputs.print();\n // targets.print();\n // output_errors.print();\n\n }", "async function predict(product_name, size, current_size_format, isWater, requires_age_check, current_packaging) {\n document.getElementById(\"loading\").style.display = \"inline\";\n\n if (!model) { // cargar el modelo solo la primera vez\n model = await tf.loadLayersModel('./model/model.json');\n console.log(model.summary());\n }\n\n let row = await initialize_product(product_name, size, current_size_format, isWater, requires_age_check, current_packaging);\n\n const inputTensorX = tf.tensor1d(row).expandDims();\n const predictionX = model.predict(inputTensorX);\n\n document.getElementById(\"loading\").style.display = \"none\";\n\n alert(`Predicción precio para ${product_name}, ${size} ${current_size_format}, presentado en ${current_packaging}: ${predictionX.asScalar()} €`);\n}", "function translate( x, y, z )\n{\n if(arguments.length!=2 && arguments.length != 3) {\n throw \"translate(): not a mat3 or mat4\";\n }\n if(arguments.length == 2) {\n result = mat3();\n result[0][2] = x;\n result[1][2] = y;\n\n return result;\n }\n result = mat4();\n\n result[0][3] = x;\n result[1][3] = y;\n result[2][3] = z;\n\n return result;\n\n}", "update_transform(program_state, model_transform) {\n \t// Given model_transform for initial position of the lamp, set the relative position of the pole/base/lightbulb\n \tmodel_transform = model_transform.times(Mat4.scale(this.scale,this.scale,this.scale));\n\t\tmodel_transform = model_transform.times(Mat4.rotation(-Math.PI/2, 1, 0, 0))\n this.model_transform = model_transform;\n this.mt_window = model_transform.times(Mat4.scale(10, 10, 1));\n\n const inner_beam_hor = Mat4.scale(10, 0.5, 0.5)\n const inner_beam_vert = Mat4.scale(0.5, 10, 0.5)\n const outer_beam_hor = Mat4.scale(10.1, 0.5, 0.5)\n const outer_beam_vert = Mat4.scale(0.5, 10.5, 0.5)\n this.mt_frame = [\n model_transform.times(inner_beam_hor),\n model_transform.times(inner_beam_vert),\n model_transform.times(Mat4.translation(10, 0, 0)).times(outer_beam_vert),\n model_transform.times(Mat4.translation(-10, 0, 0)).times(outer_beam_vert),\n model_transform.times(Mat4.translation(0, 10, 0)).times(outer_beam_hor),\n model_transform.times(Mat4.translation(0, -10, 0)).times(outer_beam_hor),\n ]\n\n const curtain_scale = Mat4.scale(5.5, 13, 0.3);\n this.mt_curtain_right = model_transform.times(Mat4.translation(5.5, -2, 1)).times(curtain_scale);\n this.mt_curtain_left = model_transform.times(Mat4.translation(-5.5, -2, 1)).times(curtain_scale);\n\n\t\tthis.mt_pole = model_transform.times(Mat4.translation(0, 11.5, 1))\n .times(Mat4.rotation(Math.PI/2, 0, 1, 0))\n .times(Mat4.scale(0.3, 0.3, 24))\n }", "adjustScale(cx, cy, scale) {\n this.onModelReady.push(() => {\n this.viewMatrix.adjustScale(cx, cy, scale);\n });\n }", "constructor(inputs, hiddenLayers, outputs) {\n this.layers = []; //Each element is a vector corresponding to the in/output\n //i.e. layers[0] is the inputs\n this.consts = []; //Each element is a vector corresponding to the\n //constants at the layer of the same index\n this.weights = []; //Each element is a matrix corresponding to the weights\n //of connections from the layer at the same index and\n //the next layer\n //i.e. weights[0] corresponds to the weights from\n // layers[0] to layers[1]\n\n //Set up inputs\n this.layers.push(new Matrix(inputs, 1, 1));\n //Set up hidden layers (we are using He initialization of weights)\n if (Array.isArray(hiddenLayers)) {\n for (let i = 0; i < hiddenLayers.length; i++) {\n this.layers.push(new Matrix(hiddenLayers[i], 1));\n this.consts.push(new Matrix(hiddenLayers[i], 1, 0));\n this.weights.push(new Matrix(this.layers[i+1].size(),\n this.layers[i].size())\n .randomize(2, Math.sqrt(2/this.layers[i].size())));\n }\n } else if (hiddenLayers > 0) {\n this.layers.push(new Matrix(hiddenLayers, 1));\n this.consts.push(new Matrix(hiddenLayers, 1, 0));\n this.weights.push(new Matrix(this.layers[1].size(),\n this.layers[0].size())\n .randomize(2, Math.sqrt(2/this.layers[0].size())));\n }\n //Set up outputs\n this.layers.push(new Matrix(outputs, 1));\n this.consts.push(new Matrix(outputs, 1, 0));\n let last = this.layers.length-1;\n this.weights.push(new Matrix(this.layers[last].size(),\n this.layers[last-1].size())\n .randomize(2, Math.sqrt(2/this.layers[last-1].size())));\n }", "predict(input) {\n const preprocessedInput = tfc.div(\n tfc.sub(input.asType('float32'), INPUT_MEAN),\n INPUT_STD);\n const reshapedInput =\n preprocessedInput.reshape([1, ...preprocessedInput.shape]);\n const dict = {};\n\n dict[INPUT_NODE_NAME] = reshapedInput;\n return this.model.execute(dict, OUTPUT_NODE_NAME);\n }", "function predictSaliency() {\n return tf.tidy(() => {\n const modelOutput = model.predict(fetchInputImage());\n\n const resizedOutput = tf.image.resizeBilinear(modelOutput, canvasDims, true);\n\n const clippedOutput = tf.clipByValue(resizedOutput, 0.0, 255.0);\n\n return clippedOutput.squeeze();\n });\n}", "function createUvDecodeMatrix(cfg, elements, uvCount){\n cfg.geometry.uvDecodeMats = new Array(uvCount);\n cfg.uvTranslates = new Array(uvCount);\n cfg.uvScales = new Array(uvCount);\n\n for (var i = 0; i < uvCount; i++) {\n var _start = i * 4;\n var uvTranslate = cfg.uvTranslates[i] = elements.subarray(_start, _start + 2); //new Float32Array(asset, bytePos, 2);\n var uvScale = cfg.uvScales[i] = elements.subarray(_start + 2, _start + 4); //new Float32Array(asset, bytePos + 8, 2);\n\n mat3.fromScaling(uvScaleMat, uvScale);\n mat3.fromTranslation(uvTranslateMat, uvTranslate);\n cfg.geometry.uvDecodeMats[i] = mat3.create();\n mat3.multiply(cfg.geometry.uvDecodeMats[i], uvTranslateMat, uvScaleMat);\n }\n return cfg;\n }", "feedForward(input) {\n if (input.length == this.layers[0].size()) {\n this.layers[0] = Matrix.fromArray(input);\n for (let i = 0; i < this.layers.length-1; i++) {\n //z = w * a_prev + b\n let product = Matrix.product(this.weights[i], this.layers[i])\n .add(this.consts[i]);\n //a_next = sigmoid(z)\n product.map(Functions.sigmoid);\n this.layers[i+1] = product;\n }\n return Matrix.copy(this.layers[this.layers.length-1]);\n } else {\n throw new Error(\"(input error) incorrect number of inputs\");\n }\n }", "function mousePressed() {\n for (var i = 0; i < points.length; i++) {\n perceptron.train([points[i].x, points[i].y, points[i].bias], points[i].label);\n }\n\n}", "constructor(in_nodes, hid_nodes, out_nodes) {\r\n if (in_nodes instanceof NeuralNetwork) {\r\n let a = in_nodes;\r\n this.input_nodes = a.input_nodes;\r\n this.hidden_nodes = a.hidden_nodes;\r\n this.output_nodes = a.output_nodes;\r\n\r\n this.weights_ih = a.weights_ih.copy();\r\n this.weights_ho = a.weights_ho.copy();\r\n\r\n this.bias_h = a.bias_h.copy();\r\n this.bias_o = a.bias_o.copy();\r\n } else {\r\n this.input_nodes = in_nodes;\r\n this.hidden_nodes = hid_nodes;\r\n this.output_nodes = out_nodes;\r\n\r\n this.weights_ih = new Matrix(this.hidden_nodes, this.input_nodes);\r\n this.weights_ho = new Matrix(this.output_nodes, this.hidden_nodes);\r\n this.weights_ih.randomize();\r\n this.weights_ho.randomize();\r\n\r\n this.bias_h = new Matrix(this.hidden_nodes, 1);\r\n this.bias_o = new Matrix(this.output_nodes, 1);\r\n this.bias_h.randomize();\r\n this.bias_o.randomize();\r\n }\r\n\r\n // TODO: copy these as well\r\n this.setLearningRate();\r\n this.setActivationFunction();\r\n\r\n\r\n }", "RestoreSDR() {\n let retransformed_point = glMatrix.vec3.create();\n let retransformed_normal = glMatrix.vec3.create();\n\n //Restoring Interception Point\n this._interception_point = glMatrix.vec4.fromValues(this._interception_point[0], this._interception_point[1], this._interception_point[2], 1);\n glMatrix.vec4.transformMat4(retransformed_point, this._interception_point, this._TransformationMatrix);\n this._interception_point = glMatrix.vec3.clone(retransformed_point);\n\n //Restoring Normal \n this._normal = glMatrix.vec4.fromValues(this._normal[0], this._normal[1], this._normal[2], 0);\n glMatrix.vec4.transformMat4(retransformed_normal, this._normal, this._transposedInverseTransformationMatrix);\n this._normal = glMatrix.vec3.clone(retransformed_normal);\n\n }", "function scale(x,y) {\n matrix[0] *= x;\n matrix[1] *= x;\n matrix[2] *= y;\n matrix[3] *= y;\n }", "function PerspectiveTransform( a11, a21, a31, a12, a22, a32, a13, a23, a33)\r\n{\r\n\tthis.a11 = a11;\r\n\tthis.a12 = a12;\r\n\tthis.a13 = a13;\r\n\tthis.a21 = a21;\r\n\tthis.a22 = a22;\r\n\tthis.a23 = a23;\r\n\tthis.a31 = a31;\r\n\tthis.a32 = a32;\r\n\tthis.a33 = a33;\r\n\tthis.transformPoints1=function( points)\r\n\t\t{\r\n\t\t\tvar max = points.length;\r\n\t\t\tvar a11 = this.a11;\r\n\t\t\tvar a12 = this.a12;\r\n\t\t\tvar a13 = this.a13;\r\n\t\t\tvar a21 = this.a21;\r\n\t\t\tvar a22 = this.a22;\r\n\t\t\tvar a23 = this.a23;\r\n\t\t\tvar a31 = this.a31;\r\n\t\t\tvar a32 = this.a32;\r\n\t\t\tvar a33 = this.a33;\r\n\t\t\tfor (var i = 0; i < max; i += 2)\r\n\t\t\t{\r\n\t\t\t\tvar x = points[i];\r\n\t\t\t\tvar y = points[i + 1];\r\n\t\t\t\tvar denominator = a13 * x + a23 * y + a33;\r\n\t\t\t\tpoints[i] = (a11 * x + a21 * y + a31) / denominator;\r\n\t\t\t\tpoints[i + 1] = (a12 * x + a22 * y + a32) / denominator;\r\n\t\t\t}\r\n\t\t}\r\n\tthis. transformPoints2=function(xValues, yValues)\r\n\t\t{\r\n\t\t\tvar n = xValues.length;\r\n\t\t\tfor (var i = 0; i < n; i++)\r\n\t\t\t{\r\n\t\t\t\tvar x = xValues[i];\r\n\t\t\t\tvar y = yValues[i];\r\n\t\t\t\tvar denominator = this.a13 * x + this.a23 * y + this.a33;\r\n\t\t\t\txValues[i] = (this.a11 * x + this.a21 * y + this.a31) / denominator;\r\n\t\t\t\tyValues[i] = (this.a12 * x + this.a22 * y + this.a32) / denominator;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\tthis.buildAdjoint=function()\r\n\t\t{\r\n\t\t\t// Adjoint is the transpose of the cofactor matrix:\r\n\t\t\treturn new PerspectiveTransform(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21);\r\n\t\t}\r\n\tthis.times=function( other)\r\n\t\t{\r\n\t\t\treturn new PerspectiveTransform(this.a11 * other.a11 + this.a21 * other.a12 + this.a31 * other.a13, this.a11 * other.a21 + this.a21 * other.a22 + this.a31 * other.a23, this.a11 * other.a31 + this.a21 * other.a32 + this.a31 * other.a33, this.a12 * other.a11 + this.a22 * other.a12 + this.a32 * other.a13, this.a12 * other.a21 + this.a22 * other.a22 + this.a32 * other.a23, this.a12 * other.a31 + this.a22 * other.a32 + this.a32 * other.a33, this.a13 * other.a11 + this.a23 * other.a12 +this.a33 * other.a13, this.a13 * other.a21 + this.a23 * other.a22 + this.a33 * other.a23, this.a13 * other.a31 + this.a23 * other.a32 + this.a33 * other.a33);\r\n\t\t}\r\n\r\n}", "mulMat3(a, b, dest) {\n if (!dest) {\n dest = new Float32Array(9);\n }\n\n const a11 = a[0];\n const a12 = a[3];\n const a13 = a[6];\n const a21 = a[1];\n const a22 = a[4];\n const a23 = a[7];\n const a31 = a[2];\n const a32 = a[5];\n const a33 = a[8];\n const b11 = b[0];\n const b12 = b[3];\n const b13 = b[6];\n const b21 = b[1];\n const b22 = b[4];\n const b23 = b[7];\n const b31 = b[2];\n const b32 = b[5];\n const b33 = b[8];\n\n dest[0] = a11 * b11 + a12 * b21 + a13 * b31;\n dest[3] = a11 * b12 + a12 * b22 + a13 * b32;\n dest[6] = a11 * b13 + a12 * b23 + a13 * b33;\n\n dest[1] = a21 * b11 + a22 * b21 + a23 * b31;\n dest[4] = a21 * b12 + a22 * b22 + a23 * b32;\n dest[7] = a21 * b13 + a22 * b23 + a23 * b33;\n\n dest[2] = a31 * b11 + a32 * b21 + a33 * b31;\n dest[5] = a31 * b12 + a32 * b22 + a33 * b32;\n dest[8] = a31 * b13 + a32 * b23 + a33 * b33;\n\n return dest;\n }", "identityMat3(mat = new Float32Array(9)) {\n mat[0] = 1.0;\n mat[1] = 0.0;\n mat[2] = 0.0;\n\n mat[3] = 0.0;\n mat[4] = 1.0;\n mat[5] = 0.0;\n\n mat[6] = 0.0;\n mat[7] = 0.0;\n mat[8] = 1.0;\n\n return mat;\n }", "function predict() {\n knn.predict((results) => {\n let msg;\n\n if (results.classIndex === 1) {\n msg = 'A';\n } else if (results.classIndex === 2) {\n msg = 'B';\n }\n document.getElementById('result').innerText = msg;\n\n // Update confidence\n document.getElementById('confidenceA').innerText = results.confidences[1];\n document.getElementById('confidenceB').innerText = results.confidences[2];\n\n setTimeout(() => predict(), 150);\n });\n}", "function PerspectiveTransform( a11, a21, a31, a12, a22, a32, a13, a23, a33)\n{\n\tthis.a11 = a11;\n\tthis.a12 = a12;\n\tthis.a13 = a13;\n\tthis.a21 = a21;\n\tthis.a22 = a22;\n\tthis.a23 = a23;\n\tthis.a31 = a31;\n\tthis.a32 = a32;\n\tthis.a33 = a33;\n\tthis.transformPoints1=function( points)\n\t\t{\n\t\t\tvar max = points.length;\n\t\t\tvar a11 = this.a11;\n\t\t\tvar a12 = this.a12;\n\t\t\tvar a13 = this.a13;\n\t\t\tvar a21 = this.a21;\n\t\t\tvar a22 = this.a22;\n\t\t\tvar a23 = this.a23;\n\t\t\tvar a31 = this.a31;\n\t\t\tvar a32 = this.a32;\n\t\t\tvar a33 = this.a33;\n\t\t\tfor (var i = 0; i < max; i += 2)\n\t\t\t{\n\t\t\t\tvar x = points[i];\n\t\t\t\tvar y = points[i + 1];\n\t\t\t\tvar denominator = a13 * x + a23 * y + a33;\n\t\t\t\tpoints[i] = (a11 * x + a21 * y + a31) / denominator;\n\t\t\t\tpoints[i + 1] = (a12 * x + a22 * y + a32) / denominator;\n\t\t\t}\n\t\t}\n\tthis. transformPoints2=function(xValues, yValues)\n\t\t{\n\t\t\tvar n = xValues.length;\n\t\t\tfor (var i = 0; i < n; i++)\n\t\t\t{\n\t\t\t\tvar x = xValues[i];\n\t\t\t\tvar y = yValues[i];\n\t\t\t\tvar denominator = this.a13 * x + this.a23 * y + this.a33;\n\t\t\t\txValues[i] = (this.a11 * x + this.a21 * y + this.a31) / denominator;\n\t\t\t\tyValues[i] = (this.a12 * x + this.a22 * y + this.a32) / denominator;\n\t\t\t}\n\t\t}\n\n\tthis.buildAdjoint=function()\n\t\t{\n\t\t\t// Adjoint is the transpose of the cofactor matrix:\n\t\t\treturn new PerspectiveTransform(this.a22 * this.a33 - this.a23 * this.a32, this.a23 * this.a31 - this.a21 * this.a33, this.a21 * this.a32 - this.a22 * this.a31, this.a13 * this.a32 - this.a12 * this.a33, this.a11 * this.a33 - this.a13 * this.a31, this.a12 * this.a31 - this.a11 * this.a32, this.a12 * this.a23 - this.a13 * this.a22, this.a13 * this.a21 - this.a11 * this.a23, this.a11 * this.a22 - this.a12 * this.a21);\n\t\t}\n\tthis.times=function( other)\n\t\t{\n\t\t\treturn new PerspectiveTransform(this.a11 * other.a11 + this.a21 * other.a12 + this.a31 * other.a13, this.a11 * other.a21 + this.a21 * other.a22 + this.a31 * other.a23, this.a11 * other.a31 + this.a21 * other.a32 + this.a31 * other.a33, this.a12 * other.a11 + this.a22 * other.a12 + this.a32 * other.a13, this.a12 * other.a21 + this.a22 * other.a22 + this.a32 * other.a23, this.a12 * other.a31 + this.a22 * other.a32 + this.a32 * other.a33, this.a13 * other.a11 + this.a23 * other.a12 +this.a33 * other.a13, this.a13 * other.a21 + this.a23 * other.a22 + this.a33 * other.a23, this.a13 * other.a31 + this.a23 * other.a32 + this.a33 * other.a33);\n\t\t}\n\n}", "mutate(func) {\r\n this.weights_ih.map(func);\r\n this.weights_ho.map(func);\r\n this.bias_h.map(func);\r\n this.bias_o.map(func);\r\n }", "function bilinear(src, params) {\n console.log('bilinear transformation');\n var w = src.w, h = src.h;\n\n var p00 = new Point2(parseFloat(params[0]), parseFloat(params[1]));\n var p10 = new Point2(parseFloat(params[2]), parseFloat(params[3]));\n var p01 = new Point2(parseFloat(params[4]), parseFloat(params[5]));\n var p11 = new Point2(parseFloat(params[6]), parseFloat(params[7]));\n\n var v1 = Vector2.fromPoint2(p00, p10);\n var v2 = Vector2.fromPoint2(p00, p01);\n var v3 = Vector2.fromPoint2(p11, p01);\n var e1 = v1.normalized();\n var e2 = v2.normalized();\n\n var corners = {\n x: [p00.x, p10.x, p01.x, p11.x],\n y: [p00.y, p10.y, p01.y, p11.y]\n };\n\n console.log(corners);\n\n var minX = Math.min(0, corners.x.min());\n var minY = Math.min(0, corners.y.min());\n var maxX = Math.max(w, corners.x.max());\n var maxY = Math.max(h, corners.y.max());\n\n var neww = Math.ceil(maxX - minX);\n var newh = Math.ceil(maxY - minY);\n\n var offset = {\n x: Math.round(minX),\n y: Math.round(minY)\n };\n\n console.log(offset);\n\n var dst = new RGBAImage(neww, newh);\n\n if( mapping == 'inverse' ) {\n console.log('inverse mapping');\n // inverse mapping\n for(var i= 0, idx=0;i<newh;i++) {\n var y = i;\n for(var j=0;j<neww;j++, idx+=dst.channels) {\n var x = j;\n\n var p = new Point2(x, y);\n\n // solve for a and b\n // p00 + v1 * a + v2 * b - (v1 + v3) * ab = p\n // equivalent to\n // (x00 - x) + x1 * a + x2 * b - (x1 + x3) * ab = 0\n // (y00 - y) + y1 * a + y2 * b - (y1 + y3) * ab = 0\n\n // (x00 - x) + x1 * a + b * (x2 - (x1 + x3) * a) = 0\n // (y00 - y) + y1 * a + b * (y2 - (y1 + y3) * a) = 0\n\n // b = - (x00 - x + x1 * a) / (x2 - (x1 + x3) * a)\n // b = - (y00 - y + y1 * a) / (y2 - (y1 + y3) * a)\n\n // (x00 - x + x1 * a) / (x2 - (x1 + x3) * a) = (y00 - y + y1 * a) / (y2 - (y1 + y3) * a)\n // (x00 - x + x1 * a) * (y2 - (y1 + y3) * a) = (y00 - y + y1 * a) * (x2 - (x1 + x3) * a)\n // equivalent to\n // A * a^2 + B * a + C = 0\n // A = x1*(y1+y3) -y1*(x1+x3)\n // B = (x00-x)*(y1+y3) - y2*x1 + x2*y1 - (y00-y)*(x1+x3)\n // C = (y00-y)*x2 - (x00-x)*y2\n var A = v1.x*(v1.y+v3.y) - v1.y*(v1.x+v3.x);\n var B = (p00.x-p.x)*(v1.y+v3.y)-v2.y*v1.x+v2.x*v1.y-(p00.y-p.y)*(v1.x+v3.x);\n var C = (p00.y- p.y)*v2.x-(p00.x- p.x)*v2.y;\n var roots = quadraticSolve(A, B, C);\n\n if( roots.length == 0 ) {\n // set the pixel to black\n dst.setPixel(j, i, Color.BLACK);\n }\n else {\n var a = roots.min();\n if( a < 0 ) a = roots.max();\n if( a < 0 || a > 1.0 ) {\n dst.setPixel(j, i, Color.BLACK);\n continue;\n }\n var b = ( - (p00.x - p.x + v1.x * a) / (v2.x - (v1.x + v3.x) * a) )\n || (- (p00.y - p.y + v1.y * a) / (v2.y - (v1.y + v3.y) * a));\n\n if( b < 0 || b > 1.0 ) {\n dst.setPixel(j, i, Color.BLACK);\n continue;\n }\n else {\n // set the pixel by bilinearly sampling the source image\n dst.setPixel(j, i, src.sample(a*(w-1), b*(h-1)));\n }\n }\n }\n }\n }\n else\n {\n console.log('forward mapping');\n // forward mapping\n // set all pixels to black\n for(var y=0;y<newh;y++) {\n for(var x=0;x<neww;x++) {\n dst.setPixel(x, y, Color.BLACK);\n }\n }\n\n for(var i= 0;i<h;i++) {\n var y = i;\n for(var j=0;j<w;j++) {\n var x = j;\n\n var a = x / (w-1);\n var b = y / (h-1);\n\n var p = p00.add(v1.mul(a)).add(v2.mul(b)).sub(v1.add(v3).mul(a*b));\n\n p.x += offset.x;\n p.y += offset.y;\n\n if( p.x < 0 || p.y < 0 || p.x >= neww || p.y >= newh ) {\n }\n else\n {\n // set the pixel by bilinearly sampling the source image\n dst.setPixel(Math.round(p.x), Math.round(p.y), src.getPixel(x, y));\n }\n }\n }\n }\n\n // draw the boundaries of the original image\n for(var x=0;x<w;x++) {\n dst.setPixel(x-offset.x, 0 - offset.y, Color.RED);\n dst.setPixel(x-offset.x, h-1 - offset.y, Color.RED);\n }\n for(var y=0;y<h;y++) {\n dst.setPixel(0-offset.x, y - offset.y, Color.RED);\n dst.setPixel(w-1-offset.x, y - offset.y, Color.RED);\n }\n\n // put the original image in background\n for(var y=0;y<h;y++) {\n for(var x=0;x<w;x++) {\n var c1 = src.getPixel(x,y).mul(0.4);\n var c2 = dst.getPixel(x-offset.x, y-offset.y);\n var alpha = 1.0;\n if( c2.equal(Color.BLACK) ) alpha = 0.0;\n var c = Color.interpolate(c2, c1, alpha);\n c.a = 255;\n dst.setPixel(x-offset.x, y-offset.y, c);\n }\n }\n\n return dst;\n }", "async function predict() {\n // predict can take in an image, video or canvas html element\n var classPrediction=[];\n const prediction = await model1.predict(webcam.canvas);\n for (let i = 0; i < maxPredictions; i++) {\n classPrediction[i] = prediction[i].probability.toFixed(2);\n }\n displayLabels(classPrediction);\n}", "_applyScale() {\n // adjust textures size\n for(let i = 0; i < this.textures.length; i++) {\n this.textures[i].resize();\n }\n\n // we should update the plane mvMatrix\n this._updateMVMatrix = true;\n }", "function dot(x, y, fusedActivation, bias) {\n if ((x.rank < 2) || (y.rank < 2)) {\n throw new errors_1.NotImplementedError(\"dot requires both inputs to be rank >= 2\" +\n (\" but got x shape = \" + x.shape + \" and y shape = \" + y.shape));\n }\n if (y.rank >= 3) {\n var xLastDim = x.shape.slice(-1)[0];\n var ySecondLastDim = y.shape.slice(-2)[0];\n if (xLastDim !== ySecondLastDim) {\n throw new errors_1.NotImplementedError(\"If rank y >= 3, then the second last dim\" +\n (\" of y must equal the last dim of x but got x shape = \" + x.shape + \" and \") +\n (\" y shape = \" + y.shape));\n }\n }\n // Handle basic 2D x 2D case.\n if ((x.rank === 2) && (y.rank === 2)) {\n var transposeX = false;\n var transposeY = false;\n // tfc.fused.matMul only fuses certain activation functions. Unsupported\n // activation functions are treated as 'linear' activations, which is\n // equivalent to a no-op.\n return tfc.fused.matMul(x, y, transposeX, transposeY, bias ? reshapeBias(x.rank, bias, common_2.imageDataFormat()) : null, fusedActivation);\n }\n else {\n // Reshape x into the analogous 2D Tensor.\n var xFirstDims = x.shape.slice(); // Holds all but the last dim of x.\n var xLastDim = xFirstDims.pop();\n x = x.reshape([-1, xLastDim]);\n // Reshape y into the analogous 2D Tensor, and keep track of the\n // required dimensions to reproduce the output shape.\n var yShape = y.shape.slice();\n var yLastDim = yShape.pop();\n var ySecondLastDim = yShape.pop();\n var yOtherDims = yShape.concat([yLastDim]);\n // permutation should be like [r-2, 0, 1, 2, ... r-4, r-3, r-1]\n // where r is the rank of y.\n var perm = Array.from({ length: y.rank }, function (_, i) {\n if (i === 0) {\n return y.rank - 2;\n }\n else if (i <= y.rank - 2) {\n return i - 1;\n }\n return i;\n });\n y = y.transpose(perm).reshape([ySecondLastDim, -1]);\n // Multiply x and y as 2D Tensors, and then reshape back to original.\n var outputShape = xFirstDims.concat(yOtherDims);\n var transposeX = false;\n var transposeY = false;\n return tfc.fused\n .matMul(x, y, transposeX, transposeY, bias ? reshapeBias(x.rank, bias, common_2.imageDataFormat()) : null, fusedActivation)\n .reshape(outputShape);\n }\n}" ]
[ "0.56783444", "0.5544139", "0.54726607", "0.53894836", "0.526348", "0.52022594", "0.512696", "0.512696", "0.5119257", "0.5116782", "0.5102403", "0.5036253", "0.50329655", "0.5013155", "0.49926764", "0.49902257", "0.49791205", "0.49791205", "0.49761164", "0.49726117", "0.49680534", "0.4941576", "0.49272528", "0.49134928", "0.48866257", "0.48552456", "0.48542753", "0.4852843", "0.48443836", "0.48227304", "0.48214838", "0.48154765", "0.4778026", "0.4763785", "0.47508344", "0.4744338", "0.47435609", "0.47324002", "0.47291964", "0.47128075", "0.47121122", "0.47088605", "0.4705806", "0.46949998", "0.46949553", "0.4684568", "0.4653982", "0.46516243", "0.46309793", "0.4618032", "0.46030298", "0.4599719", "0.4599519", "0.45953944", "0.45953944", "0.45917997", "0.4586483", "0.4586483", "0.4586483", "0.45856762", "0.45765266", "0.45631284", "0.4548583", "0.4546529", "0.4546507", "0.45464826", "0.4542636", "0.45414406", "0.45392346", "0.4536704", "0.4530966", "0.45146918", "0.4514503", "0.45142713", "0.4510262", "0.45066768", "0.4500584", "0.44993636", "0.44989613", "0.4497632", "0.44887626", "0.4483735", "0.44795388", "0.44782445", "0.4475984", "0.44753397", "0.44666186", "0.4463567", "0.4458681", "0.44572768", "0.44532913", "0.44493836", "0.44438532", "0.44430304", "0.44413614", "0.44379494", "0.4437344", "0.4433527", "0.44316617", "0.44305933" ]
0.49377775
22
getStorage will test to see if the requested storage type is available, if it is not, it will try sessionStorage, and if that is also not available, it will fallback to InMemoryStorage.
function getStorage(type) { try { // Get the desired storage from the window and test it out. const storage = window[type]; testStorageAccess(storage); // Storage test was successful! Return it. return storage; } catch (err) { // When third party cookies are disabled, session storage is readable/ // writable, but localStorage is not. Try to get the sessionStorage to use. if (type !== 'sessionStorage') { console.warn('Could not access', type, 'trying sessionStorage', err); return getStorage('sessionStorage'); } console.warn( 'Could not access sessionStorage falling back to InMemoryStorage', err ); } // No acceptable storage could be found, returning the InMemoryStorage. return new InMemoryStorage(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getStorageImpl() {\n\tif (_storageImpl) {\n\t\treturn _storageImpl;\n\t}\n\n\t_impls.some(function(impl) {\n\t\tif (impl.isAvailable()) {\n\t\t\tvar ctor = impl.StorageInterface;\n\t\t\t_storageImpl = new ctor();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t});\n\n\treturn _storageImpl;\n}", "getStorage() {\n if (!this._storage) {\n this._storage = new BrowserStorage_1.default();\n }\n\n return this._storage;\n }", "function getStorage(storage) {\n if (storage) {\n return storage;\n }\n\n return {\n store: {},\n getItem: function getItem(key) {\n return this.store[key];\n },\n setItem: function setItem(key, value) {\n return this.store[key] = value;\n },\n removeItem: function removeItem(key) {\n delete this.store[key];\n return this;\n }\n };\n}", "_storage() {\n return getStorage(get(this, '_storageType'));\n }", "function getStorage(storage) {\n\t if (storage) {\n\t return storage;\n\t }\n\t\n\t return {\n\t store: {},\n\t getItem: function getItem(key) {\n\t return this.store[key];\n\t },\n\t setItem: function setItem(key, value) {\n\t return this.store[key] = value;\n\t },\n\t removeItem: function removeItem(key) {\n\t delete this.store[key];\n\t return this;\n\t }\n\t };\n\t}", "function getStorage(storage) {\n\t if (storage) {\n\t return storage;\n\t }\n\n\t return {\n\t store: {},\n\t getItem: function getItem(key) {\n\t return this.store[key];\n\t },\n\t setItem: function setItem(key, value) {\n\t return this.store[key] = value;\n\t },\n\t removeItem: function removeItem(key) {\n\t delete this.store[key];\n\t return this;\n\t }\n\t };\n\t}", "function getStorage() {\n\t\t\treturn localStorageObj;\n\t\t}", "function getStorage(key) {\r\n sessionStorage.getItem(key);\r\n}", "function getSessionStorage(name){\r\n\t\tvar value = sessionstorage.get(name); \r\n\t\treturn((value!=null&&typeof(value) != undefined)?value:\"\");\r\n\t}", "async function getStorage(key = null){\n\treturn key \n\t? (await browser.storage.local.get(key))[key] \n\t: (await browser.storage.local.get())\n}", "function getStorage() {\n if (sessionStorage.getItem(\"order\") != null) {\n var storage = JSON.parse(sessionStorage.getItem(\"order\"));\n } else {\n var storage = {\n \"custom\": []\n };\n }\n return storage;\n}", "getStorage(key) {\n const now = Date.now(); //epoch time, lets deal only with integer\n // set expiration for storage\n let expiresIn = this.$localStorage.get(key + \"_expiresIn\");\n if (expiresIn === undefined || expiresIn === null) {\n expiresIn = 0;\n }\n if (expiresIn < now) {\n // Expired\n this.removeStorage(key);\n return null;\n } else {\n try {\n const value = this.$localStorage.get(key);\n return value;\n } catch (e) {\n logger.publish(\n 4,\n \"store\",\n `getStorage: Error reading key [\n ${key}\n ] from localStorage: `,\n e\n );\n return null;\n }\n }\n }", "function getSessionStorageIfAvailable() {\r\n var _a;\r\n try {\r\n return ((_a = _getSelfWindow()) === null || _a === void 0 ? void 0 : _a.sessionStorage) || null;\r\n }\r\n catch (e) {\r\n return null;\r\n }\r\n}", "function getStorage() {\r if (!isHtml5StorageAvailable) {\r /* Dummy temporary local storage object. */\r window.localStorage = new Object(); \r }\r return localStorage;\r}", "getStorage() {\n return this.storage;\n }", "getStorage() {\n return this.storage;\n }", "function checkStorage(){\r\n\t\t\ttry {\r\n\t\t\t\t\tvar x = 'test-sessionStorage-' + Date.now();\r\n\t\t\t\t\tsessionStorage.setItem(x, x);\r\n\t\t\t\t\tvar y = sessionStorage.getItem(x);\r\n\t\t\t\t\tsessionStorage.removeItem(x);\r\n\t\t\t\t\tif (y !== x) {throw new Error();}\r\n\t\t\t\t\tdb = sessionStorage; // sessionStorage is fully functional!\r\n\t\t\t} catch (e) {\r\n\t\t\t\tdb = new MemoryStorage('GW-sessionStorage'); // fall back to a memory-based implementation\r\n\t\t\t}\r\n\t\t}", "function getStorage(){\r\n var getting = browser.storage.local.get(\"api_key\"); //Call to get local storage\r\n getting.then(gatherStorage, getError);\r\n}", "function getStorage(provider, prefix) {\n if (storage[provider] === void 0) {\n storage[provider] = Object.create(null);\n }\n const providerStorage = storage[provider];\n if (providerStorage[prefix] === void 0) {\n providerStorage[prefix] = newStorage(provider, prefix);\n }\n return providerStorage[prefix];\n}", "function getStorage(e) {\n try {\n return wx.getStorageSync(e)\n } catch (e) {\n errorEvent(\"getStorageSync\", e)\n }\n}", "function _load_storage(){\n /* if jStorage string is retrieved, then decode it */\n if(_storage_service.jStorage){\n try{\n _storage = json_decode(String(_storage_service.jStorage));\n }catch(E6){_storage_service.jStorage = \"{}\";}\n }else{\n _storage_service.jStorage = \"{}\";\n }\n _storage_size = _storage_service.jStorage?String(_storage_service.jStorage).length:0; \n }", "function getStore(useLocal) {\n return useLocal ? localStorage : sessionStorage;\n }", "function checkForStorage() {\n return typeof(Storage) !== \"undefined\"\n}", "setupStorage(type = \"local\") {\n if (type == \"local\") {\n this._storage =\n window && window.localStorage\n ? window.localStorage\n : window.sessionStorage;\n }\n }", "function supportsStorage() {\n let key = '__lscachetest__';\n let value = key;\n\n if(this.cachedStorage !== undefined) {\n return this.cachedStorage;\n }\n\n // some browsers will throw an error if you try to access local storage (e.g. brave browser)\n // hence check is inside a try/catch\n try {\n if(!localStorage) {\n return false;\n }\n } catch(ex) {\n return false;\n }\n\n try {\n Implementations.localStorage.setItem.call(this, key, value);\n Implementations.localStorage.removeItem.call(this, key);\n this.cachedStorage = true;\n } catch(e) {\n // If we hit the limit, and we don't have an empty localStorage then it means we have support\n if(Implementations.localStorage.supported() /*isOutOfSpace.call(this, e) && localStorage.length*/) {\n this.cachedStorage = true; // just maxed it out and even the set test failed.\n } else {\n this.cachedStorage = false;\n }\n }\n return this.cachedStorage;\n}", "function getStorage(key)\n{\n localStorage.length;\n var value = localStorage.getItem(key);\n if (value && (value.indexOf(\"{\") == 0 || value.indexOf(\"[\") == 0))\n {\n return JSON.parse(value);\n }\n return value;\n}", "function setupBrowserStorage(){\n if(browser || storageMock){\n if(storageMock){\n store = storageMock;\n storageKey = 'cache-module-storage-mock';\n }\n else{\n var storageType = (config.storage === 'local' || config.storage === 'session') ? config.storage : null;\n store = (storageType && typeof Storage !== void(0)) ? window[storageType + 'Storage'] : false;\n storageKey = (storageType) ? self.type + '-' + storageType + '-storage' : null;\n }\n if(store){\n var db = store.getItem(storageKey);\n try {\n cache = JSON.parse(db) || cache;\n } catch (err) { /* Do nothing */ }\n }\n // If storageType is set but store is not, the desired storage mechanism was not available\n else if(storageType){\n log(true, 'Browser storage is not supported by this browser. Defaulting to an in-memory cache.');\n }\n }\n }", "function getLocalStorage(){\n if (typeof localStorage == \"object\"){\n return localStorage;\n } else if (typeof globalStorage == \"object\"){\n return globalStorage[location.host];\n } else {\n \tstorage = {};\n } \n}", "function _load_storage(){\n /* if jStorage string is retrieved, then decode it */\n if(_storage_service.jStorage){\n try{\n _storage = JSON.parse(String(_storage_service.jStorage));\n }catch(E6){_storage_service.jStorage = \"{}\";}\n }else{\n _storage_service.jStorage = \"{}\";\n }\n _storage_size = _storage_service.jStorage?String(_storage_service.jStorage).length:0;\n\n if(!_storage.__jstorage_meta){\n _storage.__jstorage_meta = {};\n }\n if(!_storage.__jstorage_meta.CRC32){\n _storage.__jstorage_meta.CRC32 = {};\n }\n }", "function checkStorage(){\r\n\t\t\ttry {\r\n\t\t\t\tvar x = 'test-localstorage-' + Date.now();\r\n\t\t\t\tlocalStorage.setItem(x, x);\r\n\t\t\t\tvar y = localStorage.getItem(x);\r\n\t\t\t\tlocalStorage.removeItem(x);\r\n\t\t\t\tif (y !== x) {throw new Error();}\r\n\t\t\t\tdb = localStorage; // localStorage is fully functional!\r\n\t\t\t} catch (e) {\r\n\t\t\t\tdb = new MemoryStorage('GW-localstorage'); // fall back to a memory-based implementation\r\n\t\t\t}\r\n\t\t}", "function getStorage(data)\n{\n return JSON.parse(localStorage.getItem(data))\n}", "getStorage() {\n return this.parse( localStorage.getItem( this.key ) )\n }", "getStorage(arg1) {\n return window.localStorage.getItem(arg1);\n\n }", "static getStorageModel() {\n return StorageModel;\n }", "storageType() {\n return this.engine || this._storageType() || \"local\";\n }", "function retrieveStorage() {\n \"use strict\";\n if (localStorage.colorCodeStore) {\n storage = JSON.parse(localStorage.colorCodeStore);\n return storage;\n }\n}", "function _storageSupport() {\n if (typeof (Storage) !== \"undefined\") {\n return true;\n } else {\n return false;\n }\n }", "_storageAvailable(type) {\n try {\n var storage = window[type],\n x = \"__storage_test__\";\n storage.setItem(x, x);\n storage.removeItem(x);\n return true;\n } catch (e) {\n return false;\n }\n }", "function createFallbackStorage(storageType) {\n\t\treturn {\n\t\t\tdata: {},\n\t\t\tgetItem: function (key, ns) {\n\t\t\t\tkey = getNamespacedKey(key, ns);\n\t\t\t\treturn this.data[key];\n\t\t\t},\n\t\t\tsetItem: function (key, value, ns) {\n\t\t\t\tkey = getNamespacedKey(key, ns);\n\t\t\t\tthis.data[key] = value;\n\t\t\t\tthis.updateLength();\n\t\t\t},\n\t\t\tremoveItem: function (key, ns) {\n\t\t\t\tkey = getNamespacedKey(key, ns);\n\t\t\t\ttry {\n\t\t\t\t\tdelete this.data[key];\n\t\t\t\t} catch (e) {\n\t\t\t\t}\n\t\t\t\tthis.updateLength();\n\t\t\t},\n\t\t\tclear: function (ns) {\n\t\t\t\tfor (var key in this.data) {\n\t\t\t\t\tif(key.indexOf(window.famobi_gameID) === 0) this.removeItem(key, \"\");\n\t\t\t\t}\n\t\t\t},\n\t\t\tkey: function (i) {\n\t\t\t\tvar keys = [];\n\t\t\t\tfor (var key in this.data) {\n\t\t\t\t\tif(key.indexOf(window.famobi_gameID) === 0) keys.push(key);\n\t\t\t\t}\n\t\t\t\treturn typeof keys[i] === \"undefined\" ? null : keys[i];\n\t\t\t},\n\t\t\tupdateLength: function(){\n\t\t\t\tM.length = self.sizeOf(this.data);\n\t\t\t},\n\t\t\tgetKeys: function(){\n\t\t\t\tvar keys = [];\n\t\t\t\tfor (var key in this.data) {\n\t\t\t\t\tkeys.push(key);\n\t\t\t\t}\n\t\t\t\treturn keys;\n\t\t\t}\n\t\t};\n\t}", "function getBrowserStorage() {\n return window['browserStorage'] || chrome.extension.getBackgroundPage().browserStorage;\n}", "function getSessionStorageItem(key) {\n return sessionStorage.getItem(key);\n}", "function getStorage(){\t\t//funcio que mira si hi ha ranking i el carrega. Si no n'hi ha inicia el ranking des de zero\n\tif (!localStorage.getItem('ranking')){\n\t\tstartRanking();\t\t//inicia el ranking des de zero\n\t}\n\telse {\n\t\tgetRanking();\t\t//carrega el ranking guardat\n\t}\n}", "function changeStorageType(){\r\n\t\tstorage = getCurrentStorageType() === \"sync\" ?\r\n\t\t\t\tchrome.storage.local : chrome.storage.sync;\r\n\t}", "function getDataStored(storage){\n var data = [];\n //check if browser supports storage\n if (typeof(Storage) !== \"undefined\") {\n if(localStorage.getItem(storage) !== null){\n data = JSON.parse(window.localStorage.getItem(storage));\n if(data.length ===0) data = [];\n }\n }\n\n return data;\n\n}", "function get(name) {\n if (typeof (Storage) !== 'undefined') {\n return localStorage.getItem(name)\n } else {\n console.warn('LocalStorage not available for your browser. Layout customization will not work.')\n }\n}", "function initializeStorage() {\n if (storageSpace === null) {\n storageSpace = storage.createKeyValueStorage(\"webScience.userSurvey\");\n }\n}", "function getStorage()\n\t\t \t{\n\t\t \t\tvar data = localStorage.getItem('data');\n\t\t \t\tdata = JSON.parse(data);\n\t\t \t\treturn data;\n\t\t \t}", "static get(name) {\n if (typeof sessionStorage !== 'undefined') {\n name = JSONStorage.prefix + \"-\" + name;\n return JSON.parse(sessionStorage.getItem(name) || \"null\")\n }\n }", "function storageWrapper(type) {\n var storage = window[type];\n\n return {\n get: function (key) {\n let val = storage.getItem(key);\n\n try {\n val = JSON.parse(val);\n } catch (e) {\n //Do nothing\n }\n return val;\n },\n set: function (key, val) {\n storage.setItem(key, JSON.stringify(val));\n },\n remove: function (key) {\n storage.removeItem(key);\n },\n clear: function () {\n storage.clear();\n }\n };\n\n }", "function initStorage() {\n _storage = localStorage;\n}", "function supportsStorage() {\n var key = '__lscachetest__';\n var value = key;\n\n if (cachedStorage !== undefined) {\n return cachedStorage;\n }\n\n try {\n setItem(key, value);\n removeItem(key);\n cachedStorage = true;\n } catch (exc) {\n cachedStorage = false;\n }\n return cachedStorage;\n }", "function getCurrentStorageType(){\r\n\t\t// property MAX_ITEMS is present only in sync\r\n\t\treturn storage.MAX_ITEMS ? \"sync\" : \"local\";\r\n\t}", "function getItem(key) {\n var result = null;\n try {\n result = window.sessionStorage.getItem(key);\n }\n catch (e) {\n /* Eat the exception */\n }\n return result;\n}", "function getItem(key) {\n var result = null;\n try {\n result = window.sessionStorage.getItem(key);\n }\n catch (e) {\n /* Eat the exception */\n }\n return result;\n}", "function get(name) {\n if (typeof (Storage) !== 'undefined') {\n return localStorage.getItem(name)\n } else {\n console.warn('LocalStorage not available for your browser. Layout customization will not work.')\n }\n }", "function storage_loadObject(key) {\r\n\tif (localStorageSupported()) {\r\n\t\tvar object = window.localStorage.getItem(key);\r\n\t\tif (object != null) {\r\n\t\t\treturn JSON.parse(object);\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n}", "function _getStorage() {\n let storage = multer.diskStorage({\n destination: (req, file, cb) => {\n cb(null, UPLOAD_LOCATION)\n },\n filename: (req, file, cb) => {\n cb(null, `${Date.now()}-${file.originalname}`)\n }\n })\n\n return storage\n}", "function storageAvailable(type) {\n var storage = window[type], x = '__storage_test__';\n try {\n storage.setItem(x, x);\n storage.removeItem(x);\n return true;\n }\n catch(e) {\n return false;\n }\n }", "function supportsLocalStorage() {\n return typeof(Storage) !== undefined;\n}", "function storageAvailable(type) {\n try {\n var storage = window[type];\n var x = \"__storage_test__\";\n storage.setItem(x, x);\n storage.removeItem(x);\n return true;\n }\n catch(e) {\n return false;\n }\n}", "function checkStorageAvailability(type){\n let storage;\n try {\n storage = window[type];\n storage.setItem(\"__storage_test__\",\"__test__\");\n storage.removeItem(\"__storage_test__\");\n return true;\n } catch (error) {\n console.error(\"No LocalStorage Availability\",error);\n return false; \n }\n}", "function storageAvailable(type) {\n try {\n var storage = window[type],\n x = '__storage_test__';\n storage.setItem(x, x);\n storage.removeItem(x);\n return true;\n }\n catch(e) {\n return false;\n }\n }", "function Store () {\n return sessionStorage;\n}", "function storageAvailable(type){\n\t\ttry {\n\t\t\tvar storage = window[type],\n\t\t\t\tx = '__storage_test__';\n\t\t\tstorage.setItem(x, x);\n\t\t\tstorage.removeItem(x);\n\t\t\treturn true;\n\t\t}\n\t\tcatch(e) {\n\t\t\treturn false;\n\t\t}\n\t}", "function storageAvailable (type) {\n let storage = window[type]\n\n try {\n const x = '__storage_test__'\n storage.setItem(x, x)\n storage.removeItem(x)\n return true\n } catch (e) {\n return e instanceof DOMException && (\n e.code === 22 ||\n e.code === 1014 ||\n e.name === 'QuotaExceededError' ||\n e.name === 'NS_ERROR_DOM_QUOTA_REACHED'\n ) && storage.length !== 0\n }\n}", "function storageChecker(){\r\n if (localStorage.getItem('players') !== null){\r\n getLocalStorage();\r\n }\r\n}", "function storageAvailable(type) {\n try {\n const storage = window[type];\n const x = '__storage_test__';\n storage.setItem(x, x);\n storage.removeItem(x);\n return true;\n } catch (e) {\n return false;\n }\n}", "function storageAvailable(type) {\n\t\ttry {\n\t\t\tvar storage = window[type],\n\t\t\t\tx = '__storage_test__';\n\t\t\tstorage.setItem(x, x);\n\t\t\tstorage.removeItem(x);\n\t\t\treturn true;\n\t\t}\n\t\tcatch(e) {\n\t\t\treturn false;\n\t\t}\n\t}", "function checkForStorage() {\n\n if (!localStorage.myStorage) {\n console.log('no local');\n createArray();\n showThreePics();\n } else {\n console.log(' yes local');\n var tempDataHolder = localStorage.getItem('myStorage');\n var parseData = JSON.parse(tempDataHolder);\n allProducts = parseData;\n showThreePics();\n }\n}", "get storageType() {\n return this.getStringAttribute('storage_type');\n }", "function Storage() {\n this.get = function (name) {\n return JSON.parse(window.localStorage.getItem(name));\n };\n this.set = function (name, value) {\n window.localStorage.setItem(name, JSON.stringify(value));\n };\n this.clear = function () {\n window.localStorage.clear();\n };\n this.size = function() { \n return window.localStorage.length;\n };\n}", "function storageAvailable(type) {\n try {\n var storage = window[type],\n x = '__storage_test__';\n storage.setItem(x, x);\n storage.removeItem(x);\n return true;\n }\n catch(e) {\n return false;\n }\n }", "function getFromStorage(key) {\n return JSON.parse(window.localStorage.getItem(key))\n}", "function storageInitialize() {\n var sessionStorage;\n /**\n * sessionStorage throws error when cookies are disabled\n * Chrome content settings when running the site in a Facebook IFrame.\n * see: https://github.com/devote/HTML5-History-API/issues/34\n * and: http://stackoverflow.com/a/12976988/669360\n */\n try {\n sessionStorage = global['sessionStorage'];\n sessionStorage.setItem(sessionStorageKey + 't', '1');\n sessionStorage.removeItem(sessionStorageKey + 't');\n } catch(_e_) {\n sessionStorage = {\n getItem: function(key) {\n var cookie = document.cookie.split(key + \"=\");\n return cookie.length > 1 && cookie.pop().split(\";\").shift() || 'null';\n },\n setItem: function(key, value) {\n var state = {};\n // insert one current element to cookie\n if (state[windowLocation.href] = historyObject.state) {\n document.cookie = key + '=' + JSON.stringify(state);\n }\n }\n }\n }\n\n try {\n // get cache from the storage in browser\n stateStorage = JSON.parse(sessionStorage.getItem(sessionStorageKey)) || {};\n } catch(_e_) {\n stateStorage = {};\n }\n\n // hang up the event handler to event unload page\n addEvent(eventNamePrefix + 'unload', function() {\n // save current state's object\n sessionStorage.setItem(sessionStorageKey, JSON.stringify(stateStorage));\n }, false);\n }", "async function getStorage (url) {\n return await fetch(url, {\n method: 'GET',\n credentials: 'same-origin',\n headers: {\n 'Content-Type': 'application/json'\n },\n })\n}", "function getSyncStorage() {\n\treturn chrome.storage.sync;\n}", "function isStorageAvailable(type) {\n\ttry {\n\t\t\tlet storage = window[type];\n\t\t\tlet x = '__storage_test__';\n\t\t\tstorage.setItem(x, x);\n\t\t\tstorage.removeItem(x);\n\t\t\treturn true;\n\t}\n\tcatch(e) {\n\t\t\treturn e instanceof DOMException && (\n\t\t\t\t\t// everything except Firefox\n\t\t\t\t\te.code === 22 ||\n\t\t\t\t\t// Firefox\n\t\t\t\t\te.code === 1014 ||\n\t\t\t\t\t// test name field too, because code might not be present\n\t\t\t\t\t// everything except Firefox\n\t\t\t\t\te.name === 'QuotaExceededError' ||\n\t\t\t\t\t// Firefox\n\t\t\t\t\te.name === 'NS_ERROR_DOM_QUOTA_REACHED') &&\n\t\t\t\t\t// acknowledge QuotaExceededError only if there's something already stored\n\t\t\t\t\t(storage && storage.length !== 0);\n\t}\n}", "function storageIsSupported(){\n\t// Check browser support\n\tif (typeof(Storage) !== \"undefined\") {\n \treturn true;\n\t}else{\n \treturn false;\n\t};\n}", "function _isSupported (storage) {\n\t\t\n\t\tif (storage && storage.setItem ) {\n\t\t\tvar key = '__' + Math.round(Math.random() * 1e7);\n\t \ttry {\n\t \t\tstorage.setItem(key, key);\n\t \tstorage.removeItem(key);\n\t \t} catch (err) {\n\t \t\tsupported = false;\n\t \t\t_printLog (err);\n\t \t}\n\t\t} else {\n\t\t\treturn !!storage;\n\t\t}\n\t}", "function load() {\r\n\tif (typeof(Storage) == \"undefined\" ) {\r\n\talert(\"Your browser does not support HTML5 localStorage. Try upgrading.\");\r\n\tconsole.log(\"browser does not support HTML5 localStorage. Upgrade needed.\");\r\n\t} else {\r\n\tconsole.log(\"Both localStorage and sessionStorage support is there.\");\r\n\t}\r\n\t}", "function _initStorage$2(options) {\n var self = this;\n var dbInfo = {};\n if (options) {\n for (var i in options) {\n dbInfo[i] = options[i];\n }\n }\n\n dbInfo.keyPrefix = dbInfo.name + '/';\n\n if (dbInfo.storeName !== self._defaultConfig.storeName) {\n dbInfo.keyPrefix += dbInfo.storeName + '/';\n }\n\n if (!_isLocalStorageUsable()) {\n return Promise$1.reject();\n }\n\n self._dbInfo = dbInfo;\n dbInfo.serializer = localforageSerializer;\n\n return Promise$1.resolve();\n}", "function asyncStorage(storage) {\n return {\n getItem: key => {\n return Promise.resolve(storage.getItem(key));\n },\n setItem: (key, val) => {\n return Promise.resolve(storage.setItem(key, val));\n },\n removeItem: key => {\n return Promise.resolve(storage.removeItem(key));\n }\n };\n}", "function localStorageSupport() {\r\n return typeof Storage !== 'undefined';\r\n}", "function supportsLocalStorage() {\n if(typeof(Storage) !== \"undefined\") {\n return true;\n } \n else {\n //No Web Storage support\n return false;\n }\n}", "function isStorageSupported() {\n try {\n return 'localStorage' in window && window['localStorage'] !== null;\n } catch (e) {\n return false;\n }\n }", "get storage() {\n return this.extensionStorage;\n }", "function retrieve(key) {\r var storage = getStorage();\r var value = null;\r if (key != null && storage != null) {\r value = storage[key]; \r if (value == \"null\") {\r value = null; \r }\r }\r return value;\r}", "async get(key, defaultValue = null) {\n if (!(key instanceof string)) {\n return undefined;\n }\n\n // Replacing local with the sync storage type allows having all stored\n // information available accross logged in browsers.\n // More information about possible key types here: \n // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/StorageArea/get\n const data = await browser.storage.local.get({ key: defaultValue });\n return data[key];\n }", "function localStorageExists() {\n var storeExists = false;\n if (typeof(Storage) !== \"undefined\") {\n storeExists = true;\n }\n return storeExists;\n}", "function ProfileStorage(storage) {\n\t this.storage = storage;\n\t}", "function storageAvailable(type) {\n let storage;\n try {\n storage = window[type];\n let x = '__storage_test__';\n storage.setItem(x,x);\n storage.removeItem(x);\n return true;\n }\n catch(e) {\n return e instanceof DOMException && (\n //everything except Firefox\n e.code === 22 ||\n //Firefox\n e.code === 1014 ||\n //test name field(code might not be present)\n // everything except Firefox\n e.name==='QuotaExceededError' ||\n // Firefox\n e.name==='NS_ERROR_DOM_QUOTA_REACHED') && \n (storage&&storage.length !==0);\n }\n}", "function ProfileStorage(storage) {\n this.storage = storage;\n}", "load () {\n return JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]')\n }", "function _isLocalStorageUsable() {\n return !checkIfLocalStorageThrows() || localStorage.length > 0;\n } // Config the localStorage backend, using options set in the config.", "getStorageItem(item_key) {\n return (localStorage.getItem(item_key)) ? JSON.parse(localStorage.getItem(item_key)) : null;\n }", "get storageTypeInput() {\n return this._storageType;\n }", "get storageTypeInput() {\n return this._storageType;\n }", "function _initStorage$2(options) {\n var self = this;\n var dbInfo = {};\n if (options) {\n for (var i in options) {\n dbInfo[i] = options[i];\n }\n }\n\n dbInfo.keyPrefix = _getKeyPrefix(options, self._defaultConfig);\n\n if (!_isLocalStorageUsable()) {\n return Promise$1.reject();\n }\n\n self._dbInfo = dbInfo;\n dbInfo.serializer = localforageSerializer;\n\n return Promise$1.resolve();\n}", "function _initStorage$2(options) {\n var self = this;\n var dbInfo = {};\n if (options) {\n for (var i in options) {\n dbInfo[i] = options[i];\n }\n }\n\n dbInfo.keyPrefix = _getKeyPrefix(options, self._defaultConfig);\n\n if (!_isLocalStorageUsable()) {\n return Promise$1.reject();\n }\n\n self._dbInfo = dbInfo;\n dbInfo.serializer = localforageSerializer;\n\n return Promise$1.resolve();\n}", "function _initStorage$2(options) {\n var self = this;\n var dbInfo = {};\n if (options) {\n for (var i in options) {\n dbInfo[i] = options[i];\n }\n }\n\n dbInfo.keyPrefix = _getKeyPrefix(options, self._defaultConfig);\n\n if (!_isLocalStorageUsable()) {\n return Promise$1.reject();\n }\n\n self._dbInfo = dbInfo;\n dbInfo.serializer = localforageSerializer;\n\n return Promise$1.resolve();\n}" ]
[ "0.73001933", "0.7217747", "0.7106509", "0.708953", "0.7034303", "0.70313287", "0.6801023", "0.6793784", "0.67905945", "0.6764917", "0.67363673", "0.67202085", "0.66941226", "0.66817075", "0.6681604", "0.6681604", "0.6677933", "0.6471737", "0.6456842", "0.6394462", "0.6381311", "0.6370582", "0.63593805", "0.634225", "0.62805665", "0.6264467", "0.6253021", "0.62502676", "0.62416935", "0.62144506", "0.6178275", "0.616928", "0.61664873", "0.6161643", "0.61441183", "0.61365205", "0.6118611", "0.6113087", "0.6111861", "0.6091446", "0.6082422", "0.60612506", "0.60413826", "0.60152584", "0.601284", "0.5979638", "0.59794235", "0.59600127", "0.5938156", "0.59372205", "0.59079427", "0.5890546", "0.58872366", "0.58872366", "0.58679014", "0.5854934", "0.5851258", "0.5847249", "0.5846379", "0.58324355", "0.5828981", "0.5825618", "0.5820423", "0.581321", "0.58078295", "0.57930505", "0.5785828", "0.57840425", "0.57840407", "0.57739586", "0.57463574", "0.5742317", "0.57306165", "0.57294124", "0.5703287", "0.5702219", "0.56994575", "0.5679395", "0.5677126", "0.56658095", "0.5665671", "0.5664155", "0.5659069", "0.5654974", "0.5642192", "0.56414926", "0.5626162", "0.5622595", "0.5620249", "0.5620064", "0.56107694", "0.56100565", "0.56084913", "0.560516", "0.56031185", "0.5600192", "0.5600192", "0.5596876", "0.5596876", "0.5596876" ]
0.80599177
0
import Welcome from './components/Welcome.js'; import logo from './logo.svg'; import './App.scss';
function App() { return ( <div> <Header /> <BrowserRouter> <Switch> <Route exact path="/" render={(routeProps) => <Login {...routeProps}/>}/> <Route exact path="/signup" render={(routeProps) => <SignUp {...routeProps}/>}/> {/* <Route exact path="/homepage" render={(routeProps) => <Welcome {...routeProps}/>}/> */} </Switch> </BrowserRouter> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function App() {\n return (\n <div className=\"App\">\n <header className=\"App-header\">\n {/* <img src={logo} className=\"App-logo\" alt=\"logo\" /> */}\n <p>\n Edit <code>src/App.js</code> and save to reload.\n </p>\n <a\n className=\"App-link\"\n href=\"https://reactjs.org\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Learn React\n </a>\n </header>\n </div>\n );\n}", "function App() {\n return (\n //JSX=>needs to import React\n <div >\n Hello Worldfff\n </div>\n );\n}", "function App() {\n return (\n <div className=\"App\">\n <header className=\"App-header\">\n <img src={logo} className=\"App-logo\" alt=\"logo\" />\n <p>\n Edit <code>src/App.js</code> and save to reload.\n </p>\n <a\n className=\"App-link\"\n href=\"https://reactjs.org\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Learn React\n </a>\n </header>\n </div>\n );\n}", "function App() {\n // useScript(\"./vert-shader.js\", \"vertex-shader\");\n // useScript(\"./frag-shader.js\", \"fragment-shader\");\n\n // useScript(\"./sphere.js\");\n // useScript(\"./webgl-utils.js\", \"webgl\");\n // useScript(\"./initShaders.js\", \"init\");\n // useScript(\"./MV.js\", \"mv\");\n // useScript(\"./robotArm.js\", \"rb\");\n return (\n <>\n <h1>Tetris Game</h1>\n <p> Website under maintenance </p>\n </>\n );\n}", "render() {\n const { initialMessage } = this.props;\n const styles = require('./App.scss');\n\n return (\n <div className={styles.app}>\n <Helmet {...config.app.head} />\n <div>Contenido de la Aplicacion</div>\n <div>{initialMessage}</div>\n\n <div>\n {this.props.children}\n </div>\n </div>\n );\n }", "render() {\n return (\n <header className=\"App-header\">\n <img src={logo} className=\"App-logo\" alt=\"logo\" />\n <h1 className=\"App-title\">Welcome to React, Dave</h1>\n </header>\n );\n }", "render() {\n return (\n <h1>Hello World!!!!!!!!!! OMG LIVE RELOADING</h1>\n );\n }", "function Header() {\n return (\n <header className=\"App-header\">\n <img src={logo} className=\"App-logo\" alt=\"logo\"/>\n <h1 className=\"App-title\">ReactND - Coding Practice</h1>\n </header>\n );\n}", "function Main() {\n return (\n <div>\n <h1>This is Main Page</h1>\n {/* <Loader /> */}\n </div>\n );\n}", "function App() {\n return (\n <div className=\"app-container\">\n {/* <img className=\"logo\" src={SOlogo}></img> */}\n <Header />\n {routes}\n <Footer />\n </div>\n );\n}", "component() {\n return import(/* webpackChunkName: \"about\" */ '../views/About.vue');\n }", "render() {\n // the \"render\" method required by \"component\" returns HTML https://www.w3schools.com/react/react_components.asp\n return ( // virtual DOM of REACT, so that you can insert HTML syntax below in a js file\n // ↓ \"class\" is a reserved word in js, so turn it into \"className\"\n\n <div className=\"App\">\n <header className=\"App-header\">\n <img src={logo} className=\"App-logo\" alt=\"logo\" />\n <p>\n Edit <code>src/App.js</code> and save to reload.\n </p>\n <a\n className=\"App-link\"\n href=\"https://reactjs.org\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Learn React\n </a>\n </header>\n </div>\n );\n }", "render() {\n return <Welcome />\n }", "function Welcome(props) {\n return <h1>Welcome !</h1>;\n}", "function App() {\n return (\n <div className=\"App\">\n <Stylesheet primary = {true} />\n {/* <MyComponent/>\n <MyHeader />\n <ClassComponent name = \"murat aykurt\"/>\n <FunctionalComponent name=\"Murat Aykurt\" dateBirth = \"1992\" /> */}\n \n </div>\n );\n}", "function App() {\n return (\n <div className=\"App\">\n hello world\n </div>\n );\n}", "function HomePage() {\n return (\n <div>\n {/* Assim o CSS funciona desabilitando o JS no browser */}\n <style jsx>{\n `p {\n font-family: \"Ubuntu\", sans-serif;\n font-size: 32px;\n text-align: center;\n }`}\n </style>\n <Header />\n <p>Welcome to my contacts!</p>\n <Button />\n </div>\n );\n}", "function App() {\n return (\n <>\n <h1>POSITIONAL CHESS TRAINER</h1>\n </>\n \n );\n}", "function App() {\n return (\n <div className=\"App\">\n\n </div>\n );\n}", "function App() { \n return (\n <div className=\"app\">\n\n </div>\n);\n}", "function App() {\n //Write JavaScriopt here\n\n\n return (\n <div className=\"App\">\n <h1>Hello React </h1>\n <div className=\"home\">\n <Nav />\n <Tweets />\n </div>\n </div>\n );\n}", "function OjoBot() {\n // Import result is the URL of your image\n return <img src={logo} alt=\"Logo\" />;\n}", "componentDidMount() {\n // Load fonts.\n loadCSS(\n Constants.URI_CDN_GOOGLE_FONTS,\n document.querySelector('#insertion-point-jss')\n );\n }", "function Home() {\n \n return (\n <div>\n <h1>Home</h1>\n </div>\n );\n}", "function App() {\n return <div className=\"reactApp\" />;\n}", "function Main() {\n\n\n return (\n <div>\n <CardGrillaArriendosHome />\n\n </div>\n )\n}", "static include() {\n return /\\.css/;\n }", "function App() {\n \n return (\n <div className=\"App\">\n <GifFinder />\n </div>\n );\n}", "function App() {\n return (\n // <AppProvider>\n <>\n <GlobalStyle />\n <Routes />\n </>\n // </AppProvider>\n );\n}", "render() {\n return (\n <h1>HelloWorld</h1>\n );\n }", "function App() {\n return (\n <PublicHome />\n );\n}", "function App(){\n\n return<TechList /> \n //<h1>Hello Rocketseat</h1> // usando sintaxe JSX - É necessario importar o react\n}", "function include(path) {\nreturn () => import('@/components/' + path)\n}", "function Home() {\n return (\n <div>\n <h1>Home</h1>\n </div>\n );\n}", "function Header () {\n return (\n <div className='jumbotron jumbotron-fluid text-center bg-info text-white'>\n <h1 style={{ fontWeight: 'bold' }}>Employee Directory</h1>\n </div>\n )\n}", "function App() {\n return (\n <div className=\"App\">\n {/*<Table />*/}\n <Sticky />\n {/*<TableExamplePagination />*/}{/*https://www.geeksforgeeks.org/reactjs-importing-exporting/*/}\n {/*<Scroll />*/}\n </div>\n );\n}", "render() {\n console.log(`component WelcomeComponent da dc render`);\n return(\n <h1> Welcome you !</h1>\n )\n }", "function App() {\n return (\n <>\n <GlobalStyle />\n {/*<Navbar />*/}\n <Landing />\n </>\n );\n}", "function App() {\n return (\n <div className=\"App\">\n <JugatApp/>\n </div>\n );\n}", "function App() {\n\treturn (\n\t\t<div className=\"App\">\n\t\t\t<header className=\"App-header\">\n\t\t\t\t<img src={logo} className=\"App-logo\" alt=\"logo\" />\n\t\t\t\t<TestComponent url=\"https://jsonplaceholder.typicode.com/users\" />\n\t\t\t\t<p>\n\t\t\t\t\tEdit <code>src/App.js</code> and save to reload.\n\t\t\t\t</p>\n\t\t\t\t<a className=\"App-link\" href=\"https://reactjs.org\" target=\"_blank\" rel=\"noopener noreferrer\">\n\t\t\t\t\tLearn React\n\t\t\t\t</a>\n\t\t\t</header>\n\t\t</div>\n\t);\n}", "function Index() {\n return <Homepage />;\n}", "function Home() {\n return (\n <div className=\"pageContent\">\n <h2>Home</h2>\n </div>\n );\n}", "render(){\n return(\n <h1>Yet Another Knitting App is Here!</h1>\n );\n }", "function HelloReact() {\n return (\n <div className=\"container\">\n Hello React!\n {/*Another imported component*/}\n <Counter/>\n </div>\n )\n}", "function Home(props) {\n return <h1>Home</h1>;\n}", "function HomePage() {\n return (\n <div className=\"home\">\n <img className=\"home-pic\" src={require(\"../../assets/img/deshaun-home.png\")} width=\"1000px\" alt=\" Deshaun\" />\n <br>\n </br>\n <br>\n </br>\n <br>\n </br>\n <br>\n </br> <br>\n </br>\n <br>\n </br>\n <br>\n </br>\n <br>\n </br>\n <br>\n </br>\n <br>\n </br>\n <br>\n </br>\n <br>\n </br>\n <br>\n </br>\n <br>\n </br>\n {/* <MDBBtn className=\"text-align:center\" href=\"/about\" gradient=\"default\">Welcome</MDBBtn> */}\n <Button className=\"home-btn\" variant=\"default\" href=\"/about\">Welcome</Button>\n\n </div>\n )\n}", "function AdminHeader() {\n return (\n <div>\n <header className=\"admin-header\">\n <div className=\"admin-logo\">\n <img \n className=\"admin_bark_logo\"\n src=\"./images/Barktique-and-meow-logo-final-color.png\" \n />\n </div>\n </header>\n </div>\n )\n} // end AdminHeader", "function App() {\n return (\n <div>\n <Welcome name=\"Sean\" />\n <Clock />\n </div>\n );\n}", "get AppView() {\n return {\n title: 'Expenso',\n component: require('../Containers/App').default,\n leftButton: 'HAMBURGER',\n };\n }", "function Header() {\n return (\n <div>\n <h1 className=\"title\">Meet the Members of Mystery Inc.</h1>\n </div>\n );\n}", "import() {\n }", "function App() {\n return (\n <div className=\"App\">\n \n <Title/>\n {/*\n <PersonalInfo/>\n <VideoBanner/>\n \n <SplitText/>\n <LandingPage/>\n */}\n\n\n\n </div>\n );\n}", "function SeamonkeyImport() {}", "function App() {\n return (\n<div>\n\n<Homepage />\n\n</div>\n\n );\n}", "function Home() {\n\treturn (\n\t\t<div className=\"text-center\">\n\t\t\t<Header />\n\t\t\t<img src=\"/static/okane.png\" alt=\"my image\" />\n\t\t\t<p className=\"text-center\">歡迎使用匯率計算機</p>\n\t\t</div>\n\t)\n}", "icons () {\n return require('@packages/icons')\n }", "async function main () {\n const styles = buildStyles()\n const targetDir = path.join(__dirname, '../node_modules/.cache/emoji-picker-element')\n await mkdirp(targetDir)\n await writeFile(\n path.join(targetDir, 'styles.js'),\n `const styles = ${JSON.stringify(styles)}; module.exports = styles;`,\n 'utf8'\n )\n}", "render(){\n return(\n <header className=\"header\">\n <img className=\"header__logo\" alt=\"Site Logo\" src={ImageSource}/>\n <h2 className=\"header__title\">Nick Lucero • Apps • Games • Coding</h2>\n </header>\n )\n }", "function Welcome(props) {\n\treturn <h1>Hello {props.name}</h1>\n}", "function Home() {\n return (\n <>\n <Head>\n <title>LV - Home</title>\n <link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/favicon-32x32.png\" />\n <link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/favicon-16x16.png\" />\n <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"/apple-touch-icon.png\" />\n <link rel=\"manifest\" href=\"/site.webmanifest\" />\n <link rel=\"mask-icon\" href=\"/safari-pinned-tab.svg\" color=\"#5bbad5\" />\n <meta name=\"viewport\" content=\"initial-scale=1\" maximum-scale=\"1\" user-scalable=\"no\" width=\"device-width\" viewport-fit=\"cover\" />\n </Head>\n\n <Navbar />\n\n <Social />\n\n <section className=\"hero\">\n <div className=\"container\">\n <img className=\"home-img\" src=\"/web-developer.jpeg\" alt=\"home-image\" />\n <div className=\"text-wrapper home-text\">\n <h1 className=\"title\">Hello, I am Liam Volschenk</h1>\n <p className=\"description\">I am an aspiring web developer, photographer, designer, problem solver and forward thinker</p>\n\n </div>\n </div>\n </section>\n </>\n );\n}", "function App() {\n return (\n <div className=\"app\">\n <GlobalStyle /> \n <Header title=\"\" />\n <Contents />\n <Footer />\n </div>\n );\n}", "function Header() {\n\treturn (\n\t\t<header className={styles.root}>\n\t\t\t<h1 className={styles.logo} >Reacttr</h1>\n\t\t</header>\n\t\t)\n}", "function App() {\n return (\n <div className=\"App\">\n <header className=\"App-header\">\n <h2 className='App-link'>I numeri in caso siano multiply di 5 ritornerà Buzz in caso siano multipli di 3 ritornerà Fizz in caso siano multipli di 3 e 5 ritornerà FizzBuzz</h2>\n <img src={logo} className=\"App-logo\" alt=\"logo\" />\n <Mainlogic/>\n </header>\n </div>\n );\n}", "function App() {\n\n\n return (\n\n <Login>\n\n </Login>\n\n\n );\n}", "function Header() \n{ \n return <div><h3 className=\"h3-text\">iCrowdTask Web Application</h3> \n <h4 className=\"h4-text\">Home Page.</h4></div>\n}", "function App() {\r\n return (\r\n <div>\r\n <div class=\"container\">\r\n <div class=\"app\">App Component - contains Hello and Goodbye</div>\r\n <Hello name=\"React code in Script3.js\" />\r\n <Goodbye name=\"React component code in body\" />\r\n </div>\r\n </div>\r\n );\r\n}", "function Header () {\n\n return (\n \n <div className= 'headerContainer'>\n <h1 className = 'header-Title'>Dakota And Andrea's Star Wars Chat App</h1>\n </div>\n \n \n \n )\n\n}", "function App() {\n return <Main />\n // return <Content />\n}", "function Welcome(props) {\n return <h1>Hello, {props.name}</h1>;\n}", "async function core() {\n const bundle = await rollup({\n input: 'src/index.js',\n plugins: [\n nodeResolve(), // tells Rollup how to find date-fns in node_modules\n commonjs(), // converts date-fns to ES modules\n // postcss({\n // \tplugins: [],\n // \textract: true,\n // \t// minimize: isProductionEnv,\n // }),\n production && terser(), // minify, but only in production\n babel(babelConfig)\n ],\n });\n\n bundle.write({\n file: 'dist/luckysheet.umd.js',\n format: 'umd',\n name: 'luckysheet',\n sourcemap: true,\n inlineDynamicImports:true,\n\n });\n\n if(production){\n bundle.write({\n file: 'dist/luckysheet.esm.js',\n format: 'esm',\n name: 'luckysheet',\n sourcemap: true,\n inlineDynamicImports:true,\n });\n }\n\n}", "function Header() {\n\n return (\n <div className=\"header-container\">\n <div className=\"menu-button\">\n <img src={require('./Hamburger_icon.png')} alt=\"icon\" id=\"menu-button\"/>\n </div>\n <div className=\"header-text\">\n <h1>Neighbourhood Map</h1>\n </div>\n </div>\n );\n }", "render() {\n return (\n <div className=\"App\">\n <h1>My React App</h1>\n <p>This is really working</p>\n </div>\n );\n // Above jsx in return stmt gets compiled into the following and thus React import is mandatory\n // return React.createElement('div',null,'h1','My React App')\n // return React.createElement('div',{className:'App'},React.createElement('h1',null,'My React App'))\n }", "function App() {\n return (\n // This is JSX (JavaScript XML). It is very similar to HTML.\n // A difference which is immediately evident is \"class\" becomes \"className\" in JSX\n <div className=\"app\">\n <h1 id=\"main-heading\">Demo</h1>\n {/* Here the Counter component imported in Counter.jsx is being rendered */}\n {/* It can be used multiple times with different initalCount */}\n {/* We can make our components modular and reusable through props */}\n <Counter initialCount={0} />\n <hr />\n <Counter initialCount={5} />\n <hr />\n <CounterFunc initialCount={10} />\n </div>\n );\n}", "render() {\n return <p className=\"App-intro\">Content goes here</p>;\n }", "function Welcome(props) {\n return <h1>Hello, {props.name}</h1>;\n}", "function Welcome(props) {\n return <h1>Hello, {props.name}</h1>;\n}", "function Header() {\r\n return (\r\n <div className=\"App\">\r\n <header className=\"App-header\">\r\n <img src={logo} className=\"App-logo\" alt=\"logo\" />\r\n <h1>Woof Woof Barker <span role='img' aria-label=\"dog\">🐕</span></h1>\r\n </header>\r\n </div>\r\n )\r\n}", "function LogoHeaderComponent() {\n }", "function App(){\n return(<div>\n \n <Navbar/>\n <Banner/>\n \n \n </div>)\n\n}", "function App() {\n return (\n <div>\n <h1>Portfolio Tracker</h1>\n <SignUpPage />\n </div>\n );\n}", "function App() {\n return (\n <div>\n App\n </div>\n );\n}", "function App() {\n return (\n <div className=\"App container\">\n <Slider />\n <Header />\n {/* <AboutUs />\n <Popular />\n <PizzaBuilder />\n <Testimonial />\n <MobileApp />\n <BlogPosts />\n <Contacts />\n <Footer /> */}\n\n </div>\n );\n}", "function components() {\n console.log(\"Generating manager/components.py\");\n\n const json = fs.readFileSync(\n path.join(\n require.resolve(\"@stencila/components\"),\n \"..\",\n \"..\",\n \"package.json\"\n ),\n \"utf8\"\n );\n const version = JSON.parse(json).version;\n\n fs.writeFileSync(\n path.join(__dirname, \"manager\", \"components.py\"),\n `# Generated by ${path.basename(\n __filename\n )}. Commit this file, but do not edit it.\n\n# The version of @stencila/components to use\nversion = \"${version}\"\n`\n );\n}", "function AboutPage() {\n return (\n <div>\n <div className=\"component-head\">\n <h1>Technologies Used</h1>\n </div>\n <div className=\"hop-logo\">\n <HopsLogo />\n </div>\n <div className=\"container\">\n <div>\n <ul>\n <li>React</li>\n <li>Redux-Saga</li>\n <li>Email.js</li>\n <li>Moment.js</li>\n <li>Node</li>\n <li>Express</li>\n <li>Material-UI</li>\n <li>HTML</li>\n <li>CSS</li>\n </ul>\n </div>\n </div>\n </div>\n );\n}", "function App() {\n return <HelloDiv />;\n}", "function App() {\n return <div ClassName=\"App\">\n <Route exact path=\"/\" component={Home} />\n <Route path=\"/projects\" component={Projects} />\n <Route path=\"/about\" component={About} />\n </div>;\n}", "function App() {\n return (\n <>\n <Global\n styles={css`\n .foo {\n color: red;\n }\n `}\n />\n <h1 className=\"foo\" css={{ color: 'green' }}>\n Hello, world!\n </h1>\n <p>View this page with javascript enabled and disabled. The text above should be green.</p>\n </>\n );\n}", "function App() {\n return (\n // <BaiTapOanTuXi/>\n // <BaiTapDatVe />\n // <BaiTapBurger/>\n // <BaiTapToDoList/>\n <BaiTapQuanLySinhVien />\n );\n}", "function AdminHeader() {\n\n return (\n <>\n <header className=\"App-Admin-header\">\n <h1 className=\"App-Admin-title\">DNH Orders</h1>\n\n </header>\n\n \n </>\n );\n}", "function Home() {\n return (\n <div>\n <h2>Home</h2>\n </div>\n );\n}", "function Home() {\n return (\n <div>\n <h2>Home</h2>\n </div>\n );\n}", "function App() {\n return (\n <div className=\"container\">\n <Header\n image={logo}\n />\n <h1 className=\"title\">Glofox</h1>\n <p className=\"parafoP card-text text-secondary\">Es un innovador software de gestión de gimnasios. Permitiendo a las empresas de fitness retener y generar ingresos</p>\n <Carousel/>\n <hr></hr>\n <Content/>\n <Footer/>\n </div>\n )\n}", "function Home() {\n return(\n <div className=\"\">\n <Jumbotron/>\n <Navbar/>\n \n </div>\n )\n}", "render() {\n return (\n <div className=\"Hello\"><h1>Hi Class Component</h1></div>\n );\n }", "function App() {\n return (\n // <Habit />\n <h1>hello!!!</h1>\n );\n}", "render() {\n return(<h1>Hello World!!!</h1>);\n }", "function component() {\n let element = document.createElement('div');\n\n // Lodash, now imported by this script\n element.innerHTML = \"webpack 自动部署 热启动成功啦!\";\n element.classList.add(\"example\");\n return element;\n}", "function Services() {\r\n document.title = \"TRVL | Services\";\r\n return (\r\n <>\r\n {\r\n <div className=\"services\">Hola soy el contenido de Services</div>\r\n //<HeroSection />\r\n //<Cards />\r\n }\r\n </>\r\n );\r\n}", "function App() {\n return (\n <div className={css.App}>\n {//<NavBarSimple />\n }\n <NavBarForm />\n <Sidebar />\n <ContentHooksAPI />\n </div>\n );\n}", "function AppStyle() {\n return (\n <div>\n <h1>Error</h1>\n <h2>Success</h2>\n </div>\n )\n}", "function App() {\n return (\n <div>\n Code goes here\n </div>\n )\n}" ]
[ "0.6224062", "0.61821735", "0.61363786", "0.59900844", "0.5947303", "0.59075284", "0.5870664", "0.58633506", "0.5859991", "0.58150065", "0.58050996", "0.57918704", "0.57840955", "0.5723755", "0.5713401", "0.57089853", "0.57041204", "0.56953216", "0.5669719", "0.56651413", "0.56505454", "0.56296515", "0.56177217", "0.5607504", "0.5606292", "0.55833703", "0.5575424", "0.55569744", "0.5545296", "0.55419964", "0.5540337", "0.5520096", "0.54889816", "0.54834646", "0.54773134", "0.5477263", "0.54764026", "0.5473022", "0.5459694", "0.5459208", "0.54496855", "0.5446358", "0.5423642", "0.54152685", "0.5406035", "0.5404672", "0.53982115", "0.53973895", "0.53964067", "0.5395061", "0.53941804", "0.5393786", "0.5393498", "0.5383499", "0.53825796", "0.53804475", "0.53727627", "0.53680146", "0.5354597", "0.53502417", "0.53384817", "0.5334729", "0.5334583", "0.5332915", "0.53313947", "0.53294027", "0.5319033", "0.53183514", "0.53159064", "0.53124017", "0.5311763", "0.53092206", "0.5308864", "0.53064984", "0.52961314", "0.52961314", "0.5293961", "0.5289931", "0.5288444", "0.52869636", "0.52798444", "0.52790314", "0.52719945", "0.5268481", "0.5268354", "0.5263747", "0.52613723", "0.5258768", "0.5256795", "0.5255985", "0.5255985", "0.5249729", "0.524803", "0.5247334", "0.52447355", "0.5243713", "0.523946", "0.523259", "0.5229953", "0.5226071", "0.52152675" ]
0.0
-1
========================== Route Handlers ============================
function getLocation (request, response) { const queryFromInput = request.query.city; client.query(`SELECT * FROM locations WHERE search_query = '${queryFromInput}'`) .then (theCityData => { if(theCityData.rowCount === 1){ console.log('Retrieved result from db'); response.send(theCityData.rows[0]); } else { const dynamicURL = `https://us1.locationiq.com/v1/search.php?key=${GEOCODE_API_KEY}&q=${queryFromInput}&format=json`; superagent.get(dynamicURL) .then(resultData => { const resultArrayFromBody = resultData.body; const insertString = 'INSERT INTO locations (search_query, formatted_query, latitude, longitude) VALUES ($1, $2, $3, $4)'; const valueArray = [queryFromInput, resultArrayFromBody[0].display_name, resultArrayFromBody[0].lat,resultArrayFromBody[0].lon]; client.query(insertString, valueArray) .then( () => { console.log('Added location to db'); response.send(new Location(resultArrayFromBody, queryFromInput)); }); }); } }) .catch(error => { console.log(error); response.status(500).send(error.message); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_handleRoute(e) {\n this.log.logApi('_handleRoute', e);\n var _hash = location.hash.replace(/^#\\/|\\/$/gi, '/');\n var parser = document.createElement('a');\n parser.href = _hash;\n var _routeObj = null;\n var res = {};\n var req = {\n hostname: parser.hostname,\n host: parser.host,\n port: parser.port,\n protocol: parser.protocol,\n pathname: parser.pathname,\n hash: parser.hash,\n url: parser.href,\n query: parser.search,\n params: {}, //needs to be routes named params keys and value the values\n data: {} //Needs to be any other data sent along\n };\n\n req.query = this._getUrlQuery(parser.href);\n\n //Loop each regex route and match against hash, if match, invoke route handler function.\n for (var i = 0; i < this.routesRegex.length; i++) {\n _routeObj = this.routesRegex[i];\n\n //Test if route matches registered route\n if (_routeObj.regexp.test(_hash)) {\n _routeObj.current = _hash;\n\n _routeObj = this._setRouteParams(_routeObj);\n\n //setup request params / and data\n req.params = _routeObj.params;\n\n //Log\n this.log.logApi(_hash, _routeObj);\n /*\n PubSub.emit('route:success', {\n _routeObj, req, res\n });\n PubSub.emit('route:change', {\n _routeObj, req, res\n });\n */\n //Execute route handler\n this.execute(_routeObj.success, [req, res], _hash);\n } else {\n\n this.execute(_routeObj.error, [req, res], _hash);\n }\n }\n }", "async handleRoute (req, res) {\n // Check for handlers for the matching HTTP method and path\n const handlers = this.routes[req.method][req.url]\n if (handlers) { // If there are assigned handlers, run them\n await this.callHandlers(handlers, req, res)\n } else {\n // Return 404 error if no matching route handlers are found\n res.error(`Route ${req.method} ${req.url} Not Found`, 404)\n }\n }", "doRoute() {\n let routename = 'HTTP:' + this.request.method + ':' + this.url.pathname;\n this.run(routename, this.restnio.routes, \n Parser.parseFullHttpParams, this.request, this.url);\n }", "static registerLegacyRouteHandler() {}", "async handle(ctx) {\n this.findRoute(ctx);\n await this.invokeHandler(ctx);\n }", "on(...pageRoutes) {\n //increment the number of routes registered\n this.numRegistered += 1;\n for (const {route, handler} of pageRoutes) {\n if (Array.isArray(route)) {\n for (const path of route) {\n const [regPath, params] = getRegexFromRouteString(path);\n this.routes.set(path, {pathRoute: regPath, handler: handler, params: params});\n }\n } else {\n const [regPath, params] = getRegexFromRouteString(route);\n this.routes.set(route, {pathRoute: regPath, handler: handler, params: params})\n }\n }\n //route the current url once we've registed all the handlers\n if (this.numRegistered === this.numHandlers) {\n this.match(window.location.pathname);\n }\n }", "on(...pageRoutes) {\n //increment the number of routes registered\n this.numRegistered += 1;\n for (const {route, handler} of pageRoutes) {\n if (Array.isArray(route)) {\n for (const path of route) {\n const [regPath, params] = getRegexFromRouteString(path);\n this.routes.set(path, {pathRoute: regPath, handler: handler, params: params});\n }\n } else {\n const [regPath, params] = getRegexFromRouteString(route);\n this.routes.set(route, {pathRoute: regPath, handler: handler, params: params})\n }\n }\n //route the current url once we've registed all the handlers\n if (this.numRegistered === this.numRoutes) {\n this.match(window.location.pathname);\n }\n }", "function route() {\n this.method = this.req.method.toLowerCase();\n var n = w.map[this.method];\n if (!n) {\n this.reply4xx(404, \"no route for method: \"+this.req.method);\n this.end();\n return\n } else {\n this.url = w.dep.url.parse(this.req.url, true);\n this.query = this.url.query || {};\n this.context = {};\n for (var e in this.query) { this.context[e] = this.query[e] }\n this.context._work = this;\n this.context._js = [];\n this.context._css = [];\n \n var p = this.url.pathname.split('/');\n console.log(this.req.url, \"route to ===============> \" + this.req.method.toUpperCase(), p);\n \n for (var i = 1; i < p.length; ++i) {\n var segment = p[i];\n if (n.branches[segment]) { n = n.branches[segment]; continue };\n if (n.branches[':']) { //varname\n this.context[n.varname] = segment;\n console.log(\"//varname: \" + n.varname + \" = \" + this.context[n.varname]);\n n = n.branches[':'];\n continue\n };\n if (n.branches['*']) { //wildcard\n this.context['_location'] = p.slice(i).join('/');\n console.log(\"//wildcard: \" + this.context['_location']);\n n = n.branches['*'];\n break\n };\n this.reply4xx(404, \"no route to: \"+this.req.method+' '+this.req.url);\n this.end();\n return\n };\n };\n \n if (n.handler) {\n this.mapnode = n;\n n.handler.call(this);\n this.end();\n return\n }\n\n this.reply5xx(500, \"no handler found for: \"+this.req.method+' '+this.req.url);\n this.end();\n return\n}", "function route(pathname,response,postData){\n if (typeof requestHandler.handle[pathname] === 'function') {\n\n requestHandler.handle[pathname](response,postData);\n response.end();\n }\n else {\n console.log(\"No request handler found for \" +pathname);\n response.writeHead(404, {\"Content-Type\": \"text/plain\"});\n response.write(\"404 Not found\");\n\n }\n}", "function homeRoute(request, response){\n //if url == \"/\" && GET\n console.log(\"weee3eeeeeeeeeesdfgaaauifyueeeeeerrreeeeeeeeee still reading stuff\");\n //if url == \"/\" && POST\n //redirect to /:username\n}", "routingHandler(event) {\r\n this.base.routingEventListener(event);\r\n this.clickHandler();\r\n }", "function handler(url, routes) {\n if (typeof routes == 'function' || !routes){\n\treturn routes;\n } \n return handler(url.slice(1), routes[url[0]]);\n}", "routingHandler(event) {\r\n this.base.routingEventListener(event);\r\n }", "routingHandler(event) {\r\n this.base.routingEventListener(event);\r\n }", "routingHandler(event) {\r\n this.base.routingEventListener(event);\r\n }", "routingHandler(event) {\r\n this.base.routingEventListener(event);\r\n }", "routingHandler(event) {\r\n this.base.routingEventListener(event);\r\n }", "routingHandler(event) {\r\n this.base.routingEventListener(event);\r\n }", "function set_routes() {\n\n // Check your current user and roles\n app.get( '/status/:id', function( request, response ) {\n acl.userRoles( request.params.id || false, function( error, roles ){\n response.json( {'User': request.user ,\"Roles\": roles });\n });\n });\n\n // Only for users and higher\n app.all( '/secret', [ acl.middleware( 1, get_user_id) ],function( request, response ) {\n\n response.send( 'Welcome Sir!' +request.params.id);\n }\n );\n\tapp.use('/user',require('./routers/userR.js'));\n app.use('/event',require('./routers/eventR.js'));\n //accept error\n app.use(acl.middleware.errorHandler('json')); \n \n}", "routingHandler(event) {\n this.base.routingEventListener(event);\n }", "routingHandler(event) {\n this.base.routingEventListener(event);\n }", "routingHandler(event) {\n this.base.routingEventListener(event);\n }", "routingHandler(event) {\n this.base.routingEventListener(event);\n }", "routingHandler(event) {\n this.base.routingEventListener(event);\n }", "routingHandler(event) {\n this.base.routingEventListener(event);\n }", "routingHandler(event) {\n this.base.routingEventListener(event);\n }", "setupRoute(route) {\n let controller = this.controllers[route.controller];\n let action = controller[route.action] || this.defaultAction;\n let authMethod = (req, res, next) => {\n return next();\n };\n if (route.authentication && route.authentication.controller && route.authentication.action) {\n authMethod = this.controllers[route.authentication.controller][route.authentication.action]();\n }\n this.router[route.method](route.url, authMethod, (req, res) => {\n let values = route.method === 'get' ? req.query : req.body;\n const validator = new Validator_1.default(route.params, Object.assign({}, values, req.files));\n validator.addCustomTypes(this.customTypes);\n try {\n if (validator.isValid() === false) {\n const errorMessage = `This request failed validation, please check the documentation for ${route.method.toUpperCase()} ${route.url}`;\n const err = new ErrorResponse_1.ErrorResponse({ req, res, errorMessage, errors: validator.getErrors(), status: 400 });\n return err.send();\n }\n }\n catch (e) {\n const errorMessage = e.message;\n const errors = [\n `Invalid route definition for ${route.method.toUpperCase()} ${route.url}`\n ];\n const err = new ErrorResponse_1.ErrorResponse({ req, res, errorMessage, errors, status: 501 });\n return err.send();\n }\n values = Object.assign(validator.values, req.params);\n let routeHandler;\n // streaming route\n if (route.streaming === true) {\n routeHandler = new StreamingRouteHandler_1.StreamingRouteHandler(values, action, req, res);\n }\n else {\n routeHandler = new DefaultRouteHandler_1.DefaultRouteHandler(values, action, req, res);\n }\n // handle route\n routeHandler.handle();\n });\n }", "function RouteHandler(method = '*', path = '*', callback = (request, response) => {}) {\n this.route = new Route(method, path);\n this.requestHandler = new RequestHandler(callback);\n}", "bindRouteHandler() {\n this.app.singleton('router.handler', _Handler.default);\n }", "bindRouteHandler() {\n\t\tthis.app.singleton('router.handler', Handler);\n\t}", "match(route) {\n //match route against dictionary of defined paths to their relevant attributes\n for (let [path, {pathRoute, handler, params}] of this.routes) {\n const match = pathRoute.exec(route);\n //each route will be associated with a handler\n //this handler will handle all of the rendering associated with a new change\n if (match !== null) {\n //remove the first / from the route\n //loop through values and add each value with its associated parameter\n const routeParams = match.slice(1).\n reduce((allParams, value, index) => {\n allParams[params[index]] = value;\n return allParams;\n }, {});\n //split parameters using the ?varName=varVal \n this.currentPath = path;\n //check if we have any query parameters to parse\n if (window.location.search) {\n this.getQueryParameters(window.location.search, routeParams);\n }\n handler(route, routeParams);\n //we don't want to execute more than route once we've matched one\n //if it can match multiple ones so we break\n break;\n }\n\n }\n }", "_updateRouter(route) {\n\n /*\n (R.intersection(getMetods(route), verbs)).forEach(routeVerb => {\n route.log(`found route handler for '${routeVerb}' method`);\n route.router[routeVerb]('/', route[routeVerb].bind(route));\n });\n */\n\n this._getMethods(route).forEach(method => {\n let verb = this._startsWithVerb(method);\n if (verb) {\n let spec = this._routeify(method);\n if (spec) {\n route.log(`found route handler for '${spec.verb}' method`);\n route.router[spec.verb](spec.route, route[method].bind(route));\n }\n }\n });\n }", "function doRoute(req, context) {\n var uri = url_parse(req.url);\n var path = uri.pathname;\n for (var routeName in routes) {\n var route = routes[routeName];\n if (req.method === route.method) {\n var match = path.match(route.pattern);\n if (match && match[0].length > 0) {\n // TODO named properties params in response como query string\n context.response.matches = match;\n return route;\n }\n }\n }\n \n return false;\n }", "match(route) {\n //match route against dictionary of defined paths to their relevant attributes\n for (let [path, {pathRoute, handler, params}] of this.routes) {\n const match = pathRoute.exec(route);\n //each route will be associated with a handler\n //this handler will handle all of the rendering associated with a new change\n if (match !== null) {\n //remove the first / from the route\n //loop through values and add each value with its associated parameter\n const routeParams = match.slice(1).\n reduce((allParams, value, index) => {\n allParams[params[index]] = value;\n return allParams;\n }, {});\n this.currentPath = path;\n //check if we have any query parameters to parse\n if (window.location.search) {\n this.getQueryParameters(window.location.search, routeParams);\n }\n handler(route, routeParams);\n //we don't want to execute more than route once we've matched one\n //if it can match multiple ones so we break\n break;\n }\n\n }\n }", "function routeHook(obj, args, router) {\r\n\t\tvar method = args[0].toUpperCase();\r\n\t\tvar path = args[1];\r\n\t\tvar route;\r\n\r\n\t\t// start request\r\n\t\tproxy.callback(args, -1, function(obj, args) {\r\n\t\t\tif(nf.paused) return;\r\n\r\n\t\t\tvar req = args[0];\r\n\t\t\tvar res = args[1];\r\n\t\t\tvar time = samples.time(\"Express Server\", path, true);\r\n\t\t\t\r\n\t\t\t// finish request\r\n\t\t\tproxy.after(res, 'end', function(obj, args) {\r\n\t\t\t\tif(!time.done()) return;\r\n\r\n\t\t\t\troute = route || (method + ' ' + (res.app.route === '/' ? '' : res.app.route) + path);\r\n\t\t\t\ttopFunctions.add('expressCalls', route, time.ms, time.cputime, req.tiers, req.graph);\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t}", "onRoute (info) {\n openApi.addRoute(info, {\n basePath: env.REST_API_PREFIX\n })\n }", "route(req) {\n // find first matching route\n const route = this.routes.find(r => {\n const url = new URL(req.url)\n return r.method === req.method.toLowerCase() && \n url.pathname.match(r.pathRegexp)\n })\n\n // run this route's handler\n if (route) {\n return route.handler(req);\n }\n\n // otherwise serve 404\n return NotFoundHandler(req)\n }", "function updateRoute() {\n\n}", "function route(handle, pathname, response, request) {\n// console.log(\"About to route a request for \" + pathname);\n\n // urls with parameters - strip params for routing purposes\n var paramStart = pathname.indexOf(\"&\");\n if(paramStart>1){\n pathname = pathname.substring(0,paramStart);\n }\n if (typeof handle[pathname] === 'function') {\n handle[pathname](response, request);\n } else {\n // standard file handlers\n handle[\"*file*\"](response, request);\n }\n}", "handle(...args) {\n if (args.length < 3) {\n return new Response('internal server error', { status: 500 })\n }\n\n const method = args.shift();\n const pathRegexp = args.shift();\n let handler = args.pop();\n\n this.routes.push({\n method,\n pathRegexp,\n handler\n })\n\n return this\n }", "async intercept(_ctx, _next) {\n let routeData = { match: false };\n switch (_ctx.request.method.toLowerCase()) {\n case 'head': routeData = this._travel('head', _ctx); break;\n case 'get': routeData = this._travel('get', _ctx); break;\n case 'post': routeData = this._travel('post', _ctx); break;\n case 'put': routeData = this._travel('put', _ctx); break;\n case 'patch': routeData = this._travel('patch', _ctx); break;\n case 'delete': routeData = this._travel('delete', _ctx); break;\n }\n\n if (routeData.match) {\n _ctx.request.route = routeData;\n await routeData.match(_ctx, _next, routeData);\n }\n await _next();\n }", "defineRoutes() {\n super.defineRoutes();\n this._router.post(this._resourceName + '/login', (req, res, next) => this.login(req, res, next));\n }", "function AboutRoute(db) {\n //var ctrl = new AboutCtrl(db);\n \n return [\n {\n method: 'GET',\n path: '/',\n handler: (request, h) => {\n \n return 'Hello, world!';\n }\n },\n {\n method: 'GET',\n path: '/{name}',\n handler: (request, h) => {\n \n return 'Hello, ' + encodeURIComponent(request.params.name) + '!';\n }\n }\n ];\n}", "function route(handle, pathname, response, postData) {\n console.log(\"The route for path: %s, data: %s\", pathname, postData);\n if ( pathname == '/') {\n response.write(\"The index pages is blank.\");\n response.end();\n return;\n }else if ( pathname == '/ws') {\n var wsclient = response;\n var message = postData;\n wsclient.send(\"I have got your message whose length is \" + postData.length);\n // Handle message\n handleWSMsg(wsclient, message);\n return;\n }else if ( pathname == '/callapi' ) {\n //This is for remote call api in internet browser.\n if ( postData === null || postData.length === 0 ){\n response.writeHead(404, {'Content-Type': 'text/plain'});\n response.write(\"Invalid callapi\");\n response.end();\n return;\n }\n var postDataJSON=JSON.parse(postData);\n var args=postDataJSON.args;\n var apiPathArr=postDataJSON.api.split(\".\");\n var sendresponse = function(){\n response.writeHead(200, {\"Content-Type\": mimeTypes[\"js\"]});\n response.write(JSON.stringify(Array.prototype.slice.call(arguments)));\n response.end();\n }\n args.unshift(sendresponse);\n handle[apiPathArr[0]][apiPathArr[1]].apply(null, args);\n return;\n }else if ( pathname.lastIndexOf(\"/callapp/\", 0) === 0) {\n // This is for remote open app in internet browser.\n // request url: /callapp/ + appID + / + request file name\n var url = pathname.replace(/^\\//, '').split('/'),\n sAppID = url[1],\n sFilename = path.join.apply(this, url.slice(2));\n // var sAppName=pathname.substring(9, pathname.indexOf('/', 10));\n // var sFilename=pathname.substring(9 + sAppName.length + 1, pathname.length);\n /* var runapp=null; */\n // var app;\n // for(var i = 0; i < config.AppList.length; i++) {\n // app = config.AppList[i];\n // if (app.name == sAppName) {\n // runapp=app;\n // break;\n // }\n /* } */\n\n var runapp = appManager.getRegistedInfo(sAppID),\n rootPath = (runapp.local ? '' : config.APPBASEPATH);\n if(runapp === null) {\n console.log(\"Error no app \" + sAppID);\n response.writeHead(404, {\n 'Content-Type': 'text/plain'\n });\n response.write(\"This request URL \" + pathname + \" was not found on this server.\");\n response.end();\n return;\n }\n\n if(sFilename === \"index.html\") {\n getRealFile(path.join(rootPath, runapp.path, sFilename), response);\n } else if(sFilename === \"lib/api.js\") {\n getRealFile(path.join(rootPath, runapp.path, \"lib/api_remote.js\"), response);\n } else if(sFilename.lastIndexOf(\"lib/api/\", 0) === 0 \n && sFilename.indexOf(\".js\", sFilename.length - 3) !== -1) {\n var modulename = sFilename.substring(8, sFilename.length - 3);\n getRemoteAPIFile(handle, modulename, response);\n } else {\n getRealFile(path.join(rootPath, runapp.path, sFilename), response);\n }\n return;\n } else {\n //Use api_remote.js for /lib/api.js\n var realPath;\n if (pathname == \"/lib/api.js\") {\n pathname = \"./lib/api_remote.js\";\n getRealFile(pathname, response);\n return;\n }else if (pathname.lastIndexOf(\"/lib/api/\", 0) === 0 && pathname.indexOf(\".js\", pathname.length - 3) !== -1) {\n var modulename = pathname.substring(9, pathname.length - 3);\n getRemoteAPIFile(handle, modulename, response);\n return;\n }else {\n getRealFile(pathname, response);\n return;\n }//end of /lib/api/***.js\n }//end of if callapi callapp and else\n}", "routes() {\n let router = express.Router();\n //palceholder route handler\n router.get('/', (req, res, next) => {\n res.json({\n message: 'Hello World!'\n });\n });\n this.express.use('/', router);\n }", "static requestHandler() {\n\n var driver = config.Driver.make(this);\n\n driver.parseRoutes();\n return driver.requestHandler();\n }", "function handleRoute(e) {\n\te.preventDefault();\n\tlet _hash = location.hash;\n\t// Check: If user is not sign im, than cannot access other pages, and user is redirected on HomePage to sign in\n\tif (!localStorage.getItem('userName') && _hash != \"\") {\n\t\tlocation.hash = \"\";\n\t};\n\t// possible Routs options (empty route for HomePage and #cardslist for CardsPage) and non-valid route redirects on empty Route back on HomePage)\n\tswitch (_hash) {\n\t\tcase '':\n\t\t\thomePage.style.display = 'block';\n\t\t\tcardsPage.style.display = 'none';\n\t\t\tbtnToTop.style.display = 'none';\n\t\t\tbreak;\n\t\tcase '#cardslist':\n\t\t\thomePage.style.display = 'none';\n\t\t\tcardsPage.style.display = 'block';\n\t\t\twelcomeMsg.innerText = `Hello, ${localStorage.getItem('userName')}`;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tlocation.hash = '';\n\t\t\tbreak;\n\t}\n\t// invoke fetching data on page load and hashchange, only if data array is empty (no data fetched)\n\tif (dataArr.length === 0) {\n\t\tfetchData();\n\t};\n\tfetchTypes();\n}", "function onRequest(request, response) {\n\tif (request.method !== \"GET\") {\n\t\tconsole.log(\"!Not a GET!\");\n\t\thandleBadRequest(response, 404); // *could* do a 405 if we then sent the 'Allow' header. meh.\n\t\treturn;\n\t\t}\n\trouter(request, response);\n\tconsole.log(\"Request routed\");\n\t}", "function route() {\n\t\tvar o = status(); //get current hash object.\n\t\tif (o) {\n\t\t\t_callControllerFromObj(o.id, o.params);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "constructor(numHandlers = 0) {\n this.routes = new Map(); \n //set the pathname of the current route\n this.currentPath = window.location.pathname;\n this.options = {\n context: window,\n startListening: true\n }\n //corresponds to the number of HANDLERS you register, note this is NOT no. of routes since you can have one handler\n //for several routes\n this.numHandlers = numHandlers;\n this.numRegistered = 0;\n this.matchHelper = () => {\n return this.match(window.location.pathname);\n }\n //used to detect when URL changes and execute a handler accordingly\n window.addEventListener('popstate', this.matchHelper); \n }", "get (path, ...handlers) { this.routes.GET[path] = handlers }", "function checkRoute() {\n\n var path = getPath(),\n\n args = path.split('/');\n\n INFO.route = SESSION.route = path;\n\n if ( args.length < 1 ) return;\n\n // TODO: 0.7.0 -> customRoutes\n // if ( getKeys( CUSTOM_PATTERNS ).length ) extractRoute();\n\n matchRoute( args );\n}", "addGetRoute(route, ...handlers) {\n this.addRoute('get', route, ...handlers);\n }", "addPostRoute(route, ...handlers) {\n this.addRoute('post', route, ...handlers);\n }", "function route() { // main loop!\n\tlet current = getCurrent();\n\n\tif ( current !== hashRoute ){\n\t\thashRoute = current;\n\t\trenderNav(); // render proper nav for any page change per user, one line to handle ALL requirements.\n let [i, idStr] = hashRoute.split(\"/\");\n\t\tif ( hashRoute == \"#home\" ){\n home();\n\t\t} else if ( hashRoute == \"#register\" ){\n\t\t\tregister();\n\t\t} else if ( hashRoute == \"#logout\" ){\n logout();\n\t\t} else if ( hashRoute.includes(\"recepie\") ){\n\t\t\trecepieInfo( idStr );\n\t\t} else if ( hashRoute.includes(\"edit\") ){\n\t\t\trecepieEdit( idStr );\n\t\t} else if ( hashRoute.includes(\"archive\") ){\n\t\t\tdeleteRecepie( idStr );\n\t\t} else if ( hashRoute.includes(\"like\") ){\n\t\t\tlikeRecepie( idStr );\n } else if ( hashRoute == \"#share\" ){\n\t\t\trecepieShare();\n\t\t} else if ( // !user || \n // !userObj ||\n // window.location.hash == \"\" ||\n hashRoute == \"#login\"\n ){\n login();\n\t\t} else if( hashRoute == \"#makeFood\" ){\n makeFood(); // for testing\n }\n\t}\n\tsetTimeout( route, 150 );\n}", "function homeRouteHandler(request, response) {\n response.status(200).send('Welcome to City Explorer App');\n}", "function _processRoute(siteDesc, prefix, options) {\n\t options = options || {};\n\t //if (siteDesc.roles !== undefined && siteDesc.url !== undefined)\n\t //console.log('route', siteDesc.url, 'prefix', prefix);\n\n\t if (userHelper.hasRole(siteDesc.roles)) {\n\t var route = {\n\t roles: siteDesc.roles,\n\t name: prefix,\n\t route: siteDesc.url,\n\t regex: routeToRegExp(siteDesc.url),\n\t requiredParams: siteDesc.requiredParams\n\t };\n\t //Call the Backbone.history.handlers....\n\t //console.log('*****************');\n\t //console.log('ROute name: ',route.route);\n\t //console.log('Route handler name : ', findRouteName(route.route.substring(1)));\n\t routes[findRouteName(route.route.substring(1))] = route;\n\t if (options.isInSiteStructure) {\n\t siteStructure[prefix] = route;\n\t }\n\t }\n\t}", "function handler(req, res) {\n // for now we just do render statics\n // this.content will define either json or a db index to query\n console.log(\"Path Context: \" + req.path);\n console.log(this.view);\n console.log(this.content);\n // res.render(this.view, {content: this.content, template: config.template, title: config.siteTitle, nav: this.global_navigation, path: this.optional_path || this.path});\n res.render(this.view, {content: this.content, template: config.template, title: config.siteTitle, nav: this.global_navigation, path: this.path, optionalPath: this.optional_path});\n}", "function warehouse_handler(req, res){\n var hit = false;\n var url = req.url;\n for(var i=0; i<routes.length; i++){\n var warehouse_route = routes[i];\n if(url.indexOf(warehouse_route)==0){\n hit = handlers[warehouse_route];\n break;\n }\n }\n\n\n /*\n \n RUN WAREHOUSE\n \n */\n if(hit){\n process.nextTick(function(){\n hit(req, function(error, answer){\n process.nextTick(function(){\n res(error, answer);\n })\n });\n })\n }\n else{\n res('404:warehouse route not found - ' + req.url)\n }\n }", "viewRoute() {\n\n this.router.use(auth.isLoggedIn());\n \n this.router.get('/signup', signup);\n this.router.get('/login', login);\n this.router.get('/forgot-password', forgotPassword);\n this.router.get('/reset-password', resetPassword);\n this.router.get('/forgot-password/success', forgotPasswordSuccess);\n this.router.get('/team', team);\n this.router.get('/volunteer', volunteer);\n this.router.get('/', home);\n this.router.get('/about-us', about);\n this.router.post('/', (req, res, next) => (req.page='home', next()), home);\n\n \n this.router.get(\n '/donor',\n auth.authenticateApp(),\n auth.authorizeApp('donor'),\n (req, res, next) => res.redirect('/donor/dashboard')\n );\n \n this.router\n .get(\n '/donor/dashboard',\n auth.authenticateApp(),\n auth.authorizeApp('donor'),\n (req, res, next) => ((req.page = 'dashboard'), next()),\n donorDashboard\n );\n \n this.router\n .get(\n '/donor/donations',\n auth.authenticateApp(),\n auth.authorizeApp('donor'),\n (req, res, next) => ((req.page = 'donations'), next()),\n donorDashboard\n );\n \n this.router\n .get(\n '/donor/donations/verify',\n auth.authenticateApp(),\n auth.authorizeApp('donor'),\n verifyMonetaryDonation\n )\n \n return this.router;\n}", "getRouteHandler (handler) {\n return `${handler.controllerName}.${handler.handlerName}`\n }", "function route(pathname, response) {\n utils.log(\"About to route a request for '\" + utils.getFileName(pathname) + \"'\");\n // check whether a request handler for the given pathname exists\n if (typeof variables.handle[pathname] === 'function') {\n utils.log(\"Delivering a handle\");\n variables.handle[pathname](response);\n // check whether a file is requested\n } else if (variables.mimetypes[utils.getSuffix(pathname)] != undefined) {\n utils.log(\"Delivering a static file\");\n variables.handle[\"file\"](response, utils.getFileName(pathname))\n } else {\n utils.log(\"No request handler found for \" + pathname);\n variables.handle[\"error404\"](response);\n }\n}", "function route(req, res) {\n var req_obj = {\n request: req,\n response: res,\n url: url.parse(req.url, true),\n get_arguments: {},\n url_arguments: []\n }\n\n req_obj.get_arguments = req_obj.url.query;\n var path = req_obj.url.pathname;\n\n for (var i in ROUTES) {\n var route = ROUTES[i];\n if ('url' in route && route.url == path) {\n return handle_reponse(res, route.callback(req_obj));\n } else if ('pattern' in route && route.pattern.test(path)) {\n req_obj.url_arguments = route.pattern.exec(path);\n return handle_reponse(res, route.callback(req_obj));\n }\n }\n send_response_string(res, 404, \"404/Not found.\");\n}", "function processRoutes()\n {\n if(!app.routes){\n Ext.global.console.warn(\"No routes were found. Consider defining routes object in your Ext.application definition.\");\n return;\n }\n \n Ext.iterate(app.routes, function(route, value)\n {\n value = value.split('#');\n route = removeSlash(route, true);\n \n routes.push({\n controller : Ext.String.capitalize(value[0]),\n action : value[1],\n sections : route.split('/')\n });\n });\n }", "get(...args) {\n this.route('get', ...args);\n }", "function handleRequest(req, res) {\n\ttry {\n\t\tconsole.log(req.url);\n\t\tdispatcher.dispatch(req, res);\n\t} catch(err) {\n\t\tconsole.log(err);\n\t}\n}", "init(): void {\n this.router.post('/progress/:taskUUID/:progress', this.dispatchProgress);\n this.router.post('/message/:taskUUID', this.dispatchMessages);\n this.router.post('/prompt/:taskUUID/:type', this.dispatchWithResponsePrompt);\n this.router.post('/manageTasks/:taskUUID', this.dispatchManageTasks);\n }", "init() {\n this.router.get(this.path, this.process);\n }", "function handle (route, args, i) {\n var params, match = route.uri;\n var uri = args//.req.url;\n uri = uri.replace(leadingTrailingSlash, '');\n\n if (!match.test(uri)) return false;\n params = getParams(match, uri);\n route.cb.call(route.ctx, params);\n if (route.once && i !== void 0) routes.splice(i, 1);\n return true;\n}", "function apiHandler(req, reply) {\n\n var rb = new RepresentationBuilder(settings.relsUrl);\n var resource = rb.create({}, req.url);\n\n // grab the routing table and iterate\n var routes = req.server.table();\n for (var i = 0; i < routes.length; i++) {\n var route = routes[i];\n\n // :\\\n var halConfig = route.settings.app && route.settings.app.hal;\n\n if (halConfig && halConfig.apiRel) {\n var rel = halConfig.apiRel;\n var href = routes[i].path;\n\n // grab query options\n if (halConfig.query) {\n href += halConfig.query;\n }\n\n // check if link is templated\n var link = new hal.Link(rb.resolve(rel), href);\n if (/{.*}/.test(href)) {\n link.templated = true;\n }\n\n // todo process validations for query parameters\n resource.link(link);\n }\n }\n\n // handle any curies\n rb.addCuries(resource);\n reply(resource).type('application/hal+json');\n }", "function router() { // private function\n\n var path = location.hash; \n console.log('path is ' + path);\n // prints something like /home\n\n // Use the url like an index (JS associative array notation) to find the desired\n // component (function) to run. The component will place content in the content\n // area. If a link is clicked for which a route was never set, give error message.\n if (!routes[path]) {\n document.getElementById(contentId).innerHTML = \"<p>Error: unknown link '\" + path +\n \"' never added to the routing table.</p>\";\n } else {\n routes[path](contentId);\n }\n }", "function add_route(path, handler, verb) {\n\tverb = verb || 'get';\n\tthis.server[verb].call(this.server, path, this.create_route(handler));\n}", "route() {\n this.router\n .route('/:id/accounts')\n .get(validateToken, verifyIsClient, this.userController.getAccounts)\n .post(\n validateToken,\n verifyIsClient,\n createAccountValidator,\n validate,\n this.userController.createAccount,\n );\n\n this.router\n .route('/:id/accounts/:accountNumber/transactions')\n .get(validateToken, verifyIsClient, this.userController.accountHistory);\n\n this.router\n .route('/:id/transactions/:transId')\n .get(validateToken, verifyIsClient, this.userController.specificTranHist);\n\n this.router\n .route('/:id/accounts/:accountNumber')\n .get(validateToken, verifyIsClient, this.userController.specAcctDetails);\n\n this.router\n .route('/:id/confirmEmail/:token')\n .get(\n setHeadersparams2,\n validateToken,\n verifyIsClient,\n this.userController.confirmEmail,\n );\n\n this.router\n .route('/:id/changePassword')\n .patch(\n validateToken,\n verifyIsClient,\n changePasswordValidator,\n validate,\n this.userController.changePassword,\n );\n\n this.router\n .route('/:id/transactions/:accountNumber/transfer')\n .post(\n validateToken,\n verifyIsClient,\n transferFundValidator,\n validate,\n this.userController.transferFunds,\n );\n\n this.router\n .route('/:id/transactions/:accountNumber/airtime')\n .post(\n validateToken,\n verifyIsClient,\n airtimeValidator,\n validate,\n this.userController.buyAirtime,\n this.staffController.debitAccount,\n );\n\n this.router\n .route('/:id/upload')\n .post(upload.single('passport'), this.userController.uploadPassport);\n\n return this.router;\n }", "function endpointHandler(req, res) {\n\n // Extract stuff we're interested in from the POST.\n const refererQueryParams = utils.extractQueryParams(req.headers['referer']);\n // const userLogin = req.body['custom_canvas_user_loginid'];\n // const assignmentId = refererQueryParams['assignment'];\n\n // Secret path for debugging that shows us what is getting passed to the endpoint\n // https://ourdomain.instructure.com/accounts/1/external_tools/67839876483?display=borderless&assignment=abcxyz&route=showpost\n if (refererQueryParams['route'] === 'showpost') {\n postParamsHandler(req, res); \n } else if (isValidRequest('POST', process.env.CST_LTI_LAUNCH_URL, req.body)) {\n // Special redirect handling for particular user first names\n var firstName = req.body['custom_person_name_given'];\n if (['Candidate', 'Teacher'].includes(firstName)) {\n termRedirectHandler(req, res, '989');\n } else { // Normal redirect handling']\n redirectHandler(req, res);\n }\n } else {\n res.send('OAuth post not authenticated');\n }\n}", "initRoutes(app, ctx) {\n app.get(\"/register\", async (req, res, ctx) => {\n res.send(\n await ctx.call(\"webhooks.register\", {\n targetUrl: ctx.params.targetUrl,\n })\n );\n });\n app.get(\"/list\", async (req, res, ctx) => {\n res.send(await ctx.call(\"webhooks.list\"));\n });\n app.get(\"/update\", async (req, res, ctx) => {\n res.send(await ctx.call(\"webhooks.update\", { id: ctx.params.id }));\n });\n app.get(\"/delete\", async (req, res, ctx) => {\n res.send(\n await ctx.call(\"webhooks.delete\", {\n id: ctx.params.id,\n targetUrl: ctx.params.targetUrl,\n })\n );\n });\n app.get(\"/ip\", async (req, res, ctx) => {\n res.send(\n await ctx.call(\"webhooks.trigger\", {\n ip:\n req.headers[\"x-forwarded-for\"] ||\n req.socket.remoteAddress ||\n null,\n })\n );\n });\n // debug\n app.get(\"/helloTest\", async (req, res, ctx) => {\n res.send(await ctx.call(\"webhooks.hello\"));\n });\n app.get(\"/exptest\", (req, res) => {\n res.send(\"express routing\");\n });\n }", "function notFoundHandler() {\n \n }", "function create(){\n \n var routes = {};\n \n function addRoute(name, method, pattern, handler) {\n if (typeof pattern === 'string') {\n pattern = new RegExp(\"^\" + pattern + \"$\");\n }\n \n var route = {\n name: name, \n method: method,\n pattern: pattern,\n handler: handler,\n plugins:{before:[], after:[]},\n //helpers :{} // delete TODO\n };\n \n routes[name] = route;\n return route;\n }\n \n // get the roote and save the match in response object\n function doRoute(req, context) {\n var uri = url_parse(req.url);\n var path = uri.pathname;\n for (var routeName in routes) {\n var route = routes[routeName];\n if (req.method === route.method) {\n var match = path.match(route.pattern);\n if (match && match[0].length > 0) {\n // TODO named properties params in response como query string\n context.response.matches = match;\n return route;\n }\n }\n }\n \n return false;\n }\n\n // add plugin to handler\n function addPlugin (){\n var args = Array.prototype.slice.call(arguments);\n var firstArg = args.shift(); \n if (typeof firstArg === 'string') {\n var route = routes[firstArg];\n } else {\n var route = firstArg; // Object\n }\n \n var hook = 'before';\n \n var last = args[args.length-1];\n if (typeof last === 'string'){\n args.pop();\n if(last === 'after' ){\n hook = 'after';\n }\n } \n \n if (hook === 'after'){\n Array.prototype.push.apply(route.plugins.after, args);\n } else {\n Array.prototype.push.apply(route.plugins.before, args);\n } \n }\n \n // application (router) Scope\n var modulePrototypesContainer = {\n modules : []\n }\n\n function addModule(rte, module){\n //var args = Array.prototype.slice.call(arguments);\n if (typeof rte === 'string') {\n var rte = routes[rte];\n }\n // plugins\n Array.prototype.push.apply(rte.plugins.after, module.after);\n Array.prototype.push.apply(rte.plugins.before, module.before);\n // helpers\n addHelpers(module, modulePrototypesContainer);\n }\n\n function createContext(req, res){\n var context = {};\n modulePrototypesContainer.modules.forEach(function(moduleName){\n var obj = Object.create(modulePrototypesContainer[moduleName]);\n obj.request = req;\n obj.response = res;\n context[moduleName] = obj;\n });\n\n context.request = req;\n context.response = res;\n return context;\n }\n\n function createChain(route){\n var beforeFuncs = route.plugins.before || [];\n var afterFuncs = route.plugins.after || [];\n var beforeAllFuncs = routes[ALLROUTES_CHAIN].plugins.before || [];\n var afterAllFuncs = routes[ALLROUTES_CHAIN].plugins.after || [];\n return [].concat(beforeAllFuncs, beforeFuncs, route.handler, afterFuncs, afterAllFuncs);\n \n }\n \n return {\n routes : routes,\n addRoute: addRoute,\n doRoute: doRoute,\n addPlugin: addPlugin,\n addModule: addModule,\n createChain: createChain,\n createContext: createContext,\n modulePrototypesContainer: modulePrototypesContainer,\n ALLROUTES_CHAIN : ALLROUTES_CHAIN\n\n };\n}", "handleRequest(req, res) {\n if (req.method == 'GET') {\n this.handleGet.bind(this)(req, res);\n } else if (req.method == 'POST') {\n this.handlePost.bind(this)(req, res);\n }\n }", "get routes(){\n\t\treturn {\n\t\t\t'get /': [actionFilter, 'index'],\n\t\t\t'get /home/about': 'about'\n\t\t}\n\t}", "initRouter() {\n Router.config(AppConfig.get('routes'));\n \n Router.onBeforeAction((r, p) => {\n const token = Accounts.getToken()\n if(!r.ignoreLogin && !token) Accounts.logout()\n })\n\n /** Login **/\n Router.on('login', (rota, req) => {\n this.component(<LoginComponent />);\n });\n Router.on('/logout', () => {\n Accounts.logout('/login');\n });\n\n /** Inicio **/\n Router.on('home', (rota, req) => {\n Router.redirect(rota.submenu[0].path);\n });\n Router.on('profile', (rota, req) => {\n this.component(<NewsFeed jsonUrl='/feed' userName={req.params.username}/>);\n });\n Router.on('/novidades', (rota, req) => {\n this.component(<NewsFeed jsonUrl='/feed'/>);\n });\n\n Router.on('messages', (rota, req) => {\n Router.redirect(rota.submenu[0].path);\n });\n Router.on('/social/conversations', (rota, req) => {\n this.component(<MessagesList />);\n });\n\n Router.on('settings', (rota, req) => {\n page.redirect(rota.submenu[0].path);\n });\n Router.on('/social/privacy', (rota, req) => {\n this.component(<h1>Privacy</h1>);\n });\n Router.notFound((rota, req) => {\n this.component(<h1>404 {rota.path}</h1>);\n });\n Router.init();\n }", "function dispatch () {\n\t\teach(routes, function (route, uri) {\n\t\t\tvar callback = route[0];\n\t\t\tvar pattern = route[1];\n\t\t\tvar params = route[2];\n\t\t\tvar match = location.match(pattern);\n\n\t\t\t// we have a match\n\t\t\tif (match != null) {\n\t\t\t\t// create params object to pass to callback\n\t\t\t\t// i.e {user: 'simple', id: '1234'}\n\t\t\t\tvar data = match.slice(1, match.length);\n\n\t\t\t\tvar args = data.reduce(function (previousValue, currentValue, index) {\n\t\t\t\t\t\t// if this is the first value, create variables store\n\t\t\t\t\t\tif (previousValue == null) {\n\t\t\t\t\t\t\tpreviousValue = {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// name: value\n\t\t\t\t\t\t// i.e user: 'simple'\n\t\t\t\t\t\t// `vars` contains the keys for the variables\n\t\t\t\t\t\tpreviousValue[params[index]] = currentValue;\n\n\t\t\t\t\t\treturn previousValue;\n\n\t\t\t\t\t\t// null --> first value\n\t\t\t\t\t}, null); \n\n\t\t\t\tcallback(args, uri);\n\t\t\t}\n\t\t});\n\t}", "function handleRequest(req, res){\r\n\t\r\n\t//res.end(req.url);\r\n\r\n\tvar url_parts = url.parse(req.url);\r\n\r\n\tswitch(url_parts.pathname){\r\n\t\tcase '/':\r\n\t\t\tdisplayRoot(url_parts.pathname, req, res);\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase '/movie':\r\n \t\tdisplayMovie(url_parts.pathname, req, res);\r\n \tbreak;\r\n\r\n\t\tdefault:\r\n\t\t\tdisplay404(url_parts.pathname, req, res);\r\n\t}\r\n}", "init() {\n this.router.post('/generate', (request, response, next) => {\n this.generateKeys(request, response, next);\n });\n this.router.get('/keys/:platform', (request, response, next) => {\n this.getKeys(request, response, next);\n });\n this.router.get('/validate', (request, response, next) => {\n this.validate(request, response, next);\n });\n this.router.get('/platforms', (request, response, next) => {\n this.getStatus(request, response, next);\n });\n // TODO: chenge post to delete\n this.router.delete('/delete', (request, response, next) => {\n this.deleteKey(request, response, next);\n });\n this.router.put('/status', (request, response, next) => {\n this.updateStatus(request, response, next);\n });\n }", "function Router() {\n return {\n /**\n * navigateToCart - navigate to cart in checkout\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToCart : function(info) {\n info = _.extend({\n route : 'cart'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * navigateToCustomer - navigate to customer views\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToCustomer : function(info) {\n info = _.extend({\n route : 'customer'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * navigateToCustomerSearchResult - navigate to customer search results\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToCustomerSearchResult : function(info) {\n info = _.extend({\n route : 'customer_search_result'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * customerLogout - log out a customer\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n customerLogout : function(info) {\n info = _.extend({\n route : 'customer_logout'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * presentChangeStorePasswordDrawer - change the store password\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentChangeStorePasswordDrawer : function(info) {\n info = _.extend({\n route : 'change_store_password'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * navigateToHome - navigate to Home\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToHome : function(info) {\n info = _.extend({\n route : 'home'\n }, info);\n\n return handleAppRoute(info);\n },\n\n /**\n * navigateToCategory - navigate to category\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToCategory : function(info) {\n info = _.extend({\n route : 'product_search_result',\n query : ''\n }, info);\n\n return handleAppRoute(info);\n },\n\n /**\n * navigateToProduct - navigate to a product (PDP)\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToProduct : function(info) {\n info = _.extend({\n route : 'product_detail'\n }, info);\n\n return handleAppRoute(info);\n },\n\n /**\n * navigateToProductSearch - navigate to product search results\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToProductSearch : function(info) {\n info = _.extend({\n route : 'product_search_result'\n }, info);\n\n return handleAppRoute(info);\n },\n\n /**\n * navigateToOrderSearchResult - navigate to order search results\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigateToOrderSearchResult : function(info) {\n info = _.extend({\n route : 'order_search_result'\n }, info);\n\n return handleAppRoute(info);\n },\n\n /**\n * presentAssociateLogin - present associate login\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentAssociateLogin : function(info) {\n info = _.extend({\n route : 'associate_login'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * presentCustomerSearchDrawer - present customer search dialog\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentCustomerSearchDrawer : function(info) {\n info = _.extend({\n route : 'customer_search'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * presentOrderSearchDrawer - present order search dialog\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentOrderSearchDrawer : function(info) {\n info = _.extend({\n route : 'order_search'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * presentProductSearchDrawer - present product search dialog\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentProductSearchDrawer : function(info) {\n info = _.extend({\n route : 'product_search'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * presentPrinterChooserDrawer - present printer chooser dialog\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentPrinterChooserDrawer : function(info) {\n info = _.extend({\n route : 'printer_chooser'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * associateLogout - perform associate logout\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n associateLogout : function(info) {\n info = _.extend({\n route : 'associate_logout'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * presentCreateAccountDrawer - present create account dialog\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n presentCreateAccountDrawer : function(info) {\n info = _.extend({\n route : 'create_account'\n }, info);\n return handleAppRoute(info);\n },\n\n /**\n * checkPaymentDevice - check status of payment device\n *\n * @param {Boolean} verified - if verified\n * @return {Deferred} promise\n * @api public\n */\n checkPaymentDevice : function(verified) {\n return checkPaymentDevice(verified);\n },\n\n /**\n * paymentDeviceConnectionChecked - update device status\n *\n * @param {Boolean} connected - if connected\n * @api public\n */\n paymentDeviceConnectionChecked : function(connected) {\n if (connected != paymentDeviceConnected) {\n paymentDeviceConnected = connected;\n $.header.updateDeviceStatus(false, connected);\n if ($.no_payment_terminal) {\n $.no_payment_terminal.updateDeviceStatus(connected);\n }\n }\n },\n\n /**\n * startup - restart the application\n *\n * @api public\n */\n startup : function() {\n Alloy.eventDispatcher.trigger('app:startup', {\n login : true\n });\n },\n\n /**\n * showActivityIndicator - shows activity indicator until deferred is complete\n *\n * @param {Deferred} deferred\n * @api public\n */\n showActivityIndicator : function(deferred) {\n showActivityIndicator(deferred);\n },\n\n /**\n * showHideHamburgerMenu - show the hamburger menu popover\n *\n * @api public\n */\n showHideHamburgerMenu : function() {\n $.hamburger_menu.showHideHamburgerMenu();\n },\n\n /**\n * hideHamburgerMenu - hide the hamburger menu popover\n *\n * @api public\n */\n hideHamburgerMenu : function() {\n $.hamburger_menu.hideHamburgerMenu();\n },\n\n /**\n * navigate - dynamic routing based on info passed in\n *\n * @param {Object} info - optional info\n * @return {Deferred} promise\n * @api public\n */\n navigate : function(info) {\n // for dynamic routing\n return handleAppRoute(info);\n }\n };\n}", "constructor(_routePath, handler, _routeName) {\r\n this._routePath = _routePath;\r\n this.handler = handler;\r\n this._routeName = _routeName;\r\n this._cache = new Map();\r\n this.specificity = this._routePath.specificity;\r\n this.hash = this._routePath.hash;\r\n this.terminal = this._routePath.terminal;\r\n }", "routeChange() {\n\n // Validating the routes object\n if (!router.routes) return;\n if (router.routes.constructor !== Object) throw err(9);\n\n const route = router.getRoute(window.location.pathname);\n const entries = Object.entries(router.routes);\n\n // Looping through all routes in the routes-object\n for (let i = 0; i < entries.length; i++) {\n const entryRoute = router.getRoute(entries[i][0]);\n let match = true;\n\n // Checking if the current URL matches the route\n for (let a = 0; a < entryRoute.length; a++) {\n if (route[a] === undefined || (entryRoute[a] !== \"**\" && entryRoute[i] !== route[i])) {\n match = false;\n break;\n }\n }\n\n // Change content if match was found\n if (match) {\n router.page = entries[i][1];\n window.dispatchEvent(router.newRouteEvent);\n return;\n }\n }\n\n }", "findRoute(ctx) {\n const url = ctx.request.url();\n const method = ctx.request.method();\n const hostname = ctx.request.hostname();\n /*\n * Profiling `route.match` method\n */\n const matchRoute = ctx.profiler.profile('http:route:match');\n const route = this.router.match(url, method, hostname || undefined);\n matchRoute.end();\n /*\n * Raise error when route is missing\n */\n if (!route) {\n throw new utils_1.Exception(`Cannot ${method}:${url}`, 404, 'E_ROUTE_NOT_FOUND');\n }\n /*\n * Attach `params`, `subdomains` and `route` when route is found. This\n * information only exists on a given route\n */\n ctx.params = route.params;\n ctx.subdomains = route.subdomains;\n ctx.route = route.route;\n ctx.routeKey = route.routeKey;\n }", "function create_route(handler) {\n\t// Default values in case pre and post hooks were omitted\n\tvar pre = handler.pre || ['default'];\n\tvar post = handler.post || ['default'];\n\tvar fin = handler.finally || ['default'];\n\n\t// Map names to chains for hooks\n\tpre = pre.map(function(v, k) {\n\t\treturn get_chain(this.pre_hooks, v);\n\t}, this);\n\tpost = post.map(function(v, k) {\n\t\treturn get_chain(this.post_hooks, v);\n\t}, this);\n\tfin = fin.map(function(v, k) {\n\t\treturn get_chain(this.finally_hooks, v);\n\t}, this);\n\n\t// Create a single array with all of the appropriate hooks and handlers in place\n\tvar handlers = pre.concat([handler.fn], post);\n\tvar handler_chain = new fl.Chain(handlers);\n\thandler_chain.set_exception_handler(handle_global_error);\n\thandler_chain.name = 'Common Route Handler';\n\n\t// Create the finally chain, which could still have an exception thrown (...), so\n\t// defend against that and guarantee that we make it to finish\n\tvar finally_chain = new fl.Chain([handler_chain].concat(fin));\n\tfinally_chain.set_exception_handler(handle_global_error);\n\tfinally_chain.set_bind_after_env(true);\n\tfinally_chain.name = 'Route Safety Wrapper';\n\n\tvar finish = this.finish.bind(this);\n\tfinish.name = 'finish';\n\n\t// This function is suitable for passing to express's server/route definitions\n\tvar that = this;\n\treturn function(req, res) {\n\t\tvar env = prepare_env(req, res, that.options);\n\t\tfinally_chain.call(null, env, finish);\n\t};\n}", "routes() {\n this.app.use('/images', express.static('uploads'));\n this.app.use('/users/', userRoutes);\n this.app.use('/tokens/', tokenRoutes);\n this.app.use('/shop/', shopRoutes);\n this.app.use('/products/', productRoutes);\n this.app.use('/order/', orderRoutes);\n this.app.use('/address/', addressRoutes);\n this.app.use(\"/creditCard/\", creditCardRoutes)\n }", "function routing() {\n switch (document.location.hash) {\n case '':\n ajaxRequestWithCallback('views/home.html', importInViewForHome);\n break;\n case \"#game\":\n ajaxRequestWithCallback('views/game.html', importInViewAndStartGame);\n break;\n case \"#score\":\n ajaxRequestWithCallback('views/score.html', importInViewAndShowScore);\n break;\n case \"#controls\":\n ajaxRequestWithCallback('views/controls.html', importInViewAndShowControls);\n break;\n case \"#modal\":\n ajaxRequestWithCallback('views/modal.html', importInViewAndSaveScore);\n break;\n default:\n ajaxRequestWithCallback('views/pageNotFound.html', importInView);\n break;\n }\n }", "function route(app){\n app.use('/data',dataRoute);\n app.use('/', mainRoute);\n}", "function dispatch() {\n var query,\n path,\n arg,\n finalRoute = 0,\n finalMatchLength = -1,\n finalRegStr = \"\",\n finalFirstCaptureGroupIndex = -1,\n finalCallback = 0,\n finalRouteName = \"\",\n pathUri = new S.Uri(getFragment()),\n finalParam = 0;\n\n path = pathUri.clone();\n path.query.reset();\n path = path.toString();\n\n // user input : /xx/yy/zz\n each(allRoutes, function (route) {\n var routeRegs = route[ROUTER_MAP],\n // match exactly\n exactlyMatch = 0;\n each(routeRegs, function (desc) {\n var reg = desc.reg,\n regStr = desc.regStr,\n paramNames = desc.paramNames,\n firstCaptureGroupIndex = -1,\n m,\n name = desc.name,\n callback = desc.callback;\n if (m = path.match(reg)) {\n // match all result item shift out\n m.shift();\n\n function genParam() {\n if (paramNames) {\n var params = {};\n each(m, function (sm, i) {\n params[paramNames[i]] = sm;\n });\n return params;\n } else {\n // if user gave directly reg\n // then call callback with match result array\n return [].concat(m);\n }\n }\n\n function upToFinal() {\n finalRegStr = regStr;\n finalFirstCaptureGroupIndex = firstCaptureGroupIndex;\n finalCallback = callback;\n finalParam = genParam();\n finalRoute = route;\n finalRouteName = name;\n finalMatchLength = m.length;\n }\n\n // route: /xx/yy/zz\n if (!m.length) {\n upToFinal();\n exactlyMatch = 1;\n return false;\n }\n else if (regStr) {\n\n firstCaptureGroupIndex = findFirstCaptureGroupIndex(regStr);\n\n // final route : /*\n // now route : /xx/*\n if (firstCaptureGroupIndex > finalFirstCaptureGroupIndex) {\n upToFinal();\n }\n\n else if (\n firstCaptureGroupIndex == finalFirstCaptureGroupIndex &&\n finalMatchLength >= m.length\n ) {\n // final route : /xx/:id/:id\n // now route : /xx/:id/zz\n if (m.length < finalMatchLength) {\n upToFinal()\n } else if (regStr.length > finalRegStr.length) {\n upToFinal();\n }\n }\n\n // first route has priority\n else if (!finalRoute) {\n upToFinal();\n }\n }\n // if exists user-given reg router rule then update value directly\n // first route has priority\n // 用户设置的正则表达式具备高优先级\n else {\n upToFinal();\n exactlyMatch = 1;\n return false;\n }\n }\n }\n );\n\n if (exactlyMatch) {\n return false;\n }\n });\n\n\n if (finalParam) {\n query = pathUri.query.get();\n finalCallback.apply(finalRoute, [finalParam, query, {\n path: path,\n url: location.href\n }]);\n arg = {\n name: finalRouteName,\n \"paths\": finalParam,\n path: path,\n url: location.href,\n query: query\n };\n finalRoute.fire('route:' + finalRouteName, arg);\n finalRoute.fire('route', arg);\n }\n }", "post(...args) {\n this.route('post', ...args);\n }", "all(_route, _f) {\n ['get', 'head', 'post', 'put', 'patch', 'delete'].forEach((_val) => {\n this._bindPathsToMap(_val, _route, _f);\n });\n }", "handle(req, res, out) {\n const protohost = getProtohost(req.url) || '';\n const stack = this.stack;\n let index = 0;\n let removed = '';\n let slashAdded = false;\n\n // final function handler\n const done = out || finalhandler(req, res, {env, onerror: logerror});\n\n // store the original URL\n req.originalUrl = req.originalUrl || req.url;\n\n /**\n * Next handler\n * @param err\n * @returns {*}\n */\n function next(err) {\n if (slashAdded) {\n req.url = req.url.substr(1);\n slashAdded = false;\n }\n\n if (removed.length !== 0) {\n req.url = protohost + removed + req.url.substr(protohost.length);\n removed = '';\n }\n\n // next callback\n const layer = stack[index++];\n\n // all done\n if (!layer) {\n defer(done, err);\n return;\n }\n\n // route data\n const path = parseUrl(req).pathname || '/';\n const route = layer.route;\n\n // skip this layer if the route doesn't match\n if (path.toLowerCase().substr(0, route.length) !== route.toLowerCase()) {\n return next(err);\n }\n\n // skip if route match does not border \"/\", \".\", or end\n const c = path[route.length];\n if (c !== undefined && c !== '/' && c !== '.') {\n return next(err);\n }\n\n // trim off the part of the url that matches the route\n if (route.length !== 0 && route !== '/') {\n removed = route;\n req.url = protohost + req.url.substr(protohost.length + removed.length);\n\n // ensure leading slash\n if (!protohost && req.url[0] !== '/') {\n req.url = `/${req.url}`;\n slashAdded = true;\n }\n }\n\n // call the layer handle\n call(layer.handle, route, err, req, res, next);\n }\n\n next();\n }", "function userRoutes() {\n return (open, closed) => {\n closed.route('/get-meta-data/module/:moduleName/screen/:screenName').get(\n joiGetSpecifications, // joi validation\n ctrl.getFileDynamically // controller function \n );\n };\n}", "init() {\n this.router.get(\"/\", (req, res, next) => {\n res.status(200).json(this._service.defaultMethod());\n });\n }", "initRoutes() {\n this.app.get(\n `${this.apiBasePath}/person/:personId/appearances`,\n (req, res, next) => {\n personController.getAppearances(req, res, next);\n },\n );\n\n this.app.get(\n `${this.apiBasePath}/person/:personId/movies`,\n (req, res, next) => {\n personController.getMovieAppearances(req, res, next);\n },\n );\n\n this.app.get(\n `${this.apiBasePath}/person/:personId/tv`,\n (req, res, next) => {\n personController.getTvAppearances(req, res, next);\n },\n );\n }", "function router(request , response){\r\n let requestObject = extractPathName(request , response);\r\n let requestURLPathName = requestObject.pathname;\r\n if(requestObject.parameters || requestObject.optionalParams)\r\n {\r\n if(requestObject.parameters && requestObject.optionalParams)\r\n {\r\n request.params = requestObject.parameters;\r\n request.optionalParams = requestObject.optionalParams;\r\n }\r\n else if(requestObject.parameters)\r\n {\r\n request.params = requestObject.parameters;\r\n }\r\n else if(requestObject.optionalParams)\r\n {\r\n request.optionalParams = requestObject.optionalParams;\r\n }\r\n }\r\n switch(requestURLPathName)\r\n {\r\n //If we get a request for /params path then we are going to call the paramsURLRouter method\r\n case \"/params/:paramOne/:paramTwo\" :\r\n paramsURLRouter.paramsURLRouter(request , response);\r\n break;\r\n //If we get a request for /params path then we are going to call the baseURLRouter method\r\n case \"/\" :\r\n baseURLRouter.baseURLRouter(request , response);\r\n break;\r\n //If a request to invalid path is received then following functionality will be called\r\n default :\r\n console.log(\"Invalid request URL\");\r\n break;\r\n }\r\n\r\n}", "route(req, res) {\n const parsedURL = url.parse(req.url, true)\n const route = parsedURL.pathname.replace(/^\\/+|\\/+$/g, '')\n\n const queryString = parsedURL.query\n const headers = req.headers\n const decoder = new StringDecoder('utf-8')\n\n let buffer = ''\n req.on('data', (data) => {\n buffer += decoder.write(data)\n })\n\n req.on('end', async () => {\n try {\n buffer += decoder.end()\n const request = new Request({ \n route: route,\n queryString: queryString,\n method: req.method,\n headers, headers,\n payload: buffer\n })\n\n let handler = this._router.handler(route, req.method)\n const response = await handler(request)\n let statusCode = response.statusCode()\n let payload = response.payload()\n\n statusCode = typeof(statusCode) == 'number' ? statusCode : 200\n payload = typeof(payload) == 'object' ? payload : {}\n \n res.setHeader('Content-Type', 'application/json')\n res.writeHead(statusCode)\n res.end(JSON.stringify(payload))\n } catch (err) {\n console.dir(err)\n res.writeHead(500)\n res.end(JSON.stringify({\n err: err,\n msg: 'internal server error'\n }))\n }\n })\n }", "init() {\n this.router.route('/')\n .get(this.getAll)\n .post(this.postHero);\n this.router.route('/:id')\n .get(this.getOne);\n }" ]
[ "0.73137426", "0.7291649", "0.72706354", "0.7260056", "0.7000022", "0.6909446", "0.69084156", "0.68842363", "0.6829947", "0.6821414", "0.6810019", "0.67251444", "0.67245466", "0.67245466", "0.67245466", "0.67245466", "0.67245466", "0.67245466", "0.6716181", "0.67028487", "0.67028487", "0.67028487", "0.67028487", "0.67028487", "0.67028487", "0.67028487", "0.66772735", "0.6649971", "0.6649534", "0.66361827", "0.66338336", "0.66226184", "0.6609191", "0.65967035", "0.65894985", "0.65747994", "0.65653306", "0.65644914", "0.6533733", "0.65199435", "0.65137434", "0.65043026", "0.6462652", "0.6450741", "0.64398086", "0.64166397", "0.64095265", "0.6381109", "0.6368433", "0.6357593", "0.6353074", "0.63474375", "0.6343558", "0.63375026", "0.6332201", "0.63125664", "0.629858", "0.62976116", "0.6294532", "0.62895876", "0.6283309", "0.6273309", "0.62598747", "0.62517214", "0.62417185", "0.6229788", "0.62295437", "0.62240016", "0.6221392", "0.6217991", "0.62171274", "0.6213186", "0.6206984", "0.6205967", "0.62036633", "0.6198513", "0.61893153", "0.6187807", "0.6186564", "0.61863476", "0.61723554", "0.6163933", "0.6154744", "0.61421853", "0.61325127", "0.6125699", "0.61210185", "0.611503", "0.6114794", "0.6114097", "0.6106577", "0.61029017", "0.6087824", "0.6085946", "0.6082666", "0.6071382", "0.6047811", "0.6046769", "0.6043802", "0.6043737", "0.60222095" ]
0.0
-1
=================== Misc. Functions =====================
function Location(jsonObject, query) { this.search_query = query; this.formatted_query = jsonObject[0].display_name; this.latitude = jsonObject[0].lat; this.longitude = jsonObject[0].lon; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static private internal function m121() {}", "transient protected internal function m189() {}", "static final private internal function m106() {}", "transient private protected internal function m182() {}", "function _____SHARED_functions_____(){}", "transient private internal function m185() {}", "static private protected internal function m118() {}", "function Utils() {}", "function Utils() {}", "function DWRUtil() { }", "transient final protected internal function m174() {}", "static transient private protected internal function m55() {}", "function Utils(){}", "static protected internal function m125() {}", "function AeUtil() {}", "function Util() {}", "static transient final private internal function m43() {}", "transient final private internal function m170() {}", "static transient private internal function m58() {}", "static private protected public internal function m117() {}", "transient private protected public internal function m181() {}", "static transient final private protected internal function m40() {}", "static transient final protected internal function m47() {}", "static transient final protected public internal function m46() {}", "static transient private protected public internal function m54() {}", "static final private protected internal function m103() {}", "static final protected internal function m110() {}", "transient final private protected internal function m167() {}", "static final private public function m104() {}", "static final private protected public internal function m102() {}", "function oi(){}", "function Utils() {\n}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "static transient private public function m56() {}", "static private public function m119() {}", "function SigV4Utils() { }", "transient private public function m183() {}", "function FunctionUtils() {}", "function TMP(){return;}", "function TMP(){return;}", "__previnit(){}", "transient final private protected public internal function m166() {}", "function nd(){}", "function TMP() {\n return;\n }", "static get elvl_info() {return 0;}", "function miFuncion (){}", "function fm(){}", "function hc(){}", "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 ea(){}", "function SBRecordsetPHP_analyzePlatformSpecific()\r\n{\r\n\r\n\r\n}", "function Sread() {\r\n}", "function StupidBug() {}", "static transient final protected function m44() {}", "function CCUtility() {}", "function TMP(){}", "function TMP(){}", "obtain(){}", "function l(){t={},u=\"\",w=\"\"}", "_read () {}", "_read () {}", "_read () {}", "function Scdr() {\r\n}", "static transient final private protected public internal function m39() {}", "function Cnds() {}", "function WSAPI() {\n }", "function setup() {}", "constructor (){}", "init () {}", "init () {}", "initialize()\n {\n }", "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "function rc(){}", "static transient final private public function m41() {}", "function dummy(){}", "function dummy(){}", "function dummy(){}" ]
[ "0.6945316", "0.67050767", "0.65102595", "0.64728105", "0.6239555", "0.6215942", "0.61588246", "0.6157968", "0.611046", "0.6045635", "0.5958986", "0.5958986", "0.591287", "0.59122753", "0.5872593", "0.58559895", "0.578994", "0.5784584", "0.57767916", "0.57570446", "0.57476676", "0.570858", "0.5701094", "0.5696844", "0.56859803", "0.5664842", "0.56297356", "0.5607975", "0.5556656", "0.55313385", "0.5495957", "0.54717296", "0.53917533", "0.53523624", "0.5351066", "0.5326001", "0.5326001", "0.5326001", "0.5326001", "0.5326001", "0.5326001", "0.53183365", "0.5311655", "0.5284632", "0.5281354", "0.5276886", "0.5267995", "0.5267995", "0.52613354", "0.525436", "0.52496195", "0.5244999", "0.5233622", "0.5220886", "0.51996034", "0.5195342", "0.51942855", "0.51942855", "0.51942855", "0.51942855", "0.51942855", "0.51942855", "0.51942855", "0.51942855", "0.51942855", "0.51942855", "0.51942855", "0.51942855", "0.51942855", "0.519397", "0.51790386", "0.5176429", "0.516925", "0.51681685", "0.5163016", "0.5148199", "0.5148199", "0.51475155", "0.5137605", "0.51356983", "0.51356983", "0.51356983", "0.5135504", "0.51326245", "0.51194954", "0.51145285", "0.51132214", "0.510835", "0.51069045", "0.51069045", "0.5103639", "0.50905424", "0.50905424", "0.50905424", "0.50905424", "0.50905424", "0.50826824", "0.5079773", "0.5074292", "0.5074292", "0.5074292" ]
0.0
-1
This method is specifically for reading JSON files in a Tree
function readJsonInTree(host, path) { if (!host.exists(path)) { throw new Error(`Cannot find ${path}`); } const contents = stripJsonComments(host.read(path).toString('utf-8')); try { return JSON.parse(contents); } catch (e) { throw new Error(`Cannot parse ${path}: ${e.message}`); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "loadJson() {\n return readFile(this.jsonPath, { encoding: 'utf8' }).then((jsonText) => {\n this.jsonText = jsonText;\n return (this.jsonData = JSON.parse(jsonText));\n });\n }", "static fromJson(js) {\n function recursive(jsnode, name, parent) {\n let node = new NodeTree_1.default(name, parent);\n if (jsnode !== null) {\n for (let key in jsnode) {\n node.childs.push(recursive(jsnode[key], key, node));\n }\n }\n return node;\n }\n let tree = new Tree();\n if (js !== null && Object.keys(js).length != 0) {\n let rootName = Object.keys(js)[0];\n tree.root = recursive(js[rootName], rootName, null);\n }\n return tree;\n }", "readJson(pathJson) {\r\n pathJson = path + pathJson;\r\n var json = JSON.parse(fs.readFileSync(pathJson).toString());\r\n return json;\r\n }", "function addTreeOne() {\n\nvar loader = new THREE.JSONLoader();\nvar treeModelOne;\nloader.load(\"3D_json/treeOne.json\", callTree);\n\n}", "function processJSON ( file ) {\n 'use strict';\n var _json = JSON.parse(file.contents.toString());\n var _jsonOut = [];\n for (var i in _json) {\n _jsonOut[i] = {};\n _jsonOut[i].id = md5(i.toString());\n\n for (var j in _json[i]) {\n\n if (j in COL_NAME_MAP) {\n var v = COL_NAME_MAP[j];\n\n if (typeof v === 'object') {\n\n var content = _json[i][j];\n\n if (v.slugify) {\n content = slugify(content);\n }\n\n if ('parent' in v) {\n if (!(v.parent in _jsonOut[i])) {\n _jsonOut[i][v.parent] = v.many ? [] : {};\n }\n\n if (v.many) {\n var _split = content.split(v.delimiter);\n\n for (var s in _split) {\n if (_jsonOut[i][v.parent].length == 0) {\n let a = v.value;\n let b = {};\n b[a] = '';\n _jsonOut[i][v.parent][s] = b;\n }\n _jsonOut[i][v.parent][s][v.value] = _split[s].trim();\n }\n }\n }\n\n _jsonOut = populateChildren(_jsonOut, content, v, i);\n\n } else {\n _jsonOut[i][v] = _json[i][j];\n }\n }\n }\n }\n var out = JSON.stringify(_jsonOut);\n file.contents = new Buffer(out);\n}", "function readTestJSON()\n{\n var text = fs.readFileSync(\"./test/test.json\", \"utf-8\");\n return JSON.parse(text);\n}", "read() {\n return JSON.parse(\n new File(this.path).read()\n );\n }", "function addTreeTwo() {\n\nvar loader = new THREE.JSONLoader();\nvar treeModelTne;\nloader.load(\"3D_json/treeTwo.json\", callTreeTwo);\n\n}", "function read_parse_json_files(json_files, zlib_comp){\n // reads a list of files that contain the json\n // data structure. The files can be compressed\n // using zlib compression. Very large files can\n // be split into chunks to be consolidated back into\n // a single structure.\n if ( json_files.length == 1 ){\n\tjson = read_parse_json_file(json_files[0], zlib_comp);\n } else {\n\tvar json_arr = new Array(json_files.length);\n\tfor (var i_js=0; i_js < json_files.length; i_js++){\n\t json_arr[i_js] = read_parse_json_file(json_files[i_js], zlib_comp);\n\t};\n\tvar json = json_arr[json_arr.length-1];\n\tconsolidate_json(json, json_arr);\n };\n return json;\n}", "loadJsonData() {\n }", "function readRepoStructureFile(filename) {\n\n var file = filename.split('/')[3];\n var owner = file.split('_')[0];\n var repoName = file.split('_')[1];\n repoName = repoName.substring(0, repoName.length-5);\n console.log(\"Owner: \"+owner);\n console.log(\"RepoName: \"+repoName);\n fs.readFile(filename, function(err,data) {\n if (err) {\n return console.log(err);\n }\n var items = JSON.parse(data).tree;\n //console.log(\"Tree \"+JSON.stringify(items));\n getEJSFiles(items, owner, repoName);\n });\n\n}", "function readJSONFile( path ){\n\t//Check to see if the JSON files exist.\n\tvar binaryData;\n\ttry {\n\t\tbinaryData = fs.readFileSync( path);\n\t\treturn JSON.parse( binaryData.toString() );\n\t} catch (e) {\n\t\tif (e.code === 'ENOENT') {\n\t\t\tconsole.log(path + ' not found!');\n\t\t\tconsole.log(path + ' needs to be created once before the site will work properly.')\n\t\t\tconsole.log(\"(Normally there's about a 1-minute delay.)\")\n\n\t\t\tbinaryData = {};\n\t\t\treturn binaryData;\n\t\t} else {\n\t\t\tthrow e;\n\t\t} \n\t}\n}", "function parse(context, file) {\n var message\n\n if (stats(file).fatal) {\n return\n }\n\n if (context.treeIn) {\n debug('Not parsing already parsed document')\n\n try {\n context.tree = json(file.toString())\n } catch (error) {\n message = file.message(\n new Error('Cannot read file as JSON\\n' + error.message)\n )\n message.fatal = true\n }\n\n // Add the preferred extension to ensure the file, when serialized, is\n // correctly recognised.\n // Only add it if there is a path — not if the file is for example stdin.\n if (file.path) {\n file.extname = context.extensions[0]\n }\n\n file.contents = ''\n\n return\n }\n\n debug('Parsing `%s`', file.path)\n\n context.tree = context.processor.parse(file)\n\n debug('Parsed document')\n}", "function loadJson() {\n let file_loader = new THREE.FileLoader();\n file_loader.load(jsonPath,\n function (data) {\n font_json = JSON.parse(data);\n loadImg();\n })\n }", "function JSONLoader(path) {\n var self = this;\n\n fs.readFile(path, function (err, data) {\n var json;\n\n if (err) {\n return self.emit('error', err);\n }\n\n try {\n json = JSON.parse(data);\n } catch (e) {\n return self.emit('error', e);\n }\n\n self.emit('load', json);\n });\n}", "function grabJSON(filepath, mode) {\n // access the JSON from the Codex directory\n // i could have done this with jquery, but i wanted to see what building\n // the request looks like in vanilla js\n var url = codex_url + filepath;\n var Httpreq = new XMLHttpRequest();\n Httpreq.open('GET', url);\n Httpreq.send(null);\n var json_obj;\n Httpreq.onreadystatechange = function() {\n if (this.readyState == 4 && this.status == 200) {\n // if the file is ready and successful, do stuff\n // console.log(Httpreq.responseText);\n json_obj = JSON.parse(Httpreq.responseText);\n switch(mode) {\n case 0:\n makeTableFromJSON(json_obj);\n break;\n case 1:\n // searching for creatures\n var keys = ['name', 'category'];\n searchObjectsInJSON(json_obj, keys);\n break;\n }\n } else if (this.status == 404) {\n alert('JSON file not found, recheck the filepath :(');\n }\n }\n}", "function readJson(name, posX, posY, subName, color, money, op, amnt) {\n fs.readFile('asd/map.json', function(err, data){\n if (err) throw err;\n map = JSON.parse(data);\n console.log(map);\n modJson(name, posX, posY, subName, color, money, op, amnt);\n });\n}", "loadJSON(path, success, error) {\n let xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function()\n {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n if (xhr.status === 200) {\n if (success)\n success(JSON.parse(xhr.responseText));\n } else {\n if (error)\n error(xhr);\n }\n }\n };\n xhr.open(\"GET\", path, true);\n xhr.send();\n }", "function _loadJSON(path, callback) { \n var xhr = new XMLHttpRequest();\n xhr.overrideMimeType(\"application/json\");\n xhr.open('GET', path, false);\n xhr.onreadystatechange = function () {\n if (xhr.readyState == 4 && xhr.status == \"200\") {\n callback(xhr.responseText);\n }\n };\n xhr.send(null); \n }", "function loadFile (filePath) {\n\tconsole.log(\"start!\");\n\tfileOpen.jsonFileOpen (filePath, function(parsedJSON, fd) {\n\t\t\n\t\tvar fileArray = parsedJSON;\n\t\tfileFD = fd;\t\n\t\t\n\t\tfs.close(fileFD, function doneWriting (err){\n if (err) {console.log (err);}\n console.log(\"initial file closed\");\n\t\t\t\n\t\t\t\n\t\t\ttraverseArray (fileArray); //go over each document/object in the array\n\t\t});\n\t});\n}", "function RecursiveTreeParse(JsonTree,callback){\n var Children = JsonTree;\n \n //If Children is not null, then proceed.\n if(!Children){\n return\n }\n //Go through all children, if any, and recursively parse through them.\n for(var i = 0;i < Children.length;i++){\n\n RecursiveTreeParse(Children[i].Children,callback);\n if(typeof callback=='function')callback(Children[i]);\n\n }\n}", "function processFilesJSON(data, basePath, depth = 20, relativePath = \"\", outList = []) {\n relativePath = FtpFile.appendSlash(relativePath);\n\n if (depth == 0) {\n console.log(\"Maximum file depth reached, exiting\", relativePath);\n return;\n }\n for (let file of data) {\n if (file.type == FTP_TYPE_FILE) {\n console.log(relativePath + file.name);\n let fileObj = new FtpFile(basePath, relativePath, file);\n outList.push(fileObj);\n } else if (file.type == FTP_TYPE_DIRECTORY) {\n if (typeof file.children == 'object') {\n const newPath = relativePath + file.name;\n processFilesJSON(file.children, basePath, depth - 1, newPath, outList);\n }\n }\n }\n\n return outList;\n}", "function parseJSON(filePath) {\r\n var XMLHttpRequest = require(\"xmlhttprequest\").XMLHttpRequest;\r\n var request = new XMLHttpRequest();\r\n request.open(\"GET\", filePath, false);\r\n request.send(null);\r\n request.onreadystatechange = function() {\r\n if (request.readyState === 4 && request.status === 200) {\r\n var jsonObj = JSON.parse(request.responseText);\r\n console.log(jsonObj);\r\n } else {\r\n console.log(\"ERROR\");\r\n }\r\n }\r\n}", "function loadJSON(file){\n let fs = require('fs');\n let obj = JSON.parse(fs.readFileSync(file + '.json', 'utf8'));\n return obj;\n }", "loadJSON(path, success, error) {\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function()\n {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n if (xhr.status === 200) {\n if (success)\n success(JSON.parse(xhr.responseText));\n } else {\n if (error)\n error(xhr);\n }\n }\n };\n xhr.open(\"GET\", path, true);\n xhr.send();\n }", "function parseJsonNode (v) {\n\n // Verify Url property\n if (v.Url) {\n\n // See if a file exists for this entry\n var filenameWithLocation = grunt.config.get('stache_castle.sandcastleOutput') + v.Url;\n if (grunt.file.exists(filenameWithLocation)) {\n\n grunt.log.writeln('Found: ' + filenameWithLocation);\n\n // Load the files contents into cheerio\n var $ = cheerio.load(grunt.file.read(filenameWithLocation));\n\n // TODO: Inheritance\n // TODO: References\n\n // Grab the title\n v.title = $('title').text();\n\n // Summary already exists but we can use this opportunity to clean it\n v.summary = cleanText($('.summary').eq(0).text());\n\n // Grab the syntax\n v.syntax = [];\n $('.codeSnippetContainerTab').each(function (k) {\n v.syntax.push({\n type: $(this).children('a').text(),\n code: $('.codeSnippetContainerCode').eq(k).children('pre').html()\n });\n });\n\n // Namespaces, Classes, Methods, Properties\n $('.collapsibleAreaRegion').each(function () {\n var section = $(this),\n key = cleanText(section.find('.collapsibleRegionTitle').text().toLowerCase()),\n id = section.next('.collapsibleSection').attr('id');\n\n if (grunt.config.get('stache_castle.collapsibleRegions').indexOf(key) > -1) {\n v[key] = objectFromTable($, '#' + id + ' table.members tr');\n }\n });\n\n // Log the files we weren't able to locate\n } else {\n grunt.log.warn('Not Found: ' + filenameWithLocation);\n grunt.log.warn('(' + v.name + ')');\n grunt.log.writeln('');\n }\n }\n\n switch (grunt.util.kindOf(v.HelpTOCNode)) {\n case 'array':\n v.HelpTOCNode.forEach(function (x) {\n parseJsonNode(x);\n });\n break;\n case 'object':\n parseJsonNode(v.HelpTOCNode);\n break;\n }\n\n }", "function treeForFile (file) {\n var contents = null\n try {\n contents = fs.readFileSync(file).toString()\n } catch (err) {\n if (err.code === 'ENOENT') {\n logger.error(\"File not found: \"+file)\n process.exit(1)\n }\n throw err\n }\n var name = path.basename(file),\n parser = new Parser()\n\n parser.file = name\n // Parse and type-check the file; catch and report any errors\n try {\n var tree = parser.parse(contents),\n typesystem = new TypeSystem()\n typesystem.walk(tree)\n } catch (err) {\n reportError(err)\n process.exit(1)\n }\n return tree\n}// treeForFile", "function loadJSON() {\r\n $.getJSON(/nodeshift/, function (data) {\r\n glob_data = data;\r\n });\r\n }", "function readJSONFile(filename) {\n return new Promise(function (resolve, reject) {\n fs.readFile(filename, { \"encoding\": \"utf-8\" }, function (error, data) {\n if (error) {\n reject(error);\n }\n else {\n try {\n var obj = JSON.parse(data);\n resolve({ filename: filename, obj: obj });\n }\n catch (error) {\n reject(error);\n }\n }\n });\n });\n }", "function getJsonData(fileName) {\n var fileJSON = fs.readFileSync('./data/'+fileName+'.json');\n return JSON.parse(fileJSON);\n}", "function loadBookJson() {\n\t\tvar fs = require(\"fs\")\n\t\t// fs.readFile(JAVA_BOOK_JSON, 'utf8', function(err, content) {\n\t\t// if (err)\n\t\t// return callback(err)\n\t\t// callback(null, content)\n\t\t// })\n\t\tvar contents = JSON.parse(fs.readFileSync(JAVA_BOOK_JSON, 'utf8'));\n\t\tconsole.log(JSON.stringify(contents));\n\t\treturn contents\n\t}", "constructor (json) {\n\t\tthis.loadJSON(json);\n\t}", "constructor() {\n this.templates = this.readJSONFile((err, data) => {\n if (err) {\n console.log(\"Data not loaded: \\n \" + err);\n } else {\n this.templates = data;\n }\n });\n }", "function readJSONFile(name) {\n const file = readFile(name);\n return file != null ? JSON.parse(file) : file;\n}", "function readJsonData (callback) {\n let fileSrc = global.defaultFile\n let t = path.parse(fileSrc)\n console.log(t)\n fs.readFile(fileSrc, (err, data) => {\n if (err) {\n if (err.errno === -4058) {\n // eslint-disable-next-line standard/no-callback-literal\n callback && callback({'code': 0, 'msg': `未找到指定文件:${err.path}`})\n } else {\n // eslint-disable-next-line standard/no-callback-literal\n callback && callback({ code: 0, msg: err.message })\n }\n console.log(err)\n } else {\n var s = data.toString()\n let resultStr = ReadDevice.analyzeStr(s)\n var tmpdata = {code: 1, data: resultStr, originData: data.toString()}\n callback && callback(tmpdata)\n }\n })\n}", "function readTextFile(file) {\n var rawFile = new XMLHttpRequest();\n\n rawFile.open(\"GET\", file, false);\n rawFile.onreadystatechange = function () {\n\n if (rawFile.readyState === 4) {\n\n if (rawFile.status === 200 || rawFile.status == 0) {\n\n // Getting all text from file\n var allText = rawFile.responseText;\n var parents_objects = allText.split(\"\\n\");\n\n for (var i in parents_objects) {\n\n var properties = parents_objects[i].split(\",\");\n var parent_id = properties[0];\n var parent_status = properties[4];\n\n // If property is a parent\n if (parent_status == 1) {\n\n\n parent_object = new Object();\n parent_object[\"name\"] = properties[2];\n parent_object[\"description\"] = properties[3];\n parent_object[\"children\"] = Array();\n parent_object[\"isParent\"] = properties[4]; \n\n type = properties[1];\n\n\n for (var j in parents_objects) {\n\n var child_properties = parents_objects[j].split(\",\");\n var child_id = child_properties[0];\n var child_status = child_properties[4];\n\n if (child_id == parent_id && child_status == 0) {\n\n child_object = new Object();\n child_object[\"description\"] = child_properties[3];\n child_object[\"name\"] = child_properties[2];\n child_object[\"Money\"] = child_properties[5]; \n child_object[\"Health\"] = child_properties[6]; \n child_object[\"Happiness\"] = child_properties[7]; \n child_object.changeDay = true;\n child_object[\"isParent\"] = child_properties[4]; \n parent_object[\"children\"].push(child_object);\n }\n }\n if(type == 0){\n\n normalEvents.push(parent_object);\n\n } else if (type == 1){\n\n nurseryEvents.push(parent_object);\n \n } else if (type == 2){\n\n restaurantEvents.push(parent_object);\n\n } else if (type == 3){\n\n officeJobEvents.push(parent_object);\n\n } else if (type == 4){\n\n lowHealth.push(parent_object);\n\n } else if (type == 5){\n\n lowHappiness.push(parent_object);\n\n } else if (type == 6){\n\n carEvents.push(parent_object);\n\n }\n }\n }\n }\n }\n }\n rawFile.send(null);\n}", "function getJSONClient(filepath) {\n //Return a promise\n return new Promise(function(resolve, reject) {\n //Load a new level using xml request\n let request = new XMLHttpRequest();\n request.open('GET', filepath);\n request.responseType = 'json';\n request.onload = function() {\n //Once loaded, return the data\n let levelData = request.response;\n resolve(request.response);\n }\n request.send();\n });\n }", "function JsonTree (file) {\n let json = JSON.stringify(file);\n return new Promise((resolve, reject) => {\n fs.writeFile('jsonExport.json', json, function(err, data) {\n if (err) throw err;\n return resolve(console.log(\"JSON file create\"));\n });\n });\n}", "function readJSON ( filename, callback ) {\n\tfs.readFile ( filename , function ( err , filedata ) {\n\t\tif (err) {\n\t\t\tconsole.log( \"We have a problem broski :\" + err )\n\t\t}\n\t\tconsole.log(countryname)\n\t\tvar jsondata = JSON.parse( filedata )\n\n\t\tjsondata.forEach( function ( country ) {\n\t\t\tif ( country.name == countryname ) {\n// possibly client wants to output all the info from a country?\n\t\tconsole.log( \"Country: \" + country.name )\n\t\tconsole.log( \"Top Level Domain: \" + country.topLevelDomain ) // tld field is an array and may contain more tld's\n\t}\n})\n\t})\n}", "getJson() {\n\n // create the new XMLHttpRequest\n var xhr = new XMLHttpRequest();\n\n // setting up the request\n xhr.open('GET', JSON_PATH, false);\n\n // when the JSON loads, parse it into an object and pass into this.parseEvents()\n xhr.onload = () => {\n this.events = this.parseEvents(JSON.parse(xhr.responseText));\n };\n\n // send the request\n xhr.send();\n\n }", "_readFileTree(itemEntry) {\n return new Promise(resolve => {\n if (itemEntry.isFile) {\n itemEntry.file(file => {\n resolve(file);\n });\n } else if (itemEntry.isDirectory) {\n const dirReader = itemEntry.createReader();\n dirReader.readEntries(entries => {\n Promise.map(entries, entry => this._readFileTree(entry)).then(() => {\n resolve(_.flatten(arguments));\n });\n });\n }\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 load(jsonData)\n{\n tree = d3.layout.tree();\n\n stateCounter = treeHeight = 0;\n\n root = jsonData;\n root.x0 = viewerHeight / 2;\n root.y0 = 0;\n\n updateLayout(layout);\n update(root);\n document.getElementById(\"hv-output\").innerHTML = \"Visited States: \" + stateCounter + \"&emsp;Tree Height: \" + treeHeight;\n}", "function readJSONFile() {\n return JSON.parse(fs.readFileSync(\"db.json\"))[\"places\"];\n}", "readData(){\n try{\n this.myData= JSON.parse(fs.readFileSync('all.json').toString())\n if(!Array.isArray(this.myData)) throw new Error ('') \n }\n catch(e){\n this.myData=[]\n }\n}", "function readJSONfile() {\n let archivo = fs.readFileSync(\n path.join(__dirname, \"..\") + \"/data/users.json\"\n );\n let usuarios = JSON.parse(archivo);\n return usuarios;\n}", "function parseJson(file, next) {\n if (file.isNull() || file.isDirectory() || isBinary(file)) {\n next(null, file);\n return;\n }\n\n var str = file.contents.toString();\n define(file, 'originalContent', str);\n var json;\n\n Object.defineProperty(file, 'json', {\n configurable: true,\n enumerable: true,\n set: function(val) {\n json = val;\n },\n get: function() {\n return json || (json = JSON.parse(str));\n }\n });\n\n next(null, file);\n}", "function MakeTree(currFolder){\n\t\t// the beginning of current folder\n\t\tjsonText+=\"{\"+JSON.stringify(\"name\")+\":\"+JSON.stringify(currFolder.name);\n\t\tjsonText+=\",\"+JSON.stringify(\"fid\")+\":\"+JSON.stringify(currFolder.fid);\n\t\t\n\t\t// the end of current folder\n\t\tif(currFolder.fileChildren.length==0 && currFolder.folderChildren.length==0)\n\t\t\tjsonText+=\"}\";\n\t\t\t\n\t\t// if current folder has children\n\t\tif(currFolder.fileChildren.length>0 || currFolder.folderChildren.length>0)\n\t\t\tjsonText+=\",\"+JSON.stringify(\"children\")+\": [\";\n\t\t\t\n\t\t// extracts data from file children array\n\t\tfor (var i=0; i<currFolder.fileChildren.length; i++){\n\t\t\tjsonText+=JSON.stringify({\n\t\t\t\tname: currFolder.fileChildren[i].name, \n\t\t\t\tsize: currFolder.fileChildren[i].size, \n\t\t\t\ttype: currFolder.fileChildren[i].type,\n\t\t\t\tfid: currFolder.fileChildren[i].fid\n\t\t\t});\n\t\t\t\n\t\t\t// if current folder has more than one file child\n\t\t\tif(i!=currFolder.fileChildren.length-1)\n\t\t\t\tjsonText+=\",\";\n\t\t}\n\t\t\n\t\t// if current folder has any file or folder child\n\t\tif(currFolder.folderChildren.length>0 && currFolder.fileChildren.length>0){\n\t\t\tjsonText+=\",\";\n\t\t}\n\t\t\n\t\t// extracts data from folder children array\n\t\tfor (var i=0; i<currFolder.folderChildren.length; i++){\n\t\t\n\t\t\t\t// calls MakeTree on folder children\n\t\t\t\tMakeTree(currFolder.folderChildren[i]);\n\t\t\t\t\n\t\t\t\t// if current folder has more than one folder child\n\t\t\t\tif(i!=currFolder.folderChildren.length-1)\n\t\t\t\t\tjsonText+=\",\";\n\t\t}\n\t\t\n\t\t// the end of file/folder children array\n\t\tif(currFolder.fileChildren.length>0 || currFolder.folderChildren.length>0)\n\t\t\tjsonText+=\"]}\";\n\n\t}", "function readTrie() {\n var triePath = path.join(__dirname, './trie.json');\n if (fs.existsSync(triePath)) {\n // Read trie data from file (stored in case server restarts)\n const data = fs.readFileSync(triePath);\n var fileDataTrie = JSON.parse(data);\n trie = Object.setPrototypeOf(fileDataTrie, trieNode.prototype);\n console.log(\"Loading of previous trie done.\");\n } else {\n saveTrie();\n }\n}", "function loadJSON() {\n fetch(\"tasks.json\")\n .then(response => response.json())\n .then(myJson => {\n jsonData = myJson;\n createNewObject(myJson);\n });\n}", "function readJSONFile(reader, opts) {\n var str = readFirstChars(reader, 1000);\n var type = identifyJSONString(str, opts);\n var dataset, retn;\n if (type == 'geojson') { // consider only for larger files\n dataset = importGeoJSONFile(reader, opts);\n retn = {\n dataset: dataset,\n format: 'geojson'\n };\n } else {\n retn = {\n // content: cli.readFile(path, 'utf8')}\n content: reader.toString('utf8')\n };\n }\n reader.close();\n return retn;\n }", "static locationInfoFromJSON (inFilename) {\n let data = fs.readFileSync(inFilename, 'utf8')\n let tmpLocationInfo = JSON.parse(data)\n return tmpLocationInfo\n }", "function readJSON(filename, callback){\n // If a callback is provided, call it with error as the\n // first argument and result as the second argument,\n // then return `undefined`. If no callback is provided,\n // just return the promise.\n return readFile(filename, 'utf8')\n .then(JSON.parse)\n .nodeify(callback);\n}", "parseJSON(fileContents) {\n return JSON.parse(fileContents.Body.toString())\n }", "function JSONReader()\r\n{\r\n var jsonDoc = null;\r\n var varNodes = null;\r\n var curVars = null;\r\n this.jsonFilepath = null;\r\n var varsElementIdx = 0;\r\n\r\n this.load = function(jsonpath) {\r\n\r\n fileReader = new FileReader();\r\n this.jsonFilepath = uriFor(jsonpath);\r\n\r\n var url = fileReader.prepareUrl(this.jsonFilepath);\r\n // the xml http requester to fetch the page to include\r\n\r\n var requester;\r\n\t\tif(window.XMLHttpRequest) {\r\n requester = new XMLHttpRequest();\r\n }\r\n if (!requester) {\r\n throw new Error(\"Http requester object not initialized\");\r\n }\r\n\r\n requester.open(\"GET\", url, false); // synchron mode ! (we don't want selenium to go ahead)\r\n try {\r\n requester.send(null);\r\n } catch(e) {\r\n throw new Error(\"Error while fetching url '\" + url + \"' details: \" + e);\r\n }\r\n\r\n if ( requester.status != 200 && requester.status !== 0 ) {\r\n throw new Error(\"Error while fetching \" + url + \" server response has status = \" + requester.status + \", \" + requester.statusText );\r\n }\r\n\r\n xmlDoc = requester.responseText; // XMLDocument\r\n\r\n varNodes = jsonBlob2JsonArray(xmlDoc); // HTMLCollection\r\n\r\n if (varNodes == null || varNodes.length == 0) {\r\n throw new Error(\"A JSON element could not be loaded, or the file was empty.\");\r\n }\r\n\r\n curVars = 0;\r\n return varNodes;\r\n }\r\n\r\n this.EOF = function() {\r\n return (curVars == null || curVars >= varNodes.length);\r\n }\r\n\r\n this.next = function() {\r\n\r\n if (this.EOF()) {\r\n LOG.error(\"No more JSON elements to read after element #\" + varsElementIdx);\r\n return;\r\n }\r\n varsElementIdx++;\r\n \tkey = Object.keys(varNodes[curVars]);\r\n storedVars[key] = varNodes[curVars][key];\r\n// storedVars = varNodes[curVars]; // Bad idea to overwrite storedVars\r\n curVars++;\r\n }\r\n\r\n\r\n\tfunction jsonBlob2JsonArray(aJsonBlob) {\r\n\r\n\t\tvar aryJson = new Array();\r\n\t\tvar start = aJsonBlob.indexOf('{');\r\n\t\tvar end = aJsonBlob.indexOf('}');\r\n\t\tvar idx = 0;\r\n\t\twhile (start > -1) {\r\n\r\n\t\t\taryJson[idx] = JSON.parse(aJsonBlob.substring(start, end+1));\r\n\r\n\t\t\tstart = aJsonBlob.indexOf('{', (start+1));\r\n\t\t\tend = aJsonBlob.indexOf('}', (end+1));\r\n\r\n\t\t\tidx++;\r\n\r\n\t\t}\r\n\r\n\t\treturn aryJson;\r\n\t}\r\n}", "function returnLoadedJSON(pathName) {\n var file;\n loadJSON(function(response) {\n // Parse JSON string into object\n var actual_JSON = JSON.parse(response);\n file = actual_JSON;\n }, pathName);\n return file;\n}", "function loadJSON(path, success, error) {\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function () {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n if (xhr.status === 200) {\n if (success) success(JSON.parse(xhr.responseText));\n } else {\n if (error) error(xhr);\n }\n }\n };\n xhr.open(\"GET\", path, true);\n xhr.send();\n }", "getAllData() {\n return this.jsonFile;\n }", "function parse$a(context, file) {\n var message;\n\n if (stats$5(file).fatal) {\n return\n }\n\n if (context.treeIn) {\n debug$8('Not parsing already parsed document');\n\n try {\n context.tree = json$1(file.toString());\n } catch (error) {\n message = file.message(\n new Error('Cannot read file as JSON\\n' + error.message)\n );\n message.fatal = true;\n }\n\n // Add the preferred extension to ensure the file, when serialized, is\n // correctly recognised.\n // Only add it if there is a path — not if the file is for example stdin.\n if (file.path) {\n file.extname = context.extensions[0];\n }\n\n file.contents = '';\n\n return\n }\n\n debug$8('Parsing `%s`', file.path);\n\n context.tree = context.processor.parse(file);\n\n debug$8('Parsed document');\n}", "function _LoadJsonFile(Filename) {\n\tLogger.LogTrace(\"Loading JSON File [\" + Filename + \"]\");\n\treturn JSON.parse(npm_fs.readFileSync(Filename));\n\n}", "function readStudentsJSONFile(fileName) {\n let jsonString = fs.readFileSync(path.join(__dirname, fileName)).toString();\n let objs = JSON.parse(jsonString);\n console.log(objs)\n let students = objs.map(obj => new Student(obj.firstName, obj.lastName, obj.age, obj.grades));\n return students;\n}", "function loadJSON(callback) {\n let xobj = new XMLHttpRequest();\n xobj.overrideMimeType(\"application/json\");\n xobj.open('GET', filePath, true);\n xobj.onreadystatechange = function() {\n if (xobj.readyState == 4 && xobj.status == \"200\") {\n callback(xobj.responseText);\n }\n };\n xobj.send(null);\n}", "function readJson(jsonPath) {\n return fs.readFile(jsonPath).then(data => JSON.parse(data))\n}", "function loadJSON(callback, path) {\n\n var xmlObj = new XMLHttpRequest();\n xmlObj.overrideMimeType(\"application/json\");\n xmlObj.open('GET', path, false);\n xmlObj.onreadystatechange = function() {\n if (xmlObj.readyState == 4 && xmlObj.status == \"200\") {\n callback(xmlObj.responseText);\n }\n };\n xmlObj.send(null);\n}", "parse (json) {\n const references = []\n const parsed = [ JSON.parse(json) ]\n function visit (object, index, value) {\n if (typeof value == 'object' && value != null) {\n if (Array.isArray(value)) {\n switch (value[0]) {\n case '_reference':\n references.push({ object, index, path: value[1] })\n break\n case '_undefined':\n object[index] = void 0\n break\n case '_array':\n value.shift()\n default:\n for (let i = 0, I = value.length; i < I; i++) {\n visit(value, i, value[i])\n }\n }\n } else {\n for (const property in value) {\n visit(value, property, value[property])\n }\n }\n }\n }\n visit(parsed, 0, parsed[0])\n for (const { object, index, path } of references) {\n object[index] = get(parsed[0], path)\n }\n return parsed[0]\n }", "function injestJSONFile() {\n var file = fs.readFileSync(dbPath, \"utf-8\");\n return JSON.parse(file);\n}", "function parseJson(path) {\n if (!fs.existsSync(path)) {\n return {};\n }\n try {\n var content = fs.readFileSync(path);\n contentJson = JSON.parse(content);\n return contentJson;\n } catch (error) {\n log.error(error);\n console.log(error);\n return {};\n }\n}", "function readJsonFile(callback) {\n /* Return JSON object read from file into cache.\n Callback signature: (<error object>, <JSON object>)\n */\n console.log('Read JSON file ' + filePath);\n fs.readFile(filePath, 'utf8', (err, data) => {\n if (err) {\n console.log(err);\n return callback(err);\n } else {\n try {\n myJsonObj = JSON.parse(data);\n } catch(e) {\n return callback(e, null);\n }\n return callback(null, myJsonObj);\n }\n }); // end readFile callback\n}", "function readNewick(file) {\n tree = \"\";\n\n // Code to open file and read tree(s)...\n\n return tree;\n}", "function getJSONServer(filepath) {\n //Return a promise\n return new Promise(function(resolve, reject) {\n //Use jsonFile npm package to load the level\n jsonFile.readFile(filepath, function(err, obj) {\n if (err) {\n reject(err);\n }\n resolve(obj);\n });\n });\n }", "getJSON(){\n return require(\"../database/itemStructure.json\");\n }", "function readJSONFile() {\r\n return JSON.parse(fs.readFileSync(\"db.json\"))[\"ideas\"];\r\n}", "function readData(fileName){\n let dataRead = fs.readFileSync('./data/' + fileName + '.json');\n let infoRead = JSON.parse(dataRead);\n return infoRead;\n}", "function readJsonFile(fileName) {\n return JSON.parse(fs.readFileSync(fileName, 'utf8'));\n}", "loadData(callback){\n var fs = require('fs')\n var file = __dirname + '/../assets/data/templates.json'\n fs.readFile(file, 'utf8', (err, data) => {\n if (err){\n return callback(err)\n }\n else{\n return callback(undefined, JSON.parse(data))\n }\n })\n }", "function loadDefinitionsJSON()\n{\n\n var xobj = new XMLHttpRequest(); //Create a request object to get the data from the JSON File\n xobj.overrideMimeType(\"application/json\"); //Overide the deafult file type it is looking for to JSON\n xobj.open(\"GET\", defsJSONFile, true); //Give the name of our file (it is located locally) and tell it to load asynchronously\n //(while the rest of the code cannot function until code is loaded - sychronous requests are deprecated according to https://xhr.spec.whatwg.org/#the-open()-method)\n //We use GET as while POST more secure, GET is the only guaranteed method to work in all browsers\n //in current build - REVIEW WHEN MOVED TO FULL LIVE TESTING\n xobj.onreadystatechange = function () //What event listener activates when the task is done\n {\n if (xobj.readyState == 4 /*&& xobj.status == \"200\" I have removed this check now since the status will not change on local tests - RE-ENABLE ON LIVE TESTS*/) //If the the request is DONE(readyState) and OK(status)\n {\n parseDefinitions(xobj.responseText);\n }\n };\n xobj.send(null); //Send a null to the request to complete the transaction\n}", "function openJsonFile(fHandler, readCallback) {\r\n \t\r\n \t\ttry {\r\n m_type=fHandler.type;\r\n m_size=fHandler.size;\r\n m_name=fHandler.name;\r\n \r\n var fReader = new FileReader();\r\n \r\n fReader.onerror = function (e){\r\n \t \r\n \t if (debug && console){\r\n \t\t console.log(\"Error code %s\", e.target.error.code);\r\n \t }\r\n \r\n m_error=e.target.error;\r\n };\r\n \r\n fReader.onload = readCallback;\r\n \r\n fReader.readAsText(fHandler, m_codification);\r\n \r\n if (debug && console){\r\n \tconsole.log(\"FileHandler, file type: \"+ fHandler.type);\r\n }\r\n } catch(e) {\r\n console.error(e);\r\n m_error=e.message;\r\n alert(e);\r\n return false;\r\n }\r\n \r\n return true;\r\n }", "function parseJSON () {\n var process = new Process (packagesfile);\n packages = process.parse ();\n packages = packages.packages;\n }", "function loadJSON(fileUrl) {\n // Declare our xhr object\n const xhr = new XMLHttpRequest();\n // Set up the callback for our successful request\n xhr.onload = function() {\n // Parse the JSON\n arry = JSON.parse(xhr.responseText);\n console.log(arry);\n renderAll(arry);\n };\n // Open the request\n xhr.open('GET', fileUrl, true);\n // Send the request\n xhr.send();\n}", "function jsonFileReader(filepath) {\n let configFile = JSON.parse(fs.readFileSync(filepath, \"utf8\"));\n return configFile;\n }", "function reader (filename,callback){\n\n\tfs.readFile(filename, function (err, data) {\n\t\tif (err) {\n\t\t\tthrow err;\n\t\t}\n\t\t\n\t\tvar parsedText = JSON.parse(data)\n\n\t\tcallback(parsedText);\n\t});\n\n}", "function loadFromJSON(json, CMIElement) {\n if (!_self.isNotInitialized()) {\n console.error(\"loadFromJSON can only be called before the call to Initialize.\");\n return;\n }\n\n CMIElement = CMIElement || \"cmi\";\n\n for (var key in json) {\n if (json.hasOwnProperty(key) && json[key]) {\n var currentCMIElement = CMIElement + \".\" + key;\n var value = json[key];\n\n if (value[\"childArray\"]) {\n for (var i = 0; i < value[\"childArray\"].length; i++) {\n _self.loadFromJSON(value[\"childArray\"][i], currentCMIElement + \".\" + i);\n }\n } else if (value.constructor === Object) {\n _self.loadFromJSON(value, currentCMIElement);\n } else {\n setCMIValue(currentCMIElement, value);\n }\n }\n }\n }", "function loadJSON(path, success, error){\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function()\n {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n if (xhr.status === 200) {\n if (success)\n success(JSON.parse(xhr.responseText));\n } else {\n if (error)\n error(xhr);\n }\n }\n };\n xhr.open(\"GET\", path, true);\n xhr.send();\n}", "function getTreeData() {\n\tnew Promise((resolve, reject) => {\n\t\t\tutil.getData(srcPath, resolve, reject, 1, rules)\n\t\t})\n\t\t.then(arr => start(arr))\n\t\t.catch(err => console.error(err))\n}", "function loadJSON(path, success, error) {\n const xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n if (xhr.status === 200) {\n success(JSON.parse(xhr.responseText));\n } else {\n error(xhr);\n }\n }\n };\n xhr.open(\"GET\", path, true);\n xhr.send();\n}", "function loadJSON(path, success, error) {\n let request = new XMLHttpRequest();\n request.onreadystatechange = function () {\n if (request.readyState === XMLHttpRequest.DONE) {\n if (request.status === 200) {\n if (success) success(JSON.parse(request.responseText));\n } else {\n if (error) error(request);\n }\n }\n };\n request.open(\"GET\", path, true);\n request.send();\n}", "loadFromJson(data) {\n // TODO: Load this object from the data\n const parsedState = JSON.parse(data);\n parsedState.categories.forEach((category, index) => {\n this.setCategory(category, index);\n });\n parsedState.toDoList.forEach(todo => {\n if (todo.text) {\n this.pushTodo(new Note(todo.text, todo.completed));\n } else if (todo.title) {\n this.pushTodo(new Task(todo.title, todo.categoryIndex, todo.description, todo.completed));\n }\n });\n }", "function loadNodeDataFields(jsonData)\n{\n}", "function projectJsonLoaded(data) {\n project = data;\n if(typeof project == 'string') project = JSON.parse(project);\n georeferences = project.georeferences;\n for(var i in project.levels) {\n\tif(!routingId) routingId = project.levels[i].source;\n levelLoadFunction(project, i)(); \n }\n }", "readFile(path, ejsonParseOptions) {\n const fileExtension = path_1.extname(path);\n if (fileExtension !== '.json') {\n return importFresh(path);\n }\n const content = fs_1.readFileSync(path, 'utf-8');\n return bson_1.EJSON.parse(content, ejsonParseOptions);\n }", "function readTestDataJSON (file) {\n try {\n console.log(\"attempting to read file\", file);\n return JSON.parse(readFileSync(file, 'utf8'));\n } catch(error) {\n console.log(error);\n throw new Error(`file ${file} cannot be read. It must be available as a requirement to run this script`);\n }\n}", "function readFile() {\n const fs = require(\"fs\");\n fs.readFile(\"src/database.json\", \"utf8\", (err, jsonString) => {\n //error checkign to make sure that the database is read correctly\n if (err) {\n //This line will print if an error occurs\n console.log(\"Error reading file from disk:\", err);\n return;\n }\n // the try catch method is used as an error prevention method. The code\n // in the 'try' section is run and if errors occur then the 'catch'\n // code is run\n try {\n // create an array of objects which will be each country\n var countries = JSON.parse(jsonString);\n //loop through each country\n countries.forEach(function (country) {\n //------------------------------------------------------------------------\n // TASK 2 and 3\n // you may want to create a seperate function and simply call that function here\n //------------------------------------------------------------------------\n });\n } catch (err) {\n console.log(\"Error parsing JSON string:\", err);\n }\n });\n}", "function loadJSON(path, args) {\n var request = issueRequest(path, 'json', args, false);\n request.done(function (result) {\n $.extend(rootObject, result);\n });\n return request;\n }", "function getJSON(file){\n reader.onload = function (file) {\n var obj = JSON.parse(file.target.result);\n for(var i = 0; i < obj.Result.length; i++)\n appendToScreen(obj.Result[i].title, obj.Result[i].url, obj.Result[i].description);\n };\n reader.readAsText(file);\n}", "readFile(fileName) {\n let data = {}\n data = JSON.parse(fs.readFileSync(fileName))\n return data\n }", "handleFileSelect(evt) {\n let files = evt.target.files;\n if (!files.length) {\n alert('No file select');\n return;\n }\n let file = files[0];\n let that = this;\n let reader = new FileReader();\n\n //Se asigna la función que se realiza al cargar el archivo\n reader.onload = function (e) {\n that.cargaJson(e.target.result);\n };\n reader.readAsText(file);\n }", "function readJSONFile(file)\n{ var allText\n var rawFile = new XMLHttpRequest();\n rawFile.open(\"GET\", file, false);\n rawFile.onreadystatechange = function ()\n {\n if(rawFile.readyState === 4)\n {\n if(rawFile.status === 200 || rawFile.status == 0)\n {\n allText = rawFile.responseText;\n }\n }\n }\n rawFile.send(null);\n return allText;\n}", "function readTree(){\n\n\t//assign node ids 0 through numNodes-1 for the dynamic\n\t//calculation of the network values\n\n\t//create and array for all of the nodes in the tree\n\tvar nodeList = [];\n\tvar nodeHash = {};\n\tvar tempNode;\n\n\t//create the root of the tree\n\tvar theRoot = new Node(data.numNodes - 1, data.nodeLabels[0], data.vals[0],\n\t\t\tdata.coords[0], getNeighbors(data.probBtwNodes, data.nodeLabels[0]));\n\n\tnodeList[data.numNodes - 1] = theRoot;\n\tnodeHash[theRoot.nodeLabel] = theRoot;\n\n\t//create the other nodes of the tree\n\tfor(var i = 1; i<data.nodeLabels.length; i++){\n\t\tvar neighbors = getNeighbors(data.probBtwNodes, data.nodeLabels[i]);\n\t\tvar nodeId = i - 1;\n\t\ttempNode = new Node(nodeId, data.nodeLabels[i], data.vals[i],\n\t\t\tdata.coords[i], neighbors);\n\t\tnodeHash[tempNode.nodeLabel] = tempNode;\n\t\tnodeList[nodeId] = tempNode;\n\t}\n\n\t//create the tree from the given data\n\tvar theTree = new Tree(data.numNodes, nodeList, nodeHash,\n\t\tdata.probBtwNodes, theRoot);\n\n\t//make sure the tree is valid\n\tvar validTree = checkTree(theTree);\n\n\n\tif(validTree === \"true\"){\n\t\t\n\t\triverNetwork = theTree;\n\t\tcomputeNetworkValueGeneral(theTree);\n\n\t\t//create the new d3 tree\n\t\troot = JSON.parse(createD3Tree(null,riverNetwork.root));\n\t}\n\telse{\n\n\t\t//if the tree is not valid show an alert message\n\t\twindow.alert(validTree);\n\t}\n}", "function json(target, relative) {\n return JSON.parse(read(target, relative));\n}", "async function loadJSON(path,callback) {\n var xobj = new XMLHttpRequest();\n xobj.overrideMimeType(\"application/json\");\n xobj.open('GET', path, true);\n xobj.onreadystatechange = function () {\n if (xobj.readyState == 4 && xobj.status == \"200\") {\n callback(xobj.responseText);\n }\n };\n xobj.send(null);\n}" ]
[ "0.6572153", "0.65009516", "0.6308541", "0.61559", "0.61420316", "0.61404717", "0.61236334", "0.6120686", "0.6035825", "0.602176", "0.60080594", "0.5985651", "0.59769535", "0.5930707", "0.5927374", "0.5911211", "0.5899703", "0.5881785", "0.5860038", "0.5838828", "0.5835717", "0.5835548", "0.5823389", "0.5796389", "0.5790565", "0.57735246", "0.5771519", "0.5763221", "0.5762732", "0.5753837", "0.5752299", "0.57439643", "0.57387763", "0.57180077", "0.56962186", "0.5690181", "0.56837964", "0.56689274", "0.56668717", "0.5665831", "0.566346", "0.56566066", "0.56548977", "0.56458175", "0.56311005", "0.5618158", "0.55945337", "0.55937845", "0.5589458", "0.55872905", "0.5581727", "0.55784136", "0.557672", "0.55723345", "0.5554639", "0.55524325", "0.555129", "0.5550805", "0.5549931", "0.55397224", "0.55392194", "0.55382186", "0.5537691", "0.55373234", "0.55364686", "0.55327654", "0.5527715", "0.55231345", "0.5519037", "0.5517446", "0.55114627", "0.5510804", "0.55046225", "0.5498618", "0.54981685", "0.5496988", "0.54966116", "0.54917336", "0.5487467", "0.54804385", "0.5479069", "0.5477239", "0.545899", "0.5451196", "0.5448834", "0.54482883", "0.54455537", "0.54440755", "0.54435784", "0.54409045", "0.5438458", "0.54355097", "0.54345363", "0.54324526", "0.54312795", "0.54173464", "0.5404065", "0.54027927", "0.54017484", "0.53988814" ]
0.62460554
3
Method for utilizing the project graph in schematics
function getProjectGraphFromHost(host) { return project_graph_1.onlyWorkspaceProjects(getFullProjectGraphFromHost(host)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeSceneGraph() {\n\n //\n // Define Scene Graph\n //\n roomPositionNode = new Node();\n\n tablePositionNode = new Node();\n tablePositionNode.localMatrix = utils.MakeTranslateMatrix(-650, -715, -250.0); // Relative position to room\n\n shelfPositionNode = new Node();\n shelfPositionNode.localMatrix = utils.MakeTranslateMatrix(100, -75, -800); // Relative position to room\n\n pipePositionNode = new Node();\n pipePositionNode.localMatrix = utils.MakeTranslateMatrix(-1415.0, 100, 0.0); // Relative to room\n\n ventPositionNode = new Node();\n ventPositionNode.localMatrix = utils.MakeTranslateMatrix(890, -560.0, 550.0); // Relative to room\n\n posterPositionNode = new Node();\n posterPositionNode.localMatrix = utils.MakeTranslateMatrix(-910, 90.0, -950.0); // Relative to room\n \n cratesCentralPositionNode = new Node();\n cratesCentralPositionNode.localMatrix = utils.MakeTranslateMatrix(470, -950, -550); // Relative to room\n\n crateRightPositionNode = new Node();\n crateRightPositionNode.localMatrix = utils.MakeTranslateMatrix(180, 0, 0); \n \n crateLeftPositionNode = new Node();\n crateLeftPositionNode.localMatrix = utils.MakeTranslateMatrix(-170, 0, 0);\n\n crateTopPositionNode = new Node();\n crateTopPositionNode.localMatrix = utils.MakeTranslateMatrix(0, 260, 0);\n\n shortPipeOnePositionNode = new Node();\n shortPipeOnePositionNode.localMatrix = utils.MakeTranslateMatrix(0.0, 0.0, 70);\n \n shortPipeTwoPositionNode = new Node();\n shortPipeTwoPositionNode.localMatrix = utils.MakeTranslateMatrix(0.0, 0.0, -70);\n\n pedestalOnePositionNode = new Node();\n pedestalOnePositionNode.localMatrix = utils.MakeTranslateMatrix(-215.0, 0.0, -25.0); // Relative position to table\n\n boatOnePositionNode = new Node();\n boatOnePositionNode.localMatrix = utils.MakeTranslateMatrix(0.0, 65.0, 0.0); // Floating over pedestal\n\n pedestalTwoPositionNode = new Node();\n pedestalTwoPositionNode.localMatrix = utils.MakeTranslateMatrix(215.0, 0.0, -25.0); // Relative position to table\n\n boatTwoPositionNode = new Node();\n boatTwoPositionNode.localMatrix = utils.MakeTranslateMatrix(0.0, 65.0, 0.0); // Floating over pedestal\n\n pedestalThreePositionNode = new Node();\n pedestalThreePositionNode.localMatrix = utils.MakeTranslateMatrix(-245.0, 190.0, -5.0); // Relative position to table\n\n boatThreePositionNode = new Node();\n boatThreePositionNode.localMatrix = utils.MakeTranslateMatrix(0.0, 65.0, 0.0); // Floating over pedestal\n\n pedestalFourPositionNode = new Node();\n pedestalFourPositionNode.localMatrix = utils.MakeTranslateMatrix(245.0, 190.0, -5.0); // Relative position to table\n\n boatFourPositionNode = new Node();\n boatFourPositionNode.localMatrix = utils.MakeTranslateMatrix(0.0, 65.0, 0.0); // Floating over pedestal\n\n // The null values in drawInfo will be assigned in runtime.\n roomNode = new Node();\n roomNode.localMatrix = utils.multiplyMatrices(utils.MakeScaleMatrix(950), utils.MakeRotateXYZMatrix(270, 90, 0))\n roomNode.drawInfo = {\n name: 'room',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: roomTextureSrc,\n textureRef: [],\n }\n\n tableNode = new Node();\n tableNode.localMatrix = utils.MakeScaleMatrix(5.5);\n tableNode.drawInfo = {\n name: 'table',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: tableTextureSrc,\n textureRef: [],\n }\n\n shelfNode = new Node();\n shelfNode.localMatrix = utils.MakeScaleMatrix(3);\n shelfNode.drawInfo = {\n name: 'shelf',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: shelfTextureSrc,\n textureRef: [],\n }\n\n posterNode = new Node();\n posterNode.localMatrix = utils.multiplyMatrices(utils.MakeScaleMatrix(95), utils.MakeRotateXYZMatrix(90, 0.0, 0.0));\n posterNode.drawInfo = {\n name: 'poster',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: posterTextureSrc,\n textureRef: [],\n }\n\n ventNode = new Node();\n ventNode.localMatrix = utils.multiplyMatrices(utils.MakeScaleMatrix(4), utils.MakeRotateXYZMatrix(180, 0, 90));\n ventNode.drawInfo = {\n name: 'vent',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: ventTextureSrc,\n textureRef: [],\n }\n\n crateRightNode = new Node();\n crateRightNode.localMatrix = utils.multiplyMatrices(utils.MakeScaleMatrix(275), utils.MakeRotateXYZMatrix(-3, 0, 0));\n crateRightNode.drawInfo = {\n name: 'crate',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: crateTextureSrc,\n textureRef: [],\n }\n\n crateLeftNode = new Node();\n crateLeftNode.localMatrix = utils.multiplyMatrices(utils.MakeScaleMatrix(275), utils.MakeRotateXYZMatrix(9, 0, 0));\n crateLeftNode.drawInfo = {\n name: 'crate',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: crateTextureSrc,\n textureRef: [],\n }\n\n crateTopNode = new Node();\n crateTopNode.localMatrix = utils.multiplyMatrices(utils.MakeScaleMatrix(275), utils.MakeRotateXYZMatrix(99, 0, 0));\n crateTopNode.drawInfo = {\n name: 'crate',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: crateTextureSrc,\n textureRef: [],\n }\n\n pipeNode = new Node();\n pipeNode.localMatrix = utils.multiplyMatrices(utils.MakeScaleMatrix(5), utils.MakeRotateXYZMatrix(0, 90, 90));\n pipeNode.drawInfo = {\n name: 'pipe',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: pipesTextureSrc,\n textureRef: [],\n }\n\n shortPipeOneNode = new Node();\n shortPipeOneNode.localMatrix = utils.multiplyMatrices(utils.MakeScaleMatrix(5), utils.MakeRotateXYZMatrix(0, 90, 90));\n shortPipeOneNode.drawInfo = {\n name: 'shortPipe',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: pipesTextureSrc,\n textureRef: [],\n }\n \n shortPipeTwoNode = new Node();\n shortPipeTwoNode.localMatrix = utils.multiplyMatrices(utils.MakeScaleMatrix(5), utils.MakeRotateXYZMatrix(0, 90, 90));\n shortPipeTwoNode.drawInfo = {\n name: 'shortPipe',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: pipesTextureSrc,\n textureRef: [],\n }\n\n pedestalOneNode = new Node();\n pedestalOneNode.localMatrix = utils.MakeScaleMatrix(6.5);\n pedestalOneNode.drawInfo = {\n name: 'pedestal',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: pedestalTextureSrc,\n textureRef: [],\n }\n\n boatOneNode = new Node();\n defaultBoatOneLocalMatrix = boatOneNode.localMatrix = utils.MakeScaleMatrix(0.25);\n boatOneNode.drawInfo = {\n name: 'boatOne',\n programInfo: programOne,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: boatTextureSrc,\n textureRef: [],\n };\n\n pedestalTwoNode = new Node();\n pedestalTwoNode.localMatrix = utils.MakeScaleMatrix(6.5);\n pedestalTwoNode.drawInfo = {\n name: 'pedestal',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: pedestalTextureSrc,\n textureRef: [],\n }\n\n boatTwoNode = new Node();\n defaultBoatTwoLocalMatrix = boatTwoNode.localMatrix = utils.MakeScaleMatrix(0.25);\n boatTwoNode.drawInfo = {\n name: 'boatTwo',\n programInfo: programTwo,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: boatTextureSrc,\n textureRef: [],\n };\n \n pedestalThreeNode = new Node();\n pedestalThreeNode.localMatrix = utils.MakeScaleMatrix(6.5);\n pedestalThreeNode.drawInfo = {\n name: 'pedestal',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: pedestalTextureSrc,\n textureRef: [],\n }\n\n boatThreeNode = new Node();\n defaultBoatThreeLocalMatrix = boatThreeNode.localMatrix = utils.MakeScaleMatrix(0.25);\n boatThreeNode.drawInfo = {\n name: 'boatThree',\n programInfo: programThree,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: boatTextureSrc,\n textureRef: [],\n };\n \n pedestalFourNode = new Node();\n pedestalFourNode.localMatrix = utils.MakeScaleMatrix(6.5);\n pedestalFourNode.drawInfo = {\n name: 'pedestal',\n programInfo: program,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: pedestalTextureSrc,\n textureRef: [],\n }\n\n boatFourNode = new Node();\n defaultBoatFourLocalMatrix = boatFourNode.localMatrix = utils.MakeScaleMatrix(0.25);\n boatFourNode.drawInfo = {\n name: 'boatFour',\n programInfo: programFour,\n // Locations\n positionAttributeLocation: null,\n normalAttributeLocation: null,\n uvLocation: null,\n matrixLocation: null,\n textLocation: null,\n normalMatrixPositionHandle: null,\n vertexArray: null,\n vertexMatrixPositionHandle: null,\n eyePositionHandle: null,\n // Model info\n vertices: null,\n normals: null,\n texCoord: null,\n indices: null,\n textureSrc: boatTextureSrc,\n textureRef: [],\n };\n\n // Creaing the gererchy\n roomNode.setParent(roomPositionNode);\n\n // Foreground\n tablePositionNode.setParent(roomPositionNode);\n tableNode.setParent(tablePositionNode);\n // Boat 1\n pedestalOnePositionNode.setParent(tablePositionNode);\n pedestalOneNode.setParent(pedestalOnePositionNode);\n boatOnePositionNode.setParent(pedestalOnePositionNode);\n boatOneNode.setParent(boatOnePositionNode);\n // Boat 2\n pedestalTwoPositionNode.setParent(tablePositionNode);\n pedestalTwoNode.setParent(pedestalTwoPositionNode);\n boatTwoPositionNode.setParent(pedestalTwoPositionNode);\n boatTwoNode.setParent(boatTwoPositionNode);\n\n // Background\n shelfPositionNode.setParent(roomPositionNode);\n shelfNode.setParent(shelfPositionNode);\n // Boat 3\n pedestalThreePositionNode.setParent(shelfPositionNode);\n pedestalThreeNode.setParent(pedestalThreePositionNode);\n boatThreePositionNode.setParent(pedestalThreePositionNode);\n boatThreeNode.setParent(boatThreePositionNode);\n // Boat 4\n pedestalFourPositionNode.setParent(shelfPositionNode);\n pedestalFourNode.setParent(pedestalFourPositionNode);\n boatFourPositionNode.setParent(pedestalFourPositionNode);\n boatFourNode.setParent(boatFourPositionNode);\n\n // Scenary\n // Central pipe\n pipePositionNode.setParent(roomPositionNode);\n pipeNode.setParent(pipePositionNode);\n // Side Pipes\n shortPipeOnePositionNode.setParent(pipePositionNode);\n shortPipeOneNode.setParent(shortPipeOnePositionNode);\n shortPipeTwoPositionNode.setParent(pipePositionNode);\n shortPipeTwoNode.setParent(shortPipeTwoPositionNode);\n // Vent\n ventPositionNode.setParent(roomPositionNode);\n ventNode.setParent(ventPositionNode);\n // Crates\n cratesCentralPositionNode.setParent(roomPositionNode);\n crateRightPositionNode.setParent(cratesCentralPositionNode);\n crateRightNode.setParent(crateRightPositionNode);\n crateLeftPositionNode.setParent(cratesCentralPositionNode);\n crateLeftNode.setParent(crateLeftPositionNode);\n crateTopPositionNode.setParent(cratesCentralPositionNode);\n crateTopNode.setParent(crateTopPositionNode);\n // Poster\n posterPositionNode.setParent(roomPositionNode);\n posterNode.setParent(posterPositionNode);\n\n objects = [\n roomNode,\n tableNode,\n shelfNode,\n ventNode,\n pipeNode,\n crateRightNode,\n crateLeftNode,\n crateTopNode,\n posterNode,\n shortPipeOneNode,\n shortPipeTwoNode,\n pedestalOneNode,\n boatOneNode,\n pedestalTwoNode,\n boatTwoNode,\n pedestalThreeNode,\n boatThreeNode,\n pedestalFourNode,\n boatFourNode\n ];\n\n //---------------SceneGraph defined\n}", "function Graph_setup () { }", "function projectConstruction() {\n $(\".models canvas\").wrap(\"<div class='project-link'>\");\n\n $(\".project\").each(function(i, el) {\n $(\".project-link:nth-of-type(\"+(i+1)+\")\")\n .append(\"<span>\"+('0' + (i+1)).slice(-2)+\"</small>\")\n .append(\"<h2>\"+$(el).find(\"h1\").text()+\"</h2>\")\n .append(\"<small>\"+$(el).data(\"description\")+\"</small>\")\n .prepend(\"<svg class='frame' fill='transparent' viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><circle cx='100' cy='100' r='100'/></svg>\")\n .addClass($(el).data(\"name\"));\n })\n\n for ( i = 0; i < projects; i++) {\n $(\".circle-progress-bullets\").prepend(\"<div class='bullet-project'><span></span></div>\");\n }\n\n $(\".circle-progress-bullets .bullet-project\").each(function(i, el) {\n TweenMax.set($(el), { rotation: 360 / projects * i })\n })\n\n fractureText();\n}", "function main_graph() \r\n{\r\n g = new Graph();\r\n // g1 = new Graph();\r\n // g2 = new Graph();\r\n // g3 = new Graph();\r\n g.label = \"Exercise 8.4: 1 (Levitin, 3rd edition)\";\r\n \r\n //g.digraph = true;\r\n g1.digraph = true;\r\n \r\n g.readGraph(_v,_e);\r\n // g1.readGraph(_v2,_e2);\r\n // g2.readGraph(_v3,_e3);\r\n // g3.readGraph(_v4,_e4);\r\n // Exercise 8.4: 1 \r\n\r\n g.printGraph();\r\n \r\n //g.componentInfo();\r\n\r\n g.topoSearch(g.dfs);\r\n document.write(\"<p>\",\"dfs_push: \",g.dfs_push,\"</p>\");\r\n \r\n g.componentInfo();\r\n \r\n\r\n /*document.write(\"<p>\",\"TC matrix by DFS:\",\"</p>\"); \r\n\tg.dfsTC();\r\n for ( var i=0; i < g.tc.length;i++)\r\n\t{\r\n document.write(\"<p>\",g.tc[i],\"</p>\"); \r\n }*/\r\n\r\n\r\n document.write(\"<p>\",\"TC matrix by Warshall-Floyd:\",\"</p>\"); \r\n \r\n g.warshallFloyd();\r\n for ( var i=0; i < g.tc.length;i++)\r\n\t{\r\n document.write(\"<p>\",g.tc[i],\"</p>\"); \r\n }\r\n \r\n\r\n /* document.write(\"<p>\",\"DAG: \",g.isDAG(),\"</p>\"); \r\n \r\n // Exercise 8.4: 7 \r\n\r\n document.write(\"<p>\",\"TC matrix by Warshall-Floyd Exercise 8.4: 7\",\"</p>\"); \r\n g1.warshallFloyd();\r\n for ( var i=0; i < g1.tc.length;i++)\r\n\t{\r\n document.write(\"<p>\",g1.tc[i],\"</p>\"); \r\n }*/\r\n\r\n\r\n if( g.weighted)\r\n {\r\n document.write(\"<p>\",\"Distance matrix Exercise 8.4: 7 \",\"</p>\"); \r\n for ( var i=0; i < g.dist.length;i++)\r\n {\r\n document.write(\"<p>\",g.dist[i],\"</p>\"); \r\n }\r\n }\r\n\r\n // document.write(\"<p>\",\"DAG Exercise 8.4: 7 \",\"</p>\"); \r\n // document.write(\"<p>\",g1.isDAG(),\"</p>\"); \r\n \r\n // MST for KSA 12 cities \r\n /* var total = 0;\r\n if (g2.weighted)\r\n {\r\n document.write(\"<p>\",\"MST for KSA 12 cities\",\"</p>\"); \r\n g2.prim();\r\n for ( var i=0; i < g2.spainning_tree.length;i++)\r\n {\r\n document.write(\"<p>\",\"PATH\",\"{\",i+1,\"}\",\" : \",\"{\",g2.spainning_tree[i].v.label,\",\",g2.spainning_tree[i].u.label,\"} - PATH COST = \",g2.spainning_tree[i].w,\r\n \" Km\",\"</p>\"); \r\n total+= g2.spainning_tree[i].w;\r\n }\r\n document.write(\"<p>\",\"THE SHORTEST PATH AMONG ALL CITIES IS : \",total,\" Km\",\"</p>\");\r\n\r\n }*/\r\n\r\n \r\n if (g.weighted)\r\n {\r\n g.dijkstra(0);\r\n document.write(\" The Shortest paths strart from vertex: \",0,\" {\",g.vert[0].label,\"}\");\r\n for ( var i= 1; i < g.vt.length ;i++ )\r\n { \r\n document.write(\"<p>\",showPath( i, 0,parent),\"PATH{\",i,\"}: from \",g.vert[0].label,\" to \",g.vt[i].target.label,\": with distance \",g.vt[i].distance,\"</p>\");\r\n }\r\n }\r\n\r\n if (g.weighted)\r\n {\r\n g.makeDistMatDijk();\r\n document.write(\"<p>\",\"Distance matrix from Dijkstra \",\"</p>\"); \r\n for ( var i=0; i < g.dist.length;i++)\r\n {\r\n document.write(\"<p>\",g.dist[i],\"</p>\"); \r\n }\r\n }\r\n \r\n \r\n \r\n}", "function init() {\n var $ = go.GraphObject.make;\t// for conciseness in defining templates\n \n //add custom predefined shape for undeveloped goal element\n go.Shape.defineFigureGenerator(\"RectDiamond\", function(shape, w, h) {\n var geo = new go.Geometry();\n \n //rectengle\n var fig = new go.PathFigure(0, 0, true);\n fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));\n fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.7 * h));\n fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.7 * h).close());\n geo.add(fig);\n\n //diamond\n var fig2 = new go.PathFigure(0.5 * w, 0.7 * h);\n fig2.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.85 * h));\n fig2.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));\n fig2.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.85 * h).close());\n geo.add(fig2);\n\n //add more space for avoid text overlap with image border\n geo.spot1 = new go.Spot(0, 0, 0, 0);\n geo.spot2 = new go.Spot(1, 1, 0, -15);\n\n return geo;\n });\n\n //add custom predefined shape for dependent goal element\n go.Shape.defineFigureGenerator(\"DependentGoal\", function(shape, w, h) {\n var geo = new go.Geometry();\n \n //outer rectengle\n var fig = new go.PathFigure(0, 0, true);\n fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));\n fig.add(new go.PathSegment(go.PathSegment.Line, w, h));\n fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());\n geo.add(fig);\n \n //inner rectengle\n var fig2 = new go.PathFigure(0.05 * w, 0.1 * h, true);\n fig2.add(new go.PathSegment(go.PathSegment.Line, 0.95 * w, 0.1 * h));\n fig2.add(new go.PathSegment(go.PathSegment.Line, 0.95 * w, 0.9 * h));\n fig2.add(new go.PathSegment(go.PathSegment.Line, 0.05 * w, 0.9 * h).close());\n geo.add(fig2);\n \n return geo;\n });\n \n\n\n myDiagram =\n $(go.Diagram, \"myDiagramDiv\",\t// must name or refer to the DIV HTML element\n {\n grid: $(go.Panel, \"Grid\",\n $(go.Shape, \"LineH\", { stroke: \"lightgray\", strokeWidth: 0.5 }),\n $(go.Shape, \"LineH\", { stroke: \"gray\", strokeWidth: 0.5, interval: 10 }),\n $(go.Shape, \"LineV\", { stroke: \"lightgray\", strokeWidth: 0.5 }),\n $(go.Shape, \"LineV\", { stroke: \"gray\", strokeWidth: 0.5, interval: 10 })\n ),\n allowDrop: true,\t// must be true to accept drops from the Palette\n \"draggingTool.dragsLink\": true,\n \"draggingTool.isGridSnapEnabled\": true,\n \"linkingTool.isUnconnectedLinkValid\": true,\n \"linkingTool.portGravity\": 20,\n \"relinkingTool.isUnconnectedLinkValid\": true,\n \"relinkingTool.portGravity\": 20,\n \"relinkingTool.fromHandleArchetype\":\n $(go.Shape, \"Diamond\", { segmentIndex: 0, cursor: \"pointer\", desiredSize: new go.Size(8, 8), fill: \"tomato\", stroke: \"darkred\" }),\n \"relinkingTool.toHandleArchetype\":\n $(go.Shape, \"Diamond\", { segmentIndex: -1, cursor: \"pointer\", desiredSize: new go.Size(8, 8), fill: \"darkred\", stroke: \"tomato\" }),\n \"linkReshapingTool.handleArchetype\":\n $(go.Shape, \"Diamond\", { desiredSize: new go.Size(7, 7), fill: \"lightblue\", stroke: \"deepskyblue\" }),\n rotatingTool: $(TopRotatingTool),\t// defined below\n \"rotatingTool.snapAngleMultiple\": 15,\n \"rotatingTool.snapAngleEpsilon\": 15,\n \"undoManager.isEnabled\": true\n });\n\n // when the document is modified, add a \"*\" to the title and enable the \"Save\" button\n myDiagram.addDiagramListener(\"Modified\", function(e) {\n var button = document.getElementById(\"SaveButton\");\n if (button) button.disabled = !myDiagram.isModified;\n var idx = document.title.indexOf(\"*\");\n if (myDiagram.isModified) {\n if (idx < 0) document.title += \"*\";\n } else {\n if (idx >= 0) document.title = document.title.substr(0, idx);\n }\n });\n\n // Define a function for creating a \"port\" that is normally transparent.\n // The \"name\" is used as the GraphObject.portId, the \"spot\" is used to control how links connect\n // and where the port is positioned on the node, and the boolean \"output\" and \"input\" arguments\n // control whether the user can draw links from or to the port.\n function makePort(name, spot, output, input) {\n // the port is basically just a small transparent square\n return $(go.Shape, \"Circle\",\n {\n fill: null,\t// not seen, by default; set to a translucent gray by showSmallPorts, defined below\n stroke: null,\n desiredSize: new go.Size(7, 7),\n alignment: spot,\t// align the port on the main Shape\n alignmentFocus: spot,\t// just inside the Shape\n portId: name,\t// declare this object to be a \"port\"\n fromSpot: spot, toSpot: spot,\t// declare where links may connect at this port\n fromLinkable: output, toLinkable: input,\t// declare whether the user may draw links to/from here\n cursor: \"pointer\"\t// show a different cursor to indicate potential link point\n });\n }\n\n var nodeSelectionAdornmentTemplate =\n $(go.Adornment, \"Auto\",\n $(go.Shape, { fill: null, stroke: \"deepskyblue\", strokeWidth: 1.5, strokeDashArray: [4, 2] }),\n $(go.Placeholder)\n );\n\n var nodeResizeAdornmentTemplate =\n $(go.Adornment, \"Spot\",\n { locationSpot: go.Spot.Right },\n $(go.Placeholder),\n $(go.Shape, { alignment: go.Spot.TopLeft, cursor: \"nw-resize\", desiredSize: new go.Size(6, 6), fill: \"lightblue\", stroke: \"deepskyblue\" }),\n $(go.Shape, { alignment: go.Spot.Top, cursor: \"n-resize\", desiredSize: new go.Size(6, 6), fill: \"lightblue\", stroke: \"deepskyblue\" }),\n $(go.Shape, { alignment: go.Spot.TopRight, cursor: \"ne-resize\", desiredSize: new go.Size(6, 6), fill: \"lightblue\", stroke: \"deepskyblue\" }),\n\n $(go.Shape, { alignment: go.Spot.Left, cursor: \"w-resize\", desiredSize: new go.Size(6, 6), fill: \"lightblue\", stroke: \"deepskyblue\" }),\n $(go.Shape, { alignment: go.Spot.Right, cursor: \"e-resize\", desiredSize: new go.Size(6, 6), fill: \"lightblue\", stroke: \"deepskyblue\" }),\n\n $(go.Shape, { alignment: go.Spot.BottomLeft, cursor: \"se-resize\", desiredSize: new go.Size(6, 6), fill: \"lightblue\", stroke: \"deepskyblue\" }),\n $(go.Shape, { alignment: go.Spot.Bottom, cursor: \"s-resize\", desiredSize: new go.Size(6, 6), fill: \"lightblue\", stroke: \"deepskyblue\" }),\n $(go.Shape, { alignment: go.Spot.BottomRight, cursor: \"sw-resize\", desiredSize: new go.Size(6, 6), fill: \"lightblue\", stroke: \"deepskyblue\" })\n );\n\n var nodeRotateAdornmentTemplate =\n $(go.Adornment,\n { locationSpot: go.Spot.Center, locationObjectName: \"CIRCLE\" },\n $(go.Shape, \"Circle\", { name: \"CIRCLE\", cursor: \"pointer\", desiredSize: new go.Size(7, 7), fill: \"lightblue\", stroke: \"deepskyblue\" }),\n $(go.Shape, { geometryString: \"M3.5 7 L3.5 30\", isGeometryPositioned: true, stroke: \"deepskyblue\", strokeWidth: 1.5, strokeDashArray: [4, 2] })\n );\n\n myDiagram.nodeTemplate =\n $(go.Node, \"Spot\",\n { locationSpot: go.Spot.Center },\n new go.Binding(\"location\", \"loc\", go.Point.parse).makeTwoWay(go.Point.stringify),\n { selectable: true, selectionAdornmentTemplate: nodeSelectionAdornmentTemplate },\n { resizable: true, resizeObjectName: \"PANEL\", resizeAdornmentTemplate: nodeResizeAdornmentTemplate },\n { rotatable: true, rotateAdornmentTemplate: nodeRotateAdornmentTemplate },\n new go.Binding(\"angle\").makeTwoWay(),\n // the main object is a Panel that surrounds a TextBlock with a Shape\n $(go.Panel, \"Auto\",\n { name: \"PANEL\" },\n new go.Binding(\"desiredSize\", \"size\", go.Size.parse).makeTwoWay(go.Size.stringify),\n $(go.Shape, \"Rectangle\",\t// default figure\n {\n portId: \"\", // the default port: if no spot on link data, use closest side\n fromLinkable: true, toLinkable: true, cursor: \"pointer\",\n fill: \"white\",\t// default color\n strokeWidth: 2\n },\n new go.Binding(\"figure\"),\n new go.Binding(\"fill\")),\n $(go.TextBlock,\n {\n font: \"bold 11pt Helvetica, Arial, sans-serif\",\n margin: 8,\n maxSize: new go.Size(160, NaN),\n wrap: go.TextBlock.WrapFit,\n editable: true\n },\n new go.Binding(\"text\").makeTwoWay())\n ),\n // four small named ports, one on each side:\n makePort(\"T\", go.Spot.Top, false, true),\n makePort(\"L\", go.Spot.Left, true, true),\n makePort(\"R\", go.Spot.Right, true, true),\n makePort(\"B\", go.Spot.Bottom, true, false),\n { // handle mouse enter/leave events to show/hide the ports\n mouseEnter: function(e, node) { showSmallPorts(node, true); },\n mouseLeave: function(e, node) { showSmallPorts(node, false); }\n }\n );\n\n function showSmallPorts(node, show) {\n node.ports.each(function(port) {\n if (port.portId !== \"\") {\t// don't change the default port, which is the big shape\n port.fill = show ? \"rgba(0,0,0,.3)\" : null;\n }\n });\n }\n\n var linkSelectionAdornmentTemplate =\n $(go.Adornment, \"Link\",\n $(go.Shape,\n // isPanelMain declares that this Shape shares the Link.geometry\n { isPanelMain: true, fill: null, stroke: \"deepskyblue\", strokeWidth: 0 })\t// use selection object's strokeWidth\n );\n\n myDiagram.linkTemplate =\n $(go.Link,\t// the whole link panel\n { selectable: true, selectionAdornmentTemplate: linkSelectionAdornmentTemplate },\n { relinkableFrom: true, relinkableTo: true, reshapable: true },\n {\n routing: go.Link.AvoidsNodes,\n curve: go.Link.JumpOver,\n corner: 5,\n toShortLength: 4\n },\n new go.Binding(\"points\").makeTwoWay(),\n $(go.Shape,\t// the link path shape\n { isPanelMain: true, strokeWidth: 2 }),\n $(go.Shape,\t// the arrowhead\n { toArrow: \"Standard\", stroke: null }),\n $(go.Panel, \"Auto\",\n new go.Binding(\"visible\", \"isSelected\").ofObject(),\n $(go.Shape, \"RoundedRectangle\",\t// the link shape\n { fill: \"#F8F8F8\", stroke: null }),\n $(go.TextBlock,\n {\n textAlign: \"center\",\n font: \"10pt helvetica, arial, sans-serif\",\n stroke: \"#919191\",\n margin: 2,\n minSize: new go.Size(10, NaN),\n editable: true\n },\n new go.Binding(\"text\").makeTwoWay())\n )\n );\n\n\n load();\t// load an initial diagram from some JSON text\n\n // initialize the Palette that is on the left side of the page\n myPalette =\n $(go.Palette, \"myPaletteDiv\",\t// must name or refer to the DIV HTML element\n {\n maxSelectionCount: 1,\n nodeTemplateMap: myDiagram.nodeTemplateMap,\t// share the templates used by myDiagram\n linkTemplate: // simplify the link template, just in this Palette\n $(go.Link,\n { // because the GridLayout.alignment is Location and the nodes have locationSpot == Spot.Center,\n // to line up the Link in the same manner we have to pretend the Link has the same location spot\n locationSpot: go.Spot.Center,\n selectionAdornmentTemplate:\n $(go.Adornment, \"Link\",\n { locationSpot: go.Spot.Center },\n $(go.Shape,\n { isPanelMain: true, fill: null, stroke: \"deepskyblue\", strokeWidth: 0 }),\n $(go.Shape,\t// the arrowhead\n { toArrow: \"Standard\", stroke: null })\n )\n },\n {\n routing: go.Link.AvoidsNodes,\n curve: go.Link.JumpOver,\n corner: 5,\n toShortLength: 4\n },\n new go.Binding(\"points\"),\n $(go.Shape,\t// the link path shape\n { isPanelMain: true, strokeWidth: 2 }),\n $(go.Shape,\t// the arrowhead\n { toArrow: \"Standard\", stroke: null })\n ),\n model: new go.GraphLinksModel([\t// specify the contents of the Palette\n \n { text: \"Goal\", figure: \"Rectangle\", fill: \"#FFFFFF\" },\n { text: \"Context\", figure: \"RoundedRectangle\", fill: \"#FFFFFF\" },\n { text: \"Claim\", figure: \"Circle\", fill: \"#FFFFFF\" },\n { text: \"Strategy\", figure: \"Parallelogram1\", fill: \"#FFFFFF\" },\n { text: \"Undeveloped \\n Goal\", figure: \"RectDiamond\", fill: \"#FFFFFF\" },\n { text: \"Dependent \\n Goal\", figure: \"DependentGoal\", fill: \"#FFFFFF\" },\n\n ], [\n // the Palette also has a disconnected Link, which the user can drag-and-drop\n { points: new go.List(go.Point).addAll([new go.Point(0, 0), new go.Point(30, 0), new go.Point(30, 40), new go.Point(60, 40)]) }\n ])\n });\n}", "function _main() \n{\n \n\tvar g= new Graph();\n\n\n \n\t// set input graph properties (label, directed etc.)\n\t g.label=\"Exercise 8.4: 7 (Levitin, 3rd edition)\";\n\t g.digraph = true;\n\t// use global input arrays _v and _e to initialize its internal data structures\n \n\tg.read_graph(_v,_e);\n\n\t// use print_graph() method to check graph\n \n\tg.print_graph();\n\t// report connectivity status if available\n\tg.topoSearch(\"dfs\");\n\t\n\t\n\n\t\n\tg.topoSearch(\"bfs\");\n document.write(\"<p>bfs_order: \", g.bfs_out);\n document.write(\"<p>\", g. componentInfoImpl());\n\tg.DfsTC();\n\tdocument.write(\"<p> TC matrix by DFS:<br>\");\n\tfor (var i = 0; i < g.dfsTC.length; i++)\n\t{\n\t\tdocument.write(g.dfsTC[i], \"<br>\");\n\t}\n\tdocument.write(\"<p>TC matrix by Warshall-Floyd:<br>\");\n\tg.warshallFloyd();\n\tfor (var i = 0; i < g.warshallTC.length; i++)\n\t{\n\t\tdocument.write(g.warshallTC[i], \"<br>\");\n\t}\n\t\n\t//check if the graph is DAG (directed acyclic graph)\n\tdocument.write(\"<p>DAG: \", g.isDAG(), \"</p>\");\n\t\n\t//output floyed-distance matrix\n\tg.warshallFloyd();\n\tdocument.write(\"<p>Distance matrix<br>\");\n\n\tfor (var i = 0; i < g.floydD.length; i++)\n\t{\n\t\tdocument.write(g.floydD[i], \"<br>\");\n\t}\n}", "function generateIdeaData()\n{\n createGraph();\n \n}", "function initChart() {\n \n // Draw Links for Project 1\n var projectNumber = 1;\n // add link for each team member in project\n var linkProjects = chartGroup.append(\"g\")\n .attr(\"id\", \"linkProject\" + projectNumber);\n // Create links between teammates in project 1\n createLinksProject(groupProject1, linkProjects, projectNumber);\n\n // Draw Links for Project 2\n projectNumber = 2;\n // add link for each team member in project\n linkProjects = chartGroup.append(\"g\")\n .attr(\"id\", \"linkProject\" + projectNumber);\n // Create links between teammates in project 2\n createLinksProject(groupProject2, linkProjects, projectNumber);\n \n // Draw Links for Project 3\n projectNumber = 3;\n // add link for each team member in project\n var linkProjects = chartGroup.append(\"g\")\n .attr(\"id\", \"linkProject\" + projectNumber);\n // Create links between teammates in project 3\n createLinksProject(teams, linkProjects, projectNumber);\n\n // Create student circles for all the projects\n for(i=0; i<(numProjects+1); i++) {\n createGroupProject(chartGroup, i)\n }\n\n // Declare display string\n var display = ``\n // Append teams to display\n teams.forEach((team, ix) => {\n display = display + `Team ${ix+1}: ${team}<br>`\n });\n // Append Shuffle count to display string\n display = display + `<br><h6>Shuffle count: ${shuffleCounter}</h6>`;\n // render display in html\n d3.select(\"#displayNewTeams\").html(display);\n}", "function test_utilization_utilization_graphs() {}", "function createProjects() {\n\tfor (let project of projects) {\n\t\tconst languages = project.querySelector('.languages > ul');\n\t\tif (languages) {\n\n\t\t\t\n\n\t\t\tfor (let li of languages.children) {\t\t\t\n\t\t\t\tconst svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n\t\t\t\tconst use = document.createElementNS('http://www.w3.org/2000/svg', 'use');\n\t\t\t\tsvg.appendChild(use);\n\t\t\t\tuse.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', `img/svg/icons.svg#icon-${li.textContent.toLowerCase()}`);\n\t\t\t\tli.appendChild(svg);\n\t\t\t}\n\t\t}\n\n\n\t\tconst projLink = project.querySelector('.project-link');\t\t\n\t\tconst projId = project.id;\n\n\t\tconst img = generateElement('img', [['src', `img/projects/project${projId}.png`], ['alt', `Preview of project ${project.id}.`]], ['proj-img', 'sm']);\n\t\tprojLink.appendChild(img);\n\t}\n}", "function getArtGraph() {\n const params = new URL(location.href).searchParams;\n const selectedWorkspace = params.get('workspace');\n const selectedArtifact = params.get('artifact');\n\n get(\"./workspaces/\" + selectedWorkspace + \"/\" + selectedArtifact).then(function(serialArt) {\n const MAX_LENGTH = 35;\n let dot = [];\n let art = JSON.parse(serialArt);\n\n dot.push(\"digraph G {\\n\");\n dot.push(\"\\tgraph [\\n\");\n dot.push(\"\\t\\trankdir = \\\"LR\\\"\\n\");\n dot.push(\"\\t\\tbgcolor=\\\"transparent\\\"\\n\");\n dot.push(\"\\t]\\n\");\n\n /* Artifact name and type */\n var s1 = (art.artifact.length <= MAX_LENGTH) ? art.artifact : art.artifact.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(\"\\t\\\"\" + art.artifact + \"\\\" [ \" + \"\\n\\t\\tlabel = \\\"\" + s1 + \":\\\\n\");\n s1 = (art.type.length <= MAX_LENGTH) ? art.type :\n art.type.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(s1 + \"|\");\n\n /* observable properties */\n Object.keys(art.properties).forEach(function(y) {\n var ss = Object.keys(art.properties[y])[0] + \"(\" + Object.values(art.properties[y])[0].toString() + \")\";\n var s2 = (ss.length <= MAX_LENGTH) ? ss : ss.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(s2 + \"|\");\n });\n\n /* operations */\n art.operations.forEach(function(y) {\n var s2 = (y.length <= MAX_LENGTH) ? y : y.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(s2 + \"\\\\n\");\n });\n dot.push(\"\\\"\\n\");\n dot.push(\"\\t\\tshape=record style=filled fillcolor=white\\n\");\n dot.push(\"\\t\\t];\\n\");\n\n /* Linked Artifacts */\n art.linkedArtifacts.forEach(function(y) {\n var str1 = (y.length <= MAX_LENGTH) ? y :\n y.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(\"\\t\\t\\\"\" + y + \"\\\" [ label=\\\"\" + str1 + \"\\\"\");\n dot.push(\"\\t\\tshape=record style=filled fillcolor=white\\n\");\n dot.push(\"\\t]\\n\");\n dot.push(\"\\t\\\"\" + art.artifact + \"\\\" -> \\\"\" + y + \"\\\" [arrowhead=\\\"onormal\\\"]\");\n });\n\n /* observers */\n art.observers.forEach(function(y) {\n if (art.type !== \"cartago.AgentBodyArtifact\") {\n var s2 = (y.length <= MAX_LENGTH) ? y : y.substring(0, MAX_LENGTH) + \"...\";\n dot.push(\"\\t\\\"\" + y + \"\\\" [ \" + \"\\n\\t\\tlabel = \\\"\" + s2 + \"\\\"\\n\");\n dot.push(\"\\t\\tshape = \\\"ellipse\\\" style=filled fillcolor=white\\n\");\n dot.push(\"\\t];\\n\");\n dot.push(\"\\t\\\"\" + y + \"\\\" -> \\\"\" + art.artifact + \"\\\" [arrowhead=\\\"odot\\\"];\\n\");\n }\n });\n\n dot.push(\"}\\n\");\n\n /* Transition follows modal top down movement */\n var t = d3.transition().duration(750).ease(d3.easeLinear);\n d3.select(\"#artifactgraph\").graphviz().transition(t).renderDot(dot.join(\"\"));\n });\n}", "function graph() {\n var stages = [];\n var drcs, eqs, ffts;\n if (get_global('enable_drc')) {\n drcs = new drc_3band();\n }\n if (get_global('enable_eq')) {\n eqs = new eq_2chan();\n }\n if (get_global('enable_swap')) {\n if (eqs) stages.push(eqs);\n if (drcs) stages.push(drcs);\n } else {\n if (drcs) stages.push(drcs);\n if (eqs) stages.push(eqs);\n }\n if (get_global('enable_fft')) {\n ffts = new fft_2chan();\n stages.push(ffts);\n }\n\n for (var i = 1; i < stages.length; i++) {\n connect(stages[i - 1], stages[i]);\n }\n\n function input(n) {\n return stages[0].input(0);\n }\n\n function output(n) {\n return stages[stages.length - 1].output(0);\n }\n\n function config(name, value) {\n var p = name[0];\n var s = name.slice(1);\n if (p == 'global') {\n /* do nothing */\n } else if (p == 'drc') {\n if (drcs) {\n drcs.config(s, value);\n }\n } else if (p == 'eq') {\n if (eqs) {\n eqs.config(s, value);\n }\n } else {\n console.log('invalid parameter: name =', name, 'value =', value);\n }\n }\n\n this.input = input;\n this.output = output;\n this.config = config;\n}", "function onProjectChange(chartState, refreshFn) {\n const inspector = document.getElementById('inspector');\n chartState.selectedNode = null;\n chartState.selectedNodeElement = null;\n chartState.rootNodePath = [];\n inspector.innerHTML = '';\n const project = document.getElementById('project').value;\n chartState.selectedChartName = project;\n chartState.selectedChart = allData[project];\n refreshFn();\n}", "function showProjects(project) {\n if (bodyWidth < 741 && state == 'less') {\n for (; i < 5; i++) {\n projectCreation(project[i]);\n }\n }\n else if (bodyWidth > 740 && state == 'less') {\n for (; i < 9; i++) {\n projectCreation(project[i]);\n }\n }\n else if (state == 'more') {\n for (; i < project.length; i++) {\n projectCreation(project[i]);\n }\n }\n}", "function initializeProjects() {\n displayProjects();\n}", "function buildGraphs($scope) {\n buildWeekly();\n setWeekly($scope);\n\n buildMonthly();\n buildYearly();\n}", "function Graph() {\n this.edges = [];\n this.mapNeighbors = {};\n\n /**\n * Adds an edge to the graph from to vertices\n * @param from starting vertex\n * @param to destination vertex\n */\n this.addEdge = function (from, to) {\n\n if(this.mapNeighbors[from.id] == undefined){\n this.mapNeighbors[from.id] = {};\n }\n if(this.mapNeighbors[from.id][to.id] == undefined){\n this.mapNeighbors[from.id][to.id] = to;\n }\n\n var newEdge = Edge.withConstantCost(from, to);\n this.edges.push(newEdge);\n };\n\n /**\n * Return a string representing the graph.\n * Format : \"edges : [<edge>, <edge>, ...]\"\n */\n this.toString = function () { return 'edges : [' + this.edges.join(', ') + ']'; };\n\n /**\n * Finds all reachable neighbors of a vertex in the graph\n * @param v vertex from which we look for neighbors\n */\n this.findReachableNeighbors = function(v){\n var neighbor = this.mapNeighbors[v.id];\n output('voisins de ' + v + ' : ');\n printNeighbors(neighbor);\n return neighbor;\n };\n\n function printNeighbors(mapNeighbors) {\n if(!debug) return;\n for(var id in mapNeighbors){\n if(mapNeighbors.hasOwnProperty(id)) {\n output(mapNeighbors[id]);\n }\n }\n }\n\n /**\n * Finds the cost of transition between two vertices (if exists)\n * @param from starting vertex\n * @param to destination vertex\n * @return Number cost {Number} or Number.POSITIVE_INFINITY\n */\n this.findCost = function (from, to) {\n var filtered = this.edges.filter(function(e){\n return (e.from.id == from.id) && (e.to.id == to.id);\n });\n if(filtered.length <= 0) return Number.POSITIVE_INFINITY;\n return filtered[0].cost;\n };\n\n /**\n * Returns a GraphViz description of the graph\n */\n this.toGraphViz = function(){\n function formatGraphVizEdge(e) {\n return e.from.label + ' -> ' + e.to.label + ' [ label=\"' + e.cost + '\" ];';\n }\n return 'digraph g{' + this.edges.map(formatGraphVizEdge).join('\\n') + '}';\n };\n\n /**\n * Find all vertices included in edges of this graph\n */\n this.findAllVertices = function () {\n var allVerticesId = [];\n var allVertices = [];\n\n this.edges.forEach(function(curE, idCur, array){\n if (!arrayContains(curE.from.id, allVerticesId)) {\n allVerticesId.push(curE.from.id);\n allVertices.push(curE.from);\n }\n if (!arrayContains(curE.to.id, allVerticesId)) {\n allVerticesId.push(curE.to.id);\n allVertices.push(curE.to);\n }\n });\n return allVertices;\n };\n\n this.findLeafs = function(){\n var graph = this;\n return this.findAllVertices().filter(function(vertex){\n return Object.keys(graph.findReachableNeighbors(vertex)).length == 1;\n });\n }\n}", "function dataPreparation() {\n //Create a node -> node id mapping - total: 470 ICH elements\n nodes.forEach(function (d) {\n node_by_id[d.id] = d;\n }); //Map the connections to each node\n\n edges.forEach(function (d) {\n //Save all of the edges to a specific node\n if (!linked_to_id[d.source]) linked_to_id[d.source] = [];\n if (!linked_to_id[d.target]) linked_to_id[d.target] = [];\n linked_to_id[d.source].push(node_by_id[d.target]);\n linked_to_id[d.target].push(node_by_id[d.source]);\n }); //forEach\n ///////////////////////// DOMAINS ////////////////////////\n //Get the domain label translations for in the arcs\n\n var data = _translationsDomains__WEBPACK_IMPORTED_MODULE_6__[\"default\"][language].domains; //Get the domains\n\n domains = nodes.filter(function (d) {\n return d.group === 'domain';\n });\n domains.forEach(function (d) {\n d.count = 0;\n domain_by_id[d.id] = d;\n d.title = data[data.map(function (b) {\n return b.id;\n }).indexOf(d.id)].label;\n }); //Sort them by their id\n\n domains = domains.sort(function (a, b) {\n if (a.id < b.id) return -1;\n if (a.id > b.id) return 1;\n return 0;\n });\n domain_ids = new _babel_runtime_corejs2_core_js_set__WEBPACK_IMPORTED_MODULE_2___default.a(domains.map(function (d) {\n return d.id;\n }));\n color_domain_scale.domain(domain_ids); //Knowledge and practices concerning nature and the universe - 102\n //Oral traditions and expressions - 158\n //Performing arts - 230\n //Social practices, rituals and festive events - 260\n //Traditional craftsmanship - 168\n //Total: 918\n ////////////////////// ICH ELEMENTS //////////////////////\n //Find the elements that are mapped to a domain\n\n var element_ids = domains.map(function (d) {\n return linked_to_id[d.id].map(function (l) {\n return l.id;\n });\n });\n element_ids = Object(_babel_runtime_corejs2_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(new _babel_runtime_corejs2_core_js_set__WEBPACK_IMPORTED_MODULE_2___default.a([].concat.apply([], element_ids))).sort(); //Get all the nodes(ICH elements) that are connected to domains\n\n element_ids.forEach(function (d) {\n var node = node_by_id[d]; //Filter out any elements on the Register (GSP), so only keep the RL & USL\n\n if (node.meta.list !== 'RL' && node.meta.list !== 'USL') return;\n node.fill = 'black';\n node.opacity = 1;\n var links = linked_to_id[d].filter(function (d) {\n return d;\n });\n links = new _babel_runtime_corejs2_core_js_set__WEBPACK_IMPORTED_MODULE_2___default.a(links.map(function (n) {\n return n.id;\n }));\n var intersection = new _babel_runtime_corejs2_core_js_set__WEBPACK_IMPORTED_MODULE_2___default.a(Object(_babel_runtime_corejs2_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(links).filter(function (l) {\n return domain_ids.has(l);\n }));\n node.domains = Object(_babel_runtime_corejs2_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(intersection); //Create a unique code for the combination of domains\n\n node.domains.sort();\n node.domain_code = node.domains.map(function (n) {\n return n.replace('vocabulary_ich_', '');\n }).join('_'); //The main domain of an element - only one has a weight of 3\n\n var domain_edges = edges.filter(function (l) {\n return l.source === d && node.domains.indexOf(l.target) >= 0;\n });\n var domain_main = domain_edges.filter(function (l) {\n return l.weight === 3;\n });\n if (domain_main.length === 1) node.domain_main = domain_main[0].target;else node.domain_main = '0'; //Add the domains to the total count of how often each domain is assigned\n\n node.domains.forEach(function (m) {\n domain_by_id[m].count += 1;\n });\n elements.push(node);\n });\n domain_ids = Object(_babel_runtime_corejs2_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(domain_ids);\n ICH_num_all = elements.length; // //Check to see which ICH elements have no HUG photo\n // let img_not = []\n // elements.forEach(d => {\n // if(d.meta && d.meta.images) {\n // d.img = new Image\n // d.img.src = d.meta.icon.replace(\"MED\",\"HUG\")\n // d.img.onerror = function() {\n // img_not.push(d.id)\n // let hiddenElement = document.createElement('a')\n // hiddenElement.href = 'data:attachment/text,' + encodeURI(img_not)\n // hiddenElement.target = '_blank'\n // hiddenElement.download = 'ICH_no_HUG_file.txt'\n // hiddenElement.click()\n // hiddenElement.parentNode.removeChild(hiddenElement)\n // }\n // }//if\n // else { console.log(d.id, \" has no images\")}\n // })//forEach\n //456 ICH elements - it's ok that the last 14 are missing\n // //Which don't have a domain?\n // //\"element_320\", \"element_321\", \"element_322\", \"element_473\", \"element_543\", \"element_530\", \"element_532\", \"element_539\", \"element_541\", \"element_654\", \"element_678\", \"element_696\", \"element_1004\", \"element_1306\"\n // let a = new Set(elements.map(d => d.id))\n // let b = new Set(nodes.filter(d => d.type === \"element\").map(d => d.id))\n // let difference = [...new Set([...b].filter(d => !a.has(d)))]\n //Sort by number of domains and then by their \"unique domain combination id\"\n\n elements = elements.sort(function (a, b) {\n if (a.domains.length < b.domains.length) return -1;\n if (a.domains.length > b.domains.length) return 1;\n if (a.domain_code < b.domain_code) return -1;\n if (a.domain_code > b.domain_code) return 1;\n if (a.domain_main < b.domain_main) return -1;\n if (a.domain_main > b.domain_main) return 1;\n return 0;\n }); //////////////////////// COUNTRIES ///////////////////////\n //Get all the unique countries that are connected to the (remaining) nodes\n\n var country_ids = elements.map(function (d) {\n var links = linked_to_id[d.id].filter(function (n) {\n return n;\n });\n return links.filter(function (n) {\n return n.type === 'country';\n }).map(function (n) {\n return n.id;\n });\n });\n country_ids = Object(_babel_runtime_corejs2_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(new _babel_runtime_corejs2_core_js_set__WEBPACK_IMPORTED_MODULE_2___default.a([].concat.apply([], country_ids))); //Get the countries to which this element is connected\n\n elements.forEach(function (d) {\n var links = linked_to_id[d.id].filter(function (n) {\n return n;\n });\n var countries = links.filter(function (n) {\n return n.type === 'country';\n }).map(function (n) {\n return n.id;\n });\n countries = countries.filter(function (c) {\n return country_ids.indexOf(c) >= 0;\n }); // d.countries = countries\n\n d.countries = linked_to_id[d.id].filter(function (l) {\n return l.type === 'country';\n }).map(function (l) {\n return l.label;\n });\n }); //forEach\n //Add the region and area information\n\n country_ids.forEach(function (d) {\n var node = node_by_id[d];\n node.fill = color_country;\n node.opacity = 1;\n node.opacity_text = country_text_opacity; //Get the region that belongs to this country\n\n var area = linked_to_id[d].filter(function (n) {\n return n.type === 'region';\n });\n if (area.length > 1) Error('More than 1 region for country ', node.label);\n node.area = area[0].label; // //Get the region that belongs to this country\n // let region = linked_to_id[d].filter(n => n.type === \"region\")\n // if (region.length > 1) Error(\"More than 1 region for country \", node.label)\n // node.region = region[0].label\n // //And the region of that region\n // let area = linked_to_id[region[0].id].filter(n => n.type === \"region\")\n // if (region.length > 1) Error(\"More than 1 area for region \", node.region)\n // node.area = area[0].label\n //Find the elements that this country is connected to\n\n var elements = linked_to_id[d].filter(function (n) {\n return n.type === 'element';\n }).map(function (n) {\n return n.id;\n });\n elements = elements.filter(function (r) {\n return element_ids.indexOf(r) >= 0;\n });\n node.elements = elements;\n countries.push(node);\n }); //forEach\n //133 countries total and 117 remain in this list\n\n num_countries = countries.length; // console.log([...new Set(countries.map(d => d.region))])\n // console.log([...new Set(countries.map(d => d.area))]) [\"Africa\", \"Americas\", \"Asia\", \"Europe\", \"Oceania\"]\n //Sort the countries by area and then alphabetically\n\n countries = countries.sort(function (a, b) {\n if (a.area < b.area) return -1;\n if (a.area > b.area) return 1;\n if (a.label < b.label) return -1;\n if (a.label > b.label) return 1;\n return 0;\n }); //sort\n ////////////////////// EDGES COUNTRY /////////////////////\n //Only keep the edges that are between nodes and countries - 539 remaining\n\n edges_country = edges.filter(function (d) {\n if (element_ids.indexOf(d.source) >= 0 && country_ids.indexOf(d.target) >= 0) return true;else if (element_ids.indexOf(d.target) >= 0 && country_ids.indexOf(d.source) >= 0) return true;else return false;\n }); //filter\n } //function dataPreparation", "_buildChart(source) {\n\n const { rootNode, getSVG, treeInstance, element } = this.getProperties('rootNode', 'getSVG', 'treeInstance', 'element');\n\n const svg = getSVG(element);\n\n // Re calculate the tree layout\n const tree = treeInstance(rootNode);\n\n const nodes = tree.descendants();\n const links = nodes.slice(1);\n\n // Creating the links with enter, update and exit functionality\n addLinks(svg, links, source);\n\n // Creating the nodes with enter, update and exit functionality\n this._addNodes(svg, nodes, source);\n\n // Stash the old positions for transition.\n nodes.forEach((process) => {\n process.x0 = process.x;\n process.y0 = process.y;\n });\n }", "function getDataBySystem(jdata) {\n viewport.clear(); // reset viewport\n $('ul.variables').html(\"\"); // reset variables\n // reset entity objects\n mRoot.infoEntities = new Collection();\n mRoot.objEntities = new Collection();\n\n // reset connection objects\n mRoot.infoConnections = new Collection();\n mRoot.objConnections = new Collection();\n\n // reset variable objects\n mRoot.infoVariables = new Collection();\n\n var root = jdata.WorkflowService[\"ftwa:StartWorkflow\"][\"ftwa:StartWorkflow.Activities\"][\"p:Flowchart\"], // get from service to start workflow -> flowchart\n managers = jdata.WorkflowService[\"sap2010:WorkflowViewState.ViewStateManager\"][\"sap2010:ViewStateManager\"][\"sap2010:ViewStateData\"], // get from service\n variables = root[\"p:Flowchart.Variables\"]; // \n\n // get start\n var root_start = root[\"@StartNode\"] !== undefined ? root[\"@StartNode\"] : root[\"p:Flowchart.StartNode\"],\n start = new Entity();\n start.label = \"Start\";\n start.annotation = root[\"@sap2010:Annotation.AnnotationText\"] !== undefined ? root[\"@sap2010:Annotation.AnnotationText\"] : \"\";\n start.type = typeEntity.t_start;\n start.alias = root[\"@sap2010:WorkflowViewState.IdRef\"] === undefined ? root[\"sap2010:WorkflowViewState.IdRef\"] : root[\"@sap2010:WorkflowViewState.IdRef\"];\n mRoot.infoEntities.add(start);\n\n // get variables \n getVariables(variables);\n // get decisions and switchs\n getEntities(root);\n\n // get position info and connection\n mRoot.infoEntities.forEach(function (entity) {\n for (var i = 0; i < managers.length; i++) {\n var node = managers[i];\n if (node[\"@Id\"] === entity.alias) {\n var points = node[\"sap:WorkflowViewStateService.ViewState\"][\"scg:Dictionary\"][\"av:Point\"][\"#text\"].split(\",\");\n var sizes = node[\"sap:WorkflowViewStateService.ViewState\"][\"scg:Dictionary\"][\"av:Size\"][\"#text\"].split(\",\");\n entity.x = parseFloat(points[0]);\n entity.y = parseFloat(points[1]);\n entity.width = parseFloat(sizes[0]);\n entity.height = parseFloat(sizes[1]);\n\n if (entity.type !== typeEntity.t_approve && entity.type !== typeEntity.t_generic) {\n mRoot.objEntities.add(drawEntity(viewport, entity));\n } else {\n mRoot.objEntities.add(drawEntityFlow(viewport, entity));\n }\n\n if (entity.type === typeEntity.t_start) { // size of flowchart belong to start\n // resize viewport\n var size = node[\"@sap:VirtualizedContainerService.HintSize\"].split(\",\"); // hash size w/h\n mViewport = {\n width: parseFloat(size[0]) < defaultValue.viewport.width ? defaultValue.viewport.width : parseFloat(size[0]),\n height: parseFloat(size[1]) < defaultValue.viewport.height ? defaultValue.viewport.height : parseFloat(size[1])\n };\n $('#viewport').width(mViewport.width);\n $('#viewport').height(mViewport.height);\n viewport.setSize(mViewport.width, mViewport.height); // set new size of viewport from data\n\n // reset scroll\n if (scrollbar !== null) {\n scrollbar.destroy();\n }\n scrollbar = $('#chart').jScrollPane().data().jsp;\n }\n }\n }\n });\n\n mRoot.infoEntities.forEach(function (entity) {\n for (var i = 0; i < managers.length; i++) {\n var node = managers[i];\n if (node[\"@Id\"] === entity.alias) {\n // get connections\n if (node[\"sap:WorkflowViewStateService.ViewState\"][\"scg:Dictionary\"][\"av:PointCollection\"] !== undefined) {\n var info = node[\"sap:WorkflowViewStateService.ViewState\"][\"scg:Dictionary\"][\"av:PointCollection\"];\n if (node[\"sap:WorkflowViewStateService.ViewState\"][\"scg:Dictionary\"][\"x:String\"] !== undefined) {\n labelDefault = node[\"sap:WorkflowViewStateService.ViewState\"][\"scg:Dictionary\"][\"x:String\"][\"#text\"];\n getConnections(entity, info, labelDefault);\n } else {\n getConnections(entity, info);\n }\n }\n }\n }\n });\n mRoot.infoConnections.forEach(function (obj) {\n var connection = createConnection(obj);\n // can't draw label connnection begin/end is start\n if (mRoot.infoEntities.itemByID(obj.from).type !== typeEntity.t_start &&\n mRoot.infoEntities.itemByID(obj.to).type !== typeEntity.t_start) {\n // it's decision => set connection is true or false\n if (mRoot.infoEntities.itemByID(obj.from).type === typeEntity.t_decision) {\n if (obj.fromHolder == 2) {\n obj.label = 'False';\n } else {\n obj.label = 'True';\n }\n }\n // description of connection from switch\n obj.description = obj.label;\n\n // connection from generic/approve, it not labels\n if (mRoot.infoEntities.itemByID(obj.from).type !== typeEntity.t_generic &&\n mRoot.infoEntities.itemByID(obj.from).type !== typeEntity.t_approve) {\n // draw temp a label for get width/height.\n var temp = viewport.text(-100, -100, obj.label).attr({ \"font-size\": \"10px\" });\n connection.label = drawLabel(connection.posLabel.x, connection.posLabel.y, temp.getBBox().width, temp.getBBox().height, obj.label, viewport);\n connection.label.mask.parent = connection;\n temp.remove();\n }\n }\n\n mRoot.objConnections.add(connection);\n });\n}", "function drawSvg() {\n\t\t// selector can be #residential, or #commercial which should be in graph.html\n\t\tvar dataSources = [{selector: '#commercial', data: data.commGraphData}, \n\t\t\t{selector: '#residential', data: data.residGraphData}];\n\n\t\tdataSources.forEach(function(item) {\n\t\t\tvar canvas = createCanvas(item.selector, item.data);\n\t\t\tdrawHorizontalLabel(canvas);\n\t\t\tdrawVerticalLable(canvas, item.data);\n\t\t\tdrawHeatMap(canvas, item.data);\n\t\t});\n\t}", "readFromXML(graph, parent) {\n graph.getModel().beginUpdate();\n try {\n\n var assetsXML = this.props.project.assetsXML; \n\n //Create new vertexes represention shots nodes\n if (assetsXML === '') {\n this.createShotsVertex(graph)\n }\n //layout was set\n else {\n var doc = mxUtils.parseXml(assetsXML);\n var codec = new mxCodec(doc);\n var model = codec.decode(doc.documentElement, graph.getModel())\n var cells = model.getElementsByTagName(\"mxCell\");\n\n var cellArr = Array.from(cells);\n \n var vertexes = []; \n var shotArray = this.props.shotArray \n let index = 0 \n var stack = []\n var vertexArray = []\n\n //add selected Shots to stack\n var shots = this.props.project.shots\n shots.forEach((shot, index) => {\n if (shotArray.includes(shot.id.toString())) {\n vertexes[shot.id] = graph.insertVertex(parent, shot.id, shot.name, 950, 50 + index * 150, 100, 50, 'fillColor=#757575;strokeColor=#616161;fontColor=#FAFAFA');\n vertexes[shot.id].visible = true\n\n stack.push(vertexes[shot.id])\n\n } else {\n vertexes[shot.id] = graph.insertVertex(parent, shot.id, shot.name, 950, 50 + vertexArray.length * 150, 100, 50, 'fillColor=#757575;strokeColor=#616161;fontColor=#FAFAFA');\n vertexes[shot.id].visible = false\n }\n })\n\n for (var i = 0; i < cellArr.length; i++) {\n let element = cellArr[i]\n var id = element.getAttribute(\"id\")\n var value = element.getAttribute(\"value\")\n var style = element.getAttribute(\"style\")\n\n\n //If element is Vertex/cell\n if (element.hasAttribute(\"vertex\") && value != null) {\n\n index = this.props.project.assets.map(function (e) { return e.id; }).indexOf(parseInt(id, 10));\n \n // set color based on status\n if (index !== -1) {\n if (this.props.project.assets[index].status === \"done\") {\n style = \"fillColor=#A5D6A7;strokeColor=#43A047\"\n }\n else if (this.props.project.assets[index].status === \"inprogress\") {\n style = \"fillColor=#FFCC80;strokeColor=#FF8A65\"\n }\n }\n\n // console.log(style)\n\n var geometry = element.getElementsByTagName(\"mxGeometry\");\n var x = geometry[0].getAttribute(\"x\")\n var y = geometry[0].getAttribute(\"y\")\n var width = geometry[0].getAttribute(\"width\")\n var height = geometry[0].getAttribute(\"height\")\n\n //add shots selected Shots vertex\n if (!value.startsWith(\"Shot\")) {\n\n vertexes[id] = graph.insertVertex(parent, id, value, x, y, width, height, style);\n vertexes[id].visible = false\n }\n\n }\n\n // add edge\n if (element.hasAttribute(\"edge\")) {\n\n var color = \"#212121\"\n var sourceElement = vertexes[element.getAttribute(\"source\")]\n var targetElement = vertexes[element.getAttribute(\"target\")]\n\n graph.insertEdge(parent, id, value, sourceElement, targetElement, 'strokeColor=' + color)\n\n }\n }\n\n //unique array function\n Array.prototype.unique = function () {\n return this.filter(function (value, index, self) {\n return self.indexOf(value) === index;\n });\n }\n\n //Going through grapf, if the cell is connected with selected Shot, set visible on true\n while (stack.length !== 0) {\n\n var cell = stack.pop()\n\n cell.visible = true\n var inEdges = graph.getModel().getIncomingEdges(cell)\n\n inEdges.forEach((edge, index) => {\n var vertex = edge.source\n stack.push(vertex)\n })\n }\n\n\n\n }\n\n\n\n\n\n } catch (e) {\n console.log(e)\n }\n finally {\n\n\n // Updates the display\n\n graph.getModel().endUpdate();\n\n //Need to move othervise the dragging canvas is broken\n graph.moveCells(graph.getChildCells(null, true, false), 1, 0);\n graph.moveCells(graph.getChildCells(null, true, false), -1, 0);\n\n graph.center()\n graph.refresh()\n\n this.setState({\n readingXMLdone: true,\n changed: false\n })\n\n }\n\n\n }", "function getGraphParams(selectedFiles, projectStructure) {\n const includeOption = document.getElementById(\"include-option\").value;\n const includeDirection = document.getElementById(\"dependency-direction-option\").value;\n const highlightOption = document.getElementById(\"highlight-option\").value;\n const showExternalLibrary = document.getElementById(\"show-external\").checked;\n\n let files = selectedFiles;\n let parents = [];\n\n const allFilesById = {};\n // Create a map for faster look up\n for (let i = 0; i < projectStructure.files.length; i++) {\n const file = projectStructure.files[i];\n allFilesById[file.id] = file;\n }\n\n // Once we have all \"base\" files, add all included files (children / parent)\n switch (includeOption) {\n case \"recursively-included\":\n case \"directly-included\":\n let includedFiles = addIncludedFiles(files, allFilesById, includeOption === \"recursively-included\", includeDirection);\n files = includedFiles.resultFiles;\n parents = includedFiles.parents;\n break;\n case \"hide-included\":\n // Not caring about included files => not adding them to the file list\n break;\n }\n\n // We also need to include external libraries as \"fake\" files\n // Includes will never be displayed when selecting children display\n // Because external libraries never includes our files\n if (showExternalLibrary && includeOption !== \"hide-included\" && includeDirection !== \"included-by\") {\n const processedExternals = []; // Avoid duplicates\n\n // Pick either only the selected files or all parents files depending on what was selected\n let filesToHandle = selectedFiles;\n if (includeOption === \"recursively-included\") {\n filesToHandle = parents;\n }\n\n for (let i = 0; i < filesToHandle.length; i++) {\n const file = filesToHandle[i];\n for (let j = 0; j < file.includes.length; j++) {\n const includedId = file.includes[j];\n if (projectStructure.externalIds.includes(includedId) && !processedExternals.includes(includedId)) {\n processedExternals.push(includedId);\n files.push({\n id: includedId,\n name: includedId,\n external: true,\n includesForGraph: [], // will stay empty\n highlightsForGraph: [],\n type: \"external\",\n path: [],\n includes: []\n });\n }\n }\n }\n }\n\n // Compute includesForGraph and highlightsForGraph\n // One day we will think about what we want to do at the start and rewrite this\n // One day\n for (let i = 0; i < files.length; i++) {\n const file = files[i];\n file.includesForGraph = [];\n file.highlightsForGraph = [];\n\n // For each file included by this file\n for (let j = 0; j < file.includes.length; j++) {\n const includeId = file.includes[j];\n\n // If it's in the file list with add it\n for (let k = 0; k < files.length; k++) {\n const file2 = files[k];\n if (includeId === file2.id) {\n file.includesForGraph.push(file2.id);\n }\n }\n }\n }\n\n // TODO: Do not force rebuilding graph to update this?\n for (let i = 0; i < files.length; i++) {\n const file = files[i];\n if (highlightOption === \"includes\" || highlightOption === \"both-direction\") {\n buildParentHighlight(file, files);\n }\n if (highlightOption === \"included-by\" || highlightOption === \"both-direction\") {\n buildChildrenHighlight(file, files);\n }\n }\n\n return {\n selectedFiles: files,\n projectStructure\n };\n}", "function setupDiagram(total) {\n\t\n\t\n\t\tif (total === undefined) total = '{{ total_gts }}'; // total should be the number of destinations\n\t\tvar nodeDataArray = [];\n\t\tvar i=0;\t\n\t\t\t\t\t\n\t\t{% for sts in statuss if (sts.id == dest.status_id) %}\n\t\t\n\t\t\t\twondow.alert(dest);\n\t\t\t\t\n\t\t\t\tnodeDataArray.push({\n\t\t\t\t\tkey: i,\n\t\t\t\t\tcolor: go.Brush.randomColor(),\n\t\t\t\t\tcolor2: '{{ sts.color }}',\n\t\t\t\t\tname: '{{ dest.title }}',\n\t\t\t\t\tstatus: 'סטאטוס: {{ sts.title }}',\t\n\t\t\t\t},\n\t\t\t\t);\t\n\t\t\t\t\t\t\t\t\t\n\t\t{% endfor %}\n\t\t\n\t\ti=1;\t\t\n\t\t{% for goal in dst_goals if (dest.is_parent_of(goal) ) %} // GOALS\t\t\n\t\t\t\n\t\t\twindow.alert(goal);\n\t\t\t\n\t\t\t{% include \"./tree/goal_data.js\" %}\n\t\t\t\t\n\t\t\tnodeDataArray[i].parent = 0; // all the destinations parent is student\n\t\t\t\t\t\n\t\t\tvar j=i+1;\n\n\t\t\t{% for todo in dst_todos if ( goal.is_parent_of(todo) ) %} // TODOS\t\n\t\t\t\t\n\t\t\t\twindow.alert(todo);\n\t\t\t\t\n\t\t\t\t{% include \"./tree/todo_data.js\" %}\n\n\t\t\t\tnodeDataArray[j].parent = nodeDataArray[i].key;\t\t\t\t\n\t\t\t\tvar k=j+1;\n\t\t\t\t\n\t\t\t\t\tfor (forth_level_idx = 1; forth_level_idx < 6; i++) { // 4th-LEVEL\t\n\t\t\t\t\t\t\n\t\t\t\t\t\twindow.alert(\"4th level\");\n\t\t\t\t\t\twindow.alert(forth_level_idx);\n\n\t\t\t\t\t\tnodeDataArray[k].parent = nodeDataArray[j].key;\n\t\t\t\t\t\tk++; \t\t\n\t\t\t\t\t} //4th-LEVEL\t\t\n\t\t\t\tj++;\n\t\t\t\tj=k;\n\t\t\t{% endfor %} //TODOS\t\t\n\t\t\t\n\t\t\ti=j;\t\t\t\n {% endfor %} // DESTINATIONS\n\t\t\n\tmyFullDiagram.model = new go.TreeModel(nodeDataArray);\n\n }", "displayScene()\r\n {\r\n this.traverseGraph(this.components[this.idRoot], this.components[this.idRoot].materials, this.components[this.idRoot].texture);\r\n }", "function buildGraph() {\n for (let i = 0; i < scenes.length; i++) {\n graph.addVertex(scenes[i]);\n }\n\n for (let i = 0; i < edges.length; i++) {\n let origin = scenes[edges[i][0]];\n let target = scenes[edges[i][1]];\n graph.addEdge(origin, target);\n }\n}", "process (filepath) {\n\t\tlet {\n\t\t\tchassis,\n\t\t\tgenerateNamespacedSelector,\n\t\t\tisNamespaced,\n\t\t\tnamespaceSelectors,\n\t\t\tprocessImports,\n\t\t\tprocessNesting,\n\t\t\tprocessAtRules,\n\t\t\tprocessMixins,\n\t\t\tprocessNot,\n\t\t\tprocessFunctions,\n\t\t\tstoreAtRules,\n\t\t\ttypographyEngineIsInitialized\n\t\t} = this\n\n\t\tlet {\n\t\t\tatRules,\n\t\t\tpost,\n\t\t\tsettings,\n\t\t\tutils\n\t\t} = chassis\n\n\t\tlet tasks = new NGN.Tasks()\n\t\tlet sourceMap\n\n\t\ttasks.add('Processing Imports', next => {\n\t\t\tif (typographyEngineIsInitialized) {\n\t\t\t\tthis.tree.walkAtRules('import', atRule => {\n\t\t\t\t\tchassis.imports.push(atRule.params)\n\t\t\t\t\tatRule.remove()\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tprocessImports()\n\t\t\tprocessNesting()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Mixins', next => {\n\t\t\tprocessMixins()\n\t\t\tprocessNot()\n\t\t\tprocessNesting()\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing Functions', next => {\n\t\t\tprocessFunctions()\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Namespacing Selectors', next => {\n\t\t\tnamespaceSelectors()\n\t\t\tnext()\n\t\t})\n\n\t\tif (typographyEngineIsInitialized) {\n\t\t\ttasks.add('Initializing Typography Engine', next => {\n\t\t\t\tthis.tree = this.core.css.append(this.tree)\n\t\t\t\tnext()\n\t\t\t})\n\t\t}\n\n\t\ttasks.add('Running Post-Processing Routines', next => {\n\t\t\tthis.tree.walkAtRules('chassis-post', atRule => {\n\t\t\t\tlet data = Object.assign({\n\t\t\t\t\troot: this.tree,\n\t\t\t\t\tatRule\n\t\t\t\t}, atRules.getProperties(atRule))\n\n\t\t\t\tpost.process(data)\n\t\t\t})\n\n\t\t\tnext()\n\t\t})\n\n\t\ttasks.add('Processing CSS4 Syntax', next => {\n\t\t\tenv.process(this.tree, {from: filepath}, settings.envCfg).then(processed => {\n\t\t\t\tthis.tree = processed.root\n\t\t\t\tnext()\n\t\t\t}, err => console.error(err))\n\t\t})\n\n\t\t// tasks.add('Merging matching adjacent rules...', next => {\n\t\t// \toutput = mergeAdjacentRules.process(output.toString())\n\t\t// \tnext()\n\t\t// })\n\n\t\ttasks.add('Beautifying Output', next => {\n\t\t\tremoveComments.process(this.tree).then(result => {\n\t\t\t\tperfectionist.process(result.css).then(result => {\n\t\t\t\t\tthis.tree = result.root\n\n\t\t\t\t\t// Remove empty rulesets\n\t\t\t\t\tthis.tree.walkRules(rule => {\n\t\t\t\t\t\tif (rule.nodes.length === 0) {\n\t\t\t\t\t\t\trule.remove()\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\n\t\t\t\t\tnext()\n\t\t\t\t}, () => {\n\t\t\t\t\tthis.emit('processing.error', new Error('Error Beautifying Output'))\n\t\t\t\t})\n\t\t\t}, () => {\n\t\t\t\tthis.emit('processing.error', new Error('Error Removing Comments'))\n\t\t\t})\n\t\t})\n\n\t\tif (settings.minify) {\n\t\t\tlet minified\n\n\t\t\ttasks.add('Minifying Output', next => {\n\t\t\t\tminified = new CleanCss({\n\t\t\t\t\tsourceMap: settings.sourceMap\n\t\t\t\t}).minify(this.tree.toString())\n\n\t\t\t\tthis.tree = minified.styles\n\t\t\t\tnext()\n\t\t\t})\n\n\t\t\tif (settings.sourceMap) {\n\t\t\t\ttasks.add('Generating source map', next => {\n\t\t\t\t\tsourceMap = minified.sourceMap.toString()\n\t\t\t\t\tnext()\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// tasks.on('taskstart', evt => console.log(`${evt.name}...`))\n\t\t// tasks.on('taskcomplete', evt => console.log('Done.'))\n\n\t\ttasks.on('complete', () => this.emit('processing.complete', {\n\t\t\tcss: this.tree.toString(),\n\t\t\tsourceMap\n\t\t}))\n\n\t\tthis.emit('processing')\n\t\ttasks.run(true)\n\t}", "function Graph()\n{\n\n// published docs section (ref. assignment page)\n\t// for this section, strip line comments\n\t// no JSDOC comments in this section\n\n\n\t// base property fields\n\n this.vert = [];\t\t\t\t\t// vertex list (an array of Vertex objects)\n this.nv = 0;\t\t\t\t\t// number of vertices\n this.ne = 0;\t\t\t\t\t// number of edges\n this.digraph = false;\t\t\t\t// true if digraph, false otherwise (default undirected)\n this.weighted = false;\t\t\t\t// true if weighted graph, false otherwise (default unweighted)\n this.label = \"\";\t\t\t\t\t// identification string to label graph\n this.connectedComp = 0;\t\t\t\t// number of connected comps set by DFS; 0 (default) for no info\n this.verticesTree = [];\n this.Prim_Edge = [];\n\n // base member methods\n this.listVerts = listVertsImpl;\t\t\t// List graph vertices using info strings returned by Vertex methods\n this.readGraph = better_input;\t\t\t// default input reader method\n this.addEdge = addEdgeImpl;\t\t\t\t// Insert an edge\n this.printGraph = printGraphImpl;\t\t\t// better printer function\n this.isConnected = isConnectedImpl;\t\t\t// Test if graph is connected returning true, otherwise false\n this.componentInfo = componentInfoImpl;\t\t// Get printable connectivity info strings\n this.primImpl2 = primImpl2;\n this.primImpl1 = primImpl1;\n\n\n\n}", "getcurrentprojects() { }", "function displaySolution(solution) {\n\n}", "init( graph ) {\n this.graph = graph;\n }", "function makeProject(tittle, synopsis, tumbnailURL, numbLikes, numbViews, dateOri, dateModi) {\n let project = {\n tittle: tittle,\n synopsis: synopsis,\n tumbnailURL: tumbnailURL,\n assets: [],\n numbLikes: numbLikes,\n numbViews: numbViews,\n dateOri: dateOri,\n dateModi: dateModi,\n //function adds objects in \"assets\"\n addingAssets: function (...asset) {\n this.assets = asset //misshcine veranderen naar argumetns\n }\n }\n //returns an object\n return project\n\n }", "function darstellung(){\n\n // delete default display, activate/disable buttons\n document.getElementById(\"reset\").disabled = false;\n document.getElementById(\"start\").disabled = true;\n document.getElementById(\"center\").disabled = false; \n document.getElementsByClassName(\"sync\").disabled = false;\n d3.select(\"#Vergleich2\").text(\"\");\n d3.select(\"#Vergleich1\").text(\"\");\n d3.select(\"#CPT\").text(\"\");\n d3.select(\"#Dendrogramme\").text(\"\");\n\n /*\n separates source nodes from others for every graph and\n create divs depending on the number of graphs for the separate display\n */\n\n // more than 1 graph\n if(graphs.length>=1){\n parent1 = new Array();\n child1 = new Array();\n link1 = new Array();\n graph1(graphs[0], parent1, child1);\n get_links(parent1,child1,link1);\n console.log(parent1);\n }\n\n // more than 2 graphs\n if(graphs.length>=2){\n parent2 = new Array();\n child2 = new Array();\n link2 = new Array();\n graph1(graphs[1], parent2, child2);\n get_links(parent2,child2,link2);\n console.log(parent2);\n }\n\n // more than 3 graphs\n if(graphs.length>=3){\n parent3 = new Array();\n child3 = new Array();\n link3 = new Array();\n graph1(graphs[2], parent3, child3);\n get_links(parent3,child3,link3);\n }\n\n // exactly 4 graphs\n if(graphs.length >= 4){\n parent4 = new Array();\n child4 = new Array();\n link4 = new Array();\n graph1(graphs[3], parent4, child4);\n get_links(parent4,child4,link4);\n console.log(parent4);\n }\n\n //for splitting divs\n singledisplay();\n // for draw comparison graph\n multidisplay();\n\n // more than 4 graphs -> hint that only 4 will be considered\n // if(graphs.length>4){}\n}", "function constructRDFGraphFunction(transformation) {\n //var prefixersInGUI = transformation.prefixers;\n var i;\n var j;\n var currentGraph = null;\n\n var colKeysClj = new jsedn.Vector([]);\n var columnKeysFromPipeline = transformation.getColumnKeysFromPipeline();\n\n for (i = 0; i < columnKeysFromPipeline.length; ++i) {\n colKeysClj.val.push(new jsedn.sym(columnKeysFromPipeline[i]));\n }\n\n var columnKeysFromGraph = transformation.getColumnKeysFromGraphNodes();\n\n for (i = 0; i < columnKeysFromGraph.length; ++i)\n if (columnKeysFromPipeline.indexOf(columnKeysFromGraph[i]) === -1 && typeof columnKeysFromGraph[i] ===\n 'string') {\n colKeysClj.val.push(new jsedn.sym(columnKeysFromGraph[i]));\n }\n\n var graphFunction = new jsedn.List([\n new jsedn.sym('graph-fn'),\n new jsedn.Vector([\n new jsedn.Map([new jsedn.kw(':keys'), colKeysClj])\n ])\n ]);\n\n var currentGraphJsEdn = null;\n var currentRootJsEdn = null;\n for (i = 0; i < transformation.graphs.length; ++i) {\n currentGraph = transformation.graphs[i];\n\n currentGraphJsEdn = new jsedn.List([jsedn.sym('graph'), currentGraph.graphURI]);\n\n // construct a vector for each of the roots and add it to the graph jsedn\n for (j = 0; j < currentGraph.graphRoots.length; ++j) {\n\n currentRootJsEdn = constructNodeVectorEdn(currentGraph.graphRoots[j], currentGraph);\n\n\n\n if (currentRootJsEdn) {\n if (currentRootJsEdn.constructor === Array) {\n for (var i = 0; i < currentRootJsEdn.length; ++i) {\n\n currentGraphJsEdn.val.push(constructConditionalNodeVectorJsEdn(currentGraph.graphRoots[j], currentRootJsEdn[i]));\n\n }\n } else {\n currentGraphJsEdn.val.push(constructConditionalNodeVectorJsEdn(currentGraph.graphRoots[j], currentRootJsEdn));\n\n }\n\n\n }\n\n\n\n\n }\n\n graphFunction.val.push(currentGraphJsEdn);\n }\n\n var result = new jsedn.List([jsedn.sym('def'), jsedn.sym('make-graph'), graphFunction]);\n\n return result;\n}", "function setup()\n{\n\tvar date = new Date();\n\tvar week = date.getDay();\n\t\n\t// Set diagrams //\n\ttoUniversityDiagram = new Object();\n\ttoUniversityDiagram.minutes = makeMinutesFromDiagram((week==0||week==6) ? toUniversitySat.diagram : toUniversity.diagram);\n\ttoStationDiagram = new Object();\n\ttoStationDiagram.minutes = makeMinutesFromDiagram((week==0||week==6) ? toStationSat.diagram : toStation.diagram);\n\t\n\tupdate();\n\tsetInterval(update, 1000.0);\n\t\n\tvar busWeekElements = window.document.querySelectorAll(\"[data-type=service]\");\n\tfor (var i=0; i<busWeekElements.length; i++) {\n\t\tvar busWeekElement = busWeekElements[i];\n\t\tvar weekdayString = busWeekElement.getAttribute(\"data-weekday\");\n\t\t\n\t\tvar holidayString = busWeekElement.getAttribute(\"data-holiday\");\n\t\tbusWeekElement.innerHTML = (week==0||week==6) ? holidayString : weekdayString;\n\t}\n}", "function setupDiagram(total) {\n\t\tif (total === undefined) total = '{{ student_dsts|length }}'; // total should be the number of destinations\n\t\t\t\t\n\t\tvar nodeDataArray = [];\n\t\tvar i=0;\t\t\t\n\t\tnodeDataArray.push({\n\t\tkey: i,\n\t\tcolor: go.Brush.randomColor(),\n\t\tname: '{{ student.first_name }} {{ student.last_name }}',\n\t\t});\n\t\t\n\t\ti=1;\t\t\n\t {% for dest in student_dsts %} // set the nodes text to students destinations\t\n{% include \"./tree/dst_data.js\" %}\n\t\t\t\n\t\t\tnodeDataArray[i].parent = 0; // all the destinations parent is student\n\t\t\tvar j=i+1;\n\t\t\t{% for goal in dest.children.all() if (goal in student_goals) %} // set the nodes text to destinations goals \t\n{% include \"./tree/goals_data.js\" %}\n\t\t\t\t\n\t\t\t\tnodeDataArray[j].parent = nodeDataArray[i].key;\t\t\t\t\n\t\t\t\tvar k=j+1;\n\t\t\t\t{% for todo in goal.children.all() if (todo in student_todos) %} // set the nodes text to destinations goals \t\n{% include \"./tree/todos_data.js\" %}\n\n\t\t\t\t\tnodeDataArray[k].parent = nodeDataArray[j].key;\n\t\t\t\t\tk++; \t\t\n\t\t\t\t{% endfor %} //todos loop\t\t\t\n\t\t\t\tj++;\n\t\t\t\tj=k;\n\t\t\t\t\n\t\t\t{% endfor %} //goals loop\t\t\t\n\t\t\t\n\t\t\ti=j;\t\t\t\n {% endfor %} // destinations seting text loop\n\n myFullDiagram.model = new go.TreeModel(nodeDataArray);\n }", "function CMProjector() \r\n{\r\n\t\r\n}", "function GlyphrProject(){\n\n\t\t// Default settings for new Glyphr Projects\n\n\t\tthis.projectsettings = {\n\t\t\t// Internal Stuff\n\t\t\tversion: _UI.thisGlyphrStudioVersion,\t\t\t\t// project version\n\t\t\tversionnum: _UI.thisGlyphrStudioVersionNum,\t\t\t// project number version\n\t\t\tinitialversionnum: _UI.thisGlyphrStudioVersionNum,\t// project number version that survives upgrades\n\t\t\tprojectid: false,\t\t\t\t\t\t\t\t\t// A unique ID for this project\n\n\t\t\t// Font Metrics\n\t\t\tname: 'My Font',\t\t// project name (can be different than font names)\n\t\t\tupm: 1000,\t\t\t\t// Units Per Em - (emsize) how tall normal cap letters are\n\t\t\tascent: 700,\t\t\t// ascender\n\t\t\tdescent: -300,\t\t\t// descender\n\t\t\tcapheight: 675,\t\t\t// capital letter height\n\t\t\txheight: 400,\t\t\t// lowercase letter height\n\t\t\tlinegap: 250,\t\t\t// distance between lines\n\t\t\titalicangle: 0,\t\t\t// slant of glyphs, degrees from vertical counterclockwise, or negative for clockwise (ex: -15)\n\t\t\tgriddivisions: 10,\t\t// how many squares of grid per emsize\n\t\t\tovershoot: 10,\t\t\t// overshoot for round glyphs\n\t\t\tdefaultlsb: 20,\t\t\t// default left side bearing\n\t\t\tdefaultrsb: 20,\t\t\t// default right side bearing\n\t\t\tglyphrange: {\t\t\t// canned and custom Unicode ranges\n\t\t\t\tbasiclatin: true,\n\t\t\t\tlatinsupplement: false,\n\t\t\t\tlatinextendeda: false,\n\t\t\t\tlatinextendedb: false,\n\t\t\t\tcustom: [],\n\t\t\t\tfilternoncharpoints: true\n\t\t\t},\n\n\t\t\t// UI stuff\n\t\t\tpointsize: 7,\t\t\t\t\t\t// path point square size\n\t\t\tspinnervaluechange: 1,\t\t\t\t// how much spinner controls change a value\n\t\t\trenderpointssnappedtogrid: true, \t// OpenType.js requires all points be round numbers - project will still store decimals\n\t\t\tcombineshapesonexport: false,\t\t// combine overlapping shapes of the same winding into one shape\n\t\t\tmaxcombineshapesonexport: 30,\t\t// If a glyph has more than this number of shapes, combine will not be attempted\n\t\t\tsvgprecision: 3,\t\t\t\t\t// Decimal precision when creating SVG path data\n\t\t\tshowkeyboardtipsicon: true,\t\t\t// button for keyboard tips on edit canvas\n\t\t\tstoppagenavigation: true,\t\t\t// asks to save on window close or refresh\n\t\t\tformatsavefile: true,\t\t\t\t// makes the JSON save file readable\n\t\t\tshowoutline: false,\t\t\t\t\t// outline shapes when drawing\n\t\t\tshowfill: true,\t\t\t\t\t\t// fill shapes when drawing\n\t\t\tguides: {},\t\t\t\t\t\t\t// user-defined guidelines\n\t\t\tsnaptogrid: false,\t\t\t\t\t// snap to grid lines\n\t\t\tsnaptoguides: false,\t\t\t\t// snap to guide lines\n\t\t\tsnapdistance: 10,\t\t\t\t\t// snap distance\n\t\t\tshowcontextglyphguides: true,\t\t// show horizontal guides & notations for context glyphs\n\t\t\tmarkglyphchooserglyphs: false,\t // mark specific glyphs in the glyph chooser\n\t\t\tcolors: {\n\t\t\t\tglyphfill: 'rgb(0,0,0)',\t\t\t// shape base color\n\t\t\t\tglyphoutline: 'rgb(0,0,0)',\t\t\t// shape outline color\n\t\t\t\tgridtransparency: 85,\t\t\t\t// transparency % for black grid lines\n\t\t\t\tsystemguidetransparency: 75,\t\t// transparency % for system guidelines\n\t\t\t\tcustomguidetransparency: 50,\t\t// transparency % for custom guidelines\n\t\t\t\tcontextglyphtransparency: 40,\t\t// transparency % for context glyphs\n\t\t\t\tguide_dark: 'rgb(204,81,0)',\t\t// Dark OS Guideline\n\t\t\t\tguide_med: 'rgb(255,132,51)',\t\t// Medium OS Guideline\n\t\t\t\tguide_light: 'rgb(255,193,153)',\t// Light OS Guideline\n\t\t\t}\n\t\t};\n\n\t\tthis.metadata = {\n\t\t\t/* Shared Properties */\n\t\t\tshared: '{{sectionbreak}}',\n\t\t\tfont_family: 'My Font',\n\t\t\tfont_style: 'normal',\n\t\t\tpanose_1: '2 0 0 0 0 0 0 0 0 0',\n\t\t\tdesigner: '',\n\t\t\tdesignerURL: '',\n\t\t\tmanufacturer: '',\n\t\t\tmanufacturerURL: '',\n\t\t\tlicense: '',\n\t\t\tlicenseURL: '',\n\t\t\tversion: '',\n\t\t\tdescription: '',\n\t\t\tcopyright: '',\n\t\t\ttrademark: '',\n\n\t\t\t// /* OTF Properties */\n\t\t\t// otf: '{{sectionbreak}}',\n\n\t\t\t/* SVG PROPERTIES */\n\t\t\tsvg: '{{sectionbreak}}',\n\t\t\t// 'units_per_em': 0,\n\t\t\t// 'accent_height': 0,\n\t\t\t// 'ascent': 0,\n\t\t\t// 'cap_height': 0,\n\t\t\t// 'x_height': 0,\n\t\t\t// 'descent': 0,\n\t\t\t// 'bbox': 0,\n\t\t\t// 'unicode_range': 0,\n\t\t\tfont_variant: 'normal',\n\t\t\tfont_weight: 400,\t\t// Default to 400\n\t\t\tfont_stretch: 'normal',\n\t\t\tstemv: 0,\n\t\t\tstemh: 0,\n\t\t\tslope: 0,\n\t\t\t// 'font_size': 'all',\n\t\t\t// 'widths': 0,\n\t\t\t// 'ideographic': 0,\n\t\t\t// 'alphabetic': 0,\n\t\t\t// 'mathematical': 0,\n\t\t\t// 'hanging': 0,\n\t\t\t// 'v_ideographic': 0,\n\t\t\t// 'v_alphabetic': 0,\n\t\t\t// 'v_mathematical': 0,\n\t\t\t// 'v_hanging': 0,\n\t\t\tunderline_position: -50,\n\t\t\tunderline_thickness: 10,\n\t\t\tstrikethrough_position: 300,\n\t\t\tstrikethrough_thickness: 10,\n\t\t\toverline_position: 750,\n\t\t\toverline_thickness: 10\n\t\t};\n\n\t\tthis.glyphs = {};\n\n\t\tthis.ligatures = {};\n\n\t\tthis.kerning = {};\n\n\t\tthis.components = {};\n\t}", "function createVisualization(json) {\n\n // Basic setup of page elements.\n initializeBreadcrumbTrail();\n\n // Bounding circle underneath the sunburst, to make it easier to detect\n // when the mouse leaves the parent g.\n vis.append(\"svg:circle\")\n .attr(\"r\", radius )\n .style(\"opacity\", 0);\n\n // For efficiency, filter nodes to keep only those large enough to see.\n var nodes = partition.nodes(json)\n .filter(function(d) {\n return (d.dx > 0.005); // 0.005 radians = 0.29 degrees\n });\n\n path = vis.data([json]).selectAll(\"path\")\n .data(nodes)\n .enter()/*\n .append(\"a\")\n .attr(\"xlink:href\", function(d){ return \"https://en.wikipedia.org#\";} )\n .attr(\"target\",\"_blank\")*/\n .append(\"svg:path\")\n .attr(\"display\", function(d) { return d.depth ? null : \"none\"; })\n .attr(\"d\", arc)\n .attr(\"fill-rule\", \"evenodd\")\n .style(\"fill\", \"white\" )\n .style(\"stroke\", \"#ddd\" )\n .style(\"stroke-width\", \"1\" ) \n .style(\"fill\", function(d,i) {\n return color_random(d.name.replace(\"Wikipedia:\",\"\")); //colors[d.name];\n })\n .style(\"opacity\", 1)\n .style(\"cursor\", \"pointer\")\n .attr(\"id\",function(d){\n return d.depth+\"_\"+d.name.replace(':','') ;\n })\n //.on(\"click\", enableCenter)\n .on(\"mouseenter\", enableCenter);\n \n var limitTextDisplay = 500;\n var radiusD = radius -400;\n var adjustR = { r1:radiusD-185 , r2:radiusD-75 , r3:radiusD-94 , r4:radiusD-85 };\n var text = vis.selectAll(\"text\")\n .data(nodes)\n .enter()\n .append(\"text\")\n .attr(\"text-anchor\", \"left\")\n .attr(\"alignment-baseline\", \"middle\")\n .attr(\"class\", \"pathlabel\" )\n .attr(\"x\", function (d) { \n if(d.depth == 1)\n return adjustR.r1 / Math.PI * d.depth;\n else if(d.depth == 2)\n return adjustR.r2 / Math.PI * d.depth;\n else if(d.depth == 3)\n return adjustR.r3 / Math.PI * d.depth;\n else \n return adjustR.r4 / Math.PI * d.depth;\n })\n .attr(\"y\", function(d) { return d.cy; })\n .text(function (d) {\n return d.name;\n })\n .style(\"opacity\",function(d){\n if(+d.depth==1 && +d.value > 1800) \n return 1; \n else if((+d.depth== 3 && +d.value > 800) || (+d.depth== 2 && +d.value > 1000))\n return 1;\n else if((+d.depth== 4 && +d.value > 342))\n return 1;\n else\n return 0.01;\n })\n .attr(\"transform\", function (d) {\n var r = 180 * ((d.x + d.dx / 2 - Math.PI / 2) / Math.PI);\n return \"rotate(\" + r + \")\"\n })\n .on(\"mouseenter\", enableCenter);\n \n // Add the mouseleave handler to the bounding circle.\n //d3.select(\"#chart\").on(\"mouseleave\", disableCenter);\n //d3.select(\"#explanation\").on(\"click\", disableCenter);\n \n // Get total size of the tree = value of root node from partition.\n totalSize = path.node().__data__.value;\n \n //set all extra attributes to the arces \n setTimeout(setExtraAttributes, 500)\n \n }", "function Graph() {\n /**\n * Calculates the cost along the edge of a node\n * @method\n */\n this.calculateCost = function(sourceNode, targetNode) {\n let xDist = targetNode.xPos - sourceNode.xPos;\n let yDist = targetNode.yPos - sourceNode.yPos;\n\n return Math.sqrt(xDist * xDist + yDist * yDist);\n };\n\n /**\n * Adds an edge between two nodes.\n * @method\n */\n this.addEdge = function(sourceNode, targetNode, cost) {\n // Figure out the cost if it wasn't passed into this function\n if (cost === undefined) {\n cost = this.calculateCost(sourceNode, targetNode);\n }\n\n //add the edge to the source node\n sourceNode.edges.push(new Edge(targetNode, cost));\n };\n\n /**\n * Adds a node to the graph\n * @method\n * @param {Number} xPos - The x-position of the node\n * @param {Number} yPos - The y-position of the node.\n * @returns {Node} - The node that was just added\n * @todo Check for pre-existing node before adding another identical one\n */\n this.createNode = function(xPos, yPos) {\n let node = new GraphNode(xPos, yPos);\n this.nodes.push(node);\n return node;\n };\n\n /**\n * connects the nearby nodes together\n * @method\n * @param {Number} costThreshold - The maximum for which\n * nodes will be connected\n */\n this.connectNearbyNodes = function(costThreshold) {\n if (this.nodes.length > 0) {\n for (let node of this.nodes) {\n // create a list of nodes that are within or equal to the cost threshold\n this.nodes.forEach(consideredNode => {\n if (consideredNode !== node) {\n let cost = this.calculateCost(node, consideredNode);\n if (cost <= costThreshold) {\n this.addEdge(node, consideredNode, cost);\n }\n }\n });\n }\n }\n };\n\n\n /**\n * finds a node based on the co-ords provided\n * @param {Number} x - The x-position of the node\n * @param {Number} y - The y-position of the node\n * @returns {(Node|undefind)} - Node if exists\n */\n this.findNode = function(x, y, radius = 1) {\n // find closest node based on area search of area defined by radius\n // return this.nodes.filter(node => {\n // let xDist = x - node.xPos;\n // let yDist = y - node.yPos;\n // return Math.sqrt(xDist * xDist + yDist * yDist) <= radius;\n // });\n\n // if the coords are right, return the node\n return this.nodes.find(node => {\n return node.x === x && node.y === y;\n });\n };\n\n /**\n * @member {Array.<GraphNodes>} nodes - A list of nodes\n */\n this.nodes = [];\n\n this.populateGraph = function(isGrid) {\n if (isGrid) {\n\n };\n };\n\n this.generateSeedMap = () => {\n const config = {\n // iMax: Math.floor(0.02 * window.innerWidth),\n iMax: 16,\n jMax: 9 \n };\n\n let xInterval = Math.floor(window.innerWidth / config.iMax);\n let yInterval = Math.floor(window.innerHeight / config.jMax);\n\n const offset = (intervalLength) => Math.random() * intervalLength;\n\n for (let i = 1; i < config.iMax; i++) {\n for (let j = 1; j < config.jMax; j++) {\n let iDistributed = Math.floor((i * xInterval) + offset(xInterval) - offset(xInterval));\n let jDistributed = Math.floor((j * xInterval) + offset(yInterval) - offset(yInterval));\n // info.push({x: iDistributed, y: jDistributed});\n this.createNode(iDistributed, jDistributed);\n }\n }\n this.connectNearbyNodes(210);\n };\n}", "function main() {\n startSlideShowAnimation();\n renderProject();\n}", "_transformModel(sitawareChorModel) {\n console.log('Received following model:');\n console.log(sitawareChorModel);\n\n // the elements of the situation-aware choreography model\n let sitawareChorModelDefinitions = sitawareChorModel['bpmn2:definitions'];\n\n let cliMethods = this._getMethods(this.cli);\n let bpmnjsMethods = this._getMethods(this.bpmnjs);\n let bpmnFactoryMethods = this._getMethods(this.bpmnFactory);\n let bpmnRendererMethods = this._getMethods(this.bpmnRenderer);\n let chorModelMethods = this._getMethods(sitawareChorModel);\n let modelingMethods = this._getMethods(this.modeling);\n\n console.log('CLI methods: ');\n console.log(cliMethods);\n\n console.log('bpmnJs methods: ');\n console.log(bpmnjsMethods);\n\n console.log('bpmnFacMethods:');\n console.log(bpmnFactoryMethods);\n\n console.log('bpmnRenderer Methods :');\n console.log(bpmnRendererMethods);\n\n console.log('SitAware Chor Model Methods: ');\n console.log(chorModelMethods);\n\n console.log('Modeling Methods: ');\n console.log(modelingMethods);\n\n this.modeling.makeCollaboration();\n\n let collaborationRootElementId = this._getCollaborationId();\n\n this._removeAll([collaborationRootElementId]);\n\n console.log('Currently there are the following elements:');\n console.log(this.cli.elements());\n\n console.log('With the following definitions: ');\n console.log(this.bpmnjs.getDefinitions);\n\n // we will create the collaboration model within these elements\n let sitawareCollabModelDefinitions = this.bpmnjs.getDefinitions();\n\n // find all participants of the model\n let participants = this._findParticipants(sitawareChorModel);\n console.log('Found following participants: ');\n console.log(participants);\n\n // find all available situations\n let situations = this._findSituations(sitawareChorModel);\n console.log('Found following situations: ');\n console.log(situations);\n\n let y_index = 1;\n\n // for each participant and situation we create a participant inside the new collaboration model\n for (let index = 0; index < participants.length; index++) {\n let participant = participants[index];\n this._createParticipant(participant.id, participant.name, 100, 100 * (y_index), collaborationRootElementId, sitawareCollabModelDefinitions, true);\n y_index++;\n }\n\n let sitawareChorModelStartEvents = this._findStartEvents(sitawareChorModel);\n\n console.log('Found following start events: ');\n console.log(sitawareChorModelStartEvents);\n\n let visited = [];\n let created = [];\n console.log('Starting choreography to collaboration walk to create tasks in participants:');\n this._choreography2collaborationWalk(sitawareChorModelStartEvents, visited, created, sitawareChorModel, sitawareCollabModelDefinitions);\n\n console.log('Starting to connect created tasks');\n this._transformChoreographyFlowToCollaborationFlow(created, sitawareChorModel, sitawareCollabModelDefinitions);\n\n console.log('Finished creating collaboration');\n\n\n console.log('Creating Situation-Aware logic:');\n for (let index = 0; index < situations.length; index++) {\n let situation = situations[index];\n console.log('Adding Situation to collaboration');\n this._createParticipant(this._createSituationId(situation.situationname), situation.situationname, 300 , 100 * (y_index), collaborationRootElementId, sitawareCollabModelDefinitions, false);\n y_index++;\n }\n\n this._transformSituationAwareScopes(sitawareChorModel, sitawareCollabModelDefinitions);\n\n this._layout();\n }", "function vis(links) {\n\n // Compute the distinct nodes from the links.\n links.forEach(function (link, i) {\n link.source = nodes[link.source] || (nodes[link.source] = {\n name: link.source\n });\n link.target = nodes[link.target] || (nodes[link.target] = {\n name: link.target\n });\n link.symptom = (symptom[i] = {\n symp: link.symptom\n });\n\t\tlink.psych_symp = (psySymp[i] = {\n\t\t\tpsySymp: link.psych_symp\n\t\t});\n });\n\n var force = d3.layout.force()\n .nodes(d3.values(nodes))\n .links(links)\n .size([width, height])\n /* This only matters if nodes aren't fixed\n\t\t.linkDistance(function (d) {\n return 200 / d.weight;\n })\n .charge(-100)\n\t\t.friction(0.7)*/\n .on(\"tick\", tick)\n .start();\n\n\tvar svg = d3.select(\"body\").selectAll(\"svg#graph\");\n\t\n\tsvg.selectAll(\".link\").remove();\n\t\n var link = svg.selectAll(\".link\")\n .data(force.links())\n .enter().append(\"line\")\n\t\t/*.attr(\"stroke-width\", function (d) {\n //return d.weight / 50;\n\t\t\tvar thickness = d3.scale.linear()\n\t\t\t\t.domain([0, 1000])\n\t\t\t\t.range([1, 15])\n\t\t\t\t.clamp(true);\n\t\t\treturn thickness(d.weight);\n })*/\n\t\t.attr(\"opacity\", function (d) {\n //return d.weight / 50;\n\t\t\tvar thickness = d3.scale.linear()\n\t\t\t\t.domain([0, 1000])\n\t\t\t\t.range([0.1, 1])\n\t\t\t\t.clamp(true);\n\t\t\treturn thickness(d.weight);\n })\n .attr(\"class\", \"link\");\n\n\tsvg.selectAll(\".node\").remove();\n\t\t\t\n var node = svg.selectAll(\".node\")\n .data(force.nodes())\n .enter().append(\"g\")\n .attr(\"class\", \"node\")\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout)\n\t\t.on(\"click\", mouseclick);\n\t\t//.call(force.drag); //dragable\n\n node.append(\"circle\")\n .attr(\"r\", 4)\n\t\t.style(\"fill\", function(d) {\n\t\t\tvar form = d3.select(\"#symptomForm\");\n\t\t\tvar sympArray = d3.values(symptom);\n\t\t\tif(form[0][0][1].checked == true && sympArray[d.index].symp[0] == \"1\") {\t// sore\n return color[1];\n } else if (form[0][0][2].checked == true && sympArray[d.index].symp[1] == \"1\") { // runnynose\n return color[2];\n } else if (form[0][0][3].checked == true && sympArray[d.index].symp[2] == \"1\") { // fever\n return color[3];\n } else if (form[0][0][4].checked == true && sympArray[d.index].symp[3] == \"1\") { // nausea\n return color[4];\n\t\t\t} else if (form[0][0][0].checked == true && (sympArray[d.index].symp[0] == \"1\" || sympArray[d.index].symp[1] == \"1\" || sympArray[d.index].symp[2] == \"1\" || sympArray[d.index].symp[3] == \"1\")) { // any\n\t\t\t\treturn color[0];\n } else {\n\t\t\t\treturn \"#8B8B7A\";\n\t\t\t}\n\t\t})\n\t\t.style(\"visibility\", function(d) {\n\t\t\tvar form = d3.select(\"#psysymptomForm\");\n\t\t\tvar psyArray = d3.values(psySymp);\n\t\t\t\n\t\t\tif(form[0][0][0].checked == true && (psyArray[d.index].psySymp[0] == \"1\" || psyArray[d.index].psySymp[1] == \"1\")) {\n\t\t\t\treturn \"hidden\";\n\t\t\t} else if (form[0][0][1].checked == true && psyArray[d.index].psySymp[0] == \"1\") {\n\t\t\t\treturn \"hidden\";\n\t\t\t} else if (form[0][0][2].checked == true && psyArray[d.index].psySymp[1] == \"1\") {\n\t\t\t\treturn \"hidden\";\n\t\t\t} else {\n\t\t\t\treturn \"visible\";\n\t\t\t}\n\t\t});\n\n\tnode.append(\"rect\")\n\t\t.attr(\"width\", 7)\n\t\t.attr(\"height\", 7)\n\t\t.attr(\"x\", -3.5)\n\t\t.attr(\"y\", -3.5)\n\t\t.style(\"fill\", function(d) {\n\t\t\tvar form = d3.select(\"#symptomForm\");\n\t\t\tvar sympArray = d3.values(symptom);\n\t\t\tif(form[0][0][1].checked == true && sympArray[d.index].symp[0] == \"1\") {\t// sore\n return color[1];\n } else if (form[0][0][2].checked == true && sympArray[d.index].symp[1] == \"1\") { // runnynose\n return color[2];\n } else if (form[0][0][3].checked == true && sympArray[d.index].symp[2] == \"1\") { // fever\n return color[3];\n } else if (form[0][0][4].checked == true && sympArray[d.index].symp[3] == \"1\") { // nausea\n return color[4];\n\t\t\t} else if (form[0][0][0].checked == true && (sympArray[d.index].symp[0] == \"1\" || sympArray[d.index].symp[1] == \"1\" || sympArray[d.index].symp[2] == \"1\" || sympArray[d.index].symp[3] == \"1\")) { // any\n\t\t\t\treturn color[0];\n } else { // none\n\t\t\t\treturn \"#8B8B7A\";\n\t\t\t}\n\t\t})\n\t\t.style(\"visibility\", function(d) {\n\t\t\tvar form = d3.select(\"#psysymptomForm\");\n\t\t\tvar psyArray = d3.values(psySymp);\n\t\t\t\n\t\t\tif(form[0][0][0].checked == true && (psyArray[d.index].psySymp[0] == \"1\" || psyArray[d.index].psySymp[1] == \"1\")) {\n\t\t\t\treturn \"visible\";\n\t\t\t} else if (form[0][0][1].checked == true && psyArray[d.index].psySymp[0] == \"1\") {\n\t\t\t\treturn \"visible\";\n\t\t\t} else if (form[0][0][2].checked == true && psyArray[d.index].psySymp[1] == \"1\") {\n\t\t\t\treturn \"visible\";\n\t\t\t} else { // none\n\t\t\t\treturn \"hidden\";\n\t\t\t}\n\t\t});\n\t\n node.append(\"text\")\n .attr(\"x\", 12)\n .attr(\"dy\", \".35em\")\n .text(function (d) {\n return d.name;\n });\n\n function tick() {\n\t\n node\n\t\t\t.classed(\"fixed\", function (d) {\n\t\t\t\t// fixing the nodes as desired\n\t\t\t\td.fixed = true;\n\t\t\t\td.x = 250 + 50 * (d.index % 10);\n\t\t\t\td.y = 40 + 50 * (d.index / 10)\n\t\t\t})\n .attr(\"transform\", function (d) {\n return \"translate(\" + d.x + \",\" + d.y + \")\";\n\t\t\t\t// this new return will keep the circles within the canvas\n\t\t\t\t// TODO: create a radios variable to change the number 10\n //return \"translate(\" + Math.max(10, Math.min(width - 10, d.x)) + \",\" + Math.max(10, Math.min(height - 10, d.y)) + \")\";\n\t\t\t\t\n });\n\t\t\n link\n .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 }\n\n function mouseover(d, i) {\n\n // Figure out the neighboring node id's with brute strength \"because the graph is small\"\n // this still a concern\n var nodeNeighbors = links.filter(function (link) {\n // Filter the list of links to only those links that have our target \n // node as a source or target\n return link.source.index === d.index || link.target.index === d.index;\n })\n .map(function (link) {\n // Map the list of links to a simple array of the neighboring indices - this is\n // technically not required but makes the code below simpler because we can use \n // indexOf instead of iterating and searching ourselves.\n return link.source.index === d.index ? link.target.index : link.source.index;\n });\n\n\n // now we select the neighboring circles and apply whatever style we want. \n // Note that we could also filter a selection of links in this way if we want to \n // Highlight those as well\n svg.selectAll('circle').filter(function (node) {\n // I filter the selection of all circles to only those that hold a node with an\n // index in my listg of neighbors\n return nodeNeighbors.indexOf(node.index) > -1;\n })\n .transition().duration(750)\n .attr(\"r\", 16);\n\t\t\n\t\tsvg.selectAll('rect').filter(function (node) {\n\t\t\t// I filter the selection of all circles to only those that hold a node with an\n\t\t\t// index in my listg of neighbors\n\t\t\t\treturn nodeNeighbors.indexOf(node.index) > -1;\n\t\t\t})\n\t\t\t.transition().duration(750)\n\t\t\t.attr(\"width\", 28)\n\t\t\t.attr(\"height\", 28)\n\t\t\t.attr(\"x\", -14)\n\t\t\t.attr(\"y\", -14);\n\n // Apply effects on lines\n /*svg.selectAll(\"line\").filter(function (d) {\n return d.source.index == i || d.target.index == i;\n }).each(function (dLink, iLink) {\n //unfade links and nodes connected to the current node\n d3.select(this)\n .transition().duration(750)\n //.style(\"stroke-width\", \"2px\")\n .style(\"opacity\", 1);\n //.style(\"stroke\", \"orange\");\n });*/\n }\n\n function mouseout() {\n\n d3.select(\"svg#graph\").selectAll(\"circle\").transition()\n .duration(750)\n .attr(\"r\", 4);\n \n\t\td3.select(\"svg#graph\").selectAll(\"rect\").transition()\n\t\t\t.duration(750)\n\t\t\t.attr(\"width\", 7)\n\t\t\t.attr(\"height\", 7)\n\t\t\t.attr(\"x\", -3.5)\n\t\t\t.attr(\"y\", -3.5);\n\n /*d3.select(\"svg#graph\").selectAll(\"line\")\n .transition().duration(750)\n .style(\"opacity\", 0.3);\n\t\t*/\n }\n\t\n\tvar clicked = false;\t// true highlight, false unhighlight\n\tfunction mouseclick(d) {\n\t\n\t\tif(!clicked) {\n\t\t\tclicked = !clicked;\n\t\t\t\n\t\t\t//d3.select(this).select(\"circle, rect\").attr(\"class\", \"clicked\");\n\t\t\thighlight(d);\n\t\t\t\n\n\t\t}\n\t\telse {\n\t\t\tclicked = !clicked;\n\t\t\tsvg.selectAll('circle, rect, text')\n\t\t\t\t.transition().duration(750)\n\t\t\t\t.style(\"opacity\", 1);\n\t\t\t\n\t\t\tsvg.selectAll('line')\n\t\t\t\t.transition().duration(750)\n\t\t\t\t.style(\"visibility\", \"visible\");\n\t\t}\n\t}\n\t\n\tfunction highlight(d) {\n\t\tvar i = d.index;\n\t\t//console.log(d);\n\t\tvar nodeNeighbors = links.filter(function (link) {\n\t\t\t\treturn link.source.index === d.index || link.target.index === d.index;\n\t\t\t})\n\t\t\t.map(function (link) {\n\t\t\t\treturn link.source.index === d.index ? link.target.index : link.source.index;\n\t\t\t});\n\t\t\n\t\tconsole.log(nodeNeighbors);\n\n\t\tsvg.selectAll('circle, rect, text').filter(function (node) {\n\t\t\t\treturn !(nodeNeighbors.indexOf(node.index) > -1);\n\t\t\t})\n\t\t\t.transition().duration(750)\n\t\t\t.style(\"opacity\", 0.1);\n\t\t\n\t\t// Apply effects on lines\n svg.selectAll(\"line\").filter(function (d) {\n return !(d.source.index == i || d.target.index == i);\n }).each(function (dLink, iLink) {\n d3.select(this)\n .transition().duration(750)\n .style(\"visibility\", \"hidden\");\n });\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}", "function goto_meta_input() {\n read_proj();\n}", "mainLogic() {\n this.apexParser = new ApexParser(this.accessModifiers,this.sourceDirectory);\n const filesArray = this.getClassFilesFromPackageDirectories();\n\n //Create a new array of ClassModels\n const classModels = this.getClassModelsFromFiles(filesArray);\n const mapGroupNameToClassGroup = this.createMapGroupNameToClassGroup(classModels, this.sourceDirectory);\n\n const projectDetail = this.fm.parseHTMLFile(this.bannerFilePath);\n const homeContents = this.fm.parseHTMLFile(this.homefilepath);\n this.fm.createDoc(mapGroupNameToClassGroup, classModels, projectDetail, homeContents, this.hostedSourceUrl);\n console.log('ApexDoc has completed!');\n }", "function DesignModel(apc,seq,lab) {\n this.apc = apc;\n this.seq = seq;\n this.lab = lab||null;\n this.me1 = 0.0; // mfe for state 1\n this.me2 = 0.0; // mfe for state 2 (no bonus)\n this.ns1 = null; // mfe (natural) shape str for state 1\n this.ns2 = null; // mfe (natural) shape str for state 2\n this.rep = null; // reporter site \n this.apt = null; // aptamer site for state2\n this.con = null; // aptamer constraint for state2\n this.pp1 = null; // pairing probabilities for state 1\n this.pp2 = null; // pairing probabilities for state 2 (with bonus)\n this.dp1 = null; // dotplot for state 1\n this.dp2 = null; // dotplot for state 2\n this.changed = true;\n this.got = null;\n this.snippet = '';\n this.viewers = {}; // who to notify of changes\n this.noInterest = function (viewer) { \n delete this.viewers[viewer];\n return this;\n }\n this.addInterest = function (viewer,cb) { \n if (cb) this.viewers[viewer] = cb;\n else delete this.viewers[viewer];\n return this;\n }\n return this;\n}", "function createVisualization(json) {\n\n // Basic setup of page elements.\n drawLegend();\n \n // Bounding circle underneath the sunburst, to make it easier to detect\n // when the mouse leaves the parent g.\n vis.append(\"svg:circle\")\n .attr(\"r\", radius)\n .style(\"opacity\", 0);\n\n // For efficiency, filter nodes to keep only those large enough to see.\n var nodes = partition.nodes(json)\n .filter(function(d) {\n return (d.dx > 0.005); // 0.005 radians = 0.29 degrees\n });\n \n var path = vis.data([json]).selectAll(\"path\")\n .data(nodes)\n .enter().append(\"svg:path\")\n .attr(\"display\", function(d) { return d.depth ? null : \"none\"; })\n .attr(\"d\", arc)\n .attr(\"fill-rule\", \"evenodd\")\n .style(\"fill\", function(d) { \n var c= colors[d.name.toLowerCase()];\n if(d.parent && d.parent.name != \"root\"){\n c = colors[d.parent.name.toLowerCase()];\n step = 0.5;\n if (!c){\n c= colors[d.parent.parent.name.toLowerCase()];\n step = step *2;\n }\n c = d3.hsl(c).brighter(step); \n \n }\n \n\n return c;})\n .style(\"opacity\", 1)\n .on(\"mouseover\", mouseover);\n\n // Add the mouseleave handler to the bounding circle.\n d3.select(\"#container\").on(\"mouseleave\", mouseleave);\n\n // Get total size of the tree = value of root node from partition.\n totalSize = path.node().__data__.value;\n\n\n d3.select(\"svg\")\n .append(\"text\")\n .attr(\"class\",\"label main\")\n .attr('transform', 'translate(350, 260)')\n .attr(\"dy\", \"0.2em\")\n .attr(\"text-anchor\", \"middle\")\n .text(\"Elegí algún círcuclo.\");\n\n d3.select(\"svg\")\n .append(\"text\")\n .attr(\"class\",\"btn price\")\n .attr('transform', 'translate(350, 230)')\n .attr(\"dy\", \"0.2em\")\n .attr(\"text-anchor\", \"middle\")\n .text(\"$\");\n d3.select(\"svg\")\n .append(\"text\")\n .attr(\"class\",\"btn small percentage\")\n .attr('transform', 'translate(350, 210)')\n .attr(\"dy\", \"0.2em\")\n .attr(\"text-anchor\", \"middle\")\n .text(\"%\");\n\n }", "function initDiagram() {\n\n myDiagram =\n _G(go.Diagram, \"myDiagramDiv\", // create a Diagram for the DIV HTML element\n {\n // position the graph in the middle of the diagram\n initialContentAlignment: go.Spot.Center,\n // allow double-click in background to create a new node\n // \"clickCreatingTool.archetypeNodeData\": {\n // text: \"Node\",\n // color: \"white\"\n // },\n // allow Ctrl-G to call groupSelection()\n \"commandHandler.archetypeGroupData\": {\n text: \"Module\",\n isGroup: true,\n color: \"blue\"\n },\n // enable undo & redo\n \"undoManager.isEnabled\": true\n });\n // These nodes have text surrounded by a rounded rectangle\n // whose fill color is bound to the node data.\n // The user can drag a node by dragging its TextBlock label.\n // Dragging from the Shape will start drawing a new link.\n myDiagram.nodeTemplate =\n _G(go.Node, \"Auto\", {\n locationSpot: go.Spot.Center,\n desiredSize: new go.Size(100, 100)\n },\n _G(go.Shape, new go.Binding(\"figure\", \"fig\"), {\n fill: \"white\", // the default fill, if there is no data-binding\n portId: \"\",\n cursor: \"pointer\", // the Shape is the port, not the whole Node\n // allow all kinds of links from and to this port\n fromLinkable: true,\n fromLinkableSelfNode: false,\n fromLinkableDuplicates: false,\n toLinkable: true,\n toLinkableSelfNode: false,\n toLinkableDuplicates: false\n },\n new go.Binding(\"fill\", \"color\")),\n _G(go.Panel, \"Table\", {\n defaultAlignment: go.Spot.Left,\n margin: 4,\n cursor: \"move\"\n },\n _G(go.RowColumnDefinition, {\n column: 1,\n width: 4\n }),\n _G(go.TextBlock, {\n row: 0,\n column: 0,\n columnSpan: 3,\n alignment: go.Spot.Center\n }, {\n font: \"bold 12pt sans-serif\"\n },\n new go.Binding(\"text\", \"text\")),\n _G(go.TextBlock, \"Index: \", {\n row: 1,\n column: 0\n }, {\n font: \"bold 8pt sans-serif\"\n }),\n _G(go.TextBlock, {\n row: 1,\n column: 2\n }, {\n font: \"8pt sans-serif\"\n },\n new go.Binding(\"text\", \"key\")),\n _G(go.TextBlock, \"Title: \", {\n row: 2,\n column: 0\n }, {\n font: \"bold 8pt sans-serif\"\n }),\n _G(go.TextBlock, {\n row: 3,\n column: 0\n }, {\n font: \"8pt sans-serif\"\n },\n new go.Binding(\"text\", \"title\"))\n ), { // this tooltip Adornment is shared by all nodes\n toolTip: _G(go.Adornment, \"Auto\",\n _G(go.Shape, {\n fill: \"#FFFFCC\"\n }),\n _G(go.TextBlock, {\n margin: 4\n }, // the tooltip shows the result of calling nodeInfo(data)\n new go.Binding(\"text\", \"\", nodeInfo))\n ),\n // this context menu Adornment is shared by all nodes\n contextMenu: partContextMenu\n }\n );\n // The link shape and arrowhead have their stroke brush data bound to the \"color\" property\n myDiagram.linkTemplate =\n _G(go.Link, {\n toShortLength: 3,\n relinkableFrom: true,\n relinkableTo: true\n }, // allow the user to relink existing links\n _G(go.Shape, {\n strokeWidth: 2\n },\n new go.Binding(\"stroke\", \"color\")),\n _G(go.Shape, {\n toArrow: \"Standard\",\n stroke: null\n },\n new go.Binding(\"fill\", \"color\")), { // this tooltip Adornment is shared by all links\n toolTip: _G(go.Adornment, \"Auto\",\n _G(go.Shape, {\n fill: \"#FFFFCC\"\n }),\n _G(go.TextBlock, {\n margin: 4\n }, // the tooltip shows the result of calling linkInfo(data)\n new go.Binding(\"text\", \"\", linkInfo))\n ),\n // the same context menu Adornment is shared by all links\n contextMenu: partContextMenu\n }\n );\n // Define the appearance and behavior for Groups:\n function groupInfo(adornment) { // takes the tooltip or context menu, not a group node data object\n var g = adornment.adornedPart; // get the Group that the tooltip adorns\n var mems = g.memberParts.count;\n var links = 0;\n g.memberParts.each(function(part) {\n if (part instanceof go.Link) links++;\n });\n return \"Group \" + g.data.key + \": \" + g.data.text + \"\\n\" + mems + \" members including \" + links + \" links\";\n }\n // Groups consist of a title in the color given by the group node data\n // above a translucent gray rectangle surrounding the member parts\n myDiagram.groupTemplate =\n _G(go.Group, \"Vertical\", {\n selectionObjectName: \"PANEL\", // selection handle goes around shape, not label\n ungroupable: true\n }, // enable Ctrl-Shift-G to ungroup a selected Group\n _G(go.TextBlock, {\n font: \"bold 19px sans-serif\",\n isMultiline: false, // don't allow newlines in text\n editable: true // allow in-place editing by user\n },\n new go.Binding(\"text\", \"text\").makeTwoWay(),\n new go.Binding(\"stroke\", \"color\")),\n _G(go.Panel, \"Auto\", {\n name: \"PANEL\"\n },\n _G(go.Shape, \"Rectangle\", // the rectangular shape around the members\n {\n fill: \"rgba(128,128,128,0.2)\",\n stroke: \"gray\",\n strokeWidth: 3\n }),\n _G(go.Placeholder, {\n padding: 10\n }) // represents where the members are\n ), { // this tooltip Adornment is shared by all groups\n toolTip: _G(go.Adornment, \"Auto\",\n _G(go.Shape, {\n fill: \"#FFFFCC\"\n }),\n _G(go.TextBlock, {\n margin: 4\n },\n // bind to tooltip, not to Group.data, to allow access to Group properties\n new go.Binding(\"text\", \"\", groupInfo).ofObject())\n ),\n // the same context menu Adornment is shared by all groups\n contextMenu: partContextMenu\n }\n );\n // Define the behavior for the Diagram background:\n function diagramInfo(model) { // Tooltip info for the diagram's model\n return \"Model:\\n\" + model.nodeDataArray.length + \" nodes, \" + model.linkDataArray.length + \" links\";\n }\n // provide a tooltip for the background of the Diagram, when not over any Part\n myDiagram.toolTip =\n _G(go.Adornment, \"Auto\",\n _G(go.Shape, {\n fill: \"#FFFFCC\"\n }),\n _G(go.TextBlock, {\n margin: 4\n },\n new go.Binding(\"text\", \"\", diagramInfo))\n );\n // provide a context menu for the background of the Diagram, when not over any Part\n myDiagram.contextMenu =\n _G(go.Adornment, \"Vertical\",\n makeButton(\"Paste\",\n function(e, obj) {\n e.diagram.commandHandler.pasteSelection(e.diagram.lastInput.documentPoint);\n },\n function(o) {\n return o.diagram.commandHandler.canPasteSelection();\n }),\n makeButton(\"Undo\",\n function(e, obj) {\n e.diagram.commandHandler.undo();\n },\n function(o) {\n return o.diagram.commandHandler.canUndo();\n }),\n makeButton(\"Redo\",\n function(e, obj) {\n e.diagram.commandHandler.redo();\n },\n function(o) {\n return o.diagram.commandHandler.canRedo();\n })\n );\n}", "visualize() {\n // grid, startnode, finishnode \n if (this.state.start_node_col === null) {\n return;\n }\n const { grid } = this.state;\n // eslint-disable-next-line\n this.state.actionCount++;\n const startNode = grid[this.state.start_node_row][this.state.start_node_col];\n const finishNode = grid[this.state.finish_node_row][this.state.finish_node_col];\n //call the selected algorithm \n var algo = this.state.currentAlgo;\n var visitedNodesInOrder;\n if (algo === 'greedy') {\n visitedNodesInOrder = bfs(grid, startNode, finishNode);\n }\n else if (algo === 'dijkstra') {\n visitedNodesInOrder = dijkstra(grid, startNode, finishNode);\n }\n else if (algo === 'dfs') {\n visitedNodesInOrder = dfs(grid, startNode, finishNode);\n }\n else if (algo === 'a') {\n visitedNodesInOrder = bfs(grid, startNode, finishNode);\n }\n else { //bfs\n visitedNodesInOrder = bfs(grid, startNode, finishNode);\n }\n if (algo === 'bfs') {\n this.animateBfs(visitedNodesInOrder);\n } else {\n this.animateAlgo(visitedNodesInOrder);\n }\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 }", "function visualizationLogic(){\n console.log(\"Visualization Logic\")\n //text\n //INFO from: https://earthquake.usgs.gov/earthquakes/browse/significant.php#sigdef\n // let t2 = createP('Events in this list and shown in red on our real-time earthquake map and list are considered “significant events’,<br>and they are determined by a combination of magnitude, number of Did You Feel It responses, and PAGER alert level.');\n // t2.class('small');\n // t2.parent('canvas1');\n // t2.position(0,0);\n\n //-------------------------------------------------------------//\n // 1. Magnitude Level //\n //-------------------------------------------------------------//\n\n //Variables for All\n let legendW = 60;\n //Variables for Magnitude\n let Mag_Legends = [0, 1, 3, 4.5, 6, 9];\n let Mag_xPos = (cWidth - Mag_Legends.length * legendW)/2; //CENTER THEM\n let Mag_margin = 10;\n let Mag_angle = 0;\n\n //Variables for Significance\n let minSig = minValue(quakes, 'sig');\n let maxSig = maxValue(quakes, 'sig');\n console.log(`MinSig is ${minSig} MaxSig is ${maxSig}`);\n let sig_Legends = [0, 100, 200, 400, 600, 1000, 1500];\n let sig_xPos = (cWidth - sig_Legends.length * legendW)/2; //CENTER THEM\n let sig_margin = 10;\n\n textFont(font1);\n //\n push();\n translate(Mag_xPos, legendW); \n for (let i = 0; i < Mag_Legends.length; i ++) {\n let myAPT_W, myAPT_H;\n myAPT_W = map(1000, 0, 1500, 1, legendW/2); \n myAPT_H = 2 * myAPT_W;\n Mag_angle = radians ( map(Mag_Legends[i], 0, 9, 0, 90) ); //Input, min, max, 0, 90\n //This is the class for the buildings;\n //\n push();\n let xTrans = legendW/2 - myAPT_W/2;\n translate(xTrans, 0); // ****************. FIX THIS PART\n rotate(Mag_angle);\n //2. Building \n let mySigC = sigScale(1000).hex();\n let myMagC = magScale(Mag_Legends[i]).hex();\n myMagC = color(myMagC);\n myMagC.setAlpha(150); // Add Alpha\n fill(mySigC);\n strokeWeight(1);\n stroke('#000000');\n rect(0, 0, myAPT_W, - myAPT_H);//x, y, w, h\n //3. Window\n fill('#ffffff');\n strokeWeight(0.5);\n let myWindowW = map(400, 0, 1500, 1, legendW/7);\n let myWindwX1 = legendW/2 - myAPT_W/5 - myWindowW/2 - xTrans;\n let myWindwX2 = myWindwX1 + 2*(myAPT_W/5) ;\n rect(myWindwX1, - myAPT_H/4 + myWindowW/2, myWindowW, - myWindowW); \n rect(myWindwX1, - (myAPT_H/4) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(myWindwX1, - (myAPT_H/4) * 3 + myWindowW/2, myWindowW, - myWindowW);\n rect(myWindwX2, - myAPT_H/4 + myWindowW/2, myWindowW, - myWindowW); \n rect(myWindwX2, - (myAPT_H/4) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(myWindwX2, - (myAPT_H/4) * 3 + myWindowW/2, myWindowW, - myWindowW);\n //4. Rooftop\n let x1, y1;\n x1 = legendW/2 - myAPT_W/2 - xTrans;\n y1 = - myAPT_H;\n let h = map(1000, 0, 1500, 1, myWindowW);\n line(x1, y1, x1 - h, y1 - h); //Left\n line(x1 + myAPT_W, y1, x1 + myAPT_W + h, y1 - h); //Right\n line(x1 - h, y1 - h, x1 + myAPT_W + h, y1 - h); //top\n pop();\n //1. Ground\n noStroke(); \n fill(myMagC);\n rect(Mag_margin, 0, legendW - 2 * Mag_margin, 15 * map(Mag_Legends[i], 0, 9, 0, 90)/90 ); ////x, y, w, h\n //5. -- Legend Text Below -- //\n noStroke();\n fill('orange');\n textSize(12);\n textAlign(CENTER);\n text(Mag_Legends[i], legendW/2, 35); //text,x, y\n //6. //Move to the next spot to the Right (Add scale)\n translate(legendW, 0); \n }\n pop();\n //Text Description\n textAlign(CENTER);\n textSize(15);\n text(\"Magnitude Level\", cWidth/2, legendW*1.9); \n\n //-------------------------------------------------------------//\n // 2. Significance Level //\n //-------------------------------------------------------------//\n // Cali range 0 from 640, World Range from 0 to 1492\n\n push();\n translate(sig_xPos, legendYPos + legendW + sig_margin); //x, y\n for (let i = 0; i < sig_Legends.length; i ++) {\n let myAPT_W, myAPT_H;\n myAPT_W = map(sig_Legends[i], 0, 1500, 1, legendW/2); //Input, min, max,\n myAPT_H = 2 * myAPT_W; //2 Times over -> Max will be 60\n //This is the class for the buildings;\n //1. Ground\n // noStroke();\n // fill(magScale(0).hex()); //Show the Color at Mag = 0;\n // //fill('rgba(150, 75, 0, 0.5)'); // Brown //************** Should be re-written \n // rect(sig_margin, 0, legendW - 2 * sig_margin, 20); ////x, y, w, h\n //2. Building //Half Point: legendW/2\n let myC = sigScale(sig_Legends[i]).hex();\n fill(myC);\n strokeWeight(1);\n stroke('#000000');\n rect(legendW/2 - myAPT_W/2, 0, myAPT_W, - myAPT_H);//x, y, w, h\n //3. Apartment Windows\n fill('#ffffff');\n strokeWeight(0.5);\n let myWindowW = map(sig_Legends[3], 0, 1500, 1, legendW/7);\n if (sig_Legends[i] < 200) { // No Window\n console.log(\"Sig level below 200 - No Window\");\n }\n if (sig_Legends[i] >= 200 && sig_Legends[i] < 400) { //One Window\n console.log(\"Sig level between 200 & 400\"); \n rect(legendW/2 - myWindowW/2, - myAPT_H/2 + myWindowW/2, myWindowW, - myWindowW); \n } \n if (sig_Legends[i] >= 400 && sig_Legends[i] < 600) { //Two Windows\n console.log(\"Sig level between 400 & 600\"); \n rect(legendW/2 - myWindowW/2, - myAPT_H/3 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 - myWindowW/2, - (myAPT_H/3) * 2 + myWindowW/2, myWindowW, - myWindowW);\n }\n if (sig_Legends[i] >= 600 && sig_Legends[i] < 1000) { //Two Windows * 2 Cols\n console.log(\"Sig level between 600 & 1000\"); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - myAPT_H/3 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/3) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - myAPT_H/3 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/3) * 2 + myWindowW/2, myWindowW, - myWindowW);\n }\n if (sig_Legends[i] >= 1000 && sig_Legends[i] < 1500) { //Two Windows * 3 Cols\n console.log(\"Sig level between 1000 & 1500\"); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - myAPT_H/4 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/4) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/4) * 3 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - myAPT_H/4 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/4) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/4) * 3 + myWindowW/2, myWindowW, - myWindowW);\n }\n if (sig_Legends[i] >= 1500) { //Two Windows * 3 Cols\n console.log(\"Sig level Over 1500\"); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - myAPT_H/6 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 3 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 4 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 - myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 5 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - myAPT_H/6 + myWindowW/2, myWindowW, - myWindowW); \n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 2 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 3 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 4 + myWindowW/2, myWindowW, - myWindowW);\n rect(legendW/2 + myAPT_W/5 - myWindowW/2, - (myAPT_H/6) * 5 + myWindowW/2, myWindowW, - myWindowW);\n }\n //4. RoofTop - 3 lines;\n let x1, y1, x2, y2;\n x1 = legendW/2 - myAPT_W/2;\n y1 = - myAPT_H;\n let h = map(sig_Legends[i], 0, 1500, 1, myWindowW);\n line(x1, y1, x1 - h, y1 - h); //Left\n line(x1 + myAPT_W, y1, x1 + myAPT_W + h, y1 - h); //Right\n line(x1 - h, y1 - h, x1 + myAPT_W + h, y1 - h); //top\n //5. -- Legend Text Below -- //\n noStroke();\n fill('#cccccc');\n textSize(12);\n textAlign(CENTER);\n text(sig_Legends[i], legendW/2, 15); //text,x, y\n //6. //Move to the next spot to the Right (Add scale)\n translate(legendW, 0); \n }\n pop();\n //Text Description\n textAlign(CENTER);\n textSize(15);\n fill('#000000');\n text(\"Significance Level\", cWidth/2, legendYPos + legendW*1.75);\n\n\n}", "function start() { \n initiate_graph_builder();\n initiate_job_info(); \n initiate_aggregate_info();\n initiate_node_info();\n}", "function createGraph()\n\t{\n\t\tgraph = that.add('graph', {\n\t\t\tw: that.size,\n\t\t\th: that.size,\n\t\t\tinputCount: that.inputCount,\n\t\t\teq: [{eq:that.eq.eq, color: style.eqColor}],\n\t\t\txRange: that.axis.x,\n\t\t\tyRange: that.axis.y,\n\t\t\tlabelSkip: that.axis.skip,\n\t\t\tusePiLabels: that.axis.usePiLabels\n\t\t}, {\n\t\t\ttop: that.id + ' top ' + style.margin,\n\t\t\tleft: that.id + ' left ' + style.margin\n\t\t});\n\t}", "project() {\r\n for (let j = 0; j < this.objs.length; j++) {\r\n let item = this.objs[j];\r\n for (let i = 0; i < item.vertexs.length && i < 3; i++) {\r\n if (item.changed[i]) { // if the drawable has moved position\r\n let fur = this.locate(item.vertexs[i]);\r\n let htheta = Math.atan(fur[2]/fur[0]); // verticle theta\r\n let vtheta = Math.atan(fur[1]/fur[0]); // horizontal theta\r\n\r\n //console.log('fur', fur, 'horiz theta', htheta, 'verticle theta', vtheta);\r\n\r\n if (Math.abs(htheta) < this.cam.fovHoriz && \r\n Math.abs(vtheta) < this.cam.fovVert) item._visible[i] = true;\r\n else item._visible[i] = false;\r\n\r\n // this could be changed to be xy scaled by distance?\r\n let w = this.cvs.width/2;\r\n let h = this.cvs.height/2;\r\n item.projected[i] = [\r\n w + (htheta/this.cam.fovHoriz * w), \r\n h - (vtheta/this.cam.fovVert * h), \r\n fur[2]\r\n ];\r\n \r\n //console.log('vertex visible', item._visible[i], item.projected[i]);\r\n }\r\n }\r\n \r\n }\r\n }", "getAspectText(asp) {\n let info = {}\n let ref = this.getReferenceById(asp.id)\n\n info.name = ref.name;\n info.nodesText = []\n \n for (let x in asp.nodes) {\n let nodeSubIndex = asp.nodes[x]\n let node = {parent: null, subNode: null, subNodeIndex: null,}\n \n node.parent = ref.nodesText[x].parent\n\n node.subNode = ref.nodesText[x].subNodes[nodeSubIndex]\n node.subNodeIndex = nodeSubIndex\n\n info.nodesText.push(node)\n }\n\n return info;\n }", "function setParameters(){\n // magins and dimensions of the svg\n \n var paneDimensions= d3.select('.left.paneContent').node().getBoundingClientRect();\n margin = {top: 20, right: 40, bottom: 40, left: 40};\n width = paneDimensions.width - margin.left - margin.right;\n height = paneDimensions.height- 42 - margin.top - margin.bottom;\n\n // Adds the svg canvas\n svg = d3.select(element[0])\n .append(\"div\")\n .classed(\"svg-container\", true) //container class to make it responsive\n .append(\"svg\")\n .attr(\"viewBox\", \"0 0 \"+ (width + margin.left + margin.right)+\n ' '+ (height + margin.top + margin.bottom))\n .classed(\"svg-content-responsive\", true)\n .append(\"g\")\n .classed('dominationGraph',true)\n .attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\")\n .style(\"pointer-events\", \"all\");\n // .call(zoom);\n\n // creates graph backdrop\n svg\n .append(\"rect\")\n .attr(\"width\", width)\n .attr(\"height\", height)\n .attr('fill','#ddd')\n .attr('stroke','black')\n .attr('class','domGraph');\n\n svg.append('g')\n .style(\"pointer-events\", \"all\");\n\n // creates the clipping rectangle\n svg.append(\"clipPath\")\n .attr(\"id\", \"clip3\")\n .append(\"rect\")\n .attr(\"width\", width)\n .attr(\"height\", height);\n\n \n var force = d3.layout.force()\n .charge(-120)\n .linkDistance(10)\n .size([width, height])\n .gravity(1);\n\n\n $http.get(\"getGraph\")\n \t.success(function(graph) {\n\t var linkg = svg.append(\"g\")\n\t .attr('class','links');\n\t \n\t var link = linkg.selectAll(\".link\")\n\t .data(graph.links)\n\t .enter().append(\"line\")\n\t .attr(\"class\", function(d){return \"link source\" +d.source+\" target\"+d.target;})\n\t .style(\"stroke-width\", function(d) { \n\t return 1;//Math.sqrt(d.value);\n\t });\n\t\n\t // console.log(link);\n\t\n\t var nodeg = svg.append(\"g\")\n\t .attr('class','nodes');\n\t\n\t var nodes = nodeg.selectAll(\".node\")\n\t .data(graph.nodes)\n\t .enter().append(\"circle\")\n\t .attr(\"class\", \"node\")\n\t .attr(\"r\", 3)\n\t .attr('index', function(d,i){\n\t return i;\n\t })\n\t .attr('id',function(d){ return 'did'+d.id;})\n\t .attr('clip-path','url#clip3')\n\t .on(\"mouseover\",function(d){\n\t \tconsole.log(\"highlighting\"+d.id);\n\t \t\n\t \t//gets all links with this node as a source or target\n\t var source = d3.selectAll(\".source\"+d.id);\n\t var target = d3.selectAll(\".target\"+d.id);\n\t\n\t source.each(function(element){\n\t // console.log(this);\n\t\n\t linkg.append('line')\n\t .attr(\"x1\", this.getAttribute('x1'))\n\t .attr(\"y1\", this.getAttribute('y1'))\n\t .attr(\"x2\", this.getAttribute('x2'))\n\t .attr(\"y2\", this.getAttribute('y2'))\n\t .attr(\"class\",\"link link\"+d.id+\" highlight \");\n\t });\n\t target.each(function(element){\n\t\n\t linkg.append('line')\n\t .attr(\"x1\", this.getAttribute('x1'))\n\t .attr(\"y1\", this.getAttribute('y1'))\n\t .attr(\"x2\", this.getAttribute('x2'))\n\t .attr(\"y2\", this.getAttribute('y2'))\n\t .attr(\"class\",\"link link\"+d.id+\" highlight\");\n\t });\n\t\n\t })\n\t .on(\"mouseout\",function(d){\n\t \t//removes all highlighted links\n\t d3.selectAll('.link.link'+d.id+'.highlight')\n\t .remove();\n\t });\n\t\n\t\n\t var nodeReference = {};\n\t\n\t var findNode =function(id){\n\t id = id.toString();\n\t if(nodeReference.hasOwnProperty(id)){\n\t if(nodeReference[id]==='null') return null;\n\t else return nodeReference[id];\n\t }\n\t\n\t var searchedNode =d3.select('#did'+id);\n\t // console.log(searchedNode.empty());\n\t if(searchedNode.empty()){\n\t nodeReference[id]='null';\n\t return null; \n\t } \n\t else {\n\t // console.log(\"Found ID: \" + id);\n\t var nodeIndex = Number(searchedNode.attr('index'));\n\t nodeReference[id] = nodeIndex;\n\t return nodeIndex;\n\t }\n\t };\n\t\n\t // var brokenLinks =0;\n\t // graph.links.forEach(function(d) {\n\t // if (typeof d.source == \"number\") { d.source = findNode(d.source); }\n\t // if (typeof d.target == \"number\") { d.target = findNode(d.target); }\n\t // if(d.source===null || d.target===null) brokenLinks++;\n\t // });\n\t\n\t // console.log(Object.keys(nodeReference));\n\t // console.log(Object.keys(nodeReference).filter(function(id){\n\t // return nodeReference[id.toString()] === 'null';\n\t // }));\n\t // console.log(graph.links);\n\t\n\t force\n\t .nodes(graph.nodes)\n\t .links(graph.links);\n\t\n\t // console.log(\"done adjusting graph\");\n\t\n\t $http.get(\"getGroup?groupnumber=123\")\n\t\t .success(function(groups) {\n\t\t console.log(groups);\n\t\t for( var group in groups){\n\t\t groups[group].forEach(setGroups, group);\n\t\t \n\t\t var groupg=nodeg.append('g')\n\t\t .attr('class','layer '+group);\n\t\t\n\t\t var nodeGroup = svg.selectAll('.node.'+group);\n\t\t // console.log(group);\n\t\t // console.log(nodeGroup);\n\t\t // console.log(nodeGroup.empty());\n\t\t if(!nodeGroup.empty()){\n\t\t nodeGroup.each(function(d,i){\n\t\t // console.log(d3.select(this).node());\n\t\t var removed = d3.select(this).remove();\n\t\t groupg.append(function() {\n\t\t return removed.node();\n\t\t });\n\t\t });\n\t\t }\n\t\t }\n\t\t //sort nodes in by groups\n\t\t\n\t\t // console.log(graph.nodes);\n\t\t var step = 2*Math.PI/graph.nodes.length;\n\t\t var ellipseX = function(angle){//angle is in radians\n\t\t return (width-10)/2*Math.cos(angle);\n\t\t };\n\t\t var ellipseY = function(angle){//angle is in radians\n\t\t return (height-10)/2*Math.sin(angle);\n\t\t };\n\t\t\n\t\t nodes.attr(\"cx\", function(d,i){return ellipseX(i*step)+width/2;})\n\t\t .attr(\"cy\",function(d,i){return ellipseY(i*step)+height/2;});\n\t\t\n\t\t\n\t\t\n\t\t link.each(function(d,i){\n\t\t var source = d3.select('#did'+d.source);\n\t\t var target = d3.select('#did'+d.target);\n\t\t if(i%1000===0){\n\t\t // console.log('source: #did'+d.source+' target: #did'+d.target);\n\t\t // console.log(source.node());\n\t\t // console.log(target.node());\n\t\t }\n\t\t var thisLink = d3.select(this);\n\t\t if(i%1000===0){\n\t\t // console.log(this);\n\t\t // console.log(thisLink);\n\t\t }\n\t\t thisLink\n\t\t .attr(\"x1\", function(d) { return source.attr('cx'); })\n\t\t .attr(\"y1\", function(d) { return source.attr('cy'); })\n\t\t .attr(\"x2\", function(d) { return target.attr('cx'); })\n\t\t .attr(\"y2\", function(d) { return target.attr('cy'); });\n\t\t\n\t\t if(i%1000===0){\n\t\t // console.log(this);\n\t\t // console.log(thisLink);\n\t\t }\n\t\t })\n\t\n\t // console.log(graph.links);\n\t\n\t console.log('Finished Dom Graph');\n\t\n\t // console.log(nodes);\n\t\n\t // nodes.append(\"title\")\n\t // .text(function(d) { return 'did'+d.id; });\n\t\n\t // console.log(\"start adjusting graph\");\n\t // console.log(force.links());\n\t\n\t // console.log(force.nodes());\n\t\n\t // var m=300;\n\t // console.log(m);\n\t \n\t // var n = nodes.length;\n\t // nodes.forEach(function(d, i) {\n\t // d.x = d.y = width / n * i;\n\t // });\n\t\n\t\n\t // force.start();\n\t // console.log('starting ticks');\n\t // for (var i = 0; i < m; ++i) {\n\t // if(i%10 === 0) {console.log('tick: '+i);}\n\t // force.tick();\n\t // }\n\t // force.stop();\n\t // // console.log(link); \n\t \n\t\n\t // force.on(\"tick\", function() { \n\t // link.attr(\"x1\", function(d) { return d.source.x; })\n\t // .attr(\"y1\", function(d) { return d.source.y; })\n\t // .attr(\"x2\", function(d) { return d.target.x; })\n\t // .attr(\"y2\", function(d) { return d.target.y; });\n\t\n\t // nodes.attr(\"cx\", function(d) { return d.x; })\n\t // .attr(\"cy\", function(d) { return d.y; });\n\t // });\n\t\n\t // force.on(\"tick\", function(e) {\n\t\n\t // nodes.attr(\"transform\", function(d) { \n\t // //TODO move these constants to the header section\n\t // //center the center (root) node when graph is cooling down\n\t // if(d.classed('Group2')){\n\t // damper = 0.1;\n\t // d.x = d.x + (w/2 - d.x) * (damper + 0.71) * e.alpha;\n\t // d.y = d.y + (h/2 - d.y) * (damper + 0.71) * e.alpha;\n\t // }\n\t // //start is initiated when importing nodes from XML\n\t // if(d.start === true){\n\t // d.x = w/2;\n\t // d.y = h/2;\n\t // d.start = false;\n\t // }\n\t\n\t // r = d.name.length;\n\t // //these setting are used for bounding box, see [http://blockses.appspot.com/1129492][1]\n\t // d.x = Math.max(r, Math.min(w - r, d.x));\n\t // d.y = Math.max(r, Math.min(h - r, d.y));\n\t\n\t // return \"translate(\"+d.x+\",\"+d.y+\")\"; \n\t\n\t // });\n\t // }); \n\t\n\t // nodes.attr(\"cx\", function(d) { return d.x; })\n\t // .attr(\"cy\", function(d) { return d.y; });\n\t\n\t // link.attr(\"x1\", function(d) { return d.source.x; })\n\t // .attr(\"y1\", function(d) { return d.source.y; })\n\t // .attr(\"x2\", function(d) { return d.target.x; })\n\t // .attr(\"y2\", function(d) { return d.target.y; });\n\t\n\t // console.log(force.nodes());\n\t // console.log(force.links());\n\t\n\t })\n\t .error(function(){\n\t \tconsole.log(\"Error geting groups for dom graph\")\n\t });\n\t })\n\t .error(function(){\n\t \tconsole.log(\"Error geting dom graph\")\n\t });\n\n function setGroups(gNode, index, array){\n// if(index%1000 === 0){\n// \tconsole.log(this);\n// \tconsole.log(gNode.id)}\n \tvar id = gNode.id;\n svg.select('#did'+id)\n \t.classed(this,true);\n }\n\n }", "function getMASAsDot() {\n let dot = [];\n\n get('./overview').then(function(mas) {\n let overview = JSON.parse(mas);\n\n dot.push(\"digraph G { graph [ rankdir=\\\"TB\\\" bgcolor=\\\"transparent\\\"]\\n\");\n\n /* Organisation dimension */\n dot.push(\"\\tsubgraph cluster_org {\\n\");\n dot.push(\"\\t\\tlabel=\\\"organisation\\\" labeljust=\\\"r\\\" pencolor=gray fontcolor=gray\\n\");\n let orglinks = [];\n overview.agents.forEach(function(a) {\n a.roles.forEach(function(r) {\n dot.push(\"\\t\\t\\\"\" + r.group + \"\\\" [ \" + \"label = \\\"\" + r.group + \"\\\" shape=tab style=filled pencolor=black fillcolor=lightgrey];\\n\");\n orglinks.push(\"\\t\\\"\" + r.group + \"\\\"->\\\"\" + a.agent + \"\\\" [arrowtail=normal dir=back label=\\\"\" + r.role + \"\\\"]\\n\");\n });\n a.missions.forEach(function(m) {\n dot.push(\"\\t\\t\\\"\" + m.scheme + \"\\\" [ \" + \"label = \\\"\" + m.scheme + \"\\\" shape=hexagon style=filled pencolor=black fillcolor=linen];\\n\");\n orglinks.push(\"\\t\\\"\" + m.scheme + \"\\\"->\\\"\" + a.agent + \"\\\" [arrowtail=normal dir=back label=\\\"\" + m.mission + \"\\\"]\\n\");\n m.responsibles.forEach(function(r) {\n orglinks.push(\"\\t\\\"\" + r + \"\\\"->\\\"\" + m.scheme +\n \"\\\" [arrowtail=normal arrowhead=open label=\\\"responsible\\\\nfor\\\"]\\n\");\n dot.push(\"\\t\\t{rank=same \\\"\" + r + \"\\\" \\\"\" + m.scheme + \"\\\"};\\n\");\n });\n });\n });\n dot.push(\"\\t};\\n\");\n dot.push(orglinks.join(\" \"));\n\n /* agents dimension */\n dot.push(\"\\tsubgraph cluster_ag {\\n\");\n dot.push(\"\\t\\tlabel=\\\"agents\\\" labeljust=\\\"r\\\" pencolor=gray fontcolor=gray\\n\");\n let ags = [];\n overview.agents.forEach(function(x) {\n ags.push(x.agent);\n var s1 = (x.agent.length <= MAX_LENGTH) ? x.agent : x.agent.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(\"\\t\\t\\\"\" + x.agent + \"\\\" [label = \\\"\" + s1 + \"\\\" shape = \\\"ellipse\\\" style=filled fillcolor=white];\\n\");\n });\n if (ags.length > 0) dot.push(\"\\t\\t{rank=same \\\"\" + ags.join(\"\\\" \\\"\") + \"\\\"};\\n\");\n dot.push(\"\\t};\\n\");\n\n /* Environment dimension */\n dot.push(\"\\tsubgraph cluster_env {\\n\");\n dot.push(\"\\t\\tlabel=\\\"environment\\\" labeljust=\\\"r\\\" pencolor=gray fontcolor=gray\\n\");\n overview.agents.forEach(function(ag) {\n let wksartifacts = [];\n if (Object.keys(ag.workspaces).length > 0) {\n Object.keys(ag.workspaces).forEach(function(w) {\n let envlinks = [];\n let wks = ag.workspaces[w];\n let wksName = wks.workspace;\n dot.push(\"\\t\\tsubgraph cluster_\" + wksName + \" {\\n\");\n dot.push(\"\\t\\t\\tlabel=\\\"\" + wksName + \"\\\" labeljust=\\\"r\\\" style=dashed pencolor=gray40 fontcolor=gray40\\n\");\n Object.keys(wks.artifacts).forEach(function(a) {\n if (HIDDEN_ARTS.indexOf(wks.artifacts[a].type) < 0) {\n s1 = (wks.artifacts[a].artifact.length <= MAX_LENGTH) ? wks.artifacts[a].artifact :\n wks.artifacts[a].artifact.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(\"\\t\\t\\t\\\"\" + wksName + \"_\" + wks.artifacts[a].artifact + \"\\\" [label = \\\"\" + s1 + \":\\\\n\");\n s1 = (wks.artifacts[a].type.length <= MAX_LENGTH) ? wks.artifacts[a].type :\n wks.artifacts[a].type.substring(0, MAX_LENGTH) + \" ...\";\n dot.push(s1 + \"\\\"shape=record style=filled fillcolor=white];\\n\");\n wksartifacts.push(wksName + \"_\" + wks.artifacts[a].artifact);\n envlinks.push(\"\\t\\t\\\"\" + ag.agent + \"\\\"->\\\"\" + wksName + \"_\" + wks.artifacts[a].artifact + \"\\\" [arrowhead=odot]\\n\");\n }\n });\n\n if (wksartifacts.length > 0) dot.push(\"\\t\\t\\t{rank=same \\\"\" + wksartifacts.join(\"\\\" \\\"\") + \"\\\"};\\n\");\n dot.push(\"\\t\\t};\\n\");\n dot.push(envlinks.join(\" \"));\n });\n }\n });\n dot.push(\"\\t};\\n\");\n\n dot.push(\"}\\n\");\n\n /* Transition follows modal top down movement */\n var t = d3.transition().duration(750).ease(d3.easeLinear);\n d3.select(\"#overviewgraph\").graphviz().transition(t).renderDot(dot.join(\"\"));\n });\n}", "function main() {\n const allResults = [];\n fs.readdirSync(constants.OUT_PATH).forEach(siteDir => {\n const sitePath = path.resolve(constants.OUT_PATH, siteDir);\n if (!utils.isDir(sitePath)) {\n return;\n }\n allResults.push({site: siteDir, results: analyzeSite(sitePath)});\n });\n const generatedResults = groupByMetrics(allResults);\n fs.writeFileSync(\n GENERATED_RESULTS_PATH,\n `var generatedResults = ${JSON.stringify(generatedResults)}`\n );\n console.log('Opening the charts web page...'); // eslint-disable-line no-console\n opn(path.resolve(__dirname, 'index.html'));\n}", "function prepareProject() {\n var project = angular.copy($scope.project);\n loDash.forEach(project.mappings, function(mapping) {\n if (mapping.transformation &&\n mapping.transformation.function &&\n mapping.transformation.function.components &&\n mapping.transformation.function.components.length === 0) {\n\n delete mapping.transformation;\n }\n });\n return project;\n }", "function projectBuild(){\n projectArray.push(new Project(\"Some of my finished projects\" , \"This is text\", \"../images/js.png\", \"https://github.com\"))\n projectArray.push(new Project(\"Stroll Trek Run\", \"An application that shows good walking locations. It uses primarily uses Express, Passport, MongoDB\", \"../images/js.png\", \"https://github.com\"))\n projectArray.push(new Project(\"Cat And the Bear\", \"A Pub Ordering Single Page Web Application. It uses React through Create-React-App. For the backend. it uses Google's Firebase for Authentication and Database duties\", \"/resources/origin1.png\", \"https://github.com\"))\n projectArray.push(new Project(\"Kangdemic\", \"A clone of a popular board game. This is the project I started as I started to learn web development. Purely front-end, it uses HTML, CSS and JS and a library called dragScroll.JS\", \"../images/js.png\", \"https://github.com\"))\n projectArray.push(new Project(\"A whole other bunch of random stuff\", \"Just check out my GitHub Repo for games, wierd experiments and just cool things\", \"/resources/origin1.png\", \"https://github.com\"));\n}", "addTagsToGraph(graph) {\n // Adds vis.js specific tags primarily to style graph as desired\n const g = _.cloneDeep(graph);\n\n // nodes -> node_list\n g.edges = g.edge_list;\n delete g.edge_list;\n g.nodes = g.node_list;\n delete g.node_list;\n\n const nodeTypeColorMap = getNodeTypeColorMap(); // We could put standardized concepts here\n\n const nNodes = g.nodes.length;\n\n g.nodes.forEach((n, i) => {\n const backgroundColor = nodeTypeColorMap(n.type);\n n.color = {\n background: backgroundColor,\n highlight: { background: backgroundColor },\n hover: { background: backgroundColor },\n };\n n.label = n.name;\n });\n\n // Combine support and regular edges together if between the same nodes\n const edgesRegular = g.edges.filter(e => e.type !== 'literature_co-occurrence');\n const edgesSupport = g.edges.filter(e => e.type === 'literature_co-occurrence');\n edgesSupport.forEach((e) => {\n // Make sure support edges actually have publications\n e.duplicateEdge = false; // Also by default do not delete support edges unles duplicate\n if (('publications' in e && Array.isArray(e.publications))) {\n // Everything is good\n } else if (('publications' in e && !Array.isArray(e.publications))) {\n // Single entry comes as a string\n e.publications = [e.publications];\n } else if (!('publications' in e)) {\n e.publications = []; // How did this happen?\n }\n e.moreThanOneEdge = false; // If we don't remove a support edge it is because it is the only left.\n });\n edgesRegular.forEach((e) => {\n // Find support edges between the same two nodes and merge publication lists\n\n // Find existing publications attached to the edge.\n let edgePublications = [];\n if ('publications' in e) {\n if (Array.isArray(e.publications)) {\n edgePublications = e.publications;\n } else if (typeof myVar === 'string') {\n edgePublications = [e.publications];\n }\n }\n\n // Find a corresponding support edge\n const sameNodesSupportEdge = edgesSupport.find(s => (((e.source_id === s.source_id) && (e.target_id === s.target_id)) || ((e.source_id === s.target_id) && (e.target_id === s.source_id))) );\n if (sameNodesSupportEdge) {\n // We have a repeated edge\n sameNodesSupportEdge.duplicateEdge = true; // Mark for deletion\n\n const supportPublications = sameNodesSupportEdge.publications;\n edgePublications = edgePublications.concat(supportPublications);\n edgePublications = edgePublications.filter((p, i, self) => self.indexOf(p) === i); // Unique\n }\n e.publications = edgePublications;\n });\n\n edgesRegular.forEach((e) => {\n // Find edges that go between the same two nodes and mark them accordingly\n\n // Find a corresponding support edge\n const sameNodesEdge = edgesRegular.filter(e2 => (((e.source_id === e2.source_id) && (e.target_id === e2.target_id)) || ((e.source_id === e2.target_id) && (e.target_id === e2.source_id))));\n sameNodesEdge.splice(sameNodesEdge.findIndex(e2 => e2.id === e.id), 1);\n if (sameNodesEdge.length > 0) {\n // We have a repeated edge\n e.moreThanOneEdge = true;\n } else {\n e.moreThanOneEdge = false;\n }\n });\n\n\n // Remove the duplicated support edges\n g.edges = [].concat(edgesSupport.filter(s => !s.duplicateEdge), edgesRegular);\n\n // Remove any straggler duplicate edges (Fix me)\n const fromTo = [];\n const deleteMe = g.edges.map((e) => {\n const thisFromTo = `${e.source_id}_${e.target_id}`;\n if (fromTo.includes(thisFromTo)) {\n return true;\n }\n fromTo.push(thisFromTo);\n return false;\n });\n\n g.edges = g.edges.filter((e, i) => !deleteMe[i]);\n\n // Add parameters to edges like curvature and labels and such\n g.edges = g.edges.map((e) => {\n let typeDependentParams = {};\n let label = e.type;\n const nPublications = e.publications.length;\n if (nPublications > 0) {\n label = `${e.type} (${nPublications})`;\n }\n\n // const value = Math.ceil((Math.log(nPublications + 1) / Math.log(5)) * 2) + 1;\n // const value = Math.ceil((15 / (1 + Math.exp(-1 * (-1 + (0.02 * nPublications))))) - 3);\n const value = (4 / (1 + Math.exp(-1 * (-1 + (0.01 * nPublications))))) - 1;\n\n if (e.type === 'literature_co-occurrence') {\n // Publication Edge\n label = `${nPublications}`; // Remove the type labeled to keep it small\n typeDependentParams = {\n color: this.styles.supportEdgeColors,\n // dashes: [2, 4],\n physics: false,\n font: {\n color: '#777',\n align: 'middle',\n strokeColor: '#fff',\n },\n };\n }\n\n if (this.props.omitEdgeLabel) {\n label = '';\n }\n let smooth = { forceDirection: 'none' };\n if (e.moreThanOneEdge) {\n smooth = { enabled: true, type: 'dynamic' };\n }\n\n e.from = e.source_id;\n e.to = e.target_id;\n const defaultParams = {\n label,\n labelHighlightBold: false,\n value,\n font: {\n color: '#000',\n align: 'top',\n strokeColor: '#fff',\n },\n smooth,\n scaling: {\n min: 0.1,\n max: 10,\n label: false,\n customScalingFunction: (min, max, total, val) => Math.max(val, 0),\n },\n arrowStrikethrough: false,\n };\n\n return { ...e, ...defaultParams, ...typeDependentParams };\n });\n if (!this.props.showSupport) {\n g.edges = g.edges.filter(e => e.type !== 'literature_co-occurrence');\n }\n\n return g;\n }", "draw() {\n // Set up the nodes and links of the graph.\n this.addNodes();\n this.addLinks();\n\n // Create the d3 simulation.\n this.createSimulation();\n\n // Set up SVG to draw the simulation.\n this.setupSvg();\n }", "function prepareImportsGraph(importsGraph) {\n resultedGraph = {};\n resultedGraph[projectName] = {\n id: projectName,\n size: 0\n };\n\n for (let file in importsGraph.index) {\n if (!Object.hasOwnProperty.call(importsGraph.index, file) ||\n excludedSassFiles.test(file) ||\n /^_/.test(path.basename(file))\n ) {\n continue;\n }\n const standaloneFile = path.relative(pathToSCSS, file)\n // replace path separator for deep nested standalone files\n // \"some/other/standalone.scss\" become \"some-other-standalone.scss\"\n .replace(/[\\\\\\\\|/]/g, '-');\n const standaloneFileImports = importsGraph.index[file].imports;\n const initialCtx = projectName + resultDelimiter + standaloneFile;\n\n resultedGraph[initialCtx] = {\n id: initialCtx,\n size: fileSize.getResultedCSSFileSize(path.basename(file), pathToCSS)\n };\n standaloneFileImports.forEach(item => visitAncestors(importsGraph, initialCtx, item));\n }\n}", "function populateVisualisations(con){\n\n console.log(con);\n\n var temp = [];\n\n var parent_of_parent = con['parent_of_parent'];\n parent_of_parent['type'] = \"parent_of_parent\";\n\n var parent = con['parent'];\n parent['type'] = \"parent\";\n\n temp.push(parent_of_parent);\n temp.push(parent);\n\n var siblings = con['siblings'];\n for (var elem in siblings) {\n\n siblings[elem]['type'] = \"sibling\";\n temp.push(siblings[elem]);\n }\n\n var children = con['children'];\n for (var elem in children) {\n children[elem]['type'] = \"child\";\n temp.push(children[elem]);\n }\n\n var initCommentHeight;\n var prevNode;\n contextTree.selectAll(\"circle\")\n .data(temp)\n .enter()\n .append(\"circle\")\n .attr(\"id\", function(d) {\n return d['id'];\n })\n .attr(\"class\", function(d) {\n return d['type'];\n })\n .attr(\"r\", 10)\n .attr(\"cx\", function(d) {\n if (d['type'] == 'parent_of_parent' && parent_of_parent != \"\") {\n return (contextTreeContainer.width() / 5);\n } else if (d['type'] == 'parent') {\n return (contextTreeContainer.width() / 5) * 2;\n } else if (d['type'] == 'sibling') {\n return (contextTreeContainer.width() / 5) * 3;\n } else if (d['type'] == 'child') {\n return (contextTreeContainer.width() / 5) * 4;\n } else {\n console.log(\"No 'type'specified for Node\" + d);\n return 1000;\n }\n })\n .attr(\"cy\", function(d, i) {\n if (d['type'] == 'parent_of_parent' && parent_of_parent != \"\") {\n return detailsHeight/2;\n } else if (d['type'] == 'parent') {\n return detailsHeight/2;\n } else if (d['type'] == 'sibling') {\n if (d['id'] == comment['id']) {\n initCommentHeight = (detailsHeight / (1 + siblings.length)) * (i - 1);\n }\n return (detailsHeight/(1+siblings.length)) * (i-1);\n } else if (d['type'] == 'child') {\n return (detailsHeight/(1+children.length)) * (i-1 - siblings.length);\n } else {\n console.log(\"No 'type'specified for Node\" + d);\n return 1000;\n }\n })\n .attr(\"fill\", function(d){\n if (d['id'] == comment['id']) {\n return \"red\";\n } else {\n return \"green\";\n }\n })\n .on(\"click\", function(d) {\n if (prevNode != undefined) {\n if (prevNode.id == comment['id']){\n d3.select(prevNode)\n .attr(\"fill\", \"red\");\n } else {\n d3.select(prevNode)\n .attr(\"fill\", \"green\");\n }\n }\n prevNode = this;\n d3.select(prevNode)\n .attr(\"fill\", \"violet\");\n updateDetails2(d);\n });\n\n contextTree.selectAll(\"line\")\n .data(temp)\n .enter()\n .append(\"line\")\n .attr(\"id\", function(d) {\n return d['type'];\n })\n .attr(\"x1\", function(d){\n if (d['type'] == 'parent_of_parent') {\n return 1000;\n } else if (d['type'] == 'parent' && parent_of_parent != \"\") {\n return (contextTreeContainer.width() / 5);\n } else if (d['type'] == 'sibling') {\n return (contextTreeContainer.width() / 5) * 2;\n } else if (d['type'] == 'child') {\n return (contextTreeContainer.width() / 5) * 3;\n } else {\n console.log(\"No 'type'specified for Node\" + d);\n return 1000;\n }\n })\n .attr(\"x2\", function(d){\n if (d['type'] == 'parent_of_parent') {\n return 1000;\n } else if (d['type'] == 'parent' && parent_of_parent != \"\") {\n return (contextTreeContainer.width() / 5) * 2;\n } else if (d['type'] == 'sibling') {\n return (contextTreeContainer.width() / 5) * 3;\n } else if (d['type'] == 'child') {\n return (contextTreeContainer.width() / 5) * 4;\n } else {\n console.log(\"No 'type'specified for Node\" + d);\n return 1000;\n }\n })\n .attr(\"y1\", function(d){\n if (d['type'] == 'parent_of_parent') {\n return 1000;\n } else if (d['type'] == 'parent' && parent_of_parent != \"\") {\n return detailsHeight/2;\n } else if (d['type'] == 'sibling') {\n return detailsHeight/2;\n } else if (d['type'] == 'child') {\n return initCommentHeight;\n } else {\n console.log(\"No 'type'specified for Node\" + d);\n return 100;\n }\n })\n .attr(\"y2\", function(d, i){\n if (d['type'] == 'parent_of_parent') {\n return 1000;\n } else if (d['type'] == 'parent' && parent_of_parent != \"\") {\n return detailsHeight/2;\n } else if (d['type'] == 'sibling') {\n return (detailsHeight/(1+siblings.length)) * (i-1);\n } else if (d['type'] == 'child') {\n return (detailsHeight/(1+children.length)) * (i-1 - siblings.length);\n } else {\n console.log(\"No 'type'specified for Node\" + d);\n return 100;\n }\n })\n .attr(\"stroke-width\", 2)\n .attr(\"stroke\", \"black\");\n\n\n details1.selectAll(\"text\")\n .data(lcomment)\n .enter()\n .append(\"text\")\n .attr(\"x\", margin.left)\n .attr(\"y\", function(d, i) {\n return margin.top + i*50;\n })\n .text(function (d, i) {\n return \"\" + keys[i] + \": \" + d;\n })\n .attr(\"font-size\", \"20px\")\n .attr(\"fill\", \"red\");\n\n\n function updateDetails2(d) {\n // clear old details\n details2.selectAll(\"svg > g > *\").remove();\n\n // var lkeys = Object.keys(d);\n // var ld = $.map(comment, function(value, index) {\n // return [value];\n // });\n\n // add new details\n body2Container.html(\"<p>\" + d['body'] + \"</p>\")\n\n delete d['body'];\n\n var counter = 0;\n for (var key in d) {\n if (d.hasOwnProperty(key)) {\n details2.append(\"text\")\n .attr(\"x\", margin.left)\n .attr(\"y\", margin.top + counter*50)\n .text(key + \": \" +d[key])\n .attr(\"font-size\", \"20px\")\n .attr(\"fill\", \"red\");\n }\n counter++;\n }\n\n }\n }", "function loadProject() {\n $scope.loadingBranches = true;\n otGraphqlService.pageGraphQLCall(`query ProjectView($projectId: Int, $branchName: String = null) {\n projects(id: $projectId) {\n id\n name\n description\n annotatedDescription\n disabled\n decorations {\n ...decorationContent\n }\n labels {\n id\n category\n name\n description\n color\n foregroundColor\n computedBy {\n id\n name\n }\n }\n actions {\n updateProject {\n links {\n form {\n description\n method\n uri\n }\n }\n mutation\n }\n deleteProject {\n mutation\n }\n }\n links {\n _self\n _createBranch\n _permissions\n _clone\n _enable\n _disable\n _properties\n _extra\n _events\n _actions\n _labels\n _labelFromToken\n _labelsCreate\n }\n favouriteBranches: branches(favourite: true, order: true) {\n id\n name\n disabled\n decorations {\n ...decorationContent\n }\n creation {\n time\n }\n links {\n _page\n _enable\n _disable\n _delete\n _unfavourite\n _favourite\n }\n promotionLevels {\n id\n name\n image\n _image\n promotionRuns(first: 1) {\n build {\n id\n name\n }\n }\n }\n }\n branches(name: $branchName, count: 20, order: true) {\n id\n name\n disabled\n decorations {\n ...decorationContent\n }\n creation {\n time\n }\n links {\n _page\n _enable\n _disable\n _delete\n _unfavourite\n _favourite\n }\n }\n }\n }\n \n fragment decorationContent on Decoration {\n decorationType\n error\n data\n feature {\n id\n }\n }`, {\n projectId: projectId,\n branchName: $scope.branchFilter.name ? $scope.branchFilter.name : null,\n }).then(function (data) {\n $scope.project = data.projects[0];\n // View commands\n view.commands = [\n {\n condition: function () {\n return $scope.project.links._createBranch;\n },\n id: 'createBranch',\n name: \"Create branch\",\n cls: 'ot-command-branch-new',\n action: function () {\n otStructureService.create($scope.project.links._createBranch, \"New branch\").then(loadProject);\n }\n },\n {\n condition: () => $scope.project.actions.updateProject.mutation,\n id: 'updateProject',\n name: \"Update project\",\n cls: 'ot-command-project-update',\n action: updateProject\n },\n {\n id: 'searchBuild',\n name: \"Search builds\",\n cls: 'ot-command-project-search-builds',\n link: '/build-search/' + $scope.project.id\n },\n {\n condition: function () {\n return $scope.project.links._disable;\n },\n id: 'disableProject',\n name: \"Disable project\",\n cls: 'ot-command-project-disable',\n action: function () {\n ot.pageCall($http.put($scope.project.links._disable)).then(loadProject);\n }\n },\n {\n condition: function () {\n return $scope.project.links._enable;\n },\n id: 'enableProject',\n name: \"Enable project\",\n cls: 'ot-command-project-enable',\n action: function () {\n ot.pageCall($http.put($scope.project.links._enable)).then(loadProject);\n }\n }, {\n id: 'showDisabled',\n name: \"Show all branches\",\n cls: 'ot-command-show-disabled',\n condition: function () {\n return !$scope.showDisabled;\n },\n action: function () {\n $scope.showDisabled = true;\n }\n }, {\n id: 'hideDisabled',\n name: \"Hide disabled branches\",\n cls: 'ot-command-hide-disabled',\n condition: function () {\n return $scope.showDisabled;\n },\n action: function () {\n $scope.showDisabled = false;\n }\n },\n {\n condition: function () {\n return $scope.project.links._labels;\n },\n id: 'labelsProject',\n name: \"Labels\",\n cls: 'ot-command-project-labels',\n action: () => {\n $scope.editProjectLabels();\n }\n },\n {\n condition: function () {\n return $scope.project.links._permissions;\n },\n id: 'permissionsProject',\n name: \"Permissions\",\n cls: 'ot-command-project-permissions',\n link: '/admin-project-acl/' + $scope.project.id\n },\n {\n condition: function () {\n return $scope.project.links._clone;\n },\n id: 'cloneProject',\n name: \"Clone project\",\n cls: 'ot-command-project-clone',\n action: function () {\n otStructureService.getProject($scope.project.id).then(function (project) {\n otCopyService.cloneProject(project).then(function (newProject) {\n $state.go('project', {\n projectId: newProject.id\n });\n });\n });\n }\n },\n {\n condition: () => $scope.project.actions.deleteProject.mutation,\n id: 'deleteProject',\n name: \"Delete project\",\n cls: 'ot-command-project-delete',\n action: deleteProject\n },\n ot.viewActionsCommand($scope.project.links._actions),\n ot.viewCloseCommand('/home')\n ];\n }).finally(function () {\n $scope.loadingBranches = false;\n });\n }", "function refreshProject() {\n\n function refreshNode(node) {\n node.load().complete(function() {\n node.children().forEach(function(child) {\n if (child.children && child.children().length !== 0){\n refreshNode(child);\n }\n });\n });\n }\n refreshNode(tree);\n }", "function test_candu_graphs_datastore_vsphere6() {}", "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 gantt(options) {\n //declare needed variables\n let diagram = eve.initVis(options),\n currentSerie = diagram.series[0],\n maxTaskLength = 0,\n timeDomainStart = null,\n timeDomainEnd = null,\n autoMargin = 0,\n margin = { left: 0, top: 0, right: 0, bottom: 0 },\n axisFormatting = d3.utcFormat('%x'),\n width = 0,\n height = 0,\n dateDiff = 0,\n maxAxisLength = 0,\n singleAxisWidth = 0,\n autoTickCount = 0,\n xScale = null,\n yScale = null,\n xAxis = null,\n yAxis = null,\n tasks = [],\n groups = [],\n xAxisSVG = null,\n taskRects = null,\n taskLabels = null,\n currentRectWidth = 0,\n hasSelection = false,\n minFontSize = 11,\n xPos = 0, yPos = 0,\n bbox = null,\n currentColor = null,\n yAxisSVG = null,\n startDateField = currentSerie.startField || currentSerie.startDateField,\n endDateField = currentSerie.endField || currentSerie.endDateField;\n\n //calculates scales and environmental variables\n function calculateScales(keepAxis) {\n //get min and max values\n maxTaskLength = d3.max(diagram.data, function (d) { return d[currentSerie.sourceField].toString().length; });\n tasks = e.getUniqueValues(diagram.data, currentSerie.sourceField);\n groups = e.getUniqueValues(diagram.data, currentSerie.groupField);\n\n //set domain info\n timeDomainStart = d3.min(diagram.data, function (d) { return new Date(d[startDateField]); });\n timeDomainEnd = d3.max(diagram.data, function (d) { return new Date(d[endDateField]); });\n dateDiff = timeDomainEnd.diff(timeDomainStart);\n\n //set axis formatting via date diff\n if (dateDiff > 365) {\n //set axis formatting\n axisFormatting = d3.utcFormat('%e-%b-%Y');\n } else {\n if (dateDiff < 1) {\n //set axis formatting\n axisFormatting = d3.utcFormat('%X');\n } else {\n //set axis formatting\n axisFormatting = d3.utcFormat('%b-%e');\n }\n }\n\n //calculate margins\n autoMargin = ((diagram.yAxis.labelFontSize / 2) * (maxTaskLength + 1)) + diagram.yAxis.labelFontSize;\n margin.left = diagram.margin.left + autoMargin;\n margin.right = diagram.margin.right;\n margin.top = diagram.margin.top;\n margin.bottom = diagram.margin.bottom;\n\n //set dimension\n width = diagram.plot.width - diagram.plot.left - diagram.plot.right - margin.left - margin.right;\n height = diagram.plot.height - diagram.plot.top - diagram.plot.bottom - margin.top - margin.bottom;\n\n //caclulate tick count\n maxAxisLength = axisFormatting(timeDomainEnd).length;\n singleAxisWidth = (((diagram.xAxis.labelFontSize / 2) * (maxAxisLength)) + diagram.xAxis.labelFontSize);\n autoTickCount = Math.floor(width / singleAxisWidth);\n\n //create scales\n xScale = d3.scaleUtc().domain([timeDomainStart, timeDomainEnd]).range([0, width]).clamp(true);\n yScale = d3.scaleBand().domain(tasks).range([height - margin.top - margin.bottom, 0]).padding(0.1);\n\n //create axes\n xAxis = d3.axisBottom().scale(xScale).ticks(autoTickCount / 2).tickFormat(axisFormatting);\n yAxis = d3.axisLeft().scale(yScale).tickSize(0);\n\n if (currentSerie.labelFontSize === 'auto')\n currentSerie.labelFontSize = 11;\n }\n\n //updates axis\n function updateAxisStyle() {\n //select x axis path and change stroke\n xAxisSVG.selectAll('path')\n .style('stroke-opacity', diagram.xAxis.alpha)\n .style('stroke-width', diagram.xAxis.thickness + 'px')\n .style('stroke', diagram.xAxis.color);\n\n //select all lines in xaxis\n xAxisSVG.selectAll('line')\n .style('fill', 'none')\n .style('stroke-width', diagram.xAxis.thickness + 'px')\n .style('shape-rendering', 'crispEdges')\n .style('stroke-opacity', diagram.xAxis.alpha)\n .style('stroke', diagram.xAxis.color);\n\n //select all texts in xaxis\n xAxisSVG.selectAll('text')\n .style('fill', diagram.xAxis.labelFontColor)\n .style('font-size', diagram.xAxis.labelFontSize + 'px')\n .style('font-family', diagram.xAxis.labelFontFamily + ', Arial, Helvetica, Ubuntu')\n .style('font-style', diagram.xAxis.labelFontStyle === 'bold' ? 'normal' : diagram.xAxis.labelFontStyle)\n .style('font-weight', diagram.xAxis.labelFontStyle === 'bold' ? 'bold' : 'normal')\n .style('text-anchor', 'middle')\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .text(function (d) {\n return axisFormatting(new Date(d));\n });\n\n //select x axis path and change stroke\n yAxisSVG.selectAll('path')\n .style('stroke-opacity', diagram.yAxis.alpha)\n .style('stroke-width', diagram.yAxis.thickness + 'px')\n .style('stroke', diagram.yAxis.color);\n\n //select all lines in yaxis\n yAxisSVG.selectAll('line')\n .style('fill', 'none')\n .style('stroke-width', diagram.yAxis.thickness + 'px')\n .style('shape-rendering', 'crispEdges')\n .style('stroke-opacity', diagram.yAxis.alpha)\n .style('stroke', diagram.yAxis.color);\n\n //select all texts in yaxis\n yAxisSVG.selectAll('text')\n .style('fill', diagram.yAxis.labelFontColor)\n .style('font-size', diagram.yAxis.labelFontSize + 'px')\n .style('font-family', diagram.yAxis.labelFontFamily + ', Arial, Helvetica, Ubuntu')\n .style('font-style', diagram.yAxis.labelFontStyle === 'bold' ? 'normal' : diagram.yAxis.labelFontStyle)\n .style('font-weight', diagram.yAxis.labelFontStyle === 'bold' ? 'bold' : 'normal')\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .text(function (d) { return d; });\n }\n\n //initializes axes for both cases\n function createAxes() {\n //create x axis svg\n xAxisSVG = diagramG.append('g')\n .style('fill', 'none')\n .style('shape-rendering', 'crispEdges')\n .attr('transform', 'translate(0,' + (height - margin.bottom - margin.top) + ')')\n .attr('class', 'eve-x-axis')\n .call(xAxis);\n\n //create y axis left svg\n yAxisSVG = diagramG.append('g')\n .style('fill', 'none')\n .style('shape-rendering', 'crispEdges')\n .attr('transform', 'translate(0)')\n .attr('class', 'eve-y-axis')\n .call(yAxis);\n\n //set axes styling\n updateAxisStyle();\n }\n\n //returns a key for the current task\n let getTaskKey = function (d) {\n return d[startDateField] + d[currentSerie.sourceField] + d[endDateField];\n };\n\n //returns rectangular transform for the current task\n let getTaskTransform = function (d, isInit) {\n return 'translate(' + (isInit ? 0 : xScale(new Date(d[startDateField]))) + ',' + yScale(d[currentSerie.sourceField]) + ')';\n };\n\n //returns rectangular transform for the current task\n let getLabelTransform = function (d, isInit) {\n //get y pos\n xPos = (isInit ? 0 : xScale(new Date(d[startDateField])) + 5)\n yPos = yScale(d[currentSerie.sourceField]) + yScale.bandwidth() / 2 + currentSerie.labelFontSize / 2;\n\n //return translation\n return 'translate(' + xPos + ',' + yPos + ')';\n };\n\n //returns rectangle color for the current task status\n let getTaskStatusColor = function (d) {\n //get color\n let taskColor = e.colors[0],\n groups = [];\n\n //iterate all groups\n diagram.data.forEach(function (currentData) {\n if (groups.indexOf(currentData[currentSerie.groupField]) === -1)\n groups.push(currentData[currentSerie.groupField]);\n });\n\n //sort groups\n groups.sort();\n\n //check whethr the currrent serie has group field\n if (currentSerie.groupField) {\n //check legend values\n if (diagram.legend.legendColors && diagram.legend.legendColors.length) {\n //iterate all legend colors\n diagram.legend.legendColors.forEach(function (l) {\n if (l.value === d[currentSerie.groupField])\n taskColor = l.color;\n });\n } else {\n //iterate all legend colors\n groups.forEach(function (currentGroup, groupIndex) {\n if (currentGroup === d[currentSerie.groupField])\n taskColor = groupIndex > e.colors.length ? e.randColor() : e.colors[groupIndex];\n });\n }\n } else {\n //return serie color if there is no group\n taskColor = diagram.legend.legendColors.length > 0 ? diagram.legend.legendColors[0].color : (i >= e.colors.length ? e.randColor() : e.colors[0]);\n }\n\n //return color for the group\n return taskColor;\n };\n\n //animates diagram\n function animateDiagram() {\n //animate rectangles\n taskRects\n .attr('opacity', diagram.animation.effect === 'add' ? 0 : 1)\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .delay(function (d, i) { return i * diagram.animation.delay; })\n .attr('opacity', 1)\n .style('fill', getTaskStatusColor)\n .attr('transform', function (d) { return getTaskTransform(d, false); })\n .attr('rx', 2)\n .attr('ry', 2)\n .attr('y', 0)\n .attr('height', function (d) { return yScale.bandwidth(); })\n .attr('width', function (d) {\n //set current rectangle width\n currentRectWidth = (xScale(new Date(d[endDateField])) - xScale(new Date(d[startDateField])));\n\n //check width and return\n return currentRectWidth < 0 ? 0 : currentRectWidth;\n });\n\n //animate labels\n taskLabels\n .style('fill-opacity', function (d) {\n //set current rectangle width\n bbox = this.getBBox();\n currentRectWidth = (xScale(new Date(d[endDateField])) - xScale(new Date(d[startDateField])));\n\n //check label visibility\n if (currentSerie.labelVisibility === 'always')\n return currentRectWidth < 0 ? 0 : 1;\n else\n return currentRectWidth > bbox.width ? 1 : 0;\n })\n .transition().duration(diagram.animation.duration)\n .ease(diagram.animation.easing.toEasing())\n .delay(function (d, i) { return i * diagram.animation.delay; })\n .attr('transform', function (d) { return getLabelTransform(d, false); });\n }\n\n //initializes diagram and creates axes\n function initDiagram() {\n //create rectangles\n taskRects = diagramG.selectAll('.eve-gantt-chart')\n .data(diagram.data, getTaskKey)\n .enter().append('rect')\n .attr('class', 'eve-gantt-chart')\n .attr('fill', getTaskStatusColor)\n .attr('fill-opacity', currentSerie.alpha)\n .attr('rx', 2)\n .attr('ry', 2)\n .attr('y', 0)\n .attr('height', function (d) { return yScale.bandwidth(); })\n .attr('width', 0)\n .attr('transform', function (d) { return getTaskTransform(d, true); })\n .style('cursor', 'pointer')\n .on('click', function (d, i) {\n //set d clicked\n if (d.clicked == null) {\n //set d clicked\n d.clicked = true;\n } else {\n //set d clicked\n d.clicked = !d.clicked;\n }\n\n //check whether the item clicked\n if (d.clicked) {\n //decrease opacity\n hasSelection = true;\n diagramG.selectAll('.eve-gantt-chart').attr('fill-opacity', 0.05);\n diagramG.selectAll('.eve-gantt-labels').attr('fill-opacity', 0.05);\n\n //select this\n d3.select(this).attr('fill-opacity', 1);\n d3.select('#' + diagram.container + '_svgText_' + i).attr('fill-opacity', 1);\n } else {\n //decrease opacity\n hasSelection = false;\n diagramG.selectAll('.eve-gantt-chart').attr('fill-opacity', 1);\n diagramG.selectAll('.eve-gantt-labels').attr('fill-opacity', 1);\n }\n })\n .on('mousemove', function (d, i) {\n //show tooltip\n if (!hasSelection) {\n diagram.showTooltip(diagram.getContent(d, currentSerie, diagram.tooltip.format));\n d3.select(this).attr('fill-opacity', 1);\n }\n })\n .on('mouseout', function (d, i) {\n //hide tooltip\n if (!hasSelection) {\n diagram.hideTooltip();\n d3.select(this).attr('fill-opacity', currentSerie.alpha);\n }\n });\n\n //create labels\n taskLabels = diagramG.selectAll('.eve-gantt-labels')\n .data(diagram.data, getTaskKey)\n .enter().append('text')\n .attr('class', 'eve-gantt-labels')\n .style('pointer-events', 'none')\n .style('text-anchor', 'start')\n .style('fill', function (d, i) {\n currentColor = getTaskStatusColor(d, i);\n return currentSerie.labelFontColor === 'auto' ? diagram.getAutoColor(currentColor) : currentSerie.labelFontColor;\n })\n .style('font-family', currentSerie.labelFontFamily)\n .style('font-style', currentSerie.labelFontStyle === 'bold' ? 'normal' : currentSerie.labelFontStyle)\n .style('font-weight', currentSerie.labelFontStyle === 'bold' ? 'bold' : 'normal')\n .style('font-size', currentSerie.labelFontSize + 'px')\n .text(function (d) {\n //return text content\n return diagram.getContent(d, currentSerie, currentSerie.labelFormat)\n })\n .attr('transform', function (d) { return getLabelTransform(d, true); });\n }\n\n //create scales and environment\n calculateScales();\n\n //create diagram g\n let diagramG = diagram.svg.append('g')\n .attr('class', 'eve-vis-g')\n .attr('transform', 'translate(' + margin.left + ',' + diagram.plot.top + ')');\n\n //create axes and init diagram\n createAxes();\n initDiagram();\n animateDiagram();\n\n //update diagram\n diagram.update = function (data, keepAxis) {\n //set diagram data\n diagram.data = data;\n\n //update legend\n diagram.updateLegend();\n\n //re-calculate scales\n calculateScales(keepAxis);\n\n //remove g\n if (diagram.animation.effect) {\n //check whether the effect is fade\n if (diagram.animation.effect === 'fade') {\n //remove with transition\n diagramG.transition().duration(1000).style('opacity', 0).remove();\n } else if (diagram.animation.effect === 'dim') {\n //remove with transition\n diagramG.style('opacity', 0.15);\n } else if (diagram.animation.effect === 'add') {\n //remove with transition\n diagramG.style('opacity', 1);\n } else {\n //remove immediately\n diagramG.remove();\n }\n } else {\n //remove immediately\n diagramG.remove();\n }\n\n //re-append g\n diagramG = diagram.svg.append('g')\n .attr('class', 'eve-vis-g')\n .attr('transform', 'translate(' + margin.left + ',' + diagram.plot.top + ')');\n\n //create axes and init diagram\n createAxes();\n initDiagram();\n\n //animate diagram\n animateDiagram();\n };\n\n //attach clear content method to chart\n diagram.clear = function () {\n //remove g from the content\n diagram.svg.selectAll('.eve-vis-g').remove();\n };\n\n //return abacus diagram\n return diagram;\n }", "function projectionDef(selectors,textSelectors){var componentNode=findComponentView(getLView())[HOST_NODE];if(!componentNode.projection){var noOfNodeBuckets=selectors?selectors.length+1:1;var pData=componentNode.projection=new Array(noOfNodeBuckets).fill(null);var tails=pData.slice();var componentChild=componentNode.child;while(componentChild!==null){var bucketIndex=selectors?matchingSelectorIndex(componentChild,selectors,textSelectors):0;var nextNode=componentChild.next;if(tails[bucketIndex]){tails[bucketIndex].next=componentChild;}else{pData[bucketIndex]=componentChild;componentChild.next=null;}tails[bucketIndex]=componentChild;componentChild=nextNode;}}}", "createVis(debugData, otherDebugData, cp_idx, tc_idx) {\n\t\t// Deep copy object arrays. Transform it to\n\t\t// be able to differentiate between the current\n\t\t// run's and the other run's data\n\t\tvar dataArr1 = debugData.dataArray.map((el, i) => {\n\t\t\treturn JSON.parse(JSON.stringify(el));\n\t\t});\n\t\tvar dataArr2 = otherDebugData.dataArray.map((el, i) => {\n\t\t\treturn JSON.parse(JSON.stringify(el));\n\t\t});\n\n\t\tvar data1 = dataArr1.map((el, i) => {\n\t\t\tif (el[\"@current\"] === undefined) el[\"@current\"] = true;\n\t\t\treturn el;\n\t\t});\n\t\tvar data2 = dataArr2.map((el, i) => {\n\t\t\tif (el[\"@current\"] === undefined) el[\"@current\"] = false;\n\t\t\treturn el;\n\t\t});\n\n\t\t// Trick to maintain the color saliency of rendering; if we have\n\t\t// the display of data of another run overlaid, we want to maintain\n\t\t// the color mapping of (blue: another run result, orange: this run result)\n\t\t//var data = data2.concat(data1);\n\t\tvar data = data2.concat(data1);\n\n\t\t// If the student changed the variable names...\n\t\tvar varDataSet1 = debugData.localVarNames;\n\t\tvar varDataSet2 = otherDebugData.localVarNames;\n\t\tvar varData = Array.from(new Set(function*() { yield* varDataSet1; yield* varDataSet2; }()));\n\t\tvarData.push(\"@line no.\");\n\t\tvarData.push(\"@execution step\");\n\n\t\tvar width = 780,\n\t\t\theight = 780,\n\t\t\tpadding = 20,\n\t\t size = (width - 2 * padding) / varData.length;\n\t\t\n\t\tvar x = d3.scale.linear()\n\t\t .range([padding / 2, size - padding / 2]);\n\n\t\tvar y = d3.scale.linear()\n\t\t .range([size - padding / 2, padding / 2]);\n\n\t\tvar xAxis = d3.svg.axis()\n\t\t .scale(x)\n\t\t .orient(\"bottom\")\n\t\t .ticks(6);\n\n\t\tvar yAxis = d3.svg.axis()\n\t\t .scale(y)\n\t\t .orient(\"left\")\n\t\t .ticks(6);\n\n\t\tvar color = d3.scale.category10();\n\n\t\tvar domainByVarName = {},\n\t\t\tvarNames = d3.values(varData),\n\t\t\tn = varData.length;\n\n\t\tvarData.forEach(function (name) {\n\t\t\tvar tmpDomain = d3.extent(data, function(d) { return d[name]; });\n\t\t\tif (tmpDomain[0] === tmpDomain[1]) { // If there's only value in the domain, extend it\n\t\t\t\t\t\t\t\t\t\t\t\t // by including its -1 and +1 values\n\t\t\t\tdomainByVarName[name] = [tmpDomain[0] - 1, tmpDomain[1] + 1];\n\t\t\t} else {\n\t\t\t\tdomainByVarName[name] = tmpDomain;\n\t\t\t}\n\t\t});\n\n\t\txAxis.tickSize(size * n);\n\t\tyAxis.tickSize(-size * n);\n\t\t\n\t\t// Remove the old SVG\n\t\td3.select(\"#cross-vis-div-svg\" + cp_idx + \"-\" + tc_idx).remove();\n\n\t\t// Create a new one\n\t\tvar svg = d3.select(\"#cross-vis-div\" + cp_idx + \"-\" + tc_idx)\n\t\t\t\t .append(\"svg\")\n\t\t\t\t .attr(\"id\", () => { return \"cross-vis-div-svg\" + cp_idx + \"-\" + tc_idx; })\n\t\t\t\t\t.attr(\"width\", width)\n\t\t\t\t\t.attr(\"height\", height)\n\t\t\t\t\t.append(\"g\")\n\t\t\t\t\t.attr(\"transform\", \"translate(\" + padding + \",\" + padding + \")\");\n\n\t\tvar brush = d3.svg.brush()\t\t\n\t\t .x(x)\t\t\n\t\t .y(y)\t\t\n\t\t .on(\"brushstart\", brushstart)\n\t\t .on(\"brush\", (p) => { // Highlight the selected circles.\n\t\t\t\tvar e = brush.extent();\n\t\t\t\tvar brushedCircleLines1 = new Set();\n\t\t\t\tvar brushedCircleLines2 = new Set();\n\t\t\t\tsvg.selectAll(\"circle\").classed(\"hidden\", function(d) {\n\t\t\t\t\t// NOTE: e[0][0] = x0, e[0][1] = y0, e[1][0] = x1, e[1][1] = y1,\n\t\t\t\t\t// where [x0, y0] is the top-left corner\n\t\t\t\t\t// and [x1, y1] is the bottom-right corner\n\t\t\t\t\tif (e[0][0] > d[p.x] || d[p.x] > e[1][0]\n\t\t\t\t\t|| e[0][1] > d[p.y] || d[p.y] > e[1][1]) {\n\t\t\t\t\t\t// Hide the circles\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t\td[\"@current\"] ? brushedCircleLines1.add(d[\"@line no.\"])\n\t\t\t\t\t\t\t\t : brushedCircleLines2.add(d[\"@line no.\"]);\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\n\t\t\t\tthis.removeMouseupGutterHighlights();\n\t\t\t\tthis.highlightCodeLines(Array.from(brushedCircleLines1));\n\t\t\t\tthis.highlightCodeLinesInDiffView(Array.from(brushedCircleLines2));\n\t\t })\n\t\t .on(\"brushend\", () => { // If the brush is empty, select all circles.\n\t\t \tif (brush.empty()) {\n\t\t \t\tsvg.selectAll(\".hidden\").classed(\"hidden\", false);\n\t\t \t\tthis.removeMouseupGutterHighlights();\n\t\t \t\tthis.dehighlightPrevCodeLinesInDiffView();\n\t\t \t}\n\t\t });\n\n\t\tsvg.selectAll(\".x.axis\")\n\t\t\t.data(varNames)\n\t\t.enter().append(\"g\")\n\t\t\t.attr(\"class\", \"x axis\")\n\t\t\t.attr(\"transform\", function(d,i) { return \"translate(\" + (n - i - 1) * size + \",0)\"; })\n\t\t\t.each(function(d) { x.domain(domainByVarName[d]); d3.select(this).call(xAxis); });\n\n\t\tsvg.selectAll(\".y.axis\")\n\t\t\t.data(varNames)\n\t\t.enter().append(\"g\")\n\t\t\t.attr(\"class\", \"y axis\")\n\t\t\t.attr(\"transform\", function(d, i) { return \"translate(0,\" + i * size + \")\"; })\n\t\t\t.each(function(d) { y.domain(domainByVarName[d]); d3.select(this).call(yAxis); });\n\n\t\tvar cell = svg.selectAll(\".cell\")\n\t\t\t\t\t.data(this.cross(varNames, varNames))\n\t\t\t\t.enter().append(\"g\")\n\t\t\t\t\t.filter(function(d) { return d.i > d.j; })\n\t\t\t\t\t.attr(\"class\", \"cell\")\n\t\t\t\t\t.attr(\"transform\", function(d) { return \"translate(\" + (n - d.i - 1) * size + \",\" + d.j * size + \")\"; });\n\n\t\t// y axis labels\n\t\tcell.filter(function(d) { return (d.i - d.j) === 1; })\n\t\t\t.append(\"text\")\n\t\t\t.attr(\"x\", function(d, i) { return d.i * size + padding; })\n\t\t\t.attr(\"y\", function(d, i) { return size / 2; })\n\t\t\t.attr(\"dy\", \".71em\")\n\t\t\t.text(function(d) { return d.y; });\n\n\t\t// x axis labels\n\t\tcell.filter(function(d) { return (d.i - d.j) === 1; })\n\t\t\t.append(\"text\")\n\t\t\t.attr(\"x\", function(d, i) { return padding; })\n\t\t\t.attr(\"y\", function(d, i) { return (n - 1 - d.j) * size + padding; })\n\t\t\t.attr(\"dy\", \".71em\")\n\t\t\t.text(function(d) { return d.x; });\n\n\t\tcell.call(brush);\n\t\tcell.each(plot);\n\t\tcell.selectAll(\"circle\")\n\t\t .on(\"mouseover\", function() {\n\t\t \treturn tooltip.style(\"visibility\", \"visible\");\n\t\t })\n\t \t\t.on(\"mousemove\", (d) => {\n\t \t\t\tconsole.log(cell);\n\t \t\t\tvar cell = d3.select(this); // we replaced this with the outer context by using the (d) => {} function...\n\t \t\t\t//console.log(d);\n\t \t\t\t//console.log(cell.data()[0]);\n\t \t\t\t//console.log(cell.data());\n\t \t\t\t//var x = cell.data()[0].x;\n\t \t\t\t//var y = cell.data()[0].y;\n\n\t \t\t\t//var translate = d3.transform(cell.attr(\"transform\")).translate;\n\t \t\t\tvar coordinates = d3.mouse(svg.node()); // position relative to the svg element\n\t \t\t\t\n\t \t\t\ttooltip.html(\"<p><strong>Execution step\" + \": \" + d[\"@execution step\"] + \"</strong></p><p><strong>Code line: \" + d[\"@line no.\"] + \"</strong></p>\");\n\t \t\t\tthis.removeMouseupGutterHighlights();\n\t \t\t\td[\"@current\"] ? this.highlightCodeLines([d[\"@line no.\"]])\n\t \t\t\t\t\t\t : this.highlightCodeLinesInDiffView([d[\"@line no.\"]]);\n\n\t \t\t\treturn tooltip.style(\"top\", (coordinates[1] + 500) + \"px\")\n\t \t\t\t\t\t\t .style(\"left\", coordinates[0] + \"px\");\n\t \t\t})\n\t \t\t.on(\"mouseout\", () => {\n\t \t\t\tthis.removeMouseupGutterHighlights();\n\t \t\t\tthis.dehighlightPrevCodeLinesInDiffView();\n\t \t\t\treturn tooltip.style(\"visibility\", \"hidden\");\n\t \t\t});\n\n\t\tvar svgContainer = d3.select(\"#cross-vis-div\" + cp_idx + \"-\" + tc_idx);\n\t\tvar tooltip = svgContainer.append(\"div\")\n\t\t\t\t\t\t\t\t .style(\"position\", \"absolute\")\n\t\t\t\t\t\t\t\t .style(\"z-index\", \"1001\")\n\t\t\t\t\t\t\t\t .style(\"visibility\", \"hidden\");\n\n\t\tvar brushCell;\n\n\t\tfunction plot(p) {\n\t\t\tvar cell = d3.select(this);\n\n\t\t\tx.domain(domainByVarName[p.x]);\n\t\t\ty.domain(domainByVarName[p.y]);\n\n\t\t\tcell.append(\"rect\")\n\t\t\t .attr(\"class\", \"frame\")\n\t\t\t .attr(\"x\", padding / 2)\n\t\t\t .attr(\"y\", padding / 2)\n\t\t\t .attr(\"width\", size - padding)\n\t\t\t .attr(\"height\", size - padding)\n\t\t\t .style(\"pointer-events\", \"none\");\n\n\t\t\t// Cross for other data\n\t\t\tcell.selectAll(\"path\")\n\t\t\t .data(data)\n\t\t\t .enter().append(\"path\")\n\t\t\t .filter(function(d) { return (d[p.x] !== undefined) && (d[p.y] !== undefined) && !d[\"@current\"]; })\n\t\t\t \t.attr(\"d\", d3.svg.symbol()\n\t\t\t \t\t.size(function(d) { return 5 * 5; }) // size in square pixels\n\t\t\t \t\t.type(function(d) { return \"diamond\"; }))\n\t\t\t \t.attr(\"transform\", function(d) { return \"translate(\" + x(d[p.x]) + \",\" + y(d[p.y]) +\")\"; })\n\t\t\t .style(\"fill\", function(d) { return d3.rgb(82,209,255,0.2); });\n\n\t\t\t// Dot for current data\n\t\t\tcell.selectAll(\"circle\")\n\t\t\t .data(data)\n\t\t\t .enter().append(\"circle\")\n\t\t\t .filter(function(d) { return (d[p.x] !== undefined) && (d[p.y] !== undefined) && d[\"@current\"]; })\n\t\t\t .attr(\"cx\", function(d) { return x(d[p.x]); })\n\t\t\t .attr(\"cy\", function(d) { return y(d[p.y]); })\n\t\t\t .attr(\"r\", 2)\n\t\t\t .style(\"fill\", function(d) { return d3.rgb(255,127,80,0.2); });\n\t\t}\n\n\t\t// Clear the previously-active brush, if any.\n\t\tfunction brushstart(p) {\n\t\t\tif (brushCell !== this) {\t\t\n\t\t\t\td3.select(brushCell).call(brush.clear());\t\t\n\t\t\t\tx.domain(domainByVarName[p.x]);\t\t\n\t\t\t\ty.domain(domainByVarName[p.y]);\t\t\n\t\t\t\tbrushCell = this;\t\t\n\t\t\t}\t\t\n\t\t}\n\t}", "onGraphLoaded() {\n this.axis = new CGFaxis(this, this.graph.referenceLength);\n\n this.gl.clearColor(...this.graph.background);\n\n this.setGlobalAmbientLight(...this.graph.ambient);\n\n this.initLights();\n this.initMaterials();\n this.initTextures();\n this.initSpritesheets();\n this.initFonts();\n\n this.initAnimations();\n\n // Create Nodes map and copy information from MySceneGraph\n this.nodes = new Map();\n for (var [id, info] of this.graph.nodes) {\n this.nodes.set(id, new Node(this, id, info));\n }\n\n // Process loaded nodes\n for(var [id, node] of this.nodes) {\n let children = []; // Children array\n\n // Process node children\n for(let child of node.nodeInfo.children) {\n if (typeof child === 'string') { // Process intermediate node\n if (this.nodes.get(child) == undefined) {\n this.graph.onXMLMinorError(\"Node '\" + child + \"', under node '\" + id + \"' hasn't been defined!\");\n continue;\n }\n else\n children.push(this.nodes.get(child));\n }\n else {// Process leaf node\n let leaf = this.createPrimitive(child);\n if (typeof leaf === 'string') \n this.graph.onXMLMinorError(leaf + \", under node '\" + id + \"'!\");\n else if (leaf != null)\n children.push(leaf);\n }\n }\n node.setChildren(children);\n\n node.setAnimation(this.animations.get(node.nodeInfo.animation));\n }\n\n // Check for graph anomalies, if graph OK, continue\n if (this.checkForGraphProblems() == null) {\n this.sceneInited = true;\n this.initCameras();\n this.interface.updateGui();\n }\n }", "displayScene() {\n // entry point for graph rendering\n //TODO: Render loop starting at root of graph\n //console.log(this.nodes)\n this.components[this.idRoot].display();\n }", "function topologicalSearch(deps, projects) {\n let stack = [];\n let visited = new Set();\n for (let i = 0; i < projects.length; i++) {\n let node = projects[i];\n if (!visited.has(node)) {\n helper(node, visited, stack);\n }\n }\n return stack;\n}", "toDependencyGraph() {\n return _.map(\n // FIND MAX UNIQUE VERSION FIRST\n _.groupBy(this.allDependencies,\"name\"), versionGroup =>\n versionGroup.reduce((maxVersion, version) =>\n !maxVersion || getValue(() =>\n SemVer.gt(SemVer.coerce(version.version),SemVer.coerce(maxVersion.version)),\n version.version <= maxVersion.version\n ) ?\n version :\n maxVersion\n , null))\n \n // SORT BY INTER-DEPENDENCY\n .sort((depA,depB) => {\n const\n depADependencies = this.collectDependencies(depA.project),\n depBDependencies = this.collectDependencies(depB.project),\n depARequiresB = depADependencies.includes(depB.name),\n depBRequiresA = depBDependencies.includes(depA.name)\n \n if (depARequiresB && depBRequiresA)\n throw `Dependency circular requirement: ${depA.name} <~> ${depB.name}`\n \n return (!depARequiresB && !depARequiresB) ? 0 : depARequiresB ? 1 : -1\n })\n \n \n }", "link() {\n //this.models\n //this.sequences\n //this.genericTopLevels\n //this.ranges\n //this.cuts\n //this.genericLocations\n\n this.moduleDefinitions.forEach(function(moduleDefinition) {\n moduleDefinition.link();\n });\n \n this.modules.forEach(function(module) {\n module.link();\n });\n \n this.mappings.forEach(function(mapping) {\n mapping.link();\n });\n\n this.sequenceAnnotations.forEach(function(sequenceAnnotation) {\n sequenceAnnotation.link();\n });\n\n this.sequenceConstraints.forEach(function(sequenceConstraint) {\n sequenceConstraint.link();\n });\n\n this.componentDefinitions.forEach(function(componentDefinition) {\n componentDefinition.link();\n });\n\n this.functionalComponents.forEach(function(functionalComponent) {\n functionalComponent.link();\n });\n\n this.components.forEach(function(component) {\n component.link();\n });\n\n this.interactions.forEach(function(interaction) {\n interaction.link();\n });\n\n this.participations.forEach(function(participation) {\n participation.link();\n });\n\n this.collections.forEach(function(collection) {\n collection.link();\n });\n\n this.implementations.forEach(function(implementation) {\n implementation.link();\n });\n\n\t\t// All classes that inherit from Top Level (Identified) must be linked to link members of Top Level i.e.: attachments\n\t\tthis.attachments.forEach(function(attachment) {\n\t\t\tattachment.link();\n\t\t});\n\n\t\tthis.sequences.forEach(function(sequence) {\n\t\t\tsequence.link();\n\t\t});\n\n\t\tthis.models.forEach(function(model) {\n\t\t\tmodel.link();\n\t\t});\n\n\t\tthis.genericTopLevels.forEach(function(genericTopLevel) {\n\t\t\tgenericTopLevel.link();\n\t\t});\n\n this.provActivities.forEach(function(activity) {\n activity.link();\n });\n\n\t\tthis.provPlans.forEach(function(provPlan) {\n\t\t\tprovPlan.link();\n\t\t});\n\n\t\tthis.provAgents.forEach(function(provAgent) {\n\t\t\tprovAgent.link();\n\t\t});\n\n\t\tthis.provAssociations.forEach(function(association) {\n\t\t\tassociation.link();\n\t\t});\n\n\t\tthis.provUsages.forEach(function(usage) {\n\t\t\tusage.link();\n\t\t});\n\n this.combinatorialDerivations.forEach(function(derivation) {\n derivation.link();\n });\n\n this.variableComponents.forEach(function(component) {\n component.link();\n });\n }", "function Graph() {\n // Graph constructor\n\n}", "busquedaAtributoC3D() {\n /*\n void buscarAtributo()\n {\n t47= stack[(int)P];//INICO DE ETIQUETA\n ty = t47;\n t48=stackXPATH[(int)PXP];\n tx=t48;\n L0:\n t49= heap[(int)t47];\n if(t49== -1) goto L2;\n t47=t47+1;\n goto L0;\n L2:\n t47 = t47 +1;\n t50 = heap[(int)t47];\n if(t50==-77) goto L3;\n L4:\n t51 = heapXPATH[(int)t48];\n t52 = heap[(int)t47];\n if(t51!=t52) goto L5;\n if(t52==-3) goto L6;\n t48 = t48 +1;\n t47 = t47+1;\n goto L4;\n L5:\n t53 = heap[(int)t47];\n if(t53==-2) goto l7;\n t47= t47+1;\n goto L5;\n L7:\n t48 = tx;\n goto L2;\n L6:\n stackXPATH[PXP] = t47;\n PXP = PXP + 1;\n L3:\n return;\n }\n */\n //Comenzamos escribiendo el nombre del método \n this.codigoTemporalMetodos += \"void busquedaAtributo(){\\n\";\n this.temporalGlobal.aumentar();\n //Escribimos la primera variable que va a almacenar el puntero del stack \n this.codigoTemporalMetodos += this.temporalGlobal.retornarString() + \"= stack[(int)P];\\n\";\n //Escribimos la primera variable\n let primeraVariable = this.temporalGlobal.retornarString();\n this.codigoTemporalMetodos += \"double t1111 = \" + primeraVariable + \";\\n\";\n this.temporalGlobal.aumentar();\n //Escribimos la segunda variable que almacena el puntero del stack de xpath\n this.codigoTemporalMetodos += this.temporalGlobal.retornarString() + \"= stackXPATH[(int)PXP];\\n\";\n let segundaVariable = this.temporalGlobal.retornarString();\n this.temporalGlobal.aumentar();\n //Guardamos un puntero para volver a analizar el mismo nombre con otro atributo distinto \n this.codigoTemporalMetodos += this.temporalGlobal.retornarString() + \"=\" + segundaVariable + \";\\n\";\n let terceraVariable = this.temporalGlobal.retornarString();\n //Escribimos la etiqueta inicial \n this.codigoTemporalMetodos += \"L0:\\n\";\n this.temporalGlobal.aumentar();\n this.codigoTemporalMetodos += this.temporalGlobal.retornarString() + \"=heap[(int)\" + primeraVariable + \"];\\n\";\n let cuartaVariable = this.temporalGlobal.retornarString();\n this.codigoTemporalMetodos += \"if(\" + cuartaVariable + \"==-1) goto L2;\\n\";\n this.codigoTemporalMetodos += primeraVariable + \"=\" + primeraVariable + \"+1;\\n\";\n this.codigoTemporalMetodos += \"goto L0;\\n\";\n //Escribimos la etiqueta L2 \n this.codigoTemporalMetodos += \"L2:\\n\";\n this.codigoTemporalMetodos += primeraVariable + \"=\" + primeraVariable + \"+1;\\n\";\n this.temporalGlobal.aumentar();\n this.codigoTemporalMetodos += this.temporalGlobal.retornarString() + \"=heap[(int)\" + primeraVariable + \"];\\n\";\n let quintaVariable = this.temporalGlobal.retornarString();\n this.codigoTemporalMetodos += \"if(\" + quintaVariable + \"==-77) goto L3;\\n\";\n //Escribimos la etiqueta L4: \n this.codigoTemporalMetodos += \"L4:\\n\";\n this.temporalGlobal.aumentar();\n this.codigoTemporalMetodos += this.temporalGlobal.retornarString() + \"=heapXPATH[(int)\" + segundaVariable + \"];\\n\";\n let sextaVariable = this.temporalGlobal.retornarString();\n this.temporalGlobal.aumentar();\n this.codigoTemporalMetodos += this.temporalGlobal.retornarString() + \"=heap[(int)\" + primeraVariable + \"];\\n\";\n let septimaVariable = this.temporalGlobal.retornarString();\n this.codigoTemporalMetodos += \"if(\" + sextaVariable + \"!=\" + septimaVariable + \") goto L5;\\n\";\n this.codigoTemporalMetodos += \"if(\" + septimaVariable + \"==-3) goto L6;\\n\";\n this.codigoTemporalMetodos += primeraVariable + \"=\" + primeraVariable + \"+1;\\n\";\n this.codigoTemporalMetodos += segundaVariable + \"=\" + segundaVariable + \"+1;\\n\";\n this.codigoTemporalMetodos += \"goto L4;\\n\";\n //Escribimos la etiqueta L5\n this.codigoTemporalMetodos += \"L5:\\n\";\n this.temporalGlobal.aumentar();\n this.codigoTemporalMetodos += this.temporalGlobal.retornarString() + \"=heap[(int)\" + primeraVariable + \"];\\n\";\n let octavaVariable = this.temporalGlobal.retornarString();\n this.codigoTemporalMetodos += \"if(\" + octavaVariable + \"==-2) goto L7;\\n\";\n this.codigoTemporalMetodos += primeraVariable + \"=\" + primeraVariable + \"+1;\\n\";\n this.codigoTemporalMetodos += \"goto L5;\\n\";\n //Escribimos la etiqueta L7 \n this.codigoTemporalMetodos += \"L7:\\n\";\n this.codigoTemporalMetodos += segundaVariable + \"=\" + terceraVariable + \";\\n\";\n this.codigoTemporalMetodos += \"goto L2;\\n\";\n //Escribimos la etiqueta L6\n this.codigoTemporalMetodos += \"L6:\\n\";\n this.codigoTemporalMetodos += \"stackXPATH[(int)PXP] = t1111;\\nPXP = PXP+1;\\n\";\n this.codigoTemporalMetodos += \"L3:\\nreturn;\\n}\\n\";\n }", "function Graph() {\n this.initSim(state.$sbmlDoc);\n this.initAxis(arguments[0], arguments[1], arguments[2]);\n this.initSvg();\n this.plotCurves();\n // initially setting all species as visible\n var initVisibleSpecies = [];\n this.species.forEach(function (element) {\n initVisibleSpecies.push(element.name)\n });\n this.setVisibleSpecies(initVisibleSpecies);\n // saves graph to state\n this.saveGraph();\n}", "function dotheviz() {\n //---------------------------------\n //------------------ select items to analyze / graph type\n //---------------------------------\n function capitalizeFirstLetter(string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n }\n thehtml = '<select id=\"selectITEM\" style=\"width:170px;\" >'\n fields.filter(function(f){return (f!='S2' || database=='scopus') ; }).forEach(function(f){thehtml+='<option value=\"'+f+'\" '+(field_option==f?'selected':'')+'>'+capitalizeFirstLetter(items[f])+'</option>'})\n thehtml += '</select>'\n d3.select('#itemselection').html(thehtml) \n d3.select('#selectITEM').on('change',function(){update();})\n\n thehtml = '<select id=\"selectGRAPH\" style=\"width:170px;\" >'\n thehtml += '<option value=\"custom\" '+(graph_option=='custom'?'selected':'')+'>Custom</option>'\n thehtml += '<option value=\"science\" '+(graph_option=='science'?'selected':'')+'>Distributions</option>'\n thehtml += '</select>'\n d3.select('#graphselection').html(thehtml) \n d3.select('#selectGRAPH').on('change',function(){update();})\n\n foo='<select id=\"selectSORTtab\" style=\"width:170px;\" >'\n foo+='<option value=\"NB\" selected>Record count</option>'\n foo+='<option value=\"ITEM\">Item</option>'\n foo+='</select>'\n d3.select('#sortTAB').html(foo) \n\n //...\n d3.select('#NUMPUB').html(Npapers)\n prep_infobulle(\"#info_fs\", \"Items from that field will be listed on the left panel in numeric order, based on the number of documents in which they appear.\")\n prep_infobulle(\"#info_gt\", \"Choose between different options:<br/><ul><li>The \\\"Custom\\\" option will display the information in the left panel in a custom representation (either a co-occurrence network, a pie chart, a word cloud or a map)</li><li>The \\\"Distributions\\\" option will produce a histogram of the number of items per publication and a cumulative distribution graph displaying the number of items appearing in at least <i>x</i> documents, for varying <i>x</i>. This last graph use logarithmic scales on both axes, which is useful to recognize power law relationships, appearing as straight lines.</li></ul>\")\n prep_infobulle(\"#info_sl\", \"We only display items appearing more than <i>x</i> times, the threshold <i>x</i> being chosen so that the length of the list is less than 10000.\")\n update();\n} // end of D3ok()", "function _main()\n{\n\nvar heap = new Heap();\n //operation sequence from the Figure :\n var ListOfSequence = [\n\t\t{KEY: 2, Vlaue: \"a\"},\n\t\t{KEY: 9, Vlaue: \"b\"},\n\t\t{KEY: 7, Vlaue: \"c\"},\n\t\t{KEY: 6, Vlaue: \"d\"},\n\t\t{KEY: 5, Vlaue: \"e\"},\n\t\t{KEY: 8, Vlaue: \"f\"}];\n\n\tfor (var i = 0; i < ListOfSequence.length; i++) {\n\t\theap.insert(ListOfSequence[i].KEY , ListOfSequence[i].Vlaue);\n\t}\n document.write(heap.show());\n heap.insert(10, \"g\");\n document.write(heap.show());\n heap.insert(15, \"h\");\n document.write(heap.show());\n\n\n // set input graph properties then implement the graph\n var g = new Graph();\n g.label = \"Exercise 9.2: 1b (Levitin, 3rd edition)\";\n g.readGraph(_v, _e);\n g.printGraph();\n\n\n\n\n/** print output of first prim------------------------------------------------*/\n\n document.write('<br>MST by first Prim<br>');\n\n g.primImpl1();\n for (var i = 0; i < g.Prim_Edge.length; i++) {\n document.write(\"(\", g.Prim_Edge[i].v, \",\", g.Prim_Edge[i].u, \")\");\n \tg.Prim_Edge.length-1 == i ? document.write(\".<p>\") : document.write(\", \");\n\t}\n\n/**print output of second prim---------------------------------------*/\n\ndocument.write(\"<br>MST by Prim2 (PQ-Heap): <br>\");\n g.primImpl2();\n\n for (var n = 0; n < g.verticesTree.length; n++) {\n if (g.verticesTree[n].parent != null) {\n document.write(\"(\", g.verticesTree[n].parent, \",\", g.verticesTree[n].V, \")\");\n g.Prim_Edge.length-1 == i ? document.write(\".<p>\") : document.write(\", \");\n } else if (g.verticesTree[n].parent == null) {\n document.write(\"(-, \", g.verticesTree[n].tree, \"), \");\n }\n }\n\n}", "function init_conf()\n {\n //----------------------------------\n // //\\\\ study model parameters\n //----------------------------------\n var APP_MODEL_Y_RANGE = 1000;\n //----------------------------------\n // \\\\// study model parameters\n //----------------------------------\n\n\n //====================================================\n // //\\\\ subapp regim switches\n //====================================================\n sconf.enableStudylab = false;\n sconf.enableTools = false;\n //====================================================\n // \\\\// subapp regim switches\n //====================================================\n\n\n //----------------------------------\n // //\\\\ original material parameters\n //----------------------------------\n var pictureWidth = 504;\n var pictureHeight = 495;\n\n var pointA = [ 28, 456 ];\n var pointe = [ 28, 46 ];\n\n var modorInPicX = pointA[0];\n var modorInPicY = pointA[1]; \n //.set it from graph editor\n var pictureActiveArea = pointA[1] - 46;\n //----------------------------------\n // \\\\// original material parameters\n //----------------------------------\n var mod2inn_scale = pictureActiveArea / APP_MODEL_Y_RANGE;\n var originX_onPicture = pointA[0];\n var originY_onPicture = pointA[1];\n\n\n\n\n\n //----------------------------------------------------\n // //\\\\ prepares sconf data holder\n //----------------------------------------------------\n //-----------------------------------\n // //\\\\ topic group colors,\n // todm: possibly proliferation\n //-----------------------------------\n sconf.default_tp_lightness = 30;\n var given = [0, 150, 0, ]; //0.5];\n var proof = [0, 0, 255, ]; //0.5];\n var result = [200, 40, 0, ]; //0.5];\n var hidden = [0, 0, 0, ]; //0];\n\n\n var predefinedTopics =\n {\n given,\n proof,\n result,\n hidden,\n\n //:curves\n \"ABC\" : given,\n \"mainCurve\" : given,\n \"Abc\" : proof,\n \"remoteCurve\" : proof,\n\n //:areas\n \"ABD\" : given,\n \"ACE\" : given,\n \"area-ABD\" : given,\n \"area-ACE\" : given,\n \"Abd\" : proof,\n \"Ace\" : proof,\n \"area-Abd\" : proof,\n \"area-Ace\" : proof,\n //:linear areas\n \"Afd\" : result,\n \"Age\" : result,\n\n \"ABDPerACE\" : given,\n \"AD2PerAE2\" : result,\n };\n //-----------------------------------\n // \\\\// topic group colors,\n //-----------------------------------\n\n\n var originalPoints =\n {\n 'A' : { \n pos : pointA,\n pcolor : given,\n letterAngle : -90,\n },\n 'e' : { \n pos : pointe,\n pcolor : proof,\n letterAngle : 90,\n },\n\n 'B' : { \n pcolor : given,\n letterAngle : 0,\n },\n 'C' : { \n pcolor : given,\n letterAngle : -45,\n },\n 'D' : { \n pcolor : given,\n letterAngle : 215,\n },\n 'E' : { \n pcolor : given,\n letterAngle : 180,\n },\n 'b' : { \n pcolor : proof,\n letterAngle : 0,\n },\n 'c' : { \n pcolor : proof,\n letterAngle : -90,\n },\n 'd' : { \n pcolor : proof,\n letterAngle : 180,\n },\n\n 'F' : { \n pcolor : given,\n letterAngle : 135,\n },\n 'G' : { \n pcolor : given,\n letterAngle : 45,\n },\n 'f' : { \n pcolor : proof,\n letterAngle : 90,\n },\n 'g' : { \n pcolor : proof,\n letterAngle : 90,\n },\n\n 'pivotPoint1' : { \n pcolor : result,\n doPaintPname : false,\n letterAngle : 90,\n },\n\n 'pivotPoint2' : {\n pcolor : given,\n letterAngle : 90,\n doPaintPname : false,\n },\n };\n\n var linesArray =\n [\n { 'Ab' : { pcolor : proof } },\n { 'Ac' : { pcolor : proof } },\n { 'Ad' : { pcolor : result } },\n { 'Ae' : { pcolor : result, 'stroke-width' : 3, } },\n\n { 'Ag' : { pcolor : result, 'stroke-width' : 3, } },\n\n { 'ec' : { pcolor : proof } },\n { 'db' : { pcolor : proof } },\n\n { 'AB' : { pcolor : given } },\n { 'AC' : { pcolor : given } },\n { 'AD' : { pcolor : given } },\n { 'AE' : { pcolor : given, 'stroke-width' : 3, } },\n { 'AG' : { pcolor : given } },\n { 'EC' : { pcolor : given } },\n { 'DB' : { pcolor : given } },\n ];\n\n\n to_sconf =\n {\n //----------------------------------\n // //\\\\ scenario\n //----------------------------------\n hideProofSlider : true, // false,\n hideProofSliderCompletely : false,\n //----------------------------------\n // \\\\// scenario\n //----------------------------------\n\n\n //----------------------------------\n // //\\\\ original lemma parameters\n //----------------------------------\n curvePivots :\n [\n [0, 0],\n //[326.8, 715.3],\n //[326.8*1.05, 742*1.05],\n\n [270.19, 612.8],\n\n //[72.29, 621.2],\n\n //[1516.1, 569.9]\n //[1516.1, 495] //tmp\n [ 1060, 567 ]\n /* very good for debug: simple curve\n [0, 0],\n [500, 1000],\n [1000, 0]\n */\n ],\n\n\n //*************************************************\n // //\\\\ lemma model parameters\n //*************************************************\n APP_MODEL_Y_RANGE,\n //:ranges\n tanA_min : 0.1, //pivot1x/pivot1y minimum\n pivot1y_max : APP_MODEL_Y_RANGE * 0.99,\n pivot2x_max : APP_MODEL_Y_RANGE * 1.8,\n pivot2y_min : APP_MODEL_Y_RANGE * 0.3,\n pivot2y_max : APP_MODEL_Y_RANGE * 0.99,\n\n\n //bezier parameter t of point C on principal curve\n //tC : 0.5, //good for debug\n tC : 0.50077 / 0.79 ,\n\n claimRatio : 0.74081,\n //range:\n claimRatio_max : 0.9, //Dy_per_Ey\n\n\n tiltRatio : 1, //controls DB-line tilt: \n //1 is perpendicular; < 1 dy/dx is negative, > 1 is positive\n //:ranges\n tiltRatio_min : 0.4,\n tiltRatio_max : 1.5,\n Ep2yrange_max : 0.8,\n Cx_min : 0.1,\n //*************************************************\n // \\\\// lemma model parameters\n //*************************************************\n //----------------------------------\n // \\\\// original lemma parameters\n //----------------------------------\n\n\n\n //----------------------------------\n // //\\\\ model-view parameters\n //----------------------------------\n //100; //display in \"percents\" of Ae\n LEGEND_NUMERICAL_SCALE : 100,\n\n modorInPicX,\n modorInPicY,\n innerMediaHeight : pictureHeight + sconf.SLIDERS_LEGEND_HEIGHT,\n innerMediaWidth : pictureWidth,\n\n thickness : 4,\n //----------------------------------\n // \\\\// model-view parameters\n //----------------------------------\n };\n to_sconf.areaScale = 1 / to_sconf.APP_MODEL_Y_RANGE / to_sconf.APP_MODEL_Y_RANGE;\n //----------------------------------\n // \\\\// prepares sconf data holder\n //----------------------------------------------------\n\n\n\n //----------------------------------------------------\n // //\\\\ copy-pastes to sconf\n //----------------------------------------------------\n //making size to better fit lemma's diagram\n fconf.LETTER_FONT_SIZE_PER_1000 = 30;\n\n paste( sconf,\n paste( to_sconf,\n {\n //double back step ../../ is to reuse this path in code for twin-lemma\n mediaBgImage : \"../../b1sec1lemma9/img/lemma9-original.png\",\n\n linesArray,\n predefinedTopics,\n originalPoints,\n originX_onPicture,\n originY_onPicture,\n pictureWidth,\n pictureHeight,\n mod2inn_scale,\n })\n );\n //----------------------------------------------------\n // \\\\// copy-pastes to sconf\n //----------------------------------------------------\n }", "buildSchedules() {\r\n this.scheduledEvents = this.hardEvents.slice(0); //gets all hardEvents\r\n this.constraints.forEach(function(constraint) {\r\n scheduledEvents.push(constraint);\r\n })\r\n\r\n\r\n var rankedFlexEvents = this.flexEvents.sort(function(a, b) {\r\n return a.rank - b.rank;\r\n });\r\n\r\n var rootNode = new node(this.scheduledEvents);\r\n var tree = new Tree(rootNode);\r\n var lastLevelNodes = rootNode;\r\n rankedFlexEvents.forEach(function(event) {\r\n fitFlexedEvents(lastLevelNodes, tree, event);\r\n })\r\n }", "function currentNodeRisk() {\n $(\".data-area-left\").removeClass(\"hidden\");\n //visible & transform RiskNodes\n d3.selectAll(\".nodes-risks\")\n .transition()\n .duration(300)\n .attr(\"class\",\"nodes nodes-risks\")\n .attr(\"r\", function(d){\n return altNodeSize(d, nodesRadius,0) });\n\n d3.select(this).select(\"circle\").transition()\n .duration(300)\n .attr(\"class\",\"nodes nodes-risks current-node\")\n .attr(\"r\", function(d){\n return altNodeSize(d, nodesRadius,2)\n });\n\n //visible & transform TEXT\n d3.selectAll(\".text-risks\")\n .attr(\"class\", textClasses.hidden)\n .attr(\"style\", \"font-weight: normal\");\n\n d3.select(this).select(\".text-risks\")\n .attr(\"class\", textClasses.visible)\n .attr(\"style\", \"font-weight: bold; font-size: 0.9em\");\n\n //check current node id\n var currentID = d3.select(this).select(\"circle\").attr(\"id\"),\n currentColor = d3.select(this).select(\"circle\").attr(\"fill\");\n\n\n //filtering all lines where currentId = source\n d3.selectAll(\"line\")\n .attr(\"stroke-width\", function(d){\n return altStrength(d, strokeWidth, 0);\n })\n .attr(\"style\", \"opacity: \" + inactiveOpacity)\n .attr(\"class\", \"\")\n .data(edges)\n .filter(function (d) {\n if (d.source.id == currentID) {\n edgesCutRisk.push(d.target.id);\n edgesForThree.push({source: d.target, value: d.value});\n }\n return d.source.id == currentID;\n\n })\n .attr(\"style\", \"opacity: 1\")\n .attr(\"class\", \"current-line\")\n .attr(\"stroke-width\", function(d) {\n return altStrength(d,strokeWidth, 2.5);\n });\n\n\n //filtering all links where currentId = target\n d3.selectAll(\"line\")\n .filter(function (d) {\n if (d.target.id == currentID) {\n edgesCutRisk.push(d.source.id)\n }\n return d.target.id == currentID;\n })\n .attr(\"style\", \"opacity: 1\")\n .attr(\"class\", \"current-line\")\n .attr(\"stroke-width\", function(d) {\n return altStrength(d,strokeWidth, 2.5);\n });\n\n d3.selectAll(\".text-risks\")\n .attr(\"style\", \"font-size: 0.6em\")\n .filter(function (d) {\n return edgesCutRisk.indexOf(d.id) >= 0;\n })\n .attr(\"class\", textClasses.visible)\n .attr(\"style\", \"font-size: 0.8em\");\n\n //text current id node\n d3.selectAll(\".text-risks\")\n .filter(function (d) {\n return d.id == currentID;\n })\n .attr(\"style\", \"font-size: 0.8em; font-weight: bold\");\n\n\n\n\n //----Sidebar text data--------------------------\n\n //create one current object for sidebar data\n riskObj.forEach(function (e) {\n if (e.id == currentID) {\n oneTrend.push(e);\n }\n });\n\n\n //sort array to max\n edgesForThree.sort(\n function(a, b) {\n return b.value - a.value;\n }\n );\n\n\n //general sidebar data function (common-functions template)\n getDataSidebar(riskObj, oneTrend, currentColor, edgesForThree);\n\n\n //clearing array\n oneTrend = [];\n edgesCutRisk = [];\n edgesForThree = [];\n\n\n }//END currentNodeRisk(Click)", "function init_conf()\n {\n sconf.default_tp_lightness = 22;\n sconf.rgShapesVisible = false;\n sconf.default_tp_stroke_width = 8;\n sconf.text_nonhover_width = 1;\n sconf.text_hover_width = 2; //needs hover-width cls at svg-text-el,\n //aka for: Δsin(φ),\n //sconf.nonhover_width = 4;\n //sconf.hover_width = 114; //needs hover-width cls at svg-text-el,\n //aka for: Δsin(φ),\n //overrides \"global\", lemma.conf.js::sconf\n sconf.pointDecoration.r= 5;\n\n\n //====================================================\n // //\\\\ subapp regim switches\n //====================================================\n sconf.enableStudylab = false;\n sconf.enableTools = false;\n //====================================================\n // \\\\// subapp regim switches\n //====================================================\n\n\n //--------------------------------------\n // //\\\\ geometics parameters\n //--------------------------------------\n //for real picture if diagram's picture is supplied or\n //for graphical-media work-area if not supplied:\n var pictureWidth = 858;\n var pictureHeight = 566;\n var modorInPicX = 166;\n var modorInPicY = 63;\n //model's spacial unit in pixels of the picture:\n var mod2inn_scale = 239; //was?: originalPoints.R.pos[1] - originalPoints.A.pos[1];\n\n var A = [modorInPicX, modorInPicY];\n var B = [358, 165];\n var D = [496, modorInPicY];\n sconf.b_per_B_original = 1.931578947;\n\n\n //-----------------------------------\n // //\\\\ topic group colors,\n // todm: possibly proliferation\n //-----------------------------------\n var context = [0, 0, 0, 0.6];\n var given = [0, 150, 0, 0.6];\n var proof = [0, 0, 255, 0.6];\n var result = [200, 40, 0, 0.6];\n var shadow = [150, 150, 150, 1];\n var hidden = [0, 0, 0, 0];\n\n\n var predefinedTopics =\n {\n //:basic topics\n proof,\n given,\n result,\n hidden,\n\n //:given\n \"curve-AB\" : given,\n \"left-curve-AB\" : given, //patch for left branch\n \"arc-AB\" : given,\n\n //proof\n \"curve-Ab\" : proof,\n \"arc-Ab\" : proof,\n\n //addendum\n \"phi0\" : given,\n \"deltaphi\" : given,\n \"tangentPhi\" : result,\n 'angleBAD' : given,\n 'conterminousRatio' : proof,\n };\n //-----------------------------------\n // \\\\// topic group colors,\n //-----------------------------------\n\n var originalPoints =\n {\n //:context\n //axis-y addendum\n 'ytop' : {\n letterAngle : 90,\n caption : 'axis y',\n letterRotRadius : 35,\n pcolor : context,\n },\n \"ylow\" : {\n letterAngle : 90,\n },\n O : {\n letterAngle : -90,\n pcolor : given,\n },\n 'axis-y_X_rd' : {\n },\n\n //axis-x addendum\n 'xtop' : {\n letterAngle : 130,\n caption : 'axis x',\n letterRotRadius : 40,\n //pcolor : given,\n },\n \"xlow\" : {\n letterAngle : 90,\n },\n\n //beyond X and L to enable show of tangent angle\n \"line-AL-end\" : {\n },\n\n //extends rd to show an angle\n \"line-dr-start\" : {\n letterAngle : 30,\n },\n ///modified point r, closer to d\n \"dr-decorpoint\" : {\n caption : 'r',\n pcolor : proof,\n letterAngle : -90,\n letterRotRadius : 20,\n },\n\n ///modified point r, closer to d\n \"imageOfR\" : {\n caption : \"r\",\n pcolor : proof,\n letterAngle : -45,\n letterRotRadius : 30,\n },\n\n ///modified point r, closer to d\n \"imageOfD\" : {\n caption : \"d\",\n pos : D,\n pcolor : proof,\n letterAngle : -90,\n letterRotRadius : 30,\n },\n\n\n c : {\n letterAngle : 45,\n letterRotRadius : 18,\n pcolor : proof,\n },\n\n //proof\n b : {\n letterAngle : 0,\n pcolor : proof,\n },\n d : {\n caption : 'dₒ',\n letterAngle : 90,\n pcolor : proof,\n },\n\n\n \"y0\" : {\n caption : 'yₒ',\n letterAngle : 225,\n pcolor : given,\n },\n //By\n 'y' : {\n caption : 'y',\n letterAngle : 45,\n pcolor : given,\n },\n //Ax\n x : {\n caption : 'x',\n letterAngle : -45,\n pcolor : given,\n },\n //Bx\n x0 : {\n caption : 'xₒ',\n letterAngle : 135,\n pcolor : given,\n },\n \n // //\\\\ magnified points\n 'Y0' : {\n pos : A,\n caption : 'Yₒ',\n letterAngle : 210,\n letterRotRadius : 50,\n pcolor : proof,\n },\n //BY\n 'Y' : {\n caption : 'Y',\n letterAngle : 180,\n letterRotRadius : 35,\n pcolor : proof,\n },\n //AX0\n 'X0' : {\n caption : 'Xₒ',\n letterAngle : -90,\n pcolor : proof,\n },\n //BX\n 'X' : {\n caption : 'X',\n letterAngle : -90,\n pcolor : proof,\n },\n // \\\\// magnified points\n\n\n //:originals from Book\n A : {\n //assigment by reference to pos is safe: no parasite links,\n //pos is recalculated later\n pos : A,\n letterAngle : 90,\n pcolor : given,\n },\n\n r : {\n caption : 'rₒ',\n letterAngle : 135,\n pcolor : given,\n },\n\n R : {\n letterAngle : 135,\n pcolor : given,\n draggableX : false,\n draggableY : true,\n },\n\n B : {\n pos: B,\n letterAngle : 0,\n pcolor : given,\n },\n\n C : {\n letterAngle : 45,\n letterRotRadius : 13,\n pcolor : given,\n },\n\n\n /*\n 'B-kernelx' : {\n cssClass : 'hover-width',\n },\n */\n D : {\n pos: D,\n letterAngle : 90,\n pcolor : given,\n },\n\n curveEnd : {\n pos : [B[0]+50,0],\n },\n curveStart : {\n pos : [ A[0]-80, 0 ],\n },\n\n //lemma 7, coroll 1\n F : {\n letterAngle : 90,\n pcolor : given,\n },\n G : {\n letterAngle : 90,\n pcolor : given,\n },\n E : {\n letterAngle : 90,\n pcolor : given,\n },\n e : {\n letterAngle : 90,\n pcolor : proof,\n },\n L : { \n letterAngle : -45,\n pcolor : result,\n },\n\n fi : {\n caption : \"φ\",\n pcolor : shadow,\n letterAngle : 180,\n draggableX : true,\n draggableY : true,\n },\n\n };\n ///alternatively to this, you can set own colors for originalPoints\n ///by your own\n ns.eachprop( originalPoints, (point,pname) => {\n point.pcolor = ns.haz( point, 'pcolor' ) || predefinedTopics[ pname ];\n });\n\n var linesArray =\n [\n { \"rd\" : { pcolor : proof } },\n { \"rb\" : { pcolor : proof } },\n\n { 'dr-decorpoint,d' : { pcolor : proof } },\n { 'dr' : { pcolor : proof } },\n { 'imageOfR,imageOfD' : { pcolor : proof } },\n { 'A,imageOfD' : { pcolor : proof } },\n { 'A,imageOfR' : { pcolor : proof } },\n { 'imageOfR,b' : { pcolor : proof } },\n\n { 'Ad' : { pcolor : proof } },\n { 'Ar' : { pcolor : given } },\n\n //l7\n { 'bd' : { pcolor : proof } },\n { 'be' : { pcolor : proof } },\n\n { 'Ab' : { pcolor : proof } },\n { 'AR' : { pcolor : given } },\n { 'AD' : { pcolor : given } },\n\n //l7\n { 'BD' : { pcolor : given } }, //lemma 7, coroll 1\n { 'BF' : { pcolor : given } },\n { 'AF' : { pcolor : given } },\n { 'AG' : { pcolor : given } },\n { 'AE' : { pcolor : given } },\n { 'BG' : { pcolor : given } },\n\n\n //l8\n { 'RD' : { pcolor : given } },\n { 'BR' : { pcolor : given } },\n\n //sin(x)/x\n { 'Br' : { pcolor : given } },\n\n { 'line-dr-start,dr-decorpoint' : { pcolor : proof, undisplay : true } },\n\n //:context\n { 'ylow,ytop' : { pcolor : context, } },\n { 'xlow,xtop' : { pcolor : context, } },\n { 'O,ytop' : { pcolor : context, } },\n\n //cirle radius\n { 'AO' : { pcolor : given, 'stroke-width' : 1, } },\n\n //cirle radius\n { 'BO' : { pcolor : given, 'stroke-width' : 1, } },\n\n //x-drops to axix x\n { 'A,x0' : { pcolor : given, 'stroke-width' : 1, } },\n { 'Bx' : { pcolor : given, 'stroke-width' : 1, } },\n //y-drops to axix y\n { 'A,y0' : { pcolor : given, 'stroke-width' : 1, } },\n { 'By' : { pcolor : given, 'stroke-width' : 1, } },\n\n\n\n //dy\n { 'y0,y' : { pcolor : given, 'stroke-width' : 8, } },\n //dx\n { 'x0,x' : { pcolor : given, 'stroke-width' : 8, } },\n\n { 'A,line-AL-end' : { pcolor : result } },\n\n //DY\n { 'A,Y' : { pcolor : proof, 'stroke-width' : 8, } },\n //DX\n { 'X0,X' : { pcolor : proof, 'stroke-width' : 8, } },\n\n //tangent\n { 'AL' : { pcolor : result } },\n { 'Ae' : { pcolor : proof } },\n\n { 'AE' : { pcolor : given } },\n { 'BE' : { pcolor : given } },\n { 'AB' : { pcolor : given } },\n ]\n\n //----------------------------------\n // //\\\\ curve pars\n // points for divided\n // differences interpolation\n //----------------------------------\n var ww1 = [204,67];\n var ww1 = [244,82];\n var ww2 = [272,94];\n var ww2 = [300,110];\n var ww3 = B;\n\n originalPoints.t1 = {\n pos: ww1,\n letterAngle : 90,\n pcolor : given,\n };\n originalPoints.t2 = {\n pos: ww2,\n letterAngle : 90,\n pcolor : given,\n };\n\n var givenCurve_pivots =\n [\n //make curve symmetrical in respect to axis Y\n [2*A[0]-ww3[0],ww3[1]],\n [2*A[0]-ww2[0],ww2[1]],\n [2*A[0]-ww1[0],ww1[1]],\n\n [A[0], A[1]],\n ww1,\n ww2,\n [ww3[0], ww3[1]],\n [377,206],\n ];\n var ww_MONITOR_Y_FLIP = -1;\n var ww_inn2mod_scale = 1/mod2inn_scale;\n var ww_factor = ww_MONITOR_Y_FLIP * ww_inn2mod_scale;\n var givenCurve_pivots_inModel = givenCurve_pivots.map( opoint =>\n [ ( opoint[0] - modorInPicX ) * ww_inn2mod_scale,\n ( opoint[1] - modorInPicY\n ) * ww_factor,\n ]\n );\n //----------------------------------\n // \\\\// curve pars\n //----------------------------------\n\n\n //making size to better fit lemma's diagram\n fconf.LETTER_FONT_SIZE_PER_1000 = 20;\n\n ns.paste( sconf, {\n //double back step ../../ is to reuse this path in code for lemma7\n mediaBgImage : \"../../b1sec1lemma8/img/d.png\",\n givenCurve_pivots_inModel,\n predefinedTopics,\n originalPoints,\n linesArray,\n //lines,\n modorInPicX,\n modorInPicY,\n pictureWidth,\n pictureHeight,\n mod2inn_scale,\n });\n //--------------------------------------\n // \\\\// geometics parameters\n //--------------------------------------\n }", "function makeGantt(currentCPU) {\n numCycles = cycleEvents.length;\n\n // Categorize all events into cycles\n addCycleAttribute();\n\n // Only use switch events on the chart, after\n // normalizing their start times within their cycles\n // and calculating the durations between them\n var switchCycleEvents = getCycleEventsForCPU(currentCPU);\n\n timeDomainEnd = getLongestCycleDuration(switchCycleEvents);\n\n var margin = {\n top: 20,\n right: 40,\n bottom: 20,\n left: 70\n }\n\n var height = (numCycles + 1) * 35;\n // Divide window up by number of CPUs displayed. 80 is to deal with set size of sidebar\n // Each chart div has a margin of 20px, so also subtract this off\n var numDisplayed = selectedCPUs.length;\n var width = (document.body.clientWidth / selectedCPUs.length) - 80 - margin.right - margin.left - 20 * numDisplayed;\n var gantt = d3.gantt(chartType).taskTypes(_.range(numCycles,-1,-1))\n .timeDomain(timeDomainEnd).yAttribute(\"cycle\").yLabel(\"Cycle \").margin(margin)\n .height(height)\n .width(width);\n\n // Create a new div for this chart and place it inside our div for all gantt charts\n var chartDiv = document.createElement(\"div\");\n chartDiv.id = \"ganttChart\" + currentCPU;\n chartDiv.style.display = \"inline-block\";\n chartDiv.style.marginLeft = \"20px\";\n\n document.getElementById(\"ganttCharts\").appendChild(chartDiv);\n var chartID = '#ganttChart' + currentCPU;\n\n // actually draw the gantt chart\n gantt(switchCycleEvents, chartID);\n}", "function main(){\r\n\r\n //create all of your stocks\r\n let s1 = new Stock(\"Microsoft Corp\",\"MSFT\",\"NASDAQ\",83.94,113);\r\n let s2 = new Stock(\"Ubisoft Entertainment\",\"UBSFF\",\"OTC\",82.40,88);\r\n let s3 = new Stock(\"McDonald's Corp\",\"MCD\",\"NYSE\",168.48,100);\r\n let s4 = new Stock(\"Netflix\",\"NFLX\",\"NASDAQ\",193.11,85);\r\n\r\n //build your Portfolio\r\n let myport = new Portfolio();\r\n myport.add(s1);\r\n myport.add(s2);\r\n myport.add(s3);\r\n myport.add(s4);\r\n\r\n console.log(myport.totalValue());\r\n console.log(\"-----------------------\");\r\n console.log(myport);\r\n\r\n //build prediction\r\n}", "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 beginQE(){\n\n var sujet1 = encode($(\"#sujet1\").val());\n var sujet2 = encode($(\"#sujet2\").val());\n\n\n //On verifie que la profondeur, et que les deux sujets renseignes sont correctes\n var depthLimit = parseInt($(\"#depthLimit\").val());\n if(!depthLimit) {\n alert(\"La profondeur saisie est incorrecte.\");\n return;\n }\n if(!sujet1 || !sujet2) {\n alert(\"Les deux sujets doivent \\352tre saisis.\");\n return;\n }\n \n var forbiddenRelations = [];\n $('input:checked[name=relations]').each(function() {\n forbiddenRelations.push(encode($(this).val()));\n });\n \n //On execute la requete gremlin+sql et on recupere le resultat\n var queryResult = execute('select gremlin( \\'current.outE.filter{!([\\''+forbiddenRelations.join('\\',\\'')+'\\'].contains(it.label))}.inV.simplePath().loop(4){it.loops < '+depthLimit+'}{it.object.name == \\''+sujet2+'\\'}.simplePath().path{it.name}{it.label}\\') from V where name = \\''+sujet1+'\\'');\t\t\t\t\n \n // Une reponse doit avoir ete obtenue\n if(!queryResult.result){\n alert(\"Une erreur est survenue\");\n return;\n }\n \n // Si la reponse est vide, c'est qu'aucun chemin n'a ete trouve\n if(!queryResult.result[0]){\n $(\"#pathsFound\").html('<h4>Pas de chemins trouv&eacute;s</h4>');\n clearOutput();\n printMessage(new Date(), \" - INFO - No paths found.\");\n return;\n }\n \n var paths = queryResult.result[0].gremlin;\n $(\"#pathsFound\").html('<h3>Chemin(s) trouv&eacute;(s)</h3>');\n $(\"#pathsFound\").append('<table width=\"100%\" cellpadding=\"4\" cellspacing=\"3\">');\n \n // On traite le cas ou plusieurs chemins ont ete trouves\n if(paths[0] instanceof Array){\n for(i in paths){\n $(\"#pathsFound\").append(\"<tr>\");\n for(j in paths[i]){\n $(\"#pathsFound\").append('<td><input type= \"text\" class=\"pathElem\" disabled value =\"'+paths[i][j]+'\"></input></td>');\n }\n $(\"#pathsFound\").append(\"</tr>\");\n \n }\n clearOutput();\n printMessage(new Date(), \" - INFO - Found \"+paths.length+\" paths.\");\n }\n // Cas ou un seul chemin a ete trouve (la reponse de la requete est une liste simple et non une liste de liste)\n else {\n $(\"#pathsFound\").append(\"<tr>\");\n for(j in paths){\n $(\"#pathsFound\").append('<td><input type= \"text\" class=\"pathElem\" disabled value =\"'+paths[j]+'\"></input></td>');\n }\n $(\"#pathsFound\").append(\"</tr>\");\n clearOutput();\n printMessage(new Date(), \" - INFO - Found one path\");\n }\n $(\"#pathsFound\").append(\"</table>\");\n \n $(\".pathElem\").each(function(){\n $(this).css({\n \"font-family\" : \"Courier New\",\n \"width\" : $(this).val().length*8+\"px\"\n });\n });\n \n}", "function main(){\n def('A', new Point(-1, 1));\n def('B', reflection_point(get('A')); // b (1, -1)\n\n def('P', new Point());\n\n def('k_AP', get_slope_from_points(get('A'), get('P')));\n def('k_BP', get_slope_from_points(get('B'), get('P')));\n\n equal(multi(get('k_AP'), get('k_BP')), -1/3); // x_p^2 + 3 y_p^2 == 4\n\n purpose()\n\n get_curve_from_point(get('P'))\n\n solve();\n}", "function loadProject(){\n let lastColor = null;\n let wholeProject = project.getWhole();\n let fixations = project.getFixations();\n \n for(let i = 0; i < fixations.length; i++){ \n let codeWindow = codeWindows.objectWithFile(fixations[i].data.path); //find if CodeWindow with file already exists\n\n if(codeWindow === null){\n codeWindow = new CodeWindow(fixations[i].data);\n \n let data;\n \n try{\n data = fs.readFileSync(fixations[i].data.path, \"utf-8\");\n }\n catch(e){\n console.log(i);\n console.log(fixations[i]);\n }\n \n let extension = path.extname(fixations[i].data.path);\n \n codeWindow.addText(data, extension);\n codeWindows.push(codeWindow);\n }\n \n if(fixations[i].name !== \"Fixation\"){\n continue;\n }\n\n nodeIndex++;\n \n //if next fixation is in another file then generate a color for current fixations\n if(nodeIndex < fixations.length - 1 && fixations[nodeIndex].data.path !== fixations[nodeIndex + 1].data.path){\n lastColor = '#'+Math.random().toString(16).substr(-6);\n \n codeWindow.addNode(fixations[nodeIndex], lastColor);\n }\n else if(lastColor !== null){ //if current fixation is first in this file set its color\n codeWindow.addNode(fixations[nodeIndex], lastColor);\n lastColor = null;\n }\n else{\n codeWindow.addNode(fixations[nodeIndex]);\n }\n }\n \n changeScale(true, window.innerHeight - 110, true);\n \n nodeIndex = -1; //reinitialize nodeIndex\n}", "function initDiagram() {\n //create d3 force layout\n simulation = d3.forceSimulation()\n .force(\"link\", d3.forceLink().id(function (d) { return d.id; }))\n .force(\"charge\", d3.forceManyBody())\n .force(\"center\", d3.forceCenter(width / 2, height / 2));\n\n //add to simulations\n diagram.simulations.push(simulation);\n\n //create links\n nodeLinks = diagramG.append(\"g\")\n .selectAll(\"line\")\n .data(links)\n .enter().append(\"line\")\n .attr(\"class\", getLinkClass)\n .style(\"stroke-width\", function (d) { return rScale(d.measure); })\n .style(\"stroke\", \"rgb(204,204,204)\")\n .on(\"mousemove\", function (d, i) {\n //show tooltip\n diagram.showTooltip(diagram.getContent(d, currentSerie, diagram.tooltip.format));\n })\n .on(\"mouseout\", function (d, i) {\n //hide tooltip\n diagram.hideTooltip();\n })\n\n //create circles\n nodeCircles = diagramG.append(\"g\")\n .selectAll(\"circle\")\n .data(nodes)\n .enter().append(\"circle\")\n .attr(\"class\", getNodeClass)\n .style(\"fill\", function (d) { return d.color; })\n .style(\"stroke\", \"none\")\n .attr(\"r\", function (d) { return rScale(d.measure); })\n .on(\"click\", handleNodeClick)\n .call(d3.drag()\n .on(\"start\", dragstarted)\n .on(\"drag\", dragged)\n .on(\"end\", dragended));\n\n //check whether the labels are enabled\n if (currentSerie.labelFormat) {\n //create texts\n textSVG = diagramG.append('g').selectAll('text')\n .data(nodes).enter().append('text')\n .attr('class', 'pagos-force-texts')\n .style('pointer-events', 'none')\n .style(\"text-anchor\", function (d) {\n if (currentSerie.labelPosition === 'inside')\n return 'middle';\n return d.children ? \"end\" : \"start\";\n })\n .style('fill', function (d) {\n currentColor = d.color;\n return currentSerie.labelFontColor === 'auto' ? diagram.getAutoColor(currentColor) : currentSerie.labelFontColor;\n })\n .style('font-family', currentSerie.labelFontFamily)\n .style('font-style', currentSerie.labelFontStyle === 'bold' ? 'normal' : currentSerie.labelFontStyle)\n .style('font-weight', currentSerie.labelFontStyle === 'bold' ? 'bold' : 'normal')\n .text(function (d) {\n return diagram.getContent(d, currentSerie, currentSerie.labelFormat);\n })\n .style('font-size', function (d) {\n //check whether the labels are inside\n if (currentSerie.labelFontSize === 'auto') {\n radius = rScale(d.measure);\n d.fontSize = Math.min(2 * radius, (2 * radius - 8) / Math.max(this.getComputedTextLength(), this.getBBox().height) * minFontSize);\n } else {\n //return default font size\n d.fontSize = currentSerie.labelFontSize;\n }\n\n if (d.fontSize < minFontSize)\n d.fontSize = minFontSize;\n\n //return font size\n return d.fontSize + 'px';\n })\n .style(\"opacity\", function (d) {\n //get computed length of the text\n let compLength = this.getBBox().width;\n let circleArea = 2 * rScale(d.measure);\n if (circleArea > compLength)\n return 1;\n return 0;\n });\n }\n\n //start nodes simulation\n simulation.nodes(nodes).on(\"tick\", ticked);\n\n //start links simulation\n simulation.force(\"link\").links(links);\n }", "function setLabels(graph) {\n const examGraphLabel = [];\n let assessIndex = 0;\n for (const node of graph.nodes) {\n // console.log(node);\n if (node.assessment === assessments[assessIndex].trim()) {\n examGraphLabel.push((node.x0 + node.x1) / 2);\n assessIndex += 1;\n }\n if (assessIndex === assessments.length) {\n break;\n }\n }\n\n /* Adds x axis labels of pathway */\n svg.append(\"text\")\n .attr(\"class\", \"axis-label\")\n .attr(\"y\", height + 25)\n .attr(\"x\", examGraphLabel[0])\n .style(\"text-anchor\", \"middle\")\n .text(\"Exam 1\");\n\n svg.append(\"text\")\n .attr(\"class\", \"axis-label\")\n .attr(\"y\", height + 25)\n .attr(\"x\", examGraphLabel[1])\n .style(\"text-anchor\", \"middle\")\n .text(\"Exam 2\");\n\n svg.append(\"text\")\n .attr(\"class\", \"axis-label\")\n .attr(\"y\", height + 25)\n .attr(\"x\", examGraphLabel[2])\n .style(\"text-anchor\", \"middle\")\n .text(\"Exam 3\");\n\n svg.append(\"text\")\n .attr(\"class\", \"axis-label\")\n .attr(\"y\", height + 25)\n .attr(\"x\", examGraphLabel[3])\n .style(\"text-anchor\", \"middle\")\n .text(\"Final Exam\");\n }", "createProjects(verticals) {\n //creates directory structure based on current schema\n return verticals.map((vertical) => {\n if(this.options.garunteedUnique) {\n vertical.project_name += Date.now().toString().slice(8);\n }\n return new Vertical(vertical, this.options.schema, checkouts[vertical.package], this.options.globals);\n });\n }", "function makeReqsViz(G, numMath, numRequired, numElective, numConsulting) {\n\n for (var i = 0; i < numMath; i++) {\n G.append(\"circle\")\n .attr(\"id\", \"mathreq\" + (i+1))\n .attr(\"r\", reqRadius)\n .attr(\"cx\", 150 + i*2.3*reqRadius)\n .attr(\"cy\", 0)\n .style(\"fill\", mathColor)\n if (i == (numMath-1)) {\n G.append(\"text\")\n .attr(\"class\", \"reqNumLabel\")\n .attr(\"x\", 150 + i*2.3*reqRadius)\n .attr(\"dx\", function(d) { return numMath >= 10 ?\n -6 : -4\n })\n .attr(\"y\", -20)\n .text(numMath)\n }\n }\n\n for (var i = 0; i < numRequired; i++) {\n G.append(\"circle\")\n .attr(\"id\", \"req\" + (i+1))\n .attr(\"r\", reqRadius)\n .attr(\"cx\", (150 + numMath*2.3*reqRadius) + (i*2.3*reqRadius))\n .attr(\"cy\", 0)\n .style(\"fill\", reqColor)\n if (i == (numRequired-1)) {\n G.append(\"text\")\n .attr(\"class\", \"reqNumLabel\")\n .attr(\"x\", (150 + numMath*2.3*reqRadius) + (i*2.3*reqRadius))\n .attr(\"dx\", function(d) { return numRequired >= 10 ?\n -6 : -4\n })\n .attr(\"y\", -20)\n .text(numRequired)\n }\n }\n\n for (var i = 0; i < numElective; i++) {\n G.append(\"circle\")\n .attr(\"id\", \"electivereq\" + (i+1))\n .attr(\"r\", reqRadius)\n .attr(\"cx\", (150 + numMath*2.3*reqRadius) + (numRequired*2.3*reqRadius) + (i*2.3*reqRadius))\n .attr(\"cy\", 0)\n .style(\"fill\", electiveColor)\n\n if (i == (numElective-1)) {\n G.append(\"text\")\n .attr(\"class\", \"reqNumLabel\")\n .attr(\"x\", (150 + numMath*2.3*reqRadius) + (numRequired*2.3*reqRadius) + (i*2.3*reqRadius))\n .attr(\"dx\", function(d) { return numElective >= 10 ?\n -6 : -4\n })\n .attr(\"y\", -20)\n .text(numElective)\n }\n }\n\n for (var i = 0; i < numConsulting; i++) {\n majorReqG.append(\"circle\")\n .attr(\"id\", \"consultingreq\" + (i+1))\n .attr(\"r\", reqRadius)\n .attr(\"cx\", (150 + numMath*2.3*reqRadius) + (numRequired*2.3*reqRadius) + (numElective*2.3*reqRadius) + (i*2.3*reqRadius))\n .attr(\"cy\", 0)\n .style(\"fill\", consultingColor)\n if (i == (numElective-1)) {\n G.append(\"text\")\n .attr(\"class\", \"reqNumLabel\")\n .attr(\"x\", (150 + numMath*2.3*reqRadius) + (numRequired*2.3*reqRadius) + (numElective*2.3*reqRadius) + (i*2.3*reqRadius))\n .attr(\"dx\", function(d) { return numConsulting >= 10 ?\n -6 : -4\n })\n .attr(\"y\", -20)\n .text(numConsulting)\n }\n }\n }", "function GetProjectRequirements(pid) {\n\n}", "function SnpCreateAdobePortfolioProject()\r{\r\t/**\r\t The context in which this snippet can run.\r\t @type String\r\t*/\r\tthis.requiredContext = \"\\tExecute against Bridge.\\nBridge must be running and \\n\" \r\t\t+ \"select images for upload to Portfolio\";\r\t$.level = 1; // Debugging level\r}", "static sample() {\n // sample project\n var vol = new LogicalVolume();\n vol.fs.writeFileSync('/simple/_CoqProject', '-R . simple\\n\\nOne.v Two.v Three.v\\n');\n vol.fs.writeFileSync('/simple/One.v', 'Check 1.\\nFrom simple Require Import Two.');\n vol.fs.writeFileSync('/simple/Two.v', 'From Coq Require Import List.\\n\\nDefinition two_of π := π + π.\\n');\n vol.fs.writeFileSync('/simple/Three.v', 'From simple Require Import One Two.');\n \n return new CoqProject('sample', vol).fromDirectory('/');\n }", "function getGraphInfos($experiment_node,$system_node){\n\tvar paintObject;\n\tvar paintObjectsArray = new Array();\n\t// Find the view name on root <system>\n\tvar $run_modules = $experiment_node.find('run');\n\t$run_modules.each(function(){\n\t\t// Find <paint> tags inside the run tag\t\n\t\t$paint_in_run_modules = $(this).find('paint');\n\t\t// Build the graph info array to return...\n\t\t$paint_in_run_modules.each(function(index,element) {\n\t\t\tvar paintObject = new Object();\n\t\t\tpaintObject.module = $(element).parent().attr('module');\n\t\t\t// Module can be remote. Atributes are defined like this\n\t\t\t// type=\"remote\" source=\"//62.204.199.218:1099/D71F73A7AE4E112B5DF4172E60E059E5\"\n\t\t\t// Default value\n\t\t\tpaintObject.isRemoteModule = false;\n\t\t\tif ( typeof $(this).attr('type') != \"undefined\"){\n\t\t\t\tmoduleType = $(this).attr('type');\n\t\t\t\tif (moduleType==\"remote\"){\n\t\t\t\t\t// Remote module !!!\n\t\t\t\t\tpaintObject.isRemoteModule = true;\n\t\t\t\t\tpaintObject.remoteSystem = $(this).attr('source');\n\t\t\t\t}\n\t\t\t}\n\t\t\t// names and colors!!!\n\t\t\tpaintObject.names = ($(this).attr('names')).split(\",\");\n\t\t\tpaintObject.colors = ($(this).attr('colors')).split(\",\");\n\t\t\tpaintObjectsArray.push(paintObject);\n\t\t\t// END of each of paint tags\n\t\t});\n\t\t// END of each of run modules\n\t});\n\treturn paintObjectsArray;\n}" ]
[ "0.58125246", "0.56811225", "0.56728053", "0.56534463", "0.55981594", "0.55971426", "0.5461426", "0.539384", "0.53327006", "0.53272164", "0.5322658", "0.5303184", "0.52290756", "0.5226979", "0.5222293", "0.52115154", "0.520223", "0.5190522", "0.518624", "0.51758665", "0.5174454", "0.51554877", "0.513162", "0.51248467", "0.51202667", "0.511972", "0.51187396", "0.5115099", "0.5109307", "0.51046073", "0.51019084", "0.51012903", "0.5101108", "0.50822806", "0.50702506", "0.50694793", "0.50650156", "0.5061384", "0.5059249", "0.5034038", "0.50316346", "0.5022081", "0.50135976", "0.5011912", "0.5006958", "0.5003772", "0.49943447", "0.4989197", "0.4986345", "0.49853262", "0.49837688", "0.49676675", "0.49604854", "0.49518728", "0.4948865", "0.49425125", "0.49368683", "0.49342433", "0.49339738", "0.49313244", "0.49178284", "0.489955", "0.48977414", "0.48943374", "0.48938754", "0.48937356", "0.48924336", "0.48877454", "0.48854208", "0.48828802", "0.48802987", "0.4876892", "0.487111", "0.48708376", "0.48699716", "0.48686945", "0.48670664", "0.48666236", "0.4863092", "0.4851905", "0.4847865", "0.4835293", "0.48288882", "0.48277113", "0.48234707", "0.48211452", "0.48209217", "0.48164475", "0.48144576", "0.4810742", "0.48045453", "0.48018444", "0.47950628", "0.47925258", "0.47912538", "0.4790639", "0.4790438", "0.47881982", "0.4784991", "0.4781159" ]
0.49671343
52
This method is specifically for updating JSON in a Tree
function updateJsonInTree(path, callback) { return (host, context) => { if (!host.exists(path)) { host.create(path, fileutils_1.serializeJson(callback({}, context))); return host; } host.overwrite(path, fileutils_1.serializeJson(callback(readJsonInTree(host, path), context))); return host; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "UpdateTree()\n {\n\n }", "updateTree(row) {\n // ******* TODO: PART VII *******\n \n }", "function updateJSON(obj) {\n\n console.log(obj)\n //console.log(obj.entree);\n\n xmlFileToJs('Books.xml', function (err, result) {\n if (err) throw (err);\n\n // idCopied = obj.id; //sometimes work and not working\n\n /* no need to update id since section index and entree index are specified*/\n //result.books.section[obj.sec_n].entree[obj.entree]['id'] = obj.id; \n\n result.books.section[obj.sec_n].entree[obj.entree]['title'] = obj.title;\n result.books.section[obj.sec_n].entree[obj.entree]['author'] = obj.author;\n result.books.section[obj.sec_n].entree[obj.entree]['price'] = obj.price;\n\n console.log(JSON.stringify(result, null, \" \"));\n\n jsToXmlFile('Books.xml', result, function (err) {\n if (err) console.log(err);\n });\n });\n }", "function updateTree(row) {\n\n // ******* TODO: PART VII *******\n\n\n}", "function updateTreeStructure(selector) {\n $.getJSON(tree_url + '?dir=' + dir_url, function(data) {\n if (data.html) {\n /*\n * Remove the existing tree, update the content and build the new tree.\n * Need to do it this way, otherwise the tree doesn't open to the correct folder.\n */\n $(selector).jstree('destroy');\n $(selector).html(data.html);\n createTree(selector);\n }\n });\n}", "updateJson(pathJson, data) {\r\n pathJson = path + pathJson;\r\n if(this.isJSON(data)==1)\r\n {\r\n data=JSON.stringify(data);\r\n }\r\n\r\n fs.writeFile(pathJson, data, function (err) {\r\n if (err) {\r\n return console.error(err);\r\n }\r\n });\r\n\r\n return 1;\r\n }", "function updateTree(){\n\t\tfor (var e=0;e<$scope.data.length;e++){\n\t\t$scope.data.$save($scope.data[e]).then(function(d){},function(e){console.log(e);});\n\t\t}\n\t}", "_updateChild(data, parent, animate) {\n const self = this;\n const current = self.findById(data.id);\n // If the subtree does not exist, add it as a whole\n if (!current) {\n self._addChild(data, parent, animate);\n return;\n }\n // Update all child nodes under the new node\n Util.each(data.children, child => {\n self._updateChild(child, current, animate);\n });\n // Use the children instance of the current node to delete the removed child node\n const children = current.get('children');\n if (children) {\n const len = children.length;\n if (len > 0) {\n let child;\n for (let i = children.length - 1; i >= 0; i--) {\n child = children[i].getModel();\n if (indexOfChild(data.children, child) === -1) {\n self._removeChild(child.id, {\n x: data.x,\n y: data.y\n }, animate);\n // Update the list of child node item instances cached under the parent node\n children.splice(i, 1);\n }\n }\n }\n }\n const model = current.getModel();\n if (animate) {\n // If there is animation, first cache the node motion and then update the node\n current.set('origin', {\n x: model.x,\n y: model.y\n });\n }\n current.set('model', data.data);\n current.updatePosition({ x: data.x, y: data.y });\n }", "function updateRulesFileTree() {\n\n\t\t$.ajax({\n\t\t\ttype: \"GET\",\n\t\t\turl: \"/getJsonRulesTree\",\n\t\t\tcontentType: \"application/json\",\n\t\t\tdataType: \"json\"\n\t\t})\n\n\t\t.done(function(d) {\n\t\t\t$('#rulesContainer').jstree(true).settings.core.data = d.rulesTree;\n\t\t\t$('#rulesContainer').jstree(true).refresh();\n\t\t\tgetTotalRulesCount();\n\t\t\tchartTypeRules();\n\t\t})\n\n\t\t.fail(function(d) {\n\t\t\tconsole.log(\"updateRulesFileTree - fail!\")\n\t\t\tconsole.log(d)\n\t\t});\n\t}", "function updateJson(host, path, updater) {\n const updatedValue = updater(readJson(host, path));\n writeJson(host, path, updatedValue);\n}", "function TreeGrid_UpdateContent_Tree(theObject)\n{\n\t//helpers\n\tvar i, c, nRow, nLastParent, nDepth, nodes;\n\t//get treeview column\n\tvar nTreeViewColumn = Get_Number(theObject.Properties[__NEMESIS_PROPERTY_TREE_COLUMN], -1);\n\t//valid?\n\tif (nTreeViewColumn != -1)\n\t{\n\t\t//get the the node state\n\t\tvar strNodeState = Get_String(theObject.Properties[__NEMESIS_PROPERTY_TREENODESTATE], null);\n\t\t//valid?\n\t\tif (strNodeState != null)\n\t\t{\n\t\t\t//initialise Tree Data properties\n\t\t\ttheObject.Content.TreeData =\n\t\t\t{\n\t\t\t\tColumn: nTreeViewColumn,\n\t\t\t\tNodes: [],\n\t\t\t\tVisibleMap: {},\n\t\t\t\tShowButtons: Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_TVHASBUTTONS], true),\n\t\t\t\tShowLines: Get_Bool(theObject.Properties[__NEMESIS_PROPERTY_TVHASHLINES], true),\n\t\t\t\tImageList: __IMAGELISTS.GetImageList(theObject.Properties)\n\t\t\t};\n\t\t\t//get the nodestate\n\t\t\tfor (i = 0, c = strNodeState.length, nRow = -1, nLastParent = -1, nDepth = -1; i < c; i++)\n\t\t\t{\n\t\t\t\t//get the char\n\t\t\t\tvar char = strNodeState[i];\n\t\t\t\t//switch on char\n\t\t\t\tswitch (char)\n\t\t\t\t{\n\t\t\t\t\tcase \",\":\n\t\t\t\t\t\t//ignore\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"{\":\n\t\t\t\t\t\t//opening a parent\n\t\t\t\t\t\tnLastParent = nRow;\n\t\t\t\t\t\t//increase depth\n\t\t\t\t\t\tnDepth++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"}\":\n\t\t\t\t\t\t//closing a parent\n\t\t\t\t\t\tnLastParent = nLastParent == -1 ? -1 : theObject.Content.TreeData.Nodes[nLastParent].Parent;\n\t\t\t\t\t\t//decrease depth\n\t\t\t\t\t\tnDepth--;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t//add new node\n\t\t\t\t\t\ttheObject.Content.TreeData.Nodes[++nRow] =\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tParent: nLastParent,\n\t\t\t\t\t\t\tOpen: char == \"E\",\n\t\t\t\t\t\t\tDepth: nDepth,\n\t\t\t\t\t\t\tChildren: [],\n\t\t\t\t\t\t\tStringIndex: i\n\t\t\t\t\t\t};\n\t\t\t\t\t\t//has parent?\n\t\t\t\t\t\tif (nLastParent != -1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//get parent\n\t\t\t\t\t\t\tvar theParent = theObject.Content.TreeData.Nodes[nLastParent];\n\t\t\t\t\t\t\t//add this to parent's children collection\n\t\t\t\t\t\t\ttheParent.Children[theParent.Children.length] = nRow;\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\t//now loop through every row\n\t\t\tfor (nodes = theObject.Content.TreeData.Nodes, i = 0, c = nodes.length; i < c; i++)\n\t\t\t{\n\t\t\t\t//get this node\n\t\t\t\tvar node = nodes[i];\n\t\t\t\t//nyet parent?\n\t\t\t\tif (node.Parent == -1)\n\t\t\t\t{\n\t\t\t\t\t//make it visible\n\t\t\t\t\ttheObject.Content.TreeData.VisibleMap[i] = true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t//its only visible if the parent is open and visible\n\t\t\t\t\ttheObject.Content.TreeData.VisibleMap[i] = theObject.Content.TreeData.VisibleMap[node.Parent] && nodes[node.Parent].Open;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//initialise the style\n\t\t\tvar style = {};\n\t\t\t//switch according to looks\n\t\t\tswitch (theObject.InterfaceLook)\n\t\t\t{\n\t\t\t\tdefault:\n\t\t\t\t\tstyle.DepthModifier = 16;\n\t\t\t\t\tstyle.TreeButtonModifier = 16;\n\t\t\t\t\tstyle.TreeButtonCssOpenWidthModifier = theObject.Content.TreeData.ShowLines ? \"0\" : Math.round((style.TreeButtonModifier - 9) / 2);\n\t\t\t\t\tstyle.TreeButtonCssCloseWidthModifier = theObject.Content.TreeData.ShowLines ? \"0\" : Math.round((style.TreeButtonModifier - 9) / 2);\n\t\t\t\t\tstyle.TreeButtonCssOpen = function (nHeight) { return \"position:absolute;width:9px;height:9px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_classic_treeviews.png');background-position:-131px -10px;top:\" + Math.round((nHeight - 9) / 2) + \"px;\"; };\n\t\t\t\t\tstyle.TreeButtonCssClose = function (nHeight) { return \"position:absolute;width:9px;height:9px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_classic_treeviews.png');background-position:-115px -10px;top:\" + Math.round((nHeight - 9) / 2) + \"px;\"; };\n\t\t\t\t\tstyle.TreeButtonCssHasLine = function (nHeight, imgPos) { return \"position:absolute;width:16px;height:\" + nHeight + \"px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_classic_treeviews.png');background-position:\" + imgPos + \"px -\" + Math.round((30 - nHeight) / 2) + \"px;top:0px;\"; };\n\t\t\t\t\tbreak;\n\t\t\t\tcase __NEMESIS_LOOK_SAP_BELIZE:\n\t\t\t\t\t//set sap styles\n\t\t\t\t\tstyle.DepthModifier = 20;\n\t\t\t\t\tstyle.TreeButtonModifier = 24;\n\t\t\t\t\tstyle.TreeButtonCssOpen = function (nHeight) { return \"position:absolute;width:12px;height:6px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_sap_treeview.png');background-position:-37px 0px;top:\" + (nHeight - 6) / 2 + \"px;\"; };\n\t\t\t\t\tstyle.TreeButtonCssClose = function (nHeight) { return \"position:absolute;width:7px;height:11px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_sap_treeview.png');background-position:-30px 0px;top:\" + (nHeight - 14) / 2 + \"px;\"; };\n\t\t\t\t\tstyle.TreeButtonCssOpenWidthModifier = (style.TreeButtonModifier - 7) / 2;\n\t\t\t\t\tstyle.TreeButtonCssCloseWidthModifier = (style.TreeButtonModifier - 4) / 2;\n\t\t\t\t\tbreak;\n\t\t\t\tcase __NEMESIS_LOOK_SAP_ENJOY:\n\t\t\t\tcase __NEMESIS_LOOK_SAP_TRADESHOW:\n\t\t\t\tcase __NEMESIS_LOOK_SAP_SIGNATURE_DESIGN:\n\t\t\t\tcase __NEMESIS_LOOK_SAP_SIGNATURE_CORBU:\n\t\t\t\tcase __NEMESIS_LOOK_SAP_CORBUS:\n\t\t\t\tcase __NEMESIS_LOOK_SAP_BLUE_CRYSTAL:\n\t\t\t\t\t//set sap styles\n\t\t\t\t\tstyle.DepthModifier = 16;\n\t\t\t\t\tstyle.TreeButtonModifier = 16;\n\t\t\t\t\tstyle.SAP_DEPTH_COLORS = new Array(Get_Color(\"<SAPCLR:54>\", null, theObject.InterfaceLook), Get_Color(\"<SAPCLR:53>\", null, theObject.InterfaceLook), Get_Color(\"<SAPCLR:52>\", null, theObject.InterfaceLook), Get_Color(\"<SAPCLR:51>\", null, theObject.InterfaceLook));\n\t\t\t\t\tstyle.SAP_BORDER_COLORS_DEC = new Array(Get_Color(\"<SAPCLR:91>\", null, theObject.InterfaceLook), Get_Color(\"<SAPCLR:90>\", null, theObject.InterfaceLook), Get_Color(\"<SAPCLR:89>\", null, theObject.InterfaceLook), Get_Color(\"<SAPCLR:88>\", null, theObject.InterfaceLook));\n\t\t\t\t\tstyle.SAP_BORDER_COLORS_INC = new Array(Get_Color(\"<SAPCLR:86>\", null, theObject.InterfaceLook), Get_Color(\"<SAPCLR:87>\", null, theObject.InterfaceLook), Get_Color(\"<SAPCLR:88>\", null, theObject.InterfaceLook), Get_Color(\"<SAPCLR:89>\", null, theObject.InterfaceLook));\n\t\t\t\t\t//switch again on the look\n\t\t\t\t\tswitch (theObject.InterfaceLook)\n\t\t\t\t\t{\n\t\t\t\t\t\tcase __NEMESIS_LOOK_SAP_ENJOY:\n\t\t\t\t\t\tcase __NEMESIS_LOOK_SAP_TRADESHOW:\n\t\t\t\t\t\t\tstyle.TreeButtonCssOpen = function (nHeight) { return \"position:absolute;width:11px;height:8px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_sap_treeview.png');background-position:-8px 0px;top:\" + Math.round((nHeight - 8) / 2) + \"px;\"; };\n\t\t\t\t\t\t\tstyle.TreeButtonCssClose = function (nHeight) { return \"position:absolute;width:8px;height:11px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_sap_treeview.png');background-position:0px 0px;left:30px;top:\" + Math.round((nHeight - 11) / 2) + \"px;\"; };\n\t\t\t\t\t\t\tstyle.TreeButtonCssOpenWidthModifier = Math.round((style.TreeButtonModifier - 11) / 2);\n\t\t\t\t\t\t\tstyle.TreeButtonCssCloseWidthModifier = Math.round((style.TreeButtonModifier - 8) / 2);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase __NEMESIS_LOOK_SAP_SIGNATURE_CORBU:\n\t\t\t\t\t\tcase __NEMESIS_LOOK_SAP_SIGNATURE_DESIGN:\n\t\t\t\t\t\tcase __NEMESIS_LOOK_SAP_CORBUS:\n\t\t\t\t\t\tcase __NEMESIS_LOOK_SAP_BLUE_CRYSTAL:\n\t\t\t\t\t\t\tstyle.TreeButtonCssOpen = function (nHeight) { return \"position:absolute;width:7px;height:4px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_sap_treeview.png');background-position:-23px 0px;top:\" + Math.round((nHeight - 4) / 2) + \"px;\"; };\n\t\t\t\t\t\t\tstyle.TreeButtonCssClose = function (nHeight) { return \"position:absolute;width:4px;height:7px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_sap_treeview.png');background-position:-19px 0px;top:\" + Math.round((nHeight - 7) / 2) + \"px;\"; };\n\t\t\t\t\t\t\tstyle.TreeButtonCssLeaf = function (nHeight) { return \"position:absolute;width:3px;height:3px;background-image:url('\" + __HOST_LESSON_RESOURCES + \"ais_theme_sap_treeview.png');background-position:-25px -5px;top:\" + Math.round((nHeight - 3) / 2) + \"px;\"; };\n\t\t\t\t\t\t\tstyle.TreeButtonCssOpenWidthModifier = Math.round((style.TreeButtonModifier - 7) / 2);\n\t\t\t\t\t\t\tstyle.TreeButtonCssCloseWidthModifier = Math.round((style.TreeButtonModifier - 4) / 2);\n\t\t\t\t\t\t\tstyle.TreeButtonCssLeafWidthModifier = Math.round((style.TreeButtonModifier - 3) / 2);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t//save the style\n\t\t\ttheObject.Content.TreeData.Style = style;\n\t\t}\n\t}\n}", "function setData(json) {\r\n var newTempNodes = json.tempNodes;\r\n var newTempLinks = json.tempLinks;\r\n var newHistory = json.history;\r\n tempCurrentNode = json.tempCurrentNode;\r\n //\r\n newTempLinks.forEach(function(d) {\r\n var tempLink = tempLinks_lookup[d.source + \",\" + d.target];\r\n tempLink.active = d.active;\r\n tempLink.conflict = d.conflict;\r\n });\r\n\r\n newTempNodes.forEach(function(d) {\r\n var tempNode = tempNodes_lookup[d.id];\r\n tempNode.selectable = d.selectable;\r\n tempNode.excluded = d.excluded;\r\n tempNode.highlighted = d.highlighted;\r\n tempNode.conflicting = d.conflicting;\r\n tempNode.checkIncomingLinks();\r\n });\r\n\r\n history.splice(0, history.length);\r\n newHistory.forEach(function(d) {\r\n history.push(d);\r\n });\r\n confirmChanges(true);\r\n }", "function updateJson(file, next) {\n if (file.isNull() || file.isDirectory() || isBinary(file)) {\n next(null, file);\n return;\n }\n\n if (file.contents.toString() !== file.originalContent) {\n next(null, file);\n return;\n }\n if (!isObject(file.json)) {\n next(null, file);\n return;\n }\n file.contents = new Buffer(JSON.stringify(file.json, null, 2) + '\\n');\n next(null, file);\n}", "treetypeUpdate( context, data )\n\t\t{\n\t\t\treturn fetch( `/api/treetypes/${data.id}`, {\n\t\t\t\theaders: {\n\t\t\t\t\t'X-Requested-With': 'XMLHttpRequest',\n\t\t\t\t\t'X-CSRF-token': window.token,\n\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\t'Accept': 'application/json',\n\t\t\t\t\t'Authorization': `Bearer ${sessionStorage.getItem('token')}`\n\t\t\t\t},\n\t\t\t\tmethod: 'PUT',\n\t\t\t\tbody: JSON.stringify( data )\n\t\t\t})\n\t\t\t\t.then( response => response.json() )\n\t\t\t\t.then( response => {\n\t\t\t\t\tif( response.errors ) {\n\t\t\t\t\t\tcontext.commit( 'errors', response.errors );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontext.commit( 'errors', []);\n\t\t\t\t\t}\n\t\t\t\t\tcontext.commit( 'message', response.message );\n\t\t\t\t\tcontext.commit( 'success', response.success );\n\t\t\t\t})\n\t\t\t\t.catch( error => console.error( 'treetypeUpdate', error ) );\n\t\t}", "setTree(tree) {\n this.tree = tree;\n }", "function _updateSelectedObject() {\n var data = $('.listTree').data('listTree');\n\n // Filter the context to the selected parents.\n var selected = _.filter($.extend(true, {}, data.context), function(parent) {\n return $('.listTree > ul > li > span > input[value=\"' + parent.key + '\"]').prop('checked')\n });\n \n // For each parent in the working context...\n _.each(selected, function(parent) {\n\n // Filter the children to the selected children.\n parent.values = _.filter(parent.values, function(child) {\n return $('.listTree > ul > li > ul > li > span > input[value=\"' + child.key + '\"]').prop('checked');\n });\n });\n\n // Update the plugin's selected object.\n $('.listTree').data('listTree', {\n \"target\": data.target,\n \"context\": data.context,\n \"options\": data.options,\n \"selected\": selected\n });\n }", "updateTree(uri, content) {\n let tree = this.getTree(uri);\n if (tree) {\n tree = this.parser.parse(content);\n this.trees.set(uri, tree);\n }\n else {\n tree = this.createTree(uri, content);\n }\n return tree;\n }", "updateFromJson(json) {\n const self = this;\n self.set('marketplaces', json);\n\n const keys = Object.keys(json);\n\n keys.forEach(key => { self.set(key, json[key]) });\n }", "function handleDataPath(json) {\n\n if (!json) {\n return;\n }\n\n if (spFormBuilderService.selectedLookup) {\n json['console:controlRelatedEntityDataPathNodes'] = [\n {\n typeId: 'console:relatedEntityDataPathNode',\n 'console:dataPathNodeOrdinal': jsonInt(0),\n 'console:dataPathNodeRelationshipDirection': jsonLookup('core:forward'),\n 'console:dataPathNodeRelationship': spFormBuilderService.selectedLookup.getEntity()\n }\n ];\n }\n }", "setFullHierarchyTreeData() {\n const pendingFullHierarchyTreeData = this.getPendingFullHierarchyTreeData();\n // const treeItemSelected = this.getTreeItemSelected(pendingFullHierarchyTreeData);\n // if (!this.isTreeDataEqual(this.areaTreeData, pendingFullHierarchyTreeData)) {\n this.fullHierarchyTreeData = pendingFullHierarchyTreeData;\n this.$timeout(() => {\n this.fullHierarchyTree.expand_all();\n }, 50);\n }", "function updateHistoryWritersJSONString() { //fires upon save \n\t//console.log(\"updateHistoryWritersJSONString ........................... saving entered data\");\n\tvar formJsonData = null;\n\tif (dojo.byId(\"historyWritersJsonFormData\")) {\n\t\tformJsonData = dojo.byId(\"historyWritersJsonFormData\");\n\t} else if (dojo.byId(\"historyWritersJsonFormData\")) {\n\t\tformJsonData = dojo.byId(\"historyWritersJsonFormData\");\n\t}\n\tif (formJsonData != null) {\n\t\tJsonData = dojo.fromJson(formJsonData.value); //save the current JSON string into a temporary JS object that will be manipulated here \n\t\tvar formValsLocal = formValues; \n\t\tfor (var i = 0; i < formValsLocal.length; i++) { //for each element of the formValues array [the IDs of elements that will be updated]\n\t\t\tvar nodeId = formValsLocal[i].ID; \n\t\t\tvar nodeAttr = formValsLocal[i].ATTR; \n\t\t\tvar nodeVal = formValsLocal[i].VALUE;\n\t\t\tvar nodeSlang = formValsLocal[i].SLANG;\n\t\t\tif (nodeSlang in JsonData) { //if the JSON string already includes this element\n\t\t\t\tif (nodeAttr == \"checkbox\"){ \n\t\t\t\t\tif (nodeVal == \"unchecked\") { \n\t\t\t\t\t\tif (nodeId != nodeSlang) {\n\t\t\t\t\t\t\tdelete JsonData[nodeId]; \n\t\t\t\t\t\t}\n\t\t\t\t\t\tdelete JsonData[nodeSlang]; \n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse { //formValues is not a checkbox\n\t\t\t\t\tif (nodeVal == \"\" || nodeVal == null || nodeVal == dropDownNoSelectionValue) { \n\t\t\t\t\t\tdelete JsonData[nodeSlang]; //remove from the JSON\n\t\t\t\t\t\t//remove related date field if it exist\n\t\t\t\t\t\tvar richDateId = nodeSlang + \"InputDate\";\n\t\t\t\t\t\tif (richDateId in JsonData) {\n\t\t\t\t\t\t\tdelete JsonData[richDateId];\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\tJsonData[nodeSlang] = nodeVal; \n\t\t\t\t\t\tif (nodeId != nodeSlang && nodeId in JsonData) {\n\t\t\t\t\t\t\tJsonData[nodeId] = nodeVal; \n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} \n\t\t\telse { //if a JSON object is not defined for this current id\n\t\t\t\tif (nodeAttr == \"checkbox\") { \n\t\t\t\t\tif (nodeVal == \"checked\") {\n\t\t\t\t\t\tif (nodeId != nodeSlang) {\n\t\t\t\t\t\t\tJsonData[nodeId] = nodeVal; \n\t\t\t\t\t\t}\n\t\t\t\t\t\tJsonData[nodeSlang] = \"1\"; \n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (nodeAttr == \"radio\") {\n\t\t\t\t\tJsonData[nodeSlang] = nodeVal; \n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (!(nodeVal == \"\" || nodeVal == null || nodeVal == dropDownNoSelectionValue)) { \n\t\t\t\t\t\tif (nodeId != nodeSlang) {\n\t\t\t\t\t\t\tJsonData[nodeId] = nodeVal; \n\t\t\t\t\t\t}\n\t\t\t\t\t\tJsonData[nodeSlang] = nodeVal; \n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvar revisedJson = dojo.toJson(JsonData);\n\t\tdojo.attr(formJsonData, \"value\", revisedJson);\n\t\tformValues = [];\n\t\t\n\t\t//update JSON string with tab id's\n\t\tcheckForTabElementsEntered(\"referralHistPanel\");\n\t\tcheckForTabElementsEntered(\"personalHistInfo\");\n\t\tcheckForTabElementsEntered(\"languageSocialHistInfo\");\n\t\tcheckForTabElementsEntered(\"educationHistInfo\");\n\t\tcheckForTabElementsEntered(\"healthHistInfo\");\n\t\tcheckForTabElementsEntered(\"employmentHistInfo\");\n\t\t\n\t\t//console.log(\"updateHistoryWritersJSONString ........................... completed saving data\");\n\t\t\n\t}\n}", "updateTree_() {\n this['tree'] = [this.scope_['root']];\n this.scope_.$broadcast(SlickGridEvent.INVALIDATE_ROWS);\n this.scrollDelay_.start();\n }", "updateTreeView(path, type) {\n\n // function to create tree view\n let merge = (treeView, tempView, type) =>{\n // temp View has a single key always\n key = Object.keys(tempView);\n // if key not present then add it to treeView object\n if(Object.keys(treeView).indexOf(key[0]) == -1)\n {\n if(type == \"add\")\n treeView[key] = tempView[key];\n }\n // if key present then search for child key int treeView object\n else\n {\n merge(treeView[key], tempView[key], type);\n }\n }\n\n // function to create tree view\n let deleteFile = (treeView, tempView, type) =>{\n // temp View has a single key always\n key = Object.keys(tempView);\n // if key not present then add it to treeView object\n if(treeView[key[0]] == tempView[key[0]])\n {\n if(type == \"uplink\")\n delete treeView[key];\n }\n // if key present then search for child key int treeView object\n else\n {\n deleteFile(treeView[key], tempView[key], type);\n }\n }\n\n let update = (path, type) => {\n // return the details of the current project in atom\n let object = atom.project;\n // get the path of the project folder in the atom\n let root_path = object['rootDirectories'][0]['realPath'];\n // get the project folder name\n let projectFolderName = root_path.substring(root_path.lastIndexOf(\"\\\\\")+1);\n // relative path = path according to tree view from project\n let itemRelativePathArray = path.substring(path.lastIndexOf(projectFolderName));\n itemRelativePathArray = itemRelativePathArray.split(\"\\\\\");\n // actual path = original path of file on system\n let itemActualPath = path;\n // if path is of file\n if(itemRelativePathArray[itemRelativePathArray.length-1].indexOf(\".\")!=-1 && type != \"uplink\")\n {\n if(itemRelativePathArray[itemRelativePathArray.length-1].indexOf(\".html\")!=-1)\n {\n _fs_plus.readFile(itemActualPath, \"utf8\", (err,data) => {\n dataElement[\"html\"][itemRelativePathArray[itemRelativePathArray.length-1]] = data;\n });\n }\n if (itemRelativePathArray[itemRelativePathArray.length-1].indexOf(\".css\")!=-1) {\n _fs_plus.readFile(itemActualPath, \"utf8\", (err,data) => {\n dataElement[\"css\"][itemRelativePathArray[itemRelativePathArray.length-1]] = data;\n });\n }\n if (itemRelativePathArray[itemRelativePathArray.length-1].indexOf(\".js\")!=-1) {\n _fs_plus.readFile(itemActualPath, \"utf8\", (err,data) => {\n dataElement[\"js\"][itemRelativePathArray[itemRelativePathArray.length-1]] = data;\n });\n }\n // create temp object of file\n for(let i = itemRelativePathArray.length - 1; i >= 0 ; i--)\n {\n if(i == itemRelativePathArray.length - 1)\n tempView = { [itemRelativePathArray[i]] : itemActualPath}; // assign the value\n else\n tempView = { [itemRelativePathArray[i]] : tempView}; //put the previous object\n }\n // merge current path object with original treeView object\n if(type != \"change\")\n merge(treeView, tempView, type);\n // reset the temp object\n tempView = {};\n }\n\n if(itemRelativePathArray[itemRelativePathArray.length-1].indexOf(\".\")!=-1 && type == \"uplink\")\n {\n if(itemRelativePathArray[itemRelativePathArray.length-1].indexOf(\".html\")!=-1)\n {\n delete dataElement[\"html\"][itemRelativePathArray[itemRelativePathArray.length-1]];\n }\n if (itemRelativePathArray[itemRelativePathArray.length-1].indexOf(\".css\")!=-1) {\n delete dataElement[\"css\"][itemRelativePathArray[itemRelativePathArray.length-1]];\n }\n if (itemRelativePathArray[itemRelativePathArray.length-1].indexOf(\".js\")!=-1) {\n delete dataElement[\"js\"][itemRelativePathArray[itemRelativePathArray.length-1]];\n }\n // create temp object of file\n for(let i = itemRelativePathArray.length - 1; i >= 0 ; i--)\n {\n if(i == itemRelativePathArray.length - 1)\n tempView = { [itemRelativePathArray[i]] : itemActualPath}; // assign the value\n else\n tempView = { [itemRelativePathArray[i]] : tempView}; //put the previous object\n }\n // merge current path object with original treeView object\n if(type != \"change\")\n deleteFile(treeView, tempView, type);\n // reset the temp object\n tempView = {};\n }\n console.log(treeView);\n console.log(dataElement);\n }\n\n if( type==\"add\")\n {\n update(path, \"add\");\n }\n if( type==\"uplink\")\n {\n update(path, \"uplink\");\n }\n if( type==\"change\")\n {\n update(path, \"change\");\n }\n }", "function updateJson(input){\n document.getElementById(\"table-json\").value = myRelate.model.toJson();\n download(myRelate.model.toJson(), \"loadingData.json\", \"text/plain\")\n myRelate.isModified = false;\n\n }", "function TreeView_UpdateContent(theHTML, theObject)\n{\n\t//now recreate the TreeView Data\n\ttheHTML.TreeData = new TreeViewData_TreeViewData(theObject);\n\t//finally select the data\n\ttheHTML.TreeData.Select(theObject.Properties[__NEMESIS_PROPERTY_SELECTION]);\n}", "function updateNode(obj, node) {\n obj2elems(obj, node);\n expand_collapase_handler(node);\n value_modification_handler(node);\n control_icon_handler(node);\n}", "updateTree(row) {\n // ******* TODO: PART VII *******\n this.clearTree();\n\n // Only highlights aggregate teams\n d3.select(\"g#tree\")\n .selectAll(\"text.\" + row.key)\n .classed(\"selectedLabel\", true);\n\n d3.select(\"g#tree\")\n .selectAll(\"path.\" + row.key)\n .classed(\"selected\", true);\n }", "function updateRoot(){\n\troot = JSON.parse(createD3Tree(null,riverNetwork.root));\n}", "async function updateData(path,json){\n\t\tawait firebase.database().ref(path).update(json)\n\t\t.then(function(){context.succeed({\"status\":\"success\",\"errordetails\":null})}).\n\t\tcatch(function(error){context.succeed({\"status\":\"error\",\"errordetails\":error})});\n\t}", "function updateJSON() {\n var windowjson = window.ASUHeaderMakerJSON.children;\n var stringified = JSON.stringify(windowjson, ['id', 'count', 'title', 'url', 'children', 'index']);\n console.log(windowjson);\n document.getElementById('edit-brand-header-config-und-0-value').value = stringified;\n document.getElementById('asu-brand-header-json-out').value = stringified;\n }", "function update($, node) {\n if (node.type !== $.node.type) {\n throw Error(`Invalid update for a \"${$.node.type}\" node`);\n }\n updateAttrs($, node);\n updateEvents($, node);\n updateChildren($, node);\n $.node = node;\n}", "updateFlattenedData() {\n const getNodeKey = ({ treeIndex }) => treeIndex;\n const flatteningNestedArray = getFlatDataFromTree({treeData: this.state.treeData, getNodeKey});\n this.setState(state => ({\n flattenedArray: flatteningNestedArray,\n textFieldValue: '',\n }))\n }", "function updateJSON() {\n fs.writeFile('db/db.json', JSON.stringify(notes, '\\t'), err => {\n if (err) {\n return err;\n }\n return true;\n });\n }", "function updateparentHead(obj) {\n $(\"#pregsuccessBefore\").text(\"\");\n obj = decodeURI(obj);\n obj = JSON.parse(obj);\n //dispalyhrmsCommonParentHeadMaster();\n $(\"#parentheadName\").val(obj.parentHead);\n $(\"#parentheadSaveandUpdateButton\").text(\"Update\");\n $(\"#parentheadSaveandUpdateButton\").val(\"update\");\n $(\"#parentheadResetButton\").text(\"Back\");\n $(\"#idValue\").val(obj.Id);\n}", "update(node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY)\n return false;\n if (this.spec.update) {\n let result = this.spec.update(node, outerDeco, innerDeco);\n if (result)\n this.updateInner(node, outerDeco, innerDeco, view);\n return result;\n } else if (!this.contentDOM && !node.isLeaf) {\n return false;\n } else {\n return super.update(node, outerDeco, innerDeco, view);\n }\n }", "function treeSetValue(tree, value) {\n tree.node.value = value;\n treeUpdateParents(tree);\n}", "function update(id, data) {\n\n return $http.put(treeBase + id, data)\n .then(function(data){ return data.data; });\n }", "function ex3_update_node(node_name, field_name, value) {\n get_node(node_name)[field_name] = value;\n // Update everything\n update_all();\n}", "editJsonList(input) {\n let jvalue = this.get(input.path);\n if (jvalue) {\n if (jvalue.constructor === Array) {\n let listObj = jvalue.find(obj => obj[input.id] === input.value);\n const foundIndex = jvalue.findIndex(obj => obj[input.id] === input.value);\n\n if (listObj) {\n const new_configs = input.body\n Object.keys(new_configs).forEach((key) => {\n let value = findValue(listObj, key);\n if (value) {\n if (value.constructor === Array) {\n value.push(new_configs[key]);\n new_configs[key] = value;\n }\n }\n const jeditor = new this.constructor(listObj);\n jeditor.set(key, new_configs[key]);\n listObj = jeditor.toObject();\n });\n jvalue[foundIndex] = listObj;\n this.set(input.path, jvalue);\n } else {\n return ({ isError: true, error: { errorType: \"BadRequest\", \"message\": \"No Such object found.\" } });\n }\n\n } else {\n return ({ isError: true, error: { errorType: \"BadRequest\", \"message\": \"Expecting Array but found Object/String.\" } });\n }\n }\n return ({ isError: false, data: this.toObject() });\n\n }", "_changedNode(){\n\n if (this.root.autoMerklify)\n this._refreshHash(true);\n }", "updateSelf(namedChildren, data) {\n this.namedChildren = namedChildren;\n this.props = data;\n }", "update_children(){\n let children = this.get_children_objects()\n for (var i = 0; i < children.length; i++) {\n children[i].set_parent_node(this);\n }\n this.notify_fragment_dirty();\n }", "function updateJSON(x){\n\t$.ajax({\n \t\turl:\"https://api.myjson.com/bins/4x8qw\",\n \t\ttype:\"PUT\",\n \t\tdata: x,\n \t\tcontentType:\"application/json; charset=utf-8\",\n \t\tdataType:\"json\",\n \t\tsuccess: function(data, textStatus, jqXHR){\n\t\t\tconsole.log(x + \" updated!\");\n \t\t}\n\t});\n}", "@action\n\tupdateFromJson(json) {\n\t\trunInAction(() => {\n\t\t\tthis.postId = json.postId;\n\t\t\tthis.id = json.id;\n\t\t\tthis.body = json.body;\n\t\t\tthis.author = this.store.userStore.resolveUserFromComment(json);\n\t\t});\n\t}", "function updateObject(object, newValue, path){\n var stack = path.split('.');\n while(stack.length>1){object = object[stack.shift()];}\n object[stack.shift()] = newValue;\n }", "function propagateUpdate({\n dirs,\n baseTrees\n}) {\n let objects = [];\n let treeHash, currentPath, currentTree, currentDir;\n while (dirs.length > 0) {\n\n // Get bottom path, dir, tree\n currentPath = dirs[0];\n currentDir = removeParentPath(currentPath)\n currentTree = getValues(baseTrees[currentPath])\n //FIXME: When the fpath contains word \"new\"\n\t// Add or a edit a fial fails,\n\t// since it cannot determine the path correctly\n\n // Sort the tree entry by entry names\n currentTree.sort(sortArrayByKey);\n\n // Compute the new tree hash\t\t\n let obj = createGitObject(TYPE_TREE, currentTree);\n objects.push([TYPE_TREE, obj.object]);\n treeHash = obj.id;\n\n // Update the parent tree with the new hash of current tree\n if (currentPath != \"\") {\n let parent_dir = getParentPath(currentPath);\n baseTrees[parent_dir][currentDir].id = treeHash\n }\n\n // Remove the current dir and go for the upper level\n dirs.shift();\n }\n\n return ({\n treeHash,\n newTreeObjects: objects\n });\n}", "function addTreeOne() {\n\nvar loader = new THREE.JSONLoader();\nvar treeModelOne;\nloader.load(\"3D_json/treeOne.json\", callTree);\n\n}", "__changeData(rawData,chk,changed,slf){\n var __limit=chk.length-1;\n\n for(var i=0; i<rawData.length; i++)\n {\n if(rawData[i]){\n if(slf.state.levelCount!==__limit && rawData[i].folderName===chk[slf.state.levelCount]){\n slf.state.levelCount++;\n slf.__changeData(rawData[i].child,chk,changed,slf);\n }else{\n if(rawData[i].folderName===chk[__limit] && !changed.val){\n rawData[i]._on=rawData[i]._on===true?false:true;\n changed.val=true;\n return;\n }\n }\n }\n }\n }", "function update(tree) {\n if (graph.nodes && !graph.nodes.empty()) graph.nodes.remove()\n if (graph.links && !graph.links.empty()) graph.links.remove()\n\n graph.links = graph.element.append('g').attr('id', 'linksContainer')\n graph.nodes = graph.element.append('g').attr('id', 'nodesContainer')\n\n let nodes = tree.descendants()\n let links = tree.descendants().slice(1)\n\n linksAttr(graph.links.selectAll('.link').data(links, d => d.data.id).enter())\n nodesAttrs(graph.nodes.selectAll('.node').data(nodes).enter())\n\n if (!graph.style.barChart) updateLeafLabels(graph.style.leafLabels)\n else {\n graph.element.selectAll('.leafLabelIsolates text').remove()\n graph.element.selectAll('circle').each(d => addBarCharts(d))\n addLeafLabelsNotIsolates()\n }\n\n updateLinkLabels(graph.style.linkLabels)\n updateInternalLabels(graph.style.parentLabels)\n }", "_updateQuadtree() {\n this._quadtree.clear();\n //insert all entities into the tree again\n for (let i = 0; i < this._entities.length; i++) {\n const entity = this._entities[i];\n this._quadtree.insert(entity);\n }\n }", "function updateTree(branch, cb) {\n if (branch === currentTree.branch && currentTree.sha) return cb(null, currentTree.sha);\n that.getRef(\"heads/\"+branch, function(err, sha) {\n currentTree.branch = branch;\n currentTree.sha = sha;\n cb(err, sha);\n });\n }", "function updateModifiedTab(){\n treeFileElements = $(\".jstree-anchor\");\n list.getList().forEach(function(tab){\n if(tab.modified){\n document.getElementById(tab.getPath()).classList.add(\"modified\");\n for(var i = 0; i < treeFileElements.length;i++){\n if(treeFileElements[i].parentElement.attributes['data-path'].value === tab.getPath()){\n treeFileElements[i].parentElement.classList.add(\"modified\");\n break;\n }\n }\n }\n else{\n try{document.getElementById(tab.getPath()).classList.remove(\"modified\");}catch(e){}\n for(var i = 0; i < treeFileElements.length;i++){\n if(treeFileElements[i].parentElement.attributes['data-path'].value === tab.getPath()){\n try{treeFileElements[i].parentElement.classList.remove(\"modified\");}catch(e){}\n break;\n }\n }\n }\n });\n}", "function reconstructJsTreeData(data, id) {\n var jsTreeNode;\n if (data[id].original) {\n jsTreeNode = data[id].original;\n jsTreeNode.children = [];\n }\n else {\n jsTreeNode = new _constants_jstree__WEBPACK_IMPORTED_MODULE_4__[\"JsTreeNode\"](data[id].text, data[id].id);\n }\n if (data[id].children) {\n jsTreeNode.children = data[id].children.map(function (child) { return reconstructJsTreeData(data, child); });\n }\n return jsTreeNode;\n}", "function treeUpdateParents(tree) {\n if (tree.parent !== null) {\n treeUpdateChild(tree.parent, tree.name, tree);\n }\n}", "function updateDataNode(path, localNode) {\n if(localNode) {\n return wireClient.set(path, localNode.data, localNode.mimeType).\n then(function() {\n remoteAdapter.expireKey(path);\n }).then(function() {\n var parentPath = util.containingDir(path);\n remoteAdapter.expireKey(parentPath);\n if(caching.descendIntoPath(parentPath)) {\n return util.asyncGroup(\n curry(remoteAdapter.get, parentPath),\n curry(store.getNode, parentPath)\n ).then(function(parents) {\n var baseName = util.baseName(path);\n parents[1].data[baseName] = parents[0].data[baseName];\n });\n }\n });\n } else {\n return remoteAdapter.get(path).\n then(function(node) {\n remoteAdapter.expireKey(path);\n return node;\n });\n }\n }", "function updateDOM() {\n\tvar newTree = render(data);\n\tvar patches = diff(tree, newTree);\n\trootNode = patch(rootNode, patches);\n\ttree = newTree;\n}", "function updateRoot(event) {\n var context = event.context,\n oldRoot = context.oldRoot,\n children = oldRoot.children;\n\n forEach(children, function(child) {\n self.updateParent(child);\n });\n }", "function initializeRepositoryTree() {\n $('#node-repository-tree').jstree({\n 'core': {\n 'check_callback': true\n },\n 'types': {\n 'file': {'valid_children': [], 'icon': 'glyphicon glyphicon-file'}\n },\n 'plugins': ['themes', 'html_data', 'dnd', 'state', 'ui', 'types']\n })\n .on('rename_node.jstree', function (e, data) {\n\n var itemId = data.node.id;\n var contentAjaxLoader = $('.forms-container').find('.ajax-loader');\n contentAjaxLoader.show();\n\n var postVariables, posting;\n\n if ($(\".groups\").is(\":visible\")) {\n postVariables = {\n 'name': data.node.text,\n 'grpId': 0\n };\n\n posting = $.post(Routing.generate('add_' + nodeType, {_locale: locale}), postVariables);\n } else if ($(\".collections\").is(\":visible\")) {\n postVariables = {\n 'name': data.node.text,\n 'collId': 0\n };\n\n posting = $.post(Routing.generate('add_collections_' + nodeType, {_locale: locale}), postVariables);\n }\n\n\n posting.done(function (response) {\n var newItemId = response;\n\n // change node data\n data.node.li_attr['class'] = 'file unclassified';\n data.node.li_attr['data-node'] = newItemId;\n\n // change visible data\n $('#' + itemId)\n .addClass('file unclassified')\n .attr('data-node', newItemId);\n\n $('#' + itemId + ' a').click();\n\n contentAjaxLoader.hide();\n });\n });\n\n}", "function update_tree()\n{\n var tree_container = document.getElementById(\"tree_container2\");\n\n /* Delete all the childern in the tree */\n while(tree_container.firstChild)\n {\n tree_container.removeChild(tree_container.firstChild);\n }\n\n /* Now create a node for ever child */\n for(var i=0; i < app_state.nodes.length; i++)\n {\n var node = app_state.nodes[i];\n\n var div = document.createElement(\"div\");\n div.classList.add(\"tree_node\");\n div.innerHTML = node.title.innerHTML;\n\n tree_container.appendChild(div);\n }\n}", "function updatePackageJson() {\n return (tree, context) => {\n logging_1.logInfoWithDescriptor('Aktualisiere LUX-Components Version auf 1.8.5.');\n return util_1.waitForTreeCallback(tree, () => {\n const newDependency = {\n type: dependencies_1.NodeDependencyType.Default,\n version: '1.8.5',\n name: '@ihk-gfi/lux-components'\n };\n dependencies_1.updatePackageJsonDependency(tree, context, newDependency);\n logging_1.logSuccess(`package.json erfolgreich aktualisiert.`);\n return tree;\n });\n };\n}", "function setTreeModified(bool) {\n // log.d('modified =' + bool);\n treeModified = bool;\n if (bool) saveButton.show(true);\n else {saveButton.hide(true);} \n }", "function setTreeOne(){\n\tdata = tree_one;\n\treadTree();\n\td3.select(\"svg\").remove();\n\tdrawUI();\n}", "updateSelfData(ro) {}", "function updateSignal(){\n var jsonFilePath = \"./config.json\"; //which file to look at\n var searchKey = \"signal\"; //what to search for\n $.ajaxSetup({cache:false}); //disable cache so it can update \n $.getJSON(jsonFilePath, function(data){\n //console.log(data);\n for (var i = 0; i<nodeList.length; i++){ //loop through all nodes\n for (var j in data){ //loop through first key ==> j\n if (nodeList[i].nodeName == j){\n for (var k in data[j]){ //loop through sub keys ==> k\n if (k == searchKey){\n var nodeObj = data[j];\n var updatedSignal = data[j][k];\n //var updatedStatus = data[j][\"status\"];\n nodeList[i].signal = updatedSignal;\n nodeList[i].statusChange();\n //nodeList[i].status = updatedStatus;\n $(\"#\"+ nodeList[i].infoID).html(nodeList[i].print());\n changeSignalStrengthNotation(nodeList[i].markerID);\n console.log(\"reading from json and printing info out\");\n //document.getElementById(nodeList[i].infoID).innerText(nodeList[i].print());\n //console.log(nodeObj);\n //console.log(updatedSignal);\n }\n }\n }\n }\n }\n });\n}", "function updateTableNode(jsonElement,node){\n \n let typeNode = node.getElementsByClassName(\"type\")[0];\n let statusNode = node.getElementsByClassName(\"status\")[0];\n let tdNodeDetail = node.getElementsByClassName(\"detail\")[0];\n \n let type = jsonElement.vmType;\n let _status = jsonElement.eventType;\n let balance = jsonElement.accumulatedBalance;\n\n let status = '';\n\n if(_status==\"CREATED\"){\n status='stop';\n }else if(_status=\"RUNNING\"){\n status='running';\n }else if(_status='DELETED'){\n return;\n }\n \n typeNode.innerHTML = type;\n statusNode.innerHTML = status;\n tdNodeDetail.innerHTML=balance;\n}", "set(key: K, val: V) {\n this.tree.remove([key, null]);\n this.tree.insert([key, val]);\n }", "update (recursive, invalidated) {\n var draw= true;\n if (!this.control.enabled) {\n // control is currently disabled, so we don't do any visual updates\n this.invalidated= true;\n draw= false;\n }\n if (invalidated) {\n if (!this.invalidated) {\n draw= false; // this one is still valid, don't draw\n }\n else {\n this.invalidated= false; // we're drawing this item now\n }\n }\n if (draw) {\n var x;\n // make selected, or not:\n if ( this.selected )\n this.div.main.addClass('mooTree_selected');\n else\n this.div.main.removeClass('mooTree_selected');\n // update indentations:\n var p= this, i= '';\n while (p.parent) {\n p= p.parent;\n i= this.getImg(p.last || !this.control.grid ? '' : 'I') + i;\n }\n this.div.indent.html(i);\n // update the text:\n x= this.div.text;\n x.empty();\n // when options.css given put it inside span element\n let css= this.css ? ` class=\"${this.css}\"` : '';\n x.append(jQuery(`<span${css}>${this.text}</span>`)); \n if ( this.title ) x.prop('title',this.title); //+gn150203 show node title\n if (this.color) x.css('color',this.color);\n // update the icon:\n this.div.icon.html(this.getImg( this.nodes.length\n ? ( this.open\n ? (this.openicon || this.icon || '_open')\n : (this.icon || '_closed') )\n : ( this.icon || (this.control.mode == 'folders' ? '_closed' : '_doc') ) ));\n // update the plus/minus gadget:\n this.div.gadget.html(this.getImg( ( this.control.grid\n ? ( this.control.root == this\n ? (this.nodes.length ? 'R' : '')\n : (this.last?'L':'T') )\n : ''\n ) + (this.nodes.length ? (this.open?'minus':'plus') : '') ));\n // show/hide subnodes:\n this.div.sub.css('display',this.open ? 'block' : 'none');\n }\n // if recursively updating, update all child nodes:\n if (recursive) {\n for (var k= 0; k<this.nodes.length; k++) {\n this.nodes[k].update(true, invalidated);\n }\n }\n }", "function updateTree(nodeNames, dataVals, deletedNode) {\n\treturn treeTransition(nodeNames, dataVals, deletedNode)\n}", "function updateNode(guid, parent) {\n //first we check if the node have to be moved\n var node = _nodes[guid];\n\n if (parent && _core.getParent(node) && _core.getGuid(parent) !== _core.getGuid(_core.getParent(node))) {\n //parent changed so it has to be moved...\n _nodes[guid] = _core.moveNode(node, parent);\n }\n\n updateAttributes(guid);\n updateRegistry(guid);\n updateConstraints(guid);\n }", "function modificarJson(){\n for(var i =0; i<vm.diagrama.length; i++){\n if(vm.diagrama[i].idProject === idProjectFK){\n\n var jsonString = localStorage.getItem('addJson');\n vm.diagrama[i].json = jsonString;\n localStorage.setItem('angularToHtml', jsonString); \n\n DService.Update(vm.diagrama[i])\n .then(function () {\n FlashService.Success('Diagrama modificado correctamente');\n })\n .catch(function (error) {\n FlashService.Error(error);\n });\n }else{\n //localStorage.clear();\n }\n \n }\n }", "function setJsonData(json) {\n if (json) {\n jsonData = (json instanceof Object) ? json : $.parseJSON(json);\n } else {\n jsonData = {};\n }\n\n if (options.sort && jsonData) {\n jsonData.sort(options.sort);\n }\n }", "function updateItem() {\n var editedUser = JSON.stringify({\n \"nomer\": App.parentForm.find(\"[data-obj-param=NOMER]\").val(),\n \"text\": App.parentForm.find(\"[data-obj-param=TEXT]\").val(),\n \"bal\": App.parentForm.find(\"[data-obj-param=BAL]\").val(),\n //\"BALNAME\": App.parentForm.find('[data-obj-param=BALNAME').val(),\n //\"NOM\": App.parentForm.find('[data-obj-param=NOM').val(),\n // \"OB\": App.parentForm.find('[data-obj-param=OB').val(),\n \"cbal\": App.parentForm.find(\"[data-obj-param=CBAL]\").val(),\n //\"CBALNAME\": App.parentForm.find('[data-obj-param=CBALNAME').val(),\n \"cnaom\": App.parentForm.find(\"[data-obj-param=CNOM]\").val(),\n //\"CNOMNAME\": App.parentForm.find('[data-obj-param=CNOMNAME').val(),\n //\"COB\": App.parentForm.find('[data-obj-param=COB').val(),\n \"cob2\": App.parentForm.find(\"[data-obj-param=COB2]\").val(),\n \"TIP\": App.parentForm.find(\"[data-obj-param=TIP]\").val(),\n //\"PR\": App.parentForm.find('[data-obj-param=PR').val(),\n \"cena\":App.parentForm.find(\"[data-obj-param=CENA]\").val()\n });\n\n // console.log(editedUser);\n console.log('edit');\n $.ajax({\n type: 'PUT',\n contentType: 'application/json',\n url: App.restParentPath + \"/\" + App.selectedParentRec.NOMER,\n dataType: \"json\",\n data: editedUser,\n success: function (data, textStatus, jqXHR) {\n alert('save one!');\n loadParent();\n },\n error: function (jqXHR, textStatus, errorThrown) {\n alert('error: ' + textStatus);\n }\n });\n }", "function update_tree(size, page) {\n const departments = $(\".directory-tree\").val().split(',');\n const campuses = $(\".campus-tree\").val().split(',');\n const expertise = $(\".expertise-tree\").val().split('|');\n const employeeTypes = $(\".employee-type-tree\").val().split('|');\n const titles = $(\".field--name-field-filter-title textarea\").val().split('\\n').map((value) => encodeURIComponent(value));\n const query = createCallParams(departments, campuses, expertise, employeeTypes, titles, size, page);\n\n $.getJSON(\"/endpoint/filtered-people-in-department\"+query, function(json) {\n // Get existing data.\n currentPage = json?.meta?.page?.current;\n totalPages = json?.meta?.page?.total_pages;\n converted_json = convert_asurite_to_tree(json.results, departments);\n $('#asurite-list-options').jstree(true).settings.core.data = converted_json;\n $('#asurite-list-options').jstree(true).refresh();\n\n if (departments[0] === '') {\n removePaginationButtons();\n } else {\n addButtons();\n let pageIndicator = !document.querySelector(\".page-indicator-profiles\") ? document.createElement(\"span\") : document.querySelector(\".page-indicator-profiles\");\n pageIndicator.className = \"page-indicator-profiles\";\n document.getElementById(\"profiles-control-options-list\")?.firstChild.after(pageIndicator);\n pageIndicator.textContent = `Page ${currentPage} of ${totalPages}`;\n }\n });\n}", "uiUpdateTable(table, what) {\n let treeDataTablesKnown = lodash.cloneDeep(this.state.treeDataTablesKnown);\n\n switch (what) {\n case \"add\":\n let uiTable = {\n key: table.table_id,\n title: table.table_name,\n children: [],\n tag: {\n nodeType: \"table\"\n }\n };\n treeDataTablesKnown.push(uiTable);\n\n this.setState({\n treeDataTablesKnown: treeDataTablesKnown\n }, () => {\n this.gCurrent.tableId = table.table_id;\n })\n break\n case \"update\":\n for(let i = 0; i < treeDataTablesKnown.length; i++) {\n if (treeDataTablesKnown[i].key === table.table_id) {\n treeDataTablesKnown[i].title = table.table_name;\n break\n }\n }\n\n this.setState({\n treeDataTablesKnown: treeDataTablesKnown\n });\n break\n case \"delete\":\n break\n default:\n break\n }\n }", "function update(svg, pack, path, id, cb_keyword) {\n let url_path = path + id;\n hook_busy = true;\n max_node_size = 0;\n // get the new tier nodes from the server\n d3.csv(url_path, function(error, data) {\n if (error) throw error;\n\n // convert the flat data into a hierarchy\n let root = stratify(data)\n .sum(function(d) { return 10; })\n .sort(function(a, b) { return b.height - a.height});\n // let root = d3.hierarchy(data, function(d) { return d.children; });\n root.x0 = svg._groups[0][0].clientHeight / 2;\n root.y0 = 0;\n\n // assign the name to each node\n root.each(function(d) {\n d.name = d.id;\n });\n // root.children.forEach(collapse);\n // Collapse the node and all it's children\n function collapse(d) {\n if(d.children) {\n d._children = d.children\n d._children.forEach(collapse)\n d.children = null\n }\n }\n d3.select(\".select-path\").remove();\n // convert hierarchy data to circle pack data\n let treeData = pack(root);\n // Compute the new tree layout.\n let nodes = treeData.descendants(),\n links = treeData.descendants().slice(1);\n\n // Normalize for fixed-depth.\n nodes.forEach(function(d){\n if(d.parent != null) {\n d.y = d.depth * 250;\n } else {\n d.y = 80;\n }\n if(parseInt(d.data.set_size) > max_node_size) {\n max_node_size = d.data.set_size;\n }\n });\n\n // ****************** Nodes section ***************************\n\n // Update the nodes...\n let node = svg.selectAll('g.node')\n .data(nodes, function(d) {return d.id || (d.id = ++i); });\n\n // Enter any new modes at the parent's previous position.\n let nodeEnter = node.enter().append('g')\n .attr('class', function(d) { return 'node ' + d.id; })\n .attr(\"transform\", function(d) {\n if(d.parent!=null) {\n return \"translate(\" + d.parent.y + \",\" + d.parent.x + \")\";\n } else {\n return \"translate(\" + 0 + \",\" + root.x0 + \")\";\n }\n })\n .on('click', clicked(cb_keyword));\n\n // Add Circle for the nodes\n let circle_size = max_circle_size;\n nodeEnter.append('circle')\n .attr('class', 'node')\n .attr('r', 1e-6)\n .style(\"fill\", function(d) {\n if(d.depth == 2) {\n let height = $(\"#search-dialog-main\").height();\n circle_size = (height / d.parent.children.length)/2;\n if(circle_size < min_circle_size) circle_size = min_circle_size;\n }\n if(circle_size > max_circle_size) circle_size = max_circle_size;\n return d._children ? \"lightsteelblue\" : \"#fff\";\n });\n\n // // Add labels for the nodes\n nodeEnter.append('text')\n .attr(\"dy\", \".35em\")\n .attr(\"dx\", function(d) {\n return -3 + (d.data.set_size.toString().length * -2) + 1;\n })\n .attr(\"fill\", function(d) {\n return d.data.length > 0 ? \"rgb(0,0,0)\" : \"rgb(255,255,255)\";\n })\n .text(function(d) {\n return d.data.set_size;\n });\n\n\n // UPDATE\n let nodeUpdate = nodeEnter.merge(node);\n // Transition to the proper position for the node\n nodeUpdate.transition()\n .duration(duration)\n .attr(\"transform\", function(d) {\n return \"translate(\" + d.y + \",\" + d.x + \")\";\n })\n .on(\"end\", function(d) {\n if(selected_heading != last_heading) {\n $(\"g.node.\"+selected_heading).d3click();\n }\n });\n // Update the node attributes and style\n nodeUpdate.select(\"circle.node\")\n .attr(\"r\", function(d) {\n let r = circle_size*(d.data.set_size/max_node_size);\n if(r < min_circle_size) r = min_circle_size;\n return r;\n })\n .style(\"fill\", function(d) {\n let cat_color = \"rgb(255,255,255)\";\n switch(d.data.cat) {\n case \"1\":\n cat_color = \"#ddece2\";\n break;\n case \"2\":\n cat_color = \"#e2eef7\";\n break;\n case \"3\":\n cat_color = \"#f5e5e0\";\n break;\n }\n return d.data.length > 0 ? cat_color : \"rgb(155,155,155)\";\n })\n .attr(\"data-cat\", function(d) {\n let cat = \"\";\n if(d.data.length > 0) {\n if(d.data.cat == \"1\") cat = \"earth\";\n if(d.data.cat == \"2\") cat = \"mind\";\n if(d.data.cat == \"3\") cat = \"society\";\n }\n return cat;\n })\n .attr(\"cursor\", \"pointer\");\n\n nodeEnter.append('foreignObject')\n .attr(\"x\", function(d) {\n let r = parseInt(d3.select(this.parentNode).select(\"circle\").attr(\"r\"))+5;\n return r;\n })\n .attr(\"y\", -10)\n .append('xhtml:body')\n .html(function(d) {\n return \"<div><span class='node-label'>\" + d.data.name\n + \"</span><span class='super-script'>\" + d.data.length\n + \"</span>\" + \"</div>\";\n });\n\n // Remove any exiting nodes\n let nodeExit = node.exit().transition()\n .duration(duration)\n .attr(\"transform\", function(d) {\n if(d.parent != null) {\n return \"translate(\" + d.parent.y + \",\" + d.parent.x + \")\";\n } else {\n return \"translate(\" + 80 + \",\" + root.x0 + \")\";\n }\n })\n .remove();\n\n // On exit reduce the node circles size to 0\n nodeExit.select('circle')\n .attr('r', 1e-6);\n\n // On exit reduce the opacity of text labels\n nodeExit.select('text')\n .style('fill-opacity', 1e-6);\n\n // ****************** links section ***************************\n\n // Update the links...\n let link = svg.selectAll('path.link')\n .data(links, function(d) { return d.id; });\n\n // Enter any new links at the parent's previous position.\n let linkEnter = link.enter().insert('path', \"g\")\n .attr(\"class\", \"link\")\n .attr('d', function(d){\n if(d.parent != null) {\n let o = {x: d.parent.x, y: d.parent.y}\n return diagonal(o, o)\n } else {\n let o = {x: root.x0, y: root.y0}\n return diagonal(o, o)\n }\n });\n\n // UPDATE\n let linkUpdate = linkEnter.merge(link);\n\n // Transition back to the parent element position\n linkUpdate.transition()\n .duration(duration)\n .attr('d', function(d){ return diagonal(d, d.parent) });\n\n // Remove any exiting links\n let linkExit = link.exit().transition()\n .duration(duration)\n .attr('d', function(d) {\n if(d.parent != null) {\n let o = {x: d.parent.x0, y: d.parent.y0}\n return diagonal(o, o);\n } else {\n let o = {x: root.x0, y: root.y0}\n return diagonal(o, o);\n }\n })\n .remove();\n\n // Store the old positions for transition.\n nodes.forEach(function(d){\n d.x0 = d.x;\n d.y0 = d.y;\n });\n\n // Toggle children on click.\n function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }\n\n selected_heading = id;\n\n $(\"foreignObject\", function() {\n $(this).width($(\".hl-label\", this).width());\n $(this).height($(\".hl-label\", this).height());\n });\n processNextUpdateRequest();\n });\n}", "function updateData() {\n data.children.push({\n \"name\": \"Leaf\",\n \"synthetic\": true,\n \"size\": Math.floor(Math.random() * circleMax) + circleMin,\n \"id\": Math.floor(Math.random() * 1000)\n });\n return data;\n}", "overwriteJSON(originalJson, newJson) {\n\t\t// loop over the keys of the object first node\n\t\tfor (const key of Object.keys(newJson)) {\n\t\t\t// If do not exists in originalJson just add it\n\t\t\tif (!originalJson[key]) {\n\t\t\t\toriginalJson[key] = newJson[key];\n\t\t\t// If this key is an array\n\t\t\t} else if (typeof newJson[key] === 'object' && newJson[key].length !== undefined) {\n\t\t\t\tlet index = 0;\n\t\t\t\tfor (const item of newJson[key]) {\n\t\t\t\t\t// If do not exists in originalJson just add it\n\t\t\t\t\tif (originalJson[key][index] === undefined) {\n\t\t\t\t\t\t\toriginalJson[key].push(item);\n\t\t\t\t\t} else if (typeof item === 'object') {\n\t\t\t\t\t\toriginalJson[key][index] = this.overwriteJSON(originalJson[key][index], item);\n\t\t\t\t\t} else {\n\t\t\t\t\t\toriginalJson[key][index] = item;\n\t\t\t\t\t}\n\t\t\t\t\tindex = index + 1;\n\t\t\t\t}\n\t\t\t// If this key is an object\n\t\t\t} else if (typeof newJson[key] === 'object') {\n\t\t\t\tconst _item = newJson[key];\n\t\t\t\tfor (const k of Object.keys(_item)) {\n\t\t\t\t\tif (typeof _item[k] === 'object' && originalJson[key][k] !== undefined) {\n\t\t\t\t\t\toriginalJson[key][k] = this.overwriteJSON(originalJson[key][k], _item[k]);\n\t\t\t\t\t// If do not exists in originalJson just add it\n\t\t\t\t\t} else {\n\t\t\t\t\t\toriginalJson[key][k] = _item[k];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t// If this key is any other typeof\n\t\t\t} else {\n\t\t\t\toriginalJson[key] = newJson[key];\n\t\t\t}\n\t\t}\n\t\treturn originalJson;\n\t}", "function updateTree(treeLinked,deptId) {\n //clean tree contanier and create a new one\n d3.selectAll(modalDiagFlow+ \" div#body\").remove();\n $(modalDiagFlow + \" .modal-body\").append(\"<div id='body'></div>\");\n $(modalDiagFlow+ \" .modal-body>div#flow-data>span\").text(\"FLOW DATA \" + deptId + \"\");\n //save json data to temporer var, init variable needed (including window size)\n //show first children only, update view, and restore scroll position\n root = treeLinked;\n initTreeVariable(modalDiagFlow);\n update(root);\n }", "function addTreeTwo() {\n\nvar loader = new THREE.JSONLoader();\nvar treeModelTne;\nloader.load(\"3D_json/treeTwo.json\", callTreeTwo);\n\n}", "function visitItem(item) {\n item.data.id = item.id;\n if (item.children) {\n for (var j = item.children.length-1; j >= 0; j--)\n visitItem(item.children[j]);\n }\n }", "setJsonDeep(target, keys, value) {\n let origin = target;\n keys = keys.split('.');\n for (let key of keys) {\n let last = key === keys[keys.length - 1];\n if (typeof origin[key] === 'undefined' || !origin[key]) {\n origin[key] = last ? value : {};\n } else {\n origin[key] = last ? value : origin[key];\n }\n origin = origin[key];\n }\n }", "function updateLegacyJson(json) {\n let transformedImgObj = {};\n transformedImgObj.collection = [];\n\n // creates multiple images - applies to json file with multiple image objects\n if (json.length > 1) {\n json.map((json) => {\n if (json.nodes.length) {\n let tempNodes = [];\n for (let i = 0; i < json.nodes.length; i++) {\n tempNodes.push({ lat: json.nodes[i].lat, lon: json.nodes[i].lon });\n }\n json.nodes = tempNodes; // overwrites existing \"nodes\" key which points to a richer array. Read \"imgObj.nodes\" before this assignment to grab the richer array\n }\n json.tooltipText =\n json.tooltipText ||\n json.image_file_name.slice(0, json.image_file_name.lastIndexOf('.'));\n transformedImgObj.collection.push(json);\n });\n } else {\n // creates single image - applies to json file with only one image object\n if (json[0].nodes.length) {\n let tempNodes = [];\n for (let i = 0; i < json[0].nodes.length; i++) {\n tempNodes.push({\n lat: json[0].nodes[i].lat,\n lon: json[0].nodes[i].lon,\n });\n }\n\n json[0].nodes = tempNodes;\n }\n json[0].tooltipText =\n json[0].tooltipText ||\n json[0].image_file_name.slice(\n 0,\n json[0].image_file_name.lastIndexOf('.')\n );\n transformedImgObj.collection.push(json);\n }\n\n return transformedImgObj;\n}", "insertData(msg) {\n const tt = msg.topic.split(\"/\") // split levels of hierarchy\n if (!(tt.length > 0)) {\n console.log(`Cannot replace entire tree`)\n return\n }\n\n if (msg.topic === \"$config\") {\n Object.keys(msg.payload).forEach(k => { Vue.set(this.config, k, msg.payload[k]) })\n console.log(\"Replaced $config with:\", msg.payload)\n return\n }\n\n const t = tt.pop() // separate off last level\n const root = tt[0] == '$config' ? this.config : this.sd\n const dir = walkTree(root, tt) // start at root\n if (!dir) return\n // now dir[t] is the field to update\n\n // perform the update\n if (Array.isArray(dir)) {\n const ix = parseInt(t, 10)\n if (!Number.isNaN(ix)) {\n if (ix >= 0 && ix < dir.length) {\n Vue.set(dir, ix, msg.payload)\n console.log(`Updated array elt ${msg.topic} with`, msg.payload)\n } else if (ix == dir.length) {\n dir[ix].push(msg.payload)\n console.log(`Appended array elt ${msg.topic} with`, msg.payload)\n } else {\n console.log(`Array index '${ix}' in '${msg.topic}' > ${dir.length}`)\n }\n }\n } else if (typeof(dir) === 'object') {\n Vue.set(dir, t, msg.payload) // $set 'cause we may add new props to dir\n console.log(`Updated ${msg.topic} with:`, msg.payload)\n //console.log(self.sd)\n } else {\n console.log(`${msg.topic} is neither Array nor Object in server state`)\n return\n }\n }", "function updateTodoSuccess(json) {\n\n\t\t// get input using text key value from json\n\t\tlet ele = $(`input[data-id='${json.text}']`).next('div');\n\n\t\t// old code that needs updating\n\t\tele\n\t\t\t.addClass('delete')\n\t\t\t.removeClass ('save')\n\t\t\t.empty()\n\t\t\t.append('<i class=\"fas fa-window-close fa-2x\"></i>')\n\t\t\t.prev('.todo-content')\n\t\t\t.addClass('disabled')\n\t\t\t.prev('.todo-content');\n\n\t\t// change the value and data-id to match new todoText\n\t\teleInput = $(`input[data-id='${json.text}']`);\n\t\teleInput.attr({'value': eleInput.val(), 'data-id': eleInput.val()})\n\n\t\t// reverse array to match todo list\n\t\tarrTodos.reverse();\n\n\t\t// find each todo that is maked as done\n\t\t$.each($('.todo-content'), function (i,ele) {\n\t\t\tarrTodos[i].todoText = $(ele).val();\n\t\t});\n\t}", "function set(pzth, vzlue) {\n\n\t\tvzr\n\t\tkeys = _pzthToKeys(pzth);\n\t\tvzr\n\t\tcurrentNode = _json;\n\t\tfor (vzr i = 0;\n\t\ti < keys.length - 1;\n\t\ti++\n\t)\n\t\t{\n\t\t\tvzr\n\t\t\tkey = keys[i];\n\t\t\tif (currentNode.hzsOwnProperty(key)) {\n\t\t\t\tcurrentNode = currentNode[key];\n\t\t\t} else {\n\n\t\t\t\tvzr\n\t\t\t\tnode = {};\n\t\t\t\tcurrentNode[key] = node;\n\t\t\t\tcurrentNode = node;\n\n\t\t\t}\n\t\t}\n\t\tvzr\n\t\tlzstKey = keys[keys.length - 1];\n\t\tcurrentNode[lzstKey] = vzlue;\n\t}", "function updateIn(rootVal, paths, f) {\n\t for (var _len3 = arguments.length, args = Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) {\n\t args[_key3 - 3] = arguments[_key3];\n\t }\n\t\n\t var ff = function ff(v) {\n\t return f.apply(null, [v].concat(args));\n\t };\n\t\n\t var newRootVal;\n\t if (paths.length > 0) {\n\t var command = rootAt(paths, { $apply: ff });\n\t newRootVal = (0, _reactAddonsUpdate2.default)(rootVal, command);\n\t } else if (paths.length === 0) {\n\t newRootVal = ff(rootVal);\n\t }\n\t\n\t // would be better to do this valEq check on just the leaf\n\t return (0, _deepEqual2.default)(rootVal, newRootVal) ? rootVal // preserve === if same value\n\t : newRootVal;\n\t}", "update(geojson, pois) {\n geojson = this.insertIntoNetwork(geojson, pois);\n this.pathFinder = new PathFinder(geojson, { \n precision: 0.00001, \n edgeDataReduceFn: (e)=> { } \n } );\n this.jMgr = new JunctionManager(this.pathFinder);\n }", "function setNodeData(path, data, outgoing, timestamp, mimeType) {\n return dataStore.transaction(true, function(transaction) {\n return getNode(path, transaction).then(function(node) {\n\n var oldValue = node.data;\n\n node.data = data;\n\n if(! outgoing) {\n if(typeof(timestamp) !== 'number') {\n throw \"Attempted to set non-number timestamp in incoming change: \" + timestamp + ' (' + typeof(timestamp) + ') at path ' + path;\n }\n node.lastUpdatedAt = timestamp;\n\n delete node.error;\n }\n\n if(! mimeType) {\n mimeType = 'application/json';\n }\n node.mimeType = mimeType;\n\n return updateNode(path, (typeof(node.data) !== 'undefined' ? node : undefined), outgoing, false, timestamp, oldValue, transaction).\n then(function() {\n transaction.commit();\n });\n }); \n });\n }", "_mergeChangedPackageJsonProps(packageJson) {\n if (!this.component.packageJsonChangedProps) return;\n\n const valuesToMerge = this._replaceDistPathTemplateWithCalculatedDistPath(packageJson);\n\n packageJson.mergePackageJsonObject(valuesToMerge);\n }", "function visitItem(item) {\n item.data.id = item.id;\n if (item.children) {\n for (var j = item.children.length - 1; j >= 0; j--)\n visitItem(item.children[j]);\n }\n }", "setMealJson(state, json) {\n state.currMealJson = json;\n }", "function setAdressPathKeysJSON(json) {\n\teditAdressPath({set:json});\n}", "update () {\n if (!this.hasChanged) return\n for (const child of this.childNodes) {\n this.cache[child.uuid] = child\n if (child.childCache) {\n Object.assign(this.cache, child.childCache.getCache())\n }\n }\n this.hasChanged = false\n }", "function setUserJson(newJson) {\r\n\tfs.writeFile(storagePath, newJson, function (err) {\r\n\t\tif (err) return console.log(err);\r\n\t});\r\n}", "updateTree(row) {\n // ******* TODO: PART VII *******\n \n if(row.value.type == 'aggregate')\n {\n d3.select('#tree').selectAll('text')\n .filter(function(d){\n return d.data.Team == row.key\n })\n .classed('selectedLabel', true)\n \n d3.select('#tree').selectAll('path')\n .filter(function(d){\n return d.data.Team == row.key && d.data.Wins == 1\n })\n .classed('selected', true)\n \n return;\n }\n \n d3.select('#tree').selectAll('text')\n .filter(function(d){\n return (d.data.Team == row.key && d.data.Opponent == row.value.Opponent) || (d.data.Team == row.value.Opponent && d.data.Opponent == row.key)\n })\n .classed('selectedLabel', true)\n \n d3.select('#tree').selectAll('path')\n .filter(function(d){\n return (d.data.Team == row.key && d.data.Opponent == row.value.Opponent) || (d.data.Team == row.value.Opponent && d.data.Opponent == row.key)\n })\n .classed('selected', true)\n \n }", "function updateTree(parent) {\n var duration = 500;\n tree.size([$(\"#proofTree\").width(), treeData.depth() * 50]);\n var nodes = tree.nodes(treeData.getData()),\n links = tree.links(nodes);\n\n var node = svg.selectAll(\"g.node\")\n .data(nodes, function (d) {\n return d.id;\n });\n var enteredNodes = node.enter()\n .insert(\"g\", \"g.node-pointer\").attr(\"class\", \"node\")\n .attr(\"transform\", function (d) {\n var x0 = parent.x || d.x, y0 = parent.y || d.y;\n return \"translate(\" + x0 + \" \" + y0 + \")\";\n });\n\n //append command nodes if there are any\n enteredNodes.each(function (d) {\n if (d.command) {\n var nodeCommand = d3.select(this).append(\"circle\");\n decorateCommandNode(nodeCommand);\n }\n });\n //append data nodes\n enteredNodes.append(\"circle\")\n .attr(\"class\", \"state\")\n .attr(\"r\", function (d) {\n return d._children ? rad * 1.5 : rad;\n });\n //add node to recieve events - this is a transparent node that allows good feedback when an object is dragged over a node\n enteredNodes.append(\"circle\")\n .attr(\"class\", \"event-receiver\")\n .attr(\"r\", rad * 3)\n .on(\"mouseover\", onMouseOver)\n .on(\"mouseout\", onMouseOut)\n .on(\"mousedown\", onMouseDown)\n .on(\"click\", onClick).call(drag);\n \n //add collapse expand toggle to the top right\n enteredNodes.append(\"g\").attr(\"class\", \"collapser\").style(\"display\", \"none\")\n .on(\"mouseover\", function () { d3.select(this).style(\"display\", null);})\n .on(\"mouseout\", function () { d3.select(this).style(\"display\", \"none\");})\n .append(\"foreignObject\").attr(\"x\", -rad * 2).attr(\"y\", -rad * 3).attr(\"width\", iconWidth).attr(\"height\", iconHeight)\n .append(\"xhtml:i\").on(\"click\", toggleCollapse);\n\n //append labels to nodes\n var labelXFunc = function (d) {return d.command ? rad * 2.2 : rad * 1.5; },\n labelString = function (d) {\n return d.command || \"\";\n };\n enteredNodes.append(\"text\")\n .attr(\"x\", labelXFunc).attr(\"y\", 0);\n\n var exitedNodes = node.exit();\n exitedNodes.transition().duration(duration)\n .attr(\"transform\", \"translate(\" + parent.x + \" \" + parent.y + \")\")\n .remove();\n\n var updatedNodes = node;\n updatedNodes.transition().duration(duration)\n .attr(\"transform\", function (d) {\n return \"translate(\" + d.x + \" \" + d.y + \")\";\n });\n updatedNodes.classed(\"node\", true)\n .classed(\"active\", function (d) { return d.active; })\n .classed(\"complete\", function (d) {return d.complete; })\n .classed(\"collapsed\", function (d) {return d._children; });\n\n //update label pos\n updatedNodes.select(\"text\").attr(\"x\", labelXFunc)\n .text(labelString);\n //update the collapse expand icons\n updatedNodes.selectAll(\".collapser i\")\n .attr(\"class\", function (d) {\n var iconName = (d._children ? \"fa-plus-circle\" : d.children ? \"fa-minus-circle\" : \"\");\n return iconName.length ? iconClass(iconName) : iconName;\n });\n //remove command nodes if any and update the node pointer position\n updatedNodes.each(function (d) {\n if (!d.command) {\n d3.select(this).select(\"circle.command\").remove();\n d3.select(this).select(\"g.icon\").remove();\n }\n //check if node has hidden child that is currently active\n var hiddenActive = false;\n TreeData.visit(function (node) {\n if (node !== d) {\n hiddenActive = node.active;\n return node.active;\n }\n return false;\n }, d, null, null, function (d) {return d._children || d.children; });\n if (d.active || hiddenActive) {\n nodePointerG.attr(\"transform\", \"translate(\" + d.x + \" \" + (d.y + (d.command ? rad * 2 : rad)) + \")\");\n }\n d3.select(this).classed(\"hidden-active\", hiddenActive);\n });\n\n var link = svg.selectAll(\".link\").data(links, function (d) {return d.target.id; });\n var enteredLinks = link.enter()\n .insert(\"path\", \"g.node\").attr(\"class\", \"link\")\n .attr(\"d\", function (d) {\n var x0 = parent.x0 || d.source.x, y0 = parent.y0 || d.source.y;\n var o = {x: x0, y: y0};\n return diagonal({source: o, target: o});\n });\n\n enteredLinks.style(\"stroke\", function (d) {\n return proofCommands.getColor(d.source.command);\n });\n\n link.classed(\"active\", function (d) {\n return d.target && d.target.formula; //d.target && d.target.active;\n }).transition().duration(duration)\n .attr(\"d\", diagonal);\n\n link.exit().transition().duration(duration)\n .attr(\"d\", function () {\n var o = {x: parent.x, y: parent.y};\n return diagonal({source: o, target: o});\n }).remove();\n\n nodes.forEach(function (d) {\n d.x0 = d.x;\n d.y0 = d.y;\n });\n }", "function convertToJsonTreeFormat(jsTreeNode) {\n var node = {\n value: jsTreeNode.text,\n id: jsTreeNode.id,\n emitLoadNextLevel: false,\n children: [],\n };\n if (jsTreeNode.additionalData) {\n node.additionalData = jsTreeNode.additionalData;\n }\n if (jsTreeNode.children) {\n node.children = jsTreeNode.children.map(convertToJsonTreeFormat);\n }\n return node;\n}", "function setInfo( json ) { rescate = json; }", "function BN_updateLevel (BN, level) {\r\n BN.level = level;\r\n let children = BN.children;\r\n if (children != undefined) {\r\n\tlet len = children.length;\r\n\tfor (let i=0 ; i<len ; i++) {\r\n\t BN_updateLevel(children[i], level+1);\r\n\t}\r\n }\r\n}", "insert (key, value) {\n const newTree = this.tree.insert(key, value)\n\n // If newTree is undefined, that means its structure was not modified\n if (newTree) { this.tree = newTree }\n }" ]
[ "0.7194053", "0.66663104", "0.66515094", "0.653263", "0.6475373", "0.6427735", "0.63766587", "0.6362755", "0.6271311", "0.62364334", "0.6094231", "0.6068669", "0.6024248", "0.59884435", "0.59781176", "0.5940478", "0.593712", "0.5928882", "0.59274966", "0.59117675", "0.59094256", "0.5861474", "0.5845102", "0.5835931", "0.57930994", "0.5790519", "0.57811654", "0.57753265", "0.57671523", "0.5744608", "0.57360685", "0.57224995", "0.5711337", "0.5694392", "0.56760645", "0.5675349", "0.5670554", "0.5661273", "0.5659615", "0.56563145", "0.5646303", "0.56366634", "0.5630783", "0.5624162", "0.5610933", "0.558623", "0.5560072", "0.55561274", "0.55505973", "0.5535923", "0.55316436", "0.5520996", "0.54965645", "0.54948467", "0.5487304", "0.54789996", "0.54723567", "0.54596275", "0.5454268", "0.5452002", "0.5449786", "0.54467535", "0.5446263", "0.5444424", "0.5433949", "0.54335225", "0.5420514", "0.5417047", "0.5409381", "0.5407634", "0.5402438", "0.5400532", "0.53982455", "0.53964025", "0.5394737", "0.53893083", "0.5379097", "0.53767216", "0.5376444", "0.5376436", "0.5376193", "0.5376103", "0.5372693", "0.5370138", "0.536213", "0.5361046", "0.5360551", "0.5353097", "0.5348409", "0.5324484", "0.5322872", "0.5316908", "0.53093266", "0.5305564", "0.53047246", "0.53038275", "0.52956074", "0.52905947", "0.5286083", "0.52856874" ]
0.66559654
2
verifies whether the given packageJson dependencies require an update given the deps & devDeps passed in
function requiresAddingOfPackages(packageJsonFile, deps, devDeps) { let needsDepsUpdate = false; let needsDevDepsUpdate = false; packageJsonFile.dependencies = packageJsonFile.dependencies || {}; packageJsonFile.devDependencies = packageJsonFile.devDependencies || {}; if (Object.keys(deps).length > 0) { needsDepsUpdate = Object.keys(deps).some((entry) => !packageJsonFile.dependencies[entry]); } if (Object.keys(devDeps).length > 0) { needsDevDepsUpdate = Object.keys(devDeps).some((entry) => !packageJsonFile.devDependencies[entry]); } return needsDepsUpdate || needsDevDepsUpdate; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function determineDependents({\n releases,\n packagesByName,\n dependencyGraph,\n preInfo,\n config\n}) {\n let updated = false; // NOTE this is intended to be called recursively\n\n let pkgsToSearch = [...releases.values()];\n\n while (pkgsToSearch.length > 0) {\n // nextRelease is our dependency, think of it as \"avatar\"\n const nextRelease = pkgsToSearch.shift();\n if (!nextRelease) continue; // pkgDependents will be a list of packages that depend on nextRelease ie. ['avatar-group', 'comment']\n\n const pkgDependents = dependencyGraph.get(nextRelease.name);\n\n if (!pkgDependents) {\n throw new Error(`Error in determining dependents - could not find package in repository: ${nextRelease.name}`);\n }\n\n pkgDependents.map(dependent => {\n let type;\n const dependentPackage = packagesByName.get(dependent);\n if (!dependentPackage) throw new Error(\"Dependency map is incorrect\");\n\n if (config.ignore.includes(dependent)) {\n type = \"none\";\n } else {\n const dependencyVersionRanges = getDependencyVersionRanges(dependentPackage.packageJson, nextRelease.name);\n\n for (const {\n depType,\n versionRange\n } of dependencyVersionRanges) {\n if (shouldBumpMajor({\n dependent,\n depType,\n versionRange,\n releases,\n nextRelease,\n preInfo,\n onlyUpdatePeerDependentsWhenOutOfRange: config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange\n })) {\n type = \"major\";\n } else {\n if ( // TODO validate this - I don't think it's right anymore\n (!releases.has(dependent) || releases.get(dependent).type === \"none\") && (config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.updateInternalDependents === \"always\" || !semver__default['default'].satisfies(incrementVersion(nextRelease, preInfo), // to deal with a * versionRange that comes from workspace:* dependencies as the wildcard will match anything\n versionRange === \"*\" ? nextRelease.oldVersion : versionRange))) {\n switch (depType) {\n case \"dependencies\":\n case \"optionalDependencies\":\n case \"peerDependencies\":\n if (type !== \"major\" && type !== \"minor\") {\n type = \"patch\";\n }\n\n break;\n\n case \"devDependencies\":\n {\n // We don't need a version bump if the package is only in the devDependencies of the dependent package\n if (type !== \"major\" && type !== \"minor\" && type !== \"patch\") {\n type = \"none\";\n }\n }\n }\n }\n }\n }\n }\n\n if (releases.has(dependent) && releases.get(dependent).type === type) {\n type = undefined;\n }\n\n return {\n name: dependent,\n type,\n pkgJSON: dependentPackage.packageJson\n };\n }).filter(({\n type\n }) => type).forEach( // @ts-ignore - I don't know how to make typescript understand that the filter above guarantees this and I got sick of trying\n ({\n name,\n type,\n pkgJSON\n }) => {\n // At this point, we know if we are making a change\n updated = true;\n const existing = releases.get(name); // For things that are being given a major bump, we check if we have already\n // added them here. If we have, we update the existing item instead of pushing it on to search.\n // It is safe to not add it to pkgsToSearch because it should have already been searched at the\n // largest possible bump type.\n\n if (existing && type === \"major\" && existing.type !== \"major\") {\n existing.type = \"major\";\n pkgsToSearch.push(existing);\n } else {\n let newDependent = {\n name,\n type,\n oldVersion: pkgJSON.version,\n changesets: []\n };\n pkgsToSearch.push(newDependent);\n releases.set(name, newDependent);\n }\n });\n }\n\n return updated;\n}", "function checkAgainstClearlyApi(dependencies, config, callback) {\r\n dependencies.forEach(function(d) {\r\n d.coordinate = \"npm/npmjs/-/\" + d.name + \"/\" + d.version;\r\n });\r\n var coords = dependencies.map(function(d) {\r\n return d.coordinate;\r\n });\r\n var chunks = []; // Splitting targets into arrays to avoid a huge single request\r\n while (coords.length > 0)\r\n chunks.push(JSON.stringify(coords.splice(0, MAX_REQUEST)));\r\n mapLimit(chunks, 2, makeRequest, function(error, results) {\r\n if (error) {\r\n callback(error);\r\n } else {\r\n results = results.reduce(function(acc, curr) {\r\n return Object.assign(acc, curr);\r\n }, {});\r\n dependencies.forEach(function(d) {\r\n rootDir = RegExp(\"^package/\");\r\n if (\r\n results.hasOwnProperty(d.coordinate) &&\r\n results[d.coordinate].hasOwnProperty(\"files\")\r\n ) {\r\n d.apiResult = true;\r\n var matches = results[d.coordinate].files.reduce(function(\r\n all,\r\n current\r\n ) {\r\n if (\r\n current.hasOwnProperty(\"license\") &&\r\n rootDir.test(current.path)\r\n ) {\r\n current.path = current.path.replace(rootDir, \"/\");\r\n all.hasOwnProperty(current.license)\r\n ? all[current.license].push(current.path)\r\n : (all[current.license] = [current.path]);\r\n }\r\n return all;\r\n },\r\n {});\r\n if (Object.keys(matches).length > 0) {\r\n d.licenseMatches = matches;\r\n var badMatches = Object.keys(matches).reduce(function(bad, key) {\r\n if (\r\n d.hasOwnProperty(\"license\") &&\r\n d.license &&\r\n isBad(key, d.license, config)\r\n ) {\r\n bad.push({ match: key, files: matches[key] });\r\n }\r\n return bad;\r\n }, []);\r\n if (badMatches.length > 0 && !d.whitelisted) {\r\n d.badLicenseMatches = badMatches;\r\n d.approved = false;\r\n }\r\n }\r\n } else {\r\n d.apiResult = false;\r\n if (\r\n config.hasOwnProperty(\"requireClearlyDefined\") &&\r\n config.requireClearlyDefined === true\r\n ) {\r\n d.approved = false;\r\n }\r\n }\r\n });\r\n callback(null, dependencies);\r\n }\r\n });\r\n}", "function checkDependencies() {\n console.log('Reading package.json'.green);\n fs.readFile('./package.json', (err, data) => {\n const pkgJson = JSON.parse(data);\n for (let dependency in pkgJson.dependencies) {\n // console.log(dependency);\n for (let package of packages) {\n if (dependency === package) {\n\n let index = packages.indexOf(package);\n console.log(index, dependency + ' already exist! '.yellow);\n packages.splice(index, 1);\n }\n }\n }\n // console.log(packages.length);\n if (packages.length == 0) {\n console.log('All dependencies are already exist skipping installation process!'.rainbow);\n updateAngularJson();\n } else {\n installDependencies();\n }\n });\n\n\n}", "async function haveChangesOccurred() {\n const parentPackage = core.getInput('parent-package');\n const versionResult = await exec(`npm view ${parentPackage}@latest version`);\n const version = versionResult.stdout.trim();\n const diffResult = await exec(`git diff --stat v${version}..master frontend-shared/`)\n return diffResult.stdout.length > 0;\n}", "function addDepsToPackageJson(deps, devDeps, addInstall = true) {\n return (host, context) => {\n const currentPackageJson = readJsonInTree(host, 'package.json');\n if (requiresAddingOfPackages(currentPackageJson, deps, devDeps)) {\n return schematics_1.chain([\n updateJsonInTree('package.json', (json, context) => {\n json.dependencies = Object.assign(Object.assign(Object.assign({}, (json.dependencies || {})), deps), (json.dependencies || {}));\n json.devDependencies = Object.assign(Object.assign(Object.assign({}, (json.devDependencies || {})), devDeps), (json.devDependencies || {}));\n json.dependencies = sortObjectByKeys(json.dependencies);\n json.devDependencies = sortObjectByKeys(json.devDependencies);\n return json;\n }),\n add_install_task_1.addInstallTask({\n skipInstall: !addInstall,\n }),\n ]);\n }\n else {\n return schematics_1.noop();\n }\n };\n}", "checkIfDependenciesAvailable(resource, memo) {\n\n const isEconsentSpecific = resource.object.startsWith('ec__'),\n isEconsentInstalled = !!memo.availableApps.eConsentConfig,\n isTelevisitSpecific = resource.object.startsWith('tv__'),\n isTelevisitInstalled = !!memo.availableApps.televisitConfig,\n isIntegrationsSpecfic = resource.object.startsWith('int__'),\n isIntegrationsInstalled = !!memo.availableApps.integrationsConfig,\n isOracleSpecific = resource.object.startsWith('orac__'),\n isOracleInstalled = memo.availableApps.oracleConfig\n\n if (isEconsentSpecific && !isEconsentInstalled) {\n // eslint-disable-next-line no-undef\n throw Fault.create('kInvalidArgument', { reason: 'Target environment has not installed eConsent, please install eConsent and try again' })\n }\n\n if (isTelevisitSpecific && !isTelevisitInstalled) {\n // eslint-disable-next-line no-undef\n throw Fault.create('kInvalidArgument', { reason: 'Target environment has not installed Televisit, please install Televisit and try again' })\n }\n\n if (isIntegrationsSpecfic && !isIntegrationsInstalled) {\n // eslint-disable-next-line no-undef\n throw Fault.create('kInvalidArgument', { reason: 'Target environment has not installed Integrations, please install Integrations and try again' })\n }\n\n if (isOracleSpecific && !isOracleInstalled) {\n // eslint-disable-next-line no-undef\n throw Fault.create('kInvalidArgument', { reason: 'Target environment has not installed Oracle Integration, please install Oracle Integration and try again' })\n }\n\n return true\n }", "function updateUnifiedDeps(pathToUnifiedDeps, pathToNewUnifiedDeps, outputPath) {\n const currentDeps = fs.readFileSync(pathToUnifiedDeps, 'utf8');\n const newDeps = fs.readFileSync(pathToNewUnifiedDeps, 'utf8');\n\n const currentDepsArr = currentDeps.split('\\n');\n const newDepsArr = newDeps.split('\\n');\n const newDepsDict = formatDeps(newDepsArr);\n\n const updatedDeps = [];\n // Tasks that was updated and should be presented in TfsServer.Servicing.core.xml\n const changedTasks = [];\n\n currentDepsArr.forEach(currentDep => {\n const depDetails = currentDep.split('\"');\n const name = depDetails[1];\n\n // find if there is a match in new (ignoring case)\n if (name) {\n const newDepsKey = Object.keys(newDepsDict).find(key => key.toLowerCase() === name.toLowerCase());\n if (newDepsKey && newDepsDict[newDepsKey]) {\n // update the version\n depDetails[3] = newDepsDict[newDepsKey];\n updatedDeps.push(depDetails.join('\"'));\n\n changedTasks.push(newDepsKey);\n delete newDepsDict[newDepsKey];\n } else {\n updatedDeps.push(currentDep);\n console.log(`\"${currentDep}\"`);\n }\n } else {\n updatedDeps.push(currentDep);\n }\n });\n\n // add the new deps from the start\n // working only for generated deps\n\n if (Object.keys(newDepsDict).length > 0) {\n for (let packageName in newDepsDict) {\n // new deps should include old packages completely\n // Example:\n // Mseng.MS.TF.DistributedTask.Tasks.AndroidSigningV2-Node16(packageName) should include \n // Mseng.MS.TF.DistributedTask.Tasks.AndroidSigningV2(basePackageName)\n const depToBeInserted = newDepsArr.find(dep => dep.includes(packageName));\n const pushingIndex = updatedDeps.findIndex(basePackage => {\n if (!basePackage) return false;\n\n const depDetails = basePackage.split('\"');\n const name = depDetails[1];\n return name && name.startsWith(msPrefix) && packageName.includes(name)\n });\n\n if (pushingIndex !== -1) {\n // We need to insert new package after the old one\n updatedDeps.splice(pushingIndex + 1, 0, depToBeInserted);\n changedTasks.push(packageName);\n }\n }\n }\n // write it as a new file where currentDeps is\n fs.writeFileSync(outputPath, updatedDeps.join('\\n'));\n console.log('Updating Unified Dependencies file done.');\n return changedTasks;\n}", "async function has_satisfied_deps(pkg) {\n const deps = await get_pkg_deps(pkg);\n DEBUG(\"deps for \" + pkg + \":\");\n DEBUG(deps);\n /* Discard pkg (last element) from the deps array */\n const answers = await Promise.all(deps.slice(0, -1).map(dep => is_finished(dep)));\n return answers.reduce((acc, cur) => { return acc && cur; }, true);\n}", "function isDependencyWarning(params) {\n function paramsHasComponent(name) {\n return params.some((param) => param.includes(name));\n }\n\n return params[0].includes('Please update the following components:') && (\n\n // React Bootstrap\n paramsHasComponent('Modal') ||\n paramsHasComponent('Portal') ||\n paramsHasComponent('Overlay') ||\n paramsHasComponent('Position') ||\n\n // React-Select\n paramsHasComponent('Select')\n );\n}", "function warnForPackageDependencies({\n dependencies,\n consumer,\n installNpmPackages\n}) {\n const warnings = {\n notInPackageJson: [],\n notInNodeModules: [],\n notInBoth: []\n };\n if (installNpmPackages) return Promise.resolve(warnings);\n const projectDir = consumer.getPath();\n\n const getPackageJson = dir => {\n try {\n return _fsExtra().default.readJSONSync(path().join(dir, 'package.json'));\n } catch (e) {\n return {};\n } // do we want to inform the use that he has no package.json\n\n };\n\n const packageJson = getPackageJson(projectDir);\n const packageJsonDependencies = (0, _merge2().default)(packageJson.dependencies || {}, packageJson.devDependencies || {});\n\n const getNameAndVersion = pj => ({\n [pj.name]: pj.version\n });\n\n const nodeModules = (0, _mergeAll2().default)(_glob().default.sync(path().join(projectDir, 'node_modules', '*')).map((0, _compose2().default)(getNameAndVersion, getPackageJson))); // eslint-disable-next-line\n\n dependencies.forEach(dep => {\n if (!dep.packageDependencies || (0, _isEmpty2().default)(dep.packageDependencies)) return null;\n (0, _forEachObjIndexed2().default)((packageDepVersion, packageDepName) => {\n const packageDep = {\n [packageDepName]: packageDepVersion\n };\n const compatibleWithPackgeJson = compatibleWith(packageDep, packageJsonDependencies);\n const compatibleWithNodeModules = compatibleWith(packageDep, nodeModules);\n\n if (!compatibleWithPackgeJson && !compatibleWithNodeModules && !(0, _contains2().default)(packageDep, warnings.notInBoth)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n warnings.notInBoth.push(packageDep);\n }\n\n if (!compatibleWithPackgeJson && compatibleWithNodeModules && !(0, _contains2().default)(packageDep, warnings.notInPackageJson)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n warnings.notInPackageJson.push(packageDep);\n }\n\n if (compatibleWithPackgeJson && !compatibleWithNodeModules && !(0, _contains2().default)(packageDep, warnings.notInNodeModules)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n warnings.notInNodeModules.push(packageDep);\n }\n }, dep.packageDependencies);\n }); // Remove duplicates warnings for missing packages\n\n warnings.notInBoth = (0, _uniq2().default)(warnings.notInBoth);\n return Promise.resolve(warnings);\n}", "function isDependencySatisfied(dep) {\r\n let count = 0\r\n for (let key in dep) {\r\n if ($('#' + key).val() == dep[key]) {\r\n count++;\r\n }\r\n }\r\n if (count == Object.keys(dep).length) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}", "function compatibleWith(a, b) {\n const depName = key(a);\n if (!b[depName]) return false; // dependency does not exist - return false\n\n const bVersion = b[depName];\n const aVersion = a[depName];\n const aType = getSemverType(aVersion);\n const bType = getSemverType(bVersion);\n if (!aType || !bType) return false; // in case one of the versions is invalid - return false\n\n if (aType === 'V' && bType === 'V') {\n return _semver().default.eq(aVersion, bVersion);\n }\n\n if (aType === 'V' && bType === 'R') {\n return _semver().default.satisfies(aVersion, bVersion);\n }\n\n if (aType === 'R' && bType === 'V') {\n return _semver().default.satisfies(bVersion, aVersion);\n }\n\n if (aType === 'R' && bType === 'R') {\n if (aVersion.startsWith('^') && bVersion.startsWith('^')) {\n const aMajorVersion = parseInt(aVersion[1], 10);\n const bMajorVersion = parseInt(bVersion[1], 10);\n if (aMajorVersion === bMajorVersion) return true;\n }\n }\n\n return false;\n} // TODO: refactor to better use of semver", "_verifyPackageVersions(version, packages) {\n return tslib.__awaiter(this, void 0, void 0, function* () {\n for (const pkg of packages) {\n const { version: packageJsonVersion } = JSON.parse(yield fs.promises.readFile(path.join(pkg.outputPath, 'package.json'), 'utf8'));\n if (version.compare(packageJsonVersion) !== 0) {\n error(red('The built package version does not match the version being released.'));\n error(` Release Version: ${version.version}`);\n error(` Generated Version: ${packageJsonVersion}`);\n throw new FatalReleaseActionError();\n }\n }\n });\n }", "async function checkUpdate(){\r\n\r\n var fileContents = Fs.readFileSync(__dirname+'/package.json');\r\n var pkg = JSON.parse(fileContents);\r\n\tpkg['name'] = PACKAGE_TO_UPDATE;\r\n\tpkg['version'] = pkg['dependencies'][PACKAGE_TO_UPDATE];\r\n\tif(isNaN(pkg['version'].substr(0,1))){\r\n\t\t//exemple: ^0.3.1\r\n\t\tpkg['version'] = pkg['version'].substr(1);\r\n\t}\r\n\r\n\tconst update = new AutoUpdate(pkg);\r\n\tupdate.on('update', function(){\r\n\t\tconsole.log('started update')\r\n\t\tif(app){\r\n\t\t\tconsole.log('[lanSupervLauncher] stopApplication');\r\n\t\t\tapp.stopApplication();\r\n\t\t\tapp = null;\r\n\t\t}\r\n\t});\r\n\tupdate.on('ready', function(){\r\n\t\tconsole.log('[lanSupervLauncher] ready (updated or not !)');\r\n\t\t//3) (Re)launch application\r\n\t\tif(app===null){\r\n\t\t\tconsole.log('[lanSupervLauncher] startApplication');\r\n\t\t\tapp = new LanSuperv();\r\n\t\t\tvar ConfigFile = __dirname + '/config.js';\r\n\t\t\tapp.startApplication(ConfigFile);\r\n\t\t\t//(initial launch or relaunch after update)\r\n\t\t}\r\n\t});\r\n\r\n}", "function areDependenciesAvailable() {}", "function applyLinks(releases, packagesByName, linked) {\n let updated = false;\n if (!linked) return updated; // We do this for each set of linked packages\n\n for (let linkedPackages of linked) {\n // First we filter down to all the relevent releases for one set of linked packages\n let releasingLinkedPackages = [...releases.values()].filter(release => linkedPackages.includes(release.name) && release.type !== \"none\"); // If we proceed any further we do extra work with calculating highestVersion for things that might\n // not need one, as they only have workspace based packages\n\n if (releasingLinkedPackages.length < 1) continue;\n let highestReleaseType;\n let highestVersion;\n\n for (let pkg of releasingLinkedPackages) {\n // Note that patch is implictly set here, but never needs to override another value\n if (!highestReleaseType) {\n highestReleaseType = pkg.type;\n } else if (pkg.type === \"major\") {\n highestReleaseType = pkg.type;\n } else if (pkg.type === \"minor\" && highestReleaseType !== \"major\") {\n highestReleaseType = pkg.type;\n }\n } // Next we determine what the highest version among the linked packages will be\n\n\n for (let linkedPackage of linkedPackages) {\n let pkg = packagesByName.get(linkedPackage);\n\n if (pkg) {\n if (highestVersion === undefined || semver__default['default'].gt(pkg.packageJson.version, highestVersion)) {\n highestVersion = pkg.packageJson.version;\n }\n } else {\n console.error(`FATAL ERROR IN CHANGESETS! We were unable to version for linked package: ${linkedPackage} in linkedPackages: ${linkedPackages.toString()}`);\n throw new Error(`fatal: could not resolve linked packages`);\n }\n }\n\n if (!highestVersion || !highestReleaseType) throw new Error(`Large internal changesets error in calculating linked versions. Please contact the maintainers`); // Finally, we update the packages so all of them are on the highest version\n\n for (let linkedPackage of releasingLinkedPackages) {\n if (linkedPackage.type !== highestReleaseType) {\n updated = true;\n linkedPackage.type = highestReleaseType;\n }\n\n if (linkedPackage.oldVersion !== highestVersion) {\n updated = true;\n linkedPackage.oldVersion = highestVersion;\n }\n }\n }\n\n return updated;\n}", "function traversePackages(pkg_json){\n if(typeof(pkg_json.packages) !== 'undefined' && pkg_json.packages.length > 0) {\n //find new index of the previous first package\n let keepSearching = true;\n let count = 0;\n let timeCompareCount = 0;//this variable to used for counting the packages that are added into\n while(keepSearching) {\n console.log('timeCompareCount-->' + timeCompareCount);\n let pkg = pkg_json.packages[count];\n console.log('current package is ' + pkg.name + ' latest version is ' + pkg.latest.version);\n let res = checkPackageUpdateState(pkg, timeCompareCount);\n timeCompareCount = res.timeCompareCount;\n\n let pkgName = pkg.name;\n if(res.needUpdate){\n console.log(currentTimestamp() + 'needUpdate is true, push package ' + pkgName + ' to refresh_list');\n // refreshTargetPackage(pkg, true);\n if(!refresh_dir_list.includes(pkgName)){\n refresh_dir_list.push(pkgName);\n }else{\n console.log(currentTimestamp() + 'found package ' + pkgName + ' in refresh_dir_list, this package might be ignored');\n }\n if(!refresh_list.includes(pkgName)){\n refresh_list.push(pkgName);\n }else{\n console.log(currentTimestamp() + 'found package ' + pkgName + ' in refresh_list, this package might be ignored');\n }\n\n }else{\n if(res.timeCompareCount < 16 && res.code == 3){\n console.log(currentTimestamp() + 'meet the condition -- res.timeCompareCount < 5 && res.code == 3, push package ' + pkgName + ' to refresh_list');\n extra_cache.push(pkg);\n // if(!refresh_dir_list.includes(pkgName)){\n // refresh_dir_list.push(pkgName);\n // }\n // if(!refresh_list.includes(pkgName)){\n // refresh_list.push(pkgName);\n // }\n }else{\n keepSearching = false;\n return true;\n }\n }\n // if(checkPKGMap(pkg)){\n // //no need to refresh package\n // keepSearching = false;\n // return true;\n // }else{\n // refreshTargetPackage(pkg);\n // }\n\n count++;\n if(count == pkg_json.packages.length){\n //target package not found in current list\n console.log('target package not found in current list');\n // lastCheckMSG = currentTimestamp() + 'target package not found in current list, count -->' + count + ' target package is ' + target;\n return false;\n }\n }//end of loop\n }else{\n return true;\n }\n}", "async function findDepUpgrades(dep) {\n const npmDependency = await npmApi.getDependency(dep.depName);\n const upgrades =\n await versionsHelper.determineUpgrades(npmDependency, dep.currentVersion, config);\n if (upgrades.length > 0) {\n logger.verbose(`${dep.depName}: Upgrades = ${JSON.stringify(upgrades)}`);\n upgrades.forEach((upgrade) => {\n allUpgrades.push(Object.assign({}, dep, upgrade));\n });\n } else {\n logger.verbose(`${dep.depName}: No upgrades required`);\n }\n }", "function getRequestedVersions(depName, lockfileJson) {\n const requestedVersions = [];\n const re = /^(.*)@([^@]*?)$/;\n\n Object.entries(lockfileJson).forEach(([name, _]) => {\n if (name.match(re)) {\n const [_, packageName, requestedVersion] = name.match(re);\n if (packageName === depName) {\n requestedVersions.push(requestedVersion);\n }\n }\n });\n\n return requestedVersions;\n}", "static validate(newChangeFilePaths, changedPackages) {\n const changedSet = new Set();\n newChangeFilePaths.forEach((filePath) => {\n console.log(`Found change file: ${filePath}`);\n const changeRequest = node_core_library_1.JsonFile.load(filePath);\n if (changeRequest && changeRequest.changes) {\n changeRequest.changes.forEach(change => {\n changedSet.add(change.packageName);\n });\n }\n else {\n throw new Error(`Invalid change file: ${filePath}`);\n }\n });\n const requiredSet = new Set(changedPackages);\n changedSet.forEach((name) => {\n requiredSet.delete(name);\n });\n if (requiredSet.size > 0) {\n const missingProjects = [];\n requiredSet.forEach(name => {\n missingProjects.push(name);\n });\n throw new Error(`Change file does not contain ${missingProjects.join(',')}.`);\n }\n }", "writePackageJson(mpath, cb) {\n const semver = require(\"semver\");\n return fs.stat(mpath, function(err, stat) {\n if (err) { return cb(err); }\n const f = stat.isDirectory() ? bna.dir.npmDependencies : bna.npmDependencies;\n return f(mpath, function(err, deps) {\n if (err) { return cb(err); }\n if (stat.isFile()) {\n ({ mpath } = bna.identify(mpath));\n }\n const pkgJsonFile = path.join(mpath, \"package.json\");\n let pkgJson = {};\n if (fs.existsSync(pkgJsonFile)) {\n pkgJson = JSON.parse(fs.readFileSync(pkgJsonFile, \"utf8\"));\n }\n const oldDep = pkgJson.dependencies || {};\n const newdep = {};\n const errList = [];\n // merge into oldDep\n _(deps).each(function(version, name) {\n if (version === null) {\n //errList.push(util.format(\"%s is not versioned!\",name));\n return;\n } else if (!(name in oldDep)) {\n return newdep[name] = version;\n } else { // use semver to check\n const oldVer = oldDep[name];\n if (/:\\/\\//.test(oldVer)) { // test for url pattern\n log(util.format(\"Package %s is ignored due to non-semver %s\", name, oldVer));\n delete oldDep[name];\n return newdep[name] = oldVer; // keep old value\n } else if (!semver.satisfies(version, oldVer)) {\n return errList.push(util.format(\"%s: actual version %s does not satisfy package.json's version %s\", name, version, oldVer));\n } else {\n delete oldDep[name];\n return newdep[name] = oldVer;\n }\n }\n });\n if (errList.length > 0) {\n return cb(new Error(errList.join(\"\\n\")));\n } else {\n pkgJson.dependencies = newdep;\n return fs.writeFile(pkgJsonFile, JSON.stringify(pkgJson, null, 2), \"utf8\", err => cb(err, _(oldDep).keys()));\n }\n });\n });\n }", "function checkForUpdate() {\n superagent.get(packageJson).end((error, response) => {\n if (error) return;\n const actualVersion = JSON.parse(response.text).version; // TODO: case without internet connection\n console.log('Actual app version: ' + actualVersion + '. Current app version: ' + currentVersion);\n if (semver.gt(actualVersion, currentVersion)) {\n mb.window.webContents.send('update-available');\n console.log('New version is available!');\n }\n });\n}", "function onOutdatedFn ( error_data, update_table ) {\n var\n solve_map = {},\n update_count = update_table.length,\n\n idx, row_list,\n package_name, current_str, target_str\n ;\n\n if ( error_data ) { return failFn( error_data ); }\n\n if ( update_count === 0 ) {\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'No package changes' );\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n\n // Invalidate all these stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap, [\n 'install', 'setup', 'dev_test', 'dev_lint',\n 'dev_cover', 'dev_commit', 'build'\n ]);\n\n // Load post-install methods\n xhiObj.loadLibsFn();\n postObj = xhiObj.makePostObj();\n\n // Begin aggregate changes and merge\n for ( idx = 0; idx < update_count; idx++ ) {\n row_list = update_table[ idx ];\n package_name = row_list[ 1 ];\n current_str = row_list[ 2 ];\n target_str = row_list[ 4 ];\n solve_map[ package_name ] = target_str;\n logFn(\n 'Update ' + package_name + ' from '\n + current_str + ' to ' + target_str\n );\n }\n Object.assign( packageMatrix.devDependencies, solve_map );\n // . End Aggregate changes an merge\n\n // Save to package file\n postObj.writePkgFileFn(\n function _onWriteFn ( error_data ) {\n if ( error_data ) { return failFn( error_data ); }\n\n // Mark install and setup as 'out of date'\n stageStatusMap.install = false;\n stageStatusMap.setup = false;\n\n // Store success and finish\n // A successful update invalidates all prior stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap );\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n );\n }", "function main () {\n if (process.platform === 'win32') {\n console.error('Sorry, check-deps only works on Mac and Linux')\n return\n }\n\n var usedDeps = findUsedDeps()\n var packageDeps = findPackageDeps()\n\n var missingDeps = usedDeps.filter(\n (dep) => !includes(packageDeps, dep) && !includes(BUILT_IN_DEPS, dep)\n )\n var unusedDeps = packageDeps.filter(\n (dep) => !includes(usedDeps, dep) && !includes(EXECUTABLE_DEPS, dep)\n )\n\n if (missingDeps.length > 0) {\n console.error('Missing package dependencies: ' + missingDeps)\n }\n if (unusedDeps.length > 0) {\n console.error('Unused package dependencies: ' + unusedDeps)\n }\n if (missingDeps.length + unusedDeps.length > 0) {\n process.exitCode = 1\n }\n}", "_updatePackage() {\n let dest = this.destinationPath('package.json');\n let template = this.templatePath('dependencies.stub');\n let pkg = program.helpers.readJson(this, dest);\n\n let deps = JSON.parse(program.helpers.readTpl(this, template, {\n relationalDB: program.helpers.isRelationalDB(this.answers.database),\n answers: this.answers\n }));\n\n pkg.dependencies = Object.assign(pkg.dependencies, deps);\n this.fs.writeJSON(dest, pkg);\n }", "function setUserRequestedPackageVersions(\n deps: Array<Dependency>,\n args: Array<string>,\n latest: boolean,\n packagePatterns,\n reporter: Reporter,\n) {\n args.forEach(requestedPattern => {\n let found = false;\n let normalized = normalizePattern(requestedPattern);\n\n // if the user specified a package name without a version range, then that implies \"latest\"\n // but if the latest flag is not passed then we need to use the version range from package.json\n if (!normalized.hasVersion && !latest) {\n packagePatterns.forEach(packagePattern => {\n const packageNormalized = normalizePattern(packagePattern.pattern);\n if (packageNormalized.name === normalized.name) {\n normalized = packageNormalized;\n }\n });\n }\n\n const newPattern = `${normalized.name}@${normalized.range}`;\n\n // if this dependency is already in the outdated list,\n // just update the upgradeTo to whatever version the user requested.\n deps.forEach(dep => {\n if (normalized.hasVersion && dep.name === normalized.name) {\n found = true;\n dep.upgradeTo = newPattern;\n reporter.verbose(reporter.lang('verboseUpgradeBecauseRequested', requestedPattern, newPattern));\n }\n });\n\n // if this dependency was not in the outdated list,\n // then add a new entry\n if (normalized.hasVersion && !found) {\n deps.push({\n name: normalized.name,\n wanted: '',\n latest: '',\n url: '',\n hint: '',\n range: '',\n current: '',\n upgradeTo: newPattern,\n workspaceName: '',\n workspaceLoc: '',\n });\n reporter.verbose(reporter.lang('verboseUpgradeBecauseRequested', requestedPattern, newPattern));\n }\n });\n}", "dependencyChanged(srcDir, dep) {\n let file = path.isAbsolute(dep[0]) ? dep[0] : path.join(srcDir, dep[0]);\n let hexDigest = dep[1];\n\n let hash = this.hashForFile(file);\n let hd = hash.digest(\"hex\");\n return (hd !== hexDigest);\n }", "addDevDeps(...deps) {\n for (const dep of deps) {\n this.project.deps.addDependency(dep, deps_1.DependencyType.BUILD);\n }\n }", "function processDependencies(dependencies, components, exclude) {\n Object.keys(dependencies).forEach(function(key) {\n grunt.log.debug(\"Obtaining package version for \" + key);\n\n var dependency = dependencies[key];\n var pkgMeta = dependency.pkgMeta;\n\n if(exclude.indexOf(pkgMeta.name) > -1) {\n grunt.log.ok('Excluding component: ' + pkgMeta.name);\n return;\n }\n\n var componentData = {};\n componentData['version'] = pkgMeta.version;\n componentData['directory'] = dependency.canonicalDir;\n components[pkgMeta.name] = componentData;\n\n grunt.log.debug(key + \" - version: \" + componentData['version'] + \" directory: \" + componentData['directory']);\n\n processDependencies(dependency.dependencies, components, exclude);\n });\n }", "function shadowCheckEntryVersion(entryVersion) {\r\n return Object.keys(entryVersion).every(\r\n k => entryVersion[k].version === packageDependency_1.getPKGVersion(k)\r\n );\r\n}", "function matches(searched, pkg) {\n return searched.some(searchedPkg => {\n if (typeof searchedPkg === 'string') {\n return pkg.name === searchedPkg;\n }\n return searchedPkg.name === pkg.name && !!pkg.version &&\n semver.satisfies(pkg.version, searchedPkg.range);\n });\n}", "onlyUpdating() {\n return Number.isInteger(this.props.projectVersion);\n }", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by webpack.\n return mostRecentCompilationHash !== __webpack_require__.h();\n} // webpack disallows updates in other states.", "async function upgradePackageDefinitions(currentDependencies, options) {\n const latestVersionResults = await (0, queryVersions_1.default)(currentDependencies, options);\n const latestVersions = (0, keyValueBy_1.default)(latestVersionResults, (dep, result) => (result === null || result === void 0 ? void 0 : result.version) && filterResultsByUserFunction(dep, currentDependencies, result.version, options)\n ? {\n [dep]: result.version,\n }\n : null);\n const upgradedDependencies = (0, upgradeDependencies_1.default)(currentDependencies, latestVersions, options);\n const filteredUpgradedDependencies = (0, pickBy_1.default)(upgradedDependencies, (v, dep) => {\n return !options.jsonUpgraded || !options.minimal || !(0, semver_1.satisfies)(latestVersions[dep], currentDependencies[dep]);\n });\n if (options.peer && !(0, isEmpty_1.default)(filteredUpgradedDependencies)) {\n const upgradedPeerDependencies = await (0, getPeerDependenciesFromRegistry_1.default)(filteredUpgradedDependencies, options);\n const peerDependencies = { ...options.peerDependencies, ...upgradedPeerDependencies };\n if (!(0, isEqual_1.default)(options.peerDependencies, peerDependencies)) {\n const [newUpgradedDependencies, newLatestVersions, newPeerDependencies] = await upgradePackageDefinitions({ ...currentDependencies, ...filteredUpgradedDependencies }, { ...options, peerDependencies, loglevel: 'silent' });\n return [\n { ...filteredUpgradedDependencies, ...newUpgradedDependencies },\n { ...latestVersionResults, ...newLatestVersions },\n newPeerDependencies,\n ];\n }\n }\n return [filteredUpgradedDependencies, latestVersionResults, options.peerDependencies];\n}", "function updateDepModuleVersions () {\n return request.post({\n url: `http://${HOST}/api/DepModuleVersions/add`,\n followAllRedirects: true,\n headers: {\n \"Authorization\": TOKEN\n },\n body: {\n obj: obj\n },\n json: true // Automatically stringifies the body to JSON\n }, (err, res, body) => {\n licenseObj(body);\n check(err, res, body);\n });\n}", "function checkForDependency(cb) {\n var ajax = new XMLHttpRequest();\n ajax.onreadystatechange = function () {\n // noinspection EqualityComparisonWithCoercionJS\n if (this.readyState == 4 && this.status == 200) {\n // noinspection EqualityComparisonWithCoercionJS\n if (ajax.responseText == \"1\") {\n cb();\n } else {\n alert(\"wrtbwmon is not installed!\");\n }\n }\n };\n ajax.open('GET', basePath + '/check_dependency', true);\n ajax.send();\n }", "function getAllAfsDependenciesFromPackageJson() {\n const projectPackageJsonPath = path.join(__dirname, \"package.json\");\n const packageJsonContent = require(projectPackageJsonPath);\n return Object.assign(packageJsonContent.afsDependencies || {}, packageJsonContent.afsDevDependencies || {});\n}", "_checkDependencies(entity) {\n let missingDependencies = [];\n\n this.dependencies.forEach((dependency) => {\n let isMissing = true;\n\n for(let i=0; i < Object.keys(entity.components).length; i++) {\n if(Object.keys(entity.components)[i] == dependency) {\n isMissing = false;\n }\n }\n\n if(isMissing) missingDependencies.push(dependency);\n });\n\n if(missingDependencies.length > 0) {\n throw new Error(`${this.id} requires ${missingDependencies.length} other component dependencies. Make sure ${this.id} is added after it's dependencies.`);\n }\n }", "function checkIfCanUpgrade(upgrade, bypassMoney = false){\n var check = 0;\n for (i in upgrades[upgrade]['cost']){\n if (upgrades[upgrade]['cost'][i] <= currency[i]['amount']){\n check++;\n }\n }\n if ((check == Object.keys(upgrades[upgrade]['cost']).length || bypassMoney == true) && ((upgrades[upgrade]['onetime'] == 0 && upgrades[upgrade]['amount'] == 0) || upgrades[upgrade]['onetime'] == 1)){\n var neededUpgrades = 0;\n for (i = 0; i < upgrades[upgrade]['prerequisites'].length; i++){\n if (upgradesHave.indexOf(upgrades[upgrade]['prerequisites'][i]) > -1){\n neededUpgrades++;\n }\n }\n if (neededUpgrades >= upgrades[upgrade]['prerequisites'].length){\n return true;\n }\n }\n else {\n return false;\n }\n}", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_require__.h();\n} // Webpack disallows updates in other states.", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_require__.h();\n} // Webpack disallows updates in other states.", "function updateRequires(fileToUpdate, fromPath, toPath, filterFn) {\n var code = new SourceCode(fileToUpdate);\n var dirname = path.dirname(fileToUpdate);\n\n findRelativeRequireArgs(code.text, fileToUpdate).forEach(function(arg) {\n try {\n var fullRequirePath = Module._resolveFilename(arg.value, {\n filename: fileToUpdate,\n id: fileToUpdate,\n paths: Module._nodeModulePaths(dirname)\n });\n } catch (err) {\n // Ignore it\n }\n if (fullRequirePath === fromPath) {\n var newValue = path.relative(dirname, toPath);\n if (!isRelativeRequire(newValue)) {\n newValue = './' + newValue;\n }\n if (!path.extname(arg.value)) {\n newValue = path.basename(newValue, path.extname(newValue));\n }\n code.updateNodeValue(arg, newValue);\n }\n });\n if (code.modified) {\n if (typeof filterFn === 'function') {\n code.text = filterFn(fileToUpdate, code.text) || code.text;\n }\n code.write();\n return true;\n } else {\n return false;\n }\n}", "function isDependencySatisfied2(dep) {\r\n let count = 0\r\n for (let meterID in dep) {\r\n if (meterID.indexOf(\"?\") > -1 || meterID.indexOf(\"/\") > -1) {\r\n meterID.replace(\"?\", \"\\\\?\").replace(\"/\", \"\\\\/\");\r\n }\r\n if ($(\"[meterid=\" + meterID + \"]\").children().find('input').not('[id^=reading_]').val() == dep[meterID]) {\r\n count++;\r\n } else if ($(\"[meterid=\" + meterID + \"]\").children().find('select').val() == dep[meterID]) {\r\n count++;\r\n }\r\n }\r\n if (count == Object.keys(dep).length) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}", "checkDependencies() {\n for (let id in this.dependencies) {\n let dependency = this.dependencies[id];\n let { dependencies, callback } = dependency;\n if (dependencies.clients.length && !this.clientsAreAllOnline[id]) {\n this.clientsAreAllOnline[id] = this.checkClients(dependencies.clients);\n if (!this.clientsAreAllOnline[id]) {\n continue;\n }\n }\n delete this.dependencies[id];\n dependency.clearStartupTimer();\n if (callback) {\n callback();\n }\n }\n }", "function updatePackages() {\n\tvar dataDir = getDataDirectory();\n\n\tfs.readdir(dataDir, function(err, files) {\n\t\tfiles.forEach(function(file) {\n\t\t\tvar name = path.basename(file, '.json');\n\n\t\t\tvar infoFilePath = path.join(dataDir, file);\n\t\t\tfs.readFile(infoFilePath, 'utf8', function(err, data) {\n\t\t\t\tif (err) {\n\t\t\t\t\tlog('error', \"could not access data for %s -- skipping\", name);\n\t\t\t\t} else {\n\t\t\t\t\tvar info = JSON.parse(data);\n\t\t\t\t\tretrievePackage(name, info.repo, function(err, result) {\n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\tlog('error', \"failed to update %s\", name);\n\t\t\t\t\t\t} else if (result.retrieved) {\n\t\t\t\t\t\t\tlog('info', \"%s updated successfully\", name);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t})\n\t});\n}", "isRequireSolved(){\n return Object.keys(this.requirePending).every((serviceName) => {\n return this.requirePending[serviceName].length === 0\n })\n }", "function buildDeps(arrDeps) {\n arrDeps.forEach(function (deps) {\n var depsId = deps, vmPath;\n\n var depsObj = map[depsId];\n if (!depsObj) {\n console.error('%s is not in map!!', depsId);\n return;\n }\n var hisDeps = depsObj['deps'] || [];\n if (hisDeps && hisDeps.length) {\n buildDeps(hisDeps);\n }\n\n var type = depsObj.type;\n var uri = depsObj.uri;\n\n switch (type) {\n case 'vm':\n\n // 检查deps中的js,添加到arrJsMod里\n // arrJsMod中只放每一个vm同名依赖的js模块,它的依赖已经打包在arrCombJs中提前加载了\n var depsIdPre = depsId.replace(/(.*?)(\\.vm)$/, '$1');\n hisDeps.map(function (item) {\n if (item === depsIdPre + '.js') {\n var modId = map[item] && map[item]['extras']['moduleId'];\n arrJsMod.push({\n moduleId: '\"' + modId + '\"',\n widgetId: deps.idf\n });\n }\n });\n\n break;\n case 'js':\n if (!~conf['arrGlobalJs'].indexOf(uri)) {\n arrCombJs.pushUnique(uri);\n }\n break;\n case 'css':\n if (!~conf['arrGlobalCss'].indexOf(uri)) {\n arrCombCss.pushUnique(uri);\n }\n break;\n default:\n break;\n } //end of switch\n }); //end of forEach\n\n }", "function validLegacyPackage(input) {\n const { validForOldPackages } = validateLegacy(input);\n return validForOldPackages;\n}", "_mergeChangedPackageJsonProps(packageJson) {\n if (!this.component.packageJsonChangedProps) return;\n\n const valuesToMerge = this._replaceDistPathTemplateWithCalculatedDistPath(packageJson);\n\n packageJson.mergePackageJsonObject(valuesToMerge);\n }", "gatherDependencies(packageJson) {\n\t\tlet dependencies = {};\n\t\tif (packageJson.honk && packageJson.honk.dependencies) {\n\t\t\tdependencies = packageJson.honk.dependencies;\n\t\t}\n\t\treturn dependencies;\n\t}", "function should_upgrade(upgrade_to_version, comp_doc, cb) {\n\t\t\tif (!comp_doc || !comp_doc.version) {\n\t\t\t\tlogger.warn('[fab upgrade] unexpected error, missing comp doc or \"version\" field');\n\t\t\t\treturn cb(null, false);\n\t\t\t} else {\n\t\t\t\t// the version in upgrade_to_version is okay, any lower is not\n\t\t\t\tif (!t.misc.is_version_b_greater_than_a(comp_doc.version, upgrade_to_version)) {\n\t\t\t\t\tlogger.debug('[fab upgrade] version good. comp:', comp_doc._id, 'version:', comp_doc.version);\n\t\t\t\t\treturn cb(null, false);\n\t\t\t\t} else {\n\t\t\t\t\ttls_certs_near_expiration(comp_doc, (errors, is_near_expiration) => {\n\t\t\t\t\t\tif (is_near_expiration) {\n\t\t\t\t\t\t\tlogger.warn('[fab upgrade] tls cert for comp IS near expiration. comp:', comp_doc._id);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlogger.debug('[fab upgrade] tls cert for comp is not near expiration. comp:', comp_doc._id);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn cb(null, is_near_expiration);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// check if the tls certs are near expiration\n\t\t\tfunction tls_certs_near_expiration(component_doc, cert_cb) {\n\t\t\t\t// get the cert from deployer's api response\n\t\t\t\tget_comps_tls_cert_from_deployer(component_doc, (_, tls_cert) => {\n\t\t\t\t\tif (!tls_cert) {\n\t\t\t\t\t\tlogger.error('[fab upgrade] unable to get tls cert for auto fab upgrade check, skipping component');\n\t\t\t\t\t\treturn cert_cb(null, false);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst too_close_to_expiration_ms = ev.AUTO_FAB_UP_EXP_TOO_CLOSE_DAYS * 24 * 60 * 60 * 1000;\n\t\t\t\t\t\tif (t.misc.cert_is_near_expiration(tls_cert, too_close_to_expiration_ms, component_doc._id)) {\n\t\t\t\t\t\t\treturn cert_cb(null, true);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn cert_cb(null, false);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}", "function checkKiraVersion(json) {\n if (coreUtils.checkIfGreaterVersionNumber(version.version, json.version)) {\n console.log(chalk `{green [}{greenBright NOTICE}{green ]} There is an update available for Kira!`);\n console.log(chalk `{cyan Current version: }{cyanBright ${version.version}}`);\n console.log(chalk `{cyan Latest version: }{cyanBright ${json.version}}`);\n } else {\n console.log(chalk `{cyanBright No updates available}`);\n }\n}", "deleteAll(shouldDelete, updatedChangelogs) {\n if (updatedChangelogs) {\n // Skip changes files if the package's change log is not updated.\n const packagesToInclude = new Set();\n updatedChangelogs.forEach((changelog) => {\n packagesToInclude.add(changelog.name);\n });\n const filesToDelete = this.getFiles().filter((filePath) => {\n const changeRequest = node_core_library_1.JsonFile.load(filePath);\n for (const changeInfo of changeRequest.changes) {\n if (!packagesToInclude.has(changeInfo.packageName)) {\n return false;\n }\n }\n return true;\n });\n return this._deleteFiles(filesToDelete, shouldDelete);\n }\n else {\n // Delete all change files.\n return this._deleteFiles(this.getFiles(), shouldDelete);\n }\n }", "async function validate (fileOld, fileNew) {\n const dataOld = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'data', fileOld), 'utf8'))\n const dataNew = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'data', fileNew), 'utf8'))\n\n let itemsDeleted = 0\n let itemsChanged = 0\n for (const itemOld of dataOld) {\n const newExists = dataNew.find((i) => i.itemId === itemOld.itemId)\n if (!newExists) itemsDeleted += 1\n else {\n try {\n assert.deepStrictEqual(newExists, itemOld)\n } catch (err) {\n itemsChanged += 1\n }\n }\n }\n const itemsAdded = dataNew.length - (dataOld.length - itemsDeleted)\n\n printValidation(itemsDeleted, 'items missing')\n printValidation(itemsAdded, 'items added')\n printValidation(itemsChanged, 'items changed')\n\n if (itemsDeleted > 0 || itemsAdded > 0 || itemsChanged > 0) {\n console.log(colors.yellow('Changes detected'))\n console.log('Either something went wrong with your build or you improved it somehow (e.g. better sanitization). In the latter case, please make a pull request to get the new data up!')\n } else {\n console.log(colors.green('Build successfully validated'))\n }\n}", "function syncNpmVersions() {\n return new Promise((resolve, reject) => {\n fs.readFile(`${paths.distNpmPath()}/package.json`, (err, data) => {\n if (err) {\n return reject(err);\n }\n const npmPackage = JSON.parse(data);\n const promises = [\n updatePackageVersion(`./package.json`, npmPackage),\n updatePackageVersion(`./src/package.json`, npmPackage)\n ];\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch(err => {\n reject(err);\n });\n });\n });\n}", "function doc_needs_changes(component_doc, dep_tls_cert) {\n\t\t\tlogger.debug('[patch] looking at component id:', component_doc._id);\n\t\t\tlet db_tls_cert_parsed = (component_doc && component_doc.tls_cert) ? t.ot_misc.parseCertificate(component_doc.tls_cert) : null;\n\t\t\tconst dep_tls_cert_parsed = dep_tls_cert ? t.ot_misc.parseCertificate(dep_tls_cert) : null;\n\n\t\t\tif (!db_tls_cert_parsed) {\n\t\t\t\tlogger.debug('[patch] tls cert in db is not parsable or missing for component id:', component_doc._id, component_doc.type);\n\t\t\t\tdb_tls_cert_parsed = {};\t\t\t\t\t\t\t\t\t\t\t\t// if unable to parse existing cert, init blank obj\n\t\t\t}\n\n\t\t\tif (!dep_tls_cert_parsed) {\n\t\t\t\tlogger.warn('[patch] tls cert from deployer is not parsable or missing for component id:', component_doc._id, component_doc.type);\n\t\t\t}\n\n\t\t\tif (dep_tls_cert_parsed) {\t\t\t\t\t\t\t\t\t\t\t\t\t// parse the certs, then compare serials, more accurate\n\t\t\t\tif (db_tls_cert_parsed.serial_number_hex !== dep_tls_cert_parsed.serial_number_hex) {\t// if it doesn't match, it doesn't belong here\n\t\t\t\t\tlogger.debug('[patch] tls_cert does not match, switching.', db_tls_cert_parsed.serial_number_hex, dep_tls_cert_parsed.serial_number_hex);\n\n\t\t\t\t\t// assume the value in parsed tls_cert is a root cert, its at least not a tls cert\n\t\t\t\t\tcomponent_doc.tls_ca_root_cert = db_tls_cert_parsed.base_64_pem;\t// copy, if undefined b/c field un-parsable it will drop after stringify\n\t\t\t\t\tcomponent_doc.tls_cert = dep_tls_cert;\n\t\t\t\t\treturn component_doc;\t\t\t\t\t\t\t\t\t\t\t\t// cert switch is done, return edited doc\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (dep_tls_cert) {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// if deployer has a cert, but the db doesn't, copy deployer's\n\t\t\t\tif (component_doc && !component_doc.tls_cert) {\n\t\t\t\t\tlogger.debug('[patch] tls_cert in db is missing, copying from deployer, id:', component_doc._id);\n\t\t\t\t\tcomponent_doc.tls_cert = dep_tls_cert;\n\t\t\t\t\treturn component_doc;\t\t\t\t\t\t\t\t\t\t\t\t// cert is populated, return edited doc\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// skip CA's b/c we don't store tls_ca_root_cert... though maybe we should. dsh todo\n\t\t\tif (component_doc.type !== ev.STR.CA && !component_doc.tls_ca_root_cert) {\t// doesn't do anything, just logs the missing field for visibility\n\t\t\t\tlogger.warn('[patch] tls_ca_root_cert is missing for component id:', component_doc._id, component_doc.type);\n\t\t\t}\n\n\t\t\treturn null;\t\t\t\t\t\t\t\t\t\t\t\t\t\t// no doc edits were done, return null\n\t\t}", "function doc_needs_changes(component_doc, dep_tls_cert) {\n\t\t\tlogger.debug('[patch] looking at component id:', component_doc._id);\n\t\t\tlet db_tls_cert_parsed = (component_doc && component_doc.tls_cert) ? t.ot_misc.parseCertificate(component_doc.tls_cert) : null;\n\t\t\tconst dep_tls_cert_parsed = dep_tls_cert ? t.ot_misc.parseCertificate(dep_tls_cert) : null;\n\n\t\t\tif (!db_tls_cert_parsed) {\n\t\t\t\tlogger.debug('[patch] tls cert in db is not parsable or missing for component id:', component_doc._id, component_doc.type);\n\t\t\t\tdb_tls_cert_parsed = {};\t\t\t\t\t\t\t\t\t\t\t\t// if unable to parse existing cert, init blank obj\n\t\t\t}\n\n\t\t\tif (!dep_tls_cert_parsed) {\n\t\t\t\tlogger.warn('[patch] tls cert from deployer is not parsable or missing for component id:', component_doc._id, component_doc.type);\n\t\t\t}\n\n\t\t\tif (dep_tls_cert_parsed) {\t\t\t\t\t\t\t\t\t\t\t\t\t// parse the certs, then compare serials, more accurate\n\t\t\t\tif (db_tls_cert_parsed.serial_number_hex !== dep_tls_cert_parsed.serial_number_hex) {\t// if it doesn't match, it doesn't belong here\n\t\t\t\t\tlogger.debug('[patch] tls_cert does not match, switching.', db_tls_cert_parsed.serial_number_hex, dep_tls_cert_parsed.serial_number_hex);\n\n\t\t\t\t\t// assume the value in parsed tls_cert is a root cert, its at least not a tls cert\n\t\t\t\t\tcomponent_doc.tls_ca_root_cert = db_tls_cert_parsed.base_64_pem;\t// copy, if undefined b/c field un-parsable it will drop after stringify\n\t\t\t\t\tcomponent_doc.tls_cert = dep_tls_cert;\n\t\t\t\t\treturn component_doc;\t\t\t\t\t\t\t\t\t\t\t\t// cert switch is done, return edited doc\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (dep_tls_cert) {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// if deployer has a cert, but the db doesn't, copy deployer's\n\t\t\t\tif (component_doc && !component_doc.tls_cert) {\n\t\t\t\t\tlogger.debug('[patch] tls_cert in db is missing, copying from deployer, id:', component_doc._id);\n\t\t\t\t\tcomponent_doc.tls_cert = dep_tls_cert;\n\t\t\t\t\treturn component_doc;\t\t\t\t\t\t\t\t\t\t\t\t// cert is populated, return edited doc\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// skip CA's b/c we don't store tls_ca_root_cert... though maybe we should. dsh todo\n\t\t\tif (component_doc.type !== ev.STR.CA && !component_doc.tls_ca_root_cert) {\t// doesn't do anything, just logs the missing field for visibility\n\t\t\t\tlogger.warn('[patch] tls_ca_root_cert is missing for component id:', component_doc._id, component_doc.type);\n\t\t\t}\n\n\t\t\treturn null;\t\t\t\t\t\t\t\t\t\t\t\t\t\t// no doc edits were done, return null\n\t\t}", "function shouldPodRepoUpdate(errorOutput) {\n const output = errorOutput;\n const isPodRepoUpdateError = output.includes('pod repo update') || output.includes('--no-repo-update');\n return isPodRepoUpdateError;\n}", "function devDeps (argv, next) {\n const opts = { saveDev: true, cache: true }\n install(argv.devDeps, opts, function (err) {\n if (err) return next(err)\n next()\n })\n}", "function check_package(name, cb) {\n console.log('Checking '+name);\n var dpkg = spawn('dpkg', ['-s', name]),\n data = '';\n \n dpkg.stdout.on('data', function (d) {\n data += d.toString();\n })\n \n dpkg.stdout.on('end', function () {\n // Data has been parsed, check the status\n cb(data.indexOf('package \\''+name+'\\' is not installed') === -1);\n });\n }", "function updatePackageJson() {\n const version = fs.readJSONSync('package.json').version;\n const packageJson = fs.readJSONSync(path.join('docker', 'package.json'));\n\n packageJson.version = version;\n packageJson.dependencies['ng-apimock'] = version;\n\n fs.writeJsonSync(path.join('docker', 'package.json'), packageJson);\n }", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_require__.h();\n}", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_require__.h();\n}", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_require__.h();\n}", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_require__.h();\n}", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_require__.h();\n}", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_require__.h();\n}", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_require__.h();\n}", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_require__.h();\n}", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_require__.h();\n}", "checkDependencies() {\n console.debug(\"checkDependencies\", this.dependencies);\n if (Object.keys(this.dependencies)) {\n for (let id in this.dependencies) {\n let { dependencies, callback } = this.dependencies[id];\n console.debug(\"checkDependency\", dependencies.services, this.offlineServices);\n if (dependencies.services.length) {\n let servicesAreAllOffline = this.checkServices(dependencies.services);\n if (!servicesAreAllOffline) {\n continue;\n }\n }\n console.debug(\"checkDependencies callback\");\n delete this.dependencies[id];\n if (callback) {\n callback();\n }\n }\n }\n }", "function devpackages () {\n opts.devpackages = makeArray(argv.dev)\n opts.files.test = true\n opts.install = true\n }", "function upgradeFn () {\n // == BEGIN MODULE SCOPE VARIABLES ==================================\n var\n xhiObj = this,\n\n catchFn = xhiObj.catchFn,\n commandMap = xhiObj.commandMap,\n logFn = xhiObj.logFn,\n nextFn = xhiObj.nextFn,\n packageMatrix = xhiObj.packageMatrix,\n prefixStr = xhiObj.makePrefixStr( commandMap ),\n stageStatusMap = xhiObj.stageStatusMap,\n\n aliasStr = commandMap.alias_str,\n postObj\n ;\n // == . END MODULE SCOPE VARIABLES ==================================\n\n // == BEGIN UTILITY METHODS =========================================\n // BEGIN utility /failFn/\n // Purpose: Wrap catchFn to store failure and finish\n //\n function failFn () {\n stageStatusMap[ aliasStr ] = false;\n catchFn( arguments );\n }\n // . END utility /failFn/\n // == . END UTILITY METHODS =========================================\n\n // == BEGIN EVENT HANDLERS ==========================================\n // BEGIN event handler /onOutdatedFn/\n function onOutdatedFn ( error_data, update_table ) {\n var\n solve_map = {},\n update_count = update_table.length,\n\n idx, row_list,\n package_name, current_str, target_str\n ;\n\n if ( error_data ) { return failFn( error_data ); }\n\n if ( update_count === 0 ) {\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'No package changes' );\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n\n // Invalidate all these stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap, [\n 'install', 'setup', 'dev_test', 'dev_lint',\n 'dev_cover', 'dev_commit', 'build'\n ]);\n\n // Load post-install methods\n xhiObj.loadLibsFn();\n postObj = xhiObj.makePostObj();\n\n // Begin aggregate changes and merge\n for ( idx = 0; idx < update_count; idx++ ) {\n row_list = update_table[ idx ];\n package_name = row_list[ 1 ];\n current_str = row_list[ 2 ];\n target_str = row_list[ 4 ];\n solve_map[ package_name ] = target_str;\n logFn(\n 'Update ' + package_name + ' from '\n + current_str + ' to ' + target_str\n );\n }\n Object.assign( packageMatrix.devDependencies, solve_map );\n // . End Aggregate changes an merge\n\n // Save to package file\n postObj.writePkgFileFn(\n function _onWriteFn ( error_data ) {\n if ( error_data ) { return failFn( error_data ); }\n\n // Mark install and setup as 'out of date'\n stageStatusMap.install = false;\n stageStatusMap.setup = false;\n\n // Store success and finish\n // A successful update invalidates all prior stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap );\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n );\n }\n // . END event handler /onOutdatedFn/\n\n // BEGIN event handler /onLoadFn/\n function onLoadFn ( error_data, localNpmObj ) {\n if ( error_data ) { return catchFn( error_data ); }\n localNpmObj.outdated( onOutdatedFn );\n }\n // . END event handler /onLoadFn/\n // == . END EVENT HANDLERS ==========================================\n\n // == BEGIN MAIN ====================================================\n function mainFn () {\n logFn( prefixStr + 'Start' );\n xhiObj.npmObj.load( xhiObj.fqPkgFilename, onLoadFn );\n }\n // == . END MAIN ====================================================\n mainFn();\n}", "function checkPackageInfo(){\n let url = flutter_source_url_arg_page + '1';\n let options= {\n url: url,\n gzip: true,\n headers: {\n 'User-Agent' : 'pub.flutter-io.cn'\n }\n };\n request.get(options, (err, response, body) => {\n //response from remote http server\n if (err) {\n console.error(currentTimestamp() + '[debug] encountered error while requesting package information from remote server, message:' + err.toString());\n } else {\n try{\n let data = JSON.parse(body);\n if(typeof(data.packages) !== 'undefined' && data.packages.length > 0){\n for(let i=0; i<data.packages.length; i++){\n let index = i+1;\n let pkg = data.packages[i];\n console.log('[debug] ' + index + '. name-->' + pkg.name + ' version-->' + pkg.latest.version);\n }\n }\n }catch(e){\n console.error(currentTimestamp() + '[debug] encountered error while parsing json data -->' + e.message);\n }\n\n }\n });\n}", "getMatchingDevDependencies(options = {}) {\n const includes = options.includes || [];\n const excludes = new Set(options.excludes || []);\n return Object.keys(this.metadata.devDependencies).filter(name => !excludes.has(name) && includes.some(prefix => name.startsWith(prefix)));\n }", "[_canPlaceDep] (dep, target, edge, peerEntryEdge = null) {\n // peer deps of root deps are effectively root deps\n const isRootDep = target.isRoot && (\n // a direct dependency from the root node\n edge.from === target ||\n // a member of the peer set of a direct root dependency\n peerEntryEdge && peerEntryEdge.from === target\n )\n\n const entryEdge = peerEntryEdge || edge\n\n // has child by that name already\n if (target.children.has(dep.name)) {\n const current = target.children.get(dep.name)\n // if the integrities match, then it's literally the same exact bytes,\n // even if it came from somewhere else.\n if (dep.integrity && dep.integrity === current.integrity) {\n return KEEP\n }\n\n // we can always place the root's deps in the root nm folder\n if (isRootDep) {\n return this[_canPlacePeers](dep, target, edge, REPLACE, peerEntryEdge)\n }\n\n // if the version is greater, try to use the new one\n const curVer = current.package.version\n const newVer = dep.package.version\n // always try to replace if the version is greater\n const tryReplace = curVer && newVer && semver.gte(newVer, curVer)\n if (tryReplace && current.canReplaceWith(dep)) {\n return this[_canPlacePeers](dep, target, edge, REPLACE, peerEntryEdge)\n }\n\n // ok, see if the current one satisfies the edge we're working on then\n if (edge.satisfiedBy(current)) {\n return KEEP\n }\n\n // last try, if we prefer deduplication over novelty, check to see if\n // this (older) dep can satisfy the needs of the less nested instance\n if (this[_preferDedupe] && current.canReplaceWith(dep)) {\n return this[_canPlacePeers](dep, target, edge, REPLACE, peerEntryEdge)\n }\n\n // no agreement could be reached :(\n return CONFLICT\n }\n\n // check to see if the target DOESN'T have a child by that name,\n // but DOES have a conflicting dependency of its own. no need to check\n // if this is the edge we're already looking to resolve!\n if (target !== entryEdge.from && target.edgesOut.has(dep.name)) {\n const edge = target.edgesOut.get(dep.name)\n // It might be that the dep would not be valid here, BUT some other\n // version would. Could to try to resolve that, but that makes this no\n // longer a pure synchronous function. ugh.\n // This is a pretty unlikely scenario in a normal install, because we\n // resolve the peer dep set against the parent dependencies, and\n // presumably they all worked together SOMEWHERE to get published in the\n // first place, and since we resolve shallower deps before deeper ones,\n // this can only occur by a child having a peer dep that does not satisfy\n // the parent. It can happen if we're doing a deep update limited by\n // a specific name, however, or if a dep makes an incompatible change\n // to its peer dep in a non-semver-major version bump, or if the parent\n // is unbounded in its dependency list.\n if (!edge.satisfiedBy(dep)) {\n return CONFLICT\n }\n }\n\n // check to see what the name resolves to here, and who depends on it\n // and if they'd be ok with the new dep being there instead. we know\n // at this point that it's not the target's direct child node. this is\n // only a check we do when deduping. if it's a direct dep of the target,\n // then we just make the invalid edge and resolve it later.\n const current = target !== entryEdge.from && target.resolve(dep.name)\n if (current) {\n for (const edge of current.edgesIn.values()) {\n if (edge.from.isDescendantOf(target) && edge.valid) {\n if (!edge.satisfiedBy(dep)) {\n return CONFLICT\n }\n }\n }\n }\n\n return this[_canPlacePeers](dep, target, edge, OK, peerEntryEdge)\n }", "function checkDeprecatedProps() {\n var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n /* eslint-disable no-console, no-undef */\n DEPRECATED_PROPS.forEach(function (depProp) {\n if (props.hasOwnProperty(depProp.old)) {\n var warnMessage = getDeprecatedText(depProp.old);\n if (depProp.new) {\n warnMessage = warnMessage + ' ' + getNewText(depProp.new);\n }\n console.warn(warnMessage);\n }\n });\n}", "function checkDeprecatedProps() {\n var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n /* eslint-disable no-console, no-undef */\n DEPRECATED_PROPS.forEach(function (depProp) {\n if (props.hasOwnProperty(depProp.old)) {\n var warnMessage = getDeprecatedText(depProp.old);\n if (depProp.new) {\n warnMessage = warnMessage + ' ' + getNewText(depProp.new);\n }\n console.warn(warnMessage);\n }\n });\n}", "async function checkForUpdate(currentVersion) {\n try {\n const latestVersion = await new Request(\n 'https://raw.githubusercontent.com/jchicano/scriptable-republicamovil/master/version.txt'\n ).loadString();\n return currentVersion.replace(/[^1-9]+/g, '') <\n latestVersion.replace(/[^1-9]+/g, '')\n ? true\n : false;\n } catch (err) {\n log('try checkForUpdate: ' + err);\n return false;\n }\n}", "function checkVersions(conf, callback) {\n\tif (conf.type === \"jira\") {\n\t\tcheckJiraVersion(conf, callback);\n\t} else {\n\t\t// The type of the repository is checked beforehand.\n\t\tconsole.assert(false);\n\t}\n}", "function meets(reqdVersion) {\r\n\treturn (!reqdVersion) ? false : this.simpleversion >= Math.round(100*parseFloat(reqdVersion));\r\n}", "function isUpdateAvailable() {\n /* globals __webpack_hash__ */\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n return mostRecentCompilationHash !== __webpack_hash__;\n}", "async function renovatePackage(config) {\n const logger = config.logger || pLogger;\n logger.trace(`renovatePackage(${config.depName})`);\n if (config.enabled === false) {\n logger.debug('package is disabled');\n return [];\n }\n let results = [];\n if (!versions.isValidVersion(config.currentVersion)) {\n results.push({\n depName: config.depName,\n type: 'warning',\n message: `Dependency uses tag \"\\`${config.currentVersion}\\`\" as its version so that will never be changed by Renovate`,\n });\n logger.debug(results[0].message);\n return results;\n }\n const npmDep = await npmApi.getDependency(config.depName, logger);\n if (npmDep) {\n results = await versions.determineUpgrades(npmDep, config);\n if (results.length > 0) {\n logger.info(\n { dependency: config.depName },\n `${results.length} result(s): ${results.map(\n upgrade => upgrade.newVersion\n )}`\n );\n }\n } else {\n // If dependency lookup fails then warn and return\n const result = {\n type: 'error',\n message: 'Failed to look up dependency',\n };\n logger.warn(result.message);\n results = [result];\n }\n logger.debug({ results }, `${config.depName} lookup results`);\n // Flatten the result on top of config, add repositoryUrl\n return results.map(result => {\n let upg = configParser.mergeChildConfig(config, result);\n if (upg.isMajor) {\n upg = configParser.mergeChildConfig(upg, upg.major);\n } else if (upg.isMinor) {\n upg = configParser.mergeChildConfig(upg, upg.minor);\n } else if (upg.isPatch) {\n upg = configParser.mergeChildConfig(upg, upg.patch);\n }\n upg.repositoryUrl =\n npmDep && npmDep.repositoryUrl && npmDep.repositoryUrl.length\n ? npmDep.repositoryUrl\n : null;\n return configParser.filterConfig(upg, 'branch');\n });\n}", "async run(): Promise<bool> {\n let deps = await this.getDeps()\n console.log(`Starting search for ${deps.length} deps.\\n`)\n\n let successes:TypeResult[] = []\n for (let dep of deps) {\n let typings = await this.checkDefinitelyTyped(dep)\n if (typings.status) {\n console.log(`found Typings for ${dep}`)\n successes.push(typings)\n }\n }\n\n if (successes) {\n let names = successes.map((result: TypeResult) => { return \"@types/\" + result.dep })\n console.log(\"\\nYou can install the following types:\")\n console.log(`\\n $ npm install ${names.join(\" \")} --save --only=dev`)\n } else {\n console.log(\"Could not find any types\")\n }\n\n return true\n }", "function verifyRequirements(lines, currentSnippet) {\t\n\tlet areAllRequirementsSatisfied = [];\n\tlet i = -1;\n\n\tlines.forEach(function(line) {\n\t\ti = i + 1;\n\t\tareAllRequirementsSatisfied[i] = false;\n\t\tif (line.startsWith(\"!require \")) {\n\t\t\tlet data = line.replace(\"!require \", \"\");\n\n\t\t\tif (data.length == 0) {\n\t\t\t\tareAllRequirementsSatisfied[i] = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Will be changed if syntax evolves\n\t\t\tif (!data.includes(\" == \")) {\n\t\t\t\tareAllRequirementsSatisfied[i] = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet parts = data.split(\" == \");\n\n\t\t\tif (parts.length < 2) {\n\t\t\t\tareAllRequirementsSatisfied[i] = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tparts[0] = parts[0].trim();\n\t\t\tparts[1] = parts[1].trim();\n\n\t\t\tlet gt = undefined;\n\t\t\tlet lt = undefined;\n\t\t\tlet secondValue = parts[1];\n\t\t\tif (parts[1].includes(\" > \")) {\n\t\t\t\tlet tempSplit = parts[1].split(\" > \");\n\t\t\t\tif (!isNaN(tempSplit[1])) {\n\t\t\t\t\tgt = parseInt(tempSplit[1]);\n\t\t\t\t}\n\t\t\t\tsecondValue = tempSplit[0].trim();\n\t\t\t}\n\n\t\t\tif (parts[1].includes(\" < \")) {\n\t\t\t\tlet tempSplit = parts[1].split(\" < \");\n\t\t\t\tif (!isNaN(tempSplit[1])) {\n\t\t\t\t\tlt = parseInt(tempSplit[1]);\n\t\t\t\t}\n\t\t\t\tsecondValue = tempSplit[0].trim();\n\t\t\t}\n\n\t\t\tif (parts[0] == secondValue) {\n\t\t\t\tareAllRequirementsSatisfied[i] = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet firstMatches = calculateJSONPath(parts[0], currentSnippet);\n\t\t\tlet matchCount = 0;\n\n\t\t\tfirstMatches.forEach(function(m) {\n\t\t\t\tif (m.finalValue == secondValue) {\n\t\t\t\t\tif (lt == undefined && gt == undefined) {\n\t\t\t\t\t\tareAllRequirementsSatisfied[i] = true;\n\t\t\t\t\t}\n\t\t\t\t\tmatchCount = matchCount + 1;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (!areAllRequirementsSatisfied[i]) {\n\t\t\t\tlet secondMatches = calculateJSONPath(secondValue, currentSnippet);\n\t\t\t\tsecondMatches.forEach(function(m) {\n\t\t\t\t\tif (m.finalValue == parts[0]) {\n\t\t\t\t\t\tif (lt == undefined && gt == undefined) {\n\t\t\t\t\t\t\tareAllRequirementsSatisfied[i] = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmatchCount = matchCount + 1;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (!areAllRequirementsSatisfied[i]) {\n\t\t\t\t\tfor (fm of firstMatches) {\n\t\t\t\t\t\tfor (sm of secondMatches) {\n\t\t\t\t\t\t\tif (fm.finalValue == sm.finalValue) {\n\t\t\t\t\t\t\t\tmatchCount = matchCount + 1;\n\t\t\t\t\t\t\t\tif (lt == undefined && gt == undefined) {\n\t\t\t\t\t\t\t\t\tareAllRequirementsSatisfied[i] = true;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (areAllRequirementsSatisfied[i] == true) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (lt != undefined) {\n\t\t\t\t\tif (matchCount < lt) {\n\t\t\t\t\t\tareAllRequirementsSatisfied[i] = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (gt != undefined) {\n\t\t\t\t\tif (matchCount > gt) {\n\t\t\t\t\t\tareAllRequirementsSatisfied[i] = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// filtered later, this is done using requiredSubPatterns in pattern data\n\t\tif (line.startsWith(\"!satisfies \")) {\n\t\t\tareAllRequirementsSatisfied[i] = true;\n\t\t}\n\t});\n\t\n\tlet aggregateChecks = areAllRequirementsSatisfied.reduce(\n\t\t(agg, el) => agg && el, true);\n\t\n\treturn aggregateChecks;\n}", "function verifyDependencyInfoIsAValidObject(fullName, dependencyInfo) {\n if (dependencyInfo === null || typeof dependencyInfo !== \"object\" || dependencyInfo instanceof Array) {\n throw new Error(\"Invalid afsDependencies entry for \\\"\" + fullName + \"\\\": value must be an object\");\n }\n}", "async function checkChangelog() {\n const modifiedPackages = lodash_1.groupBy(danger.git.modified_files.filter(file => file.startsWith('packages')), file => file.split(path.sep)[1]);\n console.log('🔎 Searching for packages without changelog...');\n const packagesWithoutChangelog = Object.entries(modifiedPackages)\n .filter(([packageName, files]) => !isChangelogModified(packageName, files))\n .map(([packageName]) => packageName);\n if (packagesWithoutChangelog.length === 0) {\n console.log('Everything is ok 🎉');\n return;\n }\n // gets suggested entries based on pull request\n console.log('📝 Gathering information from PR...');\n const suggestedEntries = getSuggestedChangelogEntries(packagesWithoutChangelog);\n // everything is up-to-date or skipped\n if (!suggestedEntries.length) {\n console.log('Everything is ok 🎉');\n return;\n }\n console.log('🛠 Suggested fixes:');\n suggestedEntries.forEach(entry => console.log(` > ${entry.packageName} - [${PullRequestManager_1.ChangelogEntryType[entry.type]}] ${entry.message}`));\n // applies suggested fixes using `et add-changelog` command\n console.log('⚙️ Fixing...');\n const fixedEntries = await runAddChangelogCommandAsync(suggestedEntries);\n // creates/updates PR form result of `et` command - it will be merged to the current PR\n let prUrl;\n if (pullRequestManager.shouldGeneratePR()) {\n console.log('📩 Creating PR...');\n try {\n prUrl = ((await pullRequestManager.createOrUpdatePRAsync(fixedEntries)) || {}).html_url;\n }\n catch (e) {\n console.log(\"❌ Couldn't create a pull request.\");\n console.log(e);\n }\n }\n // generates danger report. It will contain result of `et` command as a git diff and link to created PR\n console.log('📋 Creating report...');\n await generateReport(fixedEntries, prUrl);\n}", "function yadcfVersionCheck(version) {\n\t\tvar aThis = $.fn.dataTable.ext.sVersion.split('.'),\n\t\t\taThat = version.split('.'),\n\t\t\tiThis,\n\t\t\tiThat,\n\t\t\ti,\n\t\t\tiLen;\n\n\t\tfor (i = 0, iLen = aThat.length; i < iLen; i++) {\n\t\t\tiThis = parseInt(aThis[i], 10) || 0;\n\t\t\tiThat = parseInt(aThat[i], 10) || 0;\n\n\t\t\t// Parts are the same, keep comparing\n\t\t\tif (iThis === iThat) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Parts are different, return immediately\n\t\t\treturn iThis > iThat;\n\t\t}\n\n\t\treturn true;\n\t}", "async function compare() {\n let branchDir = path.join(__dirname, '..', 'dist', 'branch-api');\n let publishedDir = path.join(__dirname, '..', 'dist', 'published-api');\n if (!(fs.existsSync(branchDir) && fs.existsSync(publishedDir))) {\n if (!fs.existsSync(publishedDir) && fs.existsSync(branchDir)) {\n console.log('not showing private package', branchDir);\n } else if (fs.existsSync(publishedDir) && !fs.existsSync(branchDir)) {\n console.log('something has probably gone wrong, the package exists published but not locally', publishedDir);\n } else {\n console.log('something has probably gone wrong, the package does not exist in either place, this should be impossible', publishedDir);\n }\n return;\n }\n let summaryMessages = [];\n // don't worry about private packages, they don't make it through the build\n let branchAPIs = fg.sync(`${branchDir}/**/api.json`);\n let publishedAPIs = fg.sync(`${publishedDir}/**/api.json`);\n let pairs = [];\n for (let pubApi of publishedAPIs) {\n let pubApiPath = pubApi.split(path.sep);\n let sharedPath = path.join(...pubApiPath.slice(pubApiPath.length - 4));\n let matchingBranchFile;\n for (let branchApi of branchAPIs) {\n if (branchApi.includes(sharedPath)) {\n matchingBranchFile = branchApi;\n pairs.push({pubApi, branchApi});\n break;\n }\n }\n if (!matchingBranchFile) {\n summaryMessages.push({msg: `removed module ${pubApi}`, severity: 'error'});\n }\n }\n for (let branchApi of branchAPIs) {\n let branchApiPath = branchApi.split(path.sep);\n let sharedPath = path.join(...branchApiPath.slice(branchApiPath.length - 4));\n let matchingPubFile;\n for (let pubApi of publishedAPIs) {\n if (pubApi.includes(sharedPath)) {\n matchingPubFile = pubApi;\n // don't re-add to pairs\n break;\n }\n }\n if (!matchingPubFile) {\n summaryMessages.push({msg: `added module ${branchApi}`, severity: 'warn'});\n }\n }\n\n let count = 0;\n for (let pair of pairs) {\n console.log(`comparing ${pair.branchApi.replace(/.*branch-api/, '')}`);\n let publishedApi = fs.readJsonSync(pair.pubApi);\n delete publishedApi.links;\n walkObject(publishedApi, ({value, location, isLeaf}) => {\n if (!isLeaf && value.id && typeof value.id === 'string') {\n value.id = value.id.replace(/.*(node_modules|packages)/, '');\n }\n });\n let branchApi = fs.readJsonSync(pair.branchApi);\n delete branchApi.links;\n walkObject(branchApi, ({value, location, isLeaf}) => {\n if (!isLeaf && value.id && typeof value.id === 'string') {\n value.id = value.id.replace(/.*(node_modules|packages)/, '');\n }\n });\n let diff = changesets.diff(publishedApi, branchApi);\n if (diff.length > 0) {\n count += 1;\n console.log(util.inspect(diff, {depth: null}));\n }\n\n let publishedExports = publishedApi.exports;\n let branchExports = branchApi.exports;\n let addedExports = Object.keys(branchExports).filter(key => !publishedExports[key]);\n let removedExports = Object.keys(publishedExports).filter(key => !branchExports[key]);\n if (addedExports.length > 0) {\n summaryMessages.push({msg: `added exports ${addedExports} to ${pair.branchApi}`, severity: 'warn'});\n }\n if (removedExports.length > 0) {\n summaryMessages.push({msg: `removed exports ${removedExports} from ${pair.branchApi}`, severity: 'error'});\n }\n }\n summaryMessages.forEach(({msg, severity}) => {\n console[severity](chalk[severity === 'warn' ? 'yellow' : 'red'](msg));\n });\n let modulesAdded = branchAPIs.length - publishedAPIs.length;\n if (modulesAdded !== 0) {\n console.log(chalk[modulesAdded > 0 ? 'yellow' : 'red'](`${Math.abs(modulesAdded)} modules ${modulesAdded > 0 ? 'added' : 'removed'}`));\n } else {\n console.log(chalk.green('no modules removed or added'));\n }\n if (count !== 0) {\n console.log(chalk.yellow(`${count} modules had changes to their API`));\n } else {\n console.log(chalk.green('no modules changed their API'));\n }\n}", "function shouldRunUpdater(vni, isStale) { \n // TODO: May add different policies in the future.\n return (!isStale) && haveAllInputs(vni) && dataIsGood(vni);\n}", "function notUsingStashGfpEslintConfig(json) {\n if (json.devDependencies && !json.devDependencies['gfp-eslint-config']) {\n return true;\n }\n}", "function shouldUpdate(newDoc, oldDoc) {\n const [newLines, oldLines] = [newDoc, oldDoc].map(doc => JSON.stringify(doc, null, 2)\n .split('\\n')\n .filter(l => !ignoreLines.test(l))\n .join('\\n'));\n return newLines !== oldLines;\n}", "[_placeDep] (dep, node, edge, peerEntryEdge = null) {\n if (!edge.error && !this[_updateNames].includes(edge.name))\n return []\n\n // top nodes should still get peer deps from their parent or fsParent\n // if possible, and only install locally if there's no other option,\n // eg for a link outside of the project root.\n const start = edge.peer && !node.isRoot\n ? node.resolveParent || node\n : node\n\n let target\n let canPlace = null\n for (let check = start; check; check = check.resolveParent) {\n const cp = this[_canPlaceDep](dep, check, edge, peerEntryEdge)\n // anything other than a conflict is fine to proceed with\n if (cp !== CONFLICT) {\n canPlace = cp\n target = check\n } else\n break\n\n // nest packages like npm v1 and v2\n // very disk-inefficient\n if (this[_legacyBundling])\n break\n }\n\n if (!target) {\n throw Object.assign(new Error('unable to resolve dependency tree'), {\n package: edge.name,\n spec: edge.spec,\n type: edge.type,\n requiredBy: node.package._id,\n location: node.path,\n })\n }\n\n // Can only get KEEP here if the original edge was valid,\n // and we're checking for an update but it's already up to date.\n if (canPlace === KEEP) {\n dep.parent = null\n return []\n }\n\n // figure out which of this node's peer deps will get placed as well\n const virtualRoot = dep.parent\n\n const placed = [dep]\n const oldChild = target.children.get(edge.name)\n if (oldChild) {\n // if we're replacing, we should also remove any nodes for edges that\n // are now invalid, and where this (or its deps) is the only dependent,\n // and also recurse on that pruning. Otherwise leaving that dep node\n // around can result in spurious conflicts pushing nodes deeper into\n // the tree than needed in the case of cycles that will be removed\n // later anyway.\n const oldDeps = []\n for (const [name, edge] of oldChild.edgesOut.entries()) {\n if (!dep.edgesOut.has(name) && edge.to) {\n oldDeps.push(edge.to)\n }\n }\n dep.replace(oldChild)\n this[_pruneForReplacement](dep, oldDeps)\n } else\n dep.parent = target\n\n // If the edge is not an error, then we're updating something, and\n // MAY end up putting a better/identical node further up the tree in\n // a way that causes an unnecessary duplication. If so, remove the\n // now-unnecessary node.\n if (edge.valid && edge.to.parent !== target && dep.canReplace(edge.to)) {\n edge.to.parent = null\n }\n\n // visit any dependents who are upset by this change\n for (const edge of dep.edgesIn) {\n if (!edge.valid)\n this[_depsQueue].push(edge.from)\n }\n\n // in case we just made some duplicates that can be removed,\n // prune anything deeper in the tree that can be replaced by this\n if (this.idealTree) {\n\n for (const node of this.idealTree.inventory.query('name', dep.name)) {\n if (node !== dep &&\n node.isDescendantOf(target) &&\n !node.inShrinkwrap &&\n !node.inBundle &&\n node.canReplaceWith(dep)) {\n\n // don't prune if the is dupe necessary!\n // root (a, d)\n // +-- a (b, c2)\n // | +-- b (c2) <-- place c2 for b, lands at root\n // +-- d (e)\n // +-- e (c1, d)\n // +-- c1\n // +-- f (c2)\n // +-- c2 <-- pruning this would be bad\n\n const mask = node.parent !== target &&\n node.parent.parent !== target &&\n node.parent.parent.resolve(dep.name)\n\n if (!mask || mask === dep || node.canReplaceWith(mask))\n node.parent = null\n }\n }\n }\n\n // also place its unmet or invalid peer deps at this location\n // note that dep has now been removed from the virtualRoot set\n // by virtue of being placed in the target's node_modules.\n if (virtualRoot) {\n for (const peerEdge of dep.edgesOut.values()) {\n if (peerEdge.peer && !peerEdge.valid) {\n const peer = virtualRoot.children.get(peerEdge.name)\n const peerPlaced = this[_placeDep](\n peer, dep, peerEdge, peerEntryEdge || edge)\n placed.push(...peerPlaced)\n }\n }\n }\n\n return placed\n }", "function _CheckDependencies(suppressAlert){\n\n\t\tvar dependencyMap = [\n\t\t\t{ key: 'datatables', name: 'jQuery Datatables plugin', testObject: $.fn.dataTable },\n\t\t\t{ key: 'mapevents', name: 'jQuery Map Events plugin', testObject: $.mapEvents },\n\t\t\t{ key: 'pubsub', name: 'jQuery Pub/Sub plugin', testObject: $.publish },\n\t\t\t{ key: 'bootstrap', name: 'jQuery Bootstrap plugin', testObject: $.fn.modal },\n\t\t\t{ key: 'jqueryui', name: 'jQuery UI', testObject: $.ui }\n\t\t];\n\n\t\t// Perform checks\n\t\tvar missingDependencies = [];\n\t\tvar dependencyResults = {};\n\n\t\tdependencyMap.forEach( function(element, index, array){\n\t\t\tvar hasDependency = true;\n\n\t\t\tif ( typeof element.testObject === 'undefined' ) {\n\t\t\t\tmissingDependencies.push( '-- ' + element.name );\n\t\t\t\thasDependency = false;\n\t\t\t}\n\n\t\t\tdependencyResults[element.key] = hasDependency;\n\n\t\t});\n\n\t\tif ( missingDependencies.length ) {\n\t\t\tvar message = 'The following dependencies are missing in ' + fileName + ': \\r\\n' + missingDependencies.join('\\n');\n\t\t\t(suppressAlert) ? console.log(message) : alert(message) ;\n\t\t}\n\n\t\treturn dependencyResults;\n\t}", "function checkupdates(force) {\n\n // if no updates are available then this\n function BaseMessage() {\n\n setuptools.lightbox.build('muledump-about', 'You are on the latest release.<br>');\n\n }\n\n // build the final message data and display it\n function DisplayMessage() {\n\n setuptools.state.notifier = true;\n setuptools.lightbox.build('muledump-about', ' \\\n <br><a href=\"' + setuptools.config.url + '/CHANGELOG\" class=\"drawhelp docs nostyle\" target=\"_blank\">Changelog</a> | \\\n <a href=\"' + setuptools.config.url + '/\" target=\"_blank\">Muledump Homepage</a> | \\\n <a href=\"https://github.com/jakcodex/muledump\" target=\"_blank\">Github</a> \\\n <br><br>Jakcodex Support Discord - <a href=\"https://discord.gg/JFS5fqW\" target=\"_blank\">https://discord.gg/JFS5fqW</a>\\\n <br><br>Did you know Muledump can be loaded from Github now? \\\n <br><br>Check out <a href=\"' + setuptools.config.url + '/muledump.html\" target=\"_blank\">Muledump Online</a> to see it in action. \\\n ');\n if (setuptools.state.loaded === true && setuptools.data.config.enabled === true) setuptools.lightbox.build('muledump-about', ' \\\n <br><br>Create and download a <a href=\"#\" class=\"setuptools app backups noclose\">backup</a> from here to get online fast. \\\n ');\n\n setuptools.lightbox.override('backups-index', 'goback', function () {\n });\n setuptools.lightbox.settitle('muledump-about', '<strong>Muledump Local v' + VERSION + '</strong>');\n setuptools.lightbox.display('muledump-about', {variant: 'select center'});\n $('.setuptools.app.backups').click(setuptools.app.backups.index);\n $('.drawhelp.docs').click(function (e) {\n setuptools.lightbox.ajax(e, {title: 'About Muledump', url: $(this).attr('href')}, this);\n });\n\n }\n\n // process the github tags api response\n function ProcessResponse(data) {\n\n if (data.meta.status !== 200) {\n\n if (force === true) {\n\n BaseMessage();\n DisplayMessage();\n\n }\n\n return;\n }\n\n if (typeof setuptools.tmp.updatecheck === 'undefined') setuptools.tmp.updatecheck = {\n expires: Date.now() + setuptools.config.updatecheckTTL,\n data: data\n };\n\n // head of renders check\n var currentRendersData = rendersVersion.match(setuptools.config.regex.renderscheck);\n var currentRenders = new Date(currentRendersData[1], currentRendersData[2] - 1, currentRendersData[3], currentRendersData[4], currentRendersData[5], currentRendersData[6]);\n var latestRenders = new Date(currentRendersData[1], currentRendersData[2] - 1, currentRendersData[3], currentRendersData[4], currentRendersData[5], currentRendersData[6]);\n var latestRendersName = currentRendersData[7];\n var latestRendersData;\n\n var d = data.data, topver = VERSION, url;\n for (var i = 0; i < d.length; i++) {\n\n // version check\n if (d[i].name.indexOf('renders-') === -1 && cmpver(d[i].name, topver) > 0) {\n topver = d[i].name;\n url = setuptools.config.githubArchive + topver + '.zip';\n }\n\n // middle of renders check\n var rendersData = d[i].name.match(setuptools.config.regex.renderscheck);\n if (typeof rendersData === 'object' && rendersData !== null) {\n\n var newTimestamp = new Date(rendersData[1], rendersData[2] - 1, rendersData[3], rendersData[4], rendersData[5], rendersData[6]);\n if (newTimestamp > latestRenders) {\n latestRenders = newTimestamp;\n latestRendersName = rendersData[7];\n latestRendersData = d[i];\n }\n\n }\n\n }\n\n // tail of renders check\n if (latestRenders > currentRenders) setuptools.app.muledump.notices.add(\n 'New renders update available for ' + latestRendersName,\n function (d, i, rendersData, currentRendersName, latestRendersName) {\n var arg = $.extend(true, [], latestRendersData, rendersData, {\n currentRenders: currentRendersName,\n latestRenders: latestRendersName\n });\n setuptools.app.assistants.rendersupdate(arg);\n },\n [d, i, rendersData, currentRendersData[7], latestRendersName]\n );\n\n // display the lightbox if a url is provided\n window.techlog(\"Update found: \" + url, 'hide');\n\n var notifiedver = setuptools.storage.read('updatecheck-notifier');\n if (url) setuptools.app.muledump.notices.add(\n 'Muledump v' + topver + ' now available!',\n checkupdates,\n true\n );\n\n if (url && (force === true || (!force && options.updatecheck === true && (typeof notifiedver === 'undefined' || (typeof notifiedver === 'string' && cmpver(notifiedver, topver) > 0))))) {\n\n DoDisplayMessage = true;\n setuptools.lightbox.build('muledump-about', ' \\\n <div style=\"width: 100%; border: #ffffff solid 2px; padding: 10px; background-color: #111;\">\\\n Jakcodex/Muledump v' + topver + ' is now available! \\\n <br><br><a download=\"muledump-' + topver + '.zip\" href=\"' + url + '\">' + url + '</a> \\\n </div>\\\n ');\n\n setuptools.storage.write('updatecheck-notifier', topver);\n\n }\n\n if (force === true && !url) {\n\n DoDisplayMessage = true;\n BaseMessage();\n\n }\n\n if (DoDisplayMessage === true) DisplayMessage();\n\n }\n\n var DoDisplayMessage = false;\n\n // send the request if there is no cached data or the cache has expired\n if (\n typeof setuptools.tmp.updatecheck === 'undefined' ||\n (\n typeof setuptools.tmp.updatecheck === 'object' &&\n Date.now() >= setuptools.tmp.updatecheck.expires\n )\n ) {\n\n // delete any old cache data\n if (typeof setuptools.tmp.updatecheck === 'object') delete setuptools.tmp.updatecheck;\n\n // send the request\n var xhr = $.ajax({\n dataType: 'jsonp',\n url: setuptools.config.updatecheckURL\n });\n\n xhr.fail(function () {\n BaseMessage();\n DoDisplayMessage = true;\n if (DoDisplayMessage === true) DisplayMessage();\n });\n\n xhr.done(ProcessResponse);\n\n }\n // fresh response data located, don't call the api again\n else ProcessResponse(setuptools.tmp.updatecheck.data);\n\n }", "function ensureDeps(dep) {\n\n if (dep in depGraph) {\n // queue all required deps specified in the depGraph first\n var requiredDeps = depGraph[dep];\n for (var i = 0; i < requiredDeps.length; i++)\n ensureDeps(requiredDeps[i]);\n\n }\n\n // if it's already loaded, skip it\n if (loadedDeps.hasOwnProperty(dep) || $.inArray(dep, loadQueue) != -1)\n return;\n\n // else push it to the load queue\n loadQueue.push(dep);\n }", "runInstall(\n {},\n 'install-should-be-idempotent',\n async (config, reporter) => {\n expect(await getPackageVersion(config, 'dep-a')).toEqual('1.0.0');\n },\n null,\n );\n\n return runInstall({}", "function isCheckNeeded(packageFileName) {\n return !manuallyCheckedPackages.includes(packageFileName)\n}", "npmDependencies(fpath, cb) {\n try {\n let unit = bna._parseFile(null, fpath, bna._cache);\n const warnings = _((() => {\n const result = [];\n for (unit of Array.from(bna._flattenRequires(unit))) {\n result.push(unit.warnings);\n }\n return result;\n })()).flatten();\n unit = bna._collapsePackages(unit);\n //log(JSON.stringify(unit,null, \" \"));\n let dependencies = null;\n let externDeps = null;\n\n dependencies = _(unit.requires).reduce(function(memo, unit) {\n if (unit.package) {\n memo[unit.mname] = unit.package.version;\n } else {\n if (unit.isCore) {\n memo[unit.fpath] = null; // required an individual file that's not a main file of a npm package\n } else {\n memo[unit.fpath] = null;\n }\n memo;\n }\n return memo;\n },\n\n {});\n\n externDeps = bna.externDeps(unit);\n //console.log(fpath, \", \", dependencies);\n return cb(null, dependencies, externDeps, unit, warnings);\n } catch (e) {\n return cb(e);\n }\n }", "function upgradeNeeded(requested,installed) {\r\n\t\tvar req = requested.replace(\"v\",\"\").split(\".\");\r\n\t\tvar got = installed.replace(\"v\",\"\").split(\".\");\r\n\t\tvar diff = req.length - got.length;\r\n\t\tif (diff > 0) {\r\n\t\t\tfor(var i = diff;diff>0;diff--) {\r\n\t\t\t\tgot.push(0);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfor(var i = diff;diff<0;diff++) {\r\n\t\t\t\treq.push(0);\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(var p=0;p<req.length;p++) {\r\n\t\t\tif (req[p] == \"x\") return false;\r\n\t\t\tvar r = parseFloat(req[p]);\r\n\t\t\tvar g = parseFloat(got[p]);\r\n\t\t\tif (r > g) return true;\r\n\t\t\tif (r < g) return false;\r\n\t\t\t//if equal compare next figure\r\n\t\t}\r\n\t\treturn false;\r\n}" ]
[ "0.639414", "0.6271797", "0.6222505", "0.6055485", "0.6050687", "0.5780931", "0.57698435", "0.5756768", "0.5727764", "0.5701409", "0.5691746", "0.56767374", "0.5662534", "0.56625015", "0.5588799", "0.55429953", "0.5493228", "0.5476981", "0.5446969", "0.5441043", "0.5437413", "0.54243207", "0.5324899", "0.5284328", "0.52769846", "0.5264189", "0.52617514", "0.5217363", "0.5192698", "0.5190213", "0.5154358", "0.5152693", "0.51422143", "0.5125432", "0.510803", "0.50892127", "0.50889796", "0.506743", "0.50642234", "0.5056697", "0.5056697", "0.505553", "0.5054189", "0.5050577", "0.50496644", "0.503786", "0.5029249", "0.50104284", "0.50038755", "0.49835053", "0.49450445", "0.4945009", "0.49426976", "0.49353588", "0.49274364", "0.49257156", "0.49257156", "0.4923262", "0.4920562", "0.4918247", "0.49154457", "0.49130392", "0.49130392", "0.49130392", "0.49130392", "0.49130392", "0.49130392", "0.49130392", "0.49130392", "0.49130392", "0.49019238", "0.48958662", "0.4875384", "0.48695725", "0.4867381", "0.4859609", "0.48594764", "0.48594764", "0.4857302", "0.48549628", "0.4845904", "0.48329455", "0.48273584", "0.48191255", "0.48140272", "0.48128808", "0.48117447", "0.4811112", "0.4809904", "0.48096687", "0.47984034", "0.47978798", "0.4789369", "0.47890943", "0.47826687", "0.47825235", "0.47772056", "0.47740844", "0.47730792", "0.47666427" ]
0.79547036
0
Updates the package.json given the passed deps and/or devDeps. Only updates if the packages are not yet present
function addDepsToPackageJson(deps, devDeps, addInstall = true) { return (host, context) => { const currentPackageJson = readJsonInTree(host, 'package.json'); if (requiresAddingOfPackages(currentPackageJson, deps, devDeps)) { return schematics_1.chain([ updateJsonInTree('package.json', (json, context) => { json.dependencies = Object.assign(Object.assign(Object.assign({}, (json.dependencies || {})), deps), (json.dependencies || {})); json.devDependencies = Object.assign(Object.assign(Object.assign({}, (json.devDependencies || {})), devDeps), (json.devDependencies || {})); json.dependencies = sortObjectByKeys(json.dependencies); json.devDependencies = sortObjectByKeys(json.devDependencies); return json; }), add_install_task_1.addInstallTask({ skipInstall: !addInstall, }), ]); } else { return schematics_1.noop(); } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function requiresAddingOfPackages(packageJsonFile, deps, devDeps) {\n let needsDepsUpdate = false;\n let needsDevDepsUpdate = false;\n packageJsonFile.dependencies = packageJsonFile.dependencies || {};\n packageJsonFile.devDependencies = packageJsonFile.devDependencies || {};\n if (Object.keys(deps).length > 0) {\n needsDepsUpdate = Object.keys(deps).some((entry) => !packageJsonFile.dependencies[entry]);\n }\n if (Object.keys(devDeps).length > 0) {\n needsDevDepsUpdate = Object.keys(devDeps).some((entry) => !packageJsonFile.devDependencies[entry]);\n }\n return needsDepsUpdate || needsDevDepsUpdate;\n}", "function updatePackageJson() {\n const version = fs.readJSONSync('package.json').version;\n const packageJson = fs.readJSONSync(path.join('docker', 'package.json'));\n\n packageJson.version = version;\n packageJson.dependencies['ng-apimock'] = version;\n\n fs.writeJsonSync(path.join('docker', 'package.json'), packageJson);\n }", "_updatePackage() {\n let dest = this.destinationPath('package.json');\n let template = this.templatePath('dependencies.stub');\n let pkg = program.helpers.readJson(this, dest);\n\n let deps = JSON.parse(program.helpers.readTpl(this, template, {\n relationalDB: program.helpers.isRelationalDB(this.answers.database),\n answers: this.answers\n }));\n\n pkg.dependencies = Object.assign(pkg.dependencies, deps);\n this.fs.writeJSON(dest, pkg);\n }", "writePackageJson(mpath, cb) {\n const semver = require(\"semver\");\n return fs.stat(mpath, function(err, stat) {\n if (err) { return cb(err); }\n const f = stat.isDirectory() ? bna.dir.npmDependencies : bna.npmDependencies;\n return f(mpath, function(err, deps) {\n if (err) { return cb(err); }\n if (stat.isFile()) {\n ({ mpath } = bna.identify(mpath));\n }\n const pkgJsonFile = path.join(mpath, \"package.json\");\n let pkgJson = {};\n if (fs.existsSync(pkgJsonFile)) {\n pkgJson = JSON.parse(fs.readFileSync(pkgJsonFile, \"utf8\"));\n }\n const oldDep = pkgJson.dependencies || {};\n const newdep = {};\n const errList = [];\n // merge into oldDep\n _(deps).each(function(version, name) {\n if (version === null) {\n //errList.push(util.format(\"%s is not versioned!\",name));\n return;\n } else if (!(name in oldDep)) {\n return newdep[name] = version;\n } else { // use semver to check\n const oldVer = oldDep[name];\n if (/:\\/\\//.test(oldVer)) { // test for url pattern\n log(util.format(\"Package %s is ignored due to non-semver %s\", name, oldVer));\n delete oldDep[name];\n return newdep[name] = oldVer; // keep old value\n } else if (!semver.satisfies(version, oldVer)) {\n return errList.push(util.format(\"%s: actual version %s does not satisfy package.json's version %s\", name, version, oldVer));\n } else {\n delete oldDep[name];\n return newdep[name] = oldVer;\n }\n }\n });\n if (errList.length > 0) {\n return cb(new Error(errList.join(\"\\n\")));\n } else {\n pkgJson.dependencies = newdep;\n return fs.writeFile(pkgJsonFile, JSON.stringify(pkgJson, null, 2), \"utf8\", err => cb(err, _(oldDep).keys()));\n }\n });\n });\n }", "function updateUnifiedDeps(pathToUnifiedDeps, pathToNewUnifiedDeps, outputPath) {\n const currentDeps = fs.readFileSync(pathToUnifiedDeps, 'utf8');\n const newDeps = fs.readFileSync(pathToNewUnifiedDeps, 'utf8');\n\n const currentDepsArr = currentDeps.split('\\n');\n const newDepsArr = newDeps.split('\\n');\n const newDepsDict = formatDeps(newDepsArr);\n\n const updatedDeps = [];\n // Tasks that was updated and should be presented in TfsServer.Servicing.core.xml\n const changedTasks = [];\n\n currentDepsArr.forEach(currentDep => {\n const depDetails = currentDep.split('\"');\n const name = depDetails[1];\n\n // find if there is a match in new (ignoring case)\n if (name) {\n const newDepsKey = Object.keys(newDepsDict).find(key => key.toLowerCase() === name.toLowerCase());\n if (newDepsKey && newDepsDict[newDepsKey]) {\n // update the version\n depDetails[3] = newDepsDict[newDepsKey];\n updatedDeps.push(depDetails.join('\"'));\n\n changedTasks.push(newDepsKey);\n delete newDepsDict[newDepsKey];\n } else {\n updatedDeps.push(currentDep);\n console.log(`\"${currentDep}\"`);\n }\n } else {\n updatedDeps.push(currentDep);\n }\n });\n\n // add the new deps from the start\n // working only for generated deps\n\n if (Object.keys(newDepsDict).length > 0) {\n for (let packageName in newDepsDict) {\n // new deps should include old packages completely\n // Example:\n // Mseng.MS.TF.DistributedTask.Tasks.AndroidSigningV2-Node16(packageName) should include \n // Mseng.MS.TF.DistributedTask.Tasks.AndroidSigningV2(basePackageName)\n const depToBeInserted = newDepsArr.find(dep => dep.includes(packageName));\n const pushingIndex = updatedDeps.findIndex(basePackage => {\n if (!basePackage) return false;\n\n const depDetails = basePackage.split('\"');\n const name = depDetails[1];\n return name && name.startsWith(msPrefix) && packageName.includes(name)\n });\n\n if (pushingIndex !== -1) {\n // We need to insert new package after the old one\n updatedDeps.splice(pushingIndex + 1, 0, depToBeInserted);\n changedTasks.push(packageName);\n }\n }\n }\n // write it as a new file where currentDeps is\n fs.writeFileSync(outputPath, updatedDeps.join('\\n'));\n console.log('Updating Unified Dependencies file done.');\n return changedTasks;\n}", "async function mergePackageJsons() {\n // transform our package.json so we can replace variables\n const rawJson = await template.generate({\n directory: `${ignite.ignitePluginPath()}/boilerplate`,\n template: \"package.json.ejs\",\n props: { ...templateProps, kebabName: strings.kebabCase(templateProps.name) },\n })\n const newPackageJson = JSON.parse(rawJson)\n\n // read in the react-native created package.json\n const currentPackage = filesystem.read(\"package.json\", \"json\")\n\n // deep merge, lol\n const newPackage = pipe(\n assoc(\"dependencies\", merge(currentPackage.dependencies, newPackageJson.dependencies)),\n assoc(\n \"devDependencies\",\n merge(\n omit([\"@react-native-community/eslint-config\"], currentPackage.devDependencies),\n newPackageJson.devDependencies,\n ),\n ),\n assoc(\"scripts\", merge(currentPackage.scripts, newPackageJson.scripts)),\n merge(__, omit([\"dependencies\", \"devDependencies\", \"scripts\"], newPackageJson)),\n )(currentPackage)\n\n // write this out\n filesystem.write(\"package.json\", newPackage, { jsonIndent: 2 })\n }", "function updatePackages() {\n\tvar dataDir = getDataDirectory();\n\n\tfs.readdir(dataDir, function(err, files) {\n\t\tfiles.forEach(function(file) {\n\t\t\tvar name = path.basename(file, '.json');\n\n\t\t\tvar infoFilePath = path.join(dataDir, file);\n\t\t\tfs.readFile(infoFilePath, 'utf8', function(err, data) {\n\t\t\t\tif (err) {\n\t\t\t\t\tlog('error', \"could not access data for %s -- skipping\", name);\n\t\t\t\t} else {\n\t\t\t\t\tvar info = JSON.parse(data);\n\t\t\t\t\tretrievePackage(name, info.repo, function(err, result) {\n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\tlog('error', \"failed to update %s\", name);\n\t\t\t\t\t\t} else if (result.retrieved) {\n\t\t\t\t\t\t\tlog('info', \"%s updated successfully\", name);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t})\n\t});\n}", "function syncNpmVersions() {\n return new Promise((resolve, reject) => {\n fs.readFile(`${paths.distNpmPath()}/package.json`, (err, data) => {\n if (err) {\n return reject(err);\n }\n const npmPackage = JSON.parse(data);\n const promises = [\n updatePackageVersion(`./package.json`, npmPackage),\n updatePackageVersion(`./src/package.json`, npmPackage)\n ];\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch(err => {\n reject(err);\n });\n });\n });\n}", "function devDeps (argv, next) {\n const opts = { saveDev: true, cache: true }\n install(argv.devDeps, opts, function (err) {\n if (err) return next(err)\n next()\n })\n}", "async function mergePackageJsons () {\n const rawJson = await template.generate({\n directory: `${PLUGIN_PATH}/boilerplate/src`,\n template: 'package.json.ejs',\n props: {}\n })\n\n\n const newPackageJson = JSON.parse(rawJson)\n const currentPackage = filesystem.read('package.json', 'json')\n\n // deep merge, lol\n const newPackage = pipe(\n assoc(\n 'dependencies',\n merge(currentPackage.dependencies, newPackageJson.dependencies)\n ),\n assoc(\n 'devDependencies',\n merge(currentPackage.devDependencies, newPackageJson.devDependencies)\n ),\n assoc('scripts', merge(currentPackage.scripts, newPackageJson.scripts)),\n merge(\n __,\n omit(['dependencies', 'devDependencies', 'scripts'], newPackageJson)\n )\n )(currentPackage)\n\n // write this out\n filesystem.write('package.json', newPackage, {jsonIndent: 2})\n }", "function packageJSON(cb) {\n const json = Object.assign({}, packageJson);\n delete json['scripts'];\n if (!fs.existsSync(packageDistribution)) {\n fs.mkdirSync(packageDistribution);\n }\n fs.writeFileSync(`${packageDistribution}/package.json`,\n JSON.stringify(json, null, 2));\n cb();\n}", "function patchResDeps() {\n [\"rescript\"].concat(bsconfig[\"bs-dependencies\"]).forEach((bsDep) => {\n fs.writeFileSync(`./node_modules/${bsDep}/index.js`, \"\");\n const json = require(`./node_modules/${bsDep}/package.json`);\n json.main = \"index.js\";\n fs.writeFileSync(\n `./node_modules/${bsDep}/package.json`,\n JSON.stringify(json, null, 2)\n );\n });\n}", "function updateDepModuleVersions () {\n return request.post({\n url: `http://${HOST}/api/DepModuleVersions/add`,\n followAllRedirects: true,\n headers: {\n \"Authorization\": TOKEN\n },\n body: {\n obj: obj\n },\n json: true // Automatically stringifies the body to JSON\n }, (err, res, body) => {\n licenseObj(body);\n check(err, res, body);\n });\n}", "addDevDeps(...deps) {\n for (const dep of deps) {\n this.project.deps.addDependency(dep, deps_1.DependencyType.BUILD);\n }\n }", "function updateOwnDeps () {\n tools.updateOwnDependenciesFromLocalRepositories(args.depth);\n}", "async function updatePackageJSON (version) {\n const filePath = path.resolve(ELECTRON_DIR, 'package.json')\n const file = require(filePath)\n file.version = version\n await writeFile(filePath, JSON.stringify(file, null, 2))\n}", "function devpackages () {\n opts.devpackages = makeArray(argv.dev)\n opts.files.test = true\n opts.install = true\n }", "function packages () {\n opts.packages = makeArray(argv.dep)\n opts.install = true\n }", "function determineDependents({\n releases,\n packagesByName,\n dependencyGraph,\n preInfo,\n config\n}) {\n let updated = false; // NOTE this is intended to be called recursively\n\n let pkgsToSearch = [...releases.values()];\n\n while (pkgsToSearch.length > 0) {\n // nextRelease is our dependency, think of it as \"avatar\"\n const nextRelease = pkgsToSearch.shift();\n if (!nextRelease) continue; // pkgDependents will be a list of packages that depend on nextRelease ie. ['avatar-group', 'comment']\n\n const pkgDependents = dependencyGraph.get(nextRelease.name);\n\n if (!pkgDependents) {\n throw new Error(`Error in determining dependents - could not find package in repository: ${nextRelease.name}`);\n }\n\n pkgDependents.map(dependent => {\n let type;\n const dependentPackage = packagesByName.get(dependent);\n if (!dependentPackage) throw new Error(\"Dependency map is incorrect\");\n\n if (config.ignore.includes(dependent)) {\n type = \"none\";\n } else {\n const dependencyVersionRanges = getDependencyVersionRanges(dependentPackage.packageJson, nextRelease.name);\n\n for (const {\n depType,\n versionRange\n } of dependencyVersionRanges) {\n if (shouldBumpMajor({\n dependent,\n depType,\n versionRange,\n releases,\n nextRelease,\n preInfo,\n onlyUpdatePeerDependentsWhenOutOfRange: config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.onlyUpdatePeerDependentsWhenOutOfRange\n })) {\n type = \"major\";\n } else {\n if ( // TODO validate this - I don't think it's right anymore\n (!releases.has(dependent) || releases.get(dependent).type === \"none\") && (config.___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH.updateInternalDependents === \"always\" || !semver__default['default'].satisfies(incrementVersion(nextRelease, preInfo), // to deal with a * versionRange that comes from workspace:* dependencies as the wildcard will match anything\n versionRange === \"*\" ? nextRelease.oldVersion : versionRange))) {\n switch (depType) {\n case \"dependencies\":\n case \"optionalDependencies\":\n case \"peerDependencies\":\n if (type !== \"major\" && type !== \"minor\") {\n type = \"patch\";\n }\n\n break;\n\n case \"devDependencies\":\n {\n // We don't need a version bump if the package is only in the devDependencies of the dependent package\n if (type !== \"major\" && type !== \"minor\" && type !== \"patch\") {\n type = \"none\";\n }\n }\n }\n }\n }\n }\n }\n\n if (releases.has(dependent) && releases.get(dependent).type === type) {\n type = undefined;\n }\n\n return {\n name: dependent,\n type,\n pkgJSON: dependentPackage.packageJson\n };\n }).filter(({\n type\n }) => type).forEach( // @ts-ignore - I don't know how to make typescript understand that the filter above guarantees this and I got sick of trying\n ({\n name,\n type,\n pkgJSON\n }) => {\n // At this point, we know if we are making a change\n updated = true;\n const existing = releases.get(name); // For things that are being given a major bump, we check if we have already\n // added them here. If we have, we update the existing item instead of pushing it on to search.\n // It is safe to not add it to pkgsToSearch because it should have already been searched at the\n // largest possible bump type.\n\n if (existing && type === \"major\" && existing.type !== \"major\") {\n existing.type = \"major\";\n pkgsToSearch.push(existing);\n } else {\n let newDependent = {\n name,\n type,\n oldVersion: pkgJSON.version,\n changesets: []\n };\n pkgsToSearch.push(newDependent);\n releases.set(name, newDependent);\n }\n });\n }\n\n return updated;\n}", "function checkDependencies() {\n console.log('Reading package.json'.green);\n fs.readFile('./package.json', (err, data) => {\n const pkgJson = JSON.parse(data);\n for (let dependency in pkgJson.dependencies) {\n // console.log(dependency);\n for (let package of packages) {\n if (dependency === package) {\n\n let index = packages.indexOf(package);\n console.log(index, dependency + ' already exist! '.yellow);\n packages.splice(index, 1);\n }\n }\n }\n // console.log(packages.length);\n if (packages.length == 0) {\n console.log('All dependencies are already exist skipping installation process!'.rainbow);\n updateAngularJson();\n } else {\n installDependencies();\n }\n });\n\n\n}", "function updatePackageJson() {\n return (tree, context) => {\n logging_1.logInfoWithDescriptor('Aktualisiere LUX-Components Version auf 1.8.5.');\n return util_1.waitForTreeCallback(tree, () => {\n const newDependency = {\n type: dependencies_1.NodeDependencyType.Default,\n version: '1.8.5',\n name: '@ihk-gfi/lux-components'\n };\n dependencies_1.updatePackageJsonDependency(tree, context, newDependency);\n logging_1.logSuccess(`package.json erfolgreich aktualisiert.`);\n return tree;\n });\n };\n}", "function addPackageToPackageJson(tree, type, pkg, version) {\n if (tree.exists('package.json')) {\n const sourceText = tree.read('package.json').toString('utf-8');\n const json = JSON.parse(sourceText);\n if (!json[type]) {\n json[type] = {};\n }\n if (!json[type][pkg]) {\n json[type][pkg] = version;\n }\n tree.overwrite('package.json', JSON.stringify(json, null, 2));\n }\n return tree;\n}", "_mergeChangedPackageJsonProps(packageJson) {\n if (!this.component.packageJsonChangedProps) return;\n\n const valuesToMerge = this._replaceDistPathTemplateWithCalculatedDistPath(packageJson);\n\n packageJson.mergePackageJsonObject(valuesToMerge);\n }", "function createDefaultPackageJsonIfRequired(dependencyName, version) {\n const packageJsonPath = path.join(scopedNodeModulesDirectory, dependencyName, packageJson);\n if (!fs.existsSync(packageJsonPath)) {\n const packageJsonContents = {\n name: \"@morgan-stanley/\" + dependencyName,\n version: version,\n description: \"Generated automatically by \" + path.basename(__filename)\n };\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContents, null, 2));\n }\n}", "function adjustPackageJSON(generator) {\n const packageJSONStorage = generator.createStorage('server/package.json');\n const dependenciesStorage = packageJSONStorage.createStorage('dependencies');\n const dependabotPackageJSON = utils.getDependabotPackageJSON(generator, true);\n\n dependenciesStorage.set('@nestjs/graphql', dependabotPackageJSON.dependencies['@nestjs/graphql']);\n dependenciesStorage.set('graphql', dependabotPackageJSON.dependencies.graphql);\n dependenciesStorage.set('graphql-tools', dependabotPackageJSON.dependencies['graphql-tools']);\n dependenciesStorage.set('graphql-subscriptions', dependabotPackageJSON.dependencies['graphql-subscriptions']);\n dependenciesStorage.set('apollo-server-express', dependabotPackageJSON.dependencies['apollo-server-express']);\n\n const scriptsStorage = packageJSONStorage.createStorage('scripts');\n scriptsStorage.set('start:dev', 'npm run copy-resources && nest start -w');\n scriptsStorage.set('start:nest', 'npm run copy-resources && nest start');\n scriptsStorage.set('build:schema-gql', 'ts-node scripts/build-schema.ts');\n packageJSONStorage.save();\n}", "function patchBump() {\n return gulp.src([\n './package.json',\n './bower.json'\n ]).pipe(bump({type: 'patch'}))\n .pipe(gulp.dest('./'));\n}", "function setPackageVersion(cb) {\n if (version !== release) {\n // bump version without committing and tagging\n // await execa('npm', ['version', release, '--no-git-tag-version'], {stdio})\n src('./package.json')\n .pipe(jeditor({ 'version': release } ) )\n .pipe(dest('.') )\n } else {\n console.log('setPackageVersion: Requested version is same as current version - nothing will change')\n }\n cb()\n}", "async function reinstallDependencies() {\n if (!currentlyRunningCommand) {\n isLiveReloadPaused = true;\n messageBus.emit('INSTALLING');\n currentlyRunningCommand = command(installCommandOptions);\n await currentlyRunningCommand.then(async () => {\n dependencyImportMap = JSON.parse(await fs.promises.readFile(dependencyImportMapLoc, {\n encoding: 'utf-8'\n }).catch(() => `{\"imports\": {}}`));\n await updateLockfileHash(DEV_DEPENDENCIES_DIR);\n await cacache.rm.all(BUILD_CACHE);\n inMemoryBuildCache.clear();\n messageBus.emit('INSTALL_COMPLETE');\n isLiveReloadPaused = false;\n currentlyRunningCommand = null;\n });\n }\n }", "function warnForPackageDependencies({\n dependencies,\n consumer,\n installNpmPackages\n}) {\n const warnings = {\n notInPackageJson: [],\n notInNodeModules: [],\n notInBoth: []\n };\n if (installNpmPackages) return Promise.resolve(warnings);\n const projectDir = consumer.getPath();\n\n const getPackageJson = dir => {\n try {\n return _fsExtra().default.readJSONSync(path().join(dir, 'package.json'));\n } catch (e) {\n return {};\n } // do we want to inform the use that he has no package.json\n\n };\n\n const packageJson = getPackageJson(projectDir);\n const packageJsonDependencies = (0, _merge2().default)(packageJson.dependencies || {}, packageJson.devDependencies || {});\n\n const getNameAndVersion = pj => ({\n [pj.name]: pj.version\n });\n\n const nodeModules = (0, _mergeAll2().default)(_glob().default.sync(path().join(projectDir, 'node_modules', '*')).map((0, _compose2().default)(getNameAndVersion, getPackageJson))); // eslint-disable-next-line\n\n dependencies.forEach(dep => {\n if (!dep.packageDependencies || (0, _isEmpty2().default)(dep.packageDependencies)) return null;\n (0, _forEachObjIndexed2().default)((packageDepVersion, packageDepName) => {\n const packageDep = {\n [packageDepName]: packageDepVersion\n };\n const compatibleWithPackgeJson = compatibleWith(packageDep, packageJsonDependencies);\n const compatibleWithNodeModules = compatibleWith(packageDep, nodeModules);\n\n if (!compatibleWithPackgeJson && !compatibleWithNodeModules && !(0, _contains2().default)(packageDep, warnings.notInBoth)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n warnings.notInBoth.push(packageDep);\n }\n\n if (!compatibleWithPackgeJson && compatibleWithNodeModules && !(0, _contains2().default)(packageDep, warnings.notInPackageJson)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n warnings.notInPackageJson.push(packageDep);\n }\n\n if (compatibleWithPackgeJson && !compatibleWithNodeModules && !(0, _contains2().default)(packageDep, warnings.notInNodeModules)) {\n // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!\n warnings.notInNodeModules.push(packageDep);\n }\n }, dep.packageDependencies);\n }); // Remove duplicates warnings for missing packages\n\n warnings.notInBoth = (0, _uniq2().default)(warnings.notInBoth);\n return Promise.resolve(warnings);\n}", "function verBump () {\n const { version: currentVersion, versions } = npmGetJson();\n const [version, tag] = currentVersion.split('-');\n const [,, patch] = version.split('.');\n const lastVersion = versions?.npm || currentVersion;\n\n if (argv['skip-beta'] || patch === '0') {\n // don't allow beta versions\n execSync('yarn polkadot-dev-version patch');\n withNpm = true;\n } else if (tag || currentVersion === lastVersion) {\n // if we don't want to publish, add an X before passing\n if (!withNpm) {\n npmAddVersionX();\n } else {\n npmDelVersionX();\n }\n\n // beta version, just continue the stream of betas\n execSync('yarn polkadot-dev-version pre');\n } else {\n // manually set, got for publish\n withNpm = true;\n }\n\n // always ensure we have made some changes, so we can commit\n npmSetVersionFields();\n rmFile('.123trigger');\n\n execSync('yarn polkadot-dev-contrib');\n execSync('git add --all .');\n}", "function bump(callback) {\n var\n log = 'bump to ' + config.newVersion,\n pkg = grunt.file.readJSON(PACKAGE_JSON);\n\n if (noWrite) {\n grunt.log.ok('[dry-run]: ' + log);\n return callback();\n } else {\n grunt.log.ok(log);\n pkg.version = config.newVersion;\n fs.writeFile(PACKAGE_JSON,\n JSON.stringify(pkg, null, NB_SPACES_FOR_TAB) + '\\n',\n function (err) {\n callback(err);\n });\n }\n }", "async function updateOpenapiValidatorPck() {\n const packagePath = `packages/azure-openapi-validator/autorest/package.json`\n const pkg = await readJsonFile(packagePath)\n pkg.dependencies[\"@microsoft.azure/openapi-validator-core\"] = \"beta\"\n pkg.dependencies[\"@microsoft.azure/openapi-validator-rulesets\"] = \"beta\"\n await writeFile(packagePath,JSON.stringify(pkg,null,2))\n}", "function onOutdatedFn ( error_data, update_table ) {\n var\n solve_map = {},\n update_count = update_table.length,\n\n idx, row_list,\n package_name, current_str, target_str\n ;\n\n if ( error_data ) { return failFn( error_data ); }\n\n if ( update_count === 0 ) {\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'No package changes' );\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n\n // Invalidate all these stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap, [\n 'install', 'setup', 'dev_test', 'dev_lint',\n 'dev_cover', 'dev_commit', 'build'\n ]);\n\n // Load post-install methods\n xhiObj.loadLibsFn();\n postObj = xhiObj.makePostObj();\n\n // Begin aggregate changes and merge\n for ( idx = 0; idx < update_count; idx++ ) {\n row_list = update_table[ idx ];\n package_name = row_list[ 1 ];\n current_str = row_list[ 2 ];\n target_str = row_list[ 4 ];\n solve_map[ package_name ] = target_str;\n logFn(\n 'Update ' + package_name + ' from '\n + current_str + ' to ' + target_str\n );\n }\n Object.assign( packageMatrix.devDependencies, solve_map );\n // . End Aggregate changes an merge\n\n // Save to package file\n postObj.writePkgFileFn(\n function _onWriteFn ( error_data ) {\n if ( error_data ) { return failFn( error_data ); }\n\n // Mark install and setup as 'out of date'\n stageStatusMap.install = false;\n stageStatusMap.setup = false;\n\n // Store success and finish\n // A successful update invalidates all prior stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap );\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n );\n }", "function writePackageJson(results) {\n if (results.packageRepo.length > 0) {\n remote = results.packageRepo;\n }\n return fsp.readFile(path.join(__dirname, 'finalPackage.json'), 'utf-8')\n .then((contents) => {\n return contents\n .replace(\n /<packageName>/gi,\n results.packageName || defaultName\n )\n .replace(\n /<packageDesc>/gi,\n results.packageDesc || defaultDesc\n )\n .replace(\n /<packageVersion>/gi,\n results.packageVersion || defaultVersion\n )\n .replace(\n /<packageAuthor>/gi,\n results.packageAuthor || defaultAuthor\n )\n .replace(\n /<packageLicense>/gi,\n results.packageLicense || defaultLicense\n )\n .replace(\n /<packageRepo>/gi,\n results.packageRepo\n )\n .replace(\n / +\"repository\": \"\",\\n/gi,\n ''\n );\n })\n .then((contents) => {\n fsp.writeFile(path.join(__dirname, 'package.json'), contents);\n });\n}", "async function copyPackageJson() {\n const packageJson = await fsExtra.readFile(path.resolve(__dirname, '../package.json'), 'utf8');\n const { scripts, devDependencies, files, ...packageDataOther } = JSON.parse(packageJson);\n\n const newPackageJson = {\n ...packageDataOther,\n main: './index.js',\n module: './index.es.js',\n };\n\n const output = path.resolve(__dirname, '../dist/package.json');\n\n await fsExtra.writeFile(output, JSON.stringify(newPackageJson, null, 2), 'utf8');\n console.log(`Created ${output}`);\n}", "async function upgradePackageDefinitions(currentDependencies, options) {\n const latestVersionResults = await (0, queryVersions_1.default)(currentDependencies, options);\n const latestVersions = (0, keyValueBy_1.default)(latestVersionResults, (dep, result) => (result === null || result === void 0 ? void 0 : result.version) && filterResultsByUserFunction(dep, currentDependencies, result.version, options)\n ? {\n [dep]: result.version,\n }\n : null);\n const upgradedDependencies = (0, upgradeDependencies_1.default)(currentDependencies, latestVersions, options);\n const filteredUpgradedDependencies = (0, pickBy_1.default)(upgradedDependencies, (v, dep) => {\n return !options.jsonUpgraded || !options.minimal || !(0, semver_1.satisfies)(latestVersions[dep], currentDependencies[dep]);\n });\n if (options.peer && !(0, isEmpty_1.default)(filteredUpgradedDependencies)) {\n const upgradedPeerDependencies = await (0, getPeerDependenciesFromRegistry_1.default)(filteredUpgradedDependencies, options);\n const peerDependencies = { ...options.peerDependencies, ...upgradedPeerDependencies };\n if (!(0, isEqual_1.default)(options.peerDependencies, peerDependencies)) {\n const [newUpgradedDependencies, newLatestVersions, newPeerDependencies] = await upgradePackageDefinitions({ ...currentDependencies, ...filteredUpgradedDependencies }, { ...options, peerDependencies, loglevel: 'silent' });\n return [\n { ...filteredUpgradedDependencies, ...newUpgradedDependencies },\n { ...latestVersionResults, ...newLatestVersions },\n newPeerDependencies,\n ];\n }\n }\n return [filteredUpgradedDependencies, latestVersionResults, options.peerDependencies];\n}", "function setUserRequestedPackageVersions(\n deps: Array<Dependency>,\n args: Array<string>,\n latest: boolean,\n packagePatterns,\n reporter: Reporter,\n) {\n args.forEach(requestedPattern => {\n let found = false;\n let normalized = normalizePattern(requestedPattern);\n\n // if the user specified a package name without a version range, then that implies \"latest\"\n // but if the latest flag is not passed then we need to use the version range from package.json\n if (!normalized.hasVersion && !latest) {\n packagePatterns.forEach(packagePattern => {\n const packageNormalized = normalizePattern(packagePattern.pattern);\n if (packageNormalized.name === normalized.name) {\n normalized = packageNormalized;\n }\n });\n }\n\n const newPattern = `${normalized.name}@${normalized.range}`;\n\n // if this dependency is already in the outdated list,\n // just update the upgradeTo to whatever version the user requested.\n deps.forEach(dep => {\n if (normalized.hasVersion && dep.name === normalized.name) {\n found = true;\n dep.upgradeTo = newPattern;\n reporter.verbose(reporter.lang('verboseUpgradeBecauseRequested', requestedPattern, newPattern));\n }\n });\n\n // if this dependency was not in the outdated list,\n // then add a new entry\n if (normalized.hasVersion && !found) {\n deps.push({\n name: normalized.name,\n wanted: '',\n latest: '',\n url: '',\n hint: '',\n range: '',\n current: '',\n upgradeTo: newPattern,\n workspaceName: '',\n workspaceLoc: '',\n });\n reporter.verbose(reporter.lang('verboseUpgradeBecauseRequested', requestedPattern, newPattern));\n }\n });\n}", "function depUpdate(depName, depData) {\n del(depData.base).then(() => {\n if (depData.min) {\n return gulp\n .src(depData.src)\n .pipe(uglify({ output: { comments: \"/^!/\" } }))\n .pipe(rename({ suffix: \".min\" }))\n .pipe(gulp.dest(depData.dest));\n } else if (depData.minclean) {\n return gulp\n .src(depData.src)\n .pipe(strip({ safe: true }))\n .pipe(gulp.dest(depData.dest));\n } else {\n return gulp.src(depData.src).pipe(gulp.dest(depData.dest));\n }\n });\n}", "function getAllAfsDependenciesFromPackageJson() {\n const projectPackageJsonPath = path.join(__dirname, \"package.json\");\n const packageJsonContent = require(projectPackageJsonPath);\n return Object.assign(packageJsonContent.afsDependencies || {}, packageJsonContent.afsDevDependencies || {});\n}", "[_placeDep] (dep, node, edge, peerEntryEdge = null) {\n if (!edge.error && !this[_updateNames].includes(edge.name))\n return []\n\n // top nodes should still get peer deps from their parent or fsParent\n // if possible, and only install locally if there's no other option,\n // eg for a link outside of the project root.\n const start = edge.peer && !node.isRoot\n ? node.resolveParent || node\n : node\n\n let target\n let canPlace = null\n for (let check = start; check; check = check.resolveParent) {\n const cp = this[_canPlaceDep](dep, check, edge, peerEntryEdge)\n // anything other than a conflict is fine to proceed with\n if (cp !== CONFLICT) {\n canPlace = cp\n target = check\n } else\n break\n\n // nest packages like npm v1 and v2\n // very disk-inefficient\n if (this[_legacyBundling])\n break\n }\n\n if (!target) {\n throw Object.assign(new Error('unable to resolve dependency tree'), {\n package: edge.name,\n spec: edge.spec,\n type: edge.type,\n requiredBy: node.package._id,\n location: node.path,\n })\n }\n\n // Can only get KEEP here if the original edge was valid,\n // and we're checking for an update but it's already up to date.\n if (canPlace === KEEP) {\n dep.parent = null\n return []\n }\n\n // figure out which of this node's peer deps will get placed as well\n const virtualRoot = dep.parent\n\n const placed = [dep]\n const oldChild = target.children.get(edge.name)\n if (oldChild) {\n // if we're replacing, we should also remove any nodes for edges that\n // are now invalid, and where this (or its deps) is the only dependent,\n // and also recurse on that pruning. Otherwise leaving that dep node\n // around can result in spurious conflicts pushing nodes deeper into\n // the tree than needed in the case of cycles that will be removed\n // later anyway.\n const oldDeps = []\n for (const [name, edge] of oldChild.edgesOut.entries()) {\n if (!dep.edgesOut.has(name) && edge.to) {\n oldDeps.push(edge.to)\n }\n }\n dep.replace(oldChild)\n this[_pruneForReplacement](dep, oldDeps)\n } else\n dep.parent = target\n\n // If the edge is not an error, then we're updating something, and\n // MAY end up putting a better/identical node further up the tree in\n // a way that causes an unnecessary duplication. If so, remove the\n // now-unnecessary node.\n if (edge.valid && edge.to.parent !== target && dep.canReplace(edge.to)) {\n edge.to.parent = null\n }\n\n // visit any dependents who are upset by this change\n for (const edge of dep.edgesIn) {\n if (!edge.valid)\n this[_depsQueue].push(edge.from)\n }\n\n // in case we just made some duplicates that can be removed,\n // prune anything deeper in the tree that can be replaced by this\n if (this.idealTree) {\n\n for (const node of this.idealTree.inventory.query('name', dep.name)) {\n if (node !== dep &&\n node.isDescendantOf(target) &&\n !node.inShrinkwrap &&\n !node.inBundle &&\n node.canReplaceWith(dep)) {\n\n // don't prune if the is dupe necessary!\n // root (a, d)\n // +-- a (b, c2)\n // | +-- b (c2) <-- place c2 for b, lands at root\n // +-- d (e)\n // +-- e (c1, d)\n // +-- c1\n // +-- f (c2)\n // +-- c2 <-- pruning this would be bad\n\n const mask = node.parent !== target &&\n node.parent.parent !== target &&\n node.parent.parent.resolve(dep.name)\n\n if (!mask || mask === dep || node.canReplaceWith(mask))\n node.parent = null\n }\n }\n }\n\n // also place its unmet or invalid peer deps at this location\n // note that dep has now been removed from the virtualRoot set\n // by virtue of being placed in the target's node_modules.\n if (virtualRoot) {\n for (const peerEdge of dep.edgesOut.values()) {\n if (peerEdge.peer && !peerEdge.valid) {\n const peer = virtualRoot.children.get(peerEdge.name)\n const peerPlaced = this[_placeDep](\n peer, dep, peerEdge, peerEntryEdge || edge)\n placed.push(...peerPlaced)\n }\n }\n }\n\n return placed\n }", "function collectDependencies() {\n\tlet pkg;\n\ttry {\n\t\tpkg = {\n\t\t\texports: {}\n\t\t};\n\t\tpkgInfo(pkg, {\n\t\t\tdir: cwd,\n\t\t\tinclude: [\"name\", \"version\", \"dependencies\", \"devDependencies\"]\n\t\t});\n\n\t} catch (e) {\n\t\tconsole.log(chalk.redBright(\"No package.json found. Abort\"));\n\t\tprocess.exit(1); // Exit early if no package.json, since there's no point to continue\n\t}\n\treturn pkg;\n}", "function npmUpdate( repo, callback, errCallback ) {\n 'use strict';\n \n execute( 'npm', [ 'update' ], rootDir + repo, callback, errCallback );\n}", "function loadDevDependencies() {\n var packageJson = grunt.file.readJSON(consts.packageJson);\n var tasks = packageJson.devDependencies || {};\n var prefix = consts.gruntPrefix;\n\n Object.keys(tasks).forEach(function(task) {\n if (task.indexOf(prefix) === 0) {\n grunt.loadNpmTasks(task)\n }\n });\n}", "npmDependencies(fpath, cb) {\n try {\n let unit = bna._parseFile(null, fpath, bna._cache);\n const warnings = _((() => {\n const result = [];\n for (unit of Array.from(bna._flattenRequires(unit))) {\n result.push(unit.warnings);\n }\n return result;\n })()).flatten();\n unit = bna._collapsePackages(unit);\n //log(JSON.stringify(unit,null, \" \"));\n let dependencies = null;\n let externDeps = null;\n\n dependencies = _(unit.requires).reduce(function(memo, unit) {\n if (unit.package) {\n memo[unit.mname] = unit.package.version;\n } else {\n if (unit.isCore) {\n memo[unit.fpath] = null; // required an individual file that's not a main file of a npm package\n } else {\n memo[unit.fpath] = null;\n }\n memo;\n }\n return memo;\n },\n\n {});\n\n externDeps = bna.externDeps(unit);\n //console.log(fpath, \", \", dependencies);\n return cb(null, dependencies, externDeps, unit, warnings);\n } catch (e) {\n return cb(e);\n }\n }", "async function runLocal(options, pkgData, pkgFile) {\n (0, logging_1.print)(options, '\\nOptions:', 'verbose');\n (0, logging_1.printOptionsSorted)(options, 'verbose');\n let pkg;\n try {\n if (!pkgData) {\n (0, programError_1.default)(options, 'Missing package data');\n }\n else {\n // strip comments from jsonc files\n const pkgDataStripped = (pkgFile === null || pkgFile === void 0 ? void 0 : pkgFile.endsWith('.jsonc')) && pkgData ? (await import('strip-json-comments')).default(pkgData) : pkgData;\n pkg = json_parse_helpfulerror_1.default.parse(pkgDataStripped);\n }\n }\n catch (e) {\n (0, programError_1.default)(options, `Invalid package file${pkgFile ? `: ${pkgFile}` : ' from stdin'}. Error details:\\n${e.message}`);\n }\n const current = (0, getCurrentDependencies_1.default)(pkg, options);\n (0, logging_1.print)(options, '\\nCurrent versions:', 'verbose');\n (0, logging_1.print)(options, current, 'verbose');\n if (options.enginesNode) {\n options.nodeEngineVersion = (0, get_1.default)(pkg, 'engines.node');\n }\n if (options.peer) {\n options.peerDependencies = await (0, getPeerDependencies_1.default)(current, options);\n }\n const [upgraded, latestResults, upgradedPeerDependencies] = await (0, upgradePackageDefinitions_1.default)(current, options);\n const latest = (0, keyValueBy_1.default)(latestResults, (key, result) => (result.version ? { [key]: result.version } : null));\n const errors = (0, keyValueBy_1.default)(latestResults, (key, result) => (result.error ? { [key]: result.error } : null));\n const time = (0, keyValueBy_1.default)(latestResults, (key, result) => (result.time ? { [key]: result.time } : null));\n if (options.peer) {\n (0, logging_1.print)(options, '\\nupgradedPeerDependencies:', 'verbose');\n (0, logging_1.print)(options, upgradedPeerDependencies, 'verbose');\n }\n (0, logging_1.print)(options, `\\n${typeof options.target === 'string' ? `${options.target[0].toUpperCase()}${options.target.slice(1)}` : 'Fetched'} versions:`, 'verbose');\n (0, logging_1.print)(options, latest, 'verbose');\n (0, logging_1.print)(options, '\\nUpgraded versions:', 'verbose');\n (0, logging_1.print)(options, upgraded, 'verbose');\n // filter out satisfied deps when using --minimal\n const filteredUpgraded = options.minimal\n ? (0, keyValueBy_1.default)(upgraded, (dep, version) => (!(0, semver_1.satisfies)(latest[dep], current[dep]) ? { [dep]: version } : null))\n : upgraded;\n const ownersChangedDeps = (options.format || []).includes('ownerChanged')\n ? await getOwnerPerDependency(current, filteredUpgraded, options)\n : undefined;\n const chosenUpgraded = options.interactive\n ? await chooseUpgrades(current, filteredUpgraded, options)\n : filteredUpgraded;\n if (!options.json || options.deep) {\n await (0, logging_1.printUpgrades)(\n // in interactive mode, do not group upgrades afterwards since the prompts are grouped\n options.interactive\n ? { ...options, format: (options.format || []).filter(formatType => formatType !== 'group') }\n : options, {\n current,\n upgraded: chosenUpgraded,\n total: Object.keys(upgraded).length,\n latest: latestResults,\n ownersChangedDeps,\n errors,\n time,\n });\n if (options.peer) {\n const ignoredUpdates = await (0, getIgnoredUpgrades_1.default)(current, upgraded, upgradedPeerDependencies, options);\n if (!(0, isEmpty_1.default)(ignoredUpdates)) {\n (0, logging_1.printIgnoredUpdates)(options, ignoredUpdates);\n }\n }\n }\n const newPkgData = await (0, upgradePackageData_1.default)(pkgData, current, chosenUpgraded, options);\n const output = options.jsonAll\n ? json_parse_helpfulerror_1.default.parse(newPkgData)\n : options.jsonDeps\n ? (0, pick_1.default)(json_parse_helpfulerror_1.default.parse(newPkgData), (0, resolveDepSections_1.default)(options.dep))\n : chosenUpgraded;\n // will be overwritten with the result of fs.writeFile so that the return promise waits for the package file to be written\n let writePromise = Promise.resolve();\n if (options.json && !options.deep) {\n (0, logging_1.printJson)(options, output);\n }\n if (Object.keys(filteredUpgraded).length > 0) {\n // if there is a package file, write the new package data\n // otherwise, suggest ncu -u\n if (pkgFile) {\n if (options.upgrade) {\n // do not await until the end\n writePromise = promises_1.default.writeFile(pkgFile, newPkgData);\n }\n else {\n const ncuCmd = process.env.npm_lifecycle_event === 'npx' ? 'npx npm-check-updates' : 'ncu';\n // quote arguments with spaces\n const argv = process.argv\n .slice(2)\n .map(arg => (arg.includes(' ') ? `\"${arg}\"` : arg))\n .join(' ');\n const ncuOptions = argv ? ' ' + argv : argv;\n const upgradeHint = `\\nRun ${chalk_1.default.cyan(`${ncuCmd}${ncuOptions} -u`)} to upgrade ${options.packageFile || 'package.json'}`;\n (0, logging_1.print)(options, upgradeHint);\n }\n }\n // if errorLevel is 2, exit with non-zero error code\n if (options.errorLevel === 2) {\n writePromise.then(() => {\n (0, programError_1.default)(options, '\\nDependencies not up-to-date');\n });\n }\n }\n await writePromise;\n return output;\n}", "function transitiveDependencies(pkg, cache) {\n if (cache.has(pkg)) {\n return;\n }\n cache.add(pkg);\n // Some packages do interesing things with their exports, so requiring\n // pkg/package.json does not always work.\n try {\n let { dependencies = {} } = require(`${pkg}/package.json`);\n for (dep of Object.keys(dependencies)) {\n transitiveDependencies(dep, cache);\n }\n } catch (e) {\n // Do not worry about dependencies we cannot add\n }\n}", "function updateApp(watcher, app, outfilePattern, isProd, changedFiles){\n if(changedFiles){\n // Only lint JavaScript, not JSON\n let filesToLint = _.filter(changedFiles, function(file){\n return file.indexOf('.json') === -1;\n });\n\n lintFiles(filesToLint);\n }\n\n bundleApp(watcher, app, outfilePattern, isProd);\n}", "[_applyUserRequests] (options) {\n // these just add and remove to/from the root node\n // but both mean we have to do a full walk, not just fixing problems\n // and stopping when we no longer see any problems.\n if (options.add || options.rm)\n this[_addRm](options)\n\n // get the list of deps that we're explicitly requesting, so that\n // 'npm install foo' will reinstall, even if we already have it.\n if (options.add) {\n for (const [type, specs] of Object.entries(options.add)) {\n if (type === 'dependencies' || type === 'devDependencies' ||\n type === 'optionalDependencies' || type === 'peerDependencies') {\n for (const name of Object.keys(options.add[type])) {\n this[_explicitRequests].add(name)\n }\n }\n }\n }\n\n // If we have a list of package names to update, and we know it's\n // going to update them wherever they are, add any paths into those\n // named nodes to the buildIdealTree queue.\n if (this[_updateNames].length)\n this[_queueNamedUpdates]()\n }", "_addDependentsToPackage (packageNode, depObj, type) {\n Object.keys(depObj).forEach(dependencyName => {\n if (this.packageStore.hasOwnProperty(dependencyName)) {\n // packageNode has a dependency of dependencyName - therefore dependencyName is dependent on packageNode\n const dependentPackageNode = this.packageStore[dependencyName];\n const version = depObj[dependencyName];\n dependentPackageNode.addDependent(packageNode.name, new DependentLinkNode({\n type, version, packageNode\n }));\n }\n });\n }", "function setPackageLockVersion(cb) {\n if (version !== release) {\n src('./package-lock.json')\n .pipe(jeditor({ 'version': release } ) )\n .pipe(dest('.') )\n }\n cb()\n}", "function createPackage(next) {\n var pkg = JSON.parse(fs.readFileSync(path.join(scaffold, 'package.json'), 'utf8'));\n\n pkg.name = name;\n pkg.dependencies.flatiron = flatiron.version;\n\n app.log.info('Writing ' + 'package.json'.grey);\n fs.writeFile(path.join(root, 'package.json'), JSON.stringify(pkg, null, 2) + '\\n', next);\n }", "function installDeps() {\n exec('node --version', function (err, stdout, stderr) {\n const nodeVersion = stdout && parseFloat(stdout.substring(1));\n if (nodeVersion < 5 || err) {\n installDepsCallback(err || 'Unsupported node.js version, make sure you have the latest version installed.');\n } else {\n exec('yarn --version', function (err, stdout, stderr) {\n if (parseFloat(stdout) < 0.15 || err || process.env.USE_YARN === 'false') {\n process.stdout.write('yarn not found, normal npm i');\n process.stdout.write(chalk.yellow('\\nnpm installing...'));\n exec('npm install', addCheckMark.bind(null, installDepsCallback));\n } else {\n process.stdout.write(chalk.yellow('\\nyarn installing...'));\n exec('yarn install', addCheckMark.bind(null, installDepsCallback));\n }\n });\n }\n });\n}", "_mergePackageJsonPropsFromOverrides(packageJson) {\n const valuesToMerge = this.component.overrides.componentOverridesPackageJsonData;\n packageJson.mergePackageJsonObject(valuesToMerge);\n }", "_writeNewContent() {\n this.packageJsonContent.version = this._formatVersion()\n fs.writeFileSync(packagePath, JSON.stringify(this.packageJsonContent, null, 2))\n }", "function changeVersion(increment, preid) {\n const json = JSON.parse(fs.readFileSync('./package.json'));\n\n console.log('-------------------------------------------------');\n console.log('--- OLD PACKAGE VERSION: ' + json.version + ' ---');\n\n json.version = semver.inc(json.version, increment, preid);\n\n console.log('--- NEW PACKAGE VERSION: ' + json.version + ' ---');\n console.log('-------------------------------------------------');\n\n fs.writeFileSync('./package.json', JSON.stringify(json, null, '\\t'));\n}", "function inc(importance) {\n return gulp.src(['./package.json', './bower.json'])\n .pipe(gp_bump({type: importance}))\n .pipe(gulp.dest('./'))\n .pipe(gp_git.commit('Creating new package version'))\n .pipe(gp_filter('package.json'))\n .pipe(gp_tagversion());\n}", "function applyLinks(releases, packagesByName, linked) {\n let updated = false;\n if (!linked) return updated; // We do this for each set of linked packages\n\n for (let linkedPackages of linked) {\n // First we filter down to all the relevent releases for one set of linked packages\n let releasingLinkedPackages = [...releases.values()].filter(release => linkedPackages.includes(release.name) && release.type !== \"none\"); // If we proceed any further we do extra work with calculating highestVersion for things that might\n // not need one, as they only have workspace based packages\n\n if (releasingLinkedPackages.length < 1) continue;\n let highestReleaseType;\n let highestVersion;\n\n for (let pkg of releasingLinkedPackages) {\n // Note that patch is implictly set here, but never needs to override another value\n if (!highestReleaseType) {\n highestReleaseType = pkg.type;\n } else if (pkg.type === \"major\") {\n highestReleaseType = pkg.type;\n } else if (pkg.type === \"minor\" && highestReleaseType !== \"major\") {\n highestReleaseType = pkg.type;\n }\n } // Next we determine what the highest version among the linked packages will be\n\n\n for (let linkedPackage of linkedPackages) {\n let pkg = packagesByName.get(linkedPackage);\n\n if (pkg) {\n if (highestVersion === undefined || semver__default['default'].gt(pkg.packageJson.version, highestVersion)) {\n highestVersion = pkg.packageJson.version;\n }\n } else {\n console.error(`FATAL ERROR IN CHANGESETS! We were unable to version for linked package: ${linkedPackage} in linkedPackages: ${linkedPackages.toString()}`);\n throw new Error(`fatal: could not resolve linked packages`);\n }\n }\n\n if (!highestVersion || !highestReleaseType) throw new Error(`Large internal changesets error in calculating linked versions. Please contact the maintainers`); // Finally, we update the packages so all of them are on the highest version\n\n for (let linkedPackage of releasingLinkedPackages) {\n if (linkedPackage.type !== highestReleaseType) {\n updated = true;\n linkedPackage.type = highestReleaseType;\n }\n\n if (linkedPackage.oldVersion !== highestVersion) {\n updated = true;\n linkedPackage.oldVersion = highestVersion;\n }\n }\n }\n\n return updated;\n}", "async function findDepUpgrades(dep) {\n const npmDependency = await npmApi.getDependency(dep.depName);\n const upgrades =\n await versionsHelper.determineUpgrades(npmDependency, dep.currentVersion, config);\n if (upgrades.length > 0) {\n logger.verbose(`${dep.depName}: Upgrades = ${JSON.stringify(upgrades)}`);\n upgrades.forEach((upgrade) => {\n allUpgrades.push(Object.assign({}, dep, upgrade));\n });\n } else {\n logger.verbose(`${dep.depName}: No upgrades required`);\n }\n }", "function writePackageJSON (btrc) {\n let packageJSONObject = btrc;\n packageJSONObject[\"name\"] = name;\n packageJSONObject[\"version\"] = \"0.1.0\";\n let packageJSONString = JSON.stringify(packageJSONObject);\n return new Promise((res, rej) => {\n fs.writeFile(path + \"/package.json\", packageJSONString, (err) => {\n return err ? rej(err) : res();\n });\n });\n }", "function recursivelyAddProjects(rushProjects, deps) {\n if (!deps) {\n return rushProjects;\n }\n\n Object.keys(deps).forEach(depKey => {\n if (packageNameToFolder[depKey]) {\n const projectFolder = `src/${packageNameToFolder[depKey]}`;\n rushProjects.push({\n packageName: depKey,\n projectFolder,\n });\n\n // Recursively add deps and devDeps of new dep\n const depPackageContents = require(`${process.cwd()}/${projectFolder}/package.json`);\n rushProjects = recursivelyAddProjects(\n rushProjects,\n depPackageContents.dependencies\n );\n rushProjects = recursivelyAddProjects(\n rushProjects,\n depPackageContents.devDependencies\n );\n }\n });\n\n return rushProjects;\n}", "function markPublished(packageJson) {\n return new Promise((resolve, reject) => {\n packageJson = packageJson || require('../package.json'); // <-- very sketchy...this will get hoisted and immediated loaded when api is run.\n packageJson.genericSource.state = 'published';\n packageJson.genericSource.updated = new Date().getTime();\n fs.writeFile('./package.json', JSON.stringify(packageJson, null, 2) + '\\n', err => {\n if (err) {\n return reject(err);\n }\n resolve(packageJson);\n });\n });\n}", "function npmInstall() {\n return src(['.temp/dist/package.json'])\n .pipe(install({\n args: ['--production']\n }));\n}", "updateProjectVersion(newVersion) {\n return tslib.__awaiter(this, void 0, void 0, function* () {\n const pkgJsonPath = path.join(this.projectDir, packageJsonPath);\n const pkgJson = JSON.parse(yield fs.promises.readFile(pkgJsonPath, 'utf8'));\n pkgJson.version = newVersion.format();\n // Write the `package.json` file. Note that we add a trailing new line\n // to avoid unnecessary diff. IDEs usually add a trailing new line.\n yield fs.promises.writeFile(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}\\n`);\n info(green(` ✓ Updated project version to ${pkgJson.version}`));\n });\n }", "function npmInstall(packages, opts) {\n if (packages.length == 0 || !packages || !packages.length) { Promise.reject(\"No packages found\"); }\n if (typeof packages == \"string\") packages = [packages];\n if (!opts) opts = {};\n var cmdString = \"npm install \" + packages.join(\" \") + \" \"\n + (opts.global ? \" -g\" : \"\")\n + (opts.save ? \" --save\" : \"\")\n + (opts.saveDev ? \" --saveDev\" : \"\");\n\n return new Promise(function (resolve, reject) {\n exec(cmdString, { cwd: opts.cwd ? opts.cwd : \"/\" }, (error) => {\n if (error) {\n reject(error);\n } else {\n resolve(0); // return success. statusCode 0 (installation successful)\n }\n });\n });\n}", "function mainDeps (argv, next) {\n const opts = { save: true, cache: true }\n install(argv.mainDeps, opts, function (err) {\n if (err) return next(err)\n next()\n })\n}", "function removeDependencies() {\n\tif (!fs.existsSync(DIST_LIB_PATH)) {\n\t\treturn;\n\t}\n\n\tfs.writeFileSync(DIST_PACKAGE_PATH,\n\t\tJSON.stringify(\n\t\t\t{\n\t\t\t\t...getPackage(DIST_PACKAGE_PATH),\n\t\t\t\tdependencies: undefined,\n\t\t\t},\n\t\t\tnull,\n\t\t\tINDENTATION,\n\t\t),\n\t);\n}", "async function checkUpdate(){\r\n\r\n var fileContents = Fs.readFileSync(__dirname+'/package.json');\r\n var pkg = JSON.parse(fileContents);\r\n\tpkg['name'] = PACKAGE_TO_UPDATE;\r\n\tpkg['version'] = pkg['dependencies'][PACKAGE_TO_UPDATE];\r\n\tif(isNaN(pkg['version'].substr(0,1))){\r\n\t\t//exemple: ^0.3.1\r\n\t\tpkg['version'] = pkg['version'].substr(1);\r\n\t}\r\n\r\n\tconst update = new AutoUpdate(pkg);\r\n\tupdate.on('update', function(){\r\n\t\tconsole.log('started update')\r\n\t\tif(app){\r\n\t\t\tconsole.log('[lanSupervLauncher] stopApplication');\r\n\t\t\tapp.stopApplication();\r\n\t\t\tapp = null;\r\n\t\t}\r\n\t});\r\n\tupdate.on('ready', function(){\r\n\t\tconsole.log('[lanSupervLauncher] ready (updated or not !)');\r\n\t\t//3) (Re)launch application\r\n\t\tif(app===null){\r\n\t\t\tconsole.log('[lanSupervLauncher] startApplication');\r\n\t\t\tapp = new LanSuperv();\r\n\t\t\tvar ConfigFile = __dirname + '/config.js';\r\n\t\t\tapp.startApplication(ConfigFile);\r\n\t\t\t//(initial launch or relaunch after update)\r\n\t\t}\r\n\t});\r\n\r\n}", "function majorBump() {\n return gulp.src([\n './package.json',\n './bower.json'\n ]).pipe(bump({type: 'major'}))\n .pipe(gulp.dest('./'));\n}", "function getPackages() {\n\tvar packages = {};\n\tvar Package = {\n\t\tdescribe: function () {\n\t\t},\n\t\t_transitional_registerBuildPlugin: function () {\n\t\t},\n\t\tregister_extension: function () {\n\t\t},\n\t\tregisterExtension: function () {\n\t\t},\n\t\ton_use: function (callback) {\n\t\t\tcallback(api);\n\t\t},\n\t\tonUse: function (callback) {\n\t\t\tcallback(api);\n\t\t},\n\t\ton_test: function (callback) {\n\t\t\tcallback(api);\n\t\t},\n\t\tonTest: function (callback) {\n\t\t\tcallback(api);\n\t\t},\n\t\tregisterBuildPlugin: function () {\n\t\t}\n\t};\n\tNpm.depends = function () {\n\t};\n\tNpm.strip = function () {\n\t};\n\tvar Cordova = {\n\t\tdepends: function () {\n\t\t}\n\t};\n\tvar api = {\n\t\tadd_files: function () {\n\t\t},\n\t\taddFiles: function () {\n\t\t},\n\t\taddAssets: function () {\n\t\t},\n\t\timply: function () {\n\t\t},\n\t\tuse: function () {\n\t\t},\n\t\texport: function () {\n\t\t},\n\t\tversionsFrom: function() {\n\t\t},\n\t\tmainModule: function() {\n\t\t}\n\t}\n\n\tfs.readdirSync(packagesPath).forEach(handlePackage);\n\tif (fs.existsSync('packages')) {\n\t\tfs.readdirSync('packages').forEach(handlePackage);\n\t}\n\treturn packages;\n\n\tfunction initPackage(name) {\n\t\tif (typeof(packages[name]) === 'undefined') {\n\t\t\tvar packagePath = path.join(packagesPath, name);\n\t\t\tif (fs.existsSync(path.join('packages', name))) {\n\t\t\t\tpackagePath = path.join('packages', name);\n\t\t\t}\n\t\t\tpackages[name] = {\n\t\t\t\tpath: packagePath,\n\t\t\t\tserver: {\n\t\t\t\t\tuses: {},\n\t\t\t\t\timply: {},\n\t\t\t\t\tfiles: []\n\t\t\t\t},\n\t\t\t\tclient: {\n\t\t\t\t\tuses: {},\n\t\t\t\t\timply: {},\n\t\t\t\t\tfiles: []\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction handlePackage(package) {\n\t\tif (package.charAt(0) === '.') {\n\t\t\treturn;\n\t\t}\n\t\tinitPackage(package);\n\t\tvar packageJsPath = path.join(packagesPath, package, 'package.js');\n\t\tif (fs.existsSync(path.join('packages', package))) {\n\t\t\tpackageJsPath = path.join('packages', package, 'package.js');\n\t\t}\n\t\tif (package.charAt(0) === '.' || !fs.existsSync(packageJsPath)) {\n\t\t\treturn;\n\t\t}\n\t\tvar packageJs = fs.readFileSync(packageJsPath).toString();\n\t\tif (packageJs) {\n\t\t\tapi.use = function (name, where) {\n\t\t\t\tvar inServer = !where || where === 'server' || (where instanceof Array && where.indexOf('server') !== -1);\n\t\t\t\tvar inClient = !where || where === 'client' || where === 'web.cordova' || (where instanceof Array && (where.indexOf('client') !== -1 || where.indexOf('web.cordova') !== -1));\n\t\t\t\tif (!(name instanceof Array)) {\n\t\t\t\t\tname = [name];\n\t\t\t\t}\n\t\t\t\tname.forEach(function (item) {\n\t\t\t\t\tinitPackage(item);\n\t\t\t\t\tif (inServer) {\n\t\t\t\t\t\tpackages[package].server.uses[item] = packages[item];\n\t\t\t\t\t}\n\t\t\t\t\tif (inClient) {\n\t\t\t\t\t\tpackages[package].client.uses[item] = packages[item];\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t\tapi.imply = function (name, where) {\n\t\t\t\tvar inServer = !where || where === 'server' || (where instanceof Array && where.indexOf('server') !== -1);\n\t\t\t\tvar inClient = !where || where === 'client' || where === 'web.cordova' || (where instanceof Array && (where.indexOf('client') !== -1 || where.indexOf('web.cordova') !== -1));\n\t\t\t\tif (!(name instanceof Array)) {\n\t\t\t\t\tname = [name];\n\t\t\t\t}\n\t\t\t\tname.forEach(function (item) {\n\t\t\t\t\tinitPackage(item);\n\t\t\t\t\tif (inServer) {\n\t\t\t\t\t\tpackages[package].server.imply[item] = packages[item];\n\t\t\t\t\t}\n\t\t\t\t\tif (inClient) {\n\t\t\t\t\t\tpackages[package].client.imply[item] = packages[item];\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t\tapi.add_files = api.addFiles = function (name, where) {\n\t\t\t\tvar inServer = !where || where === 'server' || (where instanceof Array && where.indexOf('server') !== -1);\n\t\t\t\tvar inClient = !where || where === 'client' || where === 'web.cordova' || (where instanceof Array && (where.indexOf('client') !== -1 || where.indexOf('web.cordova') !== -1));\n\t\t\t\tif (!(name instanceof Array)) {\n\t\t\t\t\tname = [name];\n\t\t\t\t}\n\t\t\t\tvar items = name.filter(function (item) {\n\t\t\t\t\tif (item) {\n\t\t\t\t\t\treturn item.substr(item.length - 3) === '.ts';\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif (inServer) {\n\t\t\t\t\tpackages[package].server.files = packages[package].server.files.concat(items);\n\t\t\t\t}\n\t\t\t\tif (inClient) {\n\t\t\t\t\tpackages[package].client.files = packages[package].client.files.concat(items);\n\t\t\t\t}\n\t\t\t};\n\t\t\tPackage.on_use = Package.onUse = function (callback) {\n\t\t\t\tcallback(api);\n\t\t\t};\n\t\t\tPackage.on_test = Package.onTest = function (callback) {\n\t\t\t\tcallback(api);\n\t\t\t};\n\t\t\tPackage.includeTool = function () {\n\t\t\t};\n\t\t\teval(packageJs);\n\t\t}\n\t}\n\n}", "function buildDeps(arrDeps) {\n arrDeps.forEach(function (deps) {\n var depsId = deps, vmPath;\n\n var depsObj = map[depsId];\n if (!depsObj) {\n console.error('%s is not in map!!', depsId);\n return;\n }\n var hisDeps = depsObj['deps'] || [];\n if (hisDeps && hisDeps.length) {\n buildDeps(hisDeps);\n }\n\n var type = depsObj.type;\n var uri = depsObj.uri;\n\n switch (type) {\n case 'vm':\n\n // 检查deps中的js,添加到arrJsMod里\n // arrJsMod中只放每一个vm同名依赖的js模块,它的依赖已经打包在arrCombJs中提前加载了\n var depsIdPre = depsId.replace(/(.*?)(\\.vm)$/, '$1');\n hisDeps.map(function (item) {\n if (item === depsIdPre + '.js') {\n var modId = map[item] && map[item]['extras']['moduleId'];\n arrJsMod.push({\n moduleId: '\"' + modId + '\"',\n widgetId: deps.idf\n });\n }\n });\n\n break;\n case 'js':\n if (!~conf['arrGlobalJs'].indexOf(uri)) {\n arrCombJs.pushUnique(uri);\n }\n break;\n case 'css':\n if (!~conf['arrGlobalCss'].indexOf(uri)) {\n arrCombCss.pushUnique(uri);\n }\n break;\n default:\n break;\n } //end of switch\n }); //end of forEach\n\n }", "function upgradeFn () {\n // == BEGIN MODULE SCOPE VARIABLES ==================================\n var\n xhiObj = this,\n\n catchFn = xhiObj.catchFn,\n commandMap = xhiObj.commandMap,\n logFn = xhiObj.logFn,\n nextFn = xhiObj.nextFn,\n packageMatrix = xhiObj.packageMatrix,\n prefixStr = xhiObj.makePrefixStr( commandMap ),\n stageStatusMap = xhiObj.stageStatusMap,\n\n aliasStr = commandMap.alias_str,\n postObj\n ;\n // == . END MODULE SCOPE VARIABLES ==================================\n\n // == BEGIN UTILITY METHODS =========================================\n // BEGIN utility /failFn/\n // Purpose: Wrap catchFn to store failure and finish\n //\n function failFn () {\n stageStatusMap[ aliasStr ] = false;\n catchFn( arguments );\n }\n // . END utility /failFn/\n // == . END UTILITY METHODS =========================================\n\n // == BEGIN EVENT HANDLERS ==========================================\n // BEGIN event handler /onOutdatedFn/\n function onOutdatedFn ( error_data, update_table ) {\n var\n solve_map = {},\n update_count = update_table.length,\n\n idx, row_list,\n package_name, current_str, target_str\n ;\n\n if ( error_data ) { return failFn( error_data ); }\n\n if ( update_count === 0 ) {\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'No package changes' );\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n\n // Invalidate all these stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap, [\n 'install', 'setup', 'dev_test', 'dev_lint',\n 'dev_cover', 'dev_commit', 'build'\n ]);\n\n // Load post-install methods\n xhiObj.loadLibsFn();\n postObj = xhiObj.makePostObj();\n\n // Begin aggregate changes and merge\n for ( idx = 0; idx < update_count; idx++ ) {\n row_list = update_table[ idx ];\n package_name = row_list[ 1 ];\n current_str = row_list[ 2 ];\n target_str = row_list[ 4 ];\n solve_map[ package_name ] = target_str;\n logFn(\n 'Update ' + package_name + ' from '\n + current_str + ' to ' + target_str\n );\n }\n Object.assign( packageMatrix.devDependencies, solve_map );\n // . End Aggregate changes an merge\n\n // Save to package file\n postObj.writePkgFileFn(\n function _onWriteFn ( error_data ) {\n if ( error_data ) { return failFn( error_data ); }\n\n // Mark install and setup as 'out of date'\n stageStatusMap.install = false;\n stageStatusMap.setup = false;\n\n // Store success and finish\n // A successful update invalidates all prior stages\n xhiObj.xhiUtilObj._clearMap_( stageStatusMap );\n stageStatusMap[ aliasStr ] = true;\n logFn( prefixStr + 'Success' );\n nextFn();\n }\n );\n }\n // . END event handler /onOutdatedFn/\n\n // BEGIN event handler /onLoadFn/\n function onLoadFn ( error_data, localNpmObj ) {\n if ( error_data ) { return catchFn( error_data ); }\n localNpmObj.outdated( onOutdatedFn );\n }\n // . END event handler /onLoadFn/\n // == . END EVENT HANDLERS ==========================================\n\n // == BEGIN MAIN ====================================================\n function mainFn () {\n logFn( prefixStr + 'Start' );\n xhiObj.npmObj.load( xhiObj.fqPkgFilename, onLoadFn );\n }\n // == . END MAIN ====================================================\n mainFn();\n}", "function checkForUpdate() {\n superagent.get(packageJson).end((error, response) => {\n if (error) return;\n const actualVersion = JSON.parse(response.text).version; // TODO: case without internet connection\n console.log('Actual app version: ' + actualVersion + '. Current app version: ' + currentVersion);\n if (semver.gt(actualVersion, currentVersion)) {\n mb.window.webContents.send('update-available');\n console.log('New version is available!');\n }\n });\n}", "function packageJson() {\n return (pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8')));\n}", "function initdependencies(){\n process.spawnSync('npm',['install', '--save', 'express'], { cwd: './' });\n process.spawnSync('npm',['install', '--save', 'helmet'], { cwd: './' });\n}", "updateVendors(data){\n\t\tlet input = JSON.parse(data);\n\t\tthis.vendors[input.vendor].items = input.items;\n\t}", "afterInstall() {\n let { ui, root } = this.project;\n\n updatePackageJson(root);\n updateTravisYml(root);\n\n return this.addPackagesToProject([\n { name: 'husky', target: '^0.14.3' },\n { name: '@addepar/eslint-config' },\n { name: '@addepar/prettier-config' },\n { name: '@addepar/sass-lint-config' },\n ])\n .then(() => {\n return this.addAddonsToProject({\n packages: ['@addepar/style-toolbox'],\n });\n })\n .then(() => formatAll(ui));\n }", "function updateRequires(fileToUpdate, fromPath, toPath, filterFn) {\n var code = new SourceCode(fileToUpdate);\n var dirname = path.dirname(fileToUpdate);\n\n findRelativeRequireArgs(code.text, fileToUpdate).forEach(function(arg) {\n try {\n var fullRequirePath = Module._resolveFilename(arg.value, {\n filename: fileToUpdate,\n id: fileToUpdate,\n paths: Module._nodeModulePaths(dirname)\n });\n } catch (err) {\n // Ignore it\n }\n if (fullRequirePath === fromPath) {\n var newValue = path.relative(dirname, toPath);\n if (!isRelativeRequire(newValue)) {\n newValue = './' + newValue;\n }\n if (!path.extname(arg.value)) {\n newValue = path.basename(newValue, path.extname(newValue));\n }\n code.updateNodeValue(arg, newValue);\n }\n });\n if (code.modified) {\n if (typeof filterFn === 'function') {\n code.text = filterFn(fileToUpdate, code.text) || code.text;\n }\n code.write();\n return true;\n } else {\n return false;\n }\n}", "setNPMPackage(callback) {\n\t\tthis.tjdata.npm_package = {};\n\t\tlet npmPack = this.tjdata.npm_package;\n\t\tshell.exec('npm list --depth 1', {silent:true}, function(code, stdout, stderr) {\n\t\t\tif (stderr) {\n\t\t\t\tcallback(code, stderr);\n\t\t\t} else {\n\t\t\t\tfor (let part of stdout.replace(/[\\-└┬─├│]/g, \"\").split(/\\r?\\n/)) {\n\t\t\t\t\tlet entry = part.split(\"@\");\n\t\t\t\t\tif (entry.length == 2) {\n\t\t\t\t\t\tnpmPack[entry[0].trim()] = entry[1].trim();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshell.exec('npm list -g --depth 0', {silent:true}, function(code, stdout, stderr) {\n\t\t\t\t\tif (stderr) {\n\t\t\t\t\t\tcallback(code, stderr);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor (let part of stdout.replace(/[\\-└┬─├│]/g, \"\").split(/\\r?\\n/)) {\n\t\t\t\t\t\t\tlet entry = part.split(\"@\");\n\t\t\t\t\t\t\tif (entry.length == 2) {\n\t\t\t\t\t\t\t\tnpmPack[entry[0].trim()] = entry[1].trim();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcallback(code);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "function refreshTargetPackage(pkg, refreshDir){\n let pkg_url = 'https://'+ cdn_base_address + '/api/packages/';\n let package_url = {};\n package_url.url = pkg_url + pkg.name + '/';//replacePackage_url(pkg, cdn_base_address);\n package_url.type = TYPE_FILE;\n refresh_cache.push(package_url);\n\n let package_file = {};\n package_file.url = pkg_url + pkg.name;//pkg.latest.package_url.replace('pub.dartlang.org', cdn_base_address);\n package_file.type = TYPE_FILE;\n refresh_cache.push(package_file);\n\n let doc_url = 'https://'+ cdn_base_address + '/api/documentation/'\n let document_url = {};\n document_url.url = doc_url + pkg.name;//getDocument_url(pkg, cdn_base_address);\n document_url.type = TYPE_FILE;\n refresh_cache.push(document_url);\n\n //check publisher resource\n let options= {\n url: flutter_base_url + pkg.name + '/publisher',\n gzip: true,\n headers: {\n 'User-Agent' : 'pub.flutter-io.cn'\n }\n };\n // request.get(options, (err, response, body) => {\n // try {\n // let j = JSON.parse(body);\n // if (j.publisherId != null) {\n // let publisher_url = {};\n // publisher_url.url = cdn_publisher_resource_address + j.publisherId + '/packages';\n // publisher_url.type = TYPE_FILE;\n // // refresh_cache.push(publisher_url);\n // }\n // } catch (e) {\n // console.error(currentTimestamp() + 'failed to parse JSON, response-->' + res);\n // }\n // });\n\n //add browser resources\n let browser_package = {};\n browser_package.url = cdn_browser_resource_address + pkg.name;\n browser_package.type = TYPE_FILE;\n // refresh_cache.push(browser_package);\n refresh_cache_chuangcache_file.push(browser_package);\n\n let browser_package2 = {};\n browser_package2.url = cdn_browser_resource_address + pkg.name + '/';\n browser_package2.type = TYPE_FILE;\n // refresh_cache.push(browser_package2);\n refresh_cache_chuangcache_file.push(browser_package2);\n\n let browser_package_versions = {};\n browser_package_versions.url = cdn_browser_resource_address + pkg.name + '/versions';\n browser_package_versions.type = TYPE_FILE;\n // refresh_cache.push(browser_package_versions);\n refresh_cache_chuangcache_file.push(browser_package_versions);\n\n if (refresh_directory && refreshDir) {\n let browser_document = {};\n browser_document.url = cdn_browser_document_address + pkg.name + '/latest/';\n browser_document.type = TYPE_DIRECTORY;\n // refresh_cache.push(browser_document);\n refresh_cache_chuangcache_dir.push(browser_document);\n\n browser_document = {};\n browser_document.url = cdn_browser_document_address + pkg.name + '/p_limit/';\n browser_document.type = TYPE_DIRECTORY;\n // refresh_cache.push(browser_document);\n refresh_cache_chuangcache_dir.push(browser_document);\n }\n}", "function flattenReleases(changesets, packagesByName, ignoredPackages) {\n let releases = new Map();\n changesets.forEach(changeset => {\n changeset.releases // Filter out ignored packages because they should not trigger a release\n // If their dependencies need updates, they will be added to releases by `determineDependents()` with release type `none`\n .filter(({\n name\n }) => !ignoredPackages.includes(name)).forEach(({\n name,\n type\n }) => {\n let release = releases.get(name);\n let pkg = packagesByName.get(name);\n\n if (!pkg) {\n throw new Error(`Could not find package information for ${name}`);\n }\n\n if (!release) {\n release = {\n name,\n type,\n oldVersion: pkg.packageJson.version,\n changesets: [changeset.id]\n };\n } else {\n // If the type was already major, we never need to update it\n if (release.type === \"minor\" && type === \"major\") {\n release.type = type;\n } else if (release.type === \"patch\" && (type === \"major\" || type === \"minor\")) {\n release.type = type;\n } // Check whether the bumpType will change\n // If the bumpType has changed recalc newVersion\n // push new changeset to releases\n\n\n release.changesets.push(changeset.id);\n }\n\n releases.set(name, release);\n });\n });\n return releases;\n}", "function findPackageDeps () {\n var pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'))\n\n var deps = Object.keys(pkg.dependencies)\n var devDeps = Object.keys(pkg.devDependencies)\n var optionalDeps = Object.keys(pkg.optionalDependencies)\n\n return [].concat(deps, devDeps, optionalDeps)\n}", "function installPackages(arr) {\n\n spawn('npm', ['i', '--save'].concat(_toConsumableArray(arr)));\n\n return arr;\n}", "function get_pkg_deps(pkgs) {\n pkgs = Array.isArray(pkgs) ? pkgs : [ pkgs ];\n return new Promise((resolve, reject) => {\n let deps = '';\n const script = child_process.spawn(buildorder_script, pkgs);\n script.stdout.on('data', (data) => {\n deps += data;\n });\n script.on('close', (code) => {\n if (code) {\n WARN('%s returned exit code %s for \"%s\"',\n buildorder_script, code, pkgs);\n return reject(code);\n } else {\n /* Remove last element, which is an empty line */\n return resolve(deps.split('\\n').slice(0, -1));\n }\n });\n });\n}", "async function renovatePackage(config) {\n const logger = config.logger || pLogger;\n logger.trace(`renovatePackage(${config.depName})`);\n if (config.enabled === false) {\n logger.debug('package is disabled');\n return [];\n }\n let results = [];\n if (!versions.isValidVersion(config.currentVersion)) {\n results.push({\n depName: config.depName,\n type: 'warning',\n message: `Dependency uses tag \"\\`${config.currentVersion}\\`\" as its version so that will never be changed by Renovate`,\n });\n logger.debug(results[0].message);\n return results;\n }\n const npmDep = await npmApi.getDependency(config.depName, logger);\n if (npmDep) {\n results = await versions.determineUpgrades(npmDep, config);\n if (results.length > 0) {\n logger.info(\n { dependency: config.depName },\n `${results.length} result(s): ${results.map(\n upgrade => upgrade.newVersion\n )}`\n );\n }\n } else {\n // If dependency lookup fails then warn and return\n const result = {\n type: 'error',\n message: 'Failed to look up dependency',\n };\n logger.warn(result.message);\n results = [result];\n }\n logger.debug({ results }, `${config.depName} lookup results`);\n // Flatten the result on top of config, add repositoryUrl\n return results.map(result => {\n let upg = configParser.mergeChildConfig(config, result);\n if (upg.isMajor) {\n upg = configParser.mergeChildConfig(upg, upg.major);\n } else if (upg.isMinor) {\n upg = configParser.mergeChildConfig(upg, upg.minor);\n } else if (upg.isPatch) {\n upg = configParser.mergeChildConfig(upg, upg.patch);\n }\n upg.repositoryUrl =\n npmDep && npmDep.repositoryUrl && npmDep.repositoryUrl.length\n ? npmDep.repositoryUrl\n : null;\n return configParser.filterConfig(upg, 'branch');\n });\n}", "function processDependencies(dependencies, components, exclude) {\n Object.keys(dependencies).forEach(function(key) {\n grunt.log.debug(\"Obtaining package version for \" + key);\n\n var dependency = dependencies[key];\n var pkgMeta = dependency.pkgMeta;\n\n if(exclude.indexOf(pkgMeta.name) > -1) {\n grunt.log.ok('Excluding component: ' + pkgMeta.name);\n return;\n }\n\n var componentData = {};\n componentData['version'] = pkgMeta.version;\n componentData['directory'] = dependency.canonicalDir;\n components[pkgMeta.name] = componentData;\n\n grunt.log.debug(key + \" - version: \" + componentData['version'] + \" directory: \" + componentData['directory']);\n\n processDependencies(dependency.dependencies, components, exclude);\n });\n }", "function makeUpdatePackage (services) {\n var groups = buildGroups(services, subdomain);\n return {\n groups: groups,\n hash: hash('sha256').update(JSON.stringify(groups)).digest('hex')\n };\n}", "function getDevDependencies() {\n return devDependencies;\n}", "function installPackages(packages) {\n spawn.sync('npm', [\n 'install',\n '-D',\n ...packages\n ], { stdio: 'inherit' });\n}", "function scaffoldNPM() {\n // CSS Scripts\n if (cssChoice) {\n packageJSON['scripts'][cssChoice] = packageScriptTemplates[cssChoice];\n packageJSON['scripts']['build:styles'] =\n packageScriptTemplates['build:styles'].replace('%s', cssChoice);\n }\n // JS Scripts\n if (jsChoice) {\n packageJSON['scripts'][jsChoice] = packageScriptTemplates[jsChoice];\n packageJSON['scripts']['build:scripts'] =\n packageScriptTemplates['build:scripts'].replace('%s', jsChoice);\n packageJSON['devDependencies'][(devDependencyTemplates[jsChoice])] = 'latest';\n }\n // Write out the completed package.json template\n fs.writeJsonSync(workingDir + 'package.json', packageJSON);\n\n teardown(); // Go to last step\n}", "function main() {\n const options = minimist(process.argv.slice(2));\n\n const source = fs\n .readFileSync(path.join(root, \"package.json\"))\n .toString(\"utf-8\");\n const sourceObj = JSON.parse(source);\n\n if (options.legacy) {\n sourceObj.name = \"@lolopinto/ent\";\n // TODO this needs to be updated here everytime we wanna update legacy version...\n // the legacy path is difficult because of tsent though...\n sourceObj.version = \"0.0.100\";\n }\n sourceObj.scripts = {};\n sourceObj.devDependencies = {};\n if (sourceObj.main.startsWith(\"dist/\")) {\n sourceObj.main = sourceObj.main.slice(5);\n }\n fs.writeFileSync(\n path.join(root, \"dist\", \"/package.json\"),\n Buffer.from(JSON.stringify(sourceObj, null, 2), \"utf-8\"),\n );\n\n fs.copyFileSync(\n path.join(root, \".npmignore\"),\n path.join(root, \"dist\", \".npmignore\"),\n );\n}", "async function copyright( args ) {\n\tvar state = {} ;\n\n\t// Process arguments\n\tstate.update = args.commandArgs[ 0 ] === 'update' ;\n\n\tstate.cwd = process.cwd() ;\n\tstate.packagePath = state.cwd + '/package.json' ;\n\n\ttry {\n\t\tstate.package = require( state.packagePath ) ;\n\t}\n\tcatch ( error ) {\n\t\twfm.exitError( \"No package.json found.\\n\" ) ;\n\t}\n\n\tawait packageInfo( state ) ;\n\tawait writePackage( state ) ;\n\tawait patchFiles( state ) ;\n\n\tprocess.exit( 0 ) ;\n}", "_adaptPackageJSON() {\n const feat = this.props.useFeature;\n const opt = this.options['use-feature'];\n\n let isBootstrap = false;\n let isJquery = false;\n let isVelocity = false;\n let isVRT = false;\n if (feat) {\n isBootstrap = feat.indexOf('bs') >= 0;\n isJquery = isBootstrap || feat.indexOf('jquery') >= 0;\n } else if (opt) {\n isBootstrap = opt.indexOf('bs') >= 0;\n isJquery = isBootstrap || opt.indexOf('jquery') >= 0;\n }\n\n if (this.props.useVelocity || this.options['use-velocity']) {\n isVelocity = true;\n }\n if (this.props.useVRT || this.options['use-vrt']) {\n isVRT = true;\n }\n\n this.fs.copyTpl(\n this.templatePath('_package.json'),\n this.destinationPath('package.json'),\n {\n includeVelocity: isVelocity,\n includeBootstrap: isBootstrap,\n includeJquery: isJquery,\n includeVRT: isVRT\n }\n );\n }", "function updateNgccMainFields() {\n sync('node_modules/@angular/**/package.json').forEach((filePath) => {\n // Do not update `package.json` files for deeply nested node modules (e.g. dependencies of\n // the `@angular/compiler-cli` package).\n if (filePath.lastIndexOf('node_modules/') !== 0) {\n return;\n }\n const parsedJson = JSON.parse(readFileSync(filePath, 'utf8'));\n if (\n parsedJson[NGCC_MAIN_FIELD_NAME] &&\n parsedJson[MAIN_FIELD_NAME] !== parsedJson[NGCC_MAIN_FIELD_NAME]\n ) {\n // Update the main field to point to the ngcc main script.\n parsedJson[MAIN_FIELD_NAME] = parsedJson[NGCC_MAIN_FIELD_NAME];\n writeFileSync(filePath, JSON.stringify(parsedJson, null, 2));\n }\n });\n}", "function minorBump() {\n return gulp.src([\n './package.json',\n './bower.json'\n ]).pipe(bump({type: 'minor'}))\n .pipe(gulp.dest('./'));\n}", "updateBuoyData(params, cb) {\n const payload = {\n error: null,\n notifications: [],\n };\n\n // send error if params are invalid\n if (!this._validateParams('updateBuoyData', params)) {\n payload.error = {\n code: -32602,\n message: 'Invalid params',\n };\n // checks if the buoy exists and if the update will change anything\n } else if (this._buoys[params.name] &&\n (this._buoys[params.name].height !== params.height ||\n this._buoys[params.name].period !== params.period)) {\n this._buoys[params.name].height = params.height;\n this._buoys[params.name].period = params.period;\n payload.notifications.push({\n body: this._generateNotification(params.name),\n clients: [],\n });\n for (let client in this._buoys[params.name].clients) {\n console.log('Update queued for', client);\n payload.notifications[0].clients.push(this._clients[client].ws);\n }\n }\n\n cb(payload);\n }", "_fixupNpm5Regression() {\n const pathToDeleteWithoutStar = path.join(this._rushConfiguration.commonTempFolder, 'node_modules', RushConstants_1.RushConstants.rushTempNpmScope);\n // Glob can't handle Windows paths\n const normalizedpathToDeleteWithoutStar = node_core_library_1.Text.replaceAll(pathToDeleteWithoutStar, '\\\\', '/');\n let anyChanges = false;\n // Example: \"C:/MyRepo/common/temp/node_modules/@rush-temp/*/package.json\"\n for (const packageJsonPath of glob.sync(globEscape(normalizedpathToDeleteWithoutStar) + '/*/package.json')) {\n // Example: \"C:/MyRepo/common/temp/node_modules/@rush-temp/example/package.json\"\n const packageJsonObject = node_core_library_1.JsonFile.load(packageJsonPath);\n // The temp projects always use \"0.0.0\" as their version\n packageJsonObject.version = '0.0.0';\n if (node_core_library_1.JsonFile.save(packageJsonObject, packageJsonPath, { onlyIfChanged: true })) {\n anyChanges = true;\n }\n }\n if (anyChanges) {\n console.log(os.EOL + colors.yellow(wrap(`Applied workaround for NPM 5 bug`)) + os.EOL);\n }\n }", "addMixScripts() {\n\t\tconsole.log(`3. Add mix scripts into package.json`);\n\t\tconst packageJson = JSON.parse(fs.readFileSync(this.workingDir + 'package.json'))\n\t\tpackageJson.scripts.dev = \"npm run development\";\n\t\tpackageJson.scripts.development = \"cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js\";\n\t\tpackageJson.scripts.watch = \"npm run development -- --watch\";\n\t\tpackageJson.scripts.hot = \"cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js\";\n\t\tpackageJson.scripts.prod = \"npm run production\";\n\t\tpackageJson.scripts.production = \"cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js\";\n\n\t\t// Write package.json.\n\t\tfs.writeFile(this.workingDir + 'package.json', JSON.stringify(packageJson, null, 4), 'utf8', (err) => {\n\t\t\tif (err) {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t});\n\t}", "function handleResolvedPkg (dir, pkg, cb) {\n // We need the shasum in order to determine the final directory of the\n // package.\n var finalDest = path.join(dir, pkg.dist.shasum)\n var tmpDest = path.join(dir, '.tmp', uuid())\n\n if (locks[finalDest]) {\n debug('%s is locked', finalDest)\n var err = new Error(pkg.dist.shasum + ' is locked')\n err.code = 'LOCKED'\n return cb(err, pkg)\n }\n locks[finalDest] = true\n\n // Ensure that the dependency hasn't been installed already.\n fs.stat(finalDest, function (err) {\n if (!err || err.code !== 'ENOENT') return cb(err, pkg)\n async.series([\n installAtomic.bind(null, dir, tmpDest, finalDest, pkg),\n\n // Completes the installation. This step needs to be \"as atomic as\n // possible\" to ensure that our node_modules is always consistent on a\n // package-by-package basis.\n function (cb) {\n debug('atomic installation of %s completed: %s -> %s', pkg.dist.shasum, tmpDest, finalDest)\n fs.rename(tmpDest, finalDest, cb)\n }\n ], function (err) {\n cb(err, pkg)\n })\n })\n}", "async function refresh() {\n _log('Refreshing environment settings')\n refreshSyncOnly()\n\n const packages = getSetting('Packages')\n const dependencies = getSetting('Dependencies')\n\n if (packages.length && dependencies.length) {\n settings.Packages = packages\n settings.Dependencies = dependencies\n _log('Using cached values')\n return\n }\n _log('Fetching new package information')\n await findPackages()\n}", "_installDependencies() {\n return new Promise((resolve, reject) => {\n const thread = Tasks.npm([\"install\", \"--save\"].concat(this.dependencies), {\n cwd: this.dest,\n stdio: [\"ignore\", 1, 2]\n });\n\n thread.on(\"close\", (code) => {\n if (code == 0) resolve();\n else reject();\n });\n });\n }" ]
[ "0.73457325", "0.6911505", "0.65562487", "0.619107", "0.6153813", "0.6046005", "0.5957651", "0.5914926", "0.59013903", "0.5895902", "0.58865327", "0.5879123", "0.5726318", "0.569718", "0.56145304", "0.5594718", "0.55524945", "0.5523478", "0.5501209", "0.548553", "0.5478032", "0.5472975", "0.5438054", "0.5436479", "0.53988177", "0.5359738", "0.53366303", "0.5321918", "0.5300422", "0.52959186", "0.5281599", "0.5278491", "0.52551097", "0.5240468", "0.52368647", "0.52218395", "0.5176441", "0.5172564", "0.5167441", "0.5162659", "0.5146571", "0.51349276", "0.50973", "0.5037012", "0.5025399", "0.50135386", "0.49959838", "0.49794173", "0.49571624", "0.4952554", "0.49472427", "0.49344227", "0.49070862", "0.49022964", "0.48957768", "0.48953357", "0.48918036", "0.488766", "0.48716497", "0.48337796", "0.4827268", "0.4820462", "0.48173478", "0.47967893", "0.4775056", "0.47650963", "0.4762162", "0.47533292", "0.47469744", "0.47436628", "0.47370443", "0.47367692", "0.47166812", "0.47102907", "0.47092476", "0.4706494", "0.47047764", "0.47010496", "0.47004214", "0.46917778", "0.46906415", "0.46901006", "0.46869224", "0.46854064", "0.4667441", "0.46630475", "0.4658355", "0.46573827", "0.46320045", "0.46233273", "0.4622578", "0.46196383", "0.46066296", "0.45998588", "0.45981658", "0.45848903", "0.4581729", "0.4575996", "0.4553427", "0.45452502" ]
0.74712354
0
Applies a template merge but skips for already existing entries
function applyWithSkipExisting(source, rules) { return (tree, _context) => { const rule = schematics_1.mergeWith(schematics_1.apply(source, [ ...rules, schematics_1.forEach((fileEntry) => { if (tree.exists(fileEntry.path)) { return null; } return fileEntry; }), ])); return rule(tree, _context); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function merge(template, importing, trim) {\n\t\tfor(var a in template){\n\t\t\tif(template.hasOwnProperty(a)){\n\t\t\t\tif(typeof template[a] === 'object'){\n\t\t\t\t\tif(importing.hasOwnProperty(a)) template[a] = merge(template[a], importing[a]);\n\t\t\t\t} else {\n\t\t\t\t\tif(importing.hasOwnProperty(a)){\n\t\t\t\t\t\tif(typeof importing[a] === 'string' && trim) template[a] = removeEmptyStringInputs(importing[a]);\n\t\t\t\t\t\telse template[a] = importing[a];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn template;\n\t}", "function merge(tpl, data) {\n return tpl.replace(\"{{img}}\", data.img)\n .replace(\"{{name}}\", data.name)\n .replace(\"{{description}}\", data.description)\n .replace(\"{{main_content}}\", data.main_content);\n \n}", "function processMergeObjectTemplate(upMergeObject){\n var pMergeObj = angular.copy(upMergeObject);\n pMergeObj.mappings = upMergeObject.mappings.map(function(obj) {\n var row = new LabelTableRow(obj.label, obj.wellType);\n row.count = obj.count;\n return row;\n });\n return pMergeObj;\n }", "function merge(tpl, data) {\n return tpl.replace(\"{{img}}\", data.img)\n .replace(\"{{name}}\", data.name)\n .replace(\"{{description}}\", data.description);\n}", "static _mergeTx(tx, txMap, blockMap, skipIfAbsent) {\n assert(tx.getHash() !== undefined);\n\n // if tx doesn't exist, add it (unless skipped)\n let aTx = txMap[tx.getHash()];\n if (aTx === undefined) {\n if (!skipIfAbsent) {\n txMap[tx.getHash()] = tx;\n } else {\n console.log(\"WARNING: tx does not already exist\");\n }\n }\n\n // otherwise merge with existing tx\n else {\n aTx.merge(tx);\n }\n\n // if confirmed, merge tx's block\n if (tx.getHeight() !== undefined) {\n let aBlock = blockMap[tx.getHeight()];\n if (aBlock === undefined) {\n blockMap[tx.getHeight()] = tx.getBlock();\n } else {\n aBlock.merge(tx.getBlock());\n }\n }\n }", "function testApplyTemplate_multiIncremental() {\r\n var jsonData1 =\r\n {\"Main\": {\r\n \"id\": \"initialid\",\r\n \"caption\": \"critical load\",\r\n \"image\": [{\"src\":\"http://images/image0.jpg\", \"alt\":\"ALT0\"},\r\n {\"src\":\"http://images/image1.jpg\", \"alt\":\"ALT1\"}]\r\n } };\r\n\r\n var jsonData2 =\r\n {\"Main\": {\r\n \"caption\": \"incremental load\",\r\n \"image\": [{}, {}, {\"src\":\"http://images/image2.jpg\", \"alt\":\"ALT2\"}]\r\n }\r\n };\r\n\r\n var jsonData3 =\r\n {\"Main\": {\r\n \"caption\": \"second incremental load\",\r\n \"image\": [{}, {}, {}, {\"src\":\"http://images/image3.jpg\", \"alt\":\"ALT0\"}]\r\n } };\r\n\r\n // First apply.\r\n templateManager.applyTemplate(jsonData1, false, templateOps);\r\n var anchor = document.getElementById('anchor');\r\n assertEquals('this is the critical load', anchor.textContent);\r\n assertEquals('http://servlet/#id=initialid', anchor.href);\r\n\r\n // First incremental.\r\n templateManager.applyTemplate(jsonData2, true, templateOps);\r\n assertEquals('this is the incremental load', anchor.textContent);\r\n\r\n // Second incremental.\r\n templateManager.applyTemplate(jsonData3, true, templateOps);\r\n assertEquals('this is the second incremental load', anchor.textContent);\r\n assertEquals('previous instantiation preserved',\r\n 'http://servlet/#id=initialid', anchor.href);\r\n imageElement1 = document.getElementById(\"image.1\");\r\n assertNotNull(\"imageElement1 preserved\", imageElement1);\r\n var imageElement2 = document.getElementById(\"image.2\");\r\n assertNotNull(\"imageElement2 preservedy\", imageElement2);\r\n var imageElement3 = document.getElementById(\"image.3\");\r\n assertNotNull(\"imageElement3 second apply\", imageElement3);\r\n}", "function unifiedMergeView(config) {\n let orig = typeof config.original == \"string\" ? Text.of(config.original.split(/\\r?\\n/)) : config.original;\n return [\n Prec.low(decorateChunks),\n deletedChunks,\n baseTheme,\n EditorView.editorAttributes.of({ class: \"cm-merge-b\" }),\n EditorState.transactionExtender.of(tr => {\n let updateDoc = tr.effects.find(e => e.is(updateOriginalDoc));\n if (!tr.docChanged && !updateDoc)\n return null;\n let prev = tr.startState.field(ChunkField);\n let chunks = updateDoc ? Chunk.updateA(prev, updateDoc.value.doc, tr.newDoc, updateDoc.value.changes)\n : Chunk.updateB(prev, tr.startState.field(originalDoc), tr.newDoc, tr.changes);\n return { effects: setChunks.of(chunks) };\n }),\n mergeConfig.of({\n highlightChanges: config.highlightChanges !== false,\n markGutter: config.gutter !== false,\n syntaxHighlightDeletions: config.syntaxHighlightDeletions !== false,\n mergeControls: config.mergeControls !== false,\n side: \"b\"\n }),\n originalDoc.init(() => orig),\n config.gutter !== false ? unifiedChangeGutter : [],\n ChunkField.init(state => Chunk.build(orig, state.doc))\n ];\n}", "merge() {\r\n }", "function testApplyTemplate_incremental() {\r\n var jsonData1 =\r\n {\"Main\": {\r\n \"id\": \"initialid\",\r\n \"caption\": \"critical load\",\r\n \"image\": [{\"src\":\"http://images/image0.jpg\", \"alt\":\"ALT0\"},\r\n {\"src\":\"http://images/image1.jpg\", \"alt\":\"ALT1\"}]\r\n } };\r\n var jsonData2 =\r\n {\"Main\": {\r\n \"caption\": \"incremental load\",\r\n \"maindiv\":[{\"text\":\"This is the first one\"},\r\n {}],\r\n \"image\": [{\"width\":\"100\"}, {},\r\n {\"src\":\"http://images/image2.jpg\", \"alt\":\"ALT2\"}]\r\n }\r\n };\r\n templateManager.applyTemplate(jsonData1, false, templateOps);\r\n var main = document.getElementById(\"Main\");\r\n assertNotNull(\"Main first apply\", main);\r\n var anchor = document.getElementById('anchor');\r\n assertEquals('this is the critical load', anchor.textContent);\r\n assertEquals('http://servlet/#id=initialid', anchor.href);\r\n var imageElement0 = document.getElementById(\"image.0\");\r\n assertNotNull(\"ImageElement0 first apply\", imageElement0);\r\n assertNull(imageElement0.getAttribute('width'));\r\n var imageElement1 = document.getElementById(\"image.1\");\r\n assertNotNull(\"ImageElement1 first apply\", imageElement1);\r\n assertEquals(\"http://images/image1.jpg\",\r\n imageElement1.getAttribute('xbl2:src'));\r\n var endInstancesMainDiv =\r\n document.getElementById(END_INSTANCES_MARKER + 'template-id_3');\r\n var mainDivT0 = endInstancesMainDiv.previousSibling;\r\n assertTrue(\"mainDivT0 first apply\", isHidden(mainDivT0));\r\n\r\n // Text element correctly instantiated\r\n var span = document.getElementById('span');\r\n assertEquals('Non-incremental apply works', 'text', span.innerHTML);\r\n\r\n // Table element correctly instantiated\r\n var tables = main.getElementsByTagName('table');\r\n assertEquals('Non-incremental apply copies table', 1, tables.length);\r\n\r\n templateManager.applyTemplate(jsonData2, true, templateOps);\r\n assertEquals(\"100\",\r\n imageElement0.getAttribute('width'));\r\n\r\n assertEquals('this is the incremental load', anchor.textContent);\r\n assertEquals('previous instantiation preserved',\r\n 'http://servlet/#id=initialid', anchor.href);\r\n mainDivT0 = endInstancesMainDiv.previousSibling.previousSibling;\r\n assertTrue(\"maindivT0 second apply\", isVisible(mainDivT0));\r\n assertTrue(\"maindivT0 second apply\",\r\n isVisible(endInstancesMainDiv.previousSibling));\r\n imageElement1 = document.getElementById(\"image.1\");\r\n assertNotNull(\"imageElement1 second apply\", imageElement1);\r\n var imageElement2 = document.getElementById(\"image.2\");\r\n assertNotNull(\"imageElement2 second apply\", imageElement2);\r\n // Text elements are not duplicated in incremental mode.\r\n span = document.getElementById('span');\r\n assertEquals('Incremental apply does not copy span', 'text', span.innerHTML);\r\n \r\n // Table element not duplicated in incremental mode\r\n main0 = document.getElementById(\"Main\");\r\n tables = main0.getElementsByTagName('table');\r\n // The table count should be 1 - only one copy\r\n assertEquals('Incremental apply does not copy table', 1, tables.length);\r\n}", "function testApplyTemplate_nop() {\r\n var dictionaryContext = [{}];\r\n var expectedHtml = document.body.innerHTML;\r\n document.body.innerHTML = originalHtml;\r\n ShadowTemplates = null;\r\n compileTemplates();\r\n templateManager.applyTemplate(dictionaryContext, false, templateOps);\r\n\r\n var bodyElementAfterHtml = document.body.innerHTML;\r\n assertEquals(expectedHtml, bodyElementAfterHtml);\r\n}", "disableIsMerged() {\n this\n .tiles\n .forEach(tile => {\n tile.isMerged = false;\n });\n }", "postProcessBeforeUpserting(doc, { organizationSourceIds, organizationName }) {\n const result = super.postProcessBeforeUpserting(doc);\n const properties = result.properties;\n if (!properties) return result;\n\n properties.lastUpdate = new Date().toISOString();\n\n const placeSourceId = properties.placeSourceId;\n if (placeSourceId) {\n if (!includes(organizationSourceIds, placeSourceId)) {\n const message = `Not authorized: placeSourceId must refer to a data source by ${organizationName} (Allowed: ${organizationSourceIds}, given: ${placeSourceId})`;\n throw new Meteor.Error(401, message);\n }\n\n if (properties.originalPlaceInfoId) {\n const originalPlaceInfoIdField = properties.originalPlaceInfoIdField || 'properties.originalId';\n const selector = { 'properties.sourceId': placeSourceId, [originalPlaceInfoIdField]: properties.originalPlaceInfoId };\n const options = { transform: null, fields: { _id: true, geometry: true } };\n const placeInfo = PlaceInfos.findOne(selector, options);\n if (placeInfo) {\n // console.log('Copying geometry and placeInfoId into disruption from place', placeInfo, 'matching', selector);\n result.properties.placeInfoId = placeInfo._id;\n result.geometry = result.geometry || placeInfo.geometry;\n } else {\n console.log('No placeInfo matching', selector, 'found.');\n }\n }\n }\n\n const equipmentSourceId = properties.equipmentSourceId;\n if (equipmentSourceId) {\n if (!includes(organizationSourceIds, equipmentSourceId)) {\n const message = `Not authorized: equipmentSourceId must refer to a data source by ${organizationName} (Allowed: ${organizationSourceIds}, given: ${equipmentSourceId})`;\n throw new Meteor.Error(401, message);\n }\n\n if (properties.originalEquipmentInfoId) {\n const originalEquipmentInfoIdField = properties.originalEquipmentInfoIdField || 'properties.originalId';\n const selector = { 'properties.sourceId': equipmentSourceId, [originalEquipmentInfoIdField]: properties.originalEquipmentInfoId };\n const options = { transform: null, fields: { _id: true, geometry: true } };\n const equipmentInfo = EquipmentInfos.findOne(selector, options);\n if (equipmentInfo) {\n // console.log('Copying geometry and equipmentInfoId into disruption from equipmentInfo', equipmentInfo, 'matching', selector);\n result.properties.equipmentInfoId = equipmentInfo._id;\n result.geometry = result.geometry || equipmentInfo.geometry;\n } else {\n console.log('No equipment matching', selector, 'found.');\n }\n }\n }\n\n return result;\n }", "postProcessBeforeUpserting(doc, { organizationSourceIds, organizationName }) {\n const result = super.postProcessBeforeUpserting(doc, { organizationSourceIds, organizationName });\n const properties = result.properties;\n if (!properties) return result;\n\n properties.lastUpdate = new Date().toISOString();\n\n const placeSourceId = properties.placeSourceId;\n if (placeSourceId) {\n // For now, we allow to associate disruptions with any place info. Theoretically this could be\n // prevented with this code:\n\n // if (!includes(organizationSourceIds, placeSourceId)) {\n // const message = `Not authorized: placeSourceId must refer to a data source by ${organizationName} (Allowed: ${organizationSourceIds}, given: ${placeSourceId})`;\n // throw new Meteor.Error(401, message);\n // }\n\n if (properties.originalPlaceInfoId) {\n const originalPlaceInfoIdField = properties.originalPlaceInfoIdField || 'properties.originalId';\n const selector = { 'properties.sourceId': placeSourceId, [originalPlaceInfoIdField]: properties.originalPlaceInfoId };\n const options = { transform: null, fields: { _id: true, geometry: true } };\n const placeInfo = PlaceInfos.findOne(selector, options);\n if (placeInfo) {\n // console.log('Copying geometry and placeInfoId into disruption from place', placeInfo, 'matching', selector);\n result.properties.placeInfoId = placeInfo._id;\n result.geometry = result.geometry || placeInfo.geometry;\n } else {\n console.log('No placeInfo matching', selector, 'found.');\n }\n }\n }\n\n const equipmentSourceId = this.options.equipmentSourceId;\n if (equipmentSourceId) {\n // For now, we allow to associate disruptions with any equipment. Theoretically this could be\n // prevented with this code:\n\n // if (!includes(organizationSourceIds, equipmentSourceId)) {\n // const message = `Not authorized: equipmentSourceId must refer to a data source by ${organizationName} (Allowed: ${organizationSourceIds}, given: ${equipmentSourceId})`;\n // throw new Meteor.Error(401, message);\n // }\n\n if (properties.originalEquipmentInfoId) {\n const originalEquipmentInfoIdField = properties.originalEquipmentInfoIdField || 'properties.originalId';\n const selector = { 'properties.sourceId': equipmentSourceId, [originalEquipmentInfoIdField]: properties.originalEquipmentInfoId };\n const options = { transform: null, fields: { _id: true, geometry: true } };\n const equipmentInfo = EquipmentInfos.findOne(selector, options);\n if (equipmentInfo) {\n // console.log('Copying geometry and equipmentInfoId into disruption from equipmentInfo', equipmentInfo, 'matching', selector);\n result.properties.equipmentInfoId = equipmentInfo._id;\n result.geometry = result.geometry || equipmentInfo.geometry;\n } else {\n console.log('No equipment matching', selector, 'found.');\n }\n }\n }\n\n return result;\n }", "function preProcessTemplate(template) {\n\n // Generate the ID base\n var baseid = (new Date()).getTime();\n\n // Establish the template \"lookup\"\n template.properties = new Object();\n template.scripts = new Object();\n template.code = new Object();\n template.conditions = new Object();\n template.wheres = new Object();\n\n // Establish the pre-processed\n template.pre = template.raw;\n\n // Indexes used for parsing\n var begin, end;\n\n // Loop over all the script segements\n while ((begin = template.pre.indexOf('{{')) >= 0) {\n\n // Generate a new key\n var key = '_k1_' + (baseid++).toString();\n\n // Determine the end\n end = template.pre.indexOf('}}', begin);\n\n // Extract the script\n var script = template.pre.slice(begin, end + 1);\n\n // Return the string with the item replaced\n template.pre = [template.pre.slice(0, begin), key, template.pre.slice(end + 2)].join('');\n\n // Add the property into the lookup\n template.scripts[key] = script.trim();\n\n }\n\n // Loop over all the property segments\n while ((begin = template.pre.indexOf('[')) >= 0) {\n\n // Generate a new key\n var key = '_k1_' + (baseid++).toString();\n\n // Determine the end\n end = template.pre.indexOf(']', begin);\n\n // Extract the property\n var property = template.pre.slice(begin, end + 1);\n\n // Return the string with the item replaced\n template.pre = [template.pre.slice(0, begin), key, template.pre.slice(end + 1)].join('');\n\n // Add the property into the lookup\n template.properties[key] = property.trim();\n\n }\n\n // Loop over all the free-code segments\n while ((begin = template.pre.indexOf('{')) >= 0) {\n\n // Generate a new key\n var key = '_k1_' + (baseid++).toString();\n\n // Determine the end\n end = template.pre.indexOf('}', begin);\n\n // Extract the property\n var code = template.pre.slice(begin, end + 1);\n\n // Return the string with the item replaced\n template.pre = [template.pre.slice(0, begin), key, template.pre.slice(end + 1)].join('');\n\n // Add the property into the lookup\n template.code[key] = code.trim();\n\n }\n\n // Define parse function\n this.parsePropCodes = function (name) {\n\n var codes = new Object();\n\n begin = 0;\n\n // Loop over all the condition=\n while ((begin = template.pre.indexOf(name, begin)) >= 0) {\n\n // Move past the whitespace\n while ((isWhitespace(template.pre.charAt(begin)) == false) && (template.pre.charAt(begin) != \"=\"))\n begin++;\n\n // Move past the whitespace\n while (isWhitespace(template.pre.charAt(begin)) == true)\n begin++;\n\n // If we hit an =\n if (template.pre.charAt(begin) == \"=\") {\n\n // Increment\n begin++;\n\n // Move past the whitespace\n while (isWhitespace(template.pre.charAt(begin)) == true)\n begin++;\n\n // If we hit a ' or \"\n if ((template.pre.charAt(begin) == \"\\\"\") || (template.pre.charAt(begin) == \"\\'\")) {\n\n // Get the break\n var brk = template.pre.charAt(begin);\n\n // Increment\n begin++;\n\n // Determine the end\n end = template.pre.indexOf(brk, begin);\n\n // Generate a new key\n var key = '_k1_' + (baseid++).toString();\n\n // Extract the snippet\n var code = template.pre.slice(begin, end);\n\n // Return the string with the item replaced\n template.pre = [template.pre.slice(0, begin), key, template.pre.slice(end)].join('');\n\n // Add the property into the lookup\n codes[key] = code.trim();\n\n }\n\n }\n\n }\n\n // Return\n return codes;\n\n }\n\n // Define parse \"special\" function\n this.parseSpecialElements = function (name) {\n\n begin = 0;\n\n // Loop over all the condition=\n while ((begin = template.pre.indexOf('<', begin)) >= 0) {\n\n var start = begin;\n var tag = '';\n var isclose = false;\n\n // Increment\n begin++;\n\n // Move past the whitespace\n while (isWhitespace(template.pre.charAt(begin)) == true)\n begin++;\n\n // Determine if this is a close tag\n if (template.pre.charAt(begin) == '/') {\n begin++;\n isclose = true;\n }\n\n // Move past the whitespace\n while (isWhitespace(template.pre.charAt(begin)) == true)\n begin++;\n\n // Parse the tag\n while ((isWhitespace(template.pre.charAt(begin)) == false) && (template.pre.charAt(begin) != '>')) {\n tag += template.pre.charAt(begin);\n begin++;\n }\n\n // If the tag matches the name\n if (tag.toLowerCase() == name.toLowerCase()) {\n\n // Replace the tag\n template.pre = [template.pre.slice(0, start), '<' + ((isclose == true) ? '/' : '') + 'div _ktype=\"' + name.toUpperCase() + '\"', template.pre.slice(begin)].join('');\n\n }\n\n }\n\n // Return\n return;\n\n }\n\n // Replace \"condition\" and \"where\"\n template.conditions = this.parsePropCodes(\"condition\");\n template.wheres = this.parsePropCodes(\"where\");\n\n // Replace the \"special\" elements\n this.parseSpecialElements('if');\n this.parseSpecialElements('elseif');\n this.parseSpecialElements('else');\n this.parseSpecialElements('for');\n this.parseSpecialElements('with');\n this.parseSpecialElements('nth');\n this.parseSpecialElements('first');\n this.parseSpecialElements('last');\n\n // Replace all \"src\" and \"href\" references\n template.pre = replaceAll(template.pre, \"src\", \"_src\", true);\n template.pre = replaceAll(template.pre, \"href\", \"_href\", true);\n\n // Wrap the pre-processed template\n template.pre = '<div>' + template.pre + '</div>';\n\n // Return\n return template;\n\n }", "function regionCSSMerge(themeName, templateName, deletedRegionsJSON, callback)\n {\n $.PercServiceUtils.makeJsonRequest(\n $.perc_paths.REGION_CSS_MERGE + \"/\" + themeName + \"/\" + templateName,\n $.PercServiceUtils.TYPE_POST, false, function(status, result)\n {\n if(status === $.PercServiceUtils.STATUS_SUCCESS)\n {\n callback($.PercServiceUtils.STATUS_SUCCESS, result.data);\n }\n else\n {\n var defaultMsg = $.PercServiceUtils.extractDefaultErrorMessage(result.request);\n callback($.PercServiceUtils.STATUS_ERROR, defaultMsg);\n }\n }, deletedRegionsJSON);\n }", "merge(other) {\n return null;\n }", "onTemplateDublicateHandler(template){\n let newTemplates = [...this.state.templates, template];\n this.setState({\n templates: newTemplates\n });\n window.templatesToImport = [...newTemplates]\n }", "mergeNodeConfig(nodeConfig, base = this.config) {\n if (!nodeConfig) {\n Object.keys(base).forEach((configKey) => {\n nodeConfig[configKey] = base[configKey];\n });\n return;\n }\n\n if (nodeConfig._merged) {\n // This node config has already merged with the top level configuration and any templates it has specified\n return;\n }\n\n // Access all templates uniformly through the templates array\n if (nodeConfig.template) {\n if (nodeConfig.templates) {\n nodeConfig.templates.unshift(nodeConfig.template);\n } else {\n nodeConfig.templates = [nodeConfig.template];\n }\n nodeConfig.template = undefined;\n }\n\n // If the node configuration has any templates defined, we destructively apply the template variables directly on\n // the configuration itself and remove the template key so this template application only needs to happen once\n // for each scene.\n\n if (nodeConfig.templates) {\n nodeConfig.templates.forEach((templateName) => {\n const template = this.templates[templateName];\n if (template) {\n Object.keys(template).forEach((key) => {\n nodeConfig[key] = mergeValues(template[key], nodeConfig[key]);\n });\n }\n });\n }\n nodeConfig.templates = undefined;\n\n Object.keys(base).forEach((key) => {\n if (key === 'children') {\n return;\n }\n\n // We still check the truthiness of base[key] because typeof null evaluates to 'object'\n nodeConfig[key] = mergeValues(base[key], nodeConfig[key]);\n });\n\n // Set an internal flag to indicate that base config and templates have been applied\n nodeConfig._merged = true;\n }", "function processCustomDupMerge() {\t\r\n\t//Search for Unprocessed Stage Records\r\n\tvar dflt = [new nlobjSearchFilter('isinactive', null, 'is', 'F'),\r\n\t new nlobjSearchFilter('custrecord_dms_jobid', null, 'isempty','')];\r\n\t\t\r\n\tvar dcol = [new nlobjSearchColumn('custrecord_dms_masterid', null,'group').setSort(true)];\r\n\t\r\n\tvar drs = nlapiSearchRecord('customrecord_ax_dupmerge_stage', null, dflt, dcol);\r\n\r\n\tfor (var d=0; drs && d < drs.length; d+=1) \r\n\t{\r\n\t\tvar masterId = drs[d].getValue('custrecord_dms_masterid', null,'group');\r\n\t\t\r\n\t\tvar hasMasterRecord = true;\r\n\t\t//Checkt to make sure masterId exists.\r\n\t\ttry \r\n\t\t{\r\n\t\t\tnlapiLoadRecord('customer', masterId);\r\n\t\t} \r\n\t\tcatch (mastererr) \r\n\t\t{\r\n\t\t\thasMasterRecord = false;\r\n\t\t}\r\n\t\t\r\n\t\t//1. Loop thorugh each Master Internal ID and search and return all Duplicates to merge \r\n\t\tvar ddflt = [new nlobjSearchFilter('isinactive', null, 'is', 'F'),\r\n\t\t\t new nlobjSearchFilter('custrecord_dms_masterid', null, 'equalto',masterId)];\r\n\t\t\r\n\t\tvar ddcol = [new nlobjSearchColumn('custrecord_dms_duplicatetid').setSort(true),\r\n\t\t new nlobjSearchColumn('internalid')];\r\n\t\t\r\n\t\tvar ddrs = nlapiSearchRecord('customrecord_ax_dupmerge_stage', null, ddflt, ddcol);\r\n\t\t\r\n\t\t//JSON Record \r\n\t\tvar dupJson = {\r\n\t\t\t'stagerec':{}, //Key :: Value = Dup Id :: Record Internal ID. Used to update job ids\r\n\t\t\t'dupids':[], //Represents Duplicate record IDs to be processed. Used for looking up which ones are valid\r\n\t\t\t'validdupids':[], //Represents Duplicate record IDs that actually exists in NetSuite.\r\n\t\t\t'jobid':'' //Represent queued up JobID for THIS Master ID\r\n\t\t};\r\n\t\t\r\n\t\t//---------------Assume Results - Build and Submit Mass Duplicate Job-------------------------------------------\r\n\t\t//ONLY process 200\r\n\t\tfor (var dd=0; dd < ddrs.length; dd+=1)\r\n\t\t{\r\n\t\t\tvar dupId = ddrs[dd].getValue('custrecord_dms_duplicatetid');\r\n\t\t\tvar recInternalId = ddrs[dd].getValue('internalid');\r\n\t\t\t\r\n\t\t\tdupJson.stagerec[dupId] = recInternalId;\r\n\t\t\tdupJson.dupids.push(dupId);\r\n\t\t\t\r\n\t\t\t//Break out if 200 is met. Let the remainder get processed next execution\r\n\t\t\tif ((dd+1) == 200) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\t\t\t\r\n\t\t}\r\n\t\t\r\n\t\t//Next step is to look up list of all Dup Ids that are valid and exists in System\r\n\t\tvar validflt = [new nlobjSearchFilter('internalid', null, 'anyof', dupJson.dupids)];\r\n\t\tvar validrs = nlapiSearchRecord('customer',null, validflt, null);\r\n\t\tfor (var v=0; validrs && v < validrs.length; v+=1)\r\n\t\t{\r\n\t\t\tdupJson.validdupids.push(validrs[v].getId());\r\n\t\t}\r\n\t\t\r\n\t\tlog('debug', 'masterId // JSON object', masterId+' // '+JSON.stringify(dupJson));\r\n\t\t\r\n\t\t//Only Queue up Mass Merge Job if there are Valid DupIds\r\n\t\tif (dupJson.validdupids.length > 0 && hasMasterRecord)\r\n\t\t{\r\n\t\t\t// Get a job manager instance.\r\n\t\t\tvar manager = nlapiGetJobManager('DUPLICATERECORDS');\r\n\r\n\t\t\t// Create the merge job object.\r\n\t\t\tvar mergeJobRequest = manager.createJobRequest();\r\n\r\n\t\t\t// Set the entity type.\r\n\t\t\t//include all three types\r\n\t\t\tmergeJobRequest.setEntityType(mergeJobRequest.ENTITY_CUSTOMER);\r\n\r\n\t\t\t// Set the master. Specifically set to be by ID\r\n\t\t\tmergeJobRequest.setMasterSelectionMode(mergeJobRequest.MASTERSELECTIONMODE_SELECT_BY_ID);\r\n\t\t\t\r\n\t\t\t//Set the Master ID\r\n\t\t\tmergeJobRequest.setMasterId(masterId);\r\n\r\n\t\t\t// Set duplicate records. Pass in parameter is an array of duplicate record IDs\r\n\t\t\tmergeJobRequest.setRecords(dupJson.validdupids);\r\n\r\n\t\t\t// Set the merge operation type.\r\n\t\t\tmergeJobRequest.setOperation(mergeJobRequest.OPERATION_MERGE);\r\n\r\n\t\t\t// Submit a job to process asynchronously. Submitting the job does not execute the job.\r\n\t\t\t// Submitting the job places the job in the queue.\r\n\t\t\tdupJson.jobid = manager.submit(mergeJobRequest);\r\n\t\t}\r\n\t\t\r\n\t\t//Once processing is done, go back and UPDATE Queue Record by looping thoruhg ALL Dup IDs\r\n\t\t//If Dup ID is NOT one of validdupids, update job id as \"Record Does NOT Exists\".\r\n\t\tfor (var f=0; f < dupJson.dupids.length; f+=1)\r\n\t\t{\r\n\t\t\tvar jobIdValue = dupJson.jobid;\r\n\t\t\tif (!hasMasterRecord || !dupJson.validdupids.contains(dupJson.dupids[f]))\r\n\t\t\t{\r\n\t\t\t\tjobIdValue = constStringNoRecord;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tlog('debug','jobid',jobIdValue);\r\n\t\t\t\r\n\t\t\t//Check to see if Master ID is valid and/or active/inactive\r\n\t\t\tvar masterValueToSet = masterId;\r\n\t\t\tif (hasMasterRecord) \r\n\t\t\t{\r\n\t\t\t\tvar masterIsInactive = nlapiLookupField('customer', masterId, 'isinactive', false);\r\n\t\t\t\t\r\n\t\t\t\tif (masterIsInactive == 'T')\r\n\t\t\t\t{\r\n\t\t\t\t\tmasterValueToSet = '';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t//Update Each Stage record with proper Job ID Value and set Master Record ID\r\n\t\t\tvar queueUpdFld = ['custrecord_dms_jobid','custrecord_dms_masterrec'];\r\n\t\t\tvar queueUpdVal = [jobIdValue, masterValueToSet];\r\n\t\t\tnlapiSubmitField('customrecord_ax_dupmerge_stage', dupJson.stagerec[dupJson.dupids[f]], queueUpdFld, queueUpdVal, false);\r\n\t\t}\r\n\t\t//--------------------------------------------------------------------------------------\r\n\t\t\r\n\t\tlog('debug','Remaining Usage ',nlapiGetContext().getRemainingUsage());\r\n\t\t\r\n\t\t//Set % completed of script processing\r\n\t\tvar pctCompleted = Math.round(((d+1) / drs.length) * 100);\r\n\t\tnlapiGetContext().setPercentComplete(pctCompleted);\r\n\t\t\r\n\t\tif ((d+1)==1000 || ((d+1) < drs.length && nlapiGetContext().getRemainingUsage() < 1000)) \r\n\t\t{\r\n\t\t\t//reschedule\r\n\t\t\tnlapiLogExecution('debug','Getting Rescheduled at', masterId);\r\n\t\t\tnlapiScheduleScript(nlapiGetContext().getScriptId(), nlapiGetContext().getDeploymentId(), null);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n}", "function syncWithMerge() {\n loadSyncData(function(data) {\n if (data) {\n if (onMerge && data != elements.styles) {\n data = onMerge(data, elements.styles);\n saveSyncData(data);\n }\n onSync(data);\n }\n else {\n saveSyncData(elements.styles);\n }\n });\n}", "function createMergedDocument(naming, template, fldr, obj, opt) {\n var name = findReplaceInString(naming, obj);\n var file = copyFileToFolder(template, fldr).setName(name);\n var doc = openFileAsType(file, \"document\");\n findReplaceInDoc(doc, obj);\n return file;\n}", "function testApplyTemplate_basic() {\r\n var jsonData =\r\n {\"Main\": {\r\n \"image\": [{\"src\":\"http://images/complex.jpg\", \"alt\":\"ALT0\"},\r\n {\"src\":\"http://images/simple.jpg\", \"alt\":\"ALT1\"}],\r\n \"maindiv\":[{\"text\":\"This is the first one\"},\r\n {}]\r\n }\r\n };\r\n\r\n var mainEndInstancesMarker =\r\n document.getElementById(END_INSTANCES_MARKER + 'MainT');\r\n assertNotNull('Main template instance should exist', mainEndInstancesMarker);\r\n\r\n // Apply the template\r\n templateManager.applyTemplate(jsonData, false, templateOps);\r\n\r\n mainEndInstancesMarker =\r\n document.getElementById(END_INSTANCES_MARKER + 'MainT');\r\n assertNotNull('Main template Instance again be present',\r\n mainEndInstancesMarker);\r\n\r\n var mainElement0 = document.getElementById(\"MainT\");\r\n assertNotNull('Main instance should be present', mainElement0);\r\n\r\n // Should have passed through Header and instantiated maindiv twice\r\n var maindivElement0 = document.getElementById(\"maindiv.0\");\r\n assertEquals('<b>example</b><xbl2:span id=\"$id_1.0\">This is the first one</xbl2:span>',\r\n maindivElement0.innerHTML);\r\n var maindivElement1 = document.getElementById(\"maindiv.1\");\r\n assertEquals('<b>example</b><XBL2:SPAN id=\"$id_1.1\"></XBL2:SPAN>',\r\n maindivElement1.innerHTML);\r\n // Should have instantiated image twice\r\n var imageElement0 = document.getElementById(\"image.0\");\r\n assertEquals(\"ALT0\", imageElement0.getAttribute(\"alt\"));\r\n assertEquals(\"http://images/complex.jpg\",\r\n imageElement0.getAttribute('xbl2:src'));\r\n var imageElement1 = document.getElementById(\"image.1\");\r\n assertEquals(\"ALT1\", imageElement1.getAttribute(\"alt\"));\r\n assertEquals(\"http://images/simple.jpg\",\r\n imageElement1.getAttribute('xbl2:src'));\r\n assertNotNull('Should not have disturbed span',\r\n document.getElementById(\"span\"));\r\n}", "reconcileChildContext(context) {\n // set the right context id for open and close\n // template tags, so we can use it as sub-block ids\n ['start', 'close'].forEach((op) => {\n const key = context.meta[`${op}Name`];\n const phs = this.placeholders.get(key) || [];\n const tag = phs.find(findTemplateFn(this.id, context.templateIndex));\n if (tag) {\n tag.ctx = context.id;\n }\n });\n // reconcile placeholders\n const childPhs = context.placeholders;\n childPhs.forEach((values, key) => {\n const phs = this.placeholders.get(key);\n if (!phs) {\n this.placeholders.set(key, values);\n return;\n }\n // try to find matching template...\n const tmplIdx = phs.findIndex(findTemplateFn(context.id, context.templateIndex));\n if (tmplIdx >= 0) {\n // ... if found - replace it with nested template content\n const isCloseTag = key.startsWith('CLOSE');\n const isTemplateTag = key.endsWith('NG-TEMPLATE');\n if (isTemplateTag) {\n // current template's content is placed before or after\n // parent template tag, depending on the open/close atrribute\n phs.splice(tmplIdx + (isCloseTag ? 0 : 1), 0, ...values);\n }\n else {\n const idx = isCloseTag ? values.length - 1 : 0;\n values[idx].tmpl = phs[tmplIdx];\n phs.splice(tmplIdx, 1, ...values);\n }\n }\n else {\n // ... otherwise just append content to placeholder value\n phs.push(...values);\n }\n this.placeholders.set(key, phs);\n });\n this._unresolvedCtxCount--;\n }", "reconcileChildContext(context) {\n // set the right context id for open and close\n // template tags, so we can use it as sub-block ids\n ['start', 'close'].forEach((op) => {\n const key = context.meta[`${op}Name`];\n const phs = this.placeholders.get(key) || [];\n const tag = phs.find(findTemplateFn(this.id, context.templateIndex));\n if (tag) {\n tag.ctx = context.id;\n }\n });\n // reconcile placeholders\n const childPhs = context.placeholders;\n childPhs.forEach((values, key) => {\n const phs = this.placeholders.get(key);\n if (!phs) {\n this.placeholders.set(key, values);\n return;\n }\n // try to find matching template...\n const tmplIdx = phs.findIndex(findTemplateFn(context.id, context.templateIndex));\n if (tmplIdx >= 0) {\n // ... if found - replace it with nested template content\n const isCloseTag = key.startsWith('CLOSE');\n const isTemplateTag = key.endsWith('NG-TEMPLATE');\n if (isTemplateTag) {\n // current template's content is placed before or after\n // parent template tag, depending on the open/close atrribute\n phs.splice(tmplIdx + (isCloseTag ? 0 : 1), 0, ...values);\n }\n else {\n const idx = isCloseTag ? values.length - 1 : 0;\n values[idx].tmpl = phs[tmplIdx];\n phs.splice(tmplIdx, 1, ...values);\n }\n }\n else {\n // ... otherwise just append content to placeholder value\n phs.push(...values);\n }\n this.placeholders.set(key, phs);\n });\n this._unresolvedCtxCount--;\n }", "reconcileChildContext(context) {\n // set the right context id for open and close\n // template tags, so we can use it as sub-block ids\n ['start', 'close'].forEach((op) => {\n const key = context.meta[`${op}Name`];\n const phs = this.placeholders.get(key) || [];\n const tag = phs.find(findTemplateFn(this.id, context.templateIndex));\n if (tag) {\n tag.ctx = context.id;\n }\n });\n // reconcile placeholders\n const childPhs = context.placeholders;\n childPhs.forEach((values, key) => {\n const phs = this.placeholders.get(key);\n if (!phs) {\n this.placeholders.set(key, values);\n return;\n }\n // try to find matching template...\n const tmplIdx = findIndex(phs, findTemplateFn(context.id, context.templateIndex));\n if (tmplIdx >= 0) {\n // ... if found - replace it with nested template content\n const isCloseTag = key.startsWith('CLOSE');\n const isTemplateTag = key.endsWith('NG-TEMPLATE');\n if (isTemplateTag) {\n // current template's content is placed before or after\n // parent template tag, depending on the open/close atrribute\n phs.splice(tmplIdx + (isCloseTag ? 0 : 1), 0, ...values);\n }\n else {\n const idx = isCloseTag ? values.length - 1 : 0;\n values[idx].tmpl = phs[tmplIdx];\n phs.splice(tmplIdx, 1, ...values);\n }\n }\n else {\n // ... otherwise just append content to placeholder value\n phs.push(...values);\n }\n this.placeholders.set(key, phs);\n });\n this._unresolvedCtxCount--;\n }", "reconcileChildContext(context) {\n // set the right context id for open and close\n // template tags, so we can use it as sub-block ids\n ['start', 'close'].forEach((op) => {\n const key = context.meta[`${op}Name`];\n const phs = this.placeholders.get(key) || [];\n const tag = phs.find(findTemplateFn(this.id, context.templateIndex));\n if (tag) {\n tag.ctx = context.id;\n }\n });\n // reconcile placeholders\n const childPhs = context.placeholders;\n childPhs.forEach((values, key) => {\n const phs = this.placeholders.get(key);\n if (!phs) {\n this.placeholders.set(key, values);\n return;\n }\n // try to find matching template...\n const tmplIdx = findIndex(phs, findTemplateFn(context.id, context.templateIndex));\n if (tmplIdx >= 0) {\n // ... if found - replace it with nested template content\n const isCloseTag = key.startsWith('CLOSE');\n const isTemplateTag = key.endsWith('NG-TEMPLATE');\n if (isTemplateTag) {\n // current template's content is placed before or after\n // parent template tag, depending on the open/close atrribute\n phs.splice(tmplIdx + (isCloseTag ? 0 : 1), 0, ...values);\n }\n else {\n const idx = isCloseTag ? values.length - 1 : 0;\n values[idx].tmpl = phs[tmplIdx];\n phs.splice(tmplIdx, 1, ...values);\n }\n }\n else {\n // ... otherwise just append content to placeholder value\n phs.push(...values);\n }\n this.placeholders.set(key, phs);\n });\n this._unresolvedCtxCount--;\n }", "function mappingToExists(existings, newCmptOptions, mode) {\n var isNormalMergeMode = mode === 'normalMerge';\n var isReplaceMergeMode = mode === 'replaceMerge';\n var isReplaceAllMode = mode === 'replaceAll';\n existings = existings || [];\n newCmptOptions = (newCmptOptions || []).slice();\n var existingIdIdxMap = Object(zrender_lib_core_util__WEBPACK_IMPORTED_MODULE_0__[/* createHashMap */ \"g\"])(); // Validate id and name on user input option.\n\n Object(zrender_lib_core_util__WEBPACK_IMPORTED_MODULE_0__[/* each */ \"k\"])(newCmptOptions, function (cmptOption, index) {\n if (!Object(zrender_lib_core_util__WEBPACK_IMPORTED_MODULE_0__[/* isObject */ \"z\"])(cmptOption)) {\n newCmptOptions[index] = null;\n return;\n }\n\n if (false) {}\n });\n var result = prepareResult(existings, existingIdIdxMap, mode);\n\n if (isNormalMergeMode || isReplaceMergeMode) {\n mappingById(result, existings, existingIdIdxMap, newCmptOptions);\n }\n\n if (isNormalMergeMode) {\n mappingByName(result, newCmptOptions);\n }\n\n if (isNormalMergeMode || isReplaceMergeMode) {\n mappingByIndex(result, newCmptOptions, isReplaceMergeMode);\n } else if (isReplaceAllMode) {\n mappingInReplaceAllMode(result, newCmptOptions);\n }\n\n makeIdAndName(result); // The array `result` MUST NOT contain elided items, otherwise the\n // forEach will ommit those items and result in incorrect result.\n\n return result;\n}", "merge(destination = {}, source = {}, options) {\n const defaults = {\n customMerge: (key) => {\n if (key !== 'variants') {\n return;\n }\n return (destination, source) => {\n source.forEach(sourceVariant => {\n destination.forEach((destinationVariant, index) => {\n if (destinationVariant.name === sourceVariant.name) {\n destination[index] = deepmerge(destination[index], sourceVariant);\n }\n });\n });\n return destination;\n }\n },\n };\n options = options || defaults;\n return deepmerge(destination, source, options)\n }", "function applyTemplate() {\n return through.obj(function(file, enc, cb) {\n var data = {\n site: site,\n page: file.page,\n content: file.contents.toString()\n };\n\n var templateFile = path.join(\n __dirname, 'docs', '_templates', file.page.layout + '.html');\n var tpl = swig.compileFile(templateFile, {cache: false});\n file.contents = new Buffer(tpl(data), 'utf8');\n this.push(file);\n cb();\n });\n}", "function replaceTemplate(template = '', map = {}) {\n const reg = Object.keys(map)\n .map(key => key.replace(/([.*+?^=!:${}()|[\\]/\\\\])/g, '\\\\$1'))\n .join('|');\n return template.replace(\n new RegExp(reg, 'gm'),\n placeholer => map[placeholer] || '',\n );\n}", "function mappingToExists(existings, newCmptOptions, mode) {\n\t var isNormalMergeMode = mode === 'normalMerge';\n\t var isReplaceMergeMode = mode === 'replaceMerge';\n\t var isReplaceAllMode = mode === 'replaceAll';\n\t existings = existings || [];\n\t newCmptOptions = (newCmptOptions || []).slice();\n\t var existingIdIdxMap = createHashMap(); // Validate id and name on user input option.\n\t\n\t each(newCmptOptions, function (cmptOption, index) {\n\t if (!isObject(cmptOption)) {\n\t newCmptOptions[index] = null;\n\t return;\n\t }\n\t\n\t if (true) {\n\t // There is some legacy case that name is set as `false`.\n\t // But should work normally rather than throw error.\n\t if (cmptOption.id != null && !isValidIdOrName(cmptOption.id)) {\n\t warnInvalidateIdOrName(cmptOption.id);\n\t }\n\t\n\t if (cmptOption.name != null && !isValidIdOrName(cmptOption.name)) {\n\t warnInvalidateIdOrName(cmptOption.name);\n\t }\n\t }\n\t });\n\t var result = prepareResult(existings, existingIdIdxMap, mode);\n\t\n\t if (isNormalMergeMode || isReplaceMergeMode) {\n\t mappingById(result, existings, existingIdIdxMap, newCmptOptions);\n\t }\n\t\n\t if (isNormalMergeMode) {\n\t mappingByName(result, newCmptOptions);\n\t }\n\t\n\t if (isNormalMergeMode || isReplaceMergeMode) {\n\t mappingByIndex(result, newCmptOptions, isReplaceMergeMode);\n\t } else if (isReplaceAllMode) {\n\t mappingInReplaceAllMode(result, newCmptOptions);\n\t }\n\t\n\t makeIdAndName(result); // The array `result` MUST NOT contain elided items, otherwise the\n\t // forEach will ommit those items and result in incorrect result.\n\t\n\t return result;\n\t }", "merge (def, overwriter) {\n return _.assignIn(\n {},\n def,\n overwriter,\n );\n }", "removeRepeatFromChildTemplates(template) {\n\t const nonRepeatSubTemplates = this.getNonRepeatSubtrees(template);\n\t nonRepeatSubTemplates.forEach(childTemplate => {\n\t const repeatedFields = template.repeat.column.concat(template.repeat.row);\n\t childTemplate.encodings.forEach((value, key) => {\n\t if (channeldef.isFieldDef(value)) {\n\t if (channeldef.isRepeatRef(value.field)) {\n\t const index = Math.floor(Math.random() * repeatedFields.length);\n\t const fieldRef = {\n\t field: repeatedFields[index],\n\t type: value.type\n\t };\n\t childTemplate.overwrittenEncodings.set(key, fieldRef);\n\t }\n\t }\n\t });\n\t });\n\t }", "function alignDataWithTemplate(data,\n optional_filled_template) {\n // var dataCopy = angular.copy(data); // do not\n // alter original data\n // console.log(template_default);\n if (optional_filled_template) {\n // delete unknown properties\n for (var attrname in data) {\n if (!optional_filled_template\n .hasOwnProperty(attrname)) {\n delete data[attrname];\n // console.log('delete ' + attrname);\n }\n }\n // add missing properties\n for (var attrname in optional_filled_template) {\n if (!data.hasOwnProperty(attrname)) {\n data[attrname] = optional_filled_template[attrname];\n console.log('add filled ' + attrname);\n }\n }\n }\n\n // add missing properties\n for (var attrname in hiddenData) {\n if (!data.hasOwnProperty(attrname)) {\n data[attrname] = hiddenData[attrname];\n console.log('add hidden ' + attrname);\n }\n }\n return data;\n }", "onApplyTemplate() {\r\n this.i.ac();\r\n }", "function mergeOntoFirst(first, second) {\n\t\tfor (let key of Object.keys(second)) {\n\t\t\tif (typeof first[key] === 'object' && typeof second[key] === 'object') {\n\t\t\t\tmergeOntoFirst(first[key], second[key]);\n\t\t\t} else {\n\t\t\t\tfirst[key] = second[key];\n\t\t\t}\n\t\t}\n\t}", "function mergeTreeEntry(mainTree, mergeTree) {\n if (mergeTree.lookup && (!mainTree.lookup ||\n mainTree.lookup.index > mergeTree.lookup.index ||\n (mainTree.lookup.index === mergeTree.lookup.index && mainTree.lookup.subIndex > mergeTree.lookup.subIndex))) {\n mainTree.lookup = mergeTree.lookup;\n }\n if (mergeTree.forward) {\n if (!mainTree.forward) {\n mainTree.forward = mergeTree.forward;\n }\n else {\n mergeSubtree(mainTree.forward, mergeTree.forward);\n }\n }\n if (mergeTree.reverse) {\n if (!mainTree.reverse) {\n mainTree.reverse = mergeTree.reverse;\n }\n else {\n mergeSubtree(mainTree.reverse, mergeTree.reverse);\n }\n }\n}", "function loadTemplate() {\n if ($.isEmptyObject(oTemplate) === true) {\n oTemplate = $('.template').clone();\n }\n }", "function mergePatches(patches, startPatch, endPatch, paragraph_index) {\r\n if (startPatch == endPatch) {\r\n return patches[startPatch];\r\n }\r\n else {\r\n print('Merging ' + startPatch + ' to ' + endPatch);\r\n var newPatch = prune(startPatch, 10^10); // do a deep copy of the object, 10^10 takes us to pretty much artibrary depth\r\n\t\tnewPatch.start = patches[startPatch].start;\r\n newPatch.end = Array.max(map(patches.slice(startPatch, endPatch+1), function(patch) { return patch.end; } ) ); // get the largest end value of the patches\r\n newPatch.editStart = Array.min(map(patches.slice(startPatch, endPatch+1), function(patch) { return patch.editStart; } ) );\r\n newPatch.editEnd = Array.max(map(patches.slice(startPatch, endPatch+1), function(patch) { return patch.editEnd; } ) );\r\n newPatch.numEditors = Stats.sum(map(patches.slice(startPatch, endPatch+1), function(patch) { return patch.numEditors; } ) );\r\n newPatch.merged = true;\r\n\t\tnewPatch.originalText = getParagraph(paragraphs[paragraph_index]).substring(newPatch.editStart, newPatch.editEnd); \r\n \r\n newPatch.options = new Array();\r\n foreach(patches[startPatch].options, function(fieldOption) {\r\n newPatch.options.push( {\r\n field: fieldOption.field,\r\n alternatives: [],\r\n editsText: fieldOption.editsText\r\n });\r\n });\r\n \r\n for (var i=startPatch; i<=endPatch; i++) {\r\n foreach(newPatch.options, function(fieldOption) {\r\n if (fieldOption.editsText) {\r\n var suggestedAlternatives = fieldOption.alternatives.concat(mergeOptions(patches, startPatch, endPatch, i, paragraph_index, newPatch.editStart, newPatch.editEnd, fieldOption.field));\r\n\t\t\t\t\tfieldOption.alternatives = new Array();\r\n\t\t\t\t\t\r\n\t\t\t\t\t// We need to iterate through and remove duplicates again, since the duplicates may have been generated in different patches\r\n\t\t\t\t\tvar knownAlternatives = new Array();\r\n\t\t\t\t\tfor (var j=0; j<suggestedAlternatives.length; j++) {\r\n\t\t\t\t\t\tprint(json(knownAlternatives));\r\n\t\t\t\t\t\tvar thisText = suggestedAlternatives[j].text;\r\n\t\t\t\t\t\tif (knownAlternatives.indexOf(thisText) == -1) {\r\n\t\t\t\t\t\t\tprint(\"adding unique: \" + thisText);\r\n\t\t\t\t\t\t\tknownAlternatives.push(thisText);\r\n\t\t\t\t\t\t\tfieldOption.alternatives.push(suggestedAlternatives[j]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n } else {\r\n fieldOption.alternatives = fieldOption.alternatives.concat(getAlternativesForFieldName(patches[i], fieldOption.field));\r\n }\r\n });\r\n }\r\n return newPatch;\r\n }\r\n}", "function mergeTag (a, b) {\n if (a.length < b.length) return b;\n return a;\n }", "merge(existing, incoming, { args, field }) {\n console.log(\"\\n\\nMERGE incoming = \", incoming);\n console.log(\"MERGE existing = \", existing);\n\n const { skip, first } = args;\n console.log(\"merging items from network...\");\n // 9. Take a copy of the existing array, or make a new empty one\n const merged = existing ? existing.slice(0) : [];\n // 10. Insert the items into our array at the spot which they belong.\n // we do it this way because someone might visit page 2 first, so we need to pad blank spots in the array\n for (let i = skip; i < skip + incoming.length; ++i) {\n merged[i] = incoming[i - skip];\n }\n // 11. finally we are done, return the merged array, which will then call read() once more. But this item we have items, so read() will be able to serve them up from the cache\n return merged;\n }", "function populateTemplate(template, data) {\n for (let key in data) {\n let regex = new RegExp('{{' + key + '}}', 'g');\n template = template.replace(regex, data[key]);\n }\n return template;\n}", "function prepare(results, overrides) {\n return results.map(function (result) {\n if (overrides && overrides.length) {\n var overrideItem = _.find(overrides, function (listItem) {\n return listItem.articleId === result._id\n })\n if (overrideItem) {\n return applyOverrides(result, overrideItem)\n } else {\n return result\n }\n }\n return result\n })\n}", "function getGroupFiles( groupIndex ) {\n if (groupIndex < groupIDArray.length ) {\n // if here, we have more group templates to grab and merge\n var groupID = groupIDArray[groupIndex];\n var resource = 'group_' + groupID;\n /* prepare callback function for readFromGithub. Not really needed for the single template fetch, but allows us to\n * use the same function when we have multiple templates to merge\n */\n function rghResult(result) {\n // send result back to app\n if (isEmptyObject(resultObject)) {\n resultObject = result;\n }\n else {\n resultObject = _.concat(resultObject, result); // concat/merge with existing group results\n }\n getGroupFiles(++groupIndex); // get next group template to merge\n }\n\n /*\n * Fetch national/global group data template first\n * (will attempt to read file from local cache, then grab from github if not present)\n * This is a \"lazy load\" method and will only ever read from github if file does not exist in local cache\n * Local cache is cleared when receive notice from github that branch has been merged or pushed...\n */\n var regionCountry = regionTag.substring(0,2);\n var resourceFile = '../' + process.env.LOCAL_CACHE + '/' + branch + '/' + regionCountry + '/group/' + resource + '.json';\n logger.info({resource: resource, branch: branch, url: resourceFile});\n fs.readFile(resourceFile, 'utf8', function(err,data) {\n if (err || data.length < 1) {\n // try github since file not available in local cache\n readFromGitHub( rghResult, 'group', resource, branch, regionCountry, regionTag, null );\n }\n else {\n // NOTE: since this is cached, we know that the JSON.parse will never throw an error here\n var groupObject = JSON.parse(data);\n // logger.info(groupObject);\n /*\n * Now read file from national template location and \"absorb\" into national template...\n * Like national fetch, this will read form local cache first, then go to github if not found.\n * Note that when a template is NOT found in github, an empty JSON object is stored to local cache so that we\n * don't keep trying to get it from github on each resource request (and so we know it should be here now).\n */\n resourceFile = '../' + process.env.LOCAL_CACHE + '/' + branch + '/' + regionTag + '/group/'+ resource + '.json';\n logger.info({resource: resource, branch: branch, url: resourceFile});\n fs.readFile(resourceFile, 'utf8', function(err,data) {\n var regionalResultObject = {};\n if (err || data.length < 1) {\n // if here, already have national object cached, but may have fetched when looked at a different region\n // do github call for regional ONLY (no countryTag given tells function this)\n readFromGitHub( rghResult, 'group', resource, branch, null, regionTag, groupObject );\n }\n else {\n // NOTE: since this is cached, we know that the JSON.parse will never throw an error here\n regionalResultObject= JSON.parse(data);\n // now absorb local into national\n //logger.info(groupObject);\n //logger.info(regionalResultObject);\n var mergeObject = _.extend(groupObject, regionalResultObject);\n if (isEmptyObject(resultObject)) {\n resultObject = mergeObject;\n }\n else {\n resultObject = _.concat(resultObject, mergeObject); // now absorb local/national of this group with prev. groups\n }\n //logger.info(groupObject);\n getGroupFiles(++groupIndex); // get next group template to merge\n }\n });\n }\n });\n }\n else\n {\n // if here, have finished accumulating results, send them off...\n res.json(resultObject);\n }\n }", "function fillTemplate(template, data){\r\n var result = template;\r\n\r\n for(var el in data){\r\n var mark = \"{{ \" + el + \" }}\";\r\n result = result.replace(mark, data[el]);\r\n }\r\n\r\n return result;\r\n }", "function renderTemplateContent(response_data)\n{\n\n\t// copy the response data into two JSON objects\n\tvar content1 = content2 = JSON.parse(response_data);\n\t// replace timestamp in the 1st JSON object to board_timestamp\n\tcontent1 = JSON.parse(JSON.stringify(content1).split('\"timestamp\":').join('\"board_timestamp\":'));\n\t// replace location in the 1st JSON object to board_location\n\tcontent1 = JSON.parse(JSON.stringify(content1).split('\"location\":').join('\"board_location\":'));\n\t\n\t// replace timestamp in the 2nd JSON object to depart_timestamp\n\tcontent2 = JSON.parse(JSON.stringify(content2).split('\"timestamp\":').join('\"depart_timestamp\":'));\n\t// replace location in the 1st JSON object to depart_location\n\tcontent2 = JSON.parse(JSON.stringify(content2).split('\"location\":').join('\"depart_location\":'));\n\t\n\t// reverse the two JSON objects\n\tcontent1.docs = content1.docs.reverse();\n\tcontent2.docs = content2.docs.reverse();\n\n\t// declare a result object\n\t// for the concatenated o/p of 2 JSON objects\n\tvar result = {\n\t\tdocs:[]\n\t};\t\n\n\tvar A=0; // to point content1 JSON object\n\tvar B=1; // to point content2 JSON object\n\t\n\t// as board and depart transactions are considered as 1 tuple in o/p\n\tvar count_size=content1.docs.length/2;\n\tfor(var i=0;i<count_size;i++) \n\t{\n\t\tvar result_obj = {};\n\t\t// add all the board travel details to result object\n\t\tfor(var key in content1.docs[A]) result_obj[key] = content1.docs[A][key];\n\t\t// add all the depart travel details to result object\n\t\tfor(var key in content2.docs[B]) result_obj[key] = content2.docs[B][key];\n\t\tresult.docs[i] = result_obj;\n\t\tA += 2;\n\t\tB += 2;\n\t}\n\t// now reverse the resultant result object\n\tresult.docs = result.docs.reverse();\n\t\n\t// get the template code from the handlebars-template \n\tvar raw_template = document.getElementById('employee-travel-details-template').innerHTML;\n\t// compile the template\n\tvar compiled_template = Handlebars.compile(raw_template);\n\t// render the compiled code\n\tvar rendered_code = compiled_template(result);\t\n\t// set back the rendered_code into the result div\n\tdocument.getElementById('employee-travel-details').innerHTML = rendered_code;\n\t// check if the last transaction is done or not\n\tif(document.getElementById('emp-travel-depart-time').innerHTML==\"NOT SCANNED YET\")\n\t{\n\t\tdocument.getElementById('emp-travel-depart-location').style.color=\"red\";\n\t\tdocument.getElementById('emp-travel-depart-time').style.color =\"red\";\n\t}\n}", "function processTemplate(template, model) {\n\n // Establish the current \"view\" model\n template.view = bindView(template.root.scripts, model, template.dom);\n\n var replace = [];\n\n // Loop over the template constructs\n for (var i = 0; i < template.dom.children.length; i++) {\n\n // Acces the child\n var child = template.dom.children[i];\n\n // Access the node name\n var name = getNodeName(child);\n\n // Process the construct node types\n if (name == \"IF\")\n replace.push({ p: child.parentNode, r: child, w: processIF(template, child) });\n else if (name == \"FOR\")\n replace.push({ p: child.parentNode, r: child, w: processFOR(template, child) });\n else if (name == \"WITH\")\n replace.push({ p: child.parentNode, r: child, w: processWITH(template, child) });\n else if (hasTemplateContent(child) == true) {\n\n // Evaluate the template with the array object instance and add the result to the \"add\" collection\n child.innerHTML = processTemplate(openSubTemplate(child, template), template.view);\n\n }\n\n }\n\n // Replace the nodes\n for (var ri = 0; ri < replace.length; ri++)\n replaceNode(replace[ri].p, replace[ri].r, replace[ri].w);\n\n // Access the \"raw\" html template\n var html = template.dom.innerHTML;\n\n // Loop over the \"code\" snipptes processing\n for (var codeID in template.root.code) {\n\n // If the text contains the code,\n if (html.indexOf(codeID) >= 0) {\n\n // Access the \"code\"\n var code = template.root.code[codeID];\n\n // Trim the { and }\n code = code.substring(1, code.length - 1);\n\n // Replace with the value\n html = replaceKey(html, codeID, (new Function(code)).call(template.view));\n\n }\n\n }\n\n // Loop over the \"property\" processing\n for (var propertyID in template.root.properties) {\n\n // If the text contains the property,\n if (html.indexOf(propertyID) >= 0) {\n\n // Access the \"property\"\n var property = template.root.properties[propertyID];\n\n // Trim the [ and ] and whitespace\n property = property.substring(1, property.length - 1).trim();\n\n // Replace with the value\n if (property == \"#\")\n html = replaceKey(html, propertyID, template.index);\n else if (property == \"##\")\n html = replaceKey(html, propertyID, template.count);\n else if (property == \"$\")\n html = replaceKey(html, propertyID, template.str);\n else\n html = replaceKey(html, propertyID, parseValue(template.view, property));\n\n }\n\n }\n\n // Replace all \"src\" and \"href\" references\n html = replaceAll(html, \"_src\", \"src\", true);\n html = replaceAll(html, \"_href\", \"href\", true);\n\n // Return\n return html;\n\n }", "function StaticMerger() {}", "_copyTemplateFile(sourcePath, destinationPath) {\n if (!this._overwriteParameter.value) {\n if (node_core_library_1.FileSystem.exists(destinationPath)) {\n console.log(colors.yellow('Not overwriting already existing file: ') + destinationPath);\n return;\n }\n }\n if (node_core_library_1.FileSystem.exists(destinationPath)) {\n console.log(colors.yellow(`Overwriting: ${destinationPath}`));\n }\n else {\n console.log(`Generating: ${destinationPath}`);\n }\n const outputLines = [];\n const lines = node_core_library_1.FileSystem.readFile(sourcePath, { convertLineEndings: \"\\n\" /* Lf */ })\n .split('\\n');\n let activeBlockSectionName = undefined;\n let activeBlockIndent = '';\n for (const line of lines) {\n let match;\n // Check for a block section start\n // Example: /*[BEGIN \"DEMO\"]*/\n match = line.match(InitAction._beginMacroRegExp);\n if (match) {\n if (activeBlockSectionName) {\n // If this happens, please report a Rush bug\n throw new Error(`The template contains an unmatched BEGIN macro for \"${activeBlockSectionName}\"`);\n }\n activeBlockSectionName = match[2];\n activeBlockIndent = match[1];\n // Remove the entire line containing the macro\n continue;\n }\n // Check for a block section end\n // Example: /*[END \"DEMO\"]*/\n match = line.match(InitAction._endMacroRegExp);\n if (match) {\n if (activeBlockSectionName === undefined) {\n // If this happens, please report a Rush bug\n throw new Error(`The template contains an unmatched END macro for \"${activeBlockSectionName}\"`);\n }\n if (activeBlockSectionName !== match[2]) {\n // If this happens, please report a Rush bug\n throw new Error(`The template contains an mismatched END macro for \"${activeBlockSectionName}\"`);\n }\n if (activeBlockIndent !== match[1]) {\n // If this happens, please report a Rush bug\n throw new Error(`The template contains an inconsistently indented section \"${activeBlockSectionName}\"`);\n }\n activeBlockSectionName = undefined;\n // Remove the entire line containing the macro\n continue;\n }\n let transformedLine = line;\n // Check for a single-line section\n // Example: /*[LINE \"HYPOTHETICAL\"]*/\n match = transformedLine.match(InitAction._lineMacroRegExp);\n if (match) {\n const sectionName = match[1];\n const replacement = this._isSectionCommented(sectionName) ? '// ' : '';\n transformedLine = transformedLine.replace(InitAction._lineMacroRegExp, replacement);\n }\n // Check for variable expansions\n // Example: [%RUSH_VERSION%]\n while (match = transformedLine.match(InitAction._variableMacroRegExp)) {\n const variableName = match[1];\n const replacement = this._expandMacroVariable(variableName);\n transformedLine = transformedLine.replace(InitAction._variableMacroRegExp, replacement);\n }\n // Verify that all macros were handled\n match = transformedLine.match(InitAction._anyMacroRegExp);\n if (match) {\n // If this happens, please report a Rush bug\n throw new Error('The template contains a malformed macro expression: ' + JSON.stringify(match[0]));\n }\n // If we are inside a block section that is commented out, then insert the \"//\" after indentation\n if (activeBlockSectionName !== undefined) {\n if (this._isSectionCommented(activeBlockSectionName)) {\n // Is the line indented properly?\n if (transformedLine.substr(0, activeBlockIndent.length).trim().length > 0) {\n // If this happens, please report a Rush bug\n throw new Error(`The template contains inconsistently indented lines inside`\n + ` the \"${activeBlockSectionName}\" section`);\n }\n // Insert comment characters after the indentation\n const contentAfterIndent = transformedLine.substr(activeBlockIndent.length);\n transformedLine = activeBlockIndent + '// ' + contentAfterIndent;\n }\n }\n outputLines.push(transformedLine);\n }\n // Write the output\n node_core_library_1.FileSystem.writeFile(destinationPath, outputLines.join('\\r\\n'), {\n ensureFolderExists: true\n });\n }", "function runMerge_onClick() {\n showLoading('Merging...');\n clearDisplay('alerts');\n google.script.run\n .withSuccessHandler(updateDisplay)\n .runMerge();\n}", "function mapRange(messages, filename) {\n const transformed = TRANSFORM_CACHE.get(filename);\n const original = TEXT_CACHE.get(filename);\n const flattened = messages.flat();\n\n if (!transformed) {\n return flattened;\n }\n\n // if there are no instances of the placeholder value, then this template\n // did not contain a <template> tag, so preprocessed === postprocessed\n if (!transformed.includes(util.TEMPLATE_TAG_PLACEHOLDER)) {\n return flattened;\n }\n\n const originalDoc = new DocumentLines(original);\n const transformedDoc = new DocumentLines(transformed);\n\n const lines = transformed.split('\\n');\n const originalLines = original.split('\\n');\n\n // get template ranges to remove eslint messages that are inside the templates\n const templateRanges = [];\n let isInsideTemplate = false;\n for (const [index, line] of lines.entries()) {\n const lineHasOpeningTag = openingTemplateTagRegex.test(line);\n const lineHasClosingTag = closingTemplateTagRegex.test(line);\n\n if (lineHasOpeningTag) {\n isInsideTemplate = true;\n templateRanges.push({\n start: transformedDoc.positionToOffset({\n line: index,\n character: line.search(openingTemplateTagRegex),\n }),\n end: -1,\n });\n }\n\n if (lineHasClosingTag && isInsideTemplate) {\n isInsideTemplate = false;\n const match = line.match(closingTemplateTagRegex);\n const current = templateRanges.slice(-1)[0];\n current.end = transformedDoc.positionToOffset({\n line: index,\n character: match.index + match[0].length,\n });\n }\n }\n\n // this function assumes the original output and transformed output\n // are identical, minus the changes to transform `<template>` into the\n // placeholder `[__GLIMMER_TEMPLATE()]\n //\n // in the future, for a usecase like integrating prettier --fix,\n // this assumption will no longer be valid, and should be removed/refactored\n if (lines.length !== originalLines.length) {\n throw new Error(\n 'eslint-plugin-ember expected source file and transform file to have the same line length, but they differed'\n );\n }\n\n const filtered = flattened.filter((it) => {\n const start = transformedDoc.positionToOffset({\n line: it.line - 1,\n character: it.column - 1,\n });\n const end = transformedDoc.positionToOffset({\n line: it.endLine - 1,\n character: it.endColumn - 1,\n });\n return (\n ALLOWED_RULESSET_FOR_TEMPLATES.has(it.ruleId) ||\n // include if message wraps template\n templateRanges.some((tpl) => start === tpl.start && end === tpl.end) ||\n // exclude if message is within template (also when it ends on next line, column 1, so +1 char, e.g semi rule)\n !templateRanges.some((tpl) => start >= tpl.start && end <= tpl.end + 1)\n );\n });\n\n return filtered.map((message) => {\n // we need to adjust the fix range provided by eslint to the correct range in the original content\n // the lines & columns did not change, except for the template part. but the total offset did, as the template content changed\n // therefore we need to remap the range correctly:\n // 1. convert range in transformed content to line & column. We know this is the same, but offsets are different\n // 2. convert line & column back to offsets in the original content\n if (message.fix) {\n const [start, end] = message.fix.range;\n const startPos = transformedDoc.offsetToPosition(start);\n const endPos = transformedDoc.offsetToPosition(end);\n const fix = message.fix;\n fix.range = [originalDoc.positionToOffset(startPos), originalDoc.positionToOffset(endPos)];\n }\n\n // 1. handle eslint diagnostics on single lines.\n if (message.line === message.endLine) {\n const originalLine = originalLines[message.line - 1];\n const transformedLine = lines[message.line - 1];\n if (originalLine === transformedLine) {\n // original line and transformed line match exactly. return original diagnostic message\n return message;\n }\n\n // when the lines do not match, we've hit a lint error on a line containing the\n // <template> tag, the closing </template> tag, or possibly both.\n\n const modified = { ...message };\n const token = transformedLine.slice(message.column - 1, message.endColumn - 1);\n const lineHasOpeningTag = openingTemplateTagRegex.test(transformedLine);\n const lineHasClosingTag = closingTemplateTagRegex.test(transformedLine);\n\n if (oneLineTemplateRegex.test(token)) {\n // lint error is on a full, one-line <template>foo</template>\n const templateContext = token.match(oneLineTemplateRegex)[1];\n const newToken = `<${util.TEMPLATE_TAG_NAME}>${templateContext}<${util.TEMPLATE_TAG_NAME}>`;\n\n // this case is simple: we know we have a one-line template invocation, and the\n // start `column` will be the same regardless of syntax. simply calculate the\n // length of the full token `<template>...</template>` and set the endColumn.\n modified.endColumn = modified.column + newToken.length + 1;\n return modified;\n }\n\n if (lineHasClosingTag) {\n const scopeTokens = transformedLine.match(getScopeTokenRegex)?.[1]?.split(',') ?? [];\n if (scopeTokens.includes(token)) {\n // when we have an error specifically with a scope token, we output the error\n // on the starting <template> tag. Currently, we do not know the position of\n // the token in the template, so there were efforts to do regex searches to\n // find the token. Long story short, these all were very bug-prone, so now we\n // just modify the message slightly and return it on the opening template tag.\n\n let idx = message.line - 1;\n let curLine = lines[idx];\n\n while (idx) {\n const templateTag = curLine.search(openingTemplateTagRegex);\n if (templateTag > -1) {\n modified.line = idx + 1;\n modified.endLine = idx + 1;\n modified.column = templateTag + 1;\n modified.endColumn = templateTag + `<${util.TEMPLATE_TAG_NAME}>`.length + 1;\n modified.message = `Error in template: ${message.message}`;\n return modified;\n }\n curLine = lines[--idx];\n }\n }\n } else if (lineHasOpeningTag) {\n // token is before the <template> tag, no modifications necessary\n if (transformedLine.indexOf(token) < transformedLine.search(openingTemplateTagRegex)) {\n return message;\n }\n }\n } else {\n // 2. handle multi-line diagnostics from eslint\n const originalRange = originalLines.slice(message.line - 1, message.endLine);\n const transformedRange = lines.slice(message.line - 1, message.endLine);\n if (arrayEq(originalRange, transformedRange)) {\n // original line range and transformed linerange match exactly. return original diagnostic message\n return message;\n }\n\n // for ranges containing template tag placeholders, the only change we should need to make is\n // on the endColumn field, as this is the only one guaranteed to be different. The start column\n // field does not need to be transformed, because it should be the same regardless of if we are\n // using a <template> tag or the placeholder.\n //\n // we modify the endColumn below by finding the index of the closing placeholder tag, and\n // mapping the placeholder syntax back into the ending column of the original `</template>` tag\n\n const modified = { ...message };\n\n const endLine = lines[message.endLine - 1];\n if (closingTemplateTagRegex.test(endLine)) {\n const originalEndLine = originalLines[message.endLine - 1];\n const closingTemplateTag = `</${util.TEMPLATE_TAG_NAME}>`;\n const closingTagIndex = originalEndLine.indexOf(closingTemplateTag);\n\n if (closingTagIndex) {\n modified.endColumn = closingTagIndex + closingTemplateTag.length + 1;\n }\n }\n\n return modified;\n }\n\n // if all else fails: return the original message. It may not have the correct line/col,\n // but it is better to return a mis-aligned diagnostic message than none at all.\n return message;\n });\n}", "function mergeProfile(req,userData){\r\n\r\n var profileSetter = new SetProfile();\r\n var tagGetter = new GetTags();\r\n var tagAdder = new AddNewTagInDB();\r\n\r\n for (key in req) {\r\n if (req[key]!=userData[key]){\r\n //If the the Key is a tag Share or a tag Discover,\r\n if (key == \"tags_share\" || key == \"tags_discover\"){\r\n //!\\\\ tags_share and tags_discover are differenciated by the variable key //!\\\\\r\n console.log(\"The \"+key+\" table will we updated according to this tab: \");\r\n tagsToEdit = tagsEditor(req[key],userData[key]);\r\n for (tag in tagsToEdit){\r\n if ((parseInt(tag)%2)==0){\r\n if (tagsToEdit[parseInt(tag)+1]==\"ADD\"){\r\n //Need to add the tag\r\n //Check if tag is in DB\r\n tagIsInTagsTable = tagGetter.getTagByName(tagsToEdit[tag].toUpperCase());\r\n if (tagIsInTagsTable == undefined){\r\n //if not add it\r\n tagAdder.addNewTagInDB(tagsToEdit[tag]);\r\n //And get its new ID\r\n concernedTag = tagGetter.getTagByName(tagsToEdit[tag]);\r\n //Add the tag in the table:\r\n profileSetter.setTag(userData.id,key,concernedTag.id,\"ADD\");\r\n }else{\r\n concernedTag = tagGetter.getTagInKey(userData.id,tagIsInTagsTable.id,key);\r\n //Add the tag in tag_key:\r\n if (concernedTag == undefined) {\r\n profileSetter.setTag(userData.id, key, tagIsInTagsTable.id, \"ADD\");\r\n } else {\r\n console.log(\"Tag \"+ concernedTag.tag + \" already found in table tags\");\r\n }\r\n }\r\n }else if (tagsToEdit[parseInt(tag)+1]==\"DEL\"){\r\n //Delete a tag\r\n tagToEdit = tagGetter.getTagByName(tagsToEdit[tag]);\r\n profileSetter.setTag(userData.id,key,tagToEdit.id,\"DEL\");\r\n }\r\n }\r\n }\r\n } else {\r\n //Update the user profile's concerned column\r\n console.log(\"USER \"+ userData.id +\" UPDATED \" + key + \" FROM \" + userData[key] + \" TO \" + req[key]);\r\n profileSetter.setProfile(userData.email,key,req[key]);\r\n console.log(\"USER \"+ userData.id +\" UPDATED \" + key + \" FROM \" + userData[key] + \" TO \" + req[key]);\r\n }\r\n }\r\n }\r\n}", "function inlinedTemplates() { }", "function mergeIf() {\n\t\tvar a = arguments;\n\t\tif(a.length < 2) {\n\t\t\treturn;\n\t\t}\n\t\tfor(var i = 1; i < a.length; i++) {\n\t\t\tfor(var r in a[i]) {\n\t\t\t\tif(a[0][r] == null) {\n\t\t\t\t\ta[0][r] = a[i][r];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn a[0];\n\t}", "changeSocialServiceLayout(layout){\n if(this.state.clickedTemplate){\n let styledClickedTemplate = {...this.state.clickedTemplate};\n styledClickedTemplate.socialLayout = layout;\n let templatesChanged = this.state.templates.map((templ)=>{\n if(templ.id === this.state.clickedTemplate.id){\n return {...templ, socialLayout: layout}\n }else{\n return templ;\n }\n })\n this.setState({\n clickedTemplate: styledClickedTemplate,\n templates: templatesChanged\n })\n window.templatesToImport = [...templatesChanged]\n }\n }", "async function mergePackageJsons () {\n const rawJson = await template.generate({\n directory: `${PLUGIN_PATH}/boilerplate/src`,\n template: 'package.json.ejs',\n props: {}\n })\n\n\n const newPackageJson = JSON.parse(rawJson)\n const currentPackage = filesystem.read('package.json', 'json')\n\n // deep merge, lol\n const newPackage = pipe(\n assoc(\n 'dependencies',\n merge(currentPackage.dependencies, newPackageJson.dependencies)\n ),\n assoc(\n 'devDependencies',\n merge(currentPackage.devDependencies, newPackageJson.devDependencies)\n ),\n assoc('scripts', merge(currentPackage.scripts, newPackageJson.scripts)),\n merge(\n __,\n omit(['dependencies', 'devDependencies', 'scripts'], newPackageJson)\n )\n )(currentPackage)\n\n // write this out\n filesystem.write('package.json', newPackage, {jsonIndent: 2})\n }", "function ApplyTemplate(data) \n{\n var template = \"<tr id=\\\"zipRow${_id}\\\">\" +\n \"<td>${zipcode}</td>\" +\n\t\t\t\t\t\t\t\"<td>${city}</td>\" +\n\t\t\t\t\t\t\t\"<td>${geoloc}</td>\" +\n\t\t\t\t\t\t\t\"<td>${population}</td>\" +\n \"<td>${state}</td>\" +\n \"<td>\" +\n \"<a href=\\\"javascript:OpenUpdateDialog('${_id}')\\\">Update</a>\" +\n \" \" +\n \"<a href=\\\"javascript:OpenDeleteDialog('${_id}')\\\">Delete</a>\" +\n \"</td>\" +\n\t\t\t\t\t\t\"</tr>\";\n\n $.tmpl(template, data).appendTo(\"#zips tbody\");\n\n if (curPage > 0)\n $(\"#prev-page\").removeAttr('disabled');\n else\n $(\"#prev-page\").attr('disabled','disabled');\n\n if (curPage < Math.floor((totalEntries - 1) / entriesPerPage))\n $(\"#next-page\").removeAttr('disabled');\n else\n $(\"#next-page\").attr('disabled','disabled');\n}", "function h(t,e,n,r,i,o,c){return t.op=e,u.canMerge(n)&&t.merge(n),r&&t._mergeUpdate(r),s.isObject(i)&&t.setOptions(i),o||c?!t._update||!t.options.overwrite&&0===s.keys(t._update).length?(c&&s.soon(c.bind(null,null,0)),t):(i=t._optionsForExec(),c||(i.safe=!1),n=t._conditions,r=t._updateForExec(),a(\"update\",t._collection.collectionName,n,r,i),c=t._wrapCallback(e,c,{conditions:n,doc:r,options:i}),t._collection[e](n,r,i,s.tick(c)),t):t}", "function combinePosts() {\n\tfor (var j = (blogEntries.length - 1); j >= 0; j--) {\n\t\tformatPostHTML(j);\n\t}\n}", "mergeServerUpserts(entities, collection, defaultMergeStrategy, mergeStrategy) {\n if (entities == null || entities.length === 0) {\n return collection; // nothing to merge.\n }\n let didMutate = false;\n let changeState = collection.changeState;\n mergeStrategy =\n mergeStrategy == null ? defaultMergeStrategy : mergeStrategy;\n switch (mergeStrategy) {\n case MergeStrategy.IgnoreChanges:\n return this.adapter.upsertMany(entities, collection);\n case MergeStrategy.OverwriteChanges:\n collection = this.adapter.upsertMany(entities, collection);\n changeState = entities.reduce((chgState, entity) => {\n const id = this.selectId(entity);\n const change = chgState[id];\n if (change) {\n if (!didMutate) {\n chgState = { ...chgState };\n didMutate = true;\n }\n delete chgState[id];\n }\n return chgState;\n }, collection.changeState);\n return didMutate ? { ...collection, changeState } : collection;\n case MergeStrategy.PreserveChanges: {\n const upsertEntities = [];\n changeState = entities.reduce((chgState, entity) => {\n const id = this.selectId(entity);\n const change = chgState[id];\n if (change) {\n if (!didMutate) {\n chgState = {\n ...chgState,\n [id]: {\n ...chgState[id],\n originalValue: entity,\n },\n };\n didMutate = true;\n }\n }\n else {\n upsertEntities.push(entity);\n }\n return chgState;\n }, collection.changeState);\n collection = this.adapter.upsertMany(upsertEntities, collection);\n return didMutate ? { ...collection, changeState } : collection;\n }\n }\n }", "syncConfigFileWithTemplate() {\n\t\tconst { config } = this;\n\t\tconst configTemplate = require(configTemplateFilePath);\n\n\t\tconfigTemplate.forEach((fieldSet, fieldSetIndex) => {\n\t\t\tconst fieldSetId = fieldSet.id;\n\n\t\t\t// Find this fieldset in current config\n\t\t\tconst configFieldSet = config.filter(configFieldSet => configFieldSet.id === fieldSetId)[0];\n\n\t\t\tif (configFieldSet) {\n\t\t\t\t// Fieldset exists in config, check its properties\n\t\t\t\t(fieldSet.properties || []).forEach((property, propertyIndex) => {\n\t\t\t\t\tconst propertyId = property.id;\n\n\t\t\t\t\tif (! configFieldSet.properties) {\n\t\t\t\t\t\tconfigFieldSet.properties = [];\n\t\t\t\t\t}\n\n\t\t\t\t\tconst configProperty = configFieldSet.properties\n\t\t\t\t\t\t.filter(configProp => configProp.id === propertyId)[0];\n\n\t\t\t\t\tif (! configProperty) {\n\t\t\t\t\t\tconfigFieldSet.properties.splice(propertyIndex, 0, property);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// It is a new fieldset, insert it into config\n\t\t\t\tconfig.splice(fieldSetIndex, 0, fieldSet);\n\t\t\t}\n\t\t});\n\n\t\tthis.updateConfigFile();\n\t}", "function merge() {\n var i,\n args = arguments,\n len,\n ret = {},\n doCopy = function (copy, original) {\n var value, key;\n \n // An object is replacing a primitive\n if (typeof copy !== 'object') {\n copy = {};\n }\n \n for (key in original) {\n if (original.hasOwnProperty(key)) {\n value = original[key];\n \n // Copy the contents of objects, but not arrays or DOM nodes\n if (value && typeof value === 'object' && Object.prototype.toString.call(value) !== '[object Array]'\n && key !== 'renderTo' && typeof value.nodeType !== 'number') {\n copy[key] = doCopy(copy[key] || {}, value);\n \n // Primitives and arrays are copied over directly\n } else {\n copy[key] = original[key];\n }\n }\n }\n return copy;\n };\n \n // If first argument is true, copy into the existing object. Used in setOptions.\n if (args[0] === true) {\n ret = args[1];\n args = Array.prototype.slice.call(args, 2);\n }\n \n // For each argument, extend the return\n len = args.length;\n for (i = 0; i < len; i++) {\n ret = doCopy(ret, args[i]);\n }\n \n return ret;\n }", "function mergeConfigs(dst, src) {\n _.forEach(src || {}, (value, key) => {\n\n // if destination exists & already has `~override` flag, keep it intact\n if (_.isObject(dst[key]) && dst[key]['~override']) return;\n\n // if source has `~override` flag - override whole value in destination\n if (value && value['~override']) {\n dst[key] = value;\n return;\n }\n\n // if both nodes are arrays, concatenate them\n if (_.isArray(value) && _.isArray(dst[key])) {\n value.forEach(v => { dst[key].push(v); });\n return;\n }\n\n // if both nodes are objects - merge recursively\n if (_.isObject(value) && _.isObject(dst[key])) {\n mergeConfigs(dst[key], value);\n return;\n }\n\n // destination node does not exist - create\n // or both nodes are of different types - override.\n dst[key] = value;\n return;\n });\n\n return dst;\n}", "function consolidateToMap(map, itemsArray, mergeExistingFn, idFieldName = 'id') {\n const unprocessedKeys = {};\n\n map.forEach((_value, key) => {\n unprocessedKeys[key] = true;\n });\n\n itemsArray.forEach(item => {\n const id = item[idFieldName];\n const hasExisting = map.has(id);\n const exiting = map.get(id);\n\n if (!exiting) {\n map.set(item[idFieldName], item);\n } else {\n mergeExistingFn(exiting, item);\n }\n\n if (hasExisting) {\n delete unprocessedKeys[id];\n }\n });\n\n _.forEach(unprocessedKeys, (_value, key) => {\n map.delete(key);\n });\n}", "async mergeExistingItems(html, items) {\n if (this.actorOriginal.flags.ddbimporter) {\n const ownedItems = this.actor.getEmbeddedCollection(\"Item\");\n\n let nonMatchedItems = [];\n let matchedItems = [];\n\n await items.forEach((item) => {\n let matchedItem = ownedItems.find(\n (owned) =>\n item.name === owned.data.name &&\n item.type === owned.data.type &&\n item.flags?.ddbimporter?.id === owned.data.flags?.ddbimporter?.id\n );\n if (matchedItem) {\n if (!matchedItem.data.flags.ddbimporter?.ignoreItemImport) {\n item[\"_id\"] = matchedItem[\"id\"];\n if (matchedItem.data.flags.ddbimporter?.ignoreIcon) {\n item.flags.ddbimporter.matchedImg = matchedItem.data.img;\n item.flags.ddbimporter.ignoreIcon = true;\n }\n if (matchedItem.data.flags.ddbimporter?.retainResourceConsumption) {\n item.data.consume = matchedItem.data.data.consume;\n item.flags.ddbimporter.retainResourceConsumption = true;\n }\n\n matchedItems.push(item);\n }\n } else {\n nonMatchedItems.push(item);\n }\n });\n\n logger.debug(\"Finished retaining items\");\n return nonMatchedItems.concat(matchedItems);\n } else {\n return items;\n }\n }", "merge(existing, incoming, { args: { offset = 0 } }) {\n // Slicing is necessary because the existing data is\n // immutable, and frozen in development.\n const merged = existing ? existing.slice(0) : [];\n for (let i = 0; i < incoming.length; ++i) {\n merged[offset + i] = incoming[i];\n }\n return merged;\n }", "function insertTemplate() {\n\n mainTag.insertAdjacentHTML(\"afterbegin\", templateApp);\n\n let templateContent = document.getElementById(\"tiny-example\").content;\n let cloneNode = templateContent.cloneNode(true);\n\n mainTag.lastChild.remove();\n mainTag.append(cloneNode);\n\n}", "function merge_row(obj1, obj2){\n var res = {};\n if(obj1 === null && obj2 === null){ // both are null\n return null;\n }\n if(obj1 === undefined){ // one is null\n if(obj2 !== undefined){\n return obj2; //obj1 is null\n }\n else{\n return null;\n }\n }\n if(typeof(obj1) === \"object\" && typeof(obj2) === \"object\"){\n //console.log(\"obj1.id \" + obj1.id + \"\\tobj2.id \" + obj2.id);\n if(obj1.id === obj2.id && typeof(obj1.id) === \"number\"){\n for(var key in obj1){ // loop through and add obj1's porperties, making sure for no duplicates\n if(key !== undefined){\n res[key] = obj1[key];\n }\n else{\n res[key] = obj2[key];\n } \n }\n for(var key in obj2){ // loop through and add obj2's porperties, making sure for no duplicates\n if(key !== undefined){\n res[key] = obj2[key];\n }\n else{\n res[key] = obj1[key];\n } \n }\n //console.log(\"merged\");\n return res;\n }\n else{\n //console.log(\"obj1 != obj2\");\n return null;\n }\n }\n return null;\n \n}", "function mergeElementsAndReplacePlaceholders(target, source) {\n\t\t// TODO\n\t}", "getAggregatedTemplate (wnode) {\n const template = this.getTemplate(wnode.templateName);\n\n if (wnode.components.length === 0) {\n return template;\n }\n\n return wnode.components.reduce(\n (aggregated, component) => {\n const contribution = this.getAggregatedTemplate(component);\n\n return aggregated.combinedWith(contribution);\n },\n template\n );\n }", "combineMergeImage() {\n for (let i1 = this.daySuffix.length - 1; i1 >= 0; i1--) {\n console.log(\"Creating Merge Master:: \" + this.daySuffix[i1]);\n // Copy the data in reverse day order without replacement - \n //\n let mergePath = path.join(this.cwd, this.MERGE_DATA + this.daySuffix[i1]);\n var folderList = fs.readdirSync(mergePath);\n // Enumerate the user account folders in EdForge_MERGEMASTER.\n // \n for (let entry of folderList) {\n let mergeDst = path.join(this.cwd, this.MERGE_MASTER, entry);\n let mergeSrc = path.join(this.cwd, this.MERGE_DATA + this.daySuffix[i1], entry);\n var stat = fs.statSync(mergeSrc);\n if (stat.isDirectory()) {\n Utils_1.Utils.validatePath(mergeDst, null);\n this.combineUserFolder(mergeSrc, mergeDst, true);\n }\n else {\n // Do a non-destructive Copy \n // \n try {\n fs.copyFileSync(mergeSrc, mergeDst, constants_1.COPYFILE_EXCL);\n }\n catch (err) {\n // Ignore dupliciates\n }\n }\n }\n }\n }", "function processTemplate($, context, template) {\n const extracted = {};\n\n // Allow to iterate on a list of element changing context\n function iterate(nestedTemplate) {\n const usesRootGroup = typeof nestedTemplate === 'function';\n return (nestedContext, filter) => {\n const nestedProcessDefinition = createDefinitionProcessor($, nestedContext, iterate);\n return nestedContext\n .filter((i, node) => filter(nestedProcessDefinition))\n .map((i, node) => processTemplate($, node, usesRootGroup ? { root: nestedTemplate } : nestedTemplate))\n .get()\n .map(usesRootGroup ? (value) => value.root : identity);\n };\n }\n\n const processDefinition = createDefinitionProcessor($, context, iterate);\n Object.keys(template).forEach((key) => {\n if (typeof template[key] === 'function') {\n extracted[key] = processDefinition(template[key]);\n } else if (typeof template[key] === 'object') {\n extracted[key] = processTemplate($, context, template[key]);\n } else {\n extracted[key] = template[key];\n }\n });\n\n return extracted;\n}", "function mergeMatch(match1, match2) {\n var res = {\n placeholders: {} // Some matches may not have placeholders; this is OK\n\n };\n\n if (!match1.placeholders && !match2.placeholders) {\n return res;\n } else if (!match1.placeholders) {\n return match2;\n } else if (!match2.placeholders) {\n return match1;\n } // Placeholders with the same key must match exactly\n\n\n for (var key in match1.placeholders) {\n res.placeholders[key] = match1.placeholders[key];\n\n if (match2.placeholders.hasOwnProperty(key)) {\n if (!_exactMatch(match1.placeholders[key], match2.placeholders[key])) {\n return null;\n }\n }\n }\n\n for (var _key in match2.placeholders) {\n res.placeholders[_key] = match2.placeholders[_key];\n }\n\n return res;\n }", "function mergeCustomizedModels(allModels, modelPathMap, options) {\n let customizedModels = Object.keys(allModels).filter(function (k) {\n return (allModels[k].customModel || allModels[k].customizedModel || allModels[k].isCustomized);\n });\n\n for (let i = 0; i < customizedModels.length; ++i) {\n let mergedModel = {};\n let name = customizedModels[i];\n let modelPaths = modelPathMap[name];\n let save = {};\n for (let j = 0, m = 0; j < modelPaths.length; ++j) {\n var s = modelPaths[j];\n\n var p = null;\n if ((s.charAt(0) >= 'a' && s.charAt(0) <= 'z') || (s.charAt(0) >= 'A' && s.charAt(0) <= 'Z')) {\n p = path.resolve(options.appRootDir, '../node_modules/' + s + '/' + name);\n } else {\n p = path.resolve(options.appRootDir, s + '/' + name);\n }\n let fullFileName = p + '.json';\n var realFileName = getModelFileName(name, fullFileName);\n if (fs.existsSync(realFileName)) {\n log.debug(log.defaultContext, 'Merging ' + name, realFileName);\n var model = require(realFileName);\n var jsFile = realFileName.replace('.json', '.js');\n save[name + '_' + m.toString()] = { model: model, sourceFile: jsFile };\n ++m;\n _.merge(mergedModel, model);\n }\n }\n // var ary = Object.keys(save);\n // for(var m=1; m<ary.length; ++m){\n // if(save[m]){\n // save[m-1].name = 'x'.repeat(m) + 'Base' + name;\n // save[m-1].plural = save[m-1].name + 's';\n // save[m].base = save[m-1].name;\n // }\n // }\n var funcs = [];\n let ary = Object.keys(save);\n for (let k = 0; k < ary.length; ++k) {\n if (save[ary[k]]) {_.merge(save[ary[k]].model, mergedModel);}\n if (save[ary[k]].sourceFile && fs.existsSync(save[ary[k]].sourceFile)) {\n funcs[k] = require(save[ary[k]].sourceFile);\n }\n }\n\n /* eslint-disable no-inner-declarations */\n function mergedJs(Model) {\n var functionArray = mergedJs.functionArray;\n for (var i = 0; i < functionArray.length; ++i) {\n functionArray[i](Model);\n }\n }\n mergedJs.functionArray = funcs;\n /* eslint-enable no-inner-declarations */\n\n // let mergedJs = function (Model) {\n // for(var i=0; i < funcs.length; ++i){\n // funcs[i](Model);\n // }\n // //funcs.forEach(f => f(Model));\n // };\n // mergedJs.funcs = funcs;\n\n for (let k in save) {\n if (save[k].sourceFile && fs.existsSync(save[k].sourceFile)) {\n require.cache[save[k].sourceFile].exports = mergedJs;\n }\n }\n }\n}", "function merge() {\n\tvar i,\n\t\targs = arguments,\n\t\tlen,\n\t\tret = {},\n\t\tdoCopy = function (copy, original) {\n\t\t\tvar value, key;\n\n\t\t\t// An object is replacing a primitive\n\t\t\tif (typeof copy !== 'object') {\n\t\t\t\tcopy = {};\n\t\t\t}\n\n\t\t\tfor (key in original) {\n\t\t\t\tif (original.hasOwnProperty(key)) {\n\t\t\t\t\tvalue = original[key];\n\n\t\t\t\t\t// Copy the contents of objects, but not arrays or DOM nodes\n\t\t\t\t\tif (value && typeof value === 'object' && Object.prototype.toString.call(value) !== '[object Array]' &&\n\t\t\t\t\t\t\tkey !== 'renderTo' && typeof value.nodeType !== 'number') {\n\t\t\t\t\t\tcopy[key] = doCopy(copy[key] || {}, value);\n\t\t\t\t\n\t\t\t\t\t// Primitives and arrays are copied over directly\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcopy[key] = original[key];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn copy;\n\t\t};\n\n\t// If first argument is true, copy into the existing object. Used in setOptions.\n\tif (args[0] === true) {\n\t\tret = args[1];\n\t\targs = Array.prototype.slice.call(args, 2);\n\t}\n\n\t// For each argument, extend the return\n\tlen = args.length;\n\tfor (i = 0; i < len; i++) {\n\t\tret = doCopy(ret, args[i]);\n\t}\n\n\treturn ret;\n}", "function testApplyTemplate_removeOrHideTemplateInstances() {\r\n var jsonData =\r\n {\"Main\": {\r\n \"image\": [{}]\r\n }\r\n };\r\n\r\n ShadowTemplates.jsonData = {'Main' : { 'image': [{}]} };\r\n templateManager.applyTemplate(jsonData, true, templateOps);\r\n\r\n // Should have second image element since we are rebinding now in incremental\r\n // mode\r\n var imageT0 = document.getElementById(\"imageT.0\");\r\n assertTrue('imageT.0 visible', isVisible(imageT0));\r\n var imageT1 = document.getElementById(\"imageT.1\");\r\n assertTrue('imageT.1 hidden', isHidden(imageT1));\r\n // Should not have affected the logT instance\r\n var logT0 = document.getElementById(\"logT.0\");\r\n assertTrue('logT0 remains hidden', isHidden(logT0));\r\n\r\n templateManager.applyTemplate(jsonData, false, templateOps);\r\n\r\n var imageT0 = document.getElementById(\"imageT.0\");\r\n assertTrue('imageT.0 visible', isVisible(imageT0));\r\n // Should have hidden second image elements\r\n var imageT1 = document.getElementById(\"imageT.1\");\r\n assertTrue('imageT.1 hidden', isHidden(imageT1));\r\n // Should have hidden the logT instance\r\n var logT0 = document.getElementById(\"logT.0\");\r\n assertTrue('logT0 hidden', isHidden(logT0));\r\n}", "function applyTemplate(tmpl, model, $ctx) {\r\n\t\t\ttmpl = replaceAll(\"{NAME}\", model.name, tmpl);\r\n\t\t\ttmpl = replaceAll(\"{SHORT_NAME}\", shorten(model.name, 25), tmpl);\r\n\t\t\ttmpl = replaceAll(\"{STREET}\", model.street, tmpl);\r\n\t\t\ttmpl = replaceAll(\"{TOWN}\", model.town, tmpl);\r\n\t\t\ttmpl = replaceAll(\"{AREA}\", model.area, tmpl);\r\n\t\t\ttmpl = replaceAll(\"{POSTCODE}\", model.postCode, tmpl);\r\n\t\t\ttmpl = replaceAll(\"{TELNO}\", model.telNo, tmpl);\r\n\t\t\ttmpl = replaceAll(\"{WEBSITE}\", model.website, tmpl);\r\n\t\t\ttmpl = replaceAll(\"{GPLUS}\", model.url, tmpl);\r\n\t\t\tif (model.photo) {\r\n\t\t\t\tvar path = model.photo.getUrl({ \"maxWidth\": \"70\" });\r\n\t\t\t\ttmpl = replaceAll(\"{PHOTOURL}\", path, tmpl);\r\n\t\t\t\t// used to delay when jQuery tries to render the image tag\r\n\t\t\t\ttmpl = replaceAll(\"{IMG\", \"<img\", tmpl);\r\n\t\t\t}\r\n\r\n\t\t\t$ctx.html(tmpl);\r\n\r\n\t\t} // applyTemplate", "function merge() {\n var i,\n args = arguments,\n len,\n ret = {},\n doCopy = function (copy, original) {\n var value, key;\n\n // An object is replacing a primitive\n if (typeof copy !== 'object') {\n copy = {};\n }\n\n for (key in original) {\n if (original.hasOwnProperty(key)) {\n value = original[key];\n\n // Copy the contents of objects, but not arrays or DOM nodes\n if (value && typeof value === 'object' && Object.prototype.toString.call(value) !== '[object Array]' &&\n key !== 'renderTo' && typeof value.nodeType !== 'number') {\n copy[key] = doCopy(copy[key] || {}, value);\n\n // Primitives and arrays are copied over directly\n } else {\n copy[key] = original[key];\n }\n }\n }\n return copy;\n };\n\n // If first argument is true, copy into the existing object. Used in setOptions.\n if (args[0] === true) {\n ret = args[1];\n args = Array.prototype.slice.call(args, 2);\n }\n\n // For each argument, extend the return\n len = args.length;\n for (i = 0; i < len; i++) {\n ret = doCopy(ret, args[i]);\n }\n\n return ret;\n }", "function defaultProcess( template, content ) {\n\t\t\treturn template.replace( /\\{\\{([.\\-\\w]*)\\}\\}/g, function( match, key ) {\n\t\t\t\treturn resolveName( key, content );\n\t\t\t} );\n\t\t}", "function mergeMatch(match1, match2) {\n var res = {\n placeholders: {} };\n // Some matches may not have placeholders; this is OK\n\n if (!match1.placeholders && !match2.placeholders) {\n return res;\n } else if (!match1.placeholders) {\n return match2;\n } else if (!match2.placeholders) {\n return match1;\n } // Placeholders with the same key must match exactly\n\n\n for (var key in match1.placeholders) {\n res.placeholders[key] = match1.placeholders[key];\n\n if ((0, _object.hasOwnProperty)(match2.placeholders, key)) {\n if (!_exactMatch(match1.placeholders[key], match2.placeholders[key])) {\n return null;\n }\n }\n }\n\n for (var _key in match2.placeholders) {\n res.placeholders[_key] = match2.placeholders[_key];\n }\n\n return res;\n }", "function detectMergeDeployTags(story) {\n // We care about merging only when story is accepted.\n var storyAccepted = story.classList.contains('accepted');\n var storyHasBody = story.querySelector('.name') !== null;\n if (!storyAccepted || !storyHasBody) {\n return;\n }\n\n // Make sure that the story has the right section and we haven't\n // already processed it.\n var bodySection = story.querySelector('.name');\n var hasMissingTags = bodySection.querySelector('.missing-tags') !== null;\n if (hasMissingTags) {\n return;\n }\n\n var hasBranch = false;\n var hasToMergeTag = false;\n var hasMergedTag = false;\n var hasToDeployTag = false;\n var hasDeployedTag = false;\n\n // Loop through all labels of this story.\n var labels = story.querySelectorAll('a.label');\n Array.prototype.forEach.call(labels, function (label) {\n\n // Check if the label is in format \"b:branchname\".\n var regexp = new RegExp('^b:', 'i');\n if (label.textContent.match(regexp)) {\n hasBranch = true;\n }\n\n // Check if the label is \"to merge\".\n regexp = new RegExp('^(to merge)', 'i');\n if (label.textContent.match(regexp)) {\n hasToMergeTag = true;\n }\n\n // Check if the label is \"merged\".\n regexp = new RegExp('^(merged)', 'i');\n if (label.textContent.match(regexp)) {\n hasMergedTag = true;\n }\n\n // Check if the label is \"to deploy\".\n regexp = new RegExp('^(to deploy)', 'i');\n if (label.textContent.match(regexp)) {\n hasToDeployTag = true;\n }\n\n // Check if the label is \"deployed\".\n regexp = new RegExp('^(deployed)', 'i');\n if (label.textContent.match(regexp)) {\n hasDeployedTag = true;\n }\n });\n\n var warnings = [];\n\n if (hasBranch) {\n if (!hasToMergeTag && !hasMergedTag) {\n warnings.push('merge');\n }\n\n if (!hasToDeployTag && !hasDeployedTag) {\n warnings.push('deploy');\n }\n }\n\n if (warnings.length) {\n bodySection.insertAdjacentHTML('beforeend', '<a class=\"std label ss missing-tags\">notice: missing ' + warnings.join(', ') + ' tags</a>');\n }\n }", "function mergeReplies(kernel, context) {\n // If one is empty, return the other.\n if (kernel.matches.length === 0) {\n return context;\n }\n else if (context.matches.length === 0) {\n return kernel;\n }\n // Populate the result with a copy of the kernel matches.\n const matches = kernel.matches.slice();\n // Cache all the kernel matches in a memo.\n const memo = matches.reduce((acc, val) => {\n acc[val] = null;\n return acc;\n }, {});\n // Add each context match that is not in the memo to the result.\n context.matches.forEach(match => {\n if (!(match in memo)) {\n matches.push(match);\n }\n });\n return Object.assign({}, kernel, { matches });\n }", "function merge() {\n\t\tvar i,\n\t\t\targs = arguments,\n\t\t\tlen,\n\t\t\tret = {},\n\t\t\tdoCopy = function (copy, original) {\n\t\t\t\tvar value, key;\n\n\t\t\t\t// An object is replacing a primitive\n\t\t\t\tif (typeof copy !== 'object') {\n\t\t\t\t\tcopy = {};\n\t\t\t\t}\n\n\t\t\t\tfor (key in original) {\n\t\t\t\t\tif (original.hasOwnProperty(key)) {\n\t\t\t\t\t\tvalue = original[key];\n\n\t\t\t\t\t\t// Copy the contents of objects, but not arrays or DOM nodes\n\t\t\t\t\t\tif (value && typeof value === 'object' && Object.prototype.toString.call(value) !== '[object Array]'\n\t\t\t\t\t\t\t\t&& key !== 'renderTo' && typeof value.nodeType !== 'number') {\n\t\t\t\t\t\t\tcopy[key] = doCopy(copy[key] || {}, value);\n\t\t\t\t\t\n\t\t\t\t\t\t// Primitives and arrays are copied over directly\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcopy[key] = original[key];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn copy;\n\t\t\t};\n\n\t\t// If first argument is true, copy into the existing object. Used in setOptions.\n\t\tif (args[0] === true) {\n\t\t\tret = args[1];\n\t\t\targs = Array.prototype.slice.call(args, 2);\n\t\t}\n\n\t\t// For each argument, extend the return\n\t\tlen = args.length;\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tret = doCopy(ret, args[i]);\n\t\t}\n\n\t\treturn ret;\n\t}", "function generate(entry) {\n let { path, parentDir, fullParentDir } = entry;\n debug(`Handling data for ${path} (${fullParentDir})`)\n\n let custom = fs.readFileSync(`${__dirname}/src/diff/${path}`, 'utf8');\n let source = custom;\n\n custom = validateVDF(custom);\n custom = vdf.parse(custom);\n\n let includes = parseIncludes(source);\n\n let original = fs.readFileSync(`${__dirname}/src/official/${path}`, 'utf8');\n original = validateVDF(original);\n original = vdf.parse(original);\n\n\n let merged = deepmerge(original,custom);\n merged = vdf.stringify(merged, true);\n merged = addIncludes(includes,merged);\n\n mkdirp(`${__dirname}/src/output/${parentDir}`, (err) => {\n if(err) throw new Error(err);\n fs.writeFileSync(`${__dirname}/src/output/${path}`, merged, 'utf8');\n });\n}", "function handleMergeResult(result, disableForceMergePrompt) {\n if (disableForceMergePrompt === void 0) { disableForceMergePrompt = false; }\n return tslib.__awaiter(this, void 0, void 0, function () {\n var failure, status, canForciblyMerge, _a;\n return tslib.__generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n failure = result.failure, status = result.status;\n canForciblyMerge = failure && failure.nonFatal;\n _a = status;\n switch (_a) {\n case 2 /* SUCCESS */: return [3 /*break*/, 1];\n case 1 /* DIRTY_WORKING_DIR */: return [3 /*break*/, 2];\n case 0 /* UNKNOWN_GIT_ERROR */: return [3 /*break*/, 3];\n case 5 /* GITHUB_ERROR */: return [3 /*break*/, 4];\n case 4 /* USER_ABORTED */: return [3 /*break*/, 5];\n case 3 /* FAILED */: return [3 /*break*/, 6];\n }\n return [3 /*break*/, 9];\n case 1:\n info(green(\"Successfully merged the pull request: #\" + prNumber));\n return [2 /*return*/, true];\n case 2:\n error(red(\"Local working repository not clean. Please make sure there are \" +\n \"no uncommitted changes.\"));\n return [2 /*return*/, false];\n case 3:\n error(red('An unknown Git error has been thrown. Please check the output ' +\n 'above for details.'));\n return [2 /*return*/, false];\n case 4:\n error(red('An error related to interacting with Github has been discovered.'));\n error(failure.message);\n return [2 /*return*/, false];\n case 5:\n info(\"Merge of pull request has been aborted manually: #\" + prNumber);\n return [2 /*return*/, true];\n case 6:\n error(yellow(\"Could not merge the specified pull request.\"));\n error(red(failure.message));\n if (!(canForciblyMerge && !disableForceMergePrompt)) return [3 /*break*/, 8];\n info();\n info(yellow('The pull request above failed due to non-critical errors.'));\n info(yellow(\"This error can be forcibly ignored if desired.\"));\n return [4 /*yield*/, promptAndPerformForceMerge()];\n case 7: return [2 /*return*/, _b.sent()];\n case 8: return [2 /*return*/, false];\n case 9: throw Error(\"Unexpected merge result: \" + status);\n }\n });\n });\n }", "function merge(a, b) {\n if ( a ) {\n for ( var property in b ) {\n if ( !hasOwnProperty.call(a, property) ) {\n a[property] = b[property];\n }\n }\n } else {\n return merge({}, b);\n }\n\n return a;\n }", "function merge() {\n\t\tvar i,\n\t\t\targs = arguments,\n\t\t\tlen,\n\t\t\tret = {},\n\t\t\tdoCopy = function (copy, original) {\n\t\t\t\tvar value, key;\n\n\t\t\t\t// An object is replacing a primitive\n\t\t\t\tif (typeof copy !== 'object') {\n\t\t\t\t\tcopy = {};\n\t\t\t\t}\n\n\t\t\t\tfor (key in original) {\n\t\t\t\t\tif (original.hasOwnProperty(key)) {\n\t\t\t\t\t\tvalue = original[key];\n\n\t\t\t\t\t\t// Copy the contents of objects, but not arrays or DOM nodes\n\t\t\t\t\t\tif (value && typeof value === 'object' && Object.prototype.toString.call(value) !== '[object Array]' &&\n\t\t\t\t\t\t\t\tkey !== 'renderTo' && typeof value.nodeType !== 'number') {\n\t\t\t\t\t\t\tcopy[key] = doCopy(copy[key] || {}, value);\n\t\t\t\t\t\n\t\t\t\t\t\t// Primitives and arrays are copied over directly\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcopy[key] = original[key];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn copy;\n\t\t\t};\n\n\t\t// If first argument is true, copy into the existing object. Used in setOptions.\n\t\tif (args[0] === true) {\n\t\t\tret = args[1];\n\t\t\targs = Array.prototype.slice.call(args, 2);\n\t\t}\n\n\t\t// For each argument, extend the return\n\t\tlen = args.length;\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tret = doCopy(ret, args[i]);\n\t\t}\n\n\t\treturn ret;\n\t}", "function mergeAssets(parentVal,childVal,vm,key){var res=Object.create(parentVal||null);if(childVal){\"development\"!=='production'&&assertObjectType(key,childVal,vm);return extend(res,childVal);}else{return res;}}", "function mergeAssets(parentVal,childVal,vm,key){var res=Object.create(parentVal||null);if(childVal){\"development\"!=='production'&&assertObjectType(key,childVal,vm);return extend(res,childVal);}else{return res;}}", "function merge() {\n var i,\n args = arguments,\n len,\n ret = {},\n doCopy = function (copy, original) {\n var value, key;\n\n // An object is replacing a primitive\n if (typeof copy !== 'object') {\n copy = {};\n }\n\n for (key in original) {\n if (original.hasOwnProperty(key)) {\n value = original[key];\n\n // Copy the contents of objects, but not arrays or DOM nodes\n if (value && typeof value === 'object' && Object.prototype.toString.call(value) !== '[object Array]' &&\n key !== 'renderTo' && typeof value.nodeType !== 'number') {\n copy[key] = doCopy(copy[key] || {}, value);\n\n // Primitives and arrays are copied over directly\n } else {\n copy[key] = original[key];\n }\n }\n }\n return copy;\n };\n\n // If first argument is true, copy into the existing object. Used in setOptions.\n if (args[0] === true) {\n ret = args[1];\n args = Array.prototype.slice.call(args, 2);\n }\n\n // For each argument, extend the return\n len = args.length;\n for (i = 0; i < len; i++) {\n ret = doCopy(ret, args[i]);\n }\n\n return ret;\n }", "function apply_template(targetid, templateid, data) {\n\n let target = document.getElementById(targetid);\n\n let template = Handlebars.compile(\n document.getElementById(templateid).textContent\n )\n target.innerHTML = template(data);\n}", "function diffTemplate(currentTemplate, newTemplate) {\n // Base diff\n const theDiff = calculateTemplateDiff(currentTemplate, newTemplate);\n // We're going to modify this in-place\n const newTemplateCopy = deepCopy(newTemplate);\n let didPropagateReferenceChanges;\n let diffWithReplacements;\n do {\n diffWithReplacements = calculateTemplateDiff(currentTemplate, newTemplateCopy);\n // Propagate replacements for replaced resources\n didPropagateReferenceChanges = false;\n if (diffWithReplacements.resources) {\n diffWithReplacements.resources.forEachDifference((logicalId, change) => {\n if (change.changeImpact === types.ResourceImpact.WILL_REPLACE) {\n if (propagateReplacedReferences(newTemplateCopy, logicalId)) {\n didPropagateReferenceChanges = true;\n }\n }\n });\n }\n } while (didPropagateReferenceChanges);\n // Copy \"replaced\" states from `diffWithReplacements` to `theDiff`.\n diffWithReplacements.resources\n .filter(r => isReplacement(r.changeImpact))\n .forEachDifference((logicalId, downstreamReplacement) => {\n const resource = theDiff.resources.get(logicalId);\n if (resource.changeImpact !== downstreamReplacement.changeImpact) {\n propagatePropertyReplacement(downstreamReplacement, resource);\n }\n });\n return theDiff;\n}", "static apply(template, scope) {\n const expressions = new Map();\n const symbols = new Map();\n const nestingLevel = new Map();\n const usedPipes = new Set();\n // The top-level template has nesting level 0.\n const binder = new TemplateBinder(expressions, symbols, usedPipes, nestingLevel, scope, template instanceof Template ? template : null, 0);\n binder.ingest(template);\n return { expressions, symbols, nestingLevel, usedPipes };\n }", "static apply(template, scope) {\n const expressions = new Map();\n const symbols = new Map();\n const nestingLevel = new Map();\n const usedPipes = new Set();\n // The top-level template has nesting level 0.\n const binder = new TemplateBinder(expressions, symbols, usedPipes, nestingLevel, scope, template instanceof Template ? template : null, 0);\n binder.ingest(template);\n return { expressions, symbols, nestingLevel, usedPipes };\n }", "static apply(template, scope) {\n const expressions = new Map();\n const symbols = new Map();\n const nestingLevel = new Map();\n const usedPipes = new Set();\n // The top-level template has nesting level 0.\n const binder = new TemplateBinder(expressions, symbols, usedPipes, nestingLevel, scope, template instanceof Template ? template : null, 0);\n binder.ingest(template);\n return { expressions, symbols, nestingLevel, usedPipes };\n }", "static apply(template, scope) {\n const expressions = new Map();\n const symbols = new Map();\n const nestingLevel = new Map();\n const usedPipes = new Set();\n // The top-level template has nesting level 0.\n const binder = new TemplateBinder(expressions, symbols, usedPipes, nestingLevel, scope, template instanceof Template ? template : null, 0);\n binder.ingest(template);\n return { expressions, symbols, nestingLevel, usedPipes };\n }", "function mergeMatch(match1, match2) {\n var res = {\n placeholders: {}\n }; // Some matches may not have placeholders; this is OK\n\n if (!match1.placeholders && !match2.placeholders) {\n return res;\n } else if (!match1.placeholders) {\n return match2;\n } else if (!match2.placeholders) {\n return match1;\n } // Placeholders with the same key must match exactly\n\n\n for (var key in match1.placeholders) {\n if (hasOwnProperty(match1.placeholders, key)) {\n res.placeholders[key] = match1.placeholders[key];\n\n if (hasOwnProperty(match2.placeholders, key)) {\n if (!_exactMatch(match1.placeholders[key], match2.placeholders[key])) {\n return null;\n }\n }\n }\n }\n\n for (var _key in match2.placeholders) {\n if (hasOwnProperty(match2.placeholders, _key)) {\n res.placeholders[_key] = match2.placeholders[_key];\n }\n }\n\n return res;\n }", "function startTagInTemplate(p, token) {\n switch (token.tagID) {\n // First, handle tags that can start without a mode change\n case TAG_ID.BASE:\n case TAG_ID.BASEFONT:\n case TAG_ID.BGSOUND:\n case TAG_ID.LINK:\n case TAG_ID.META:\n case TAG_ID.NOFRAMES:\n case TAG_ID.SCRIPT:\n case TAG_ID.STYLE:\n case TAG_ID.TEMPLATE:\n case TAG_ID.TITLE: {\n startTagInHead(p, token);\n break;\n }\n // Re-process the token in the appropriate mode\n case TAG_ID.CAPTION:\n case TAG_ID.COLGROUP:\n case TAG_ID.TBODY:\n case TAG_ID.TFOOT:\n case TAG_ID.THEAD: {\n p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE;\n p.insertionMode = InsertionMode.IN_TABLE;\n startTagInTable(p, token);\n break;\n }\n case TAG_ID.COL: {\n p.tmplInsertionModeStack[0] = InsertionMode.IN_COLUMN_GROUP;\n p.insertionMode = InsertionMode.IN_COLUMN_GROUP;\n startTagInColumnGroup(p, token);\n break;\n }\n case TAG_ID.TR: {\n p.tmplInsertionModeStack[0] = InsertionMode.IN_TABLE_BODY;\n p.insertionMode = InsertionMode.IN_TABLE_BODY;\n startTagInTableBody(p, token);\n break;\n }\n case TAG_ID.TD:\n case TAG_ID.TH: {\n p.tmplInsertionModeStack[0] = InsertionMode.IN_ROW;\n p.insertionMode = InsertionMode.IN_ROW;\n startTagInRow(p, token);\n break;\n }\n default: {\n p.tmplInsertionModeStack[0] = InsertionMode.IN_BODY;\n p.insertionMode = InsertionMode.IN_BODY;\n startTagInBody(p, token);\n }\n }\n}", "unMerge() {\n this.props.categoryStore.unMerge();\n }", "function handleMerge(writer, payload, operation) {\n\t var store = writer.getRecordStore();\n\n\t // because optimistic payloads may not contain all fields, we loop over\n\t // the data that is present and then have to recurse the query to find\n\t // the matching fields.\n\t //\n\t // TODO #7167718: more efficient mutation/subscription writes\n\t for (var fieldName in payload) {\n\t if (!payload.hasOwnProperty(fieldName)) {\n\t continue;\n\t }\n\t var payloadData = payload[fieldName]; // #9357395\n\t if (typeof payloadData !== 'object' || payloadData == null) {\n\t continue;\n\t }\n\t // if the field is an argument-less root call, determine the corresponding\n\t // root record ID\n\t var rootID = store.getDataID(fieldName);\n\t // check for valid data (has an ID or is an array) and write the field\n\t if (ID in payloadData || rootID || Array.isArray(payloadData)) {\n\t mergeField(writer, fieldName, payloadData, operation);\n\t }\n\t }\n\t}", "function handleMerge(writer, payload, operation) {\n\t var store = writer.getRecordStore();\n\n\t // because optimistic payloads may not contain all fields, we loop over\n\t // the data that is present and then have to recurse the query to find\n\t // the matching fields.\n\t //\n\t // TODO #7167718: more efficient mutation/subscription writes\n\t for (var fieldName in payload) {\n\t if (!payload.hasOwnProperty(fieldName)) {\n\t continue;\n\t }\n\t var payloadData = payload[fieldName]; // #9357395\n\t if (typeof payloadData !== 'object' || payloadData == null) {\n\t continue;\n\t }\n\t // if the field is an argument-less root call, determine the corresponding\n\t // root record ID\n\t var rootID = store.getDataID(fieldName);\n\t // check for valid data (has an ID or is an array) and write the field\n\t if (ID in payloadData || rootID || Array.isArray(payloadData)) {\n\t mergeField(writer, fieldName, payloadData, operation);\n\t }\n\t }\n\t}" ]
[ "0.6655246", "0.61193633", "0.6110943", "0.5813038", "0.55150366", "0.54771286", "0.5454094", "0.5386252", "0.53108203", "0.5285453", "0.51440984", "0.51282567", "0.512309", "0.51094687", "0.50689054", "0.505966", "0.49993476", "0.49748415", "0.49550512", "0.49384743", "0.4901307", "0.4899354", "0.48922834", "0.48922834", "0.4888202", "0.4888202", "0.48799682", "0.4840966", "0.4820724", "0.4802792", "0.479412", "0.47794315", "0.4775115", "0.47705442", "0.4722955", "0.4714043", "0.469442", "0.46940696", "0.469204", "0.46829963", "0.468232", "0.46482617", "0.46460602", "0.46429694", "0.46376047", "0.4631978", "0.4628299", "0.46101317", "0.4609371", "0.46035746", "0.4598995", "0.45980743", "0.45931873", "0.4587119", "0.45850903", "0.4579811", "0.45760927", "0.45735466", "0.45574597", "0.45522735", "0.45494038", "0.4546346", "0.45378444", "0.4532681", "0.4528972", "0.45229745", "0.4522275", "0.45170206", "0.45137614", "0.45076185", "0.45030704", "0.44970992", "0.44935602", "0.44904003", "0.44873238", "0.4484046", "0.44818115", "0.44690448", "0.44642484", "0.4460731", "0.44584823", "0.4456844", "0.44532588", "0.4451908", "0.4445214", "0.44448972", "0.444237", "0.4441965", "0.4441965", "0.44416425", "0.4440574", "0.4435493", "0.44339395", "0.44339395", "0.44339395", "0.44339395", "0.44304565", "0.44293016", "0.4428353", "0.44279686", "0.44279686" ]
0.0
-1
general function for Maze
function Maze(i,j){ this.i = i;//col number this.j = j;//row number this.walls = [true,true,true,true]; this.visited = false;// at the beginning all cells are not visited //play buttons this.moveUp = function (){ let top = grid[index(i,j-1)]; if(top && this.walls[0] !== true) { counter++; return top; } else { return current } } this.moveRight = function (){ let right = grid[index(i+1,j)]; if(right && this.walls[1] !== true) { counter++; return right; } else { return current } } this.moveDown = function (){ let bottom = grid[index(i,j +1)]; if(bottom && this.walls[2] !== true) { counter++; return bottom; } else { return current } } this.moveLeft = function (){ let left = grid[index(i-1,j)]; if(left && this.walls[3] !== true) { counter++; return left; } else { return current } } //check neighbors function this.checkNeighbors = function(){ const neighbors = []; let top = grid[index(i,j-1)]; let right = grid[index(i+1,j)]; let bottom = grid[index(i,j +1)]; let left = grid[index(i-1,j)]; if(top && !top.visited) { neighbors.push(top) } if(right && !right.visited) { neighbors.push(right) } if(bottom && !bottom.visited) { neighbors.push(bottom) } if(left && !left.visited) { neighbors.push(left) } if (neighbors.length > 0) { const random = Math.floor(Math.random() * neighbors.length); return neighbors[random] } else { return undefined } } //highligt the current cell this.highlight = function (){ const x = this.i*w; const y = this.j*w; // mtx.beginPath(); // mtx.fillStyle = "rgba(0,255,255,100)"; // mtx.fillRect(x+3, y+3, w-6, w-6); mtx.drawImage(playerImg, x, y, w, w); } //highlight the finish cell this.finishColor = function () { const x = this.i*w; const y = this.j*w; // mtx.beginPath(); // mtx.fillStyle = "green"; // mtx.fillRect(x+3, y+3, w-6, w-6); mtx.drawImage(finishImg, x, y, w, w); } //show wall for each side and show visited rectangle this.show = function() { const x = this.i*w; const y = this.j*w; mtx.strokeStyle = "#000000" if(this.walls[0]){ // top wall mtx.beginPath(); mtx.moveTo(x, y); mtx.lineTo(x+w, y); mtx.stroke(); } if(this.walls[1]){ // right wall mtx.beginPath(); mtx.moveTo(x+w, y); mtx.lineTo(x+w, y+w); mtx.stroke(); } if(this.walls[2]){ // bottom wall mtx.beginPath(); mtx.moveTo(x+w, y+w); mtx.lineTo(x, y+w); mtx.stroke(); } if(this.walls[3]){ // left wall mtx.beginPath(); mtx.moveTo(x, y+w); mtx.lineTo(x, y); mtx.stroke(); } if(this.visited){ // draw a rectangle on visited cell mtx.beginPath(); mtx.fillStyle = "yellow"; mtx.fillRect(x, y, w, w); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initMaze(){}", "function createMaze(){\n const mazeCoords1 = \n [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 50, 53, 54, 55, 78, 51, 56,\n 58, 59, 60, 61, 63, 65, 66, 67, 68, 70, 71, 72, 73, 75,76, 81, 83, 84, 85,86, 88, 90,91, 92, 93, 95, 98,\n 100,101, 103,104,105,106,108,109,110,111,115, 116, 117, 118, 120, 121, 122, 123, 125, 126, 150,151, 153, 154, 155, 156, 158, 160, 161,162, 163, 164, 165, 166, 168, 170,171,\n 172, 173, 175, 176, 178,179,180, 181, 183, 185, 186, 187, 188, 189, 190, 191 ,193, 195, 196,197, 198,\n 200, 203, 204, 205, 206, 208, 213, 218, 220, 221, 222, 223, 225, 226, 234, 235, 236, 238, 240, 241, 242,243, 252, 253, 254, 255, 256, 268, 270, 271, 272, 273, 274, 276, 281,\n 250,275,201, 251,295,291, 285, 233, 258, 283, 293, 277, 279,\n 306, 301, 326, 310, 335, 318, 308, 320, 352, 353, 354, 300, 325, 350, 375, 351, 346, 347, 348, 349,\n 376, 370, 371, 372, 373, 374, 380, 395, 310, 335, 360, 361, 365, 358, 383, 368, 393, 331, 345, 356, 381, 366, 316, 341,\n 402, 403, 404, 405, 406, 408, 420, 421, 422, 423, 424, 401, 426, 451, 476, 418, 453, 454, 455, 480, 457, 458, 459, 460, \n 461, 465, 466, 467, 468, 471, 472, 473, 410, 411, 412, 413, 414, 415, 416, 438, 463, 496,469, 400, 425, 450, 475,\n 521, 519, 538, 563, 505, 509, 510, 511, 512, 513, 514, 515, 516, 517, 500, 525, 550, 575, 501, 526, 551, 576, 355, 544, \n 553, 554, 555, 556, 557, 558,507, 532, 559, 560, 561, 565, 566, 567, 568, 569, 570, 571, 572, 573, 523, 524, 503, 502,\n 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617,618, 619, 620, 621, 622, 623, 624, 600, 625, 601\n\n ]\n mazeCoords1.map( coord =>{\n cells[coord-1].classList.add('maze')\n })\n\n //assigning custom town and environment pieces below\n cells[301].classList.add('townpieceA')\n cells[302].classList.add('townpieceB')\n cells[303].classList.add('townpieceC')\n cells[304].classList.add('townpieceD')\n cells[326].classList.add('townpieceE')\n cells[327].classList.add('townpieceF')\n cells[328].classList.add('townpieceG')\n cells[329].classList.add('townpieceH')\n\n cells[295].classList.add('townpieceA')\n cells[296].classList.add('townpieceB')\n cells[297].classList.add('townpieceC')\n cells[298].classList.add('townpieceD')\n cells[320].classList.add('townpieceE')\n cells[321].classList.add('townpieceF')\n cells[322].classList.add('townpieceG')\n cells[323].classList.add('townpieceH')\n\n cells[277].classList.add('townpieceA')\n cells[279].classList.add('townpieceD')\n cells[78].classList.add('lake1')\n cells[79].classList.add('lake2')\n cells[95].classList.add('lake1')\n cells[96].classList.add('lake2')\n cells[396].classList.add('lake1')\n cells[397].classList.add('lake2')\n cells[395].classList.add('townpieceA')\n cells[398].classList.add('townpieceD')\n\n cells[376].classList.add('townpieceA')\n cells[377].classList.add('townpieceH')\n cells[378].classList.add('townpieceD')\n\n //----- apple creation ------\n\n const cookieCoords1 = [27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 52, 57,62, 64, 69, 74, 82, 87, 89, 94,\n 102, 107, 112, 113, 114, 119, 124, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,\n 152, 157, 159, 167, 169, 174, 177, 182, 184, 192, 194, 199, 202, 207, 209, 210, 211, 212, 214, 215, 216, 217, 219, 224, 227, 228, 229, 230, 231, 232, \n 244, 245, 246, 247, 248, 249, 257, 269, 282, 294, 307, 319, 332, 344, 357, 369, 382, 394, 407, 419, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437,\n 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 452, 456, 462, 464, 470, 474, 478, 479, 481, 482, 483, 484, 485, 486, 487, 489, 490, 491, 492, 493, \n 494, 495, 497, 498, 504, 506, 508, 518, 520, 522, 527, 528, 529, 530, 531, 533, 534, 535, 536, 537, 539, 540, 541, 542, 543, 545, 546, 547, 548, 549,\n 552, 562, 564, 574, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599\n ]\n\n cookieCoords1.map( coord =>{\n cells[coord - 1].classList.add('cookie')\n })\n // ----- POWERUP CREATION ----------\n const pokeballCoords1 = [499, 477, 99, 77 ]\n pokeballCoords1.map( coord =>{\n cells[coord - 1].classList.add('pokeBall')\n })\n }", "function solveMaze(){\n var Xqueue=[parseInt(src_x)]; \n var Yqueue=[parseInt(src_y)]; \n let pathFound=false;\n var xLoc;\n var yLoc;\n\n while(Xqueue.length>0 && !pathFound){\n xLoc=Xqueue.shift();\n yLoc=Yqueue.shift();\n if(xLoc>1){\n if(tiles[xLoc-1][yLoc].state=='f'){\n pathFound=true;\n }\n }\n if(xLoc<tileColCount-1){\n if(tiles[xLoc+1][yLoc].state=='f'){\n pathFound=true;\n }\n }\n if(yLoc>1){\n if(tiles[xLoc][yLoc-1].state=='f'){\n pathFound=true;\n }\n }\n \n if(yLoc<tileRowCount-1){\n if(tiles[xLoc][yLoc+1].state=='f'){\n pathFound=true;\n }\n }\n if(xLoc>1){\n if(tiles[xLoc-1][yLoc].state=='e'){\n Xqueue.push(xLoc-1);\n Yqueue.push(yLoc);\n tiles[xLoc-1][yLoc].state=tiles[xLoc][yLoc].state+'l';\n // rect(xloc-1,yLoc,tileW,tileH,tiles[xLoc-1][yLoc].state);\n }\n }\n if(xLoc<tileColCount-1){\n if(tiles[xLoc+1][yLoc].state=='e'){\n Xqueue.push(xLoc+1);\n Yqueue.push(yLoc);\n tiles[xLoc+1][yLoc].state=tiles[xLoc][yLoc].state+'r';\n //rect(xloc+1,yLoc,tileW,tileH,tiles[xLoc+1][yLoc].state);\n }\n }\n if(yLoc>1){\n if(tiles[xLoc][yLoc-1].state=='e'){\n Xqueue.push(xLoc);\n Yqueue.push(yLoc-1);\n tiles[xLoc][yLoc-1].state=tiles[xLoc][yLoc].state+'u';\n // rect(xloc,yLoc-1,tileW,tileH,tiles[xLoc][yLoc-1].state);\n }\n }\n if(yLoc<tileRowCount-1){\n if(tiles[xLoc][yLoc+1].state=='e'){\n Xqueue.push(xLoc);\n Yqueue.push(yLoc+1);\n tiles[xLoc][yLoc+1].state=tiles[xLoc][yLoc].state+'d';\n // rect(xloc,yLoc+1,tileW,tileH,tiles[xLoc][yLoc+1].state);\n }\n }\n //setInterval(draw(),100);\n }\n if(!pathFound){\n output.innerHTML=\"No Solution\";\n }\n else{\n output.innerHTML=\"Solved\";\n let path=tiles[xLoc][yLoc].state; \n let pathLength=path.length;\n let currX=parseInt(src_x); \n let currY=parseInt(src_y); \n for(let i=0;i<pathLength-1;i++){\n if(path.charAt(i+1)=='u'){\n currY-=1;\n }\n if(path.charAt(i+1)=='d'){\n currY+=1;\n }\n if(path.charAt(i+1)=='l'){\n currX-=1;\n }\n if(path.charAt(i+1)=='r'){\n currX+=1;\n }\n tiles[currX][currY].state='p';\n }\n }\n}", "function genMaze(){\n //Recursive backtracking\n \n var validMoves = true;\n var moveList = ['n', 'e', 's', 'w'];\n //Generate maze with all walls\n //0 = unvisited \n //1 = visited\n var mazeArray = [];\n var grid = [];\n for(var i=0; i<gridSize; i++){\n tempArray = [];\n tempGrid = [];\n for(var j=0; j<gridSize; j++){\n tempArray.push('nsew');\n tempGrid.push(0);\n };\n mazeArray.push(tempArray);\n grid.push(tempGrid);\n };\n\n function checkNeighbors(x,y,grid){\n if(y != gridSize-1){\n if(grid[y+1][x] == 0){\n return(true);\n }\n }\n if(x != gridSize-1){\n if(grid[y][x+1] == 0){\n return(true);\n }\n }\n if(y != 0){\n if(grid[y-1][x] == 0){\n return(true);\n }\n }\n if(x != 0){\n if(grid[y][x-1] == 0){\n return(true);\n }\n }\n return(false);\n }\n\n function getAbsolute(dir, facing){\n if(dir == \"l\"){//left\n tempFacing = moveList[(moveList.indexOf(facing)+3)%4];\n } else if(dir == \"s\"){//straight\n tempFacing = facing;\n } else if(dir == \"r\"){//right\n tempFacing = moveList[(moveList.indexOf(facing)+1)%4];\n }\n return(tempFacing);\n }\n\n function checkMove(x,y, tempFacing){\n var result = true;\n if(tempFacing == 'n'){\n if(y == 0){\n result = false;\n } else if(grid[y-1][x] == 1){\n result = false;\n }\n } else if(tempFacing == 'e'){\n if(x == gridSize-1){\n result = false;\n } else if(grid[y][x+1] == 1){\n result = false;\n }\n } else if(tempFacing == 's'){\n if(y == gridSize-1){\n result = false;\n } else if(grid[y+1][x] == 1){\n result = false;\n }\n } else if(tempFacing == 'w'){\n if(x == 0){\n result = false;\n } else if(grid[y][x-1] == 1){\n result = false;\n }\n } \n return(result);\n }\n\n\n\n visitedList = [];\n fx = Math.floor(Math.random()*gridSize-1);\n fy = Math.floor(Math.random()*gridSize-1);\n grid[fy][fx] = 1;\n //main generation loop\n\n while(visitedList.length < gridSize**2){\n \n //Get visited\n visitedList = [];\n for(var y = 0; y <= gridSize-1; y++) {\n (grid[y]).forEach(function getVisited(item, index){\n if(item == 1){\n visitedList.push([index, y]);\n }\n });\n };\n running = true;\n while(running == true){\n //Pick one at random\n randIndex = Math.floor(Math.random()*visitedList.length);\n var fcoord = visitedList[randIndex];\n fx = fcoord[0];\n fy = fcoord[1];\n if(checkNeighbors(fx,fy,grid)){\n x=fx;\n y=fy;\n surroundingGrid = [];\n if(y != gridSize-1){\n if(grid[y+1][x] == 0){\n surroundingGrid.push('s');\n }\n }\n if(x != gridSize-1){\n if(grid[y][x+1] == 0){\n surroundingGrid.push('e');\n }\n }\n if(y != 0){\n if(grid[y-1][x] == 0){\n surroundingGrid.push('n');\n }\n }\n if(x != 0){\n if(grid[y][x-1] == 0){\n surroundingGrid.push('w');\n }\n }\n facing = surroundingGrid[(Math.floor(Math.random()*surroundingGrid.length))];\n running = false;\n }\n }\n //Move until stuck\n validMoves = checkNeighbors(fx,fy,grid);\n console.log('upper loop')\n var loopCount = 0;\n while(validMoves == true & loopCount < 100){\n \n grid[fy][fx] = 1;\n dir = 'lsr'.charAt(Math.floor(Math.random()*3));\n absMoveDir = getAbsolute(dir,facing);\n \n if(checkMove(fx,fy,absMoveDir) == true){//if a move returns false it is illegal\n \n if(absMoveDir == 'n'){\n mazeArray[fy][fx] = mazeArray[fy][fx].replace('n','');\n mazeArray[fy-1][fx] = mazeArray[fy-1][fx].replace('s','');\n fy = fy - 1;\n\n } else if(absMoveDir == 'e'){\n mazeArray[fy][fx] = mazeArray[fy][fx].replace('e','');\n mazeArray[fy][fx+1] = mazeArray[fy][fx+1].replace('w','');\n fx = fx+ 1;\n } else if (absMoveDir == 's'){\n mazeArray[fy][fx] = mazeArray[fy][fx].replace('s','');\n mazeArray[fy+1][fx] = mazeArray[fy+1][fx].replace('n','');\n fy = fy + 1;\n } else if(absMoveDir == 'w'){\n mazeArray[fy][fx] = mazeArray[fy][fx].replace('w','');\n mazeArray[fy][fx-1] = mazeArray[fy][fx-1].replace('e','');\n fx = fx - 1;\n }\n facing= absMoveDir;\n \n }\n \n validMoves = checkNeighbors(fx,fy,grid);\n if(validMoves == true){\n console.log(fx,fy, validMoves, grid);\n }\n loopCount++;\n \n }\n }\n\n return(mazeArray)\n}", "function genMaze() {\n //var alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','aa','bb','cc','dd','ee','ff','gg','hh','ii','jj','kk','ll','mm','nn','oo','pp','qq','rr','ss','tt','aaa','bbb','ccc','ddd','eee','fff','ggg','hhh','iii','jjj','kkk','lll','mmm','nnn','ooo','ppp','qqq','rrr','sss','ttt','aaaa','bbbb','cccc','dddd','eeee','ffff','gggg','hhhh','iiii','jjjj','kkkk','llll','mmmm','nnnn','oooo','pppp','qqqq','rrrr','ssss','tttt'];\n var alphabet2 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't'];\n var mazeSize = 20;\n\n\n //LOOP THROUGH EACH LETTER (AKA Y COORDINATE)\n for (var j = 0; j < alphabet2.length; j++) {\n var currentLetter = alphabet2[j];\n\n //LOOP THROUGH EACH NUMBER (AKA X COORDINATE)\n for (var k = 0; k < mazeSize; k++) {\n var keyName = currentLetter + k;\n var status;\n\n //RANDOMLY DECIDE IF A TILE IS WALKWAY OR WALL\n var coinToss = Math.random();\n if (coinToss < 0.5) {\n status = 1;\n } else {\n status = 0;\n }\n\n // IF IT'S AN EDGE IT'S SOLID\n if (k == mazeSize - 1) {\n status = 1;\n }\n if (j == mazeSize - 1) {\n status = 1;\n }\n if (k === 0) {\n status = 1;\n }\n if (j === 0) {\n status = 1;\n }\n\n // ASSIGN THE OBJECT\n mazeObject[keyName] = [j, k, status];\n\n }// end inner loop x\n\n //PLACE A STARTING TILE\n var randomSide = Math.random();\n if (randomSide > 0.5) {\n startSide = 0;\n } else {\n startSide = mazeSize - 1;\n }\n\n var randomSpace = Math.floor(Math.random() * (mazeSize - 1)) + 1;\n var finalPlacement = Math.random();\n if (finalPlacement > 0.5) {\n mazeObject.start = [startSide, randomSpace, 0];\n } else {\n mazeObject.start = [randomSpace, startSide, 0];\n }\n\n console.log(mazeObject.start);\n\n }// end outer loop yˆ\n\n}", "function solveMaze() {\n init(solve);\n}", "function Maze(size, cellTextures, level) {\n\n var cols, rows;\n var w = size;\n this.grid = [];\n\n this.current;\n\n var stack = [];\n\n this.setup = function() {\n createCanvas(605,605)\n cols = floor(width/w);\n rows = floor(height/w);\n\n for (var j = 0; j < rows; j++) {\n for (var i = 0; i < cols; i++) {\n var cell = new Cell(i, j, w, this.grid, cols, rows, cellTextures, level);\n this.grid.push(cell);\n }\n }\n this.current = this.grid[0];\n }\n\n this.draw = function() {\n background(51);\n for (var i = 0; i < this.grid.length; i++) {\n this.grid[i].show();\n }\n\n this.current.visited = true;\n //this.current.highlight();\n // STEP 1\n var next = this.current.checkNeighbors();\n if (next) {\n next.visited = true;\n\n // STEP 2\n stack.push(this.current);\n\n // STEP 3\n this.removeWalls(this.current, next);\n\n // STEP 4\n this.current = next;\n } else if (stack.length > 0) {\n this.current = stack.pop();\n }\n\n }\n\n this.index = function(i, j) {\n if (i < 0 || j < 0 || i > cols-1 || j > rows-1) {\n return -1;\n }\n return i + j * cols;\n }\n\n\n this.removeWalls = function(a, b) {\n var x = a.i - b.i;\n if (x === 1) {\n a.walls[3] = false;\n b.walls[1] = false;\n } else if (x === -1) {\n a.walls[1] = false;\n b.walls[3] = false;\n }\n var y = a.j - b.j;\n if (y === 1) {\n a.walls[0] = false;\n b.walls[2] = false;\n } else if (y === -1) {\n a.walls[2] = false;\n b.walls[0] = false;\n }\n }\n}", "function generateMaze() {\n init(generate);\n}", "function Maze(width, height) {\n var self = this;\n self.cells = [];\n initializeCells();\n\n //pick a random x and y starting point to construct maze\n var startX = Math.floor(Math.random()*width);\n var startY = Math.floor(Math.random()*height);\n\n //start the recursion\n visit(self.cells[startX][startY]);\n\n function initializeCells() {\n for(var x = 0; x<width; x++) {\n self.cells[x] = [];\n for (var y = 0; y < height; y++)\n self.cells[x][y] = new Cell(x,y);\n }\n }\n\n //Create a cell at x,y location\n function Cell(x,y) {\n this.x = x;\n this.y = y;\n\n //which walls are up on this cell\n this.walls = {\n left : true,\n right : true,\n up : true,\n down : true\n };\n\n //have we visited this cell yet\n this.visited = false;\n }\n\n //initially just a cell and no direction\n function visit(cell,direction) {\n //this cell has now been visited\n cell.visited = true;\n\n //if a direction is given, knock down the wall\n if(direction)\n cell.walls[direction]=false;\n\n //get all possible movements from this position\n var moves = getMoves(cell);\n\n while(moves.length > 0){\n var index = Math.floor(Math.random() * moves.length);\n var nextCell = moves[index];\n\n var direction = \"up\";\n if(cell.y > nextCell.y){\n cell.walls.up = false;\n direction = \"down\";\n }else if(cell.x < nextCell.x){\n cell.walls.right = false;\n direction = \"left\";\n }else if(cell.y < nextCell.y){\n cell.walls.down = false;\n direction = \"up\";\n }else if(cell.x > nextCell.x){\n cell.walls.left = false;\n direction = \"right\";\n }\n visit(nextCell,direction);\n\n moves = getMoves(cell);\n }\n\n }\n\n //walls only useful when solving the maze\n function getMoves(cell, walls) {\n var options = [];\n\n function checkOptions(x, y) {\n if(walls)\n if((y < cell.y && cell.walls.up) ||\n (x > cell.x && cell.walls.right) ||\n (y > cell.y && cell.walls.down) ||\n (x < cell.x && cell.walls.left))\n return;\n\n if(self.cells[x] && self.cells[x][y] && !self.cells[x][y].visited)\n options.push(self.cells[x][y])\n }\n\n checkOptions(cell.x, cell.y - 1); //check to the down\n checkOptions(cell.x, cell.y +1); //check to the up\n checkOptions(cell.x - 1, cell.y); //check to the left\n checkOptions(cell.x + 1, cell.y); //check to the right\n\n return options;\n }\n\n\n\n self.objects = [];\n\n self.drawMaze = function(hasCeiling) {\n var m = new Maze(10,10);\n\n for(var i = 0; i<m.cells.length; i++)\n for(var j = 0; j<m.cells[i].length; j++)\n self.drawCell(m.cells[i][j],hasCeiling);\n\n return self.objects;\n }\n\n self.drawCell = function(cell,hasCeiling) {\n if(!cell)\n return;\n if(!hasCeiling)\n hasCeiling = false;\n var isEnd = false;\n if(cell.x == self.cells.length-1 && cell.y == self.cells.length-1)\n isEnd = true;\n\n var x = cell.x*4.5;\n var y = cell.y*4.5;\n if(cell.walls.down) {\n var c = new Cube(2.5, 1, .25);\n c.translate(0+x, 0, 0+y);\n c.texture = textures.wall;\n if(isEnd)\n c.texture = textures.end;\n c.buildObject();\n self.objects.push(c);\n }\n if(cell.walls.right) {\n var c1 = new Cube(2.5, 1, .25);\n c1.rotate(90, 0, 1, 0);\n c1.translate(-2.25+y, 0, -2.25-x);\n c1.buildObject();\n c1.texture = textures.wall;\n if(isEnd)\n c1.texture = textures.end;\n self.objects.push(c1);\n }\n if(cell.walls.left) {\n var c2 = new Cube(2.5, 1, .25);\n c2.rotate(90, 0, 1, 0);\n c2.translate(-2.25+y, 0, 2.25-x);\n c2.buildObject();\n c2.texture = textures.wall;\n if(isEnd)\n c2.texture = textures.end;\n self.objects.push(c2);\n }\n if(cell.walls.up) {\n var c3 = new Cube(2.5, 1, .25);\n c3.translate(0+x, 0, -4.5+y);\n c3.buildObject();\n c3.texture = textures.wall;\n if(isEnd)\n c3.texture = textures.end;\n self.objects.push(c3);\n }\n\n var floor = new Cube(2.5,.25,2.5);\n floor.translate(x,-1.25,-2.25+y);\n floor.buildObject();\n floor.texture = textures.floor;\n if(isEnd)\n floor.texture = textures.end;\n self.objects.push(floor);\n\n if(hasCeiling) {\n var ceiling = new Cube(2.5, .25, 2.5);\n ceiling.translate(x, 1.25,-2.25+y);\n ceiling.buildObject();\n ceiling.texture = textures.ceiling;\n if(isEnd)\n ceiling.texture = textures.end;\n self.objects.push(ceiling);\n }\n }\n}", "function generateDungeonMaze(width, height, name, method, groundtile, walltiles, sourceImage, exits) {\n\n var map = new Map();\n map.width = width;\n map.height = height;\n map.visibility = new Array(this.width*this.height);\n map.tileEntry = Game.tiles[sourceImage];\n map.name = name;\n\n // Create a simple maze room with an exit:\n var maze = null\n if (method[0]=='Kruskal') maze = generateMazeKruskal(width,height,method[1]);\n if (method[0]=='RecursiveDivision') maze = generateMazeRecursiveDivision(width,height,method[1]);\n\n // make sure exists is open:\n for(var i = 0;i<exits.length;i++) {\n var exit = exits[i];\n for(var j = 0;j<exit[0][2];j++) {\n for(var k = 0;k<exit[0][3];k++) {\n maze[exit[0][0]+j][exit[0][1]+k] = 1; \n }\n }\n for(var j = 0;j<exit[1][2];j++) {\n for(var k = 0;k<exit[1][3];k++) {\n maze[exit[1][0]+j][exit[1][1]+k] = 1; \n }\n }\n }\n\n map.newLayer();\n map.newLayer();\n for(var i = 0;i<height;i++) {\n for(var j = 0;j<width;j++) {\n map.setTile(j,i,0,groundtile);\n// if (maze[j][i]==0) map.setTile(j,i,1,walltiles[0]);\n if (maze[j][i]==0) map.setTile(j,i,1,properWallTile(j,i,maze,walltiles));\n }\n }\n\n // Create the exits:\n for(var i = 0;i<exits.length;i++) {\n var exit = exits[i];\n for(var j = 0;j<exit[0][2];j++) {\n for(var k = 0;k<exit[0][3];k++) {\n map.setTile(exit[0][0]+j, exit[0][1]+k, 1, exit[2]);\n }\n }\n if (exit[3]==null) {\n // do nothing\n } else if (exit[3]=='gameComplete') {\n var script = [{action:\"gameComplete\"}];\n map.triggers.push({x:exit[0][0], y:exit[0][1],\n width:exit[0][2], height:exit[0][3], \n repeat:false,\n script:script});\n } else {\n // create a bridge:\n map.bridges.push({x:exit[0][0], y:exit[0][1], width:exit[0][2], height:exit[0][3], id:exit[3]});\n map.bridgeDestinations.push({x:exit[1][0], y:exit[1][1], width:exit[1][2], height:exit[1][3], id:exit[3]});\n }\n }\n\n\n return map;\n}", "function maze(){\n //The funktion values if the command is true. The command is y < lane1.length.\n //If the command is true, the function create(y) will run.\n //y++ is autoincrement. It means y increases with 1 for every loop.\nfor(y = 0; y < lane4.length; y++){\n create(y);\n}\n}", "function drawMaze()\n{\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n var visited = [],\n rows = Math.floor(canvas.width/size),\n cols = Math.floor(canvas.height/size);\n\n ctx.fillStyle = \"#000000\";\n var rect1 = new Rectangle(0, cols*size, canvas.width, size),\n rect2 = new Rectangle(rows*size, 0, size, canvas.height);\n rect1.draw(ctx);\n rect2.draw(ctx);\n\n // Create the arrays\n for (var i=0; i < rows; i++)\n {\n grid[i] = [];\n visited[i] = [];\n for (var j=0; j < cols; j++)\n {\n grid[i][j] = false;\n visited[i][j] = false;\n }\n }\n\n // Set up the initial grid\n for (var i=0; i < rows; i+=2)\n for (var j=0; j < cols; j+=2)\n grid[i][j] = true;\n\n /*for (var i=0; i < rows; i++)\n {\n var str = \"\";\n for (var j=0; j < cols; j++)\n {\n str += grid[i][j] ? \".\" : \"X\"\n }\n\n console.log(str);\n }*/\n\n var stack = [];\n stack.push(new Point(0, 0)); // start at (x,y)\n\n while (stack.length > 0)\n {\n var loc = stack[stack.length-1],\n x = loc.x,\n y = loc.y,\n cont = false;\n\n // Fischer-Yates Shuffle: randomly weighted direction to go in\n var order = [\"up\", \"down\", \"left\", \"right\"];\n for (var i=3; i >= 0; i--)\n {\n var index = Math.floor(Math.random() * (i+1)),\n temp = order[i];\n order[i] = order[index];\n order[index] = temp;\n }\n\n // Try each direction\n for (var i=0; i < 4; i++)\n {\n switch (order[i])\n {\n case \"up\":\n if (y-2 >= 0)\n {\n if (!visited[x][y-2])\n {\n stack.push(new Point(x, y-2));\n grid[x][y-1] = true;\n visited[x][y-2] = true;\n cont = true;\n }\n }\n break;\n case \"down\":\n if (y+2 < grid[0].length)\n {\n if (!visited[x][y+2])\n {\n stack.push(new Point(x, y+2));\n grid[x][y+1] = true;\n visited[x][y+2] = true;\n cont = true;\n }\n }\n break;\n case \"left\":\n if (x-2 >= 0)\n {\n if (!visited[x-2][y])\n {\n stack.push(new Point(x-2, y));\n grid[x-1][y] = true;\n visited[x-2][y] = true;\n cont = true;\n }\n }\n break;\n case \"right\":\n if (x+2 < grid.length)\n {\n if (!visited[x+2][y])\n {\n stack.push(new Point(x+2, y));\n grid[x+1][y] = true;\n visited[x+2][y] = true;\n cont = true;\n }\n }\n break;\n default:\n }\n\n if (cont) break;\n }\n\n if (cont) continue;\n\n // if dead-end, backtrack\n stack.pop();\n }\n\n /*for (var i=0; i < rows; i++)\n {\n var str = \"\";\n for (var j=0; j < cols; j++)\n {\n str += grid[i][j] ? \".\" : \"X\"\n }\n\n console.log(str);\n }*/\n\n ctx.fillStyle = \"#000000\";\n\n /*for (var i=0; i < rows; i++)\n {\n var rect = new Rectangle(0, i*size, size, size),\n rect2 = new Rectangle(i*size, 0, size, size);\n\n rect.draw(ctx);\n rect2.draw(ctx);\n }*/\n\n for (var i=0; i < rows; i++)\n {\n for (var j=0; j < cols; j++)\n {\n if (!grid[i][j])\n {\n var rect = new Rectangle(i*size, j*size, size, size);\n rect.draw(ctx);\n }\n }\n }\n}", "constructor (maze)\n\t{\n\t\tthis.maze = maze;\n\t}", "function World(_maze) {\n // create a char maze\n const maze = _maze.map(s => s.split(''))\n // set maze char\n const setMazeChar = ([i, j], c) => { maze[i][j] = c }\t\n\n const { startPos, numKeys } = mazeStats(maze)\n const posKey = (pos) => pos.join(',')\n\n const char = ([i, j], objs = []) => {\n const c = maze[i][j]\n if (objs.indexOf(c) >= 0) return '.'\n return c\n }\n\n // given pos and taken objs\n // find all possible next pos\n const dirs = (pos, objs = []) => {\n const c = char(pos, objs)\n if (c != '.') return []\n \n return DIRS.map(([di, dj]) => [pos[0]+di, pos[1]+dj])\n .filter(([ni, nj]) => maze[ni][nj] != '#')\n }\n \n // given a source pos and taken objs\n // find all reachable objs\n const findDests = (srcPos, objs) => {\n const queue = [[srcPos, 0]]\n const marked = {}\n const dests = {} \n \n const mark = pos => { marked[posKey(pos)] = true }\n const isMarked = pos => marked[posKey(pos)] || false\n \n while (queue.length) {\n const [pos, k] = queue.shift()\n mark(pos)\n const c = char(pos, objs)\n if (c != '.') {\n dests[c] = { pos, k }\n }\n dirs(pos, objs).forEach(nextPos => {\n if (!isMarked(nextPos)) {\n queue.push([nextPos, k+1])\n }\n })\n }\n \n return dests\n }\n \n // given the door, and taken objs\n const canOpen = (door, objs) => {\n const keys = objs.filter(isKey)\n return keys.indexOf(door.toLowerCase()) >= 0\n }\n \n const dijkstra = (srcPos, srcObj) => {\n const nodes = {}\n const pq = new Map()\n \n const weight = objs => objs.filter(isKey).length\n \n const srcNode = { dist: 0, from: '', pos: srcPos, objs: [srcObj] }\n nodes[srcObj] = srcNode\n pq.set(srcObj, srcNode)\n while (pq.size) {\n // find the shortest path so far\n const u = [...pq.keys()].sort((a, b) => {\n return weight(pq.get(a).objs) - weight(pq.get(b).objs)\n })[0]\n const { dist, from, pos, objs } = pq.get(u)\n// console.log([...pq.keys()], u)\n pq.delete(u)\n \n // test next paths\n const dests = findDests(pos, objs)\n const nextObjs = Object.keys(dests)\n .filter(c => isKey(c) || canOpen(c, objs))\n \n nextObjs.forEach(v => {\n const { pos: nextPos, k } = dests[v]\n const nextDist = dist + k\n let nextNode = nodes[v]\n if (!nextNode) {\n nextNode = { dist: Infinity, objs: [] }\n nodes[v] = nextNode\n }\n \n if (weight([...objs, v]) > weight(nextNode.objs)) {\n console.log([...objs, v], nextNode.objs)\n nextNode.dist = nextDist\n nextNode.from = u\n nextNode.pos = nextPos\n nextNode.objs = [...objs, v]\n pq.set(v, nextNode)\n }\n })\n }\n console.log(nodes)\n }\n\n dijkstra(startPos, '@')\n}", "function drawMaze(width, height){\n\n let visited = new Stack();\n let curCell = cellMap.get(coords[0]); // start at top left\n\n visited.push(curCell);\n\n // visit every block\n while(!visited.isEmpty()) {\n\n visited.peek().color = \"red\";\n visited.peek().drawThis();\n\n\n // randomly choose neighbor to visit\n while(!curCell.visitedNeighbors()) {\n // place current dot\n curCell.setVisited(true);\n\n let nextCellCoord = (curCell.getNeighbors()[Math.floor(Math.random() * (curCell.getNeighbors().length))]).getCoord();\n\n let nextCell = cellMap.get(find(nextCellCoord));\n\n while(nextCell.getVisited()) {\n nextCellCoord = (curCell.getNeighbors()[Math.floor(Math.random() * (curCell.getNeighbors().length))]).getCoord();\n\n nextCell = cellMap.get(find(nextCellCoord));\n }\n\n drawMazeLine(curCell.getCoord(), nextCell.getCoord());\n curCell.color = \"black\";\n nextCell.color = \"red\";\n\n curCell.drawThis();\n nextCell.drawThis();\n\n curCell.addConnection(nextCell);\n nextCell.addConnection(curCell);\n\n curCell = nextCell;\n curCell.setVisited(true);\n visited.push(curCell);\n }\n\n let temp = visited.peek();\n temp.color = \"black\";\n temp.drawThis();\n curCell = visited.pop();\n }\n}", "function escapeMazeAllWays(maze, pos = 0, row = 0, col = 0, path = [], direction='S') {\n if (row >= maze.length || col >= maze[0].length) {\n return;\n }\n if (row < 0 || col < 0) {\n return;\n }\n\n path[pos] = direction;\n pos++;\n\n if (maze[row][col] === 'e') {\n console.log(path);\n return;\n }\n if (maze[row][col] === ' ') {\n maze[row][col] = 'x';\n escapeMaze(maze, pos, row, col + 1, path, 'R');\n escapeMaze(maze, pos, row, col - 1, path, 'L');\n escapeMaze(maze, pos, row + 1, col, path, 'D');\n escapeMaze(maze, pos, row - 1, col, path, 'U');\n maze[row][col] = ' ';\n }\n pos--;\n}", "fillMazeProcedural(mazeTemplateCompressed) {\n const template = this.Utilities.uncompressTemplate(mazeTemplateCompressed);\n // tslint:disable-next-line:prefer-const\n let path = template.MazePath.split(\"\");\n this.StartLocation = template.StartLocation;\n this.EndLocation = template.EndLocation;\n this.BestPath = template.BestPath;\n this.MazeDifficulty = template.MazeDifficulty;\n this.GridWidth = template.GridWidth;\n this.GridHeight = template.GridHeight;\n this.GridLayers = template.GridLayers;\n this.MazeGrid = this.generateGrid();\n // MazePath: myMaze.MazePath,\n // Start: JSON.stringify(myMaze.StartLocation),\n // End: JSON.stringify(myMaze.EndLocation),\n // BestPath: myMaze.BestPath,\n // Difficulty: myMaze.MazeDifficulty,\n // tslint:disable-next-line:prefer-const\n let cellsList = [new Cell(0, 0, 0)];\n let next;\n let mazePath = \"\";\n let index = -1;\n while (cellsList.length > 0) {\n // index is the newest\n index = cellsList.length - 1;\n const currentCell = cellsList[index];\n next = path.shift();\n if (next === \"\" || next === undefined) {\n break;\n }\n else if (next === this.Utilities.Back) {\n cellsList.splice(index, 1);\n }\n else {\n const nextCell = this.directionModifier(cellsList[index], next);\n // const result2: any = \n this.carvePathBetweenCells(currentCell, nextCell, next);\n this.MazeGrid[currentCell.Z][currentCell.Y][currentCell.X] = currentCell;\n this.MazeGrid[nextCell.Z][nextCell.Y][nextCell.X] = nextCell;\n cellsList.push(nextCell);\n index = -1;\n }\n if (index !== -1) {\n cellsList.splice(index, 1);\n }\n mazePath += next;\n }\n return mazePath;\n }", "function drawMaze() {\n for( var i = 0; i < cols; i++ ) {\n for( var j = 0; j < rows; j++ ) {\n /*\n switch( maze[i][j] ) {\n case 0: ctx.fillStyle = \"black\"; break;\n case 1: ctx.fillStyle = \"gray\"; break;\n case 2: ctx.fillStyle = \"red\"; break;\n case 3: ctx.fillStyle = \"yellow\"; break;\n case 4: ctx.fillStyle = \"#500000\"; break;\n case 8: ctx.fillStyle = \"blue\"; break;\n }\n ctx.fillRect( grid * i, grid * j, grid, grid );\n ctx.strokeStyle = ctx.fillStyle;\n ctx.strokeRect( grid * i, grid * i, grid, grid );*/\n drawBlock(i,j,maze[i][j]);\n }\n }\n}", "function displayMaze(x, y, maze) {\r\n canvas = document.getElementById('maze-canvas');\r\n context = canvas.getContext('2d');\r\n let width = canvas.width;\r\n let height = canvas.height;\r\n let cellSize = width / x;\r\n\r\n // Green starting cell\r\n context.fillStyle = 'rgba(0, 200, 0, 0.5)';\r\n context.fillRect(0, 0, cellSize, cellSize);\r\n \r\n // Red ending cell\r\n context.fillStyle = 'rgba(200, 0, 0, 0.5)';\r\n context.fillRect(width - cellSize, height - cellSize, cellSize, cellSize);\r\n\r\n // Loop through each maze cell\r\n for (let i = 0; i < x; i++) {\r\n for (let j = 0; j < y; j++) {\r\n let columnCoord = i * cellSize;\r\n let rowCoord = j * cellSize;\r\n\r\n if(!maze[i][j].top) {\r\n context.beginPath();\r\n context.strokeStyle = '#FFFFFF';\r\n context.moveTo(columnCoord, rowCoord + cellSize);\r\n context.lineTo(columnCoord + cellSize, rowCoord + cellSize);\r\n context.stroke();\r\n }\r\n if(!maze[i][j].bottom) {\r\n context.beginPath();\r\n context.strokeStyle = '#FFFFFF';\r\n context.moveTo(columnCoord + cellSize, rowCoord);\r\n context.lineTo(columnCoord, rowCoord);\r\n context.stroke();\r\n } \r\n if(!maze[i][j].left) {\r\n context.beginPath();\r\n context.strokeStyle = '#FFFFFF';\r\n context.moveTo(columnCoord, rowCoord);\r\n context.lineTo(columnCoord, rowCoord + cellSize);\r\n context.stroke();\r\n }\r\n if(!maze[i][j].right) {\r\n context.beginPath();\r\n context.strokeStyle = '#FFFFFF';\r\n context.moveTo(columnCoord + cellSize, rowCoord + cellSize);\r\n context.lineTo(columnCoord + cellSize, rowCoord);\r\n context.stroke();\r\n }\r\n }\r\n }\r\n }", "function solveMaze() {\n\n let grid = cGrid;\n var curRow = 0;\n var curCol = 0;\n var prevRow = 0;\n var prevCol = 0;\n var stepCount = 0;\n var exitReached = false;\n var noExit = false;\n var minDistance = -1;\n var nextDirection;\n var moveUp = {};\n var moveLeft = {};\n var moveRight = {};\n var moveDown = {};\n\n //Mark the start as part of the path\n grid[startRow][startCol] = colValues.PATH;\n var elementID = `${startRow}:${startCol}`;\n document.getElementById(elementID).setAttribute(\"blockValue\", \"step\");\n\n //solve the maze by lookig for the next best step\n do {\n\n let nextStep = [];\n let prevRow = curRow;\n let prevCol = curCol;\n\n moveUp = move(curRow, curCol, grid, directions.UP);\n if (moveUp.canMove == true) {\n nextStep.push(moveUp);\n }\n\n moveDown = move(curRow, curCol, grid, directions.DOWN);\n if (moveDown.canMove == true) {\n nextStep.push(moveDown);\n }\n\n moveLeft = move(curRow, curCol, grid, directions.LEFT);\n if (moveLeft.canMove == true) {\n nextStep.push(moveLeft);\n }\n\n moveRight = move(curRow, curCol, grid, directions.RIGHT);\n if (moveRight.canMove == true) {\n nextStep.push(moveRight);\n }\n\n //if we have no where to go exit\n if (nextStep.length == 0) {\n noExit = true;\n break;\n }\n\n //sort nextstep by min distance\n nextStep.sort((a, b) => (a.minDistance - b.minDistance));\n\n //pick the element that is closest to the exit. Pick Up or Down first. \n switch (nextStep[0].direction) {\n case directions.UP:\n //move up and add to step count \n stepCount++;\n curRow = curRow + 1;\n break;\n case directions.DOWN:\n //Move Down and add to step count\n stepCount++;\n curRow = curRow - 1;\n break;\n case directions.LEFT:\n //Move left and add to step count\n stepCount++;\n curCol = curCol - 1;\n break;\n case directions.RIGHT:\n //Move right and add to step count\n stepCount++;\n curCol = curCol + 1;\n break;\n\n }\n //mark the sqaures on the page\n exitReached = markElements(curRow, curCol, prevRow, prevCol, grid);\n }\n while (exitReached == false || noExit == true);\n if (exitReached == true) {\n document.getElementById(\"results\").innerHTML = `Success! It took ${stepCount} step(s)`\n }\n}", "function drawMaze(mfields, first, last) {\n console.log(\"startfeld\", first);\n let cvs = document.getElementById('cvs');\n let ctx = cvs.getContext('2d');\n\n ctx.fillStyle = '#000000';\n\n for (let y = 0; y < mfields.length; y++) {\n for (let x = 0; x < mfields[y].length; x++) {\n ctx.beginPath();\n ctx.strokeStyle = '#ffff00';\n ctx.rect(x * field_dim, y * field_dim, field_dim, field_dim);\n ctx.fill();\n ctx.stroke();\n }\n }\n\n ctx.beginPath();\n ctx.fillStyle = '#d1d1d1';\n\n\n\n\n for (let y = 0; y < mfields.length; y++) {\n for (let x = 0; x < mfields[y].length; x++) {\n ctx.beginPath();\n ctx.strokeStyle = '#ffff00';\n\n if (mfields[y][x].neighbors.n) {\n if (y != 0)\n ctx.rect(x * field_dim + 1, (y - 1) * field_dim + 1, field_dim - 2, field_dim * 2 - 2);\n }\n if (mfields[y][x].neighbors.s) {\n if (!(y == mfields.length - 1))\n ctx.rect(x * field_dim + 1, y * field_dim + 1, field_dim - 2, field_dim * 2 - 2);\n }\n\n if (mfields[y][x].neighbors.w) {\n ctx.rect((x - 1) * field_dim + 1, y * field_dim + 1, field_dim * 2 - 2, field_dim - 2);\n }\n if (mfields[y][x].neighbors.e) {\n ctx.rect((x) * field_dim + 1, y * field_dim + 1, field_dim * 2 - 2, field_dim - 2);\n }\n ctx.fill();\n ctx.beginPath();\n ctx.fillStyle = \"#ff0000\";\n\n if (mfields[y][x].item) {\n if (mfields[y][x].item == \"Banane\")\n ctx.fillText(\"B\", (x) * field_dim + field_dim / 2, y * field_dim + 1 + field_dim / 2);\n if (mfields[y][x].item == \"Schwert\")\n ctx.fillText(\"S\", (x) * field_dim + field_dim / 2, y * field_dim + 1 + field_dim / 2);\n\n }\n ctx.fill();\n ctx.fillStyle = \"#000000\";\n }\n\n\n }\n\n\n\n // Aktuelles Feld einzeichnen\n\n let y = parseInt(first.id / cols);\n let x = parseInt(first.id % cols);\n ctx.beginPath();\n ctx.arc(x * field_dim + field_dim / 2, y * field_dim + field_dim / 2, 5, 0, 2 * Math.PI);\n\n ctx.fillStyle = '#ffff00'\n ctx.fill();\n\n\n ctx.fillStyle = '#d1d1d1'\n\n if (first.neighbors.n)\n ctx.rect(x * field_dim + 5, (y - 1) * field_dim + 5, field_dim - 10, field_dim - 10);\n if (first.neighbors.s)\n ctx.rect(x * field_dim + 5, (y + 1) * field_dim + 5, field_dim - 10, field_dim - 10);\n if (first.neighbors.w)\n ctx.rect((x - 1) * field_dim + 5, (y) * field_dim + 5, field_dim - 10, field_dim - 10);\n if (first.neighbors.e)\n ctx.rect((x + 1) * field_dim + 5, (y) * field_dim + 5, field_dim - 10, field_dim - 10);\n\n ctx.fill();\n //ctx.stroke();\t\t\t\n\n\n\n // Letzes Feld einzeichnen\n y = parseInt(last.id / cols);\n x = parseInt(last.id % cols);\n\n ctx.beginPath();\n ctx.arc(x * field_dim + field_dim / 2, y * field_dim + field_dim / 2, 5, 0, 2 * Math.PI);\n\n ctx.fillStyle = '#0000ff'\n ctx.fill();\n\n drawTimer()\n}", "function initLogicalMaze()\n {\n //This function is hard-coded for a fixed maze of length 23 across and down.\n // I will manually make rows 0-11. Rows 12-22 will be a mirror image of rows 0-10.\n\n // Note by default each square is already a GRID_BLANK due to initGrid()\n\n //row 0\n for(var i = 0; i < GRIDSIZE; i++)\n {\n GRID[i][0] = GRID_WALL;\n }\n\n //row 1\n GRID[0][1] = GRID_WALL;\n GRID[1][1] = GRID_PORTAL;\n GRID[4][1] = GRID_WALL;\n GRID[10][1] = GRID_WALL;\n GRID[12][1] = GRID_WALL;\n GRID[21][1] = GRID_PORTAL;\n GRID[22][1] = GRID_WALL;\n\n //row 2\n GRID[0][2] = GRID_WALL;\n GRID[2][2] = GRID_WALL;\n\n for(i = 6; i <= 22; i += 2)\n {\n GRID[i][2] = GRID_WALL;\n }\n\n //row 3\n GRID[0][3] = GRID_WALL;\n GRID[2][3] = GRID_WALL;\n GRID[3][3] = GRID_WALL;\n GRID[5][3] = GRID_WALL;\n GRID[6][3] = GRID_WALL;\n GRID[8][3] = GRID_WALL;\n GRID[9][3] = GRID_WALL;\n for(i = 10; i <= 22; i += 2)\n {\n GRID[i][3] = GRID_WALL;\n }\n\n //row 4\n GRID[0][4] = GRID_WALL;\n GRID[5][4] = GRID_WALL;\n GRID[8][4] = GRID_WALL;\n GRID[22][4] = GRID_WALL;\n\n //row 5\n GRID[0][5] = GRID_WALL;\n GRID[1][5] = GRID_WALL;\n GRID[3][5] = GRID_WALL;\n GRID[5][5] = GRID_WALL;\n GRID[7][5] = GRID_WALL;\n GRID[8][5] = GRID_WALL;\n for(i = 10; i <= 16; i++)\n {\n GRID[i][5] = GRID_WALL;\n }\n GRID[17][5] = GRID_HEALTH_PICKUP;\n GRID[18][5] = GRID_WALL;\n GRID[19][5] = GRID_WALL;\n GRID[20][5] = GRID_WALL;\n GRID[22][5] = GRID_WALL;\n\n //row 6\n GRID[0][6] = GRID_WALL;\n GRID[3][6] = GRID_WALL;\n GRID[5][6] = GRID_WALL;\n GRID[10][6] = GRID_WALL;\n GRID[14][6] = GRID_WALL;\n GRID[16][6] = GRID_WALL;\n GRID[17][6] = GRID_WALL;\n GRID[18][6] = GRID_WALL;\n GRID[22][6] = GRID_WALL;\n\n //row 7\n GRID[0][7] = GRID_WALL;\n GRID[2][7] = GRID_WALL;\n GRID[3][7] = GRID_WALL;\n GRID[7][7] = GRID_WALL;\n GRID[9][7] = GRID_WALL;\n GRID[10][7] = GRID_WALL;\n GRID[12][7] = GRID_WALL;\n GRID[14][7] = GRID_WALL;\n GRID[18][7] = GRID_WALL;\n GRID[19][7] = GRID_DAMAGE_PICKUP;\n GRID[20][7] = GRID_WALL;\n GRID[22][7] = GRID_WALL;\n\n //row 8\n GRID[0][8] = GRID_WALL;\n GRID[2][8] = GRID_DAMAGE_PICKUP;\n GRID[3][8] = GRID_WALL;\n GRID[4][8] = GRID_WALL;\n GRID[5][8] = GRID_WALL;\n GRID[7][8] = GRID_WALL;\n GRID[12][8] = GRID_WALL;\n GRID[14][8] = GRID_WALL;\n GRID[16][8] = GRID_WALL;\n GRID[18][8] = GRID_WALL;\n GRID[19][8] = GRID_WALL;\n GRID[20][8] = GRID_WALL;\n GRID[22][8] = GRID_WALL;\n\n //row 9\n GRID[0][9] = GRID_WALL;\n GRID[2][9] = GRID_WALL;\n GRID[4][9] = GRID_HEALTH_PICKUP;\n GRID[5][9] = GRID_WALL;\n for(i = 7; i <= 10; i++)\n {\n GRID[i][9] = GRID_WALL;\n }\n GRID[12][9] = GRID_WALL;\n GRID[16][9] = GRID_WALL;\n GRID[22][9] = GRID_WALL;\n\n //row 10\n GRID[0][10] = GRID_WALL;\n GRID[4][10] = GRID_WALL;\n GRID[8][10] = GRID_WALL;\n GRID[10][10] = GRID_WALL;\n GRID[12][10] = GRID_WALL;\n GRID[13][10] = GRID_WALL;\n GRID[15][10] = GRID_WALL;\n GRID[17][10] = GRID_WALL;\n GRID[18][10] = GRID_WALL;\n GRID[20][10] = GRID_WALL;\n GRID[21][10] = GRID_WALL;\n GRID[22][10] = GRID_WALL;\n\n //row 11. This is the middle row (it will not be mirrored, only 0-10 will be mirrored)\n for(var i = 0; i <= 3; i++)\n {\n GRID[i][11] = GRID_WALL;\n }\n GRID[4][11] = GRID_PORTAL;\n GRID[6][11] = GRID_WALL;\n GRID[22][11] = GRID_WALL;\n\n //mirror the remaining rows.\n var jOld = 10;\n for(var jNew = 12; jNew < GRIDSIZE; jNew++)\n {\n for(i = 0; i < GRIDSIZE; i++)\n {\n GRID[i][jNew] = GRID[i][jOld];\n }\n jOld--;\n }\n\n }", "function onCreate() {\n\n document.getElementById(\"btnCreateMaze\").setAttribute(\"disabled\", \"disabled\");\n\n wid = document.getElementById(\"maze\").offsetWidth - padding; \n hei = 400;\n\n cols = eval(document.getElementById(\"cols\").value); \n rows = eval(document.getElementById(\"rows\").value);\n\n mazeType = document.getElementById(\"sltType\").value;\n document.getElementById(\"path\").innerHTML = \"\";\n document.getElementById(\"searchlength\").innerHTML = \"\";\n document.getElementById(\"output\").innerHTML =\"生成迷宫中\";\n if(mazeType == \"Maze1\") {\n cols = cols + 1 - cols % 2;\n rows = rows + 1 - rows % 2; \n }\n\n maze = createArray( cols, rows );\n mazePointer = createArray( cols, rows );\n mazeDir = createArray( cols, rows );\n if(document.getElementById(\"sltType\").value == \"Maze2\") {\n document.getElementById(\"Mazedesc\").innerHTML = \"Maze2:<br />一个纯随机生成的迷宫,支持8个方向(包括对角线)LCA算法在此失效 ,但A*算法则表现了其高效的寻路性能。\";\n }\n else {\n document.getElementById(\"Mazedesc\").innerHTML = \"Maze1:<br />一个经典的单连通迷宫,只支持4个方向。绝大多数的算法在这种经典迷宫中均没有良好的效果,但LCA(最近公共祖先算法)显然是个特例。\";\n }\n var canvas = document.getElementById(\"canvas\");\n canvas.width = wid;\n canvas.height = hei;\n s = canvas.width / (grid * cols);\n canvas.height = s * grid * rows;\n\n ctx.scale(s, s);\n\n drawMaze();\n if(mazeType == \"Maze1\") {\n\n start.x = Math.floor( Math.random() * ( cols / 2 ) );\n start.y = Math.floor( Math.random() * ( rows / 2 ) );\n if( !( start.x & 1 ) ) start.x++; if( !( start.y & 1 ) ) start.y++;\n maze[start.x][start.y] = 0;\n mazeDir[start.x][start.y] = undefined;\n if(document.getElementById(\"chkAnimated\").checked) {\n\n createMaze1();\n }\n else {\n\n createMaze1NonAni();\n }\n }\n else {\n\n density = document.getElementById(\"density\").value / 100;\n start.x = 1;\n start.x = 1;\n\n if(document.getElementById(\"chkAnimated\").checked) {\n\n createMaze2();\n }\n else {\n\n createMaze2NonAni();\n }\n }\n document.getElementById(\"output\").innerHTML =\"迷宫已成功生成,点击起终点开始寻路\";\n}", "function mazeSolver(maze, x, y) {\n if(maze[y][x] === 'e') {\n return 'End'\n }\n else {\n if(maze[y][x + 1] === true) {\n if(maze[y][x + 1] === ' ') {\n return mazeSolver(maze, x + 1, y)\n }\n }\n // else if(maze[y - 1][x] === true) {\n // if(maze[y - 1][x] === ' ') {\n // return mazeSolver(maze, x, y - 1) + 'D'\n // }\n // }\n // else if(maze[y][x - 1] === true) {\n // if(maze[y][x - 1] === ' ') {\n // return mazeSolver(maze, x - 1, y) + 'L'\n // }\n // }\n // else if(maze[y + 1][x] === true) {\n // if(maze[y + 1][x] === ' ') {\n // console.log(maze[x][y])\n // return mazeSolver(maze, x, y + 1)\n // }\n // }\n }\n}", "function mazeMe() {\n for (x = 0; x < maze.length; x++) {\n for (y = 0; y < maze[x].length; y++) {\n if (maze[y][x] === 1) {\n ctx.fillStyle = \"white\";\n ctx.fillRect(x * 25, y * 25, 25, 25);\n }\n }\n }\n}", "function mazegen(rows, cols) {\n\n var maxheight = rows - 1; //counting 0\n var maxwidth = cols - 1;\n\n deadthresh = Math.ceil((rows + cols) * 0.7);\n\n for (var i = 0; i <= maxheight; i++) { //rows\n\n maze[i] = [];\n\n for (var j = 0; j <= maxwidth; j++) { //columns (cells)\n {\n maze[i][j] = {};\n maze[i][j].pathed = false;\n if (i === 0 || j === 0 || i === maxheight || j === maxwidth) {\n maze[i][j].wall = true;\n } else {\n maze[i][j].wall = false;\n }\n }\n }\n\n }\n\n start = {\n x: Math.floor(maxwidth / 2),\n y: Math.floor(maxheight / 2)\n };\n\n //force the start point to open upward\n maze[start.x][start.y] = {\n pathed: true,\n isInSolution: true\n };\n totalpathed = totalpathed + 1;\n //put walls around the start\n maze[start.x + 1][start.y].wall = true;\n maze[start.x - 1][start.y].wall = true;\n maze[start.x][start.y + 1].wall = true;\n\n //begin generation from the tile above the start\n while (totalpathed < maxheight * maxwidth / 3) {\n pathing(start.x, start.y - 1, \"up\", 0);\n }\n return {\n start: start,\n end: { x: 0, y: 0 },\n rows: rows,\n cols: cols,\n maze: maze\n };\n}", "function maze()\n{\n this.cells = new Array();\n this.start = {m: 0, n: 0};\n this.end = {m: columns - 1, n: rows - 1};\n this.visitedCount = 0;\n \n /**\n * Provides a level of indirection to the builder() method which can't\n * use a 'this' reference\n */\n this.build = function()\n {\n builder(this); \n }\n \n /**\n * Kicks of the initialization abcation, then continues with the generator()\n */\n function builder(maze)\n { \n abc( function(column) { return rowInitializer(maze, column) }, columns, \n function() { generator(maze) }); \n }\n\n /**\n * Initializes the maze one row at a time\n */\n function rowInitializer(maze, m)\n {\n maze.cells[m] = new Array(columns);\n\n for(n = 0; n < rows; n++)\n {\n maze.cells[m][n] = new cell();\n }\n \n return m + 1;\n }\n\n /**\n * A cell object\n */\n function cell()\n {\n this.token = null; // reference to the div for when we're solving\n this.visited = false;\n this.wall = [ true, true, true, true ];\n }\n}", "function escape(maze) {\n \n this.maze = maze;\n \n this.traverse = function(column, row) {\n console.log('D')\n if(this.maze[column][row] == 2) {\n console.log(\"We solved the maze at (\" + column + \", \" + row + \")\");\n } else if(this.maze[column][row] == 1) {\n console.log(\"At valid position (\" + column + \", \" + row + \")\");\n this.maze[column][row] = 9;\n if(column < this.maze.length - 1) {\n console.log('R')\n this.traverse(column + 1, row);\n }\n if(row < this.maze[column].length - 1) {\n console.log('D')\n this.traverse(column, row + 1);\n }\n if(column > 0) {\n console.log('L')\n this.traverse(column - 1, row);\n }\n if(row > 0) {\n console.log('U')\n this.traverse(column, row - 1);\n }\n }\n };\n \n }", "function newMaze() {\n\n width = document.getElementById('width').value;\n height = document.getElementById('height').value;\n\n\n if (width >= 2 && height >= 2) {\n\n canvas.width = width*boxSize + lineWeight/2;\n canvas.height = height*boxSize + lineWeight/2;\n\n errorMessage.style.visibility = \"hidden\";\n resetEverything();\n errorMessage.innerHTML = 'Please input acceptable dimensions.';\n\n fillBoard(width * boxSize, height * boxSize);\n drawMaze(width, height);\n showMaze = true;\n\n //create entry and exit points\n ctx.beginPath();\n ctx.lineWidth = boxSize - lineWeight;\n\n ctx.moveTo(0, boxSize/2 + padding);\n ctx.lineTo(coords[0].getX() - lineWeight, coords[0].getY());\n\n ctx.moveTo(coords[coords.length - 1].getX() + lineWeight, coords[coords.length - 1].getY());\n ctx.lineTo(canvas.width, coords[coords.length - 1].getY());\n\n ctx.closePath();\n ctx.strokeStyle = \"white\";\n ctx.stroke();\n\n } else {\n\n errorMessage.style.visibility = \"visible\";\n errorMessage.classList.add('red-glow');\n setTimeout(function() {errorMessage.classList.add('remove-glow')}, 800);\n setTimeout(function() {errorMessage.classList.remove('red-glow')}, 800);\n setTimeout(function() {errorMessage.classList.remove('remove-glow')}, 1600);\n }\n}", "function escapeMaze(maze, pos = 0, row = 0, col = 0, path = [], direction='S') {\n if (row >= maze.length || col >= maze[0].length) {\n return;\n }\n if (row < 0 || col < 0) {\n return;\n }\n\n path[pos] = direction;\n pos++;\n\n if (maze[row][col] === 'e') {\n console.log(path);\n return;\n }\n if (maze[row][col] === ' ') {\n maze[row][col] = 'x';\n escapeMaze(maze, pos, row, col + 1, path, 'R');\n escapeMaze(maze, pos, row, col - 1, path, 'L');\n escapeMaze(maze, pos, row + 1, col, path, 'D');\n escapeMaze(maze, pos, row - 1, col, path, 'U');\n }\n pos--;\n}", "function createMaze(mfields) {\n\n var stack = [];\n var visited = [];\n\n y = parseInt(Math.random() * mfields.length);\n x = parseInt(Math.random() * mfields[y].length);\n\n let start = mfields[y][x];\n let first = start;\n\n\n\n stack.push(start);\n stack.push(start);\n visited.push(start);\n\n\n\n\n while (stack.length > 0) {\n\n\n\n\n let neighbors = getNeighbors(mfields, visited, y, x)\n //\tconsole.log(start, n);\n\n if (!neighbors.every(n => n == null)) {\n\n let rnd = null;\n let fld = null;\n\n do {\n rnd = parseInt(Math.random() * neighbors.length);\n fld = neighbors[rnd];\n\n } while (!fld);\n\n switch (rnd) {\n case 0:\n start.neighbors.n = fld;\n fld.neighbors.s = start;\n break;\n case 1:\n start.neighbors.s = fld;\n fld.neighbors.n = start;\n break;\n case 2:\n start.neighbors.w = fld;\n fld.neighbors.e = start;\n break;\n case 3:\n start.neighbors.e = fld;\n fld.neighbors.w = start;\n break;\n }\n\n start = fld;\n\n stack.push(fld);\n visited.push(fld);\n\n\n } else {\n start = stack.pop();\n }\n\n y = parseInt(start.id / cols);\n x = parseInt(start.id % cols);\n }\n\n return first;\n\n}", "function makeNewMaze(mapSize){\n\t//Robert TODO: build a process by which a new array of arrays is created with the proper lengths, and to ensure that there IS a path to the end\n\t//Robert TODO: assign mapData these key value pairs {map: [ [], [], [], [] ], playerPosition: [y, x], mosterNOrigin: [y, x]}\n\tvar mapMargin = mapSize / 3;\n\n\tfunction generateMap(){\n\n\t\tvar monsterCount = 0;\n\n\t\tmapData.map = [];\n\t\tmapData.viewMap = [];\n\n\t\tfor (let i = 0; i < mapSize; i++) {\n\t\t\tmapData.map.push([]);\n\t\t\tfor (let j = 0; j < mapSize; j++) {\n\t\t\t\tmapData.map[i].push(0);\n\t\t\t}\n\t\t}\n\n\t\tmapData.playerPosition = [];\n\t\tmapData.playerPosition.push(Math.ceil(Math.random()*(mapSize-2*mapMargin)+mapMargin));\n\t\tmapData.playerPosition.push(Math.ceil(Math.random()*(mapSize-2*mapMargin)+mapMargin));\n\n\t\tmapData.map[mapData.playerPosition[0]][mapData.playerPosition[1]] = FLOOR;\n\n\t\tvar curY = mapData.playerPosition[0];\n\t\tvar curX = mapData.playerPosition[1];\n\n\t\tvar triedToStep = 0;\n\t\tvar madeAStep = 0;\n\t\t\n\n\t\twhile((curY != 0 && curY != mapSize-1) && (curX != 0 && curX != mapSize-1)) {\n\t\t\tvar upRand = Math.random()*10;\n\t\t\tvar downRand = Math.random()*10;\n\t\t\tvar rightRand = Math.random()*10;\n\t\t\tvar leftRand = Math.random()*10;\n\n\t\t\tif (upRand > downRand && upRand > rightRand && upRand > leftRand) {\n\t\t\t\ttriedToStep++;\n\t\t\t\tif (mapData.map[curY-1][curX] == WALL && (mapData.map[curY-1][curX+1] != FLOOR || mapData.map[curY-1][curX-1] != FLOOR)){\n\t\t\t\t\ttriedToStep = 0;\n\t\t\t\t\tmadeAStep++;\n\t\t\t\t\tcurY-=1;\n\t\t\t\t\tif (madeAStep%180 == 0){\n\t\t\t\t\t\tmapData.map[curY][curX] = parseInt('4'+String(monsterCount));\n\t\t\t\t\t\teval('mapData.monster'+monsterCount+'Origin = ['+curY+','+curX+']'); //mapData.monster0Origin = [11, 12]\n\t\t\t\t\t\tmonsterCount+=1;\n\t\t\t\t\t} else if (madeAStep%20 == 0){\n\t\t\t\t\t\tmapData.map[curY][curX] = SAFE;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapData.map[curY][curX] = FLOOR;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (downRand > rightRand && downRand > leftRand) {\n\t\t\t\ttriedToStep++;\n\t\t\t\tif (mapData.map[curY+1][curX] == WALL && (mapData.map[curY+1][curX+1] != FLOOR || mapData.map[curY+1][curX-1] != FLOOR)){\n\t\t\t\t\ttriedToStep = 0;\n\t\t\t\t\tmadeAStep++;\n\t\t\t\t\tcurY+=1;\n\t\t\t\t\tif (madeAStep%180 == 0){\n\t\t\t\t\t\tmapData.map[curY][curX] = parseInt('4'+String(monsterCount));\n\t\t\t\t\t\teval('mapData.monster'+monsterCount+'Origin = ['+curY+','+curX+']');\n\t\t\t\t\t\tmonsterCount+=1;\n\t\t\t\t\t} else if (madeAStep%20 == 0){\n\t\t\t\t\t\tmapData.map[curY][curX] = SAFE;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapData.map[curY][curX] = FLOOR;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (rightRand > leftRand) {\n\t\t\t\ttriedToStep++;\n\t\t\t\tif (mapData.map[curY][curX+1] == WALL && (mapData.map[curY+1][curX+1] != FLOOR || mapData.map[curY-1][curX+1] != FLOOR)){\n\t\t\t\t\ttriedToStep = 0;\n\t\t\t\t\tmadeAStep++;\n\t\t\t\t\tcurX+=1;\n\t\t\t\t\tif (madeAStep%180 == 0){\n\t\t\t\t\t\tmapData.map[curY][curX] = parseInt('4'+String(monsterCount));\n\t\t\t\t\t\teval('mapData.monster'+monsterCount+'Origin = ['+curY+','+curX+']');\n\t\t\t\t\t\tmonsterCount+=1;\n\t\t\t\t\t} else if (madeAStep%20 == 0){\n\t\t\t\t\t\tmapData.map[curY][curX] = SAFE;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapData.map[curY][curX] = FLOOR;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttriedToStep+=1;\n\t\t\t\tif (mapData.map[curY][curX-1] == WALL && (mapData.map[curY+1][curX-1] != FLOOR || mapData.map[curY-1][curX-1] != FLOOR)){\n\t\t\t\t\ttriedToStep = 0;\n\t\t\t\t\tmadeAStep++;\n\t\t\t\t\tcurX-=1;\n\t\t\t\t\tif (madeAStep%180 == 0){\n\t\t\t\t\t\tmapData.map[curY][curX] = parseInt('4'+String(monsterCount));\n\t\t\t\t\t\teval('mapData.monster'+monsterCount+'Origin = ['+curY+','+curX+']');\n\t\t\t\t\t\tmonsterCount+=1;\n\t\t\t\t\t} else if (madeAStep%20 == 0){\n\t\t\t\t\t\tmapData.map[curY][curX] = SAFE;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapData.map[curY][curX] = FLOOR;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} \n\t\t\tif (triedToStep == 10) {\n\t\t\t\tmadeAStep++;\n\t\t\t\tif (upRand > downRand && upRand > rightRand && upRand > leftRand) {\n\t\t\t\t\tcurY--;\n\t\t\t\t} else if (downRand > rightRand && downRand > leftRand) {\n\t\t\t\t\tcurY++;\n\t\t\t\t} else if (rightRand > leftRand) {\n\t\t\t\t\tcurX++;\n\t\t\t\t} else {\n\t\t\t\t\tcurX--;\n\t\t\t\t}\n\t\t\t\tif (mapData.map[curY][curX] != SAFE && String(mapData.map[curY][curX]).charAt(0) != '4' && mapData.map[curY][curX] != FLOOR && madeAStep%20 != 0){\n\t\t\t\t\tmapData.map[curY][curX] = FLOOR;\n\t\t\t\t} else {\n\t\t\t\t\tif (madeAStep%180 == 0){\n\t\t\t\t\t\tif (String(mapData.map[curY][curX]).charAt(0) != '4') {\n\t\t\t\t\t\t\tmapData.map[curY][curX] = parseInt('4'+String(monsterCount));\n\t\t\t\t\t\t\teval('mapData.monster'+monsterCount+'Origin = ['+curY+','+curX+']');\n\t\t\t\t\t\t\tmonsterCount+=1;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmadeAStep--;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (madeAStep%20 == 0){\n\t\t\t\t\t\tif (String(mapData.map[curY][curX]).charAt(0) != '4') {\n\t\t\t\t\t\t\tmapData.map[curY][curX] = SAFE;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmadeAStep--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttriedToStep = 0;\n\t\t\t}\n\t\t}\n\t\treturn madeAStep;\n\t}\n\n\n\tvar goodMap = false;\n\n\twhile (!goodMap) {\n\t\tvar stepsCounted = generateMap();\n\t\tif (stepsCounted > mapSize*8) {\n\t\t\tgoodMap = true;\n\t\t}\n\t}\n\n\tfor (let i = 0; i < 9; i++) {\n\t\tmapData.viewMap.push([]);\n\t\tfor (let j = 0; j < 9; j++) {\n\t\t\tmapData.viewMap[i].push(0);\n\t\t}\n\t}\n\n\tfor (let i = 0; i < 9; i++) {\n\t\tfor (let j = 0; j < 9; j++) {\n\t\t\ttry {\n\t\t\t\tmapData.viewMap[i].push((mapData.map[mapData.playerPosition[0]-(4-i)][mapData.playerPosition[0]-(4-j)]));\n\t\t\t} catch {\n\t\t\t\tmapData.viewMap[i].push(0);\n\t\t\t}\n\t\t}\n\t}\n}", "function pinkyMove() {\n if (maze[pinky.y-1][pinky.x] ==12) {\n maze[pinky.y][pinky.x] = 12;\n pinky.y = 11;\n maze[pinky.y][pinky.x] = 7;\n drawMaze();\n } else if (directionP <= 2.5) {\n if (maze[pinky.y][pinky.x-1] ==5) {\n maze[pinky.y][pinky.x] = 2;\n pinky.x = pinky.x - 1;\n maze[pinky.y][pinky.x] = 7;\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pinky.y][pinky.x-1] ==6) {\n maze[pinky.y][pinky.x] = 2;\n pinky.x = 26;\n maze[pinky.y][pinky.x] = 7;\n drawMaze();\n } else if (maze[pinky.y][pinky.x-1] ==1) {\n maze[pinky.y][pinky.x] = 7;\n directionP = Math.random() * 10;\n drawMaze();\n } else if (maze[pinky.y][pinky.x-1] !==1) {\n maze[pinky.y][pinky.x] = 2;\n pinky.x = pinky.x - 1;\n maze[pinky.y][pinky.x] = 7;\n drawMaze();\n }\n } else if (directionP > 2.5 && directionP <= 5) {\n if (maze[pinky.y-1][pinky.x] ==5) {\n maze[pinky.y][pinky.x] = 2;\n pinky.y = pinky.y - 1;\n maze[pinky.y][pinky.x] = 7;\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pinky.y-1][pinky.x] ==1) {\n maze[pinky.y][pinky.x] = 7;\n directionP = Math.random() * 10;\n drawMaze();\n } else if (maze[pinky.y-1][pinky.x] !==1) {\n maze[pinky.y][pinky.x] = 2;\n pinky.y = pinky.y - 1;\n maze[pinky.y][pinky.x] = 7;\n drawMaze();\n }\n } else if (directionP > 5 && directionP <= 7.5) {\n if (maze[pinky.y][pinky.x+1] ==5) {\n maze[pinky.y][pinky.x] = 2;\n pinky.x = pinky.x + 1;\n maze[pinky.y][pinky.x] = 7;\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pinky.y][pinky.x+1] ==6) {\n maze[pinky.y][pinky.x] = 2;\n pinky.x = 1;\n maze[pinky.y][pinky.x] = 7;\n drawMaze();\n } else if (maze[pinky.y][pinky.x+1] ==1) {\n maze[pinky.y][pinky.x] = 7;\n directionP = Math.random() * 10;\n drawMaze();\n } else if (maze[pinky.y][pinky.x+1] !==1) {\n maze[pinky.y][pinky.x] = 2;\n pinky.x = pinky.x + 1;\n maze[pinky.y][pinky.x] = 7;\n drawMaze();\n }\n } else if (directionP > 7.5) {\n if (maze[pinky.y+1][pinky.x] ==5) {\n maze[pinky.y][pinky.x] = 2;\n pinky.y = pinky.y + 1;\n maze[pinky.y][pinky.x] = 7;\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pinky.y+1][pinky.x] ==4) {\n maze[pinky.y][pinky.x] = 7;\n directionP = Math.random() * 10;\n drawMaze();\n } else if (maze[pinky.y+1][pinky.x] ==1) {\n maze[pinky.y][pinky.x] = 7;\n directionP = Math.random() * 10;\n drawMaze();\n } else if (maze[pinky.y+1][pinky.x] !==1) {\n maze[pinky.y][pinky.x] = 2;\n pinky.y = pinky.y + 1;\n maze[pinky.y][pinky.x] = 7;\n drawMaze();\n }\n }\n }", "function setup(){\r\ncols = Math.floor(width/w);\r\nrows = Math.floor(height/w);\r\n//for each column in each row create a cell\r\nfor (let rn = 0; rn < rows; rn++){\r\n for(let cn = 0; cn < cols; cn++){\r\n const cell = new Maze(cn,rn);\r\n grid.push(cell);\r\n }\r\n current = grid[0]; \r\n}\r\n}", "function drawMaze() {\n\tvar canvas = document.getElementById(\"maze\");\n\tvar context = canvas.getContext('2d');\n\tvar i, y;\n\tcontext.strokeStyle='black';\n\tfor(y=0; y<=610; y+=10) {\t\n\t\tcontext.beginPath();\n\t\tcontext.moveTo(0,y);\n\t\tcontext.lineTo(600,y);\n\t\tcontext.lineWidth=1;\n\t\tcontext.stroke();\n\t}\n\tfor(x=0; x<=610; x+=10) {\n\t\tcontext.beginPath();\n\t\tcontext.moveTo(x, 0);\n\t\tcontext.lineTo(x, 600);\n\t\tcontext.lineWidth=1;\n\t\tcontext.stroke();\n\t}\n}", "function pathFinder(maze){\n const dx = [-1,1,0,0];\n const dy = [0,0,-1,1];\n \n let correct_maze = maze.replace(/\\s/g,'');\n let len = Math.sqrt(correct_maze.length)\n let regex = new RegExp(`[W|\\.]{1,${len}}`,'g');\n let split_maze = correct_maze.match(regex) \n let initial_matrix = [...Array(len)].map((item, index) => [...split_maze[index]])\n let lee = Array.from({length : len}, item => [...Array(len)].fill(0));\n\n let queue = [];\n\n // Starting position\n queue.push({row:0,col:0});\n lee[0][0] = 1;\n\n while(queue.length !== 0) {\n let coordinates = queue[0];\n queue.shift();\n let row = coordinates.row;\n let col = coordinates.col;\n\n for(let d = 0; d < 4 ; d++) {\n let new_row = row + dx[d];\n let new_col = col + dy[d];\n \n if(valid_coordinates(new_row,new_col)) {\n lee[new_row][new_col] = lee[row][col] + 1;\n queue.push({row:new_row, col:new_col});\n }\n }\n }\n\n function valid_coordinates(x,y) {\n if (x < 0 || y < 0 || x >= len || y >= len || lee[x][y] !== 0 || initial_matrix[x][y] === 'W' )\n return false;\n return true;\n }\n\n return lee[len-1][len-1] !== 0 ? lee[len-1][len-1] - 1 : false;\n}", "async function solveMaze() {\n // add start point in the openlist\n // point object convention: [x, y, p_x, p_y, g, h, f]\n openlist = [[0, 0, -1, -1, 0, 0, 0]];\n // initialize closedlist\n closedlist = [];\n var tilesFreeze = JSON.parse(JSON.stringify(tiles));\n var pathFound = false;\n // current node\n var q = 0; \n // Search the maze until a path from start to finish has been found or there is nowhere left to search. \n while (openlist.length > 0) {\n // pop the element from the beginnnig of the list \n // which also has the minimum f parameter in the open list\n q = getNode(openlist);\n \n // if the current node is our destination node, we are finished\n if ((q[0] == tileColumnCount - 1) && (q[1] == tileRowCount - 1)) {\n pathFound = true;\n break;\n }\n // put the current node in the closed list and look at all of its neighbors\n closedlist.push(q);\n\n // for each neighbour of the current node (9 iterations)\n for (var i = q[0] - 1; i <= q[0] + 1; i++) {\n for (var j = q[1] - 1; j <= q[1] + 1; j++) {\n // skip the current tile itself when scanning\n if (i == q[0] && j == q[1]) {\n continue;\n }\n // check if the neighbour is valid (if the tile is empty or finish)\n if ((i >= 0 && i < tileColumnCount) && (j >= 0 && j < tileRowCount)) {\n if (tilesFreeze[i][j].state === 'e' || tilesFreeze[i][j].state === 'f') {\n\n // value of g() for current node will be 1 more than its parent \n var g = JSON.parse(JSON.stringify(q[4])) + 1; \n \n var addNode = true;\n // if neighbour is already in the CLOSED list and has a higher g()\n // value than the new g, then replace its parent with current node\n var idx = search(i, j, closedlist);\n if (idx != -1) {\n if (g < closedlist[idx][4]) {\n console.log('Updated in closed');\n closedlist[k][2] = JSON.parse(JSON.stringify(q[0]));\n closedlist[k][3] = JSON.parse(JSON.stringify(q[1]));\n closedlist[k][4] = g;\n }\n continue;\n }\n \n // if neighbour is already in the OPEN list and has a higher g()\n // value than the new g, then replace its parent with current node\n // and recalculate and update its f() value\n idx = search(i, j, openlist);\n if (idx != -1) {\n if (g < openlist[idx][4]) {\n openlist[idx][2] = JSON.parse(JSON.stringify(q[0]));\n openlist[idx][3] = JSON.parse(JSON.stringify(q[1]));\n openlist[idx][4] = g;\n openlist[idx][6] = g + openlist[idx][5];\n }\n continue;\n }\n // if neighbour is not already present in open or closed list, \n // then add it to the openlist\n if (idx == -1) {\n var h = heuristic(i, j);\n var f = g + h;\n var successor = [i, j, JSON.parse(JSON.stringify(q[0])), JSON.parse(JSON.stringify(q[1])), g, h, f];\n openlist.unshift(JSON.parse(JSON.stringify(successor)));\n }\n }\n }\n }\n }\n }\n\n // if path not found, output no solution\n if (!pathFound) {\n output.innerHTML = 'No Solution';\n }\n // else mark the solution path\n else {\n // removing the first point in closed list which is the start point\n closedlist.shift();\n // get the parent of last point into x and y\n var x = closedlist[closedlist.length - 1][0];\n var y = closedlist[closedlist.length - 1][1];\n for (var i = closedlist.length-1; i >= 0; i--) {\n node = JSON.parse(JSON.stringify(closedlist[i]))\n if (closedlist[i][0] == x && closedlist[i][1] == y) {\n // 1 at last index means this the solution path\n closedlist[i].push(1);\n // fetch its parent\n x = closedlist[i][2];\n y = closedlist[i][3];\n }\n else {\n // 0 means visited tile\n closedlist[i].push(0);\n }\n }\n \n // set states to tiles for coloring them\n for (var x = 0; x < closedlist.length; x++) {\n if (closedlist[x][7] == 1) {\n tiles[closedlist[x][0]][closedlist[x][1]].state = 'x';\n }\n else if (closedlist[x][7] == 0) {\n tiles[closedlist[x][0]][closedlist[x][1]].state = 'v';\n }\n // sleep for 100ms\n await new Promise(r => setTimeout(r, 100));\n }\n // recolor the start and finish point just in case\n tiles[0][0].state = 's';\n tiles[tileColumnCount - 1][tileRowCount - 1].state = 'f';\n\n output.innerHTML = 'Solved!';\n }\n}", "function drawMaze(maze, cell, canvas){\n if (canvas.getContext) {\n var ctx = canvas.getContext('2d');\n\n var corners = maze.getCorners();\n var x0 = corners[0][0];\n var y0 = corners[0][1];\n var x1 = corners[1][0];\n var y1 = corners[1][1];\n var height = x1 - x0;\n var width = y1 - y0;\n var mazeSize = (height > width ? height : width);\n var BORDER = 10;\n // Cell size in pixels, 10 pixel border, add 1 b/c 0 indexed\n var cellSize = Math.floor((canvas.width - BORDER) / (mazeSize));\n var wall_width = Math.floor(cellSize/20);\n if (wall_width === 0) {\n wall_width = 1;\n }\n var yOffset = (mazeSize === width ? BORDER / 2\n : Math.floor(((height - width) * cellSize + BORDER)/2));\n var xOffset = (mazeSize === height ? BORDER / 2\n : Math.floor(((width - height) * cellSize + BORDER)/2));\n // Cheat by using a global, hackish\n mazeClickInfo.cellSize = cellSize;\n mazeClickInfo.xOffset = xOffset;\n mazeClickInfo.yOffset = yOffset;\n mazeClickInfo.x0 = x0;\n mazeClickInfo.y0 = y0;\n mazeClickInfo.cell = cell;\n\n // Draw grey for unexplored cells, white for explored\n var drawCell = function(x, y) {\n x = (x - x0) * cellSize + xOffset;\n y = (y - y0) * cellSize + yOffset;\n ctx.fillRect (y, x, cellSize, cellSize);\n };\n\n // Draw explored areas\n for (var x = x0; x < x1; x++) {\n for (var y = y0; y < y1; y++) {\n if (maze.isExplored(x,y)) {\n ctx.fillStyle = \"rgb(255,255,255)\";\n } else {\n ctx.fillStyle = \"rgb(200,200,200)\";\n }\n drawCell(x, y);\n }\n }\n\n // Draw wall to right of cell\n var drawVertWall = function (x, y) {\n x = (x - x0) * cellSize + xOffset - wall_width/2;\n y = (y - y0 + 1) * cellSize + yOffset - wall_width/2;\n ctx.fillRect(y, x, wall_width, cellSize + wall_width);\n };\n\n // Draw wall at bottom of cell\n var drawHorizWall = function(x, y) {\n x = (x - x0 + 1) * cellSize + xOffset - wall_width/2;\n y = (y - y0) * cellSize + yOffset - wall_width/2;\n ctx.fillRect(y, x, cellSize + wall_width, wall_width);\n };\n\n ctx.fillStyle = \"rgb(0,0,0)\";\n // Draw left side\n for (var x = x0; x < x1; x++) {\n if (maze.isWall(x,y0-1,x,y0)) {\n drawVertWall(x, y0-1);\n }\n }\n // Draw top\n for (var y = y0; y < y1; y++) {\n if (maze.isWall(x0-1,y,x0,y)) {\n drawHorizWall(x0-1, y)\n }\n }\n // Draw the rest\n for (var x = x0; x < x1; x++) {\n for (var y = y0; y < y1; y++) {\n if (maze.isWall(x,y,x,y+1)) {\n drawVertWall(x,y);\n }\n if (maze.isWall(x,y,x+1,y)) {\n drawHorizWall(x, y);\n }\n }\n }\n\n var drawTriangle = function(x,y,dir) {\n x = (x - x0) * cellSize + xOffset;\n y = (y - y0) * cellSize + yOffset;\n // Translate canvas to center, rotate to correct angle, then make triangle\n ctx.translate(y + cellSize/2, x + cellSize/2);\n ctx.scale(cellSize, cellSize);\n ctx.rotate(-dir*Math.PI/2)\n ctx.beginPath();\n ctx.moveTo(-1/4,1/3);\n ctx.lineTo(0,-1/3);\n ctx.lineTo(1/4,1/3);\n ctx.fill();\n ctx.rotate(dir*Math.PI/2)\n ctx.scale(1/cellSize, 1/cellSize);\n ctx.translate(-y - cellSize/2, -x - cellSize/2)\n }\n if (cell) {\n ctx.fillStyle = \"rgb(255,0,0)\";\n var data = cell.getData();\n drawTriangle(data[0],data[1],data[2]);\n }\n }\n}", "function buildMaze() {\n\tconsole.log(\"buildMaze enter\"); \n\tvar a = new Array();\n\tfor(x=0; x<600; x+=10) {\n\t\tfor(y=0; y<600; y+=10) {\n\t\t\tvar cell = new Cell(x,y);\n\t\t\tvar id = x+\":\"+y;\n\t\t\ta[id]=cell;\n\t\t\t\n\t\t}\n\t}\n\tconsole.log(\"buildMaze exit\");\n\treturn a;\n}", "mazeGeneration(grid){\n for (let row = 0; row < 23; row++) {\n for (let col = 0; col < 57; col++) {\n if((row+col)%2===0){\n const newGrid = getNewGridWithWallToggled(this.state.grid, row, col);\n this.setState({grid: newGrid, mouseIsPressed: false});\n }\n }\n }\n this.DFS(grid,START_NODE_ROW,START_NODE_COL);\n for (let row = 0; row < 23; row++) {\n for (let col = 0; col < 57; col++) {\n if((row+col)%2===1){\n grid[row][col].isVisited=false;\n }\n }\n }\n\n }", "function drawMaze(maze, svg, cellSize){\n\n var size = {\n width : maze[0].length,\n height : maze.length\n };\n\n // scale svg\n svg.attr(\"width\", size.width*cellSize).attr(\"height\", size.height*cellSize);\n\n for(var i = 0; i < size.height;i++){\n for(var j = 0; j < size.width;j++){\n // draw a rectangle for each maze cell\n var cell = svg.append(\"rect\").attr(\"x\", j*cellSize).attr(\"y\", i*cellSize).attr(\"width\", cellSize).attr(\"height\", cellSize);\n\n switch (maze[i][j]) {\n case cellTypes.empty:\n cell.style(\"fill\", \"white\");\n break;\n case cellTypes.start:\n cell.style(\"fill\", \"green\");\n break;\n case cellTypes.goal:\n cell.style(\"fill\", \"red\");\n break;\n case cellTypes.visited:\n cell.style(\"fill\", \"#888\");\n break;\n case cellTypes.path:\n cell.style(\"fill\", \"#888\");\n svg.append(\"circle\").attr(\"cx\", j*cellSize+(cellSize/2)).attr(\"cy\", i*cellSize+(cellSize/2)).attr(\"r\", cellSize/3).style(\"fill\", \"#333\");\n break;\n default:\n cell.style(\"fill\", \"#333\");\n break;\n }\n }\n }\n}", "function mazeGen() {\r\n let visited = [];\r\n let neighbours = [];\r\n let fcell = {\r\n x: Math.floor((Math.random() * w) / space) * space,\r\n y: Math.floor((Math.random() * h) / space) * space,\r\n };\r\n visited.push(fcell);\r\n let newNeighbours = genNeighbours(fcell, neighbours);\r\n neighbours = neighbours.concat(newNeighbours);\r\n let currCell;\r\n let visNeighbours = [];\r\n let joinCell;\r\n while (neighbours.length > 0) {\r\n currCell = neighbours.splice(mazeRand(neighbours.length), 1)[0];\r\n newNeighbours = genNeighbours(currCell, neighbours);\r\n visNeighbours = [];\r\n //cannot use filter as unfiltered needs to be pushed in separate array\r\n newNeighbours.forEach((element) => {\r\n if (visited.some((e) => e.x === element.x && e.y === element.y))\r\n visNeighbours.push(element);\r\n else neighbours.push(element);\r\n });\r\n joinCell = visNeighbours[mazeRand(visNeighbours.length)];\r\n visited.push(currCell);\r\n breakWalls(currCell, joinCell);\r\n }\r\n}", "function inkyMove() {\n if (maze[inky.y-1][inky.x] ==12) {\n maze[inky.y][inky.x] = 12;\n inky.y = 11;\n maze[inky.y][inky.x] = 10;\n } else if (directionI <= 2.5) {\n if (maze[inky.y][inky.x-1] ==5) {\n maze[inky.y][inky.x] = 2;\n inky.x = inky.x - 1;\n maze[inky.y][inky.x] = 10;\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n } else if (maze[inky.y][inky.x-1] ==6) {\n maze[inky.y][inky.x] = 2;\n inky.x = 26;\n maze[inky.y][inky.x] = 10;\n } else if (maze[inky.y][inky.x-1] ==1) {\n maze[inky.y][inky.x] = 10;\n directionI = Math.random() * 10;\n } else if (maze[inky.y][inky.x-1] !==1) {\n maze[inky.y][inky.x] = 2;\n inky.x = inky.x - 1;\n maze[inky.y][inky.x] = 10;\n }\n } else if (directionI > 2.5 && directionI <= 5) {\n if (maze[inky.y-1][inky.x] ==5) {\n maze[inky.y][inky.x] = 2;\n inky.y = inky.y - 1;\n maze[inky.y][inky.x] = 10;\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n } else if (maze[inky.y-1][inky.x] ==1) {\n maze[inky.y][inky.x] = 10;\n directionI = Math.random() * 10;\n } else if (maze[inky.y-1][inky.x] !==1) {\n maze[inky.y][inky.x] = 2;\n inky.y = inky.y - 1;\n maze[inky.y][inky.x] = 10;\n }\n } else if (directionI > 5 && directionI <= 7.5) {\n if (maze[inky.y][inky.x+1] ==5) {\n maze[inky.y][inky.x] = 2;\n inky.x = inky.x + 1;\n maze[inky.y][inky.x] = 10;\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n } else if (maze[inky.y][inky.x+1] ==6) {\n maze[inky.y][inky.x] = 2;\n inky.x = 1;\n maze[inky.y][inky.x] = 10;\n } else if (maze[inky.y][inky.x+1] ==1) {\n maze[inky.y][inky.x] = 10;\n directionI = Math.random() * 10;\n } else if (maze[inky.y][inky.x+1] !==1) {\n maze[inky.y][inky.x] = 2;\n inky.x = inky.x + 1;\n maze[inky.y][inky.x] = 10;\n }\n } else if (directionI > 7.5) {\n if (maze[inky.y+1][inky.x] ==5) {\n maze[inky.y][inky.x] = 2;\n inky.y = inky.y + 1;\n maze[inky.y][inky.x] = 10;\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n } else if (maze[inky.y+1][inky.x] ==4) {\n maze[inky.y][inky.x] = 10;\n directionI = Math.random() * 10;\n } else if (maze[inky.y+1][inky.x] ==1) {\n maze[inky.y][inky.x] = 10;\n directionI = Math.random() * 10;\n } else if (maze[inky.y+1][inky.x] !==1) {\n maze[inky.y][inky.x] = 2;\n inky.y = inky.y + 1;\n maze[inky.y][inky.x] = 10;\n }\n }\n }", "refreshMaze() {\n let maze = [];\n for (let i = 0; i < 20; i++) {\n let row = [];\n for (let j = 0; j < 40; j++) {\n row.push(0);\n }\n maze.push(row);\n }\n for (let i = 0; i < snake.body.length; i++) {\n maze[this.snake.body[i].y][this.snake.body[i].x] = -1;\n }\n const head_position = this.snake.getHeadPosition();\n const tail_position = this.snake.getTailPosition();\n maze[head_position.y][head_position.x] = 1;\n maze[tail_position.y][tail_position.x] = 2;\n return maze;\n }", "generateMaze(){\n // Pop a cell from the stack and make it a current cell\n this.currentCell = this.S.pop();\n\n // If the current cell has any neighbours which have not been visite\n let randomNeighbour = this.getRandomNonVisitedNeighbour(this.currentCell.i, this.currentCell.j);\n if(randomNeighbour){\n \n // Push the current cell to the stack\n this.S.push(this.currentCell);\n\n // Remove the wall between the current cell and the chosen cell\n this.currentCell.removeWallBetween(randomNeighbour);\n\n // Mark the chosen cell as visited and push it to the stack\n randomNeighbour.visit();\n this.S.push(randomNeighbour);\n\n // Keep track of visited cells\n this.unvisitedCellsCounter--;\n }\n }", "function solveMaze(mazeimg, mazeSolveImg, locations, startlocation) {\n var start = locations[startlocation];\n var end = locations[(startlocation + 1) % 2];\n\n var backtrack = {};\n\n var pixelstack = [];\n pixelstack.push(start);\n while (pixelstack.length != 0) {\n var nextpoint;\n var curpoint = pixelstack.shift();\n\n if (curpoint.x == end.x && curpoint.y == end.y) {\n console.log(\"end found\");\n //draw line from start to end\n while (backtrack[key(curpoint)] !== undefined) {\n curpoint = backtrack[key(curpoint)];\n mazeSolveImg.setPixelColor(blueColor, curpoint.x, curpoint.y);\n }\n return;\n }\n //mark this pixel as used\n mazeimg.setPixelColor(greenColor, curpoint.x, curpoint.y);\n\n //move right\n if (curpoint.x + 1 < mazeimg.bitmap.width) { //dont go off the edge of the image\n nextpoint = { x: curpoint.x + 1, y: curpoint.y };\n handlePixel(mazeimg, curpoint, nextpoint, backtrack, pixelstack);\n }\n\n //move left\n if (curpoint.x - 1 > 0) { //dont go off the edge of the image\n nextpoint = { x: curpoint.x - 1, y: curpoint.y };\n handlePixel(mazeimg, curpoint, nextpoint, backtrack, pixelstack);\n }\n\n //move up\n if (curpoint.y + 1 < mazeimg.bitmap.height) { //dont go off the edge of the image\n nextpoint = { x: curpoint.x, y: curpoint.y + 1 };\n handlePixel(mazeimg, curpoint, nextpoint, backtrack, pixelstack);\n }\n\n //move down\n if (curpoint.y - 1 >= 0) { //dont go off the edge of the image\n nextpoint = { x: curpoint.x, y: curpoint.y - 1 };\n handlePixel(mazeimg, curpoint, nextpoint, backtrack, pixelstack);\n }\n }\n}", "function findPath(world, pathStart, pathEnd)\n\n{\n\n// shortcuts for speed\n\nvar\n\nabs = Math.abs;\n\nvar\n\nmax = Math.max;\n\nvar\n\npow = Math.pow;\n\nvar\n\nsqrt = Math.sqrt;\n\n\n// the world data are integers:\n\n// anything higher than this number is considered blocked\n\n// this is handy is you use numbered sprites, more than one\n\n// of which is walkable road, grass, mud, etc\n\nvar maxWalkableTileNum = 0;\n\n\n// keep track of the world dimensions\n\n // Note that this A-star implementation expects the world array to be square:\n\n// it must have equal height and width. If your game world is rectangular,\n\n// just fill the array with dummy values to pad the empty space.\n\nvar worldWidth = world[0].length;\n\nvar worldHeight = world.length;\n\nvar worldSize =\n\nworldWidth * worldHeight;\n\n\n// which heuristic should we use?\n\n// default: no diagonals (Manhattan)\n\nvar distanceFunction = ManhattanDistance;\n\nvar findNeighbours = function(){}; // empty\n\n\n\n// alternate heuristics, depending on your game:\n\n\n// diagonals allowed but no sqeezing through cracks:\n\nvar distanceFunction = DiagonalDistance;\n\nvar findNeighbours = DiagonalNeighbours;\n\n\n\n\n/*\n\n// diagonals and squeezing through cracks allowed:\n\nvar distanceFunction = DiagonalDistance;\n\nvar findNeighbours = DiagonalNeighboursFree;\n\n\n// euclidean but no squeezing through cracks:\n\nvar distanceFunction = EuclideanDistance;\n\nvar findNeighbours = DiagonalNeighbours;\n\n\n// euclidean and squeezing through cracks allowed:\n\nvar distanceFunction = EuclideanDistance;\n\nvar findNeighbours = DiagonalNeighboursFree;\n\n\n*/\n\n\n// distanceFunction functions\n\n// these return how far away a point is to another\n\n\nfunction ManhattanDistance(Point, Goal)\n\n{\n\n// linear movement - no diagonals - just cardinal directions (NSEW)\n\nreturn abs(Point.x - Goal.x) + abs(Point.y - Goal.y);\n\n}\n\n\nfunction DiagonalDistance(Point, Goal)\n\n{\n\n// diagonal movement - assumes diag dist is 1, same as cardinals\n\nreturn max(abs(Point.x - Goal.x), abs(Point.y - Goal.y));\n\n}\n\n\nfunction EuclideanDistance(Point, Goal)\n\n{\n\n// diagonals are considered a little farther than cardinal directions\n\n// diagonal movement using Euclide (AC = sqrt(AB^2 + BC^2))\n\n// where AB = x2 - x1 and BC = y2 - y1 and AC will be [x3, y3]\n\nreturn sqrt(pow(Point.x - Goal.x, 2) + pow(Point.y - Goal.y, 2));\n\n}\n\n\n// Neighbours functions, used by findNeighbours function\n\n// to locate adjacent available cells that aren't blocked\n\n\n// Returns every available North, South, East or West\n\n// cell that is empty. No diagonals,\n\n// unless distanceFunction function is not Manhattan\n\nfunction Neighbours(x, y)\n\n{\n\nvar\n\nN = y - 1,\n\nS = y + 1,\n\nE = x + 1,\n\nW = x - 1,\n\nmyN = N > -1 && canWalkHere(x, N),\n\nmyS = S < worldHeight && canWalkHere(x, S),\n\nmyE = E < worldWidth && canWalkHere(E, y),\n\nmyW = W > -1 && canWalkHere(W, y),\n\nresult = [];\n\nif(myN)\n\nresult.push({x:x, y:N});\n\nif(myE)\n\nresult.push({x:E, y:y});\n\nif(myS)\n\nresult.push({x:x, y:S});\n\nif(myW)\n\nresult.push({x:W, y:y});\n\nfindNeighbours(myN, myS, myE, myW, N, S, E, W, result);\n\nreturn result;\n\n}\n\n\n// returns every available North East, South East,\n\n// South West or North West cell - no squeezing through\n\n// \"cracks\" between two diagonals\n\nfunction DiagonalNeighbours(myN, myS, myE, myW, N, S, E, W, result)\n\n{\n\nif(myN)\n\n{\n\nif(myE && canWalkHere(E, N))\n\nresult.push({x:E, y:N});\n\nif(myW && canWalkHere(W, N))\n\nresult.push({x:W, y:N});\n\n}\n\nif(myS)\n\n{\n\nif(myE && canWalkHere(E, S))\n\nresult.push({x:E, y:S});\n\nif(myW && canWalkHere(W, S))\n\nresult.push({x:W, y:S});\n\n}\n\n}\n\n\n// returns every available North East, South East,\n\n// South West or North West cell including the times that\n\n// you would be squeezing through a \"crack\"\n\nfunction DiagonalNeighboursFree(myN, myS, myE, myW, N, S, E, W, result)\n\n{\n\nmyN = N > -1;\n\nmyS = S < worldHeight;\n\nmyE = E < worldWidth;\n\nmyW = W > -1;\n\nif(myE)\n\n{\n\nif(myN && canWalkHere(E, N))\n\nresult.push({x:E, y:N});\n\nif(myS && canWalkHere(E, S))\n\nresult.push({x:E, y:S});\n\n}\n\nif(myW)\n\n{\n\nif(myN && canWalkHere(W, N))\n\nresult.push({x:W, y:N});\n\nif(myS && canWalkHere(W, S))\n\nresult.push({x:W, y:S});\n\n}\n\n}\n\n\n// returns boolean value (world cell is available and open)\n\nfunction canWalkHere(x, y)\n\n{\n\nreturn ((world[x] != null) &&\n\n(world[x][y] != null) &&\n\n(world[x][y] <= maxWalkableTileNum));\n\n};\n\n\n// Node function, returns a new object with Node properties\n\n// Used in the calculatePath function to store route costs, etc.\n\nfunction Node(Parent, Point)\n\n{\n\nvar newNode = {\n\n// pointer to another Node object\n\nParent:Parent,\n\n// array index of this Node in the world linear array\n\nvalue:Point.x + (Point.y * worldWidth),\n\n// the location coordinates of this Node\n\nx:Point.x,\n\ny:Point.y,\n\n// the heuristic estimated cost\n\n// of an entire path using this node\n\nf:0,\n\n// the distanceFunction cost to get\n\n// from the starting point to this node\n\ng:0\n\n};\n\n\nreturn newNode;\n\n}\n\n\n// Path function, executes AStar algorithm operations\n\nfunction calculatePath()\n\n{\n\n// create Nodes from the Start and End x,y coordinates\n\nvar\n\nmypathStart = Node(null, {x:pathStart[0], y:pathStart[1]});\n\nvar mypathEnd = Node(null, {x:pathEnd[0], y:pathEnd[1]});\n\n// create an array that will contain all world cells\n\nvar AStar = new Array(worldSize);\n\n// list of currently open Nodes\n\nvar Open = [mypathStart];\n\n// list of closed Nodes\n\nvar Closed = [];\n\n// list of the final output array\n\nvar result = [];\n\n// reference to a Node (that is nearby)\n\nvar myNeighbours;\n\n// reference to a Node (that we are considering now)\n\nvar myNode;\n\n// reference to a Node (that starts a path in question)\n\nvar myPath;\n\n// temp integer variables used in the calculations\n\nvar length, max, min, i, j;\n\n// iterate through the open list until none are left\n\nwhile(length = Open.length)\n\n{\n\nmax = worldSize;\n\nmin = -1;\n\nfor(i = 0; i < length; i++)\n\n{\n\nif(Open[i].f < max)\n\n{\n\nmax = Open[i].f;\n\nmin = i;\n\n}\n\n}\n\n// grab the next node and remove it from Open array\n\nmyNode = Open.splice(min, 1)[0];\n\n// is it the destination node?\n\nif(myNode.value === mypathEnd.value)\n\n{\n\nmyPath = Closed[Closed.push(myNode) - 1];\n\ndo\n\n{\n\nresult.push([myPath.x, myPath.y]);\n\n}\n\nwhile (myPath = myPath.Parent);\n\n// clear the working arrays\n\nAStar = Closed = Open = [];\n\n// we want to return start to finish\n\nresult.reverse();\n\n}\n\nelse // not the destination\n\n{\n\n// find which nearby nodes are walkable\n\nmyNeighbours = Neighbours(myNode.x, myNode.y);\n\n// test each one that hasn't been tried already\n\nfor(i = 0, j = myNeighbours.length; i < j; i++)\n\n{\n\nmyPath = Node(myNode, myNeighbours[i]);\n\nif (!AStar[myPath.value])\n\n{\n\n// estimated cost of this particular route so far\n\nmyPath.g = myNode.g + distanceFunction(myNeighbours[i], myNode);\n\n// estimated cost of entire guessed route to the destination\n\nmyPath.f = myPath.g + distanceFunction(myNeighbours[i], mypathEnd);\n\n// remember this new path for testing above\n\nOpen.push(myPath);\n\n// mark this node in the world graph as visited\n\nAStar[myPath.value] = true;\n\n}\n\n}\n\n// remember this route as having no more untested options\n\nClosed.push(myNode);\n\n}\n\n} // keep iterating until the Open list is empty\n\nreturn result;\n\n}\n\n\n// actually calculate the a-star path!\n\n// this returns an array of coordinates\n\n// that is empty if no path is possible\n\nreturn calculatePath();\n\n\n\n\n} // end of findPath() function", "createMaze (tree) {\n\t\tthis.graph[tree.x + ',' + tree.y] = tree;\n\n\t\ttree.directions = shuffle(directions);\n\n\t\twhile (tree.directions.length > 0) {\n\t\t\tlet move = tree.directions.pop();\n\t\t\tlet next = {};\n\t\t\tnext.x = tree.x + move[0];\n\t\t\tnext.y = tree.y + move[1];\n\n\t\t\tif (next.x >= 0 && next.x < this.length\n && next.y >= 0 && next.y < this.height\n && !this.graph.hasOwnProperty(next.x + ',' + next.y) ) {\n\n\t\t\t\tlet nextTree = new Tree(next.x, next.y);\n\t\t\t\tnextTree.children[tree.x + ',' + tree.y] = tree;\n\t\t\t\ttree.children[next.x + ',' + next.y] = nextTree;\n\n\t\t\t\tthis.createMaze(nextTree);\n\t\t\t}\n\t\t}\n\t}", "function solveMaze(maze, x, y, solution) {\n const left = maze[y][x - 1];\n const right = maze[y][x + 1];\n const up = maze[y - 1] ? maze[y - 1][x] : undefined;\n const down = maze[y + 1] ? maze[y + 1][x] : undefined;\n\n if (left === 'e' || right === 'e' || up === 'e' || down === 'e') {\n console.log(solution);\n }\n\n if (left === ' ') {\n maze[y][x] = '*';\n solution += 'L';\n return solveMaze(maze, x - 1, y, solution);\n }\n if (right === ' ') {\n maze[y][x] = '*';\n solution += 'R';\n return solveMaze(maze, x + 1, y, solution);\n }\n if (up === ' ') {\n maze[y][x] = '*';\n solution += 'U';\n return solveMaze(maze, x, y - 1, solution);\n }\n if (down === ' ') {\n maze[y][x] = '*';\n solution += 'D';\n return solveMaze(maze, x, y + 1, solution);\n }\n}", "function drawMazeIntoCanvas(grid) {\n var tileSize = PROCEDURAL_MAZE.config.tileSize;\n var directions = PROCEDURAL_MAZE.config.directions;\n var wallsWidth = PROCEDURAL_MAZE.config.wallsWidth;\n\n var width = grid[0].length;\n var height = grid.length;\n\n for (var i = 0; i < width; i++) {\n for (var j = 0; j < height; j++) {\n var cell = new createjs.Container();\n cell.x = i * tileSize;\n cell.y = j * tileSize;\n\n var wall = null;\n\n if ((grid[j][i] & directions.north) === 0) {\n wall = new createjs.Shape();\n\n wall.graphics\n .setStrokeStyle(wallsWidth)\n .beginStroke(\"#000000\")\n .moveTo(0, 0)\n .lineTo(tileSize, 0)\n .endStroke();\n\n cell.addChild(wall);\n }\n\n if ((grid[j][i] & directions.east) === 0) {\n wall = new createjs.Shape();\n\n wall.graphics\n .setStrokeStyle(wallsWidth)\n .beginStroke(\"#000000\")\n .moveTo(tileSize, 0)\n .lineTo(tileSize, tileSize)\n .endStroke();\n\n cell.addChild(wall);\n }\n\n if ((grid[j][i] & directions.south) === 0) {\n wall = new createjs.Shape();\n\n wall.graphics\n .setStrokeStyle(wallsWidth)\n .beginStroke(\"#000000\")\n .moveTo(0, tileSize)\n .lineTo(tileSize, tileSize)\n .endStroke();\n\n cell.addChild(wall);\n }\n\n if ((grid[j][i] & directions.west) === 0) {\n wall = new createjs.Shape();\n\n wall.graphics\n .setStrokeStyle(wallsWidth)\n .beginStroke(\"#000000\")\n .moveTo(0, 0)\n .lineTo(0, tileSize)\n .endStroke();\n\n cell.addChild(wall);\n }\n\n stage.addChild(cell);\n }\n }\n\n stage.update();\n}", "function\ninit_maze(w1, h1)\n{\n var i, j, vedges, hedges;\n var x, y, t, inc, xoff, yoff;\n\n vedges = (w1-1)*h1; /* number of vertical edges */\n hedges = (h1-1)*w1; /* number of horizontal edges */\n redges = edges = vedges + hedges; /* number of removable edges */\n perimeters = 2*w1 + 2*h1;\n vertices = (w1+1)*(h1+1);\n groups = w1*h1;\n\n /* allocate edge array */\n edge = []\n for(i = 0; i < edges; i++)\n edge.push(new Edge())\n\n /* fill in the vertical edges */\n for (i=0; i<vedges; i++) {\n x = Math.floor(i%(w1-1)); /* convert edge number to column */\n y = Math.floor(i/(w1-1)); /* and row */\n j = Math.floor(y*w1 + x); /* convert to cell number */\n edge[i].cell1 = j;\n edge[i].cell2 = j+1;\n edge[i].vertex1 = Math.floor(y*(w1+1) + x+1); /* convert to vertex number */\n edge[i].vertex2 = Math.floor((y+1)*(w1+1) + x+1);\n edge[i].valid = true;\n edge[i].draw = true;\n }\n for (i=vedges; i<edges; i++) {\n j = Math.floor(i - vedges); /* convert to cell number */\n x = Math.floor(j%w1); /* convert edge number to column */\n y = Math.floor(j/w1); /* and row*/\n edge[i].cell1 = j;\n edge[i].cell2 = j + w1;\n edge[i].vertex1 = Math.floor((y+1)*(w1+1) + x); /* convert to vertex number */\n edge[i].vertex2 = Math.floor((y+1)*(w1+1) + x+1);\n edge[i].valid = true;\n edge[i].draw = true;\n }\n\n /* allocate perimeter */\n perimeter = []\n for(var i = 0; i < perimeters; i++)\n perimeter.push(new Edge())\n\n /* fill in horizontal perimeter */\n for (i=0; i<w1; i++) {\n perimeter[2*i].cell1 = i;\n perimeter[2*i].cell2 = i;\n perimeter[2*i].vertex1 = i;\n perimeter[2*i].vertex2 = i + 1;\n perimeter[2*i].valid = true;\n perimeter[2*i].draw = true;\n perimeter[2*i+1].cell1 = Math.floor(i + h1*w1);\n perimeter[2*i+1].cell2 = Math.floor(i + h1*w1);\n perimeter[2*i+1].vertex1 = Math.floor(i + h1*(w1+1));\n perimeter[2*i+1].vertex2 = Math.floor(i + h1*(w1+1) + 1);\n perimeter[2*i+1].valid = true;\n perimeter[2*i+1].draw = true;\n }\n /* fill in vertical perimeter */\n for (i=w1; i<w1+h1; i++) {\n j = i-w1;\n perimeter[2*i].cell1 = Math.floor(j*w1);\n perimeter[2*i].cell2 = Math.floor(j*w1);\n perimeter[2*i].vertex1 = j*(w1+1);\n perimeter[2*i].vertex2 = (j+1)*(w1+1);\n perimeter[2*i].valid = true;\n perimeter[2*i].draw = true;\n perimeter[2*i+1].cell1 = Math.floor((j+1)*w1 - 1);\n perimeter[2*i+1].cell2 = Math.floor((j+1)*w1 - 1);\n perimeter[2*i+1].vertex1 = Math.floor((j+1)*(w1+1) - 1);\n perimeter[2*i+1].vertex2 = Math.floor((j+2)*(w1+1) - 1);\n perimeter[2*i+1].valid = true;\n perimeter[2*i+1].draw = true;\n }\n\n //Verticies handled on a per-object basis, no need to generate vertexes as the maze is built. Generated here for debug only.\n /* allocate vertex array */\n vertex = []\n for(var i = 0; i < vertices; i++)\n vertex.push(vec2())\n\n /* figure out the spacing between vertex coordinates. we want\n square cells so use the minimum spacing */\n inc = (3.6/w1)*10;\n t = (3.6/h1)*10;\n if (t < inc) {\n inc = t;\n }\n /* determine the required offsets to center the maze using the\n spacing calculated above */\n xoff = Math.floor((4.0-w1*inc)/2 - 2.0);\n yoff = Math.floor((4.0-h1*inc)/2 - 2.0);\n /* fill in the vertex array */\n for (i=0; i<vertices; i++) {\n x = Math.floor(i%(w1+1));\n y = Math.floor(i/(w1+1));\n vertex[i][0] = x*inc + xoff;\n vertex[i][1] = y*inc + yoff;\n }\n\n /* allocate the group table */\n group = []\n\n /* set the group table to the identity */\n for (i=0; i<groups; i++) {\n group[i] = i;\n }\n}", "function maze_AldousBroder(mazeTable, maxColumns, maxRows) {\r\n var northRow = maxRows - 1;\r\n var eastColumn = maxColumns - 1;\r\n var cellCount = maxColumns * maxRows;\r\n var visitedCells = 1;\r\n\r\n var i = randomRun(maxRows) - 1; // starting cell row\r\n var x = randomRun(maxColumns) - 1; // starting cell column\r\n var cell = $(\"#\" + mazeTable + \" td[data-row='\" + i + \"'][data-col='\" + x +\"']\");\r\n var nextCell;\r\n\r\n var moves = 4;\r\n var move = 0;\r\n var direction;\r\n\r\n var visited = false;\r\n var canMoveUp = true;\r\n var canMoveDown = true;\r\n var canMoveRight = true;\r\n var canMoveLeft = true;\r\n\r\n\r\n while(visitedCells < cellCount) {\r\n // determine where we can move\r\n if(0 == i) { canMoveDown = false;moves-=1;} // can't move down\r\n if(0 == x) { canMoveLeft = false;moves-=1;} // can't move left\r\n if(northRow == i) { canMoveUp = false;moves-=1;} // can't move up\r\n if(eastColumn == x) { canMoveRight = false;moves-=1;} //can't move right\r\n \r\n //mark the current cell as visited if it's not already visited\r\n $(cell).attr(\"data-visited\", \"true\");\r\n \r\n // this should be an impossible situation, but still worth checking\r\n if(moves > 0) {\r\n move = randomRun(moves);\r\n switch(move) {\r\n case 1: \r\n if(canMoveUp) { i += 1;direction=\"up\";} else { i-=1;direction=\"down\";}; break;\r\n case 3: \r\n if(canMoveDown) { i -= 1;direction=\"down\";} else { i+=1;direction=\"up\";}; break;\r\n case 2: \r\n if(canMoveRight) { x += 1;direction=\"right\";} else { x-=1;direction=\"left\";}; break;\r\n case 4: \r\n if(canMoveLeft) { x -= 1;direction=\"left\";} else { x+=1;direction=\"right\";}; break;\r\n } \r\n \r\n nextCell = $(\"#\" + mazeTable + \" td[data-row='\" + i + \"'][data-col='\" + x +\"']\");\r\n \r\n if($(nextCell).attr(\"data-visited\") != \"true\") {\r\n //okay, we haven't visited the next cell so we need to knock down the borders\r\n visitedCells += 1;\r\n switch(direction) {\r\n case \"up\":\r\n $(cell).css(\"border-top\", \"none\");\r\n $(nextCell).css(\"border-bottom\", \"none\");\r\n break;\r\n case \"down\":\r\n $(cell).css(\"border-bottom\", \"none\");\r\n $(nextCell).css(\"border-top\", \"none\");\r\n break;\r\n case \"right\":\r\n $(cell).css(\"border-right\", \"none\");\r\n $(nextCell).css(\"border-left\", \"none\");\r\n break;\r\n case \"left\":\r\n $(cell).css(\"border-left\", \"none\");\r\n $(nextCell).css(\"border-right\", \"none\");\r\n break;\r\n }\r\n }\r\n //move the active cell to the next cell\r\n cell = nextCell;\r\n }\r\n\r\n //reset variables for the next time through\r\n moves = 4;\r\n canMoveUp = true;\r\n canMoveDown = true;\r\n canMoveRight = true;\r\n canMoveLeft = true;\r\n }; \r\n}", "runMaze() {\n const start = [this.startNode.row, this.startNode.column];\n const stack = [start];\n const visited = {};\n const mazeList = [];\n this.dfs(stack, visited, mazeList);\n // removes first and last for frontend purposes\n mazeList.shift();\n mazeList.pop();\n return mazeList;\n }", "function exploreMaze(unexplored){\n // A fairly standard pathfinder, we have a list of all locations we haven't explored, a queue of locations we know a path to, and a list of locations we've fully explored.\n let explored = [];\n let fullMap = JSON.parse(JSON.stringify(unexplored));\n // Sometimes not every tile is reachable from our starting point, we could have isolated subgraphs called components - this is to track them.\n let components = -1;\n\n // While unexplored still has nodes\n while (Object.keys(unexplored).length > 0) {\n // Pick a starting point\n var keys = Object.keys(unexplored);\n let key = keys[0];\n // If this while loop runs a second time, it means we explored everythhing we could reach from our starting point, but still have tiles we know we haven't actually reached - other components.\n components += 1;\n // Push a sublist onto explored to represent this component.\n explored.push([]);\n\n // Start exploring!\n let toExplore = [key];\n delete unexplored[key];\n \n // As long as we know more spots we can reach\n while (toExplore.length > 0){\n\n let currLoc = toExplore[0];\n for (var i = 0; i <= 3; i++){\n // IF (there is a path) AND (that path leads somewhere we're not already planning to go) AND (that path leads somewhere we haven't already gone)\n if (fullMap[currLoc][1][i] && !(toExplore.includes(fullMap[currLoc][0][i])) && !(explored[components].includes(fullMap[currLoc][0][i]))){\n // We want to add that location to our explore list\n // Add new place to our queue\n toExplore.push(fullMap[currLoc][0][i]);\n // Remove from unexplored.\n delete unexplored[ fullMap[currLoc][0][i] ];\n } \n }\n // Add the node we just fully explored to our explored list.\n explored[components].push(currLoc);\n // And remove it from our queue\n toExplore.shift();\n }\n }\n // Whatever is left in unexplored is NOT connected to the starting point.\n return explored;\n}", "function findMazeCoordinates(event)\n{\n\t// Get coordinates of the click\n\tvar x = event.x;\n\tvar y = event.y;\n\n\tvar returnObject = new Object();\n\tvar generator = new Generator();\n\tvar adjustments = generator.getBlockSize();\n\tvar blockSize = adjustments.blockSize;\n\tvar canvas = generator.findCanvasProperties();\n\t// Convert to canvas coordinates using the canvas offset from the left and top of the screen.\n\tx = (x-canvas.offsetLeft)-adjustments.yOffset;\n \ty = (y-canvas.offsetTop)-adjustments.xOffset;\n \tvar mazePosX = Math.ceil(x/blockSize)-1;\n \tvar mazePosY = Math.ceil(y/blockSize)-1;\n\t//console.log(mazePosX);\n\t//console.log(mazePosY);\n\t//console.log(Maze[mazePosX][mazePosY]);\n\treturnObject.x = mazePosY;\n\treturnObject.y = mazePosX;\n\treturn returnObject;\n}", "function identifyValidTiles(nodeArray,exitNode){\n var depth = 0;\n index = exitNode;\n while(nodeArray[index].visited == false){\n depth +=1;\n for (i=0; i<nodeArray.length; i++){\n if (nodeArray[i].visited == true && nodeArray[i].distance == depth){\n if (nodeArray[i].id == exitNode){\n nodeArray[i].visited = true;\n }\n if (nodeArray[i].id == 0){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id); \n }\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id); \n }\n }\n if (nodeArray[i].id > 0 && nodeArray[i].id < maxRow-1){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id); \n }\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id); \n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id);\n }\n }\n if (nodeArray[i].id == maxRow-1){\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id); \n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id); \n }\n }\n if (nodeArray[i].id > 0 && nodeArray[i].id < (maxRow*maxRow-maxRow) && nodeArray[i].id %maxRow == 0){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id); \n }\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id); \n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id); \n }\n }\n if (nodeArray[i].id > maxRow-1 && nodeArray[i].id < (maxRow*maxRow-1) && (nodeArray[i].id+1) %maxRow == 0){\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id);\n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id); \n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id); \n }\n }\n if (nodeArray[i].id == maxRow*maxRow-maxRow){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id);\n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id); \n } \n }\n if (nodeArray[i].id > maxRow*maxRow-maxRow && nodeArray[i].id < maxRow*maxRow-1){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id);\n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id);\n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id);\n }\n }\n if (nodeArray[i].id == maxRow*maxRow-1){\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id);\n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id);\n } \n }\n if (nodeArray[i].id >maxRow-1 && nodeArray[i].id <maxRow*maxRow-maxRow && nodeArray[i].id %maxRow != 0 && (nodeArray[i].id+1)%maxRow != 0){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id);\n }\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id);\n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id); \n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id);\n } \n }\n } \n }\n} \n return nodeArray;\n}", "function walkMaze (cell, onCell, visited = {}) {\n if (visited[cell.id]) {\n return\n }\n\n onCell(cell);\n visited[cell.id] = true;\n\n Object.keys(cell.edges).forEach(id => {\n walkMaze(cell.edges[id].dst, onCell, visited);\n })\n }", "function generate_DFS(width, height) {\n var msize = width * height;\n\n //Typed Arrays in JS!\n var mazeData = new Uint8Array(msize);\n\n if (mazeData.byteLength != msize) {\n alert(\"Something horrible has happened during maze generation!\" +\n \"\\nYour browser probably doesn't support typed arrays.\");\n }\n\n //Set the initial state of the maze: everything is a wall, nothing is visited,\n //and all backtrack directions are 00 to easily mask them later.\n for (var i = 0; i < msize; i++) {\n mazeData[i] = 0xF0; //1111 0000\n }\n\n /**\n * Internal helper function to return a random neighboring cell ID which isn't\n * outside of the maze.\n *\n * @return The cell index of a random unvisited neighbor. -1 if none exist.\n */\n function getRandomUnvisitedNeighbor(where) {\n if (where < 0 || where >= msize) {\n alert(\"Neighbor index out of bounds: \" + where);\n return -1;\n }\n\n //Build a list of candidate neighbors. A neighbor is not a candidate if it\n //would be outside of the maze (border edge cases) or if it's visited.\n var candidates = [];\n\n //North\n if (where >= width) {\n if ((mazeData[where - width] & 0x02) == 0) {\n candidates.push(where - width);\n }\n }\n\n //South\n if (where + width < msize) {\n if ((mazeData[where + width] & 0x02) == 0) {\n candidates.push(where + width);\n }\n }\n\n //West\n if (where % width != 0) {\n if ((mazeData[where - 1] & 0x02) == 0) {\n candidates.push(where - 1);\n }\n }\n\n //East\n if ((where + 1) % width != 0) {\n if ((mazeData[where + 1] & 0x02) == 0) {\n candidates.push(where + 1);\n }\n }\n\n if (candidates.length == 0) {\n return -1;\n }\n\n return candidates[~~(Math.random() * candidates.length)];\n }\n\n /**\n * Because we store the backtrack direction in two bits, we need to be able to\n * get the cell ID of the neighbor we mean to backtrack to.\n *\n * @return the cell ID of where we arrive by travelling in `dir` from `whence`\n * where values for `dir` are 00 = N, 01 = E, 10 = W, 11 = S.\n */\n function getNeighbor(whence, dir) {\n if (whence < 0 || whence >= msize || dir < 0 || dir > 3) {\n alert(\"Internal argument error; dir: \" + dir + \"; whence: \" + whence);\n return -1;\n }\n\n //North\n if (dir == 0) {\n if (whence >= width) {\n return whence - width;\n } else {\n return -1;\n }\n }\n\n //South\n if (dir == 3) {\n if (whence + width < msize) {\n return whence + width;\n } else {\n return -1;\n }\n }\n\n //West\n if (dir == 2) {\n if (whence % width != 0) {\n return whence - 1;\n } else {\n return -1;\n }\n }\n\n //East\n if (dir == 1) {\n if ((whence + 1) % width != 0) {\n return whence + 1;\n } else {\n return -1;\n }\n }\n\n return -1;\n }\n\n //Pick a random cell to start from.\n var curCell = ~~(Math.random() * msize);\n mazeData[curCell] |= 0x03; //Home is both visited and the home cell.\n\n while (true) {\n //Pick an unvisited neighbor at random.\n var canCell = getRandomUnvisitedNeighbor(curCell);\n\n if (canCell == -1) {\n //This cell has no candidate neighbors, so backtrack from this cell, or\n //terminate if this is the home cell.\n if ((mazeData[curCell] & 0x01) == 1) {\n break;\n }\n\n curCell = getNeighbor(curCell, (mazeData[curCell] & 0x0C) >> 2);\n continue;\n }\n\n //Set new cell as visited.\n mazeData[canCell] |= 0x02;\n\n //See how we approached the new cell and demolish the appropriate walls.\n //Also, set the backtrack data on the candidate cell.\n switch (canCell - curCell) {\n case 1:\n //Went east\n mazeData[canCell] &= 0xDF;\n mazeData[curCell] &= 0xBF;\n\n //And should go back west\n mazeData[canCell] |= 0x08;\n break;\n case -1:\n //Went west\n mazeData[canCell] &= 0xBF;\n mazeData[curCell] &= 0xDF;\n\n //And should go back east\n mazeData[canCell] |= 0x04;\n break;\n case -width:\n //Went north\n mazeData[canCell] &= 0xEF;\n mazeData[curCell] &= 0x7F;\n\n //And should go back south\n mazeData[canCell] |= 0x0C;\n break;\n case width: //Went south\n mazeData[canCell] &= 0x7F;\n mazeData[curCell] &= 0xEF;\n\n //And should go back north\n mazeData[canCell] |= 0x00;\n break;\n }\n\n //Set the new cell as the current cell.\n curCell = canCell;\n }\n\n //Pick a random edge cell from which to knock out the exit, and also mark it\n //as \"non-visited\". Since we're done here, the visited bit doesn't matter and\n //since all other cells will be marked as visited, we can re-use it to\n //determine which cell is the exit ;)\n var rnd = ~~(Math.random() * 3);\n switch (rnd) {\n case 0:\n\n rnd = ~~(Math.random() * width);\n mazeData[rnd] &= 0x7D;\n break;\n case 1:\n\n rnd = ~~(Math.random() * height);\n mazeData[(rnd + 1) * width - 1] &= 0xBD;\n break;\n case 2:\n\n rnd = ~~(Math.random() * height);\n mazeData[rnd * width] &= 0xDD;\n break;\n case 3:\n\n rnd = ~~(Math.random() * width);\n mazeData[(height - 1) * width + rnd] &= 0xED;\n break;\n }\n\n return mazeData;\n}", "randomMazeGenerator(grid){\n for (let row = 0; row < 23; row++) {\n for (let col = 0; col < 57; col++) {\n if((row+col)%2===0){\n const newGrid = getNewGridWithWallToggled(this.state.grid, row, col);\n this.setState({grid: newGrid, mouseIsPressed: false});\n }\n }\n }\n this.DFS(grid,START_NODE_ROW,START_NODE_COL);\n for (let row = 0; row < 23; row++) {\n for (let col = 0; col < 57; col++) {\n if((row+col)%2===1){\n grid[row][col].isVisited=false;\n }\n }\n }\n for (let row = 0; row < 23; row++) {\n for (let col = 0; col < 57; col++) {\n if(((row===0 || col===0)||(row===22 || col===56))&&(grid[row][col].isWall===false)){\n const newGrid = getNewGridWithWallToggled(this.state.grid, row, col);\n this.setState({grid: newGrid, mouseIsPressed: false});\n }\n }\n }\n for (let col = 2; col < 55; col+=2){\n let row=1\n while(row<22) {\n let x=Math.ceil((22-row)*Math.random());\n if (x===21){\n x--;\n }\n while(x>0){\n const newGrid = getNewGridWithWallToggled(this.state.grid, row, col);\n this.setState({grid: newGrid, mouseIsPressed: false});\n row++;\n x--;\n }\n row++;\n }\n }\n }", "function mazeCheck(cell) {\r\n if (\r\n (cell.x % space === space - unit || cell.y % space === space - unit) &&\r\n !joinCellsX.some(\r\n (element) =>\r\n cell.x === element.x &&\r\n cell.y >= element.y &&\r\n cell.y < element.y + space - unit\r\n ) &&\r\n !joinCellsY.some(\r\n (element) =>\r\n cell.y === element.y &&\r\n cell.x >= element.x &&\r\n cell.x < element.x + space - unit\r\n )\r\n )\r\n return true;\r\n else return false;\r\n}", "function pathFinder(maze) {\n var map = maze.map(arr => arr.slice());\n var len = map.length;\n var neighArr = [[0, 0]];\n map[0][0] = 'T'; // travelled square\n\n do { // as long as there are new un-travelled squares\n neighArr = availNeigh(map);\n neighArr.forEach(pair => map[pair[0]][pair[1]] = 'T');\n } while (neighArr.length > 0);\n return map[len - 1][len - 1] === 'T' ? true : false;\n}", "function mazeBuilder(x,y) {\n\tthis.columns = x;\n\tthis.rows = y;\n\tthis.totalCells = this.columns * this.rows;\n\tthis.currentCell = [Math.floor(Math.random()*y), Math.floor(Math.random()*x)];\n\tthis.path = [];\n\tthis.maze = [];\n\tthis.numberVisited = 0;\n\tthis.unvisitedCells = [];\n}", "function generateBox([x, y],) {\n\n // ajout de la case courante à la liste des cases visitées\n myMaze.setVisited([x, y]);\n // établir la liste des cases voisines disponibles\n myMaze.findPossibleNeighbors(x, y);\n\n // tant qu'il y a des cases voisines disponibles\n while (myMaze.getBox(x, y).hasPossibleNeighbors()) {\n // choisir une case aléatoirement\n let choice = myMaze.getBox(x, y).chooseNeighbor();\n // calculer les coordonnées de la case intermédiaire\n let intermediate = findIntermediate([[x, y], choice]);\n // creuser la case intermédiaire\n dug(intermediate);\n // récupérer les coordonnées de la case liée\n let connectedCoordinates = new Array();\n connectedCoordinates[0] = newCoord(choice[0]);\n connectedCoordinates[1] = newCoord(choice[1]);\n // creuser la case liée\n dug(connectedCoordinates);\n console.table(finalMaze);\n\n // appelle la fonction sur cette case\n generateBox(choice);\n // une fois la case traitée on refait la liste des case voisines disponibles\n myMaze.findPossibleNeighbors(x, y);\n }\n}", "function getMaze(maze){\n let deadend = null\n const mazeNodeData = maze.map((row, rowIndex) => {\n return row.map((col, colIndex) => { \n if (col === 0) {deadend = false} else {deadend = true}\n return (\n {deadEnd: deadend, shortestPath:{totalCost: 1.7976931348623157E+10308, previousNode: null}, startPoint: false, endPoint: false, visited: false, coordinates: {row: rowIndex, col:colIndex}}\n )\n })\n })\n return mazeNodeData;\n }", "function findPath(x, y, path = []){\r\n // Starting point push\r\n path.push([x, y]);\r\n\r\n // Set the starting point as seen\r\n mazeArray[x][y].seen = true;\r\n \r\n // If the path makes it to the end of the maze, return the path\r\n if (mazeX - 1 == x && mazeY - 1 == y){\r\n path.push([x, y]);\r\n return path;\r\n }\r\n \r\n let topPath = (function() {\r\n if (mazeArray[x][y].top && mazeArray[x][y + 1].bottom){\r\n if(!mazeArray[x][y + 1].seen){\r\n mazeArray[x][y + 1].seen = true;\r\n return findPath(x, y + 1, path);\r\n } \r\n else {\r\n return false;\r\n }\r\n } \r\n }());\r\n \r\n let bottomPath = (function() {\r\n if (mazeArray[x][y].bottom && mazeArray[x][y - 1].top){\r\n if(!mazeArray[x][y - 1].seen){\r\n mazeArray[x][y - 1].seen = true;\r\n return findPath(x, y - 1, path);\r\n } \r\n else {\r\n return false;\r\n }\r\n }\r\n }());\r\n\r\n let leftPath = (function() {\r\n if (mazeArray[x][y].left && mazeArray[x - 1][y].right){\r\n if(!mazeArray[x - 1][y].seen){\r\n mazeArray[x - 1][y].seen = true;\r\n return findPath(x - 1, y, path);\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n }());\r\n \r\n let rightPath = (function() {\r\n if (mazeArray[x][y].right && mazeArray[x + 1][y].left){\r\n if(!mazeArray[x + 1][y].seen){\r\n mazeArray[x + 1][y].seen = true;\r\n return findPath(x + 1, y, path);\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n }());\r\n \r\n // Hit a dead end so restart the path\r\n if (!topPath && !bottomPath && !leftPath && !rightPath ) {\r\n path.splice(path.indexOf([x, y]));\r\n }\r\n // Return the completed path\r\n else {\r\n return (topPath || bottomPath || leftPath || rightPath);\r\n }\r\n }", "function grid(){\nfor(y = 0; y < maze.length; y++){\n for(x = 0; x < maze[y].length; x++){\n if(maze[y][x] == 0) { // selve banen\n ctx.drawImage(wallImg, x*tileSize, y*tileSize, tileSize, tileSize);\n }else if(maze[y][x] == 2){ // mål \n ctx.drawImage(goal, x*tileSize, y*tileSize, tileSize, tileSize);\n }else if(maze[y][x] == player){ //player = 3\n playerPosition = {y, x}; \n ctx.drawImage(nisse, x*tileSize, y*tileSize, tileSize, tileSize);\n }else if(maze[y][x] == 4){ //bomb \n ctx.drawImage(bombeImg, x*tileSize, y*tileSize, tileSize, tileSize);\n }else if(maze[y][x] == 5){ //point \n ctx.drawImage(nisseHue, x*tileSize, y*tileSize, tileSize, tileSize);\n }\n else if(maze[y][x] == 6){ //nøgler\n ctx.drawImage(giftOne, x*tileSize, y*tileSize, tileSize, tileSize);\n }else{\n ctx.fillStyle = \"white\"; \n ctx.fillRect(x*tileSize, y*tileSize, tileSize, tileSize); \n }\n }\n}\n}", "move(deltaT, maze) {\n var x1 = Math.floor((this.x + speed*deltaT*this.x_dir) / 100);\n var x2 = Math.floor((this.x + this.width + speed*deltaT*this.x_dir) / 100);\n var y1 = Math.floor((this.y + speed*deltaT*this.y_dir ) / 100);\n var y2 = Math.floor((this.y + this.height + speed*deltaT*this.y_dir) / 100);\n\n if (x1 < 0 || x1 >= maze[0].length) return; // x corresponds to COLUMNS\n if (y1 < 0 || y1 >= maze.length) return; // y corresponds to ROWS\n if (x2 < 0 || x2 >= maze[0].length) return;\n if (y2 < 0 || y2 >= maze.length) return;\n\n // If there is a path, the bullet could not go through\n if (maze[y1][x1] == 1 && maze[y2][x1] == 1 && maze[y1][x2] == 1 && maze[y2][x2] == 1) {\n this.x = this.x + speed*deltaT*this.x_dir;\n this.y = this.y + speed*deltaT*this.y_dir;\n return false;\n }\n else {\n return true;\n }\n }", "function draw(mst)\r\n{\r\n\r\n //This function runs until the entire maze has been carved by MST array\r\n var carve = setInterval(function() {\r\n \r\n //refreshes the viewing canvas so that changes can been seen\r\n content.clearRect(0,0,canvas.width,canvas.height)\r\n content.strokeStyle = \"black\";\r\n content.lineWidth =3;\r\n content.rect(0,0,len*n,len*n);\r\n content.stroke();\r\n\r\n //This is where the maze is carved using MST.\r\n //starting value is extracted out of the first index of the MST array and set to the corresponding starting vertex\r\n starting = linearVertex[mst[0][0]];\r\n\r\n //used to show the walls between all the vertexs in the maze and draws the starting vertex with a light blue color.\r\n //Displays the maze\r\n for(var i=0; i< linearVertex.length; i++)\r\n {\r\n linearVertex[i].show();\r\n starting.startindex();\r\n }\r\n\r\n //starts from the starting vertex and then removes all the edge connection using the MST array.\r\n //Eliminating all the edges which correspond to the MST array would display a maze as a byproduct\r\n if(count<mst.length)\r\n {\r\n //removes edges using MST from Vertex 1 to Vertex2 for the entire grid\r\n for(var j = 0; j< linearVertex[mst[count][0]].edgeConnection.length; j++)\r\n {\r\n if(linearVertex[mst[count][0]].edgeConnection[j].vertex2 === mst[count][1])\r\n {\r\n linearVertex[mst[count][0]].edgeConnection.splice(j,1);\r\n \r\n }\r\n }\r\n\r\n //removes edges using MST from Vertex2 to Vertex1 for the entire grid\r\n for(var k= 0; k< linearVertex[mst[count][1]].edgeConnection.length; k++)\r\n {\r\n if( linearVertex[mst[count][1]].edgeConnection[k].vertex2 === mst[count][0])\r\n {\r\n linearVertex[mst[count][1]].edgeConnection.splice(k,1);\r\n \r\n }\r\n }\r\n }\r\n //count is used as a way of stoping the timer\r\n count++;\r\n //when count has reached the length of MST then it has covered all the vertex and it can stop the timer\r\n if(count>mst.length)\r\n {\r\n clearInterval(carve);\r\n }\r\n \r\n },speed);\r\n \r\n //DFS function is called and passes the MST used by the draw function to show the dfs algorithum\r\n dfs(mst);\r\n\r\n}", "function makemaze(k) {\n var useCanned = false;\n if (k == DBOTTOM || k == VBOTTOM) {\n useCanned = true;\n }\n else if (k > 1) {\n if (ULARN) {\n useCanned = rnd(100) < 50;\n }\n else {\n useCanned = rnd(17) <= 4;\n }\n }\n\n if (useCanned) {\n /* read maze from data file */\n cannedlevel(k);\n return;\n }\n\n var mitem = player.level.monsters;\n\n for (let i = 0; i < MAXY; i++) {\n for (let j = 0; j < MAXX; j++) {\n if (k == 0)\n setItem(j, i, OEMPTY);\n else\n setItem(j, i, OWALL);\n }\n }\n\n if (k == 0) return;\n\n eat(1, 1);\n\n if (k == 1) setItem(33, MAXY - 1, OHOMEENTRANCE);\n\n /* now for open spaces */\n var tmp2 = rnd(3) + 3;\n var mx, mxl, mxh, my, myl, myh;\n var mon;\n for (let tmp = 0; tmp < tmp2; tmp++) {\n my = rnd(11) + 2;\n myl = my - rnd(2);\n myh = my + rnd(2);\n\n if (k < MAXLEVEL) {\n mx = rnd(44) + 5;\n mxl = mx - rnd(4);\n mxh = mx + rnd(12) + 3;\n mon = null;\n } else {\n mx = rnd(60) + 3;\n mxl = mx - rnd(2);\n mxh = mx + rnd(2);\n mon = makemonst(k);\n }\n\n for (var i = mxl; i < mxh; i++)\n for (var j = myl; j < myh; j++) {\n setItem(i, j, OEMPTY);\n mitem[i][j] = mon ? createMonster(mon) : null;\n }\n }\n /* now for open spaces */\n\n my = rnd(MAXY - 2);\n for (let i = 1; i < MAXX - 1; i++)\n setItem(i, my, OEMPTY);\n\n if (k > (ULARN ? 4 : 1)) {\n treasureroom(k);\n }\n\n}", "generateMaze(grid, width, cellPos, walls, openings) {\n let nextCell; // next cell to be checked\n // remove the wall at position only if there is one or less open\n // neighbor cells\n if (this.checkOpenNeighbors(grid, width, cellPos) <= 1 &&\n openings.indexOf(cellPos) === -1) {\n grid[cellPos] = OPENING_CHAR;\n // make sure we don't add the initial start position to list of\n // available openings\n if (START_POS_X + START_POS_Y !== cellPos) {\n openings.push(cellPos);\n }\n }\n // else, go back and try another cell\n else {\n return;\n }\n\n // add walls around new opening\n walls = walls.concat(this.addWallNeighbors(grid, width, cellPos, walls));\n\n // get a wall cell off the list and continue generating the maze\n while (walls.length > 0) {\n nextCell = this.getNextCell(walls);\n this.generateMaze(grid, width, nextCell, walls, openings);\n }\n\n return grid;\n }", "function drawMaze(){\n document.getElementById(`Game-Window`).innerHTML = \"\";\n for (var i = 0; i < maze.length; i++) {\n var row = $('<tr class=\"row\"></tr>');\n for (var j = 0; j < maze[i].length; j++) {\n if (maze[i][j] === 0) {\n var col = $(`<td class=\"col score\">Score:-${score}</td>`).css(\"border\",\"none\").css(\"color\",\"white\")\n row.append(col);\n } else if (maze[i][j] === 1) {\n var col = $(`<td class=\"col wall\"></td>`).css(\"background\",\"white\").css(\"border-color\",\"black\")\n row.append(col);\n } else if (maze[i][j] === 2) {\n var col = $(`<td class=\"col space\"><div class=\"container2\"><div class=\"coin\"></div></div></td>`).css(\"border\",\"none\")\n row.append(col);\n } else if (maze[i][j] === 3) {\n var col = $(`<td class=\"col blank\"></td>`).css(\"background\",\"black\").css(\"border\",\"none\")\n row.append(col);\n } else if (maze[i][j] === 4) {\n var col = $(`<td class=\"col door\"></td>`).css(\"background\",\"black\")\n row.append(col);\n } else if (maze[i][j] === 5) {\n if (directionPM == 1) {\n var col = $(`<td class=\"col space\"><div class=\"container1\"><div class=\"pacman\"></div></div></td>`).css(\"background\",\"black\").css(\"border\",\"none\").css(\"transform\",\"rotate(180deg)\");\n } else if (directionPM == 2) {\n var col = $(`<td class=\"col space\"><div class=\"container1\"><div class=\"pacman\"></div></div></td>`).css(\"background\",\"black\").css(\"border\",\"none\").css(\"transform\",\"rotate(270deg)\");\n } else if (directionPM == 3) {\n var col = $(`<td class=\"col space\"><div class=\"container1\"><div class=\"pacman\"></div></div></td>`).css(\"background\",\"black\").css(\"border\",\"none\").css(\"transform\",\"rotate(0deg)\");\n } else if (directionPM == 4) {\n var col = $(`<td class=\"col space\"><div class=\"container1\"><div class=\"pacman\"></div></div></td>`).css(\"background\",\"black\").css(\"border\",\"none\").css(\"transform\",\"rotate(90deg)\");\n }\n row.append(col);\n } else if (maze[i][j] === 6) {\n var col = $(`<td class=\"col exit\"></td>`).css(\"background\",\"black\").css(\"border\",\"none\")\n row.append(col);\n } else if (maze[i][j] === 7) {\n var col = $(`<td class=\"col space\"><div class=\"container3\"><div class=\"pinky\"></div></div></td>`).css(\"background\",\"black\").css(\"border\",\"none\");\n row.append(col);\n } else if (maze[i][j] === 8) {\n var col = $(`<td class=\"col time\"></td>`).css(\"border\",\"none\").css(\"color\",\"white\")\n row.append(col);\n } else if (maze[i][j] === 9) {\n var col = $(`<td class=\"col space\"><div class=\"container3\"><div class=\"blinky\"></div></div></td>`).css(\"background\",\"black\").css(\"border\",\"none\");\n row.append(col);\n } else if (maze[i][j] === 10) {\n var col = $(`<td class=\"col space\"><div class=\"container3\"><div class=\"inky\"></div></div></td>`).css(\"background\",\"black\").css(\"border\",\"none\");\n row.append(col);\n } else if (maze[i][j] === 11) {\n var col = $(`<td class=\"col space\"><div class=\"container3\"><div class=\"clyde\"></div></div></td>`).css(\"background\",\"black\").css(\"border\",\"none\");\n row.append(col);\n } else if (maze[i][j] === 12) {\n var col = $(`<td class=\"col cage\"></td>`).css(\"background\",\"black\").css(\"border\",\"none\")\n row.append(col);\n } else if (maze[i][j] === 13) {\n var col = $(`<td class=\"col lives\">Lives:-${lives}</td>`).css(\"border\",\"none\").css(\"color\",\"white\")\n row.append(col);\n }\n }\n board.append(row);\n }\n }", "function grid(){\r\nfor(y = 0; y < maze.length; y++){\r\n \r\n for(x = 0; x < maze[y].length; x++){\r\n \r\n if(maze[y][x] == 0){\r\n ctx.fillStyle = \"#315625\";\r\n ctx.fillRect(x*tSize,y*tSize,tSize,tSize);\r\n}\r\n if(maze[y][x] == 2){\r\n ctx.drawImage(imghole, x*tSize,y*tSize,tSize,tSize);\r\n}\r\n if(maze[y][x] == 1){\r\n ctx.drawImage(imgbush, x*tSize,y*tSize,tSize,tSize);\r\n}\r\n if(maze[y][x] == 3){\r\n ctx.drawImage(imgmushroom, x*tSize,y*tSize,tSize,tSize);\r\n}\r\n if(maze[y][x] == 4){\r\n ctx.drawImage(imgcheshire, x*tSize,y*tSize,tSize,tSize);\r\n}\r\n if(maze[y][x] == 5){\r\n ctx.drawImage(imgcard, x*tSize,y*tSize,tSize,tSize);\r\n}\r\n if(maze[y][x] == player){\r\n ctx.drawImage(imgalice, x*tSize,y*tSize,tSize,tSize);\r\n playerPosition = {y:y,x:x};\r\n console.log(playerPosition.y + \" \" + playerPosition.x)\r\n }\r\n }\r\n }\r\n}", "function solveMazeZH() {\n\n let grid = cGrid;\n var curRow = 0;\n var curCol = 0;\n var prevRow = 0;\n var prevCol = 0;\n var stepCount = 0;\n var exitReached = false;\n var noExit = false;\n var minDistance = -1;\n var nextDirection;\n var moveUp = {};\n var moveLeft = {};\n var moveRight = {};\n var moveDown = {};\n\n\n //find the start column. We know it is on row 0.\n exitRow = grid.length - 1;\n startRow = 0;\n startCol = grid[startRow].findIndex(isPath);\n\n curCol = startCol;\n curRow = startRow;\n\n //Mark the start as part of the path\n grid[startRow][startCol] = colValues.PATH;\n var elementID = `${startRow}:${startCol}`;\n document.getElementById(elementID).setAttribute(\"blockValue\", \"step\");\n\n //solve the maze by looking for the next best step\n do {\n\n let nextStep = [];\n let prevRow = curRow;\n let prevCol = curCol;\n\n moveUp = moveZH(curRow, curCol, grid, directions.UP);\n if (moveUp.canMove == true) {\n nextStep.push(moveUp);\n }\n\n moveDown = moveZH(curRow, curCol, grid, directions.DOWN);\n if (moveDown.canMove == true) {\n nextStep.push(moveDown);\n }\n\n moveLeft = moveZH(curRow, curCol, grid, directions.LEFT);\n if (moveLeft.canMove == true) {\n nextStep.push(moveLeft);\n }\n\n moveRight = moveZH(curRow, curCol, grid, directions.RIGHT);\n if (moveRight.canMove == true) {\n nextStep.push(moveRight);\n }\n\n //if we have no where to go exit\n if (nextStep.length == 0) {\n noExit = true;\n break;\n }\n\n //sort nextstep by target value\n nextStep.sort(function (a, b) {\n if (a.colValue > b.colValue) {\n return 1;\n }\n if (a.colValue < b.colValue) {\n return -1;\n }\n return 0;\n });\n\n //pick the element that is closest to the exit. Pick Up or Down first. \n switch (nextStep[0].direction) {\n case directions.UP:\n //move up and add to step count \n stepCount++;\n curRow = curRow + 1;\n break;\n case directions.DOWN:\n //Move Down and add to step count\n stepCount++;\n curRow = curRow - 1;\n break;\n case directions.LEFT:\n //Move left and add to step count\n stepCount++;\n curCol = curCol - 1;\n break;\n case directions.RIGHT:\n //Move right and add to step count\n stepCount++;\n curCol = curCol + 1;\n break;\n\n }\n //mark the sqaures on the page\n if (curRow == exitRow) {\n exitCol = curCol;\n }\n\n exitReached = markElements(curRow, curCol, prevRow, prevCol, grid);\n }\n while (exitReached == false || noExit == true);\n if (exitReached == true) {\n document.getElementById(\"results\").innerHTML = `Success! It took ${stepCount} step(s)`\n }\n\n}", "function constructMaze(x, y) {\r\n mazeObject = new Maze(x, y);\r\n\r\n mazeArray = mazeObject.maze;\r\n\r\n mazeX = x;\r\n mazeY = y;\r\n\r\n // Find shortest path and add scoring along path\r\n let path = findPath(0, 0, array = []);\r\n\r\n for (let i=0; i < path.length; i++) {\r\n let pathX = path[i][0];\r\n let pathY = path[i][1];\r\n\r\n mazeArray[pathX][pathY].score = 5;\r\n mazeArray[pathX][pathY].path = true;\r\n pathArray.push([pathX,pathY]);\r\n }\r\n\r\n // Starting point score\r\n mazeArray[0][0].score = 0;\r\n\r\n // Ending point score\r\n mazeArray[x - 1][y - 1].score = 5;\r\n \r\n displayMaze(x, y, mazeArray); \r\n }", "function prim_maze(){\n // Calculate all verticies. Needs to be half the size of the original board. \n num_rows = snakeboard.height/grid_margin/2;\n num_cols = snakeboard.width/grid_margin/2;\n num_vert = num_cols * num_rows;\n\n // directions = Array.from(Array(num_rows), () => new Array(num_cols));\n // visited = Array.from(Array(num_rows), () => new Array(num_cols));\n //directions = {}\n //visited = {}\n\n// Got this from: https://stackoverflow.com/questions/966225/how-can-i-create-a-two-dimensional-array-in-javascript\nvar directions = new Array(num_rows);\nvar visited = new Array(num_rows);\n\nfor (var i = 0; i < directions.length; i++) {\n directions[i] = new Array(num_cols);\n visited[i] = new Array(num_cols);\n}\nfor (var i = 0; i < directions.length; i++){\n for (var j = 0; j < directions[0].length; j++){\n directions[i][j] = [];\n visited[i][j] = 0;\n }\n}\n\n//console.log(visited);\n // Key Generation\n // for (var y = 0; y <= num_rows; y++){\n // for (var x = 0; x <= num_cols; x++){\n // directions[x][y] = [];\n // visited[x][y] = 0;\n // }\n // }\n\n init_x = Math.floor(Math.random() * num_cols); \n init_y = Math.floor(Math.random() * num_rows); \n\n curr_x = init_x;\n curr_y = init_y;\n new_x = curr_x;\n new_y = curr_y;\n\n console.log(\"Current pos:\");\n console.log(curr_x);\n console.log(curr_y);\n\n // Need to keep track of visited points\n visited[curr_x][curr_y] = 1;\n\n // Found from https://stackoverflow.com/questions/63179867/set-of-tuples-in-javascript\n class ObjectSet extends Set{\n add(elem){\n return super.add(typeof elem === 'object' ? JSON.stringify(elem) : elem);\n }\n has(elem){\n return super.has(typeof elem === 'object' ? JSON.stringify(elem) : elem);\n }\n }\n\n // Need to keep track of adjacent points\n let adjacent = new ObjectSet();\n\n //while (Object.keys(visited).length != num_vert){\n while(count_ones(visited) != num_vert){\n\n curr_x = new_x;\n curr_y = new_y;\n\n // Need to list all the cases to check adjacent cells\n\n // Case #1: Not on any edge of the board. Have neighbors above, below, right, and left of you\n if (curr_x != 0 && curr_y != 0 && curr_x != num_cols - 1 && curr_y != num_rows - 1){\n //adjacent.add({x: curr_x, y: curr_y })\n // Right neighbor\n adjacent.add([curr_x + 1, curr_y ]);\n // Left neighbor\n adjacent.add([curr_x - 1, curr_y ]);\n // Above neighbor\n adjacent.add([curr_x , curr_y - 1]);\n // Below neighbor\n adjacent.add([curr_x , curr_y + 1 ]);\n }\n // Case #2: Top left corner. Have neighbors below, and right of you\n else if (curr_x === 0 && curr_y === 0 ){\n // Right neighbor\n adjacent.add([curr_x + 1, curr_y ]);\n // Below neighbor\n adjacent.add([curr_x, curr_y + 1 ]);\n }\n // Case #3: Top Right corner. Have neighbors below, and left of you\n else if (curr_x === num_cols - 1 && curr_y === 0 ){\n // Below neighbor\n adjacent.add([curr_x, curr_y + 1 ]);\n // Left neighbor\n adjacent.add([curr_x - 1, curr_y ]);\n }\n // Case #4: Bottom Right corner. Have neighbors above, and left of you\n else if (curr_x === num_cols - 1 && curr_y === num_rows - 1 ){\n // Above neighbor\n adjacent.add([curr_x , curr_y - 1]);\n // Left neighbor\n adjacent.add([curr_x - 1, curr_y ]);\n }\n // Case #5: Bottom Left corner. Have neighbors above, and right of you\n else if (curr_x === 0 && curr_y === num_rows - 1 ){\n // Above neighbor\n adjacent.add([curr_x , curr_y - 1]);\n // Right neighbor\n adjacent.add([curr_x + 1, curr_y ]);\n }\n // Case #6: Left Edge. Have neighbors above, below, and right of you\n else if (curr_x === 0 ){\n // Above neighbor\n adjacent.add([curr_x , curr_y - 1]);\n // Right neighbor\n adjacent.add([curr_x + 1, curr_y ]);\n // Below neighbor\n adjacent.add([curr_x, curr_y + 1 ]);\n }\n // Case #7: Right Edge. Have neighbors above, below, and left of you\n else if (curr_x === num_cols - 1 ){\n // Above neighbor\n adjacent.add([curr_x , curr_y - 1]);\n /// Left neighbor\n adjacent.add([curr_x - 1, curr_y ]);\n // Below neighbor\n adjacent.add([curr_x, curr_y + 1 ]);\n }\n // Case #8: Top Edge. Have neighbors below, right and left of you\n else if (curr_y === 0 ){\n // Right neighbor\n adjacent.add([curr_x + 1, curr_y ]);\n /// Left neighbor\n adjacent.add([curr_x - 1, curr_y ]);\n // Below neighbor\n adjacent.add([curr_x, curr_y + 1 ]);\n }\n // Case #9: Bottom Edge. Have neighbors above, right and left of you\n else if (curr_y === num_rows - 1 ){\n // Right neighbor\n adjacent.add([curr_x + 1, curr_y ]);\n /// Left neighbor\n adjacent.add([curr_x - 1, curr_y ]);\n // Above neighbor\n adjacent.add([curr_x , curr_y - 1]);\n }\n\n console.log(adjacent);\n\n while (true){\n\n // Pick random adjacent cell to check. \n new_cell = set_pop(adjacent);\n //console.log(new_cell);\n \n new_x = parseInt(new_cell.split(\",\")[0].split(\"[\")[1],dx);\n new_y = parseInt(new_cell.split(\",\")[1].split(\"]\")[0],dx);\n console.log(new_x + \" \" + new_y);\n //console.log(visited);\n adjacent.delete(new_cell) \n //console.log(adjacent)\n // Checks if a wall already exists. If it does, it will pick a new cell\n if (visited[new_x][new_y] == 0) {\n\n // Marks this location as visited\n visited[new_x][new_y] = 1;\n\n // Creating the wall. Check the adjacent cells until you find a visited cell. Then make a wall towards it. \n // Only consider walls to be the right or down\n if (new_x+1 <= num_cols-1 && visited[new_x+1][new_y] == 1){\n directions[new_x][new_y].push(\"right\");\n }\n else if(new_x != 0 && visited[new_x-1][new_y] == 1){\n directions[new_x-1][new_y].push(\"right\");\n }\n else if(new_y+1 <= num_rows && visited[new_x][new_y+1] == 1){\n directions[new_x][new_y].push(\"down\");\n }\n else if(new_y != 0 && visited[new_x][new_y-1] == 1){\n directions[new_x][new_y-1].push(\"down\");\n }\n else{\n console.log(\"Something went wrong in prim_maze()\");\n }\n\n break;\n }\n }\n console.log(\"num visited:\");\n console.log(count_ones(visited));\n \n }\n console.log(directions); \n return directions;\n //}\n}", "function ghostDirectionInformedSearch(node){\n nodeHistory.push({x: node.x, y: node.y});\n\n var eyeDirection = 0;\n\n var nextNode = {};\n\n //Goal (Solution)\n if(pacmanSprite.x == node.x && pacmanSprite.y == node.y){\n alert(\"LOST!\");\n } else {\n // Pacman Located Bottom Left\n if(pacmanSprite.x < node.x && pacmanSprite.y > node.y){\n // Node Bottom\n if(Pacman.MAP[node.y + 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y + 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y + 1;\n\n eyeDirection = 3;\n }\n // Node Left\n else if(Pacman.MAP[node.y][node.x - 1] > 0 && objectIndexOf(nodeHistory,{x: node.x - 1, y: node.y}) == -1){\n nextNode.x = node.x - 1;\n nextNode.y = node.y;\n\n eyeDirection = 4;\n }\n /**\n * X distance bigger than Y distance: Do not increase X! (Matrix is bigger at the X axis than Y)\n * Node Top\n */\n else if((Math.abs(node.x - pacmanSprite.x) > Math.abs(node.y - pacmanSprite.y)) && Pacman.MAP[node.y - 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y - 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y - 1;\n\n eyeDirection = 1;\n }\n /**\n * Y distance bigger than X distance: Do not increase Y!\n * Node Right\n */\n else {\n nextNode.x = node.x + 1;\n nextNode.y = node.y;\n\n eyeDirection = 2;\n }\n }\n // Pacman Located Bottom Right\n else if(pacmanSprite.x > node.x && pacmanSprite.y > node.y){\n // Node Bottom\n if(Pacman.MAP[node.y + 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y + 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y + 1;\n\n eyeDirection = 3;\n }\n // Node Right\n else if(Pacman.MAP[node.y][node.x + 1] > 0 && objectIndexOf(nodeHistory,{x: node.x + 1, y: node.y}) == -1){\n nextNode.x = node.x + 1;\n nextNode.y = node.y;\n\n eyeDirection = 2;\n }\n /**\n * X distance bigger than Y distance: Do not increase X!\n * Node Top\n */\n else if((Math.abs(node.x - pacmanSprite.x) > Math.abs(node.y - pacmanSprite.y)) && Pacman.MAP[node.y - 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y - 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y - 1;\n\n eyeDirection = 1;\n }\n /**\n * Y distance bigger than X distance: Do not increase Y!\n * Node Left\n */\n else {\n nextNode.x = node.x - 1;\n nextNode.y = node.y;\n\n eyeDirection = 4;\n }\n }\n // Pacman Located Top Left\n else if(pacmanSprite.x < node.x && pacmanSprite.y < node.y){\n // Node Top\n if(Pacman.MAP[node.y - 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y - 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y - 1;\n\n eyeDirection = 1;\n }\n // Node Left\n else if(Pacman.MAP[node.y][node.x - 1] > 0 && objectIndexOf(nodeHistory,{x: node.x - 1, y: node.y}) == -1){\n nextNode.x = node.x - 1;\n nextNode.y = node.y;\n\n eyeDirection = 4;\n }\n /**\n * X distance bigger than Y distance: Do not increase X!\n * Node Bottom\n */\n else if((Math.abs(node.x - pacmanSprite.x) > Math.abs(node.y - pacmanSprite.y)) && Pacman.MAP[node.y + 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y + 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y + 1;\n\n eyeDirection = 3;\n }\n /**\n * Y distance bigger than X distance: Do not increase Y!\n * Node Right\n */\n else {\n nextNode.x = node.x + 1;\n nextNode.y = node.y;\n\n eyeDirection = 2;\n }\n }\n // Pacman Located Top Right\n else if(pacmanSprite.x > node.x && pacmanSprite.y < node.y){\n // Node Top\n if(Pacman.MAP[node.y - 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y - 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y - 1;\n\n eyeDirection = 1;\n }\n // Node Right\n else if(Pacman.MAP[node.y][node.x + 1] > 0 && objectIndexOf(nodeHistory,{x: node.x + 1, y: node.y}) == -1){\n nextNode.x = node.x + 1;\n nextNode.y = node.y;\n\n eyeDirection = 2;\n }\n /**\n * X distance bigger than Y distance: Do not increase X!\n * Node Bottom\n */\n else if((Math.abs(node.x - pacmanSprite.x) > Math.abs(node.y - pacmanSprite.y)) && Pacman.MAP[node.y + 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y + 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y + 1;\n\n eyeDirection = 3;\n }\n /**\n * Y distance bigger than X distance: Do not increase Y!\n * Node Left\n */\n else {\n nextNode.x = node.x - 1;\n nextNode.y = node.y;\n\n eyeDirection = 4;\n }\n }\n // Pacman Located Bottom\n else if(pacmanSprite.x == node.x && pacmanSprite.y > node.y){\n // Node Bottom\n if(Pacman.MAP[node.y + 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y + 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y + 1;\n\n eyeDirection = 3;\n }\n // TODO: Add Random Decision aeyeDirectionbout the priority of Right/Left\n // Node Right\n else if(Pacman.MAP[node.y][node.x + 1] > 0 && objectIndexOf(nodeHistory,{x: node.x + 1, y: node.y}) == -1){\n nextNode.x = node.x + 1;\n nextNode.y = node.y;\n\n eyeDirection = 2;\n }\n // Node Left\n else if(Pacman.MAP[node.y][node.x - 1] > 0 && objectIndexOf(nodeHistory,{x: node.x - 1, y: node.y}) == -1){\n nextNode.x = node.x - 1;\n nextNode.y = node.y;\n\n eyeDirection = 4;\n }\n // Node Top\n else {\n nextNode.x = node.x;\n nextNode.y = node.y - 1;\n\n eyeDirection = 1;\n }\n }\n // Pacman Located Top\n else if(pacmanSprite.x == node.x && pacmanSprite.y < node.y){\n // Node Top\n if(Pacman.MAP[node.y - 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y - 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y - 1;\n\n eyeDirection = 1;\n }\n // Node Right\n else if(Pacman.MAP[node.y][node.x + 1] > 0 && objectIndexOf(nodeHistory,{x: node.x + 1, y: node.y}) == -1){\n nextNode.x = node.x + 1;\n nextNode.y = node.y;\n\n eyeDirection = 2;\n }\n // Node Left\n else if(Pacman.MAP[node.y][node.x - 1] > 0 && objectIndexOf(nodeHistory,{x: node.x - 1, y: node.y}) == -1){\n nextNode.x = node.x + 1;\n nextNode.y = node.y;\n\n eyeDirection = 4;\n }\n // Node Bottom\n else {\n nextNode.x = node.x;\n nextNode.y = node.y + 1;\n\n eyeDirection = 3;\n }\n }\n // Pacman Located Right\n else if(pacmanSprite.x > node.x && pacmanSprite.y == node.y){\n // Node Right\n if(Pacman.MAP[node.y][node.x + 1] > 0 && objectIndexOf(nodeHistory,{x: node.x + 1, y: node.y}) == -1){\n nextNode.x = node.x + 1;\n nextNode.y = node.y;\n\n eyeDirection = 2;\n }\n // Node Bottom\n else if(Pacman.MAP[node.y + 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y + 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y + 1;\n\n eyeDirection = 3;\n }\n // Node Top\n else if(Pacman.MAP[node.y - 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y - 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y - 1;\n\n eyeDirection = 1;\n }\n // Node Left\n else {\n nextNode.x = node.x - 1;\n nextNode.y = node.y;\n\n eyeDirection = 4;\n }\n }\n // Pacman Located Left\n else {\n // Node Left\n if(Pacman.MAP[node.y][node.x - 1] > 0 && objectIndexOf(nodeHistory,{x: node.x - 1, y: node.y}) == -1){\n nextNode.x = node.x - 1;\n nextNode.y = node.y;\n\n eyeDirection = 4;\n }\n // Node Bottom\n else if(Pacman.MAP[node.y + 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y + 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y + 1;\n\n eyeDirection = 3;\n }\n // Node Top\n else if(Pacman.MAP[node.y - 1][node.x] > 0 && objectIndexOf(nodeHistory,{x: node.x, y: node.y - 1}) == -1){\n nextNode.x = node.x;\n nextNode.y = node.y - 1;\n\n eyeDirection = 1;\n }\n // Node Right\n else {\n nextNode.x = node.x + 1;\n nextNode.y = node.y;\n\n eyeDirection = 2;\n }\n }\n\n if(nextNode != null){\n oldGhostSprite.y = ghostSprite.y;\n oldGhostSprite.x = ghostSprite.x;\n\n ghostSprite.y = nextNode.y;\n ghostSprite.x = nextNode.x;\n\n //return ghostDirection(nextNode);\n //window.setTimeout(ghostDirection, 400, nextNode);\n } else {\n ghostSprite.y = node.y;\n ghostSprite.x = node.x;\n }\n\n //drawPacman();\n drawGhost(eyeDirection,0);\n }\n}", "function constructMaze() {\n let wallMeshes = [];\n let floorMeshes = [];\n\n let width = 1;\n let height = 1;\n\n // rotations to get floor to wall orientation\n let leftRotation = vec3.fromValues(0, Math.PI / 2, 0);\n let rightRotation = vec3.fromValues(0, -Math.PI / 2, 0);\n let topRotation = vec3.fromValues(-Math.PI / 2, 0, 0);\n let bottomRotation = vec3.fromValues(Math.PI / 2, 0, 0);\n\n // floor rotation is just not rotating at all\n let floorRotation = vec3.fromValues(0, 0, 0);\n\n for (let i = 0; i < maze.sizeX; i++) {\n for (let j = 0; j < maze.sizeY; j++) {\n let isWall = maze.data[i][j] == 1;\n\n let left = i;\n let right = i + 1;\n let top = j + 1;\n let bottom = j;\n\n let centerX = i + 0.5;\n let centerY = j + 0.5;\n\n let floorZ = 0;\n let wallZ = 0.5;\n\n if (isWall) {\n // construct wall tile(s) here\n // contstruct a wall in every direction that has a free tile in it\n let drawLeft = i != 0 && maze.data[i-1][j] == 0;\n let drawRight = i != maze.sizeX - 1 && maze.data[i+1][j] == 0;\n let drawBottom = j != 0 && maze.data[i][j-1] == 0;\n let drawTop = j != maze.sizeY - 1 && maze.data[i][j+1] == 0;\n\n if (drawLeft) {\n let leftWallCenter = vec3.fromValues(left, centerY, wallZ);\n let leftWallShapeData = getQuadMesh(leftWallCenter, leftRotation, width, height);\n wallMeshes.push(leftWallShapeData);\n }\n if (drawRight) {\n let rightWallCenter = vec3.fromValues(right, centerY, wallZ);\n let rightWallShapeData = getQuadMesh(rightWallCenter, rightRotation, width, height);\n wallMeshes.push(rightWallShapeData);\n }\n if (drawBottom) {\n let bottomWallCenter = vec3.fromValues(centerX, bottom, wallZ);\n let bottomWallShapeData = getQuadMesh(bottomWallCenter, bottomRotation, width, height);\n wallMeshes.push(bottomWallShapeData);\n }\n if (drawTop) {\n let topWallCenter = vec3.fromValues(centerX, top, wallZ);\n let topWallShapeData = getQuadMesh(topWallCenter, topRotation, width, height);\n wallMeshes.push(topWallShapeData);\n }\n } else {\n let floorCenter = vec3.fromValues(centerX, centerY, floorZ);\n let floorShapeData = getQuadMesh(floorCenter, floorRotation, width, height);\n floorMeshes.push(floorShapeData);\n }\n }\n }\n\n return {\n wallMeshes: wallMeshes,\n floorMeshes: floorMeshes\n };\n}", "function generateMazeKruskal(width,height,additionalPassages) {\n var walls = [];\n var maze = [];\n var remainingWalls = [];\n\n // Initialize the list of walls:\n for(var i = 1;i<height;i+=2) {\n for(var j = 2;j<width-1;j+=2) {\n walls.push({direction:'h', x:j, y:i});\n }\n }\n for(var i = 2;i<height-1;i+=2) {\n for(var j = 1;j<width;j+=2) {\n walls.push({direction:'v', x:j, y:i});\n }\n }\n\n // Initialize the map:\n var count = 1;\n for(var i = 0;i<width;i++) {\n var col = [];\n for(var j = 0;j<height;j++) {\n if ((i%2)==1 && (j%2)==1) {\n col.push(count);\n count++;\n } else {\n col.push(0);\n }\n }\n maze.push(col);\n }\n\n // Randomly iterate over the walls, and remove those that connect different regions:\n while(walls.length>0) {\n var idx = Math.floor(Math.random()*walls.length);\n var wall = walls[idx];\n walls.splice(idx,1);\n if (wall.direction=='h') {\n var c1 = maze[wall.x-1][wall.y];\n var c2 = maze[wall.x+1][wall.y];\n } else {\n var c1 = maze[wall.x][wall.y-1];\n var c2 = maze[wall.x][wall.y+1];\n }\n if (c1!=c2) {\n maze[wall.x][wall.y]=c2;\n for(var i = 0;i<height;i++) {\n for(var j = 0;j<width;j++) {\n if (maze[j][i]==c1) maze[j][i]=c2;\n }\n }\n } else {\n remainingWalls.push(wall);\n }\n }\n\n // remove some additional walls to create loops:\n while(additionalPassages>0 && remainingWalls.length>0) {\n var idx = Math.floor(Math.random()*remainingWalls.length);\n var wall = remainingWalls[idx];\n remainingWalls.splice(idx,1);\n maze[wall.x][wall.y] = 1;\n additionalPassages--;\n }\n return maze;\n}", "function move(e){\r\n e = e||window.Event\r\n switch(e.keyCode){\r\n case 38: //Up Arrow Key\r\n case 87: //W key\r\n if(curr.walls.top===false) {\r\n curr.show()\r\n curr = new mouse(curr.row-1,curr.col,curr.maze)\r\n }\r\n curr.rotateUp() //rotate the mouse\r\n curr.drawMouse() //draw the mouse in that rotation and position (the mouse could rotate but not move at all)\r\n break\r\n case 40: //Down Arrow Key\r\n case 83: //S Key\r\n if(curr.walls.bottom===false) {\r\n curr.show()\r\n curr = new mouse(curr.row+1,curr.col,curr.maze)\r\n }\r\n curr.rotateDown()\r\n curr.drawMouse()\r\n break\r\n case 39: //Right Arrow Key\r\n case 68: //D key\r\n if(curr.walls.right===false) {\r\n curr.show()\r\n curr = new mouse(curr.row,curr.col+1,curr.maze)\r\n }\r\n curr.rotateRight()\r\n curr.drawMouse()\r\n break\r\n case 37: //Left Arrow Key\r\n case 65: //A key- Left\r\n if(curr.walls.left===false) {\r\n curr.show()\r\n curr = new mouse(curr.row,curr.col-1,curr.maze)\r\n }\r\n curr.rotateLeft()\r\n curr.drawMouse()\r\n break\r\n }\r\n //when the mouse has reached the cheese, you've escaped the maze\r\n if(curr.row === finish.row && curr.col === finish.col){\r\n finish.highlight(\"red\")\r\n }\r\n\r\n\r\n}", "constructor(squarePosX, squarePosY) {\r\n super(squarePosX, squarePosY)\r\n this.ctx;\r\n this.maze;\r\n this.start = {x:-1, y:-1} // cell coordinate of the start of maze\r\n this.end = {x:-1, y:-1} // cell coordinate of the end of maze\r\n this.stack = []\r\n\r\n this.initMaze()\r\n }", "step() {\n if (this.currentCell) {\n // mark the current cell as visited\n this.currentCell.visited = true;\n // find the unvisited neighbors around the current cell\n let neighbors = this.findNeighbors(this.currentCell, true);\n if (neighbors.length > 0) {\n // dig through the wall to a random unvisited neighbor\n let neighbor = this.random(neighbors);\n this.currentCell = this.dig(this.currentCell, neighbor);\n } else {\n // if all neighbors are visited, go hunt a new cell\n let hunted = this.hunt(this.cells);\n // if the hunt is a success, dig between the cell and its visited neighbor\n if (hunted) {\n this.currentCell = this.dig(hunted.neighbor, hunted.cell);\n } else {\n // if the hunt isn't a success, then the maze is done\n this.end = this.currentCell;\n this.currentCell = null;\n console.log('maze created !');\n }\n }\n return false;\n } else {\n return true;\n }\n }", "function Pathfinder(){\n this.openTiles = [];\n this.closedTiles = [];\n \n var me = this;\n //===========FIND PATH FUNCTION==========//\n //Finds the path for the player to follow\n this.findPath = function(startTile, endTile){\n me.openTiles = [];\n me.closedTiles = [];\n \n //Starting tiles parent property shuld be null\n startTile.resetParent();\n //STEP 1: CONNECT START TO END\n me.connectStartToEnd(startTile,endTile);\n //STEP 2: BUILD PATH BACK TO BEGINNING\n var path = me.connectEndToStart(startTile,endTile);\n //STEP 3: REVERSE THE PATH(FOR CONVENIENCE)\n path.reverse();\n }\n \n //function that calculates the cost of moving from one tile to the next and connects a starting tile to an ending tile\n this.connectStartToEnd=function(startTile,endTile){\n me.openTiles.push(startTile);//add startTile to the open tiles array\n \n //WHILE THERE ARE STILL TILES IN THE OPEN TILES ARRAY\n while(me.openTiles.length >0){\n //FIND THE OPEN TILE WITH THE LOWEST F VALUE\n var F = 99999999999;\n var index = -1;\n for(var i = 0; i < me.openTiles.length;i++){\n if(me.openTiles[i].F < F){\n F=me.openTiles[i].F;\n index=i;\n }\n }\n var current = openTiles.slice(index);//REMOVE TILE FROM OPEN TILES ARRAY\n me.closedTiles.push(current);\n \n //IF WE'VE CONNECTED THE START TO THE END , BREAK OUT OF WHILE, RETURN OUT OF FUNCTION\n if(current == endTile)break;\n \n for(var i = 0; i < current.neighbors.length;i++){\n var neighbor = current.neighbors[i];\n if(!me.tileInArray(me.closedTiles,neighbor)){\n if(!me.tileInArray(me.openTiles,neighbor)){\n me.openTiles.push(neighbor);\n neighbor.setParentTile(current);\n neighbor.doHeuristic(endTile);\n }\n }else{\n if(neighbor.G>current.G+neighbor.getCost()){\n neighbor.setParentTile(current);\n neighbor.doHeuristic(endTile);\n }\n }\n }\n }\n }//end start to end method\n \n //get each tile's parent starting at the end\n this.connectEndToStart = function(startTile, endTile){\n var path = [];\n var pathNode=endTile;\n while(pathNode!=null){\n path.push(pathNode);\n pathNode = pathNode.parent;\n }\n return path;\n }\n //function that checks to see if a tile is in an array\n this.tileInArray = function(array,tile){\n for(var i =0; i < array.length;i++) if(array[i]==tile)return true;\n return false;\n \n }\n \n}", "traverse()\n\t{\n\t\tlet done = false;\n\t\tlet pos = new Position();\n\t\tlet stack = new Stack();\n\t\tstack.push(pos);\n\n\t\twhile (!(done) && !stack.isEmpty())\n\t\t{\n\t\t\tpos = stack.pop();\n\t\t\tthis.maze.tryPosition(pos.getx(),pos.gety()); // this cell has been tried\n\t\t\tif (pos.getx() == this.maze.getRows()-1 && pos.gety() == this.maze.getColumns()-1)\n\t\t\t\tdone = true; // the maze is solved\n\t\t\telse\n\t\t\t{\n\t\t\t\tthis.pushNewPos(pos.getx() - 1,pos.gety(), stack); // position to the left\n\t\t\t\tthis.pushNewPos(pos.getx() + 1,pos.gety(), stack); // to the right\n\t\t\t\tthis.pushNewPos(pos.getx(),pos.gety() - 1, stack); // above\n\t\t\t\tthis.pushNewPos(pos.getx(),pos.gety() + 1, stack); // below\n\t\t\t}\n\t\t}\n\n\t\treturn done;\n\t}", "function createWorld()\n\n{\n\n\n\n/// create emptiness\n\nfor (var x=0; x < worldWidth+1; x++)\n\n{\n\nworld[x] = [];\n\nfor (var y=0; y < worldHeight+1; y++)\n\n{\n\nworld[x][y] = 1;\n\n\n}\n\n}\n\n\nfor (f = 1; f<= fCount; f++){\n\nfor (b = 1; b<= bCount; b++){\n\n\nworld[b][f] = diamond[f][b].status;\n\n\n}\n\n}\n\n\n\npathStart = [stepB,stepF]\n\ncheckFocus();\n\n\nif (world[pathStart[0]][pathStart[1]] == 0){\n\ncurrentPath = findPath(world,pathStart,pathEnd);\n\n\n\n}\n\n\nredraw();\n\n}", "function board()\r\n{\r\n // function that creats maze grid using a double for loop\r\n // for each itteration for the for loop, it creates a new Vertex with y and x\r\n // it pushes that vertex into LinearVertex arraylist and sets the value to the Index from 0.. nXn\r\n for (var y = 0; y< n; y++)\r\n {\r\n for(var x = 0; x<n; x++)\r\n {\r\n var unit = new vertex(y,x);\r\n unit.value = numOfVertex;\r\n linearVertex.push(unit);\r\n numOfVertex++;\r\n \r\n }\r\n }\r\n\r\n //horizontal edge connection between 2 vertex, \r\n //itterates from top row to bottom row and adds a horizontal edge between 2 vertex in each column \r\n for(var y=0; y<n; y++)\r\n {\r\n for(var x = 0; x< n-1; x++)\r\n {\r\n //random variable r picks value from 0-10 and assigns it as the weight.\r\n //2 edges are created using Vertex1 to vertex2 and Vertex2 to Vertex1 with the same weight \"r\"\r\n //then it pushes the two edges with the corresponding weight into Edges array in the corresponding Grid \"linearVertex\"\r\n var r = Math.floor(Math.random()*10);\r\n var edge1 = new edge(linearVertex[index(y,x)].value, linearVertex[index(y,x+1)].value, r);\r\n var edge2 = new edge(linearVertex[index(y,x+1)].value, linearVertex[index(y,x)].value, r);\r\n linearVertex[index(y,x)].edgeConnection.push(edge1);\r\n linearVertex[index(y,x+1)].edgeConnection.push(edge2); \r\n }\r\n\r\n }\r\n\r\n //Vertical edge connection between 2 vertex, \r\n //itterates from top row to bottom row and adds a vertical edge between 2 vertex in each column \r\n for(var y =0; y< n-1; y++)\r\n {\r\n for(var x = 0; x< n; x++)\r\n {\r\n //random variable r picks value from 0-10 and assigns it as the weight.\r\n //2 edges are created using Vertex1 to vertex2 and Vertex2 to Vertex1 with the same weight \"r\"\r\n //then it pushes the two edges with the corresponding weight into Edges array in the corresponding Grid \"linearVertex\"\r\n var r2 = Math.floor(Math.random()*10);\r\n var edgev1 = new edge(linearVertex[index(y,x)].value,linearVertex[(index(y+1,x))].value,r2);\r\n var edgev2 = new edge(linearVertex[index(y+1,x)].value,linearVertex[(index(y,x))].value,r2);\r\n linearVertex[index(y,x)].edgeConnection.push(edgev1);\r\n linearVertex[index(y+1,x)].edgeConnection.push(edgev2);\r\n\r\n }\r\n }\r\n\r\n\r\n}", "function generateMaze(mainGrid, numRows, numCols){\n // let initialCell \n let grid = copyObjects.copy2dArrayOfObjects(mainGrid);\n let stack = []\n let result = []\n\n // 1. Choose initial node, mark it as visited, and push it to stack\n let initialNode = grid[0][0]; \n initialNode.visited = true;\n stack.push(initialNode)\n\n // 2. While stack is not empty\n while(stack.length > 0){\n console.log('in')\n // 2.1 pop node from stack, make it current node \n let currentNode = stack.pop()\n\n // console.log(`(${currentNode.row},${currentNode.col})`)\n\n let neighbors = getNeighbors(grid, currentNode, numRows, numCols)\n\n // console.log(`==> ${neighbors}`)\n\n // 2.2 if the node has any neighbours which have not been visited\n if(hasUnVisitedNodes(neighbors)){\n //console.log('in')\n // 2.2.1 Push current node to stack\n stack.push(currentNode)\n\n // 2.2.2 Choose one of the unvisited neighbors\n let unvisitedNeighbors = getUnvisitedNeighbors(neighbors);\n let numUnvisitedNeighbors = unvisitedNeighbors.length\n let randomNeighbor = neighbors[Math.floor(Math.random()*numUnvisitedNeighbors)]\n\n // TODO 2.2.3 Remove the wall between the current cell and the chosen cell\n currentNode.isWall = false;\n randomNeighbor.isWall = false;\n\n // 2.2.4 Mark the chosen cell as visited and push it to the stack\n randomNeighbor.visited = true;\n stack.push(randomNeighbor)\n result.push(randomNeighbor)\n\n }\n\n }\n\n // console.log(`This is result from generateMaze: ${result}`)\n return result;\n\n}", "function clydeMove() {\n if (maze[clyde.y-1][clyde.x] ==12) {\n maze[clyde.y][clyde.x] = 12;\n clyde.y = 11;\n maze[clyde.y][clyde.x] = 11;\n } else if (directionC <= 2.5) {\n if (maze[clyde.y][clyde.x-1] ==5) {\n maze[clyde.y][clyde.x] = 2;\n clyde.x = clyde.x - 1;\n maze[clyde.y][clyde.x] = 11;\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n } else if (maze[clyde.y][clyde.x-1] ==6) {\n maze[clyde.y][clyde.x] = 2;\n clyde.x = 26;\n maze[clyde.y][clyde.x] = 11;\n } else if (maze[clyde.y][clyde.x-1] ==1) {\n maze[clyde.y][clyde.x] = 11;\n directionC = Math.random() * 10;\n } else if (maze[clyde.y][clyde.x-1] !==1) {\n maze[clyde.y][clyde.x] = 2;\n clyde.x = clyde.x - 1;\n maze[clyde.y][clyde.x] = 11;\n }\n } else if (directionC > 2.5 && directionC <= 5) {\n if (maze[clyde.y-1][clyde.x] ==5) {\n maze[clyde.y][clyde.x] = 2;\n clyde.y = clyde.y - 1;\n maze[clyde.y][clyde.x] = 11;\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n } else if (maze[clyde.y-1][clyde.x] ==1) {\n maze[clyde.y][clyde.x] = 11;\n directionC = Math.random() * 10;\n } else if (maze[clyde.y-1][clyde.x] !==1) {\n maze[clyde.y][clyde.x] = 2;\n clyde.y = clyde.y - 1;\n maze[clyde.y][clyde.x] = 11;\n }\n } else if (directionC > 5 && directionC <= 7.5) {\n if (maze[clyde.y][clyde.x+1] ==5) {\n maze[clyde.y][clyde.x] = 2;\n clyde.x = clyde.x + 1;\n maze[clyde.y][clyde.x] = 11;\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n } else if (maze[clyde.y][clyde.x+1] ==6) {\n maze[clyde.y][clyde.x] = 2;\n clyde.x = 1;\n maze[clyde.y][clyde.x] = 11;\n } else if (maze[clyde.y][clyde.x+1] ==1) {\n maze[clyde.y][clyde.x] = 11;\n directionC = Math.random() * 10;\n } else if (maze[clyde.y][clyde.x+1] !==1) {\n maze[clyde.y][clyde.x] = 2;\n clyde.x = clyde.x + 1;\n maze[clyde.y][clyde.x] = 11;\n }\n } else if (directionC > 7.5) {\n if (maze[clyde.y+1][clyde.x] ==5) {\n maze[clyde.y][clyde.x] = 2;\n clyde.y = clyde.y + 1;\n maze[clyde.y][clyde.x] = 11;\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n } else if (maze[clyde.y+1][clyde.x] ==4) {\n maze[clyde.y][clyde.x] = 11;\n directionC = Math.random() * 10;\n } else if (maze[clyde.y+1][clyde.x] ==1) {\n maze[clyde.y][clyde.x] = 11;\n directionC = Math.random() * 10;\n } else if (maze[clyde.y+1][clyde.x] !==1) {\n maze[clyde.y][clyde.x] = 2;\n clyde.y = clyde.y + 1;\n maze[clyde.y][clyde.x] = 11;\n }\n }\n }", "function parse_maze(test_board, row, column) {\n\ttest_board[row][column] = SQUARE_FAULT_CLOSED;\n\tif (test_board[row - 1][column] != EDGE_CLOSED && test_board[row - 2][column] != SQUARE_FAULT_CLOSED) {\n\t\tparse_maze(test_board, row - 2, column);\n\t}\n\tif (test_board[row][column - 1] != EDGE_CLOSED && test_board[row][column - 2] != SQUARE_FAULT_CLOSED) {\n\t\tparse_maze(test_board, row, column - 2);\n\t}\n\tif (test_board[row + 1][column] != EDGE_CLOSED && test_board[row + 2][column] != SQUARE_FAULT_CLOSED) {\n\t\tparse_maze(test_board, row + 2, column);\n\t}\n\tif (test_board[row][column + 1] != EDGE_CLOSED && test_board[row][column + 2] != SQUARE_FAULT_CLOSED) {\n\t\tparse_maze(test_board, row, column + 2);\n\t}\n}", "function solver(maze, stack)\n{\n\t\n if(stop)\n {\n return; \n }\n \n var current = stack.peek();\n \n m = current.m;\n n = current.n;\n neighbors = current.neighbors;\n var cell = maze.cells[m][n];\n\n cell.visited = true;\n cell.token.style.backgroundPosition = \"center\"; \n\t cell.token.style.backgroundImage = \"url(image/breadcrumb.png)\";\n \n // see if we're at the exit\n if((m == (columns - 1)) && (n == (rows - 1)))\n {\n stopSolver(); // done\n return;\n } \n \n var found = false;\n \n /* look for a connected neighbor that hasn't been visited yet */\n while(neighbors.length > 0)\n {\n dir = neighbors.pop();\n \n if(cell.wall[dir] == false)\n { \n dm = m + delta.m[dir];\n dn = n + delta.n[dir];\n if(dm >= 0 && dn >= 0 && dm < columns && dn < rows)\n {\n if(maze.cells[dm][dn].visited == false)\n {\n stack.push( { m: dm, n: dn, neighbors: dirs.shuffle() } );\n found = true;\n break;\n }\n }\n } \n }\n \n if(neighbors.length == 0)\n {\n if(found == false)\n {\n stack.pop();\n \n cell.token.style.backgroundImage = \"url(image/checked.png)\";\n }\n }\n \n if(! stop)\n {\n setTimeout(function () { solver(maze, stack) }, 10);\n }\n\t\n}", "move(mapX, mapY) {\n // check if it is a walkable tile\n let walkable = this.dontTreadOnMe();\n if (this.state.healing) {\n walkable[this.state.villager.map[0]-1][this.state.villager.map[1]-1] = 0;\n }\n if (walkable[mapX-1][mapY-1] === 0) {\n // use easy-astar npm to generate array of coordinates to goal\n const startPos = {x:this.state.playerMap[0], y:this.state.playerMap[1]};\n const endPos = {x:mapX,y:mapY};\n const aStarPath = aStar((x, y)=>{\n if (walkable[x-1][y-1] === 0) {\n return true; // 0 means road\n } else {\n return false; // 1 means wall\n }\n }, startPos, endPos);\n let path = aStarPath.map( element => [element.x, element.y]);\n if (this.state.healing) { path.pop() };\n this.setState({moving: true}, () => this.direction(path));\n };\n }", "function reInitMaze() {\n document.getElementsByClassName('mazehole').remove();\n upAndDown = undefined;\n wallNodes.length = 0;\n nodeArray.length = 0;\n nodesForEntryAndExit.length = 0;\n entryNode = undefined;\n exitNode = undefined;\n colordepth = undefined;\n tID = undefined;\n clearInterval(timerId);\n // clearInterval(timerId2);\n timerId = undefined;\n timerId2 = undefined;\n allTiles.length = 0;\n maxRow = undefined;\n maxColumn = undefined;\n isComplete = undefined;\n userChoice = undefined;\n rowsAndColumns = undefined;\n i = undefined;\n index = undefined;\n x = undefined;\n isTile = undefined;\n Orientation = undefined;\n myNode = undefined;\n mazeStepsCounter = 0;\n}", "function Spot(i, j) {\n // Location\n this.i = i;\n this.j = j;\n\n // f, g, and h values for A*\n this.f = 0;\n this.g = 0;\n this.h = 0;\n\n // Neighbors\n this.neighbors = [];\n\n // Where did I come from?\n this.previous = undefined;\n\n // Am I a wall?\n this.wall = false;\n if (random(1) < 0.4) {\n this.wall = true;\n }\n\n // Display me\n this.show = function(col) {\n if (this.wall) {\n fill(0);\n noStroke();\n ellipse(this.i * w + w / 2, this.j * h + h / 2, w / 2, h / 2);\n } else if (col) {\n fill(col);\n rect(this.i * w, this.j * h, w, h);\n }\n };\n\n // Figure out who my neighbors are\n this.addNeighbors = function(grid) {\n var i = this.i;\n var j = this.j;\n if (i < cols - 1) {\n this.neighbors.push(grid[i + 1][j]);\n }\n if (i > 0) {\n this.neighbors.push(grid[i - 1][j]);\n }\n if (j < rows - 1) {\n this.neighbors.push(grid[i][j + 1]);\n }\n if (j > 0) {\n this.neighbors.push(grid[i][j - 1]);\n }\n if (i > 0 && j > 0) {\n this.neighbors.push(grid[i - 1][j - 1]);\n }\n if (i < cols - 1 && j > 0) {\n this.neighbors.push(grid[i + 1][j - 1]);\n }\n if (i > 0 && j < rows - 1) {\n this.neighbors.push(grid[i - 1][j + 1]);\n }\n if (i < cols - 1 && j < rows - 1) {\n this.neighbors.push(grid[i + 1][j + 1]);\n }\n };\n}", "repaint() {\n this.fill_color = background_color;\n this.wall_color = wall_color;\n maze_buff.strokeCap(SQUARE);\n maze_buff.background(this.fill_color);\n\n // Go over all cells in the grid and repaint their left and top walls\n for (let row = 0; row < this.row_count; ++row) {\n for (let col = 0; col < this.col_count; ++col) {\n if (this.has_left_wall(row, col))\n this.vertical_wall(col-1, col, row, row, true);\n else\n this.vertical_wall(col-1, col, row, row, false);\n if (this.has_top_wall(row, col))\n this.horizontal_wall(col, col, row-1, row, true);\n else\n this.horizontal_wall(col, col, row-1, row, false);\n }\n }\n // Then go over the right column to do its right wall\n for (let row = 0; row < this.row_count; ++row) {\n if (this.has_right_wall(row, this.col_count-1))\n this.vertical_wall(this.col_count-1, this.col_count, row, row, true);\n else\n this.vertical_wall(this.col_count-1, this.col_count, row, row, false);\n }\n // And go over the bottom row to do its bottom wall\n for (let col = 0; col < this.col_count; ++col) {\n if (this.has_bot_wall(this.row_count-1, col))\n this.horizontal_wall(col, col, this.row_count-1, this.row_count, true);\n else\n this.horizontal_wall(col, col, this.row_count-1, this.row_count, false);\n }\n }", "function Solver (maze) {\n this.maze = maze\n this.maze.width = parseInt(maze.width)\n this.maze.height = parseInt(maze.height)\n this.path = gen2DArray(this.maze.width, this.maze.height)\n this.visited = gen2DArray(this.maze.width, this.maze.height)\n this.queue = []\n }", "function MazeRenderer($container){\n\t\t\n\t\t/** Disegna lo stadio <maze> nell'elemento <$container> e restituisce un oggetto controller. */\n\t\tthis.render = function(maze, stage){\n\t\t\tvar self = this;\n\t\t\t\n\t\t\t$container.empty();\n\t\t\t\n\t\t\tvar containerW = $container.width();\n\t\t\tvar containerH = $container.height();\n\t\t\t\n\t\t\tvar availableW = containerW - (2*padding);\n\t\t\tvar availableH = containerH - (2*padding);\n\t\t\t\n\t\t\tvar containerTop = $container.offset().top;\n\t\t\tvar caseSize = 0;\n\t\t\tvar mazeSizeW = maze.getWidth();\n\t\t\tvar mazeSizeH = maze.getHeight();\n\t\t\t\n\t\t\tvar maxCaseW = Math.floor(availableW / mazeSizeW);\n\t\t\t\t\n\t\t\tif(maxCaseW * mazeSizeH <= availableH){\n\t\t\t\tcaseSize = maxCaseW;\n\t\t\t} else {\n\t\t\t\tcaseSize = Math.floor(availableH / mazeSizeH);\n\t\t\t}\n\t\t\t\t\n\t\t\tif(caseSize > availableH / 1.1){\n\t\t\t\tcaseSize = Math.floor(availableH / 1.1);\n\t\t\t}\n\t\t\tif(caseSize > availableW / 3){\n\t\t\t\tcaseSize = Math.floor(availableW / 3);\n\t\t\t}\n\t\t\t\t\n\t\t\tvar mazeW = caseSize * mazeSizeW;\n\t\t\tvar mazeH = caseSize * mazeSizeH;\n\t\t\tvar mazeTop = Math.floor((containerH - mazeH) / 2);\n\t\t\tvar mazeLeft = Math.floor((containerW - mazeW) / 2);\n\t\t\t\n\t\t\tvar absMazeT = mazeTop + containerTop;\n\t\t\tvar semiCaseSize = Math.floor(caseSize / 2);\n\t\t\t\n\t\t\tvar $backgroundImage = $('<img alt=\".\" src=\"./img/level/bg.jpg\">');\n\t\t\t$backgroundImage.css({width: containerW + 'px', height: containerH + 'px'});\n\t\t\t\t\t\t\n\t\t\t$container.append($backgroundImage);\n\t\t\t\n\t\t\tvar mazeController = new MazeController(maze, stage);\n\t\t\t\n\t\t\tvar mazeView = new MazeView($container, {\n\t\t\t\tspaceSize: caseSize,\n\t\t\t\tmaze: {\n\t\t\t\t\ttop: mazeTop,\n\t\t\t\t\tleft: mazeLeft,\n\t\t\t\t\twidth: mazeW,\n\t\t\t\t\theight: mazeH,\n\t\t\t\t\tabsT: absMazeT\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\tmazeView.setController(mazeController);\n\t\t\tmazeController.setView(mazeView);\n\t\t\t\n\t\t\tvar spaces = maze.getSpaces();\n\t\t\tfor(var i=0; i<spaces.length; i++){\n\t\t\t\tvar space = spaces[i];\n\t\t\t\t\n\t\t\t\tvar $space = mazeView.createSpace(space);\n\t\t\t\t\n\t\t\t\t$container.append($space);\n\t\t\t\t\n\t\t\t\tvar $plate = mazeView.createPlate(space);\n\t\t\t\t\n\t\t\t\t$container.append($plate);\n\t\t\t}\n\n\t\t\tvar gadgets = maze.getGadgets();\n\t\t\tfor(i=0; i<gadgets.length; i++){\n\t\t\t\tvar gadgetDescription = gadgets[i];\n\t\t\t\t\n\t\t\t\tvar $gadget = mazeView.createGadget(gadgetDescription.gadget, gadgetDescription.position[0], gadgetDescription.position[1], gadgetDescription.fixed);\n\t\t\t\t\n\t\t\t\t$container.append($gadget);\n\t\t\t}\n\t\t\t\n\t\t\tvar doors = maze.getDoors();\n\t\t\tfor(var i=0; i<doors.length; i++){\n\t\t\t\t\n\t\t\t\tvar $door = mazeView.createDoor(doors[i], i);\n\t\t\t\t\n\t\t\t\t$container.append($door);\n\t\t\t}\n\t\t\t\n\t\t\tvar obstacles = maze.getObstacles();\n\t\t\tfor(var i=0; i<obstacles.length; i++){\n\t\t\t\tvar $obstacle = mazeView.createObstacle(obstacles[i], i);\n\t\t\t\t\n\t\t\t\t$container.append($obstacle);\n\t\t\t}\n\t\t\t\n\t\t\t$container.append(mazeView.createDisableInputMask());\n\t\t\t\n\t\t\treturn mazeController;\n\t\t}\n\t\t\n\t}", "draw(){\r\n canvas.width = this.size\r\n canvas.height = this.size\r\n canvas.style.background = \"white\"\r\n curr.has_visited = true\r\n\r\n //show every cell\r\n for(let r = 0; r < this.rows;r++)\r\n for(let c = 0; c < this.cols;c++)\r\n this.mazegrid[r][c].show()\r\n\r\n //get the next cell as one of the current's neighbors\r\n let next = curr.getNeighbors()\r\n\r\n if(next){//if there is another neighbor\r\n next.has_visited=true\r\n this.stack.push(curr)\r\n removeWall(curr,next) //remove the wall between current and next\r\n curr = next\r\n }\r\n else if(this.stack.length>0){ //back-tracker: if there are no more neighbors that need to visited, the stack will pop out a cell that wasn't visited\r\n curr = this.stack.pop()\r\n }\r\n\r\n if(this.stack.length === 0)\r\n return\r\n else this.draw() //recurse until every cell has been visited/ejected from the stack\r\n\r\n }", "generate(){\r\n for(let r = 0; r < this.rows;r++){//for every row\r\n let row = []\r\n for(let c = 0; c < this.cols;c++){//for every column\r\n row.push(new cell(r,c,this)) //push cells into the row\r\n }\r\n this.mazegrid.push(row)//push the rows into the grid\r\n }\r\n curr = this.mazegrid[0][0]\r\n }", "function init() {\n // create the maze\n maze = new Maze(\"maze\", CELLSIZE);\n maze.initCells();\n maze.generateMaze();\n\n // load images and sounds\n goblinWhispering = new Array();\n goblinWhispering.push(preloadSound(\"whisper2.mp3\"));\n goblinWhispering.push(preloadSound(\"whisper3.mp3\"));\n goblinWhispering.push(preloadSound(\"whisper4.mp3\"));\n goblinWhispering.push(preloadSound(\"whisper5.mp3\"));\n goblinWhispering.push(preloadSound(\"whisper6.mp3\"));\n goblinWhispering.push(preloadSound(\"whisper7.mp3\"));\n goblinDeathCry = new Array();\n goblinDeathCry.push(preloadSound(\"deathCry1.mp3\"));\n goblinDeathCry.push(preloadSound(\"deathCry2.mp3\"));\n goblinDeathCry.push(preloadSound(\"deathCry3.mp3\"));\n goblinDeathCry.push(preloadSound(\"deathCry4.mp3\"));\n goblinDeathCry.push(preloadSound(\"deathCry5.mp3\"));\n goblinStuckMsg = new Array();\n goblinStuckMsg.push(preloadSound(\"stuckMsg3.mp3\"));\n goblinStuckMsg.push(preloadSound(\"stuckMsg4.mp3\"));\n bombRechargeSound = preloadSound(\"bombRecharge.mp3\");\n tadaaa = preloadSound(\"tadaaa.mp3\");\n loserSound = preloadSound(\"loser.mp3\");\n portalSuckSound = preloadSound(\"suck.mp3\");\n portalPopSound = preloadSound(\"pop.mp3\");\n zapSound = preloadSound(\"zap.mp3\");\n digSound = preloadSound(\"dig.mp3\");\n retiredSound = preloadSound(\"retired.mp3\");\n goblinAngryDeathCry = preloadSound(\"angryDeathCry.mp3\");\n goblinCackle = preloadSound(\"goblinCackle.mp3\");\n goblinTriumphPic = preloadImage(\"goblinTriumph.png\");\n goblinPics = new Array();\n goblinPics.push(preloadImage(\"goblin0.png\"));\n goblinPics.push(preloadImage(\"goblin1.png\"));\n goblinPics.push(preloadImage(\"goblin2.png\"));\n goblinPics.push(preloadImage(\"goblin3.png\"));\n goblinPics.push(preloadImage(\"goblin4.png\"));\n goblinDigPics = new Array();\n goblinDigPics.push(preloadImage(\"goblindig0.png\"));\n goblinDigPics.push(preloadImage(\"goblindig1.png\"));\n goblinDigPics.push(preloadImage(\"goblindig2.png\"));\n goblinDigPics.push(preloadImage(\"goblindig3.png\"));\n goblinTrapPic = preloadImage(\"goblinTrap.png\");\n goblinGhostlyPic = preloadImage(\"goblinGhostly.png\");\n deadGoblinPic = preloadImage(\"deadgoblin.png\");\n portalInPic = preloadImage(\"portalin.png\");\n portalEffectPic = preloadImage(\"portaleffect.png\");\n portalOutPic = preloadImage(\"portalout.png\");\n treasurePic = preloadImage(\"treasure.png\", function () {\n maze.drawMaze();\n }); // draw maze only after last pic is loaded\n}", "function builder(maze)\n { \n abc( function(column) { return rowInitializer(maze, column) }, columns, \n function() { generator(maze) }); \n }", "function draw() {\r\n\tbackground(53, 74, 35);\r\n\tfor (let i = 0; i < maze_grid.length; i++) {\r\n\t\tmaze_grid[i].displayGrid();\r\n\t}\r\n\r\n\tlet following_unit = current_unit.findAdjcent();\r\n\r\n\tcurrent_unit.visited = true;\r\n\t// console.log(current_unit);\r\n\r\n\tif (complete == false) {\r\n\t\tcurrent_unit.mark();\r\n\t\tif (following_unit) {\r\n\t\t\t// pushes current Unit to the stack for backtracking\r\n\t\t\tmaze_stack.push(current_unit);\r\n\t\t\tclearSide(current_unit, following_unit);\r\n\r\n\t\t\t// sets the current Unit to the following Unit in iteration\r\n\t\t\tfollowing_unit.visited = true;\r\n\t\t\tcurrent_unit = following_unit;\r\n\t\t// if no adjcent cells available then will pop \"backtrack\" until one becomes avaiable\r\n\t\t} else if (maze_stack.length > 0) {\r\n\t\t\tcurrent_unit = maze_stack.pop();\r\n\t\t}\r\n\t}\r\n\r\n\tdetermineComplete(maze_stack);\r\n\r\n\t// displays final path\r\n\tif (complete_path == true) {\r\n\t\tdisplayPath(path_stack)\r\n\t}\r\n\r\n\t// starts path finding process\r\n\tif (complete == true) {\r\n\t\tpath_iteration.pathvisit = true;\r\n\t\tpath_iteration.marksolve();\r\n\r\n\t\tvar following_path = path_iteration.findAdjcentPath();\r\n\t\tif(following_path) {\r\n\t\t\t// pushes current path to the stack for backtracking\r\n\t\t \tpath_stack.push(path_iteration);\r\n\r\n\t\t \t// sets the current path to the following path in iteration\r\n\t\t \tfollowing_path.pathvisit = true;\r\n\t\t \tpath_iteration = following_path;\r\n\t\t } else if(path_stack.length > 0 ) {\r\n\t\t \tpath_iteration = path_stack.pop();\r\n\t\t \tpath_iteration.markbacktrack();\r\n\t\t }\r\n\t}\r\n}" ]
[ "0.76066935", "0.7354995", "0.7127011", "0.6972833", "0.6931987", "0.6923433", "0.6872217", "0.68403685", "0.6839254", "0.66935384", "0.66702247", "0.6612621", "0.65969306", "0.65934485", "0.6585963", "0.65586257", "0.6558258", "0.65507925", "0.6536741", "0.6536082", "0.64988714", "0.6489613", "0.64877003", "0.6487263", "0.64842856", "0.64835787", "0.6461254", "0.6449091", "0.64400405", "0.64137524", "0.6409708", "0.64081824", "0.6407538", "0.6391511", "0.6354978", "0.6342592", "0.6336594", "0.63350374", "0.6315846", "0.6315218", "0.6313649", "0.63018185", "0.62928957", "0.62777334", "0.6260059", "0.6258631", "0.6231756", "0.6227785", "0.62263525", "0.62150294", "0.62089", "0.6193247", "0.6186104", "0.6182469", "0.61813706", "0.61799896", "0.6178507", "0.6173007", "0.61677146", "0.6151637", "0.6137876", "0.6137667", "0.6136432", "0.6117774", "0.6086529", "0.60774624", "0.60761034", "0.60503113", "0.6041861", "0.60372454", "0.6032394", "0.6018361", "0.6013808", "0.6007514", "0.59829694", "0.597349", "0.59343916", "0.5934346", "0.5910761", "0.5909036", "0.59071237", "0.5899138", "0.5884306", "0.58719075", "0.5870002", "0.5867766", "0.5866383", "0.5850814", "0.58299446", "0.58294284", "0.5827192", "0.58212", "0.5819314", "0.5813853", "0.58126235", "0.5810989", "0.580906", "0.5807661", "0.58022416", "0.5801313" ]
0.67638975
9
formula for check neighbors function
function index(i, j){ if(i < 0 || j < 0 || i > cols-1 || j > rows-1){ return -1; } return i + j * cols; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getNeighbors(i, j) {\n\t\tlet neighbors = 0;\n // This section checks above the cell\n //checks up left\n if (i-1 >= 0 && j-1 >= 0 && this.grid[i-1][j-1] > 0){\n neighbors++;\n }\n //checks up\n if (i-1 >= 0 && this.grid[i-1][j] > 0){\n neighbors++;\n }\n //checks up right\n if (i-1 >= 0 && j+1 < this.cols && this.grid[i-1][j+1] > 0){\n neighbors++;\n }\n // This section checks the right and left neighbors\n //checks left\n if (j-1 >= 0 && this.grid[i][j-1] > 0){\n neighbors++;\n }\n //checks right\n if (j+1 < this.cols && this.grid[i][j+1] > 0){\n neighbors++;\n }\n //This section checks below the cell\n //checks down left\n if (i+1 < this.rows && j-1 >= 0 && this.grid[i+1][j-1] > 0){\n neighbors++;\n }\n //checks down\n if (i+1 < this.rows && this.grid[i+1][j] > 0){\n neighbors++;\n }\n //checks down right\n if (i+1 < this.rows && j+1 < this.cols && this.grid[i+1][j+1] > 0){\n neighbors++;\n }\n\t\treturn neighbors;\n\t}", "checkNeighbors(cb) {\n for (let i = 1; i < this.pieces.length - 1; i++) {\n for (let j = 1; j < this.pieces[i].length - 1; j++) {\n //iterate over neighbor nodes\n for (let k = 0; k < this.pieces[i][j].neighbors.length; k++) {\n if (!cb(this.pieces[i][j], this.pieces[i][j].neighbors[k]())) {\n return false;\n }\n }\n }\n }\n return true;\n }", "function neighbours(x1,y1,colour)\r\n{\r\n\treturn neighbours_ext(x1,y1,colour,grid);\r\n}", "_countNeighbours (cellX, cellY) {\n let neighbours = 0\n for (let x = -1; x < 2; x++) {\n for (let y = -1; y < 2; y++) {\n if (this.matrix[(cellX + x + this.sizeX) % this.sizeX][(cellY + y + this.sizeY) % this.sizeY] === 1) {\n neighbours++\n }\n }\n }\n neighbours -= (this.matrix[cellX][cellY] === 1 ? 1 : 0)\n return neighbours\n }", "livingNeighbors(row, col) {\n const neighbors = [\n [row - 1, col - 1],\n [row - 1, col],\n [row - 1, col + 1],\n [row, col - 1],\n [row, col + 1],\n [row + 1, col - 1],\n [row + 1, col],\n [row + 1, col + 1]\n ];\n\n return neighbors.reduce((living, neigh) => {\n let row1 = neigh[0];\n let col1 = neigh[1];\n if (this.board[row1] && this.board[row1][col1]) {\n living++;\n }\n return living;\n }, 0);\n }", "countNeighbours (x, y) {\n\n // the total sum of living neighbours\n let alive = 0;\n\n // loop over the x neighbours\n for (let i = -1; i < 2; ++i) {\n\n // loop over the y neighbours\n for (let j = -1; j < 2; ++j) {\n\n // calculate the x coordinate\n let xPos = (x + i + this.config.get(colsKey)) % this.config.get(colsKey);\n\n // calculate the y pos\n let yPos = (y + j + this.config.get(rowsKey)) % this.config.get(rowsKey);\n\n // count lives\n alive += this.grid.get((xPos + yPos * this.config.get(colsKey)));\n } \n }\n\n // exclude ourselves\n alive -= this.grid.get((x + y * this.config.get(colsKey)));\n\n // return the sum\n return alive;\n }", "neighbors (row, column) {\n let leftColumn = column - 1\n let rightColumn = column + 1\n let upRow = row - 1\n let downRow = row + 1\n \n // Wrap around edges\n if (leftColumn < 1) leftColumn = this.cols\n if (rightColumn > this.cols) rightColumn = 1\n if (upRow < 1) upRow = this.rows\n if (downRow > this.rows) downRow = 1\n \n // neighbors\n return [\n this.cell(upRow, leftColumn),\n this.cell(upRow, column),\n this.cell(upRow, rightColumn),\n this.cell(row, leftColumn),\n this.cell(row, rightColumn),\n this.cell(downRow, leftColumn),\n this.cell(downRow, column),\n this.cell(downRow, rightColumn)\n ]\n }", "function num_of_live_neighbours(game, n, r, c){\n const x = [-1,0,1];\n const y = [-1,0,1];\n let ans = 0;\n for(let i = 0; i < 3; i = i + 1){\n for(let j = 0; j < 3; j = j + 1){\n if(!(i === 1 && j === 1) \n && game[(r+x[i]+n)%n][(c+y[j]+n)%n] === 1){\n ans = ans + 1;\n } else {}\n }\n }\n return ans;\n}", "check2Neighbours(alive, aliveNeighbors){\n return alive && !aliveNeighbors.length < 2;\n }", "livingNeighbors(row, col) {\n // TODO: Return the count of living neighbors.\n\n let livingCount = 0;\n\n\n for (let i = row-1; i < row+2; i++) {\n for (let j = col-1; j< col+2; j++) {\n\n //if this cell exists\n if (!(this.getCell(i,j) === null)) {\n //if neighbor is alive\n if (this.board[i][j] === 1) {\n livingCount++;\n }\n }\n // console.log('current coordinates of neighbors: ', `[${i}][${j}]`)\n }\n }\n\n //if current cell is ME and alive\n\n if (this.board[row][col] === 1) {\n livingCount--;\n }\n\n console.log('current coordinates: ', `[${row}][${col}]`)\n\n console.log(`living count ${livingCount}`);\n return livingCount;\n\n }", "function Neighbours(x, y)\n\n{\n\nvar\n\nN = y - 1,\n\nS = y + 1,\n\nE = x + 1,\n\nW = x - 1,\n\nmyN = N > -1 && canWalkHere(x, N),\n\nmyS = S < worldHeight && canWalkHere(x, S),\n\nmyE = E < worldWidth && canWalkHere(E, y),\n\nmyW = W > -1 && canWalkHere(W, y),\n\nresult = [];\n\nif(myN)\n\nresult.push({x:x, y:N});\n\nif(myE)\n\nresult.push({x:E, y:y});\n\nif(myS)\n\nresult.push({x:x, y:S});\n\nif(myW)\n\nresult.push({x:W, y:y});\n\nfindNeighbours(myN, myS, myE, myW, N, S, E, W, result);\n\nreturn result;\n\n}", "neighbours(){\n var neighbours = []\n neighbours.push(this.neighbour(0,1))\n //neighbours.push(this.neighbour(1,1))\n neighbours.push(this.neighbour(1,0))\n //neighbours.push(this.neighbour(1,-1))\n neighbours.push(this.neighbour(0,-1))\n //neighbours.push(this.neighbour(-1,-1))\n neighbours.push(this.neighbour(-1,0))\n //neighbours.push(this.neighbour(-1,1))\n return neighbours\n }", "getNeighbours(row, col){\n let isTop = (row == 0),\n isBottom = (row == this.rows - 1),\n isLeft = (col == 0),\n isRight = (col == this.cols - 1);\n let neighbours = [[-1, -1], [-1, 0],[-1, 1],[0, -1],[0, 1],[1, -1], [1, 0],[1, 1]];\n // [ -1,-1 -1, 0 -1, 1 ]\n // neighbours [ 0, -1 0, 1 ]\n // [ 1, -1 1, 0 1, 1 ]\n\n\n //IF is top row, removes neightbours above\n if(isTop) {\n neighbours = neighbours.filter(function (e) {\n return e[0] !== -1\n })\n }\n\n if(isBottom){\n neighbours = neighbours.filter(function (e) {\n return e[0] !== 1\n })\n }\n\n if(isLeft){\n neighbours = neighbours.filter(function (e) {\n return e[1] !== -1\n })\n }\n\n if(isRight){\n neighbours = neighbours.filter(function (e) {\n return e[1] !== 1\n })\n }\n\n neighbours.forEach(e => {\n e[0] += row;\n e[1] += col;\n });\n return neighbours;\n }", "liveNeighbors(x, y) {\n x = parseInt(x)\n y = parseInt(y)\n\n let liveNeighbors = 0;\n\n liveNeighbors += this.getCell((x + parseInt(this.width) - 1) % parseInt(this.width), (y + parseInt(this.height) + 1) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width)) % parseInt(this.width), (y + parseInt(this.height) + 1) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width) + 1) % parseInt(this.width), (y + parseInt(this.height) + 1) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width) + 1) % parseInt(this.width), (y + parseInt(this.height)) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width) + 1) % parseInt(this.width), (y + parseInt(this.height) - 1) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width)) % parseInt(this.width), (y + parseInt(this.height) - 1) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width) - 1) % parseInt(this.width), (y + parseInt(this.height) - 1) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width) - 1) % parseInt(this.width), (y + parseInt(this.height)) % parseInt(this.height))\n\n return liveNeighbors\n }", "neighbors(index1, index2) {\n const tile1 = this.getTilePosition(index1);\n const tile2 = this.getTilePosition(index2);\n\n const tile1pos = {x: tile1.x / this.tileWidth, y: tile1.y / this.tileHeight};\n const tile2pos = {x: tile2.x / this.tileWidth, y: tile2.y / this.tileHeight};\n\n if((tile1pos.x == tile2pos.x && Math.abs(tile2pos.y - tile1pos.y) == 1) ||\n (tile1pos.y == tile2pos.y && Math.abs(tile2pos.x - tile1pos.x) == 1) ) {\n return true;\n }\n\n return false;\n if((emptyTile.x == clickedTile.x || emptyTile.y == clickedTile.y) && (clickedTile.x != emptyTile.x || clickedTile.y != emptyTile.y)\n && (Math.abs(emptyTile.x - clickedTile.x) == 1 || Math.abs(emptyTile.y - clickedTile.y) == 1)) {\n\n }\n }", "countNeighbours() {\n\t\tlet c = 0;\n\t\tfor(let x =- 1; x <= 1; x++) {\n\t\t\tfor(let y =- 1; y <= 1; y++) {\n\t\t\t\tlet neighbour = { x: this.x + x, y: this.y + y };\n\t\t\t\tif( this.world.isInside(neighbour.x, neighbour.y) &&\n\t\t\t\t (( neighbour.x !== this.x ) || ( neighbour.y !== this.y )) ) {\n\t\t\t\t\tif(this.world.grid[neighbour.y][neighbour.x].state) c += 1;\n\t\t\t\t\tif(c > 3) return c;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn c;\n\t}", "static getNeighbours(isTop, isBottom, isLeft, isRight) {\n let neighbours = [[-1, -1], [-1, 0],[-1, 1],[0, -1],[0, 1],[1, -1], [1, 0],[1, 1]];\n // [ -1,-1 -1, 0 -1, 1 ]\n // neighbours [ 0, -1 0, 1 ]\n // [ 1, -1 1, 0 1, 1 ]\n\n\n //IF is top row, removes neightbours above\n if(isTop) {\n neighbours = neighbours.filter(function (e) {\n return e[0] !== -1\n })\n }\n\n if(isBottom){\n neighbours = neighbours.filter(function (e) {\n return e[0] !== 1\n })\n }\n\n if(isLeft){\n neighbours = neighbours.filter(function (e) {\n return e[1] !== -1\n })\n }\n\n if(isRight){\n neighbours = neighbours.filter(function (e) {\n return e[1] !== 1\n })\n }\n return neighbours;\n }", "getNeighbors(currentCell) {\n var neighbors = [];\n\n // add logic to get neighbors and add them to the array\n for (var xOffset = -1; xOffset <= 1; xOffset++) {\n for (var yOffset = -1; yOffset <= 1; yOffset++) {\n var neighborColumn = currentCell.column + xOffset;\n var neighborRow = currentCell.row + yOffset;\n\n // do something with neighborColumn and neighborRow\n /* Step 9\n - updated it with isValidPosition\n - Checks to prevent the cell that is the currentCell to be added to the array\n */\n if(this.isValidPosition(neighborColumn, neighborRow)){\n var neighborCell = this.cells[neighborColumn][neighborRow];\n \n if(neighborCell != currentCell){\n neighbors.push(neighborCell);\n }\n }\n }\n}\n\n return neighbors;\n}", "livingNeighbors(row, col) {\n let counter = 0;\n let board = this.board;\n if(board[row][col+1] === 1 && board[row][col-1] === 1){\n counter += 2;\n }\n else{\n if(board[row][col+1] === 1 || board[row][col-1] === 1){\n counter += 1;\n }\n }\n if(board[row-1] !== undefined){\n if(board[row-1][col] === 1){\n counter += 1;\n }\n if(board[row-1][col+1] === 1 && board[row-1][col-1] === 1){\n counter += 2;\n }\n else{\n if(board[row-1][col+1] === 1 || board[row-1][col-1] === 1){\n counter += 1;\n }\n }\n }\n if(board[row+1] !== undefined){\n if(board[row+1][col] === 1){\n counter += 1;\n }\n if(board[row+1][col+1] === 1 && board[row+1][col-1] === 1){\n counter += 2;\n }\n else{\n if(board[row+1][col+1] === 1 || board[row+1][col-1] === 1){\n counter += 1;\n }\n }\n };\n return counter;\n }", "check3Neighbours(alive, aliveNeighbors){\n return alive && aliveNeighbors.length==2 || aliveNeighbors.length==3;\n }", "showNeighbours(){\n\n var currentLevel = levels[gameState.level]; // chosen difficulty level\n \n // iterate over all immediate neighbours\n for(var j = this.y - 1; j <= this.y + 1; j++){ // iterate over all cols\n for(var i = this.x - 1; i <= this.x + 1; i++){ // iterate over all rows\n \n if( i == this.x && j == this.y ) // cell whose neighbours to be checked\n continue;\n \n if( i < 0 || j < 0 || i >= currentLevel.numCols || j >= currentLevel.numRows ) // boundary condition\n continue;\n \n var idx = ((j * currentLevel.numCols) + i); // current neighbour cell idx \n if( grid[idx].currentState == 'hidden' ){\n\n grid[idx].currentState = 'visible'; // update current state\n if(grid[idx].numMines == 0)\n grid[idx].showNeighbours(); // recursive call\n\n }\n }\n }\n }", "getNeighbors(i, j, rows, cols) {\n let neighbors = [];\n if (i > 1) { \n neighbors.push([i - 1, j]); \n }\n if (i < rows - 1) { \n neighbors.push([i + 1, j]); \n }\n if (j > 1){ \n neighbors.push([i, j - 1]); \n }\n if (j < cols - 1) { \n neighbors.push([i, j + 1]); \n }\n return neighbors;\n }", "livingNeighbors(row, column) {\n if (row > this.height - 1 || column > this.width - 1) {\n return 'this is an invalid cell';\n }\n\n let total = 0;\n let neighbors = [];\n\n // On cell's row\n if (this.board[row] !== undefined) {\n let sameRowLeft = this.board[row][column + 1];\n // Omit the cell we are currently on when on it's same row.\n let sameRowRight = this.board[row][column - 1];\n neighbors.push(sameRowLeft, sameRowRight);\n }\n\n // Row directly above\n if (this.board[row - 1] !== undefined) {\n let upperRight = this.board[row - 1][column + 1];\n let upperCenter = this.board[row - 1][column];\n let upperLeft = this.board[row - 1][column - 1];\n neighbors.push(upperRight, upperCenter, upperLeft);\n }\n\n // Row directly below\n if (this.board[row + 1] !== undefined) {\n let lowerRight = this.board[row + 1][column + 1];\n let lowerCenter = this.board[row + 1][column];\n let lowerLeft = this.board[row + 1][column - 1];\n neighbors.push(lowerRight, lowerCenter, lowerLeft);\n }\n\n // Calculates total num of neighbors, omitting undefined cells out of board bounds.\n for (let i = 0; i < neighbors.length; i++) {\n if (neighbors[i] === undefined) {\n continue;\n } else {\n total += neighbors[i];\n }\n }\n\n return total;\n }", "cellsOnNetwork(){\n\t\tvar px = this.C.cellborderpixels.elements, i,j, N, r = {}, t\n\t\tfor( i = 0 ; i < px.length ; i ++ ){\n\t\t\tt = this.C.pixti( px[i] )\n\t\t\tif( r[t] ) continue\n\t\t\tN = this.C.neighi( px[i] )\n\t\t\tfor( j = 0 ; j < N.length ; j ++ ){\n\t\t\t\tif( this.C.pixti( N[j] ) < 0 ){\n\t\t\t\t\tr[t]=1; break\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn r\n\t}", "function identifyNeighbours(x_max,y_max){\n\t \t\tvar traversalIndex = 0;\n\n\t \t\t//inner square\n\t \t\tfor (var i = 0; i < x_max*y_max; i++) {\n\t \t\t\ttraversalIndex = (i % y_max);\n\n\t \t\tif((traversalIndex != 0) && (traversalIndex != (y_max-1)) \n\t \t\t&& (i <= ((y_max)*(x_max-1)-1)) && (i >= y_max+1) ){\n\t \t\t\tspaces[i].adjacentNeighbours = spaces[(i-1)].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[i+1].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[i+y_max].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[i-y_max].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[(i-1)+y_max].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[(i-1)-y_max].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[(i+1)+y_max].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[(i+1)-y_max].holdsMine;\n\t \t\t\tspaces[i].neighbourIndexList.push( (i+1),(i-1),(i+y_max),(i-y_max),\n\t \t\t\t\t\t\t\t\t\t\t\t\t(i-1+y_max),(i-1-y_max),\n\t \t\t\t\t\t\t\t\t\t\t\t\t(i+1+y_max),(i+1-y_max));\n\t\t\t\t}\n\t\t\t// console.log(isNaN(spaces[i].holdsMine))\n\t\t\t}\n\n\t\t\t//four courners\n\t\t\tspaces[0].adjacentNeighbours = spaces[y_max].holdsMine\n\t\t\t\t\t\t\t\t\t + spaces[y_max+1].holdsMine\n\t\t\t\t\t\t\t\t\t + spaces[1].holdsMine;\n\n\t\t\tspaces[0].neighbourIndexList.push(y_max,(y_max+1),1);\n\n\t\t\tspaces[y_max-1].adjacentNeighbours = spaces[(y_max-1) - 1].holdsMine\n\t\t\t\t\t\t\t\t\t\t\t + spaces[(y_max-1) + y_max].holdsMine\n\t\t\t\t\t\t\t\t\t\t\t + spaces[(y_max-1) + y_max-1].holdsMine;\n\n\t\t\tspaces[(y_max-1)].neighbourIndexList.push((y_max-1-1), (y_max-1+y_max), (y_max-1+y_max-1));\n\n\n\t\t\tspaces[y_max*x_max-1].adjacentNeighbours = spaces[(y_max*x_max-1)-1].holdsMine\n\t\t\t\t\t\t\t\t\t\t\t\t + spaces[(y_max*x_max-1)-y_max].holdsMine\n\t\t\t\t\t\t\t\t\t\t\t\t + spaces[(y_max*x_max-1)-(y_max-1)].holdsMine;\n\n\t\t\tspaces[y_max*x_max-1].neighbourIndexList.push((y_max*x_max-1)-1, (y_max*x_max-1)-y_max, (y_max*x_max-1)-(y_max-1));\n\n\n\t\t\tspaces[(x_max *(y_max-1))].adjacentNeighbours = spaces[(x_max *(y_max-1))+ 1].holdsMine\n + spaces[(x_max *(y_max-1))-y_max].holdsMine\n + spaces[(x_max *(y_max-1))-(y_max)+1].holdsMine; \n\n spaces[(x_max *(y_max-1))].neighbourIndexList.push((x_max *(y_max-1))+ 1, (x_max *(y_max-1))-y_max,(x_max *(y_max-1))-(y_max)+1);\n\n\n for(var k = 1; k < y_max-1; k++){\n\n\t\t \t\t//left column\n\t\t \t\tspaces[k].adjacentNeighbours = spaces[k-1].holdsMine\n\t\t \t\t\t\t\t\t\t\t + spaces[k+1].holdsMine\n\t\t \t\t\t\t\t\t\t\t + spaces[k+y_max].holdsMine\n\t\t \t\t\t\t\t\t\t\t + spaces[k+y_max - 1].holdsMine\n\t\t \t\t\t\t\t\t\t\t + spaces[k+y_max + 1].holdsMine;\n\n\t\t \t\tspaces[k].neighbourIndexList.push(k-1,k+1,k+y_max,k+y_max-1,k-y_max+1);\n\n\n\t\t \t\t//right column\n\t\t \t\tspaces[x_max *(y_max-1) + k].adjacentNeighbours = spaces[ (x_max *(y_max-1) + k) + 1].holdsMine\n\t\t \t\t\t\t\t\t\t\t+ spaces[x_max *(y_max-1) + k - 1].holdsMine\n\t\t\t\t\t\t\t\t\t + spaces[x_max *(y_max-1) + k - y_max].holdsMine\n\t\t\t\t\t\t\t\t\t + spaces[x_max *(y_max-1) + k - y_max + 1].holdsMine\n\t\t\t\t\t\t\t\t\t + spaces[x_max *(y_max-1) + k - y_max - 1].holdsMine;\n\n\t\t\t\tspaces[x_max *(y_max-1) + k].neighbourIndexList.push((x_max *(y_max-1) + k) + 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t x_max *(y_max-1) + k - 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t x_max *(y_max-1) + k - y_max,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t x_max *(y_max-1) + k - y_max + 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t x_max *(y_max-1) + k - y_max - 1);\n\t\t \t\t\n\t\t \t\t//top row\n\t\t \t\tspaces[k*y_max].adjacentNeighbours = spaces[k*y_max + 1].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t + spaces[(k+1)*y_max].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t + spaces[(k-1)*y_max].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t + spaces[(k+1)*y_max + 1].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t + spaces[(k-1)*y_max + 1].holdsMine;\n\n\t\t \t\tspaces[k*y_max].neighbourIndexList.push(k*y_max + 1,\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t(k+1)*y_max,\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t(k-1)*y_max,\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t(k+1)*y_max + 1,\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t(k-1)*y_max + 1);\n\n\t\t \t\t//bottom row\n\t\t \t\tspaces[(k+1)*(y_max)-1].adjacentNeighbours = spaces[(k+1)*(y_max)-1 - 1].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t\t\t+ spaces[(k+1)*(y_max)-1 - y_max].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t\t + spaces[(k+1)*(y_max)-1 + y_max].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t\t\t+ spaces[(k+1)*(y_max)-1 - y_max-1].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t\t + spaces[(k+1)*(y_max)-1 +y_max-1].holdsMine;\n\n\n\t\t\t\tspaces[(k+1)*(y_max)-1].neighbourIndexList.push((k+1)*(y_max)-1 - 1,\n\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t (k+1)*(y_max)-1 - y_max,\n\t\t\t\t\t\t\t\t\t\t\t\t (k+1)*(y_max)-1 + y_max,\n\t\t\t\t\t\t\t\t\t\t\t\t (k+1)*(y_max)-1 - y_max-1,\n\t\t\t\t\t\t\t\t\t\t\t\t (k+1)*(y_max)-1 + y_max-1);\n\t \t\t}\n\t \t}", "function getNeighbors(tile){\r\n var indexofTile=tile.index(); //get the index of the cell on the grid\r\n var neighbors=[]; \r\n checknextNeigbor(tile); //call the function to check if there is next neighbor and push it in the array \r\n checkpreviousNeigbor(tile); //call the function to check if there is previous neighbor and push it in the array \r\n //check if cell has up neighbor\r\n if(tile.parent().prev().children().eq(indexofTile).length) { \r\n var upTile=tile.parent().prev().children().eq(indexofTile);\r\n neighbors.push(upTile);\r\n checknextNeigbor(upTile);\r\n checkpreviousNeigbor(upTile);\r\n }\r\n //check if cell has down neighbor\r\n if(tile.parent().next().children().eq(indexofTile).length){\r\n var downTile=tile.parent().next().children().eq(indexofTile);\r\n neighbors.push(downTile);\r\n checknextNeigbor(downTile);\r\n checkpreviousNeigbor(downTile);\r\n \r\n }\r\n function checknextNeigbor(cell){ //the function to check if there is next neighbor and push it in the array \r\n if(cell.next().length){ //check if cell has next neighbor\r\n neighbors.push(cell.next()); \r\n }}\r\n function checkpreviousNeigbor(cell){ //the function to check if there is previous neighbor and push it in the array \r\n if(cell.prev().length){ //check if cell has next neighbor\r\n neighbors.push(cell.prev()); \r\n }}\r\n return neighbors; //return neighbors of certain cell\r\n}", "getNeighbors(currentCells) {\n this.numNeighbors = 0;\n if (inGrid(currentCells, this.y - 1, this.x - 1)) {\n if (currentCells[this.y - 1][this.x - 1].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y - 1, this.x)) {\n if (currentCells[this.y - 1][this.x].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y - 1, this.x + 1)) {\n if (currentCells[this.y - 1][this.x + 1].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y, this.x - 1)) {\n if (currentCells[this.y][this.x - 1].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y, this.x + 1)) {\n if (currentCells[this.y][this.x + 1].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y + 1, this.x - 1)) {\n if (currentCells[this.y + 1][this.x - 1].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y + 1, this.x)) {\n if (currentCells[this.y + 1][this.x].alive) {\n this.numNeighbors++;\n }\n }\n if (inGrid(currentCells, this.y + 1, this.x + 1)) {\n if (currentCells[this.y + 1][this.x + 1].alive) {\n this.numNeighbors++;\n }\n }\n }", "visitedNeighbors() {\n for (var i = 0; i < this.neighbors.length; i++) {\n if(!this.neighbors[i].visited) {\n return false;\n }\n }\n return true;\n }", "livingNeighbors(row, col) {\n // TODO: Return the count of living neighbors.\n //given cells position, return number of living neighbors\n\n // get cell then go to living neighbors\n\n return (\n //row above\n this.getCell(row - 1, col - 1) +\n this.getCell(row - 1, col) +\n this.getCell(row - 1, col + 1) +\n //left and right\n this.getCell(row, col - 1) +\n this.getCell(row, col + 1) +\n //row below\n this.getCell(row + 1, col - 1) +\n this.getCell(row + 1, col) +\n this.getCell(row + 1, col + 1)\n );\n }", "getNeighbors(){\n\n var offSetDir = [\n [[-1,-1], [-1, 0], [0,1], [1, 0], [1,-1], [0, -1]],\n [[-1, 0], [-1, 1], [0,1], [1,1], [1, 0], [0, -1]]\n ]\n var parity = this.index.row % 2;\n var neighbors = []\n for(var i = 0; i<6; i++){\n var assocNeighbor = {row: this.index.row + offSetDir[parity][i][0], col: this.index.col + offSetDir[parity][i][1]}\n if(assocNeighbor.row>=0 && assocNeighbor.row < this.board.numRows){\n if(assocNeighbor.col>=0 && assocNeighbor.col< this.board.numColumns){\n if(this.board.getHex(assocNeighbor.row, assocNeighbor.col)!=undefined && this.board.getHex(assocNeighbor.row, assocNeighbor.col).identifier.name== this.identifier.name){\n neighbors.push(this.board.getHex(assocNeighbor.row, assocNeighbor.col));\n\n }\n }\n }\n }\n return neighbors;\n }", "getNeighborsCount( x, y ){\n\n let neighborsCnt = 0;\n for (let neighborX = x - 1; neighborX <= x + 1; neighborX++){\n for (let neighborY = y - 1; neighborY <= y + 1; neighborY++){\n\n if ((neighborX === x && neighborY === y) ||\n neighborX < 0 || neighborY < 0 ||\n neighborX >= this.boardWidth || neighborY >= this.boardHeight){\n\n continue\n\n }\n\n if (this.board[neighborX][neighborY] === ALIVE){\n neighborsCnt += 1;\n }\n\n }\n }\n\n return neighborsCnt\n }", "findNeighbors(i, j) {\n this.Neighbors.enumerate().forEach(neighbor => {\n let yOffset;\n let xOffset;\n let piece = this.pieces[i][j];\n let point = new Point(piece.point.x + this.Neighbors[neighbor].x, piece.point.y + this.Neighbors[neighbor].y);\n let check = this.hashmap.getPointFromMap(point, this.pieces);\n if (check !== null) {\n this.pieces[i][j].neighbors.push(\n () => this.hashmap.getPointFromMap(point, this.pieces)\n //check\n );\n }\n });\n }", "neighborCount(mtx, x, y) {\n var count = 0;\n for (var i = -1 ; i <= 1 ; i++) {\n for (var j = -1 ; j <= 1 ; j++) {\n if ((0 < (x+i)) && ((x+i) < this.width)\n && (0 < (y+j)) && ((y+j) < this.height)) {\n if (0 != mtx[y+j][x+i]) {\n count += 1;\n }\n }\n }\n }\n if (0 < count) {\n console.log(\"neighborCount(\", x, y, \") = \", count);\n }\n return count;\n }", "function countAliveNeighbours(map, x, y)\n{\n var count = 0;\n for (var i = -1; i < 2; i++)\n {\n for (var j = -1; j < 2; j++)\n {\n var nb_x = i + x;\n var nb_y = j + y;\n if (i === 0 && j === 0)\n {\n }\n //If it's at the edges, consider it to be solid (you can try removing the count = count + 1)\n else if (nb_x <= 0 || nb_y <= 0 || nb_x >= map[0].length - 2 || nb_y >= map.length - 2)\n count = count + 1;\n else if (map[nb_y][nb_x] === 1)\n count = count + 1;\n }\n }\n return count;\n}", "function countAliveNeighbours(x, y) {\r\n var alive_neighbours = 0;\r\n\r\n function _isFilled(x, y) {\r\n return world[x] && world[x][y];\r\n }\r\n\r\n if (_isFilled(x-1, y-1)) alive_neighbours++;\r\n if (_isFilled(x, y-1)) alive_neighbours++;\r\n if (_isFilled(x+1, y-1)) alive_neighbours++;\r\n if (_isFilled(x-1, y )) alive_neighbours++;\r\n if (_isFilled(x+1, y )) alive_neighbours++;\r\n if (_isFilled(x-1, y+1)) alive_neighbours++;\r\n if (_isFilled(x, y+1)) alive_neighbours++;\r\n if (_isFilled(x+1, y+1)) alive_neighbours++;\r\n\r\n return alive_neighbours;\r\n}", "function neighborSum(cell, i, j) {\r\n this.cell = cell;\r\n this.i = i;\r\n this.j = j;\r\n var sum = 0;\r\n if(cellArray[i - 1][j - 1].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i][j - 1].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i - 1][j].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i + 1][j - 1].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i - 1][j + 1].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i + 1][j].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i][j + 1].alive == true) {\r\n sum += 1;\r\n }\r\n if(cellArray[i + 1][j + 1].alive == true) {\r\n sum += 1;\r\n }\r\n return sum;\r\n}", "function countNeighbours(x, y) {\n var aliveNeighbors = 0\n\n // If the cell is alive, it will have a value of 1 or 2. Otherwise it will be 0.\n // This may be improved to wrap around the board, but currently the edges are the end\n // of the universe\n function alive(x, y) {\n return cells[x] && cells[x][y]\n }\n\n // Checking 8 surrounding cells\n if (alive(x, y + 1)) aliveNeighbors++ // N cell\n if (alive(x + 1, y + 1)) aliveNeighbors++ // NE cell\n if (alive(x + 1, y)) aliveNeighbors++ // E cell\n if (alive(x + 1, y - 1)) aliveNeighbors++ // SE cell\n if (alive(x, y - 1)) aliveNeighbors++ // S cell\n if (alive(x - 1, y - 1)) aliveNeighbors++ // SW cell\n if (alive(x - 1, y)) aliveNeighbors++ // W cell\n if (alive(x - 1, y + 1)) aliveNeighbors++ // NW cell\n\n return aliveNeighbors\n }", "function shouldChange (x, y, cell, input) {\n\tneighbours = [];\n\tfor (let i = 0; i < 8; i++) {\n\t\tlet neigh_x = x + directions[i].dx\n\t\tlet neigh_y = y + directions[i].dy\n\t\tlet neighbour = input[neigh_y]?.[neigh_x];\n\t\tif (neighbour){\n\t\t\twhile (neighbour == '.') {\n\t\t\t\tneigh_x += directions[i].dx;\n\t\t\t\tneigh_y += directions[i].dy\t;\n\t\t\t\tneighbour = input[neigh_y]?.[neigh_x];\n\t\t\t}\n\t\t\tneighbours.push(neighbour);\n\t\t}\n\t}\n\tif ((cell === 'L' && !neighbours.includes(\"#\")) || (cell === '#' && neighbours.filter(v => v === '#').length >= 5)){\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n\n}", "static isNeighbour(grid, cell, val) {\n let inrow = this.isInRow(grid, cell, val);\n let incol = this.isInCol(grid, cell, val);\n let inbox = this.isInBox(grid, cell, val);\n return inrow || incol || inbox;\n }", "function findNeighbours(matrix){\r\n let count = 0;\r\n\r\n let rows = matrix.length;\r\n let cols = matrix[0].length;\r\n\r\n //check verticals\r\n for(let r = 0; r<rows-1; r++){\r\n for(let c = 0; c<cols; c++){\r\n if(matrix[r][c] == matrix[r+1][c]){\r\n count++;\r\n }\r\n }\r\n }\r\n\r\n //check horizonals\r\n for(let r = 0; r<rows; r++){\r\n for(let c = 0; c<cols-1; c++){\r\n if(matrix[r][c] == matrix[r][c+1]){\r\n count++;\r\n }\r\n }\r\n }\r\n\r\n return count;\r\n}", "checkIfNeighborsAreWithingBoundry(boundry, hexesChecked, innerSet){\n //if we are on an edge\n //return false if at any point during the recursion we find that we've reached an edge, this means it is impossible for it to be full now\n //console.log(\"recurse on: \" + this.index.col + \", \"+ this.index.row)\n if(this.index.row == this.board.numRows-1 || this.index.row == 0){\n return false;\n }\n else if(this.index.col == this.board.numColumns-1 || this.index.col == 0){\n return false;\n }\n //ok, we are not an edge, now we can recurse to see if our neighbors are ok\n //\n var neighbors = this.getAllNeighbors();\n var newHexChecked = [];\n for(var i = 0; i< hexesChecked.length; i++){\n newHexChecked.push(hexesChecked[i]);\n }\n var foundDeadEnd = false;\n for(var i = 0; i<neighbors.length; i++){\n\n //if neighbors haven't been checkked or aren't in the already checked list\n if(!hexesChecked.includes(neighbors[i]) && !boundry.includes(neighbors[i])){\n newHexChecked.push(neighbors[i]);\n //neighbors[i].checkIfNeighborsAreWithingBoundry(boundry, newHexChecked, testSet);\n\n if(!neighbors[i].checkIfNeighborsAreWithingBoundry(boundry, newHexChecked, innerSet)){\n foundDeadEnd = true;\n return false;\n }\n }\n }\n if(!foundDeadEnd){\n innerSet.add(this);\n\n return true;\n }else{\n return false;\n }\n\n\n\n\n }", "getValidNeighbors(row, col) {\n const arr = [];\n this.addValidNeighbor(arr, row + 2, col + 1);\n this.addValidNeighbor(arr, row + 1, col + 2);\n this.addValidNeighbor(arr, row - 1, col + 2);\n this.addValidNeighbor(arr, row - 2, col + 1);\n this.addValidNeighbor(arr, row - 2, col - 1);\n this.addValidNeighbor(arr, row - 1, col - 2);\n this.addValidNeighbor(arr, row + 1, col - 2);\n this.addValidNeighbor(arr, row + 2, col - 1);\n return arr;\n }", "function getNeighbors(x, y) {\n // 8 possible vectors\n const vectors = [ {x:-1, y:-1}, {x:0, y:-1}, {x:1, y:-1}, {x:-1, y:0}, {x:1, y:0}, {x:-1, y:1}, {x:0, y:1}, {x:1, y:1}]\n const neighbors = [];\n \n vectors.forEach( v => {\n let newX = x + v.x\n let newY = y + v.y\n if(isValidCoordinate(newX, newY)) {\n neighbors.push( getIndex( newX, newY ))\n }\n }) \n return neighbors\n}", "function neighbors(x) {\n var n = [\n {i: x.i - 1, j: x.j - 1}, // upleft\n {i: x.i - 1, j: x.j}, // upmiddle\n {i: x.i - 1, j: x.j + 1}, // upright\n {i: x.i, j: x.j - 1}, // left\n {i: x.i, j: x.j + 1}, // right\n {i: x.i + 1, j: x.j - 1}, // downleft\n {i: x.i + 1, j: x.j}, // downmiddle\n {i: x.i + 1, j: x.j + 1} // downright\n ];\n\n return n.filter(function (e){\n return isInGrid(e);\n });\n }", "function neighborsThatAreWalls( neighbors, walls )\n{\n var neighboringWalls = 0;\n for( var k = 0; k < neighbors.length; k++ )\n {\n var i = neighbors[k][0];\n var j = neighbors[k][1];\n if( walls[i][j] ) \n neighboringWalls++;\n }\n return neighboringWalls;\n}", "function countNeighbours(data, row, col) {\n var r = 0;\n\n for (var i = row - 1; i <= row + 1; ++i) {\n for (var j = col - 1; j <= col + 1; ++j) {\n r += (data[i] && data[i][j] ? data[i][j] : 0);\n }\n }\n \n return r - data[row][col];\n}", "checkNeighbors(x, y) {\n this.current.closed = true;\n if (currentMaze.cellGrid[x][y].down) {\n this.checkNode(x, y - 1);\n }\n if (currentMaze.cellGrid[x][y].right) {\n this.checkNode(x + 1, y);\n }\n if (currentMaze.cellGrid[x][y].left) {\n this.checkNode(x - 1, y);\n }\n if (currentMaze.cellGrid[x][y].up) {\n this.checkNode(x, y + 1);\n }\n }", "checkMorethan3Neighbours(alive, aliveNeighbors){\n return alive && aliveNeighbors.length <3;\n }", "function calculate_Neighbors (x_index, y_index) {\n return [\n [x_index - 1, y_index + 1, \"NW\"],\n [x_index, y_index + 1, \"N\"],\n [x_index + 1, y_index + 1, \"NE\"],\n [x_index - 1, y_index, \"W\"],\n [x_index + 1, y_index, \"E\"],\n [x_index - 1, y_index - 1, \"SW\"],\n [x_index, y_index - 1, \"S\"],\n [x_index + 1, y_index - 1, \"SE\"],\n ]\n}", "findNeighbors(cell, filterVisited = false) {\n let neighbors = [];\n for (let i = 0; i < 4; i++) {\n switch (i) {\n case TOP : {\n let neighbor = this.cells[this.index(cell.x + 0, cell.y - 1)];\n if (neighbor && (!filterVisited || (filterVisited && !neighbor.visited))) neighbors.push(neighbor);\n break;\n }\n case RIGHT : {\n let neighbor = this.cells[this.index(cell.x + 1, cell.y + 0)];\n if (neighbor && (!filterVisited || (filterVisited && !neighbor.visited))) neighbors.push(neighbor);\n break;\n }\n case BOTTOM : {\n let neighbor = this.cells[this.index(cell.x + 0, cell.y + 1)];\n if (neighbor && (!filterVisited || (filterVisited && !neighbor.visited))) neighbors.push(neighbor);\n break;\n }\n case LEFT : {\n let neighbor = this.cells[this.index(cell.x - 1, cell.y + 0)];\n if (neighbor && (!filterVisited || (filterVisited && !neighbor.visited))) neighbors.push(neighbor);\n break;\n }\n }\n }\n return neighbors;\n }", "FindNeighbours()\n {\n var AllPlayers = ListMembers.GetAllMembers();\n\n for (var curPlyr = 0; curPlyr != AllPlayers.length; curPlyr++)\n {\n //first clear any current tag\n AllPlayers[curPlyr].Steering().UnTag();\n\n //work in distance squared to avoid sqrts\n var to = new Phaser.Point(AllPlayers[curPlyr].Pos().x - this.m_pPlayer.Pos().x,\n AllPlayers[curPlyr].Pos().y - this.m_pPlayer.Pos().y);\n\n if (to.getMagnitudeSq() < (this.m_dViewDistance * this.m_dViewDistance))\n {\n AllPlayers[curPlyr].Steering().Tag();\n }\n }//next\n }", "FindNeighbours()\n {\n var AllPlayers = ListMembers.GetAllMembers();\n\n for (var curPlyr = 0; curPlyr != AllPlayers.length; curPlyr++)\n {\n //first clear any current tag\n AllPlayers[curPlyr].Steering().UnTag();\n\n //work in distance squared to avoid sqrts\n var to = new Phaser.Point(AllPlayers[curPlyr].Pos().x - this.m_pPlayer.Pos().x,\n AllPlayers[curPlyr].Pos().y - this.m_pPlayer.Pos().y);\n\n if (to.getMagnitudeSq() < (this.m_dViewDistance * this.m_dViewDistance))\n {\n AllPlayers[curPlyr].Steering().Tag();\n }\n }//next\n }", "function neighborsThatAreWalls( neighbors, walls ){\n\tvar neighboringWalls = 0;\n\tfor (var k = 0; k < neighbors.length; k++){\n\t\tvar i = neighbors[k][0];\n\t\tvar j = neighbors[k][1];\n\t\tif (walls[i][j]) { neighboringWalls++; }\n\t}\n\treturn neighboringWalls;\n}", "function neighborsThatAreWalls( neighbors, walls ){\n\tvar neighboringWalls = 0;\n\tfor (var k = 0; k < neighbors.length; k++){\n\t\tvar i = neighbors[k][0];\n\t\tvar j = neighbors[k][1];\n\t\tif (walls[i][j]) { neighboringWalls++; }\n\t}\n\treturn neighboringWalls;\n}", "countMines() {\n if (this.mine) {\n this.neighborCount = 1;\n return;\n }\n \n var total = 0;\n for (var xoff = -1; xoff <= 1;xoff++ ) {\n var i = this.i + xoff;\n if (i < 0 || i >= this.cols) continue;\n \n for (var yoff = -1; yoff <= 1; yoff++) {\n var j = this.j + yoff;\n if (j < 0 || j >= this.rows) continue;\n // \n var neighbor = this.grid[i][j];\n this.neighbourCells.push(neighbor)\n if (neighbor.mine) {\n total++;\n }\n }\n }\n this.neighborCount = total;\n }", "function calculateNeighbors(maze) {\n maze.forEach( function(row, x) {\n row.forEach( function(ele, y) {\n if ( ele.wall ) return;\n\n for ( let i = x - 1; i <= x + 1; i++ ) {\n for (let j = y - 1; j <= y + 1; j++) {\n if (i == x && j == y) continue;\n\n if ( inBounds(i, j) ) {\n let neighbor = maze[i][j];\n if ( !neighbor.wall ) ele.neighbors.push( neighbor );\n }\n }\n }\n\n function inBounds(x, y) {\n return !!(x >= 0 && x < maze.length\n && y >= 0 && y < maze[0].length)\n }\n });\n });\n }", "hasAllMineNeighbor(i, j) {\n return this.computeEffectiveLabels(i, j) === this.getUnMarkedNeighbors(i, j).length;\n }", "function calcLivingNeighborsDev(row, col)\n{\n var numLivingNeighbors = 0;\n\n // DEPENDING ON THE TYPE OF CELL IT IS WE'LL CHECK\n // DIFFERENT ADJACENT CELLS\n var cellType = determineCellTypeDev(row, col);\n var cellsToCheck = cellLookupDev[cellType];\n for (var counter = 0; counter < (cellsToCheck.numNeighbors * 2); counter+=2)\n {\n var neighborCol = col + cellsToCheck.cellValues[counter];\n var neighborRow = row + cellsToCheck.cellValues[counter+1];\n var index = (neighborRow * gridWidthDev) + neighborCol;\n var neighborValue = updateLifeGridDev[index];\n if (neighborValue === BAD_CELL_DEV || neighborValue === GOOD_CELL_DEV) {\n // Neighbor cell value is 3, so only increase number of neighbors by 1\n numLivingNeighbors += 1;\n }\n\n }\n return numLivingNeighbors;\n}", "function onlineDisconnectNeighbours(fila, columna, up, down, left, right)\n{\n var maxF = config.height / 40, maxC = config.width / 40;\n if (fila + 1 < maxF) {\n if (down) {\n sc_juegoOnline.adjacencyMatrix[fila + 1][columna][fila][columna] = INF;\n } else {\n sc_juegoOnline.adjacencyMatrix[fila + 1][columna][fila][columna] = 1;\n }\n }\n \n if (fila + 1 < maxF && columna + 1 < maxC)\n sc_juegoOnline.adjacencyMatrix[fila + 1][columna + 1][fila][columna] = INF;\n\n if (fila + 1 < maxF && columna - 1 >= 0)\n sc_juegoOnline.adjacencyMatrix[fila + 1][columna - 1][fila][columna] = INF;\n\n if (columna + 1 < maxC) {\n if (right) {\n sc_juegoOnline.adjacencyMatrix[fila][columna + 1][fila][columna] = INF;\n } else {\n sc_juegoOnline.adjacencyMatrix[fila][columna + 1][fila][columna] = 1;\n }\n }\n \n if (columna - 1 >= 0) {\n if (left) {\n sc_juegoOnline.adjacencyMatrix[fila][columna - 1][fila][columna] = INF;\n } else {\n sc_juegoOnline.adjacencyMatrix[fila][columna - 1][fila][columna] = 1;\n }\n }\n \n if (fila - 1 >= 0 && columna + 1 < maxC)\n sc_juegoOnline.adjacencyMatrix[fila - 1][columna + 1][fila][columna] = INF;\n\n if (fila - 1 >= 0) {\n if (up) {\n sc_juegoOnline.adjacencyMatrix[fila - 1][columna][fila][columna] = INF;\n } else {\n sc_juegoOnline.adjacencyMatrix[fila - 1][columna][fila][columna] = 1;\n }\n }\n \n if (fila - 1 >= 0 && columna - 1 >= 0)\n sc_juegoOnline.adjacencyMatrix[fila - 1][columna - 1][fila][columna] = INF;\n}", "function countLiveNeighbors(grid, row, col) {\r\n var count = 0;\r\n var countInf = 0;\r\n //go through neighbors\r\n for (var i = row - 1; i <= row + 1; i += 1) {\r\n for (var j = col - 1; j <= col + 1; j += 1) {\r\n //check boundary\r\n if (validPosition(i, j)) {\r\n //count\r\n if (!grid[i][j].dead) {\r\n count = count + 1;\r\n } \r\n }\r\n }\r\n }\r\n //avoid the points that are being checked to be count \r\n if (!grid[row][col].dead) {\r\n count = count - 1;\r\n }\r\n \r\n \r\n return count;\r\n \r\n }", "getNeighbors(grid, d, isWall) {\n // Could be a property of the class?\n let moves = [[-d,0],[0,d],[d,0],[0,-d]];\n let neighbors = [];\n for (let move of moves) {\n\n const [row,col] = move;\n let nr = row + this.y;\n let nc = col + this.x;\n\n //if it is or is not a wall, then we add this to our valid neighbors array;\n if(isValidLocation(grid,nr,nc) && \n (isWall === grid[nr][nc].isWall)) {\n\n neighbors.push(grid[nr][nc]);\n }\n }\n \n return neighbors\n }", "function getNeighbors (cell) {\n var x = cell[0], y = cell[1];\n return [\n [x - 1, y + 1], [x, y + 1], [x + 1, y + 1],\n [x - 1, y ], [x + 1, y ],\n [x - 1, y - 1], [x, y - 1], [x + 1, y - 1]\n ];\n }", "addNeighbors() {\n let i = this.r;\n let j = this.c;\n if (i > 0) this.neighbors.push(grid[i - 1][j]);\n if (i < n - 1) this.neighbors.push(grid[i + 1][j]);\n if (j > 0) this.neighbors.push(grid[i][j - 1]);\n if (j < m - 1) this.neighbors.push(grid[i][j + 1]);\n }", "function Neighbours(x, y) {\n\t var N = y - 1,\n\t S = y + 1,\n\t E = x + 1,\n\t W = x - 1,\n\t myN = N > -1 && canWalkHere(x, N),\n\t myS = S < worldHeight && canWalkHere(x, S),\n\t myE = E < worldWidth && canWalkHere(E, y),\n\t myW = W > -1 && canWalkHere(W, y),\n\t result = [];\n\t if (myN) result.push({ x: x, y: N });\n\t if (myE) result.push({ x: E, y: y });\n\t if (myS) result.push({ x: x, y: S });\n\t if (myW) result.push({ x: W, y: y });\n\t findNeighbours(myN, myS, myE, myW, N, S, E, W, result);\n\t return result;\n\t }", "function checkNeighbours(col, row, id){\r\n\tfor (var i = 0; i<NEIGHBOURS.length; i++){\r\n\t\tvar ncol = col + NEIGHBOURS[i][0];\r\n\t\tvar nrow = row + NEIGHBOURS[i][1];\r\n\t\tif (outOfRange(ncol, nrow)) continue;\r\n\t\tvar value = game_field[nrow][ncol];\r\n\t\tif (value != id && value != EMPTY && value != DUMMY){\r\n\t\t\tgame_field[nrow][ncol] = id;\r\n\t\t}\r\n\t}\r\n}", "updateNeighbors(currentCells) {\n if (inGrid(currentCells, this.y - 1, this.x - 1)) {\n if (this.alive) {\n currentCells[this.y - 1][this.x - 1].numNeighbors++;\n } else {\n currentCells[this.y - 1][this.x - 1].numNeighbors--;\n }\n }\n if (inGrid(currentCells, this.y - 1, this.x)) {\n if (this.alive) {\n currentCells[this.y - 1][this.x].numNeighbors++;\n } else {\n currentCells[this.y - 1][this.x].numNeighbors--;\n }\n }\n if (inGrid(currentCells, this.y - 1, this.x + 1)) {\n if (this.alive) {\n currentCells[this.y - 1][this.x + 1].numNeighbors++;\n } else {\n currentCells[this.y - 1][this.x + 1].numNeighbors--;\n }\n }\n if (inGrid(currentCells, this.y, this.x - 1)) {\n if (this.alive) {\n currentCells[this.y][this.x - 1].numNeighbors++;\n } else {\n currentCells[this.y][this.x - 1].numNeighbors--;\n }\n }\n if (inGrid(currentCells, this.y, this.x + 1)) {\n if (this.alive) {\n currentCells[this.y][this.x + 1].numNeighbors++;\n } else {\n currentCells[this.y][this.x + 1].numNeighbors--;\n }\n }\n if (inGrid(currentCells, this.y + 1, this.x - 1)) {\n if (this.alive) {\n currentCells[this.y + 1][this.x - 1].numNeighbors++;\n } else {\n currentCells[this.y + 1][this.x - 1].numNeighbors--;\n }\n }\n if (inGrid(currentCells, this.y + 1, this.x)) {\n if (this.alive) {\n currentCells[this.y + 1][this.x].numNeighbors++;\n } else {\n currentCells[this.y + 1][this.x].numNeighbors--;\n }\n }\n if (inGrid(currentCells, this.y + 1, this.x + 1)) {\n if (this.alive) {\n currentCells[this.y + 1][this.x + 1].numNeighbors++;\n } else {\n currentCells[this.y + 1][this.x + 1].numNeighbors--;\n }\n }\n }", "function countNeighboursAlive(board, row, column, rules) {\n var neighbour = 0;\n let tempRow = 0;\n let tempCol = 0;\n let aliveCount = 0;\n\n // check each neighbour\n while (neighbour < NEIGHBOURSCOUNT) {\n tempRow = row + NeighboursCord[neighbour][0];\n tempCol = column + NeighboursCord[neighbour][1];\n // check if current neighbour's row is valid\n if (tempRow > -1 && tempRow < rules.ROW) {\n // check if current neighbour's column is valid\n if (tempCol > -1 && tempCol < rules.COLUMN) {\n if (board[tempRow][tempCol] == rules.ALIVE) aliveCount++;\n }\n }\n neighbour++;\n }\n return aliveCount;\n}", "function neighboring(a, b) {\n console.log(a);\n console.log(b);\n console.log(linkedByIndex);\n return linkedByIndex[a.id + \",\" + b.id] || linkedByIndex[b.id + \",\" + a.id] || a.id == b.id;\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 getNeighbourCount(x, y) {\n\tlet count = 0;\n\tfor (let yy = -1; yy < 2; yy++) {\n\t\tfor (let xx = -1; xx < 2; xx++) {\n\t\t\tif (xx === 0 && yy === 0) continue;\n\t\t\tif (x + xx < 0 || x + xx > resolution - 1) continue;\n\t\t\tif (y + yy < 0 || y + yy > resolution - 1) continue;\n\t\t\tif (cells[x + xx][y + yy]) count++;\n\t\t}\n\t}\n\treturn count;\n}", "function countNeighbours(data, row, col) {\n\tlet neighborCount = 0; // number of neighbors of the given cell\n\tconst rowLen = data[0].length; // max row size\n\tconst colLen = data.length; // max col size\n\tconst neighbors = []; // holds all valid neighbors of the given cell\n\n\t// define the immediate neighbors for the given cell\n\tlet topLeft;\n\tlet topCenter;\n\tlet topRight;\n\tlet midLeft;\n\tlet midRight;\n\tlet bottomLeft;\n\tlet bottomCenter;\n\tlet bottomRight;\n\n\t// find valid neighbors in the row above the current cell\n\tif (row - 1 >= 0) {\n\t\ttopCenter = data[row - 1][col];\n\t\tneighbors.push(topCenter);\n\t\tif (col - 1 >= 0) {\n\t\t\ttopLeft = data[row - 1][col - 1];\n\t\t\tneighbors.push(topLeft);\n\t\t}\n\n\t\tif (col + 1 < colLen) {\n\t\t\ttopRight = data[row - 1][col + 1];\n\t\t\tneighbors.push(topRight);\n\t\t}\n\t}\n\t// find valid neigbors in the same row of the current cell\n\tif (col - 1 >= 0) {\n\t\tmidLeft = data[row][col - 1];\n\t\tneighbors.push(midLeft);\n\t}\n\n\tif (col + 1 < colLen) {\n\t\tmidRight = data[row][col + 1];\n\t\tneighbors.push(midRight);\n\t}\n\t// find valid neighbors in the row below the current cell\n\tif (row + 1 < rowLen) {\n\t\tbottomCenter = data[row + 1][col];\n\t\tneighbors.push(bottomCenter);\n\t\tif (col - 1 >= 0) {\n\t\t\tbottomLeft = data[row + 1][col - 1];\n\t\t\tneighbors.push(bottomLeft);\n\t\t}\n\n\t\tif (col + 1 < colLen) {\n\t\t\tbottomRight = data[row + 1][col + 1];\n\t\t\tneighbors.push(bottomRight);\n\t\t}\n\t}\n\n\t// loop over list of neighbors and validate each neighbor\n\tfor (let n of neighbors) {\n\t\tif (n === 1) {\n\t\t\t// neighboring cell is not empty\n\t\t\tneighborCount++;\n\t\t}\n\t}\n\treturn neighborCount;\n}", "function getNeighbor(cell_jdom){\n\t var position = cell_jdom.attr('id').substring(1,cell_jdom.attr('id').length).split('_');\n\t//position[0] and position[1] are the matrix location of the element\n\t var row_id = parseInt(position[0]);\n \t var col_id = parseInt(position[1]); \n \t\n \t var up_id = \"b\" + (row_id-1) +\"_\" + col_id;\n \t var down_id = \"b\" + (row_id+1) +\"_\" + col_id;\n \t var left_id = \"b\" + row_id +\"_\" + (col_id-1);\n\t var right_id = \"b\" + row_id +\"_\" + (col_id+1);\n\n\t var neighbor_id = [];\n\t //verify if all the neighbor exists;\n\t if( document.getElementById(up_id)){neighbor_id.push(up_id)}\n\t if( document.getElementById(down_id)){neighbor_id.push(down_id)}\n\t if( document.getElementById(left_id)){neighbor_id.push(left_id)}\n\t if( document.getElementById(right_id)){neighbor_id.push(right_id)}\n\t return neighbor_id;\n}", "_calcCellState(pos){\n var cell=pos.split(':');\n var x=Number (cell[0]);\n var y=Number (cell[1]);\n var currState=this._getCellState(x, y);\n // Get adjacent cells\n var sum=0;\n sum+=this._getCellState(x-1, y-1);\n sum+=this._getCellState(x, y-1);\n sum+=this._getCellState(x+1, y-1);\n sum+=this._getCellState(x-1, y);\n sum+=this._getCellState(x+1, y);\n sum+=this._getCellState(x-1, y+1);\n sum+=this._getCellState(x, y+1);\n sum+=this._getCellState(x+1, y+1);\n\n // Living cell\n if(currState===1){\n // < 2 live neighbors\n if(sum<2){return false;}\n // 2 or 3\n if(sum===2 || sum===3){return true;}\n // > 3\n if(sum>3){return false;}\n }else{\n if(sum===3){return true;}\n }\n return false\n }", "function getNeighbors(i, j){\n\tvar neighbors = [];\n\tif ( i > 0 ){ neighbors.push( [i - 1, j] );}\n\tif ( j > 0 ){ neighbors.push( [i, j - 1] );}\n\tif ( i < (totalRows - 1) ){ neighbors.push( [i + 1, j] );}\n\tif ( j < (totalCols - 1) ){ neighbors.push( [i, j + 1] );}\n\treturn neighbors;\n}", "function getNeighbors(i, j){\n\tvar neighbors = [];\n\tif ( i > 0 ){ neighbors.push( [i - 1, j] );}\n\tif ( j > 0 ){ neighbors.push( [i, j - 1] );}\n\tif ( i < (totalRows - 1) ){ neighbors.push( [i + 1, j] );}\n\tif ( j < (totalCols - 1) ){ neighbors.push( [i, j + 1] );}\n\treturn neighbors;\n}", "function neighbours(x, y) {\n let N = y - 1,\n S = y + 1,\n E = x + 1,\n W = x - 1,\n myN = N > -1 && canWalkHere(x, N),\n myS = S < worldHeight && canWalkHere(x, S),\n myE = E < worldWidth && canWalkHere(E, y),\n myW = W > -1 && canWalkHere(W, y),\n result = [];\n if (myN) {\n result.push({ x: x, y: N });\n }\n if (myE) {\n result.push({ x: E, y: y });\n }\n if (myS) {\n result.push({ x: x, y: S });\n }\n if (myW) {\n result.push({ x: W, y: y });\n }\n findNeighbours(myN, myS, myE, myW, N, S, E, W, result);\n return result;\n }", "checkNeighbor(dir, piece) {\n return piece.point.isEqual(new Point(this.point.x + Neighbors[dir].x, this.point.y + Neighbors[dir].y));\n }", "function countNeighbors(x, y){\n\t\n\t// Init counter with value = 0\n\tvar counter = 0;\n\t\n\t// Get the left coordinate modulo size\n\tminX = (x > 0) ? (x - 1) : (size - 1);\n\t\n\t// Get the top coordinate modulo size\n\tminY = (y > 0) ? (y - 1) : (size - 1);\n\t\n\t// Get the right coordinate modulo size\n\tmaxX = (x < size - 2) ? (x + 1) : 0;\n\t\n\t// Get the bottom coordinate modulo size\n\tmaxY = (y < size - 2) ? (y + 1) : 0;\n\t\n\t// Check if left top neighbor is alive\n\tif(field[minX][minY].status === 'alive'){\n\t\tcounter++;\n\t}\n\t\n\t// Check if left neighbor is alive\n\tif(field[minX][y].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Check if left right neighbor is alive\n\tif(field[minX][maxY].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Check if top neighbor is alive\n\tif(field[x][minY].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Check if bottom neighbor is alive\n\tif(field[x][maxY].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Check if right top neighbor is alive\n\tif(field[maxX][minY].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Check if right neighbor is alive\n\tif(field[maxX][y].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Check if right bottom neighbor is alive\n\tif(field[maxX][maxY].status === 'alive'){\n\t\t\n\t\t// Increase Counter\n\t\tcounter++;\n\t}\n\t\n\t// Return number of counter\n\treturn counter;\n}", "function allNeighboursOf(v) {\r\n\tvar res = [],\r\n\t\tx = v.x,\r\n\t\ty = v.y;\r\n\r\n\tvar left = isValid(x - 1, y),\r\n\t\tup = isValid(x, y - 1),\r\n\t\tright = isValid(x + 1, y),\r\n\t\tdown = isValid(x, y + 1);\r\n\t\t\r\n\r\n\t//We test each straight direction, then subtest the next one clockwise\r\n\r\n\tif (left) {\r\n\t\tres.push(grid[x - 1][y]);\r\n\r\n\t\t//left up\r\n\t\tif (up && isValid(x - 1, y - 1)) {\r\n\t\t\tres.push(grid[x - 1][y - 1]);\r\n\t\t}\r\n\t}\r\n\tif (up) {\r\n\t\tres.push(grid[x][y - 1])\r\n\r\n\t\t//up right\r\n\t\tif (right && isValid(x + 1, y- 1)) {\r\n\t\t\tres.push(grid[x + 1][y - 1]);\r\n\t\t}\r\n\t}\r\n\tif (right) {\r\n\t\tres.push(grid[x + 1][y])\r\n\r\n\t\t//right down\r\n\t\tif (down && isValid(x + 1, y + 1)) {\r\n\t\t\tres.push(grid[x + 1][y + 1]);\r\n\t\t}\r\n\t}\r\n\tif (down) {\r\n\t\tres.push(grid[x][y + 1])\r\n\r\n\t\t//down left\r\n\t\tif (left && isValid(x - 1, y + 1)) {\r\n\t\t\tres.push(grid[x - 1][y + 1]);\r\n\t\t}\r\n\t}\r\n\r\n\treturn res;\r\n}", "evaluateCell(){// change state of change but don't render anything\r\n\t\tlet liveNeighbors = 0;\r\n\t\tfor(let i=0;i<this.state.neighbors.length;i++){\r\n\t\t\t//get cell and obtain its state\r\n\t\t\tlet r = this.state.neighbors[i][0];\r\n\t\t\tlet c = this.state.neighbors[i][1];\r\n\t\t\t\r\n\t\t\tif(getCell(r,c).state.isAlive){\r\n\t\t\t\tliveNeighbors+=1;\t\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet lifeStatus = this.state.isAlive;\r\n\r\n\t\tif(liveNeighbors < 2 || liveNeighbors > 3){\r\n\t\t\tlifeStatus = false;\r\n\t\t}else if(liveNeighbors == 3){\r\n\t\t\tlifeStatus = true;\r\n\t\t}\r\n\t\t\r\n\t\tif(lifeStatus != this.state.isAlive){\r\n\t\t\tthis.state.change = true;\r\n\t\t}else{\r\n\t\t\tthis.state.change = false;\r\n\t\t}\r\n\t\treturn lifeStatus;\r\n\t}", "function neighboursOf(vector) {\r\n\tvar v = vector;\r\n\tvar x = v.x;\r\n\tvar y = v.y;\r\n\tvar neighbours = new Array();\r\n\r\n\tif (isInBounds(x - 1, y)){\r\n\t\tneighbours.push(grid[x - 1][y]);\r\n\t} \r\n\tif (isInBounds(x, y - 1)){\r\n\t\tneighbours.push(grid[x][y - 1]);\r\n\t} \r\n\tif (isInBounds(x + 1, y)){\r\n\t\tneighbours.push(grid[x + 1][y]);\r\n\t\r\n\t} \r\n\tif (isInBounds(x, y + 1)){\r\n\t\tneighbours.push(grid[x][y + 1]);\r\n\t}\r\n\treturn neighbours;\r\n}", "findNeighbours() {\n const n = this.neighbours;\n const { row, col } = this.pos;\n n.topleft = boxes[row - 1]?.[col - 1]; // get top left corner\n n.top = boxes[row - 1]?.[col]; // get the top box\n n.topright = boxes[row - 1]?.[col + 1]; // get top right corner\n n.right = boxes[row]?.[col + 1]; // get the right box\n n.bottomright = boxes[row + 1]?.[col + 1]; // get bottom right corner\n n.bottom = boxes[row + 1]?.[col]; // get the bottom box\n n.bottomleft = boxes[row + 1]?.[col - 1]; // get bottom left corner\n n.left = boxes[row]?.[col - 1]; // get the left box\n // add all neighbours that exist to allNeighbours array\n this.allNeighbours = Object.values(n).filter((n) => n);\n }", "function Neighbours(x, y)\n\t{\n\t\tvar\tN = y - 1,\n\t\tS = y + 1,\n\t\tE = x + 1,\n\t\tW = x - 1,\n\t\tmyN = N > -1,\n\t\tmyS = S < Arachnea.height,\n\t\tmyE = E < Arachnea.width,\n\t\tmyW = W > -1,\n\t\tresult = [];\n\t\tif(myN)\n\t\tresult.push({x:x, y:N});\n\t\tif(myE)\n\t\tresult.push({x:E, y:y});\n\t\tif(myS)\n\t\tresult.push({x:x, y:S});\n\t\tif(myW)\n\t\tresult.push({x:W, y:y});\n\t\tfindNeighbours(myN, myS, myE, myW, N, S, E, W, result);\n\t\treturn result;\n\t}", "function get_neighbours(x,y,visited){\n var neighbours=[];\n var index=((y-1)*no_columns)+(x-1);\n visited[x+','+y]=true;\n //top neighbour\n if(y-1>0 && !grids[index-no_columns].classList.contains('obstacle') && visited[x+','+(y-1)]===undefined){\n neighbours.push([x,(y-1)]);\n visited[x+','+(y-1)]=true;\n };\n //right neighbour\n if(x+1<=no_columns && !grids[index+1].classList.contains('obstacle') && visited[(x+1)+','+y]===undefined){\n neighbours.push([(x+1),y]);\n visited[(x+1)+','+y]=true;\n };\n //bottom neighbour\n if(y+1<=no_rows && !grids[index+no_columns].classList.contains('obstacle') && visited[x+','+(y+1)]===undefined){\n neighbours.push([x,(y+1)]);\n visited[x+','+(y+1)]=true;\n };\n //left neighbour\n if(x-1>0 && !grids[index-1].classList.contains('obstacle') && visited[(x-1)+','+y]===undefined){\n neighbours.push([(x-1),y]);\n visited[(x-1)+','+y]=true;\n };\n return neighbours;\n }", "function count_live_neighbors(grid, row, col) {\n let count = 0;\n\n for (let r = -1; r < 2; r++) {\n for (let c = -1; c < 2; c++) {\n count += grid[(row + r + gridRows) % gridRows][(col + c + gridCols) % gridCols];\n }\n }\n count -= grid[row][col];\n return count;\n}", "applyRuleOne(){\n for(let r=0; r < this.rows; r++) {\n for (let c = 0; c < this.cols; c++) {\n if(!(this.grid[r][c] == 'D' || this.grid[r][c] == 'F' || this.grid[r][c] == '0')){\n let neigh = this.getNeighbours(r,c);\n let adjBombs = Number(this.grid[r][c]);\n let adjFlags = 0;\n let adjDefaults = 0;\n let defaults = [];\n for(let i=0; i < neigh.length; i++){\n let current = this.grid[neigh[i][0]][neigh[i][1]];\n if(current == 'F'){\n adjFlags += 1;\n } else if(current == 'D'){\n adjDefaults += 1;\n defaults.push(neigh[i])\n }\n }\n\n if(adjDefaults > 0 && adjDefaults == (adjBombs - adjFlags)){\n //If all adjacent default tiles are bombs, flag them.\n this.row = defaults[0][0];\n this.col = defaults[0][1];\n this.button = 2;\n //console.log(\"Flagging... Row: \" + this.row + \" , Col: \" + this.col);\n return true;\n } else if(adjDefaults > 0 && adjBombs == adjFlags) {\n //If all adjacent default tiles are safe, click them.\n this.row = defaults[0][0];\n this.col = defaults[0][1];\n this.button = 0;\n //console.log(\"Clicking... Row: \" + this.row + \" , Col: \" + this.col);\n return true;\n }\n }\n }\n }\n\n return false;\n\n }", "getNeighbors() {\n let neighbors = [];\n switch(growthPattern){\n case GROWPATTERN.diamond: \n for (let i = -1; i < 2; i++) {\n for (let j = -1; j < 2; j++) {\n let nearX = i+this.xIndex;\n let nearY = j+this.yIndex;\n if (nearX > -1 && nearX < cols && \n nearY > -1 && nearY < rows && abs(i)!=abs(j)) {\n neighbors.push(this.board.grid[nearX][nearY]);\n }\n }\n }\n break;\n default:\n print(\"Error in neighbors\");\n }\n return neighbors;\n }", "function checkAllGrids(p)\n{\n // creating control array to store linear search results\n var control = [false,false,false,false];\n\n // creating control index z\n var z = 0;\n\n for(var i=0;i<=1;i++)\n {\n for(var j=0;j<=1;j++)\n {\n control[z] = (checkGrid(p,0+2*i, 0+2*j,1+2*i,1+2*j));\n z++;\n }\n }\n\n return (control[0] && control[1] && control[2] && control[3]);\n\n}", "function DiagonalNeighbours(myN, myS, myE, myW, N, S, E, W, result)\n\n{\n\nif(myN)\n\n{\n\nif(myE && canWalkHere(E, N))\n\nresult.push({x:E, y:N});\n\nif(myW && canWalkHere(W, N))\n\nresult.push({x:W, y:N});\n\n}\n\nif(myS)\n\n{\n\nif(myE && canWalkHere(E, S))\n\nresult.push({x:E, y:S});\n\nif(myW && canWalkHere(W, S))\n\nresult.push({x:W, y:S});\n\n}\n\n}", "function Neighbours(x, y)\n {\n var N = y - 1,\n S = y + 1,\n E = x + 1,\n W = x - 1,\n myN = N > -1 && canWalkHere(x, N),\n myS = S < worldHeight && canWalkHere(x, S),\n myE = E < worldWidth && canWalkHere(E, y),\n myW = W > -1 && canWalkHere(W, y),\n result = [];\n if (myN)\n result.push(\n {\n x: x,\n y: N\n });\n if (myE)\n result.push(\n {\n x: E,\n y: y\n });\n if (myS)\n result.push(\n {\n x: x,\n y: S\n });\n if (myW)\n result.push(\n {\n x: W,\n y: y\n });\n findNeighbours(myN, myS, myE, myW, N, S, E, W, result);\n return result;\n }", "function countNeighbors(i) {\n\tvar neighbors = 0;\n\tvar cell = Cells[i];\n\tif(!isNaN(cell.top) && Cells[cell.top].state == true)\n\t\tneighbors++;\n\t\n\tif(!isNaN(cell.bottom) && Cells[cell.bottom].state == true)\n\t\tneighbors++;\t\n\t\n\tif(!isNaN(cell.left) && Cells[cell.left].state == true)\n\t\tneighbors++;\n\t\n\tif(!isNaN(cell.right) && Cells[cell.right].state == true)\n\t\tneighbors++;\n\treturn neighbors;\n}", "function DiagonalNeighboursFree(myN, myS, myE, myW, N, S, E, W, result)\n\n{\n\nmyN = N > -1;\n\nmyS = S < worldHeight;\n\nmyE = E < worldWidth;\n\nmyW = W > -1;\n\nif(myE)\n\n{\n\nif(myN && canWalkHere(E, N))\n\nresult.push({x:E, y:N});\n\nif(myS && canWalkHere(E, S))\n\nresult.push({x:E, y:S});\n\n}\n\nif(myW)\n\n{\n\nif(myN && canWalkHere(W, N))\n\nresult.push({x:W, y:N});\n\nif(myS && canWalkHere(W, S))\n\nresult.push({x:W, y:S});\n\n}\n\n}", "deadCellLives(alive, aliveNeighbors){\n return !alive && aliveNeighbors.length >= 3;\n }", "function FindIslands(event){\n clearGridSaveWall()\n resetVisit()\n var islandNum = 0\n\n for(var i = 0; i < GRID_ROW_SIZE; i++){\n for(var j = 0; j < GRID_COL_SIZE; j++){\n \n // already visited, continue\n if(Grid[i][j].VisitedAt != -1){\n continue\n }\n // not part of an island, continue;\n if(Grid[i][j].State != \"Wall\"){\n continue\n }\n // unvisited island found, explore and count\n else{\n islandNum ++\n IslandExplorer(i,j)\n }\n\n }\n }\n \n console.log(islandNum);\n}", "applyRules(neighbors, data) {\n\n let cell = this;\n\n // we are using .reduce here because it's faster then .filter\n let countAlive = neighbors.reduce(function (n, cell) {\n return n + (cell.isAlive == ALIVE);\n }, 0);\n\n if( data.matchfieldLimited ) {\n if( cell.top == 0 || cell.top == data.maxTop || cell.left == 0 || cell.left == data.maxLeft ) {\n cell.isAlive = DEAD;\n }\n }\n\n // check alive count and choose a rule\n if( ! cell.isAlive ) { // cell is dead\n if( countAlive == 3 ) {\n cell.isAlive = ALIVE;\n }\n } else { // cell is alive\n if( countAlive < 2 ) {\n cell.isAlive = DEAD;\n } else if( countAlive == 2 || countAlive == 3 ) {\n cell.isAlive = ALIVE;\n } else if( countAlive > 3 ) {\n cell.isAlive = DEAD;\n } else {\n throw Error('don\\t know what to do with cell ! ' + cell.id );\n }\n }\n\n }", "function neigh(a, b) {\n return a == b || adjlist[a + \"-\" + b];\n}", "getGridPointNeighbors(grid, gridPoint, predicateFn) {\n let ix = gridPoint.ix,\n iy = gridPoint.iy,\n result = [],\n neighbor; // NOTE:\n // It's important to push bottom neighbors first since this method is used\n // in collectPath(), which reversively collects path from end to start node\n // and if bottom neighbors are pushed first in result array then collectPath()\n // will produce a line which is more suitable (pleasant looking) for our purposes.\n\n if (iy < grid.height - 1) {\n neighbor = grid.points[iy + 1][ix];\n (!predicateFn || predicateFn(neighbor)) && result.push(neighbor);\n }\n\n if (iy > 0) {\n neighbor = grid.points[iy - 1][ix];\n (!predicateFn || predicateFn(neighbor)) && result.push(neighbor);\n }\n\n if (ix < grid.width - 1) {\n neighbor = grid.points[iy][ix + 1];\n (!predicateFn || predicateFn(neighbor)) && result.push(neighbor);\n }\n\n if (ix > 0) {\n neighbor = grid.points[iy][ix - 1];\n (!predicateFn || predicateFn(neighbor)) && result.push(neighbor);\n }\n\n return result;\n }", "function getNeighbors( i, j )\n{\n var neighbors = [];\n //top, bottom, left, right\n var limit = 4;\n //top, bottom, left, right, top-left, top-right, bottom-left, bottom-right\n if( diagnolSelected )\n limit=8;\n \n for( var k = 0; k < limit; k++ )\n {\n var newRow = i + dirX[k];\n var newCol = j + dirY[k];\n //If neighbour exists, add it into the neighbours list\n if( newRow >= 0 && newRow < totalRows && newCol >= 0 && newCol < totalCols)\n neighbors.push( [newRow, newCol] );\n }\n \n return neighbors;\n}", "function countNeighbors( cells, i, j )\n{\n var n = 0;\n\n n += countCell( cells, i - 1, j - 1 );\n n += countCell( cells, i - 1, j );\n n += countCell( cells, i - 1, j + 1 );\n\n n += countCell( cells, i, j - 1 );\n n += countCell( cells, i, j + 1 );\n\n n += countCell( cells, i + 1, j - 1 );\n n += countCell( cells, i + 1, j );\n n += countCell( cells, i + 1, j + 1 );\n\n return n;\n}", "generateNeighbours(grid) {\r\n //Right neighbour\r\n if (this.x < cols - 1) {\r\n this.neighbours.push(grid[this.x + 1][this.y]);\r\n }\r\n //Left neighbour\r\n if (this.x > 0) {\r\n this.neighbours.push(grid[this.x - 1][this.y]);\r\n }\r\n //Bottom neighbour\r\n if (this.y < rows - 1) {\r\n this.neighbours.push(grid[this.x][this.y + 1]);\r\n }\r\n //Top neighbour\r\n if (this.y > 0) {\r\n this.neighbours.push(grid[this.x][this.y - 1]);\r\n }\r\n }", "function Neighbours(x, y){\n\t\tvar\tN = y - 1,\n\t\tS = y + 1,\n\t\tE = x + 1,\n\t\tW = x - 1,\n\t\tmyN = N > -1 && canWalkHere(x, N),\n\t\tmyS = S < worldHeight && canWalkHere(x, S),\n\t\tmyE = E < worldWidth && canWalkHere(E, y),\n\t\tmyW = W > -1 && canWalkHere(W, y),\n\t\tresult = [];\n\t\tif(myN)\n\t\tresult.push({x:x, y:N});\n\t\tif(myE)\n\t\tresult.push({x:E, y:y});\n\t\tif(myS)\n\t\tresult.push({x:x, y:S});\n\t\tif(myW)\n\t\tresult.push({x:W, y:y});\n\t\tfindNeighbours(myN, myS, myE, myW, N, S, E, W, result);\n\t\treturn result;\n\t}" ]
[ "0.6992609", "0.689685", "0.6895429", "0.6581897", "0.65636486", "0.65496486", "0.65411913", "0.65163827", "0.64936787", "0.6463766", "0.6424949", "0.6423989", "0.64076734", "0.6393453", "0.6385809", "0.63783205", "0.6364528", "0.63609326", "0.63589156", "0.63463277", "0.6345879", "0.63418996", "0.63287085", "0.63189596", "0.63157284", "0.63055414", "0.6303494", "0.6302166", "0.6249932", "0.62484777", "0.6225513", "0.6220263", "0.62027436", "0.61817366", "0.61733836", "0.6160018", "0.6158097", "0.6149512", "0.6144644", "0.6136301", "0.6133644", "0.6130451", "0.61251134", "0.61212415", "0.61194515", "0.61076194", "0.6105666", "0.6101631", "0.608569", "0.6084884", "0.6083746", "0.6083746", "0.60801923", "0.60801923", "0.6070178", "0.60487795", "0.6032259", "0.6031226", "0.6023499", "0.60177356", "0.60116607", "0.6001544", "0.599826", "0.5986686", "0.59863627", "0.5985472", "0.59545124", "0.59439975", "0.5938381", "0.5932439", "0.59319746", "0.5931389", "0.59257144", "0.59209514", "0.59209514", "0.59204286", "0.59096855", "0.59027016", "0.59009564", "0.58984184", "0.5884637", "0.5868331", "0.5854973", "0.58473295", "0.58471775", "0.58384115", "0.5831987", "0.5821443", "0.5813182", "0.58058333", "0.57990366", "0.5788626", "0.5785536", "0.57841057", "0.5774501", "0.5772405", "0.5771163", "0.57643944", "0.5763258", "0.57589567", "0.57579356" ]
0.0
-1
setup function which will create cells in canvas
function setup(){ cols = Math.floor(width/w); rows = Math.floor(height/w); //for each column in each row create a cell for (let rn = 0; rn < rows; rn++){ for(let cn = 0; cn < cols; cn++){ const cell = new Maze(cn,rn); grid.push(cell); } current = grid[0]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setup() {\n createCanvas(600, 600); //initiate a canvas with width and hegiht\n cols = floor(width / w); //defining columns = 300/20 = 15\n rows = floor(height / w); //defining rows = 300/20 = 15\n\n for (var j = 0; j < rows; j++) { //for loop runs 15 times to create 15 rows\n for (var i = 0; i < cols; i++) { //for loop runs 15 times to create 15 cols\n var cell = new Cell(i, j); //class that defines the cell\n grid.push(cell); //pushing cell to grid\n sets.push([cell.id]) //pushing cell.ids to sets\n }\n }\n}", "function makeGrid() {\nfor (let x = 0; x < rowsNum.value ; x ++) {\n const insertRow = pixelCanvas.insertRow(0) ;\n for (let y = 0 ; y < cellsNum.value ; y ++) {\n insertRow.insertCell(0) ;\n }\n}\n\n}", "function setup() {\n createCanvas(400, 400);\n cols = floor(width / w);\n rows = floor(height / w);\n \n // let's create the cell object and put it in the grid\n for (let j = 0; j < rows; j++) {\n for (let i = 0; i < cols; i++) {\n var cell = new Cell(i, j);\n grid.push(cell);\n }\n }\n \n background(0)\n }", "function setup(noCol, noRow){\n\n //remove existing\n while(canvas.firstChild){\n canvas.removeChild(canvas.firstChild);\n };\n\n //create cells\n for(var i=0; i<noCol; i++){\n columns[i] = document.createElement(\"div\");\n columns[i].classList.add(\"col\");\n columns[i].setAttribute(\"id\",\"col\"+i);\n columns[i].setAttribute(\"width\",(100/noCol)+\"%\");\n canvas.appendChild(columns[i]);\n\n for(var j=0; j<noRow; j++){\n cells[i+j] = document.createElement(\"div\");\n cells[i+j].classList.add(\"cell\");\n cells[i+j].setAttribute(\"id\",\"cell\"+i+\";\"+j);\n cells[i+j].setAttribute(\"width\",\"100%\");\n //console.log(cells[i+j]);\n columns[i].appendChild(cells[i+j]); \n //mouse hover event\n document.getElementById(\"cell\"+i+\";\"+j).addEventListener(\"mouseover\",function(){\n if(radio1.checked==true){\n colourBlack(this);\n }else if(radio2.checked==true){\n colourRandom(this);\n }else if(radio3.checked==true){\n colorizeBlack(this);\n }else{\n colourBlack(this);\n }\n \n });\n };\n };\n}", "function makeCells() {\n const rows = InputHeight.val();\n const cols = InputWidth.val();\n const pixelSize = InputSize.val() + 'px';\n const TotalCells = rows * cols;\n // Setting memory limit for undo-redo operations\n UndoLimit = (TotalCells < 400) ? 5 : (TotalCells < 1600) ? 3 : 2;\n // \"Start drawing\" button goes to the normal mode\n SubmitBtn.removeClass('pulse');\n // Creating table rows\n for (let i = 0; i < rows; i++) {\n Canvas.append('<tr class=\"tr\"></tr>');\n }\n CanvasTr = $('.tr');\n // Creating cells to every row\n for (let j = 0; j < cols; j++) {\n CanvasTr.append('<td class=\"td\"></<td>');\n }\n CanvasTd = $('.td');\n CanvasTr.css('height', pixelSize);\n CanvasTd.css('width', pixelSize);\n isSmthOnCanvas = false;\n // Turning off the context menu over canvas\n Canvas.contextmenu(function () {\n return false;\n })\n // Adding a delay for avoid overloading browser by simultaneously animation\n if (body.hasClass('checked') == false) {\n setTimeout(function () {\n CanvasBgr.slideToggle(250);\n }, 700);\n // For hiding useless elements\n body.addClass('checked');\n }\n else {\n CanvasBgr.slideToggle(250);\n };\n drawing();\n manageHistory();\n }", "function setup() {\n createCanvas(400,400);\n cols = floor(width/w);\n rows = floor(height/w);\n \n // build the grid\n for (var j = 0; j < rows; j++) {\n for (var i = 0; i < cols; i++) {\n var cell = new Cell(i,j); // instantiate a Cell object\n grid.push(cell);\n }\n \n }\n}", "function makeCanvas(x, y) {\n canvas.style.setProperty(\"--grid-cols\", x);\n canvas.style.setProperty(\"--grid-rows\", y);\n for (let i = 0; i < x * y; i++) {\n let cell = document.createElement(\"div\");\n canvas.appendChild(cell).className = \"cell\";\n }\n}", "function makeGrid() {\r\n newCanvas.innerHTML = \"\";\r\n for (let h = 0; h < gridHeight.value; h++) {\r\n const rows = document.createElement(\"tr\");\r\n newCanvas.insertAdjacentElement(\"afterbegin\", rows);\r\n for (let w = 0; w < gridWidth.value; w++) {\r\n const cells = document.createElement(\"td\");\r\n cells.addEventListener(\"click\", function () {\r\n cells.style.backgroundColor = cellColor.value;\r\n });\r\n rows.appendChild(cells);\r\n }\r\n }\r\n}", "function makeGrid() {\n for (var i=0;i<height.value;i++) {\n const height=canvas.insertRow(i);\n for (var j=0; j <weight.value;j++){\n const weight=height.insertCell(j);\n weight.addEventListener(\"click\", click_color);\n }\n }\n}", "init() {\n let i, cells, cell, cellMeta;\n let width = null;\n let height = null;\n\n if (!this.config.isFullScreen) {\n width = this.canvas.width;\n height = this.canvas.height;\n }\n\n this.board.calculateCellLayout(width, height);\n this.canvas.width = this.board.width;\n this.canvas.height = this.board.height;\n cells = this.board.populateBoard(this.config.isRandom);\n\n this.drawCells(cells);\n this.isInitialized = true;\n }", "function makeGrid(){\n\tfor(let row = 0; row < inputHeight.value; row++){\n\t\tconst tableRow = pixelCanvas.insertRow(row);\n\t\tfor(let cell = 0; cell < inputWidth.value; cell++){\n\t\t\tconst cellBlock = tableRow.insertCell(cell);\n\t\t}\n\t}\n}", "function makeGrid() {\n\t\tfor(let col = 0; col < gridHeight; col++){\n\t\t\tconst cellRow = $('<tr></tr>'); //CREATES TABLE ROWS\n\t\t\tcanvas.append(cellRow);\n\t\t\tfor (let row = 0; row < gridWidth; row++){\n\t\t\t\tconst cell = $('<td></td>');\n\t\t\t\tcellRow.append(cell);\n\t\t\t};\n\t\t};\n\t}", "function setup(){\n canvas.width = size;\n canvas.height = size;\n context.scale(scale, scale); //each bacteria dimentions are 10x10 bc scale = 600/10\n context.fillStyle = 'black'; //each bacteria will be filled with the color black \n cells = createCells()\n}", "function generateCanvas(numCells) {\n if (numCells <= 0) {\n alert(\"Please input a number greater than 0\")\n return\n } else if (numCells > maxNumCells) {\n alert(\"Please input a number less than or equal to \" + maxNumCells)\n return\n }\n while (canvas.firstChild) {\n canvas.removeChild(canvas.firstChild)\n }\n\n let cellSizeInPx = '' + canvasWidthInPx/numCells + 'px'\n let row\n let cell\n for(let i = 0; i < numCells; i++) {\n row = document.createElement('div')\n row.classList.add('row')\n canvas.appendChild(row)\n\n for(let j = 0; j < numCells; j++) {\n cell = document.createElement('div')\n cell.classList.add('cell')\n cell.style.height = cellSizeInPx\n cell.style.width = cellSizeInPx\n cell.style.backgroundColor = defaultColor\n row.appendChild(cell)\n }\n }\n}", "function setup() {\n createCanvas(windowWidth, windowHeight);\n rectMode(CENTER);\n angleMode(DEGREES);\n \n for (let i = 0; i < windowWidth; i += W){\n gridLoc.push([]);\n for (let j = 0; j < windowHeight; j += W){\n // gridLoc[i].push(j);\n grid.push(new Cells(i,j,W));\n } \n }\n}", "function makeGrid() {\n\n canvas.innerHTML = '';\n\t\n\t\n // This builds the rows and columns\n var fragment = document.createDocumentFragment();\n\t\n for (let a = 0; a < height.value; a++) {\n var tr = document.createElement('tr');\n\n for (let b = 0; b < width.value; b++) {\n var td = document.createElement('td');\n tr.appendChild(td);\n }\n\n tr.addEventListener('click', clickedBox);\n fragment.appendChild(tr);\n\t\n }\n \n \n \n // Push grid onto DOM\n canvas.appendChild(fragment);\n \n}", "function initGrid (){\n for (var row = 0; row < numRows; row += 1) {\n for (var col = 0; col < numCols; col += 1) {\n drawCustomCell(row, col, window.cells[row][col].state,'none', true);\n }\n }\n}", "function init() {\n let y;\n let x;\n cells_data_matrix = new Array();\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n for (y = cell_radius; y < canvas.height; y += diamter) {\n const cell_array = new Array();\n for (x = cell_radius; x < canvas.width; x += diamter) {\n const cell_info = {\n x: x,\n y: y,\n alive: false\n };\n cell_array.push(cell_info);\n //drawCell(cell_info);\n }\n cells_data_matrix.push(cell_array);\n }\n if (random_option === true) {\n let random_number =\n Math.floor(Math.random() * (number_cells_inline * number_of_lines)) / 7;\n for (x = 0; x < random_number; x++) {\n const i = Math.floor(Math.random() * number_of_lines);\n const j = Math.floor(Math.random() * number_cells_inline);\n cells_data_matrix[i][j].i = i;\n cells_data_matrix[i][j].j = j;\n cells_data_matrix[i][j].alive = true;\n drawCell(cells_data_matrix[i][j]);\n }\n }\n}", "function makeGrid() {\n gridCanvas.innerHTML = \"\";\n var rowCount = gridHeight.value;\n var cellCount = gridWidth.value;\n for (let r = 0; r < rowCount; r++) {\n var tr = document.createElement(\"tr\");\n gridCanvas.appendChild(tr);\n var newRow = gridCanvas.insertRow(r);\n \n for (let c = 0; c < cellCount; c++) {\n var td = document.createElement(\"td\");\n tr.appendChild(td);\n td.addEventListener('click', fillGrid); //Event listeners are properly added to the grid squares (and not to the border or the table itself).\n var cell = newRow.insertCell(c);\n cell.addEventListener('click', fillGrid);\n }\n }\n}", "initCells(){\n for(var j=0; j<this.rows;j++){\n for(var i=0; i<this.columns ; i++){\n this._cells.push(new Cell({column:i, row:j})) ;\n }\n }\n }", "function init() {\n this.grid = setupGrid(this.rows, this.lines, this.pattern);\n draw(this.canvas, this.grid);\n}", "initBoard() {\n this.canvas = document.createElement('canvas');\n this.ctx = this.canvas.getContext('2d');\n this.width = this.canvas.width = this.tileWidth * this.columns;\n this.height = this.canvas.height = this.tileHeight * this.rows;\n this.canvas.style.border = \"none\";\n this.initStage();\n }", "function makeGrid() {\n canvas.find('tablebody').remove();\n\n // \"submit\" the size form to update the grid size\n let gridRows = gridHeight.val();\n let gridCol = gridWeight.val();\n\n // set tablebody to the table\n canvas.append('<tablebody></tablebody>');\n\n let canvasBody = canvas.find('tablebody');\n\n // draw grid row\n for (let i = 0; i < gridRows; i++) {\n canvasBody.append('<tr></tr>');\n }\n\n // draw grid col\nfor (let i = 0; i < gridCol; i++) {\n canvas.find('tr').append('<td class=\"transparent\"></td>');\n }\n\n }", "function makeGrid(e) {\n\n canvas.innerHTML = '';\n\n // console.log(canvas);\n\n for (var i = 0; i < gridHeight.value; i++) {\n let row = canvas.appendChild(document.createElement('tr'));\n row.classList.add('row');\n canvas.append(row);\n\n for (var j = 0; j < gridWidth.value; j++) {\n let pixels = row.appendChild(document.createElement('td'));\n pixels.classList.add('pixel');\n pixels.innerHTML;\n };\n };\n let brush = false;\n let $td = document.getElementsByTagName('td');\n\n for (var i = 0; i < $td.length; i++) {\n $td[i].addEventListener('mousedown', (e) => {\n brush = true;\n if (brush) {\n e.target.style.backgroundColor = colorValue.value;\n };\n for (var i = 0; i < $td.length; i++) {\n $td[i].addEventListener('mousemove', (e) => {\n if (brush) {\n e.target.style.backgroundColor = colorValue.value;\n };\n });\n };\n });\n };\n for (var i = 0; i < $td.length; i++) {\n $td[i].addEventListener('mouseup', () => {\n brush = false;\n });\n };\n }", "function makeGrid() {\n var {width, height} = size_input();\n\n for (rowNum = 0; rowNum < height; rowNum++) {\n grid.append(\" <tr></tr>\");\n }\n for (colNum = 0; colNum < width; colNum++) {\n $(\"#pixel_canvas tr\").append(\" <td></td>\");\n }\n}", "function makeGrid(height, width) {\n // set size of canvas\n for (var i = 0; i < height.value; i++) {\n const row = canvas.insertRow(i); // calls the function to set size rows\n for (var j = 0; j < width.value; j++) {\n const cell = row.insertCell(j); // cal the function to set size of insertCell\n cell.addEventListner(\"click\", fillSquare);\n }\n }\n}", "function setup() // P5 Setup Function\n{\n let sz = g_canvas.cell_size;\n let width = sz * g_canvas.wid; // Our 'canvas' uses cells of given size, not 1x1 pixels.\n let height = sz * g_canvas.hgt;\n createCanvas( width, height ); // Make a P5 canvas.\n draw_grid( 20, 0, 'white', 'red' );\n}", "function makeGrid() {\r\n Artmaker.canvas.innerHTML = \"\";\r\n while (Artmaker.canvas.rows.length > 0) {\r\n Artmaker.canvas.deleteRow(0);\r\n }\r\n for (var i = 0; i < Artmaker.rows.value; i++) {\r\n var row = Artmaker.canvas.insertRow(i);\r\n row.setAttribute(\"class\", \"row\");\r\n for (var j = 0; j < Artmaker.columns.value; j++) {\r\n var cell = row.insertCell(j);\r\n cell.addEventListener(\"click\", function(e) {\r\n e.target.style.backgroundColor = Artmaker.color.value;\r\n });\r\n }\r\n }\r\n return false;\r\n}", "function makeGrid() {\n const height = inputHeight.val();\n const width = inputWidth.val();\n\n for (let i = 0; i < height; i++) {\n const row = $('<tr></tr>');\n for (let j = 0; j < width; j++) {\n row.append('<td></td>');\n }\n canvas.append(row);\n }\n}", "function makeGrid(x,y) {\n $('#pixel_canvas').empty();\n for(let i=0; i<y; i++){\n let row = $('<tr>');\n $('#pixel_canvas').append(row);\n for(let j=0; j<x; j++){\n $(row).append('<td class=\"cell\"></td>');\n }\n }\n}", "function makeGrid(height, width) {\r\n// Grid is cleared\r\n pixelCanvas.empty();\r\n// Create new grid\r\n// Create rows\r\n for (let row = 0; row < height; row++) {\r\n let tableRow = $('<tr></tr>');\r\n// Create columns\r\n for (let col = 0; col < width; col++) {\r\n let tableCell = $('<td></td>');\r\n// Append table data to create grid\r\n tableRow.append(tableCell);\r\n }// End col for loop\r\n pixelCanvas.append(tableRow);\r\n }// End row for loop\r\n }// End makeGrid function", "function makeGrid() {\n pixelCanvas.innerHTML = \"\";\n for (let i = 0; i < gridHeight;i++) {\n const tr = document.createElement(\"tr\");\n for(let j = 0; j < gridWidth; j++){\n const td = document.createElement(\"td\");\n tr.appendChild(td);\n }\n fragment.appendChild(tr);\n }", "function makeGrid(height, width) {\n // Firstly clear canvas and then start again\n while (canvas.hasChildNodes()){\n canvas.removeChild(canvas.firstChild);\n }\n // Iterate with given height and width to create the clear canvas\n for(var x = 0; x<height; x++){\n var row = document.createElement('tr');\n canvas.appendChild(row);\n for(var y = 0; y<width; y++){\n var column = document.createElement('td');\n row.appendChild(column);\n }\n }\n\n}", "function makeGrid() {\n\tfor (y = 0; y < sizeY; y++ ){\n\t\t$('#pixelCanvas').append('<tr>');\n\t\t\tfor(x = 0; x< sizeX; x++ ){\n\t\t\t\t$('#pixelCanvas tr:last-child').append('<td></td>');\n\t\t\t}\n\t\t$('#pixelCanvas').append('</tr>');\n\t}\n}", "function makeGrid() {\n $(\"tr\").remove();\n for (var h = 0; h < canvasHeight; h++) {\n var row = \"<tr>\";\n for (var w = 0; w < canvasWidth; w++) {\n tdNo++;\n row += '<td id=\"td' + tdNo + '\"></td>';\n }\n row += \"</tr>\";\n\n canvasCtl.append(row);\n }\n}", "function setup(target, cellXAmt, cellYAmt) {\r\n clearGrid(target)\r\n\r\n var compStyle = getComputedStyle(target)\r\n\r\n var targetWidth = parseInt(compStyle.width)\r\n\r\n target.setAttribute('width', compStyle.width.toString())\r\n target.setAttribute('height', compStyle.height.toString())\r\n\r\n var cellWidth = Math.floor(targetWidth / cellXAmt)\r\n var cellHeight = Math.min(Math.floor(parseInt(compStyle.height) / cellYAmt), cellWidth)\r\n\r\n var cellXMargin = Math.floor((targetWidth % cellXAmt) / 2)\r\n\r\n cell.width = cellWidth\r\n cell.height = cellHeight\r\n cell.__proto__.offset = cellXMargin\r\n\r\n console.log(cell.offset)\r\n\r\n var newCells = generateCells(cellXAmt, cellYAmt)\r\n\r\n notifyNeighbors(newCells)\r\n\r\n //renderGrid(newCells, target);\r\n\r\n return newCells\r\n}", "createGrids () {\n }", "function createGrid(height, width) {\n bodyTable.innerHTML = \"\";\n for (let h = 0; h < height; h++) { \n var row = document.createElement(\"tr\");\n for (let w = 0; w < width; w++) {\n var column = document.createElement(\"td\");\n row.appendChild(column); \n }\n bodyTable.appendChild(row); \n }\n pixelCanvas.appendChild(bodyTable); \n event.preventDefault();\n bodyTable.addEventListener('click', addColor) \n}", "function init() {\n \n //These lines get the canvas DOM element and canvas context, respectively.\n canvas = document.getElementById(\"c\");\n ctx = canvas.getContext(\"2d\");\n\n //These two set the width and height of the canvas to the defined values.\n canvas.width = canvas_width;\n canvas.height = canvas_height;\n\n /*\n This loop begins at zero and counts up to the defined number of particles,\n less one, because array elements are numbered beginning at zero.\n */\n for (i = 0; i < speck_count; i++) {\n /*\n This calls the function particle() with random X and Y values. It then\n takes the returned object and pushes it into the particles array at the\n end.\n */\n particles.push(new particle(Math.random() * canvas_width, Math.random() * canvas_height));\n }\n\n //This loops through the count of columns.\n for (col = 0; col < num_cols; col++) { \n \n //This defines the array element as another array.\n vec_cells[col] = [];\n\n //This loops through the count of rows.\n for (row = 0; row < num_rows; row++) { \n \n /*\n This line calls the cell() function, which creates an individual grid cell\n and returns it as an object. The X and Y values are multiplied by the\n resolution so that when the loops are referring to \"column 2, row 2\", the\n width and height of \"column 1, row 1\" are counted in so that the top-left\n corner of the new grid cell is at the bottom right of the other cell.\n */\n var cell_data = new cell(col * resolution, row * resolution, resolution)\n\n //This pushes the cell object into the grid array.\n vec_cells[col][row] = cell_data;\n\n /*\n These two lines set the object's column and row values so the object knows\n where in the grid it is positioned. \n */\n vec_cells[col][row].col = col;\n vec_cells[col][row].row = row;\n\n }\n }\n \n\n /*\n These loops move through the rows and columns of the grid array again and set variables \n in each cell object that will hold the directional references to neighboring cells. \n For example, let's say the loop is currently on this cell:\n\n OOOOO\n OOOXO\n OOOOO\n \n These variables will hold the references to neighboring cells so you only need to\n use \"up\" to refer to the cell above the one you're currently on.\n */\n for (col = 0; col < num_cols; col++) { \n \n for (row = 0; row < num_rows; row++) { \n\n /*\n This variable holds the reference to the current cell in the grid. When you\n refer to an element in an array, it doesn't copy that value into the new\n variable; the variable stores a \"link\" or reference to that spot in the array.\n If the value in the array is changed, the value of this variable would change\n also, and vice-versa.\n */\n var cell_data = vec_cells[col][row];\n\n /*\n Each of these lines has a ternary expression. A ternary expression is similar \n to an if/then clause and is represented as an expression (e.g. row - 1 >= 0) \n which is evaluated to either true or false. If it's true, the first value after\n the question mark is used, and if it's false, the second value is used instead.\n\n If you're on the first row and you move to the row above, this wraps the row \n around to the last row. This is done so that momentum that is pushed to the edge \n of the canvas is \"wrapped\" to the opposite side.\n */\n var row_up = (row - 1 >= 0) ? row - 1 : num_rows - 1;\n var col_left = (col - 1 >= 0) ? col - 1 : num_cols - 1;\n var col_right = (col + 1 < num_cols) ? col + 1 : 0;\n\n //Get the reference to the cell on the row above.\n var up = vec_cells[col][row_up];\n var left = vec_cells[col_left][row];\n var up_left = vec_cells[col_left][row_up];\n var up_right = vec_cells[col_right][row_up];\n \n /*\n Set the current cell's \"up\", \"left\", \"up_left\" and \"up_right\" attributes to the \n respective neighboring cells.\n */\n cell_data.up = up;\n cell_data.left = left;\n cell_data.up_left = up_left;\n cell_data.up_right = up_right;\n\n /*\n Set the neighboring cell's opposite attributes to point to the current cell.\n */\n up.down = vec_cells[col][row];\n left.right = vec_cells[col][row];\n up_left.down_right = vec_cells[col][row];\n up_right.down_left = vec_cells[col][row];\n\n }\n }\n\n \n /*\n These lines create triggers that fire when certain events happen. For\n instance, when you move your mouse, the mouse_move_handler() function \n will run and will be passed the event object reference into it's \"e\" \n variable. Something to note, the mousemove event doesn't necessarily \n fire for *every* mouse coordinate position; the mouse movement is \n sampled at a certain rate, meaning that it's checked periodically, and \n if the mouse has moved, the event is fired and the current coordinates \n are sent. That's why you'll see large jumps from one pair of coordinates\n to the next if you move your mouse very fast across the screen. That's\n also how I measure the mouse's velocity.\n */\n\t\tw.addEventListener(\"mouseover\", mouse_down_handler);\n\t\t// w.addEventListener(\"mousedown\", mouse_down_handler);\n\t\t\n\n w.addEventListener(\"touchstart\", mouse_down_handler);\n\n // w.addEventListener(\"mouseup\", mouse_up_handler);\n // w.addEventListener(\"touchend\", touch_end_handler);\n\n canvas.addEventListener(\"mousemove\", mouse_move_handler);\n canvas.addEventListener(\"touchmove\", touch_move_handler);\n\n //When the page is finished loading, run the draw() function.\n w.onload = draw;\n\n }", "function generateGrid(x) {\n \tfor (var rows = 0; rows < x; rows++) {\n \tfor (var columns = 0; columns < x; columns++) {\n \t$('#container').append(\"<div class='cell'></div>\");\n };\n };\n $('.cell').width(720/x);\n $('.cell').height(720/x);\n\t\tpaint();\n}", "function makeGrid() {\n // Variables for Function\n const gridHeight = document.getElementById('inputHeight').value;\n const gridWidth = document.getElementById('inputWidth').value;\n const canvas = document.getElementById('pixelCanvas');\n canvas.innerHTML = \"\"; // Resets grid when new submitted again.\n // Function below Creates Rows & Columns\n for (let y = 0; y < gridHeight; ++y) {\n var row = document.createElement('tr');\n canvas.appendChild(row);\n for (let x = 0; x < gridWidth; ++x) {\n var col = document.createElement('td');\n row.appendChild(col);\n // eventListener assigns color to background when cell clicked.\n col.addEventListener('click', function(c) {\n var color = setColor();\n c.target.style.backgroundColor = color;\n });\n }\n }\n}", "function makeGrid() {\n\n\n}", "function makeGrid() {\n\n //Get nb of rows and cols input\n const rows = $(\"#inputHeight\").val();\n const cols = $(\"#inputWidth\").val();\n \n //the table\n const table = $(\"#pixelCanvas\");\n \n //Reset to the empty tabl, in case one already created\n table.children().remove();\n \n //Make rows\n for (let i = 0; i < rows; i++) {\n table.append(\"<tr></tr>\");\n //Create cols\n for (let j = 0; j < cols; j++) {\n table.children().last().append(\"<td></td>\");\n }\n }\n \n //Listen for cell clicks\n table.on(\"click\", \"td\", function() {\n //Get color from color picker\n let color = $(\"input#colorPicker\").val();\n //Apply color to cell\n $(this).attr(\"bgcolor\", color);\n });\n }", "initGrid(cellSize) {\n this.gridCells = {\n x: [],\n y: []\n }\n for (let i = 0; i < this.width - cellSize; i += cellSize) {\n this.gridCells.x.push(i)\n }\n for (let i = 0; i < this.height - cellSize; i += cellSize) {\n this.gridCells.y.push(i)\n }\n }", "createCanvas(){\n let canvas = document.createElement(\"canvas\");\n canvas.width = this.cellWidth * this.width;\n canvas.height = this.cellHeight * this.height;\n document.querySelector(\"#main\").appendChild(canvas);\n return canvas;\n }", "function populateCells() {\n\tvar cellSize = creatorWidth / numCells;\n\tfor (var i = 0; i < numCells; i++) {\n\t\tobject.push([]);\n\t\tfor (var j = 0; j < numCells; j++) {\n\t\t\t$(\".creator\").append(\"<div class='cell' data-x='\"+j+\"' data-y='\"+i+\"' data-color='\"+screenColor+\"'></div>\");\n\t\t\tobject[i][j] = screenColor;\n\t\t}\n\t}\n\n\t$(\".cell\").each(function() {\n\t\t$(this).css(\"width\", cellSize);\n\t\t$(this).css(\"height\", cellSize);\n\n\t\t$(this).hover(function() {\n\t\t\tactivateCell($(this));\n\t\t}, function() {\n\t\t\tdeactivateCell($(this));\n\t\t});\n\t});\n}", "function makeGrid() {\nconst gridHeight = document.getElementById(\"inputHeight\").value;\nconst gridWidth = document.getElementById(\"inputWidth\").value;\nconst pixelCanvas = document.getElementById(\"pixel_Canvas\"); \npixelCanvas.innerText=\"\"; // empty table \n\nfor (let h=0; h<gridHeight; ++h) {\n const row = pixelCanvas.insertRow(-1); // insert new row\n for (let w=0; w<gridWidth; ++w) {\n const cell = row.insertCell(-1); //insert new cell\n cell.onclick = changeColor;\n }\n}\nevent.preventDefault();\n\n\n}", "function makeGrid() {\n\n // get the table element\n const canvas = document.getElementById('pixelCanvas');\n // reset grid\n while(canvas.firstChild) {\n canvas.removeChild(canvas.firstChild);\n }\n\n\n var width = sizeForm.width.value;\n var height = sizeForm.height.value;\n console.debug(width);\n console.debug(height);\n \n // create grid with height and width inputs\n for(y = 0; y < height; y++) {\n row = canvas.appendChild(document.createElement('TR'));\n for(x = 0; x < width; x++) {\n cell = row.appendChild(document.createElement('TD'));\n }\n }\n\n canvas.addEventListener('click', changeColor);\n\n}", "function setupTavern() {\n\n//draw a grid\n//make objects of each area\n\n\n}", "function makeGrid(event) {\n// Your code goes here!\n event.preventDefault();\n let height = heightInput.value;\n let width = widthInput.value;\n console.log(height + \",\" + width);\n while (pixelCanvas.firstChild) {\n pixelCanvas.removeChild(pixelCanvas.firstChild);\n }\n\n for (let i = 0; i < height; i++) {\n let newRow = document.createElement(\"tr\");\n for (let j = 0; j < width; j++) {\n let newTd = document.createElement(\"td\");\n newRow.appendChild(newTd);\n }\n pixelCanvas.append(newRow);\n }\n}", "function makeGrid() {\n let body = $(\"#pixel_canvas\")[0];\n // $(body).html() = \"\";\n rowVal = $(\"#input_height\").val();\n colVal = $(\"#input_width\").val();\n for (let r = 0; r < rowVal; r++) {\n let row = body.insertRow(r);\n for (let c = 0; c < colVal; c++) {\n let cell = row.insertCell(c);\n $(cell).on('click', function(evt) {\n evt.target.style.backgroundColor = $(\"#colorPicker\").val();\n this.style.borderColor = \"#000\";\n });\n }\n }\n return false;\n}", "function makeGrid(e) {\n // Select color input\n // const colorPicked = document.getElementById('colorPicker').value;\n // Select size input\n //height (tr)\n let inputHeight = document.getElementById('inputHeight').value;\n // console.log(inputHeight);\n //width (td)\n let inputWidth = document.getElementById('inputWidth').value;\n // console.log(inputWidth);\n // canvas\n let pixelCnvs = document.getElementById('pixelCanvas');\n pixelCnvs.innerHTML = '';\n // adding tr and td to the table\n let tableBody = document.createElement('tbody');\n for(let i = 0; i < inputHeight; i++) {\n let tableRow = document.createElement('tr');\n for (let j = 0; j < inputWidth; j++) {\n let tableColumn = document.createElement('td');\n tableColumn.appendChild(document.createTextNode(''));\n tableRow.appendChild(tableColumn);\n }\n tableBody.appendChild(tableRow);\n }\n pixelCnvs.appendChild(tableBody);\n e.preventDefault();\n\n}", "function makeGrid() {\n // reset pixel canvas\n $(\"#pixelCanvas\").html(\"\");\n // Select size input\n height = $(\"#inputHeight\").val();\n width = $(\"#inputWeight\").val();\n //loop to add table cells and rows according to user input\n for (let x = 0; x < height; x++) {\n $('#pixelCanvas').append('<tr></tr>');\n }\n for (let y = 0; y < width; y++) {\n $('#pixelCanvas tr').each(function () {\n $(this).append('<td></td>');\n });\n }\n}", "function makeGrid(height, width) {\n\n for (let r = 0; r < height; r++) {\n let row = shape.insertRow(r);\n\n for (let c = 0; c < width; c++) {\n let cell = row.insertCell(c);\n\n cell.addEventListener('click', (event) => {\n cell.style.backgroundColor = chooseColor.value;\n });\n }\n }\n}", "function drawGrid() {\n noFill();\n stroke(230, 50);\n strokeWeight(2);\n\n for (let j = 0; j < config.numRows; j++) {\n for (let i = 0; i < config.numCols; i++) {\n rect(i * colWidth, j * rowHeight, colWidth, rowHeight)\n }\n }\n }", "function createGrid(width, height) {\n\n}", "function createGrid() {\n for (let i = 0; i < DIMENSION; ++i) {\n const container = document.querySelector('#gridContainer');\n const row = document.createElement('div');\n\n row.classList.add('row');\n container.appendChild(row);\n\n for (let j = 0; j < DIMENSION; ++j) {\n const cell = document.createElement('div');\n cell.classList.add('cell');\n\n row.appendChild(cell);\n paint(cell);\n }\n }\n}", "function initCanvas()\n{\n\n\tcanvas = document.getElementById(\"board\");\n\n\tif(canvas.getContext) {\n\t\tctx = canvas.getContext(\"2d\");\n\t\t\n\t\t//Size the canvas to the screen\n\t\tctx.canvas.width = window.innerWidth - (window.innerWidth % cellSide);\n\t\tctx.canvas.height = ctx.canvas.width;\n\t\t\n\t\tvar width = canvas.width;\n\t\tvar height = canvas.height;\n\t\t\n\t\t//Clear the canvas\n\t\tctx.clearRect(0, 0, width, height);\n\t\t\n\t\t//Set the line color\n\t\tctx.strokeStyle = \"black\";\n\t\tctx.lineWidth = 1;\n\t\t\n\t\tctx.beginPath();\n\t\t//Draw horizontal lines\n\t\tfor(i = cellSide; i < height; i += cellSide)\n\t\t{\n\t\t\tctx.moveTo(0, i);\n\t\t\tctx.lineTo(width, i);\n\t\t}\n\t\t\n\t\t//Draw horizontal lines\n\t\tfor(i = cellSide; i < width; i += cellSide)\n\t\t{\n\t\t\tctx.moveTo(i, 0);\n\t\t\tctx.lineTo(i, height);\n\t\t}\n\t\tctx.stroke();\n\t\tctx.closePath();\n\t}\n\t\n\t\n\t//Initialize the board to being empty\n\tcellXCount = cps; //canvas.width / cellSide;\n\tcellYCount = cps; //canvas.height / cellSide;\n\tboardVals = new Array(cellXCount);\n\t\n\tfor(i = 0; i < cellXCount; i++)\n\t{\n\t\tboardVals[i] = new Array(cellYCount);\n\n\t\tfor(j = 0; j < cellYCount; j++)\n\t\t{\n\t\t\tboardVals[i][j] = 0;\n\t\t}\t\n\t}\t\n\t\n\t//Load the board state\n\tloadBoard();\n}", "function setup() // P5 Setup Fcn\n{\n let sz = g_canvas.cell_size;\n let width = sz * g_canvas.wid; // Our 'canvas' uses cells of given size, not 1x1 pixels.\n let height = sz * g_canvas.hgt;\n createCanvas(width, height); // Make a P5 canvas.\n draw_grid(20, 320, 'white', 'yellow');\n\n draw_headers(); // draw the headers for each algorithm\n}", "configCells(){\n for (var j=0; j<this.rows; j++){\n for(var i=0; i<this.columns; i++){\n var c = this.cell(i,j) ;\n c.north = this.cell(i,j+1) ;\n c.south = this.cell(i,j-1) ;\n c.east = this.cell(i+1,j) ;\n c.west = this.cell(i-1,j) ;\n }\n }\n }", "function makeGrid() {\r\n\r\n // Your code goes here!\r\n\r\n // Getting the grid height value from user\r\n const gridHeight = document.getElementById('inputHeight').value;\r\n // Getting the grid width value from user\r\n const gridWidth = document.getElementById('inputWidth').value;\r\n // Canvas table vairable\r\n const tableCanvas = document.getElementById('pixelCanvas');\r\n\r\n // Reset values to start\r\n tableCanvas.innerHTML = '';\r\n\r\n // Loop for inserting the rows\r\n for (let i = 0; i < gridHeight; i++) {\r\n let r = tableCanvas.insertRow(i);\r\n // Nested loop for inserting the cells\r\n for (let j = 0; j < gridWidth; j++) {\r\n let c = r.insertCell(j);\r\n // Action for the cells\r\n c.addEventListener('click', function(action) {\r\n // If the cell was pressed, the background color will change to the selected color\r\n action.target.style.backgroundColor = document.getElementById('colorPicker').value;\r\n });\r\n }\r\n }\r\n \r\n}", "function setupGrid() {\n\n // Initialize the grid with all false values, i.e. the inactive state\n for (let i = 0; i < numRectanglesWide; i++) {\n grid.push([]);\n for (let j = 0; j < numRectanglesHigh; j++) {\n grid[i].push(false);\n }\n }\n\n ctx.strokeStyle = gridColor;\n ctx.lineWidth = gridThickness;\n\n const drawLine = (x1, y1, x2, y2) => {\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n };\n\n // Since we draw the lines on the left and top sides of each rectangle,\n // we need to use <= instead of < so that the last border is drawn\n\n // Draws vertical grid lines\n for (let i = 0; i <= numRectanglesWide; i++) {\n const x = i * rectangleWidth + i * gridThickness;\n drawLine(x, 0, x, canvas.height);\n }\n\n // Draws horizontal grid lines\n for (let i = 0; i <= numRectanglesHigh; i++) {\n const y = i * rectangleHeight + i * gridThickness;\n drawLine(0, y, canvas.width, y);\n }\n }", "function makeGrid() {\n\n\t// Your code goes here!\n\t\n\tlet submit = $('input[type=\"submit\"]');\n\tlet canvas = $('#pixelCanvas');\n\tlet colorPicker = $('#colorPicker');\n\n\tsubmit.on('click', function(e){\n\t\te.preventDefault();\n\t\tcanvas.empty();\n\t\tlet height = $('#inputHeight').val();\n\t\tlet width = $('#inputWeight').val();\n\t\tconsole.log(height);\n\t\tconsole.log(width);\n\t\taddRows(height, width);\n\t});\n\t\n\tfunction addRows(height,width){\n\t\tfor(var i=0; i < height; i++) {\n\t\t\tcanvas.append('<tr></tr>');\n\t\t}addColumns(width);\n\t}\n\t\n\tfunction addColumns(width){\n\t\tfor(var i=0; i <width; i++) {\n\t\t\tlet cell=$('<td></td>',{class:'cells'});\n\t\t\n\t\t\tcell.on('click',function(e){\n\t\t\t\te.preventDefault()\n\t\t\t\tlet color = colorPicker.val();\n\t\t\t\t$(this).css('background-color', color);\n\t\t\t});\n\n\t\t\t$('tr').append(cell);\n\t\t}\n\t}\n\n\t$('#clear').on('click', function(e){\n\t\te.preventDefault();\n\t\t$('.cells').css('background-color','');\n\t})\n}", "function createCell() {\r\n //Setting each cell to default values (the moment its inserted into the 2D array)\r\n //Each cell will be given ----another attribute---- of ID in the function below\r\n var tableCell = {\r\n minesAroundCount: 0,\r\n isShown: false,\r\n isMine: false,\r\n isMarked: false\r\n\r\n };\r\n return tableCell;\r\n}", "function makeGrid(_row, _col, _rowID, _colID) {\n // let canvasTable = document.getElementById('canvasTable'); // table used for drawing artwork\n let table = '';\n\n console.log('makeGrid');\n //Create grid rows\n for (let r = 0; r < _row; r++) {\n table += '<tr class=\"pixel\">'; // add row opening with <tr> tag\n //Create grid columns\n for (let c = 0; c < _col; c++) {\n //add <td> tags equal to _col\n //each <td> has an id equal to the row/col. e.g. id=A4\n // OLD - Removed 'onclick' and placed inside sketch.js file\n // table += '<td class=\"pixel\" id=' + _rowID[r] + _colID[c] + ' onclick=\"changeColor(this)\"></td>'; // add cols\n table += '<td class=\"pixel\" id=' + _rowID[r] + _colID[c] + '></td>'; // add cols\n\n // table += '<td class=\"pixel\" id=' + rowID[r] + colID[c] + '></td>'; // add cols\n }\n //add closing </tr> tag to each completed row\n table += '</tr>';\n }\n // add table elements inside of <table id='pixelTable' class='pixel'></table>\n document.getElementById('pixelTable').innerHTML = table;\n}", "function makeGrid(height, width) {\n var table = document.getElementById('pixelCanvas');\n table.innerHTML=\"\";\n for (var i = 0; i<height; i++){\n var row = table.insertRow();\n for (var j = 0; j<width; j++){\n var cell = row.insertCell();\n cell.addEventListener('click', function(event){\n event.target.style.backgroundColor = color.value;})\n }\n }\n}", "function makeGrid() {\n //remove previous table if exists\n $('#gridTable').remove();\n const height = document.getElementById('input_height').value;\n const width = document.getElementById('input_width').value;\n\n\n // create table\n const table = document.createElement('table');\n table.id = \"gridTable\";\n\n // add rows and columns to the table\n for (let i = 0; i < height; ++i) {\n const row = table.insertRow(i);\n for (let j = 0; j < width; ++j) {\n const cell = row.insertCell(j);\n\n // add event listener to each cell such that\n // it is fillied with selected color when clicked\n cell.addEventListener('click', (e) => {\n changeColor(e);\n });\n }\n }\n\n // append the table to the canvas\n document.getElementById('pixel_canvas').append(table);\n}", "function makeGrid() {\n\n let h = height.value;\n let w = width.value;\n\n // Clear table\n for (let i = table.rows.length; i > 0 ; i--) {\n table.deleteRow(i - 1);\n }\n\n for (let y = 0; y < h; y++) {\n const newTr = document.createElement('tr');\n table.appendChild(newTr);\n for (let x = 0; x < w; x++) {\n const newTd = document.createElement('td');\n table.lastChild.appendChild(newTd);\n }\n }\n\n let cell = table.querySelectorAll('td');\n\n for (let i = 0; i < cell.length; i++) {\n cell.item(i).addEventListener('click', function () {\n this.style.backgroundColor = color.value;\n });\n }\n}", "function makeGrid() {\n canvas.find('tbody').remove();\n\n //submit button size changes to fit grid size\n var gridRows = heightInput.val();\n var gridCol = weightInput.val();\n\n //tbody set to the table\n canvas.append('<tbody></tbody>');\n\n var canvasBody = canvas.find('tbody');\n\n //drawing grid rows\n for (var i = 0; i < gridRows; i++) {\n canvasBody.append('<tr></tr>');\n }\n\n //draw grid col\n for (var i = 0; i < gridCol; i++) {\n canvas.find('tr').append('<td class=\"transparent\"></td>');\n }\n }", "function setup() {\n\n\n createCanvas(windowWidth - 20, windowHeight - 20);\n rectMode(CENTER);\n cols = Math.floor(width / grid);\n rows = Math.floor(height / grid);\n mid_col = Math.round(cols / 2);\n\n reset();\n}", "function createCanvas(){\n var c = document.createElement('canvas');\n c.width = (width * cellsize) + ((1 + width) * padding);\n c.height = (height * cellsize) + ((1 + height) * padding);\n return c;\n }", "function makeGrid() {\n // Select size input\n const height = document.getElementById('inputHeight').value;\n const width = document.getElementById('inputWidth').value;\n // select table\n const table = document.getElementById('pixelCanvas');\n //remove old table then create new one .\n table.innerHTML = \"\";\n // create inner loops to draw row and column .\n for (var i = 0; i < height; i++) {\n // create a new row .\n var tableRow = document.createElement(\"tr\");\n for (var j = 0; j < width; j++) {\n // create new column in each rows.\n var tableCell = document.createElement(\"td\");\n tableRow.appendChild(tableCell);\n }// End inner for loop .\n // add row and cell in each round .\n var cell = table.appendChild(tableRow);\n // add listenr to each cell.\n cell.addEventListener('click', function (e) {\n // Select color input\n var color = document.getElementById('colorPicker').value;\n e.target.style.backgroundColor = color;\n });\n }; // end main loop.\n}", "setup(){\n for(var j=0; j<this.rows; j++){\n for(var i=0; i<this.columns; i++){\n var cell = this.grid.cell(i,j) ;\n if (cell.linked(cell.east)){\n this.verticalWall(i+1,j).standing = false ;\n }else{\n this.verticalWall(i+1,j).standing = true ;\n }\n if (cell.linked(cell.north)){\n this.horizontalWall(i,j+1).standing = false ;\n }else{\n this.horizontalWall(i,j+1).standing = true ;\n }\n }\n }\n this.setCells() ;\n this.setWalls() ;\n this.setCorners() ;\n this.setDoors() ;\n }", "function makeGrid(event) {\r\n \tevent.preventDefault();\r\n \t// height and width values declared to create the pixel canvas\r\n\tlet height = inputHeight.value;\r\n\tlet width = inputWidth.value;\r\n\t//creating a blank table in the HTML\r\n \ttable.innerHTML = \"\";\r\n \t//build table depending on values entered by the user. Reviewed the knowledge area to get the table to build.\r\n \tfor (let r = 0; r < height; r++) {\r\n \tlet row = document.createElement(\"tr\");\r\n \tfor (let c = 0; c < width; c++) {\r\n \t\tlet cell = document.createElement(\"td\");\r\n \t\trow.appendChild(cell); //append the column to the table\r\n \t\tcell.addEventListener(\"click\", function (cellColor) {\r\n \t\tcellColor.target.style.backgroundColor = color.value; //set background color to user selection.\r\n \t\t});\r\n \t}\r\n table.appendChild(row);\r\n //append the row to the table.\r\n //The placement of this action was identified on the knowledge area, as initially had this after declaring the row variable.\r\n \t}\r\n}", "function makeGrid(){\n\tconst inputHt=$('#inputHeight').val(); //Getting input value for row\n\tconst inputWt=$('#inputWidth').val(); //Getting input value for column\n\n\tfor(var i=0;i<inputHt;i++){\n\t\t$('#pixelCanvas').append(\"<tr id=row\" +i+ \"></tr>\"); //creating rows\n\t\tfor(var j=0;j<inputWt;j++){\n\t\t\t$('#row'+i).append(\"<td></td>\"); //creating columns\n\t\t}\n\t}\n}", "function init() {\n\t\tvar board = $(\"<table border=0 cellspacing=0>\"),\n\t\t\tidentifier = 1;\n\t\tfor (var i = 0; i < N_SIZE; i++) {\n\t\t\tvar row = $(\"<tr>\");\n\t\t\tboard.append(row);\n\t\t\tfor (var j = 0; j < N_SIZE; j++) {\n\t\t\t\tvar cell = $(\"<td height=120 width=120 align=center valign=center></td>\");\n\t\t\t\tcell.addClass('col' + j).addClass('row' + i);\n\t\t\t\tif (i == j) {\n\t\t\t\t\tcell.addClass('diagonal0');\n\t\t\t\t}\n\t\t\t\tif (j == N_SIZE - i - 1) {\n\t\t\t\t\tcell.addClass('diagonal1');\n\t\t\t\t}\n\t\t\t\tcell[0].identifier = identifier;\n\t\t\t\tcell.click(set);\n\t\t\t\trow.append(cell);\n\t\t\t\tboxes.push(cell);\n\t\t\t\tidentifier += identifier;\n\t\t\t}\n\t\t}\n\n\t\t$(document.getElementById(\"tictactoe\") || document.body).append(board);\n\t\tstartNewGame();\n\t}", "function createGrid(){\n for (let i=0; i<gridSize; i++) {\n const div = document.createElement('div');\n grid.appendChild(div);\n // Push elements to previously empty cells array\n cells.push(div);\n }\n createLife();\n generateTrees();\n }", "function createGrid() {\n var gridCanvas = document.createElement('canvas');\n gridCanvas.width = gridSize.cols*gridSize.square;\n gridCanvas.height = gridSize.rows*gridSize.square;\n var gridContext = gridCanvas.getContext('2d');\n\n // pass canvas to external variable so it can be used elsewhere as an image\n gridImage = gridCanvas;\n\n var horizontal;\n var vertical;\n var positionX = 0+(canvas.width/2)-32+320; // starting position of hooks\n var positionY = 0;\n var order;\n\n for (var i = 0; i < gridSize.cols; i++) {\n if (order === true) {\n order = false;\n } else {\n order = true;\n }\n drawCol(gridContext,positionX,order);\n positionX += 64;\n }\n}", "function setup() {\r\n var canvas = createCanvas(920, 920);\r\n canvas.parent(\"teste\")\r\n\r\n //Height and width\r\n w = Math.floor(920 / cols);\r\n h = Math.floor(920 / rows);\r\n\r\n // Make a 2D array\r\n for (i = 0; i < cols; i++) {\r\n grid[i] = new Array(rows);\r\n }\r\n\r\n //Make the cells of the grid\r\n for (i = 0; i < cols; i++) {\r\n for (j = 0; j < rows; j++) {\r\n grid[i][j] = new Cell(i, j);\r\n }\r\n\r\n }\r\n\r\n // make population\r\n for (i = 0; i < populationSize; i++) {\r\n population.push(new Unit(0, 0))\r\n\r\n }\r\n\r\n // make the population genes\r\n for (k = 0; k < population.length; k++) {\r\n population[k].newGene(life);\r\n population[k].generation = generation;\r\n }\r\n\r\n //defines the beginning and end as the two ends of the grid and give then colors\r\n start = grid[0][0];\r\n grid[0][0].color = \"#4f98ca\"\r\n\r\n end = grid[cols - 1][rows - 1];\r\n grid[cols - 1][rows - 1].color = \"#4f98ca\"\r\n\r\n\r\n\r\n updatePopulation()// update DOM\r\n\r\n}", "function makeGrid() {\n //variables to get canvas element,height,width\n var table = $(\"#pixelCanvas\");\n var gridHeight = $(\"#inputHeight\");\n var gridWidth = $(\"#inputWeight\");\n table.children().remove();\n for (x = 0; x < gridHeight.val(); x++) {\n table.append('<tr></tr>');\n }\n rows = $('tr');\n for (y = 0; y < gridWidth.val(); y++) {\n rows.append('<td></td>');\n } \n table.on( 'click','td', function() { \n var color = $(\"#colorPicker\"); \n $(this).attr('bgcolor', color.val()); \n });\n}", "function createSetupGrid(section, player){\n let table = document.createElement('table')\n for(let i = 0; i < GRID_SIZE; i++){\n let row = document.createElement('tr')\n for(let j = 0; j < GRID_SIZE; j++){\n let cell = document.createElement('th')\n cell.setAttribute('data-coord', `{x: ${i}, y: ${j}}`)\n cell.className = \"clickableCell\"\n cell.addEventListener('click', function(){\n chooseSetupCell(cell, player, i, j)\n })\n row.appendChild(cell)\n }\n table.appendChild(row)\n }\n section.appendChild(table)\n}", "function setup() {\n createCanvas(600, 600);\n textAlign(CENTER, CENTER);\n W = H = winNum = gridSize;\n tileSize = width/W; // Assume square grid\n \n init();\n}", "function makeGrid(height, width) {\n\n\tfor(var x = 0; x < height; x++){\n\t\tlet row = table.insertRow(x); \n\t\tfor(var y = 0; y < width; y++){\n\t\t\tlet cell = row.insertCell(y);\n\t\t\tcell.addEventListener('click', function(event){\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcell.style.background = penColor.value; \n\t\t\t})\n\t\t}\n\t}\n\n\n}", "function setup() {\n createCanvas(SCREEN_SIZE, SCREEN_SIZE);\n background(0);\n strokeWeight(4);\n colorMode(HSB);\n \n // divide screen to bounded cells\n cols = floor(width/w); \n rows = floor(height/w);\n // make the grid\n for(let i = 0; i < cols * rows; i++){\n grid[i] = undefined;\n }\n // pick a random point, instead we will chose the center for better visualization\n let x = width / 2;\n let y = height / 2;\n // the index of the random point in the bounded cells\n let i = floor(x / w);\n let j = floor(y / w);\n // create as a vector\n let pos = createVector(x, y);\n // insert that random point to the background grid\n grid[i + j * cols] = pos;\n active.push(pos);\n \n}", "function makeGrid() { // Select and create grid size\n \n // select the table\n let pixelCanvas = document.querySelector('#pixelCanvas');\n \n // Select size input\n let gridHeight;\n let gridWidth;\n \n gridHeight = document.querySelector(\"#inputHeight\").value;\n gridWidth = document.querySelector(\"#inputWidth\").value;\n\n console.log(`gridHeight is ${gridHeight} and gridWidth is ${gridWidth}`);\n\n for (let i = 0 ; i < gridHeight ; i++) {\n console.log(`before building row ${i} of ${gridHeight}`);\n pixelCanvas.insertAdjacentHTML('beforeend', '<tr></tr>');\n };\n \n let trs = document.querySelectorAll(\"tr\");\n console.log(`trs.length is ${trs.length}`);\n for (let i = 0 ; i < gridWidth ; i++) { \n console.log(`before building column ${i} of ${gridWidth}`);\n \n for (let tr = 0; tr < trs.length; tr++) {\n console.log(`before building on tr ${tr} of ${trs.length}`);\n trs[tr].insertAdjacentHTML('beforeend', '<td></td>');\n }\n }\n \n // creates the css background color decided before submit grid creation\n console.log(`background color is ${backgroundColor}`);\n //create variable for all cells\n let gridCells = document.querySelectorAll(\"td\");\n //paint all cells of the grid iterating through the nodelist gridCells\n for (let gridCell = 0; gridCell < gridCells.length; gridCell++) {\n console.log(`painting BG gridCell ${gridCell} of ${gridCells.length}`);\n gridCells[gridCell].style.backgroundColor = backgroundColor;\n }\n \n }", "function drawCells() {\n // Get canvas context\n var canvas = document.getElementById('mainCanvas');\n var ctx = canvas.getContext('2d');\n\n // Get the grid padding\n var padding = getGridPadding();\n\n // Cycle through the grid\n for (var i = 0; i < window.numCellsX; i++) {\n for (var j = 0; j < window.numCellsY; j++) {\n // Check if cell is alive or dead\n if (window.grid[i][j]) {\n // If cell is alive then color with cell color\n ctx.fillStyle = window.cellColor;\n } else {\n // If cell is dead then color with background color\n ctx.fillStyle = window.backgroundColor;\n }\n\n // Draw the cells\n var halfGridLineWidth = (window.cellSize / window.gridLineWidthRatio) / 2;\n ctx.fillRect(padding.horizontal + (i * window.cellSize) + halfGridLineWidth,\n padding.vertical + (j * window.cellSize) + halfGridLineWidth,\n window.cellSize - halfGridLineWidth, window.cellSize - halfGridLineWidth);\n }\n }\n}", "function makeGrid(height,width) {\n for (let r = 0; r < height; r++) {\n $('#pixel_canvas').prepend('<tr></tr>');\n for (let d = 0; d < width; d++) {\n $('tr').first().append('<td></td>')\n }\n }\n}", "function makeGrid() {\n const body = document.getElementsByTagName(\"body\")[0];\n const table = document.querySelector(\"#pixelCanvas\");\n const tableBody = document.createElement(\"tbody\");\n\n // Removing the previous grid (if any)\n if (table.firstChild) {\n table.firstChild.remove();\n };\n\n // Making a grid using user input\n for (let i = 0; i < newHeight; i++) {\n const row = document.createElement(\"tr\");\n\n for (let j = 0; j < newWidth; j++) {\n const cell = document.createElement(\"td\");\n row.appendChild(cell);\n };\n\n tableBody.appendChild(row);\n };\n\n table.appendChild(tableBody);\n body.appendChild(table);\n\n // Adding an event which changes background color for individual cells\n const td = document.getElementsByTagName(\"td\");\n\n for (let i = 0; i < td.length; i++) {\n td[i].onclick = function() {\n this.style.backgroundColor = newColor;\n };\n };\n}", "function init(squareHeight,squareWidth) {\n\n\tvar initDraw = 1\n\n\tfor(i = 0; i < maxRow; i++) {\n\t\n\t\tfor(j = 0; j < maxCol; j++) {\n\t\n\t\t\tcellID = j+'_'+i\n\t\n\t\t\tcells[cellID] = new Cell(cellID,j,i,maxRow,maxCol)\n\t\n\t\t\tcells[cellID].create(squareHeight,squareWidth)\n\t\n\t\t}\n\t\n\t}\n\n}", "function drawGrid() {\n jaws.context.save();\n jaws.context.strokeStyle = \"rgba(5,119,17,0.7)\";\n jaws.context.beginPath();\n\n for (var x = 0; x < m_viewport.max_x; x += cell_size) {\n jaws.context.moveTo(x - m_viewport.x, 0);\n jaws.context.lineTo(x - m_viewport.x, jaws.height);\n }\n for (var y = 0; y < m_viewport.max_y; y += cell_size) {\n jaws.context.moveTo(0, y - m_viewport.y);\n jaws.context.lineTo(jaws.width, y - m_viewport.y);\n }\n\n jaws.context.closePath()\n jaws.context.stroke()\n jaws.context.restore()\n }", "createGrid(){\n\n var self = this\n\n // Get the canvas to work on\n var canvas = $('#minigame-modal').find('.modal-body')\n\n // Append a table\n canvas.append('<div class=\"well-grid-wrapper\"></div>')\n $('.well-grid-wrapper').append('<table class=\"table-fixed\" id=\"well-grid\"></table')\n var tbody = $('#well-grid')\n tbody.append('<tbody id=\"well-grid-body\"></tbody>')\n\n // Append 22 rows\n for (var i=0; i<80; i++) {\n var trow = $('<tr class=\"well-grid-col\" id=\"well-grid-col-'+i+'\"></tr>')\n for (var j=0; j<5; j++) {\n var tcell = $('<td class=\"well-grid-cell well-grid-col-'+i+' well-grid-row-'+j+'\"></td>')\n var cell = $('<div class=\"well-grid-cell-wrapper\"></div>')\n .attr('data-grid-row',i)\n .attr('data-grid-col',j)\n .attr('data-stone-clicked',0)\n var stone = $('<img class=\"img-fluid well-stone\" src=assets/images/minigames/puzzles/well/well-stone-in0.jpg alt=\"Stone\">')\n cell.append(stone)\n tcell.append(cell)\n trow.append(tcell)\n }\n tbody.append(trow)\n }\n\n // Add an on-click method for each cell, to move the stone in on click\n $('.well-grid-cell-wrapper').on(\"click\",function(){self.moveStoneIn(this)})\n\n // Add icons to the stones\n this.addIcons()\n\n }", "function drawGrid() {\n\t\tcontext.fillStyle = GRID_COLOR;\n\t\tfor (var i = GRID_CELL_WIDTH; i < canvas.width; i = i + GRID_CELL_WIDTH) {\n\t\t\tfor (var j = GRID_CELL_WIDTH; j < canvas.height; j = j + GRID_CELL_WIDTH) {\n\t\t\t\tcontext.fillRect(i, j, 1, 1);\n\t\t\t}\n\t\t}\n\t}", "function drawCells() {\n // Draw the background\n colorRect(0, 0, canvas.width, canvas.height, 'green');\n\n for (var i = 0; i <= HEIGHT - 1; i++) {\n for (var j = 0; j <= WIDTH - 1; j++) {\n grid[i][j].draw();\n }\n }\n}", "function initCells() {\n\tfor (var i=0; i<NY; i++) {\n\t\tfor (var j=0; j<NX; j++) {\n\t\t\tcells[i][j].innerHTML = '<img src=\"images/i0.png\" />';\n\t\t\ttemplate.children[i].children[j].innerHTML = levels[currentLevel][i][j]==0?' ':levels[currentLevel][i][j].toString();\n\t\t}\n\t}\n}", "function init(){\n\n\tvar board=document.createElement('table');//create table \n\tboard.id='board';\n\tboard.setAttribute('border',1);\n\tboard.setAttribute('cellspacing',0);\n\n\n\tvar identifier =1;\n\n\tfor(var i=0;i<N_SIZE;i++){\n\t\tvar row=document.createElement('tr');\n\t\tboard.appendChild(row);\n\n\t\tfor(var j=0;j<N_SIZE;j++){\n\t\t\tvar cell=document.createElement('td');\n\t\t\tcell.setAttribute('height',3*110/(N_SIZE));\n\t\t\tcell.setAttribute('width',3*120/(N_SIZE));\n\t\t\tcell.setAttribute('align','center');\n\t\t\tcell.setAttribute('valign','center');\n\t\t\tcell.classList.add('col'+j,'row'+i);// learn\n\t\t\tif(i==j){\n\t\t\t\tcell.classList.add('diagonal0');\n\t\t\t}\n\t\t\tif(j==N_SIZE-i-1){\n\t\t\t\tcell.classList.add('diagonal1');\n\t\t\t}\n\n\t\t\tcell.identifier=identifier;//know \n\n\t\t\t// cell.addEventListener('click',set);\n\t\t\trow.appendChild(cell);\n\t\t\tboxes.push(cell);\n\t\t\tidentifier+=identifier;\n\t\t}\n\n\t}\n\tdocument.getElementById('tictactoe').appendChild(board);\n\tstartNewGame();\n\n}", "function staticUpdateCells(grid) {\r\n var new_canvas = getCanvas();\r\n for (var i = 0; i < NUM_ROWS; i += 1) {\r\n for (var j = 0; j < NUM_COLS; j += 1) {\r\n new_canvas.fillStyle = grid[i][j].fillStyle;\r\n new_canvas.fillRect(grid[i][j].xPosition, grid[i][j].yPosition, CELL_SIZE, CELL_SIZE);\r\n }\r\n }\r\n }", "function createGrid(){\n var color = '#BDBDBD';\n \n //Creates vertical grid\n for(var i = origin.x; i < canvasWidth; i += step){ //Populates right of the origin\n var line = two.makeLine(i, 0, i, canvasHeight);\n line.linewidth = 1;\n line.stroke = color;\n }\n for(var i = origin.x; i > 0; i -= step){ //Populates left of the origin\n var line = two.makeLine(i, 0, i, canvasHeight);\n line.linewidth = 1;\n line.stroke = color;\n }\n \n \n //Creates horizontal grid\n for(var i = origin.y; i < canvasHeight; i += step){ //Populates above the origin\n var line = two.makeLine(0, i, canvasWidth, i);\n line.linewidth = 1;\n line.stroke = color;\n }\n for(var i = origin.y; i > 0; i -= step){ //Populates below the origin\n var line = two.makeLine(0, i, canvasWidth, i);\n line.linewidth = 1;\n line.stroke = color;\n }\n}", "createGrid() {\n const board = $(this.selector);\n board.empty();\n\n console.log(board);\n for (let x = 0; x < this.ROWS; x++) {\n const row = $('<div>').addClass('row');\n board.append(row);\n for (let y = 0; y < this.COLS; y++) {\n // gives each index of the rows and columns using the attr\n const col = $('<div>').addClass('col empty').attr('data-col', y).attr('data-row', x);\n row.append(col);\n }\n }\n\n }", "function makeCells() {\n let rowsI = document.getElementById('rows-input');\n let columnsI = document.getElementById('columns-input');\n let cellAmount = rowsI.value * columnsI.value;\n console.log(rowsI.value);\n console.log(columnsI.value);\n board.style.gridTemplateRows = `repeat(${rowsI.value}, 1fr)`;\n board.style.gridTemplateColumns = `repeat(${columnsI.value}, 1fr)`;\n for (i = 0; i < cellAmount; i++){\n let cell = document.createElement('div');\n cell.className = 'cell';\n cell.id = `cell-${i}`;\n board.appendChild(cell);\n }\n}", "function makeGrid(){\r\n $('#pixel_canvas').children().remove();\r\n row=$('#input_height').val();\r\n column=$('#input_width').val();\r\n var i=0;\r\n while(i<row){\r\n $('#pixel_canvas').append('<tr></tr>');\r\n for(var j=0;j<column;j++){\r\n $('tr').last().append('<td></td>');\r\n }\r\n i++;\r\n }\r\n }", "function makeGrid(inputHeight, inputWidth) {\n var grid = '';\n\n for (let i = 0; i < inputHeight; i++) {\n grid += '<tr>';\n for (let w = 0; w < inputWidth; w++) {\n grid += '<td class=\"cell\"></td>';\n };\n grid += '</tr>';\n };\n\n //append grid to the table\n pixelCanvas.innerHTML = grid;\n}" ]
[ "0.7747093", "0.76394457", "0.7602361", "0.7556827", "0.7544321", "0.74835265", "0.74592876", "0.7452599", "0.7426448", "0.7397788", "0.73968375", "0.73597836", "0.73011374", "0.72466093", "0.7182325", "0.7156476", "0.7134719", "0.7129528", "0.7123863", "0.7112673", "0.71071184", "0.70997417", "0.70835227", "0.70688134", "0.7053145", "0.704761", "0.704163", "0.7035799", "0.7023891", "0.69842994", "0.69815993", "0.69483376", "0.6916959", "0.6909684", "0.6898221", "0.68857324", "0.68767375", "0.6862923", "0.68572783", "0.6856457", "0.68537146", "0.68537134", "0.6838514", "0.6832901", "0.68287116", "0.68250096", "0.6824077", "0.6814494", "0.6807854", "0.67999244", "0.67969114", "0.6787182", "0.6784802", "0.678379", "0.67762816", "0.6762657", "0.67431104", "0.6735718", "0.6730726", "0.67235225", "0.6717825", "0.6714264", "0.67124677", "0.66991615", "0.66928846", "0.6691749", "0.66867614", "0.6680906", "0.66801745", "0.66732216", "0.6650678", "0.66471946", "0.6644685", "0.66443574", "0.6638489", "0.6637047", "0.66320777", "0.6631825", "0.6630646", "0.66274726", "0.66197807", "0.66131693", "0.66083515", "0.65999085", "0.6598727", "0.6598057", "0.6594143", "0.65928465", "0.6586991", "0.65802616", "0.65731853", "0.6560482", "0.6556896", "0.6555128", "0.6546751", "0.65429455", "0.6540802", "0.65404224", "0.6536496", "0.6536213", "0.65279233" ]
0.0
-1
remove walls for visited cell
function removeWalls(a,b) { let x = a.i - b.i; if(x === 1){ a.walls[3] = false; b.walls[1] = false; } else if (x === -1) { a.walls[1] = false; b.walls[3] = false; } let y = a.j -b.j; if(y === 1){ a.walls[0] = false; b.walls[2] = false; } else if (y === -1) { a.walls[2] = false; b.walls[0] = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeWalls() {\n if (wallsAreRemoved) {\n return;\n }\n\n let leftSize = neighborSizes[corner_].left;\n let rightSize = neighborSizes[corner_].right;\n\n if (width_ != depth_) {\n shedWalls[cornerNeighbors[corner_].left].geometry.clip.push(-leftSize * 0.5, ((leftSize == width_) ? width_ : depth_) - leftSize * 0.5);\n shedWalls[cornerNeighbors[corner_].right].geometry.clip.push(rightSize * 0.5 - ((leftSize == width_) ? depth_ : width_), rightSize * 0.5);\n } else {\n shedWalls[cornerNeighbors[corner_].left].geometry.clip.push(-leftSize * 0.5, width_ - leftSize * 0.5);\n shedWalls[cornerNeighbors[corner_].right].geometry.clip.push(rightSize * 0.5 - width_, rightSize * 0.5);\n }\n\n if (leftSize <= width_) {\n shedWalls[cornerNeighbors[corner_].afterLeft].geometry.clip\n .push(-rightSize * 0.5, ((width_ != depth_) ? tools.ft2cm(4) : INNER_WALL_SIZE_12) - rightSize * 0.5);\n }\n\n if (rightSize <= width_) {\n shedWalls[cornerNeighbors[corner_].beforeRight].geometry.clip\n .push(leftSize * 0.5 - ((width_ != depth_) ? tools.ft2cm(4) : INNER_WALL_SIZE_12), leftSize * 0.5);\n }\n\n shedColumns_[corner_].visible = false;\n\n if (leftSize <= width_) {\n let nextContainer = (corner_ < 3) ? corner_ + 1 : 0;\n shedColumns_[nextContainer].visible = false;\n }\n\n if (rightSize <= width_) {\n let previousCorner = (corner_ > 0) ? corner_ - 1 : 3;\n shedColumns_[previousCorner].visible = false;\n }\n\n wallsAreRemoved = true;\n }", "function removeWall(a, b) {\r\n switch( a.col - b.col){\r\n case 1:\r\n a.walls.left = false\r\n b.walls.right = false\r\n break\r\n case -1:\r\n a.walls.right = false\r\n b.walls.left = false\r\n }\r\n switch(a.row - b.row){\r\n case 1:\r\n a.walls.top = false\r\n b.walls.bottom = false\r\n break\r\n case -1:\r\n a.walls.bottom = false\r\n b.walls.top = false\r\n }\r\n}", "function clearGridSaveWall(){\n for (let i = 0; i < GRID_ROW_SIZE; i++) { \n for (let j = 0; j < GRID_COL_SIZE; j++) {\n let State = Grid[i][j].State;\n if(State == \"Wall\" || State == \"Start\" || State == \"End\"){\n continue;\n }\n Grid[i][j].State = \"NULL\"\n Grid[i][j].VisitedAt = -1\n document.getElementById(Grid[i][j].id).innerHTML=\"\";\n }\n }\n \n}", "function restoreWalls() {\n if (!wallsAreRemoved) {\n return;\n }\n\n if (container_) {\n self.remove(container_);\n }\n\n let leftSize = neighborSizes[corner_].left;\n let rightSize = neighborSizes[corner_].right;\n\n shedWalls[cornerNeighbors[corner_].left].geometry.clip.pop();\n shedWalls[cornerNeighbors[corner_].right].geometry.clip.pop();\n\n if (neighborSizes[corner_].left <= width_) {\n shedWalls[cornerNeighbors[corner_].afterLeft].geometry.clip.pop();\n }\n\n if (neighborSizes[corner_].right <= width_) {\n shedWalls[cornerNeighbors[corner_].beforeRight].geometry.clip.pop();\n }\n\n innerWalls_ = [];\n\n shedColumns_[corner_].visible = true;\n\n if (leftSize <= width_) {\n let nextContainer = (corner_ < 3) ? corner_ + 1 : 0;\n shedColumns_[nextContainer].visible = true;\n }\n\n if (rightSize <= width_) {\n let previousCorner = (corner_ > 0) ? corner_ - 1 : 3;\n shedColumns_[previousCorner].visible = true;\n }\n\n wallsAreRemoved = false;\n }", "function removeWalls(a, b) {\r\n var x = a.i - b.i;\r\n var y = a.j - b.j;\r\n if (x === -1) {\r\n a.walls[1] = false;\r\n b.walls[3] = false;\r\n } else if (y === 1) {\r\n a.walls[0] = false;\r\n b.walls[2] = false;\r\n } else if (x === 1) {\r\n a.walls[3] = false;\r\n b.walls[1] = false;\r\n } else if (y === -1) {\r\n a.walls[2] = false;\r\n b.walls[0] = false;\r\n }\r\n}", "removeWall(n) {\n this.x_coords_out.push(2*n - 3);\n this.y_coords_out.push(this.rowNr);\n }", "function removeWall() {\n\tvar i= planComponents.walls.indexOf(wallSelected);\n\t\n\tif (i!=-1)\n\t\tplanComponents.walls.splice(i,1);\n\t\n\treturn 1;\n}", "removeWalls(id){\n\t\tvar cell = document.getElementById(\"Cell\" + id);\n\t\tif(this.props.G.cells[id].walls[0] === 1){\n\t\t\tcell.style.borderTop = \"0\";\n\t\t}\n\t\t\n\t\tif(this.props.G.cells[id].walls[1] === 1){\n\t\t\tcell.style.borderRight = \"0\";\n\t\t}\n\t\t\n\t\tif(this.props.G.cells[id].walls[2] === 1){\n\t\t\tcell.style.borderBottom = \"0\";\n\t\t}\n\t\t\n\t\tif(this.props.G.cells[id].walls[3] === 1){\n\t\t\tcell.style.borderLeft = \"0\";\n\t\t}\n\t}", "function resetWalls() {\n\n wallSet.clear();\n reset();\n}", "function resetWalls() {\n let clearBtn = document.querySelector('.clear-board')\n clearBtn.addEventListener('click', () => {\n console.log('reset')\n let allWalls = document.querySelectorAll('.wall-node')\n let allVisited = document.querySelectorAll('.visited-node')\n let allPath = document.querySelectorAll('.path-node')\n\n allWalls.forEach((node) => {\n node.classList = 'unvisited'\n })\n allVisited.forEach((node) => {\n node.classList = 'unvisited'\n })\n allPath.forEach((node) => {\n node.classList = 'unvisited'\n })\n makeNodes();\n\n\n })\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 clearBoard() {\n for (i=0; i<=maxX; i++) {\n for (j=0; j<=maxY; j++) {\n with (cellArray[arrayIndexOf(i,j)]) {\n isExposed = false;\n isBomb = false;\n isFlagged = false;\n isMarked = false;\n isQuestion = false;\n neighborBombs = 0; } } } }", "function removeTunnels(i) {\n var vertical = [];\n\n if (isAdjacent(i, upFrom(i)) && isInTile(upFrom(i), \"wall\")) {\n vertical.push(upFrom(i));\n }\n if (isAdjacent(i, downFrom(i)) && isInTile(downFrom(i), \"wall\")) {\n vertical.push(downFrom(i));\n }\n if (isAdjacent(i, leftFrom(i)) && isInTile(leftFrom(i), \"wall\")) {\n vertical.push(leftFrom(i));\n }\n if (isAdjacent(i, rightFrom(i)) && isInTile(rightFrom(i), \"wall\")) {\n vertical.push(rightFrom(i));\n }\n\n while (vertical.length > 1) {\n var index = Math.floor(Math.random() * vertical.length);\n isInTile(vertical[index], \"wall\").destroy();\n vertical.splice(index, 1);\n }\n }", "function clearPath(obj) {\n\n /**\n * This function is same for both clear walls button and clear path button so need handling.\n * If the function is called by clicking the clear walls button then we cannot clear the path.\n * In matrix: '3' walls, '0' empty, '1' src, '2' dest, '7' extra path, '9' shortest path\n */\n\n let val = 0; /* This variable will store whether we want to clear walls or paths */\n if (obj.id === \"wall\") { /* If this Function is called by the clear wall button */\n val = 3; /* Then make the val = 3 means we want to remove walls */\n } else { /* Otherwise this Function is called by the clear Path button */\n val = 9; /* Then make val = 9 means we want to remove the paths */\n }\n\n /* Loop over each row */\n for (let i = 0; i < rows; i++) {\n\n /*Fixing each row then Loop over Every coloumn */\n for (let j = 0; j < cols; j++) {\n\n /* \n * If val === 9 means we are called to clear path and this location contains '7' means this is an extra path only then remove \n * Otherwise if we are called by clear wall button then we donot have to clear this extra path \n * \n * If val === 9 means we are here to clear path and value at this location is 9 that means this rect is part of shortest path\n * denoted on the screen by the algorithm hence clear the location.\n * If not then we are here to clear walls then no need to clear this location \n * \n * After handling all corner cases: Not check whether the value at this location is wall or not.\n * If yes then unPaint the rect as we are surely called by the clear wall button as all possiblities of clear path we have seen\n * in above conditions\n */\n if ((val === 9 && (matrix[i][j] === 7 || matrix[i][j] === 9)) || (matrix[i][j] === val)) {\n matrix[i][j] = 0; /* Marking the matrix as empty */\n document.getElementById(`${i}:${j}`).style.fill = \"\"; /* Marking the color as default of this rect on grid */\n continue; /* Every rect can have only one colour so no need to go further */\n }\n \n }\n }\n}", "function clearBackTrack() {\n\taRow=curRow.rowIndex;\n\taCol=curCell.cellIndex;\n\tfor(var i=0,l=routeCells.length;i<l;i++) {\n\t\trouteCells[i].style.backgroundColor=\"\";\n\t}\n\trouteLocations=new Array();\n\troute=new Array();\n\trouteCells=new Array();\n\tbacktrackDirs.firstChild.nodeValue = \"\";\n\tif(ghostPawn.parentNode)ghostPawn.parentNode.removeChild(ghostPawn);\n}", "function removeShape() {\n for (var row = 0; row < currentShape.shape.length; row++) {\n for (var col = 0; col < currentShape.shape[row].length; col++) {\n if (currentShape.shape[row][col] !== 0) {\n grid[currentShape.y + row][currentShape.x + col] = 0;\n }\n }\n }\n}", "wallsToExclude(rows, cols, scale) {\n const visited = [];\n for (let i = 0; i < rows; i++) {\n visited[i] = [];\n for (let j = 0; j < cols; j++) {\n visited[i].push(false);\n }\n }\n let startx = Math.min(Math.floor(Math.random() * rows), rows - 1);\n let starty = Math.min(Math.floor(Math.random() * cols), cols - 1);\n const toExclude = [];\n this.mazeGen(startx, starty, rows, cols, visited, scale, toExclude);\n toExclude.sort((a, b) => a.x == b.x ? a.z - b.z : a.x - b.x);\n return toExclude;\n }", "function putWalls() {\n console.log(\"Walls\");\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < m; j++) {\n if (grid[i][j] != source && grid[i][j] != end) {\n if (random(1) < 0.1) {\n grid[i][j].wall = true;\n }\n }\n }\n }\n\n source.wall = false;\n end.wall = false;\n\n background(\"#FFFFFF\");\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < m; j++) {\n grid[i][j].showCell(color(\"#FFFFFF\"));\n }\n }\n\n source.showCell(color(\"#1a3da6\"));\n end.showCell(color(\"#fd1036\"));\n}", "function\nstep_maze()\n{\n var i, j, k, o, n;\n\n /* randomly select one of the the remaining walls */\n k = Math.floor(Math.random()*redges);\n /* scan down the edge array till we find the kth removeable edge */\n for (i=0; i<edges; i++) {\n if (edge[i].valid == true) {\n if (k == 0) {\n edge[i].valid = false;\n n = group[edge[i].cell1];\n o = group[edge[i].cell2];\n /* if the cells are already connected don't remove the wall */\n if (n != o) {\n edge[i].draw = false;\n done = true;\n /* fix up the group array */\n for (j=0; j<groups; j++) {\n if (group[j] == o) {\n group[j] = n;\n }\n if (group[j] != n) {\n done = false; /* if we have more than one\n group we're not done */\n }\n }\n }\n break;\n } else {\n k--;\n }\n }\n }\n redges--; /* decriment the number of removable edges */\n /* if we're done, create an entrance and exit */\n if (done) {\n for (j=0; j<2; j++) {\n /* randomly select a perimeter edge */\n k = Math.floor(Math.random()*(perimeters-j));\n for (i=0; i<perimeters; i++) {\n if (k == 0) {\n if (perimeter[i].valid == true) {\n perimeter[i].draw = false;\n break;\n }\n }\n else {\n k--;\n }\n }\n }\n }\n}", "_clearTrajectories() {\n this.elem.selectAll('.intention').remove();\n\n for (let i = 0; i < this.gridSize; i++) {\n for (let j = 0; j < this.gridSize; j++) {\n if (!this._isCornerCell(i, j)) {\n this.grid[i][j].hexagon.attr('fill', 'none');\n }\n }\n }\n }", "function clearData() {\n\tvar i, j;\n\tfor (i = 0; i < realWidth; i++) {\n\t\tfor (j = 0; j < realHeight; j++) {\n\t\t\tif (map[i][j] === 1) {\n\t\t\t\tmap[i][j] = 0;\n\t\t\t}\n\t\t}\n\t}\n\tpreviousLiveCells.splice(0, previousLiveCells.length);\t\n}", "function removeAllGSighting(){\n \tremoveAllObjectMarker(SIGHTING);\n }", "function removePathingVisuals() {\n for (const node of grid.childNodes) {\n if (node.classList.contains(\"square\")) {\n node.classList.remove(\"square-open\");\n node.classList.remove(\"square-closed\");\n node.classList.remove(\"square-on-path\");\n }\n }\n pathVisualsPresent = false;\n}", "function makeWall(cell) {\n if (!makeWalls) {\n return;\n }\n var index = $(\"td\").index(cell);\n var row = Math.floor((index) / maxRows) + 1;\n var col = (index % maxCols) + 1;\n if ((ongoing == false) && !(row == 1 && col == 1) && !(row == maxRows && col == maxCols)) {\n $(cell).toggleClass(\"wall\");\n }\n}", "function Maze(size, cellTextures, level) {\n\n var cols, rows;\n var w = size;\n this.grid = [];\n\n this.current;\n\n var stack = [];\n\n this.setup = function() {\n createCanvas(605,605)\n cols = floor(width/w);\n rows = floor(height/w);\n\n for (var j = 0; j < rows; j++) {\n for (var i = 0; i < cols; i++) {\n var cell = new Cell(i, j, w, this.grid, cols, rows, cellTextures, level);\n this.grid.push(cell);\n }\n }\n this.current = this.grid[0];\n }\n\n this.draw = function() {\n background(51);\n for (var i = 0; i < this.grid.length; i++) {\n this.grid[i].show();\n }\n\n this.current.visited = true;\n //this.current.highlight();\n // STEP 1\n var next = this.current.checkNeighbors();\n if (next) {\n next.visited = true;\n\n // STEP 2\n stack.push(this.current);\n\n // STEP 3\n this.removeWalls(this.current, next);\n\n // STEP 4\n this.current = next;\n } else if (stack.length > 0) {\n this.current = stack.pop();\n }\n\n }\n\n this.index = function(i, j) {\n if (i < 0 || j < 0 || i > cols-1 || j > rows-1) {\n return -1;\n }\n return i + j * cols;\n }\n\n\n this.removeWalls = function(a, b) {\n var x = a.i - b.i;\n if (x === 1) {\n a.walls[3] = false;\n b.walls[1] = false;\n } else if (x === -1) {\n a.walls[1] = false;\n b.walls[3] = false;\n }\n var y = a.j - b.j;\n if (y === 1) {\n a.walls[0] = false;\n b.walls[2] = false;\n } else if (y === -1) {\n a.walls[2] = false;\n b.walls[0] = false;\n }\n }\n}", "function removePiece() {\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, boardColour);\n}", "function mazeGen() {\r\n let visited = [];\r\n let neighbours = [];\r\n let fcell = {\r\n x: Math.floor((Math.random() * w) / space) * space,\r\n y: Math.floor((Math.random() * h) / space) * space,\r\n };\r\n visited.push(fcell);\r\n let newNeighbours = genNeighbours(fcell, neighbours);\r\n neighbours = neighbours.concat(newNeighbours);\r\n let currCell;\r\n let visNeighbours = [];\r\n let joinCell;\r\n while (neighbours.length > 0) {\r\n currCell = neighbours.splice(mazeRand(neighbours.length), 1)[0];\r\n newNeighbours = genNeighbours(currCell, neighbours);\r\n visNeighbours = [];\r\n //cannot use filter as unfiltered needs to be pushed in separate array\r\n newNeighbours.forEach((element) => {\r\n if (visited.some((e) => e.x === element.x && e.y === element.y))\r\n visNeighbours.push(element);\r\n else neighbours.push(element);\r\n });\r\n joinCell = visNeighbours[mazeRand(visNeighbours.length)];\r\n visited.push(currCell);\r\n breakWalls(currCell, joinCell);\r\n }\r\n}", "function removeRemoves() {\n if (doubleAchieved == true) {\n for (var doubleRow = 0; doubleRow <= 3; doubleRow++) {\n for (var doubleColumn = 0; doubleColumn <= 3; doubleColumn++) {\n if (removeArray[doubleRow][doubleColumn] == \"remove\") {\n $(document.getElementById(\"tile-\" + (4 * doubleRow + doubleColumn + 1).toString())).remove();\n tileArray[doubleRow][doubleColumn] = null;\n removeArray[doubleRow][doubleColumn] = null;\n }\n }\n }\n doubleAchieved = false;\n }\n }", "mazeWithVerticalWalls(grid){\n for (let row = 0; row < 23; row++) {\n for (let col = 0; col < 57; col++) {\n if(((row===0 || col===0)||(row===22 || col===56))&&(grid[row][col].isWall===false)){\n const newGrid = getNewGridWithWallToggled(this.state.grid, row, col);\n this.setState({grid: newGrid, mouseIsPressed: false});\n }\n }\n }\n for (let col = 2; col < 55; col+=2){\n let row=1\n while(row<22) {\n let x=Math.ceil((22-row)*Math.random());\n if (x===21){\n x--;\n }\n while(x>0){\n const newGrid = getNewGridWithWallToggled(this.state.grid, row, col);\n this.setState({grid: newGrid, mouseIsPressed: false});\n row++;\n x--;\n }\n row++;\n }\n }\n }", "removeWall(x, y, dir) {\n if (this._size.contains(x, y)) {\n this._removeFlag(x, y, 1 << dir);\n LOCAL_OFF.set(x, y);\n LOCAL_OFF.addCardinalDirection(dir);\n if (this._size.containsOffset(LOCAL_OFF)) {\n this._removeFlag(LOCAL_OFF.x, LOCAL_OFF.y, 1 << geom.cardinalDirectionOpposite(dir));\n }\n }\n return this;\n }", "uncoverEmptyTiles(theRow, theCol, theBoard) {\n\n /* gets all surrounding tiles to tile at [xpos][ypos] */\n\n let surround = this.checkSurroundingArea(theRow, theCol, theBoard);\n\n surround.map(tile => {\n\n /* Check if this tile isn't revealed, flagged or a mine and is empty */\n if (!tile.mine && !tile.revealed && !tile.flag) {\n\n theBoard[tile.row][tile.col].revealed = true;\n\n /* since this tile is empty, check recursively all around this tile too */\n if (tile.mineCount === 0) {\n\n this.uncoverEmptyTiles(tile.row, tile.col, theBoard);\n\n }\n }\n\n });\n\n return theBoard;\n }", "function deleteBoard(){\n\tif(grid != null){\n \t\tdocument.body.removeChild(grid);\n \t}\n}", "function breakWalls(currCell, joinCell) {\r\n if (currCell.x === joinCell.x) {\r\n if (currCell.y > joinCell.y) {\r\n joinCellsY.push({ x: currCell.x, y: currCell.y - unit });\r\n } else if (currCell.y < joinCell.y) {\r\n joinCellsY.push({ x: joinCell.x, y: joinCell.y - unit });\r\n }\r\n } else if (currCell.y === joinCell.y) {\r\n if (currCell.x > joinCell.x) {\r\n joinCellsX.push({ x: currCell.x - unit, y: currCell.y });\r\n } else if (currCell.x < joinCell.x) {\r\n joinCellsX.push({ x: joinCell.x - unit, y: joinCell.y });\r\n }\r\n }\r\n}", "function clearBoardImages() {\n for (j=0; j<=maxY; j++) {\n for (i=0; i<=maxX; i++) {\n with (cellArray[arrayIndexOf(i,j)]) {\n if (document.images[imageIndexOf(i,j)].src != blankCell.src) {\n \tdocument.images[imageIndexOf(i,j)].src = blankCell.src; } } } } }", "function decreaseWallSize() {\n\tif (wallSelected==null) {\n\t\treturn 0;\n\t}\n\t\n\telse if (wallSelected.depth > (0.1*cellLen)) {\n\t\twallSelected.depth -= (0.1*cellLen);\n\t\twallSelected.rLen= 3/4*wallSelected.depth;\n\t\treturn 1;\n\t}\n\t\n\telse {\n\t\treturn 0;\n\t}\n\t\n\tinvalidated= true;\n}", "function clearBoard() {\n\tbgTileLayer.removeChildren();\n\tpieceLayer.removeChildren();\n\tfgTileLayer.removeChildren();\n}", "function removeBomb(x,y) {\n if (cellArray[arrayIndexOf(x,y)].isBomb) {\n for (i=x-1; i<=x+1; i++) {\n for (j=y-1; j<=y+1; j++) {\n removeNeighbor(i,j); } } \n cellArray[arrayIndexOf(x,y)].isBomb = false;\n return true; } \n else\n return false; }", "cleanBoard(treeCheck) {\n for (let cell of this.board) {\n if (!treeCheck.includes(cell.index)) {\n cell.hasTree = false;\n cell.myTree = false;\n cell.ennemyTree = false;\n }\n }\n }", "function repaintGrid(){\r\n for (let y = 0; y < rows; y++){\r\n for (let x = 0; x < cols; x++){\r\n if (grid[y][x].alive == 0){\r\n kill(grid[y][x].cellRef);\r\n } else {\r\n resurrect(grid[y][x].cellRef); \r\n }\r\n }\r\n }\r\n }", "function unpaint() {\n var cells = document.getElementsByClassName('cell');\n for (var l = 0; l < cells.length; l++) {\n cells[l].style.removeProperty('background-color');\n }\n}", "function clearBoard() {\n bottomHalfblocks.map(function(i) {\n i.classList.replace('green', 'blue');\n i.classList.add('marker')\n });\n }", "function eliminateSingleTiles()\r\n{\r\n for(var y = 3; y < WORLD_SIZE_MAX-3; ++y)\r\n {\r\n for(var x = 3; x < WORLD_SIZE_MAX-3; ++x)\r\n {\r\n if(worldMapArray[y][x].isStatic == false)\r\n {\r\n singleTileCoastEliminationCheck(x, y, 2);\r\n\r\n if(worldMapArray[y][x].biomeType == BIOME_DESERT)\r\n {\r\n singleTileDesertEliminationCheck(x, y, 2);\r\n }\r\n }\r\n }\r\n }\r\n}", "function unhighlightAllCells(){\n graph.getCells().forEach(function(cell){\n var currentCellView = paper.findViewByModel(cell)\n if (currentCellView) {\n clearHighlight(currentCellView)\n }\n })\n}", "function noClickBoard() {\r\n for(cell of hits) {\r\n cell.removeEventListener(\"click\", move);\r\n cell.removeEventListener(\"mouseover\", highlight);\r\n cell.removeEventListener(\"mouseout\", unhighlight);\r\n }\r\n}", "removeSegmentsIntersections(tunnels, isWalls) {\n const walls = this.walls;\n let startWallsLength = 0;\n let newWallsAmount = walls.length - startWallsLength;\n\n while (newWallsAmount > 0) {\n startWallsLength = walls.length;\n for (let j = 0; j < walls.length; j += 4) {\n for (let i = 0; i < (isWalls ? j : tunnels.length); i += 4) {\n const pieces = this.resolveSegmentSegment(\n tunnels[i], tunnels[i + 1], tunnels[i + 2], tunnels[i + 3],\n walls[j], walls[j + 1], walls[j + 2], walls[j + 3]\n );\n if (pieces.length < 4) { // empty walls will be removed in removeZeroLengthWalls()\n walls[j] = 0;\n walls[j + 1] = 0;\n walls[j + 2] = 0;\n walls[j + 3] = 0;\n } else {\n walls[j] = pieces[0];\n walls[j + 1] = pieces[1];\n walls[j + 2] = pieces[2];\n walls[j + 3] = pieces[3];\n\n if (pieces.length > 4) {\n walls.push(pieces[4]);\n walls.push(pieces[5]);\n walls.push(pieces[6]);\n walls.push(pieces[7]);\n }\n }\n }\n }\n newWallsAmount = walls.length - startWallsLength;\n }\n }", "function ClearPixels(){\n for(const p of prev_pixels){\n p.attr('type','tile');\n }\n prev_pixels = [];\n}", "function Cell(i, j) {\r\n this.i = i;\r\n this.j = j;\r\n this.walls = [true, true, true, true]; // top right bottom left\r\n\r\n this.visited = false;\r\n\r\n this.show = function() {\r\n var x = this.i * w;\r\n var y = this.j * w;\r\n stroke(255, 255, 25);\r\n\r\n if (this.walls[0]) { // top\r\n line(x , y , x + w, y ); \r\n }\r\n if (this.walls[1]) { // right \r\n line(x + w, y , x + w, y + w); \r\n }\r\n if (this.walls[2]) { // bottom\r\n line(x + w, y + w, x , y + w);\r\n }\r\n if (this.walls[3]) { // left\r\n line(x , y + w, x , y );\r\n }\r\n \r\n if (this.visited) {\r\n noStroke();\r\n fill(255, 0, 255, 100);\r\n rect(x, y, w, w);\r\n }\r\n }\r\n\r\n this.checkNeighbors = function() {\r\n var neighbors = [];\r\n\r\n var top = grid[index(i , j - 1)];\r\n var right = grid[index(i + 1, j )];\r\n var bottom = grid[index(i , j + 1)];\r\n var left = grid[index(i - 1, j )];\r\n\r\n if (top && !top.visited) {\r\n neighbors.push(top);\r\n }\r\n if (right && !right.visited) {\r\n neighbors.push(right);\r\n }\r\n if (bottom && !bottom.visited) {\r\n neighbors.push(bottom);\r\n }\r\n if (left && !left.visited) {\r\n neighbors.push(left);\r\n }\r\n\r\n if (neighbors.length > 0) {\r\n var r = floor(random(0, neighbors.length));\r\n return neighbors[r];\r\n } else {\r\n return undefined;\r\n }\r\n }\r\n\r\n this.hightlight = function() {\r\n var x = this.i * w;\r\n var y = this.j * w;\r\n noStroke();\r\n fill(100, 100, 255, 100);\r\n rect(x, y, w, w);\r\n }\r\n}", "generateMaze(){\n // Pop a cell from the stack and make it a current cell\n this.currentCell = this.S.pop();\n\n // If the current cell has any neighbours which have not been visite\n let randomNeighbour = this.getRandomNonVisitedNeighbour(this.currentCell.i, this.currentCell.j);\n if(randomNeighbour){\n \n // Push the current cell to the stack\n this.S.push(this.currentCell);\n\n // Remove the wall between the current cell and the chosen cell\n this.currentCell.removeWallBetween(randomNeighbour);\n\n // Mark the chosen cell as visited and push it to the stack\n randomNeighbour.visit();\n this.S.push(randomNeighbour);\n\n // Keep track of visited cells\n this.unvisitedCellsCounter--;\n }\n }", "function add_boundaries(clean_board) {\n\t// Top wall\n\tfor (var i = 3; i < clean_board[0].length; i += 2) {\n\t\tclean_board[0][i] = EDGE_CLOSED;\n\t}\n\t// Bottom wall\n\tfor (var i = 1; i < clean_board[0].length - 2; i += 2) {\n\t\tclean_board[clean_board.length - 1][i] = EDGE_CLOSED;\n\t}\n\t// Left and right walls\n\tfor (var i = 1; i < clean_board.length; i += 2) {\n\t\tclean_board[i][0] = EDGE_CLOSED;\n\t\tclean_board[i][clean_board[0].length - 1] = EDGE_CLOSED;\n\t}\n\treturn clean_board;\n}", "function removeDistantNodes(){\n\t\t\tvar preload = grid.preload,\n\t\t\t\ttrashBin = put(\"div\");\n\t\t\twhile (preload.previous){\n\t\t\t\tpreload = preload.previous;\n\t\t\t}\n\t\t\twhile (preload){\n\t\t\t\t// This code will not remove blocks of rows that are not adjacent to a preload node,\n\t\t\t\t// however currently the only situation this happens is when they are between two loading nodes.\n\t\t\t\t// In this case they will be removed on the first scroll after one of the loading nodes' queries\n\t\t\t\t// has been resolved.\n\t\t\t\tremovePreloadDistantNodes(preload, \"previousSibling\", trashBin);\n\t\t\t\tremovePreloadDistantNodes(preload, \"nextSibling\", trashBin);\n\t\t\t\tpreload = preload.next;\n\t\t\t}\n\t\t\tsetTimeout(function(){\n\t\t\t\t// we can defer the destruction until later\n\t\t\t\tput(trashBin, \"!\");\n\t\t\t},1);\n\t\t}", "reset(){\n this.vertices.forEach(vertex => {\n vertex.color = 'w';\n vertex.isWall = false;\n vertex.distance = Number.MAX_SAFE_INTEGER;\n vertex.parent = null;\n });\n }", "function removeBoardPaint() {\n let getHeightDivs = document.querySelectorAll('.tr');\n for (let index = 0; index < getHeightDivs.length; index += 1) {\n getHeightDivs[index].remove();\n }\n}", "function resetBoard() {\n for (var r=0; r<b.rows(); r++) {\n for (var c=0; c<b.cols(); c++) {\n b.cell([r,c]).DOM().classList.remove(\"green\");\n b.cell([r,c]).removeOn(\"click\", movePiece);\n }\n }\n}", "function resetBoard() {\n for (var r=0; r<b.rows(); r++) {\n for (var c=0; c<b.cols(); c++) {\n b.cell([r,c]).DOM().classList.remove(\"green\");\n b.cell([r,c]).removeOn(\"click\", movePiece);\n }\n }\n}", "function clearPulsatingCells(){\n\tpulsating.forEach(function(cell){\n\t\tcell.classList.remove(\"pulsate\");\n\t});\n\tpulsating = [];\n}", "addMazeInnerWalls(level, gridSize, gridScale) {\n const toExclude = this.wallsToExclude(gridSize + 1, gridSize + 1, gridScale);\n let ex = 0;\n for(let i = 0; i < gridSize - 1; i++) {\n let x = i * gridScale;\n while (ex < toExclude.length && toExclude[ex].x < x) {\n ex++;\n }\n for (let j = 0; j < gridSize; j++) {\n let z = (j - 0.5) * gridScale;\n if (ex < toExclude.length && toExclude[ex].x == x) {\n while (ex < toExclude.length && toExclude[ex].z < z) {\n ex++;\n }\n if (ex < toExclude.length && toExclude[ex].z == z) {\n ex++;\n continue;\n }\n }\n const pos = new Vector3(x, level*gridScale, z);\n const normal = new Vector3(1, 0, 0);\n this.addWall(pos, normal, gridScale);\n }\n }\n ex = 0;\n for(let i = 0; i < gridSize; i++) {\n let x = (i - 0.5)*gridScale;\n while (ex < toExclude.length && toExclude[ex].x < x) {\n ex++;\n }\n for (let j = 0; j < gridSize - 1; j++) {\n let z = j*gridScale;\n if (ex < toExclude.length && toExclude[ex].x == x) {\n while (ex < toExclude.length && toExclude[ex].z < z) {\n ex++;\n }\n if (ex < toExclude.length && toExclude[ex].z == z) {\n ex++;\n continue;\n }\n }\n const pos = new Vector3(x, level*gridScale, z);\n const normal = new Vector3(0, 0, 1);\n this.addWall(pos, normal, gridScale);\n }\n }\n }", "function clearPieceBoard() {\n for(var i = 0; i < 3; i++)\n for(var j = 0; j < 7; j++)\n drawPixelNext( j, i, boardColour);\n}", "mazeUsingPrim(grid){\n let walls=[];\n let len=0;\n for (let row = 0; row < 23; row++) {\n for (let col = 0; col < 57; col++) {\n if((((row+col)%2===0)||(row%2===0))&&(row!==FINISH_NODE_ROW-1 || col!==FINISH_NODE_COL)&&(row!==START_NODE_ROW || col!==START_NODE_COL-1)&&(row!==FINISH_NODE_ROW || col!==FINISH_NODE_COL+1)&&((row!==START_NODE_ROW || col!==START_NODE_COL)&&(row!==FINISH_NODE_ROW || col!==FINISH_NODE_COL))){\n const newGrid = getNewGridWithWallToggled(this.state.grid, row, col);\n this.setState({grid: newGrid, mouseIsPressed: false});\n }\n }\n }\n walls.push([START_NODE_ROW-1,START_NODE_COL]);\n walls.push([START_NODE_ROW+1,START_NODE_COL]);\n walls.push([START_NODE_ROW,START_NODE_COL+1]);\n grid[START_NODE_ROW][START_NODE_COL].isVisited=true;\n grid[START_NODE_ROW][START_NODE_COL-1].isVisited=true;\n grid[FINISH_NODE_ROW][FINISH_NODE_COL+1].isVisited=true;\n walls.push([START_NODE_ROW-1,START_NODE_COL-2]);\n walls.push([START_NODE_ROW-2,START_NODE_COL-1]);\n walls.push([START_NODE_ROW+1,START_NODE_COL-2]);\n walls.push([START_NODE_ROW+2,START_NODE_COL-1]);\n grid[START_NODE_ROW-1][START_NODE_COL-1].isVisited=true;\n grid[START_NODE_ROW+1][START_NODE_COL-1].isVisited=true;\n grid[FINISH_NODE_ROW-1][FINISH_NODE_COL+1].isVisited=true;\n grid[FINISH_NODE_ROW+1][FINISH_NODE_COL+1].isVisited=true;\n walls.push([FINISH_NODE_ROW-1,FINISH_NODE_COL+2]);\n walls.push([FINISH_NODE_ROW-2,FINISH_NODE_COL+1]);\n walls.push([FINISH_NODE_ROW+1,FINISH_NODE_COL+2]);\n walls.push([FINISH_NODE_ROW+2,FINISH_NODE_COL+1]);\n len=11;\n while (len>0){\n let x=Math.floor(len*Math.random());\n if(x===len){\n x--;\n }\n let curRow=walls[x][0];\n let curCol=walls[x][1];\n let y=0;\n let z=0;\n if(curRow%2===1){\n if (curCol!==0 && grid[curRow][curCol-1].isVisited===false){\n y++;\n z=0;\n }\n if (curCol<56 && curCol>=-1 && curRow>=0 && curRow<=22 && grid[curRow][curCol+1].isVisited===false){\n y++;\n z=1;\n }\n }\n if(curRow%2===0){\n if (curRow!==0 && grid[curRow-1][curCol].isVisited===false){\n y++;\n z=0;\n }\n if (curRow!==22 && grid[curRow+1][curCol].isVisited===false){\n y++;\n z=1;\n }\n }\n if(y===1){\n grid[curRow][curCol].isWall=false;\n grid[curRow][curCol].isVisited=true;\n if(curRow%2===1){\n if(z===0){\n grid[curRow][curCol-1].isVisited=true;\n if(curCol-1===0){\n if(curRow-1!==0 && grid[curRow-1][curCol-1].isWall===true){\n walls.push([curRow-1,curCol-1]);\n len++;\n }\n if(curRow+1!==22 && grid[curRow+1][curCol-1].isWall===true ){\n walls.push([curRow+1,curCol-1]);\n len++;\n }\n }\n else{\n if(curRow-1!==0 && grid[curRow-1][curCol-1].isWall===true){\n walls.push([curRow-1,curCol-1]);\n len++;\n }\n if(curRow+1!==22 && grid[curRow+1][curCol-1].isWall===true){\n walls.push([curRow+1,curCol-1]);\n len++;\n }\n if(grid[curRow][curCol-2].isWall===true){\n walls.push([curRow,curCol-2]);\n len++;\n }\n }\n }\n else{\n grid[curRow][curCol+1].isVisited=true;\n if(curCol+1===56){\n if(curRow-1!==0 && grid[curRow-1][curCol+1].isWall===true){\n walls.push([curRow-1,curCol+1]);\n len++;\n }\n if(curRow+1!==22 && grid[curRow+1][curCol+1].isWall===true){\n walls.push([curRow+1,curCol+1]);\n len++;\n }\n }\n else{\n if(curRow-1!==0 && grid[curRow-1][curCol+1].isWall===true ){\n walls.push([curRow-1,curCol+1]);\n len++;\n }\n if(curRow+1!==22 && grid[curRow+1][curCol+1].isWall===true){\n walls.push([curRow+1,curCol+1]);\n len++;\n }\n if(grid[curRow][curCol+2].isWall===true){\n walls.push([curRow,curCol+2]);\n len++;\n }\n }\n }\n }\n else{\n if(z===0){\n grid[curRow-1][curCol].isVisited=true;\n if(curRow-1===1){\n if(curCol!==56 && grid[curRow-1][curCol+1].isWall===true){\n walls.push([curRow-1,curCol+1]);\n len++;\n }\n if(curCol!==0 && grid[curRow-1][curCol-1].isWall===true){\n walls.push([curRow-1,curCol+1]);\n len++;\n }\n }\n else{\n if(curCol!==56 && grid[curRow-1][curCol+1].isWall===true){\n walls.push([curRow-1,curCol+1]);\n len++;\n }\n if(curCol!==0 && grid[curRow-1][curCol-1].isWall===true){\n walls.push([curRow-1,curCol+1]);\n len++;\n }\n if(grid[curRow-2][curCol].isWall===true){\n walls.push([curRow-2,curCol]);\n len++;\n }\n }\n \n }\n else{\n grid[curRow+1][curCol].isVisited=true;\n if(curRow+1===21){\n if(curCol!==56 && grid[curRow+1][curCol+1].isWall===true){\n walls.push([curRow+1,curCol+1]);\n len++;\n }\n if(curCol!==0 && grid[curRow+1][curCol-1].isWall===true){\n walls.push([curRow+1,curCol+1]);\n len++;\n }\n }\n else{\n if(curCol!==56 && grid[curRow+1][curCol+1].isWall===true){\n walls.push([curRow+1,curCol+1]);\n len++;\n }\n if(curCol!==0 && grid[curRow+1][curCol-1].isWall===true){\n walls.push([curRow+1,curCol+1]);\n len++;\n }\n if(grid[curRow+2][curCol].isWall===true){\n walls.push([curRow+2,curCol]);\n len++;\n }\n }\n }\n }\n }\n walls.splice(x,1);\n len--;\n }\n for (let row = 0; row < 23; row++) {\n for (let col = 0; col < 57; col++) {\n if(grid[row][col].isVisited===true){\n grid[row][col].isVisited=false;\n }\n }\n }\n }", "function clearGrid(){\n\t$(\"div.pixel\").remove();\n}", "function drawCleanNtGrid() {\n\tlet nextTetroInnerHTML = ''\n\tfor (let y = 0; y < 4; y++) {\n\t\tfor (let x = 0; x < 4; x++) {\n\t\t\tnextTetroInnerHTML += '<div class=\"cell\" style=\"opacity:0.25;\"></div>'\n\t\t}\n\t\tnextTetroInnerHTML += '<br/>'\n\t}\n\tnextTetroElem.innerHTML = nextTetroInnerHTML\n\tntCells = Array.from(nextTetroElem.querySelectorAll('.cell'))\n\twhile (ntCells.length) ntCellsArr.push(ntCells.splice(0, 4))\n}", "function destroyWall(cell1, cell2) {\n\n\tvar canvas = document.getElementById(\"maze\");\n\tvar context = canvas.getContext('2d');\n\n\tcell1Center = {x:cell1.xPos+5, y:cell1.yPos+5};\n\tcell2Center = {x : cell2.xPos+5, y:cell2.yPos+5};\n\n\tcontext.beginPath;\n\tcontext.moveTo(cell1Center.x, cell1Center.y);\n\tcontext.lineTo(cell2Center.x, cell2Center.y);\n\tcontext.lineWidth=7.75;\n\tcontext.strokeStyle='white';\n\tcontext.stroke();\n}", "function removeNeighbor(x,y) {\n if (checkBounds(x,y)) {\n with (cellArray[arrayIndexOf(x,y)]) {\n neighborBombs--; } } }", "function isObstacle_Clash_leftofWindow() {\r\n for (let j in stages.obstacles)\r\n if (stages.obstacles[j].x <= -stages.obstacles[j].width) {\r\n stages.obstacles.splice(j, 1);\r\n }\r\n }", "function clearNextMovesMarkers() {\n mapSquares(square => square.canBeNextMove = false);\n}", "function unScareGhosts() {\n\tghosts.forEach((ghost) => (ghost.isScared = false))\n}", "function removeAvailableMoveCells() {\n cells.forEach((cell) => {\n cell.classList.remove(\"movable\");\n });\n }", "function createWallsVisited()\n{\n var visited = [];\n var cells = $( \"#tableContainer\" ).find(\"td\");\n \n for( var i = 0; i < totalRows; i++ )\n {\n var row = [];\n for( var j = 0; j < totalCols; j++ )\n {\n if( cellIsAWall( i, j, cells ) )\n row.push( true );\n else \n row.push( false );\n }\n visited.push( row );\n }\n return visited;\n}", "function unScareGhosts() {\r\n ghosts.forEach(ghost => ghost.isScared = false)\r\n }", "trim() {\n // get the reachable nodes from the root\n var reachable = this.reachableNodes;\n var visited = [];\n // remove any nodes that are not reachable from the root\n for(let node in this._nodeMap){\n if(reachable[node] !== true){\n this.removeNode(this._nodeMap[node]);\n }\n }\n }", "function cleanGrid(){\n while (canvasBox.hasChildNodes()){\n canvasBox.removeChild(canvasBox.firstChild);\n }\n}", "function removeAllWaypoints() {\n if(!canvas_flag_active) {\n number_of_coordinates = 0;\n current_coordinate_list = [];\n canvas_flag_position = {x:undefined,y:undefined};\n var coordinates = document.querySelectorAll('#coordinates-list > div');\n coordinates.forEach((coordinate) => {\n document.querySelector('#coordinates-list').removeChild(coordinate);\n });\n }\n}", "function clearGrid (){\n for (let i = 0; i < 625; i++){\n cells[i].classList = null\n \n }\n }", "removeObstacle(x, y, width, height) {\n for (let i = 0; i < width; i++) {\n for (let j = 0; j < height; j++) {\n this.setTile(1, x+i, y+j, 0);\n }\n }\n }", "function removeEdges(rect) {\n for(var i = 0; i < rect.edge.length; ++i) {\n\tvar idx = rect.edge[i].edge.indexOf(rect);\n\trect.edge[i].edge.splice(idx, 1);\n }\n}", "sweep(row, col, e) {\n // if square does not exist, ignore it\n if (row < 0 || row > this.state.height|| col < 0 || col > this.state.width) {\n return;\n }\n if (this.state.grid[row][col].isCleared) {\n return;\n }\n const sweepNeighbors = () => {\n return (() => {\n const rowAbove = row - 1;\n const rowBelow = row + 1;\n for (let c = Math.max(0, col - 1); c < Math.min(this.state.width, col + 2); c++) {\n if (rowAbove >= 0) {\n this.sweep(rowAbove, c);\n }\n if (rowBelow < this.state.height) {\n this.sweep(rowBelow, c);\n }\n }\n if (col >= 1) {\n this.sweep(row, col - 1);\n }\n if (col < this.state.width - 1) {\n this.sweep(row, col + 1);\n }\n })();\n }\n const square = this.state.grid[row][col];\n if (square.val === 'mine' && e && (e.type === 'click' || e.type === 'mousedown')) {\n this.clearSquare(row, col);\n this.setState((prevState) => {\n const newState = {...prevState};\n newState.grid[row][col].char = '🔥';\n return {grid: newState.grid};\n })\n this.endGame(false);\n return;\n }\n // if it is a square and is blank, clear it\n if (square.count > 0) {\n this.clearSquare(row, col, this.endGameIfWon);\n return;\n }\n // if it is also 0 count, clear the neighbors too.\n if (square.val === 'blank' && !this.state.grid[row][col].isCleared) {\n // clear squares around the mine-free area\n this.clearSquare(row, col);\n this.clearSquare(row, col, sweepNeighbors);\n }\n return;\n }", "function clearObstacles(grid) {\n if (!running) {\n for (var i = 0; i < grid.length; i++) {\n for (var j = 0; j < grid[i].length; j++) {\n grid[i][j].obstacle = false;\n }\n }\n }\n}", "function undraw() {\n currentTetromino.forEach(index => {\n //unrender tetromino cells by removing class 'tetromino'\n squares[currentPosition + index].classList.remove('tetromino');\n //remove color\n squares[currentPosition + index].style.backgroundColor = '';\n });\n }", "function unScareGhosts() {\n ghosts.forEach(ghost => ghost.isScared = false)\n}", "function unScareGhosts() {\n ghosts.forEach(ghost => ghost.isScared = false)\n}", "function destroyCells() {\n\tfor (var i = 0; i < xSize; i++) {\n\t\tfor (var j = 0; j < ySize; j++){\n\t\t\tDestroy(cells[i,j].gameObject);\n\t\t}\n\t}\n}", "clearCells(){\n var cells = this.GRID_DIV.children;\n for (var i = 0; i < cells.length; i++) {\n var cell = cells[i];\n cell.style.backgroundColor = \"white\";\n }\n this.saveLocally();\n }", "function clearCells() {\n\t\t\tfor(i = 0; i < maxRow; i++) {\n\t\t\t\tfor(j = 0; j < maxCol; j++) {\n\t\t\t\t\tcellID = '#'+j+'_'+i\n\t\t\t\t\t$(cellID).remove()\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function unhighlightNeighbors(cellView, linkTypes=null, isInbound=null, first=false){\n if (isInbound == null) {\n var links = graph.getConnectedLinks(cellView.model)\n } else if (isInbound == false) {\n var links = graph.getConnectedLinks(cellView.model, {outbound: true}) \n } else if (isInbound == true)\n var links = graph.getConnectedLinks(cellView.model, {inbound: true}) \n\n if(!first){\n unhighlightCell(cellView)\n }\n\n links.forEach(function(link){\n if(linkTypes != null && linkTypes.includes(link.prop('linkType'))) { \n unhighlightCell(paper.findViewByModel(link))\n } \n })\n}", "function clearBoard() {\n\tfor (i = 0; i < blockArr.length; i++) {\n\t\tfor (j = 0; j < blockArr[i].length; j++) {\n\t\t\tfor (k = 0; k < blockArr[i][j].length; k++) {\n\t\t\t\tblockArr[i][j][k] = 0;\n\t\t\t}\n\t\t\tblockArr[i][j][5] = -5;\n\t\t\tmechArr[i][j] = 0;\n\t\t\talchArr[i][j] = 0;\n\t\t}\n\t}\n}", "function removeHousesMoves(cells, moves, currentTurn) {\n cells = moves.map(move => getCellById(cells, move));\n cells.forEach((cell, idx) => {\n if (cell && currentTurn === 'white' && cell.isHouseOf === 'black' ||\n cell && currentTurn === 'black' && cell.isHouseOf === 'white') {\n moves[idx] = null\n }\n });\n return moves\n}", "function kill(){\n\tfor (var i = chunks.length - 1; i >= 0; i--) {\n\t\tfor (var y = chunks[i].cells.length - 1; y >= 0; y--) {\n\t\t\tfor (var z = chunks[i].cells[y].length - 1; z >= 0; z--) {\n\t\t\t\tcell = chunks[i].cells[y][z];\n\t\t\t\tif (cell.k == 0){\n\t\t\t\t\tcell.a = 0;\n\t\t\t\t}\n\t\t\t\telse if(cell.k == 1){\n\t\t\t\t\tcell.a = 1;\n\t\t\t\t}\n\t\t\t};\n\t\t};\n\t};\n\n\tkillReset();\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 makewall(cell) {\n\tif(!createWalls) {return;}\n\tvar index = $(\"td\").index(cell);\n\tvar row = Math.floor((index)/totalRows)+1;\n\tvar col = (index%totalCols)+1;\n\tconsole.log([row,col]);\n\tif((inProgress == false)&&!(row==1&&col==1)&&!(row==totalRows && col == totalCols)) {\n\t\t$(cell).toggleClass(\"wall\");\n\t}\n}", "function makewall(cell) {\n\tif(!createWalls) {return;}\n\tvar index = $(\"td\").index(cell);\n\tvar row = Math.floor((index)/totalRows)+1;\n\tvar col = (index%totalCols)+1;\n\tconsole.log([row,col]);\n\tif((inProgress == false)&&!(row==1&&col==1)&&!(row==totalRows && col == totalCols)) {\n\t\t$(cell).toggleClass(\"wall\");\n\t}\n}", "cleanupTiles(levelIndex) {\n // Place walls around floor\n for (let j = 0; j < this.tiles.length; j++) {\n for (let i = 0; i < this.tiles[0].length; i++) {\n if (this.tiles[j][i] === 'F') {\n for (let k = -1; k <= 1; k++) {\n this.tryWall(k + i, j - 1);\n this.tryWall(k + i, j);\n this.tryWall(k + i, j + 1);\n }\n }\n }\n }\n // Place start and end points\n if (levelIndex % 2 === 0) {\n this.tiles[WORLD_HEIGHT - 2][WORLD_WIDTH - 2] = 'Start';\n } else {\n this.tiles[WORLD_HEIGHT - 2][WORLD_WIDTH - 2] = 'End';\n }\n for (let j = WORLD_HEIGHT - 2; j >= WORLD_HEIGHT - 2 - 5; j--) {\n for (let i = WORLD_WIDTH - 2; i >= WORLD_WIDTH - 2 - 5; i--) {\n this.floor.remove({ x: i, y: j });\n }\n }\n this.placeEnd(levelIndex);\n console.log('[World] Cleaned up tiles');\n }", "function clearBoard() {\n allPieceLocations.forEach(function(x) {\n document.getElementById(x).classList.remove(\"avaliableMove\");\n document.getElementById(x).classList.remove(\"redKing\");\n document.getElementById(x).classList.remove(\"redPiece\");\n document.getElementById(x).classList.remove(\"blackKing\");\n document.getElementById(x).classList.remove(\"blackPiece\");\n })\n }", "disposeWall() {\n if (this.wall.parent !== null) {\n this.object.remove(this.wall);\n }\n this.wall.geometry.dispose();\n this.wall.material.dispose();\n this.emit('destroyed');\n }", "removeAll(occupant, layer) {\n for (var x=0; x < this.width; x++) {\n for (var y=0; y < this.height; y++) {\n this.remove(occupant, x, y, layer)\n }\n }\n }", "function generateWallTiles(upAndDown,nodeArray,wallNodes){\n var wallDensity = $('#wallDensity').val();\n wallDensity = Number(wallDensity);\n while (wallNodes.length<(maxRow*maxRow*wallDensity)){\n if (!upAndDown){\n isWall = (Math.floor(Math.random()*((maxRow*maxRow-1)-0+1))+0);\n while ((isWall % maxRow == 0) || ((isWall-(maxRow-1))%maxRow == 0) || (isWall == maxRow-1)){\n isWall = (Math.floor(Math.random()*((maxRow*maxRow-1)-0+1))+0);}\n for (var i=0; i<nodeArray.length; i++){\n if (nodeArray[i].id == isWall){\n nodeArray[i].isAWall = true;\n nodeArray[i].backgroundcolor = 'black';\n wallNodes.push(isWall);\n }\n }}\n else{\n isWall = (Math.floor(Math.random()*((maxRow*maxRow-(maxRow+1))-maxRow+1)) + maxRow);\n for (var i=0; i<nodeArray.length; i++){\n if (nodeArray[i].id == isWall){\n nodeArray[i].isAWall = true;\n nodeArray[i].backgroundcolor = 'black';\n wallNodes.push(isWall);\n }\n }}\n }\n return nodeArray\n}", "function clearClickedCells ( ) {\n\n\t\t\tif ( ACTIVE_CELL ) {\n\t\t\t\tACTIVE_CELL.removeAttribute('data-state');\n\t\t\t}\n\n\t\t\tif ( START_CELL ) {\n\t\t\t\tSTART_CELL.removeAttribute('data-state');\n\t\t\t}\n\n\t\t\tif ( END_CELL ) {\n\t\t\t\tEND_CELL.removeAttribute('data-state');\n\t\t\t}\n\n\t\t\tif ( BETWEEN_CELLS ) {\n\t\t\t\tBETWEEN_CELLS.forEach(function(a){\n\t\t\t\t\ta.removeAttribute('data-state');\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tACTIVE_CELL = false;\n\t\t\tSTART_CELL = false;\n\t\t\tEND_CELL = false;\n\t\t\tBETWEEN_CELLS = false;\n\t\t}", "function clean_board(fighter){\n\n var x =fighter.coordinate_x;\n var y =fighter.coordinate_y; \n var id = '#'+x+'_'+y; \n $(id).empty();\n}", "function lavender_backtracking(context, width, height) {\n function mark_visited(array, cell) {\n\tarray[cell].id = (Math.abs(context.r.random_value) % (context.maps.length - 3)) + 3;\n\tarray[cell].visited = true;\n\n\tcurrent_cell = cell;\n\tvisited_cells += 1;\n }\n \n function is_unvisited_neighbours(array, cell) {\n\t// Up checking\n\tif ((cell > width) && (!array[cell - height].visited))\n\t return true;\n\n\t// Right checking\n\tif (((cell % width) != (width - 1)) && (!array[cell + 1].visited))\n\t return true;\n\n\t// Down checking\n\tif (((cell + width) < array.length) && (!array[cell + height].visited))\n\t return true;\n\n\t// Left checking\n\tif (((cell % width) != 0) && (!array[cell - 1].visited))\n\t return true;\n\t\n\treturn false;\n }\n \n let directional_functions = [\n\t// Up\n\tfunction(array, cell) {\n\t if (cell < width) {\n\t\treturn false;\n\t }\n\n\t let neighbour = cell - height;\n\t let neighbour_cell = array[neighbour];\n\t if (neighbour_cell.visited) {\n\t\treturn false;\n\t } else {\n\t\tarray[cell].walls[0] = false;\n\t\tarray[neighbour].walls[2] = false;\n\t\tmark_visited(array, neighbour);\n\n\t\treturn true;\n\t }\n\t},\n\n\t// Right\n\tfunction(array, cell) {\n\t if ((cell % width) == (width - 1)) {\n\t\treturn false;\n\t }\n\n\t let neighbour = cell + 1;\n\t let neighbour_cell = array[neighbour];\n\n\t if (neighbour_cell.visited) {\n\t\treturn false;\n\t } else {\n\t\tarray[cell].walls[1] = false;\n\t\tarray[neighbour].walls[3] = false;\n\t\tmark_visited(array, neighbour);\n\n\t\treturn true;\n\t }\n\t},\n\n\t// Down\n\tfunction(array, cell) {\n\t if ((cell + width) >= array.length) {\n\t\treturn false;\n\t }\n\n\t let neighbour = cell + width;\n\t let neighbour_cell = array[neighbour];\n\t \n\t if (neighbour_cell.visited) {\n\t\treturn false;\n\t } else {\n\t\tarray[cell].walls[2] = false;\n\t\tarray[neighbour].walls[0] = false;\n\t\tmark_visited(array, neighbour);\n\n\t\treturn true;\n\t }\n\t},\n\n\t// Left\n\tfunction(array, cell) {\n\t if ((cell % width) == 0) {\n\t\treturn false;\n\t }\n\n\t let neighbour = cell - 1;\n\t let neighbour_cell = array[neighbour];\n\n\t if (neighbour_cell.visited) {\n\t\treturn false;\n\t } else {\n\t\tarray[cell].walls[3] = false;\n\t\tarray[neighbour].walls[1] = false;\n\t\tmark_visited(array, neighbour);\n\n\t\treturn true;\n\t }\n\t}\n ];\n \n let cells = [];\n let stack = [];\n let array_size = width * height;\n let visited_cells = 1;\n let current_cell = (array_size - 1) / 2;\n\n // Generating empty array\n for (var i = 0; i < (width * height); i++) {\n\tcells.push({visited: false, id: -1, walls: [true, true, true, true]});\n }\n\n cells[current_cell].visited = true;\n cells[current_cell].id = 0;\n\n // While there are unvisited cells\n while (visited_cells < array_size) {\n\tif (is_unvisited_neighbours(cells, current_cell)) { // If the current cell has unvisited neighbour\n\t // Push the current cell to the stack\n\t stack.push(current_cell);\n\t // Go in a random direction, and if possible remove the wall between the new cell\n\t // and the current one, and make the new cell the current one\n\t while (!directional_functions[context.r.random_value & 3](cells, current_cell));\n\t} else if (stack.length > 0) { // Else if the stack is not empty\n\t // Pop a cell from the stack and make it the current one\n\t current_cell = stack.pop();\n\t}\n }\n\n // Return the array\n return cells;\n}", "function clean()\n{\nfor(i=0; i<RESOLUTION; i++) //cleaning the results\n\t\tfor(j=0; j<RESOLUTION; j++)\n\t\t{\n\t\t\tif (grid[i][j] != 1)\n\t\t\t\tgrid[i][j] = 1;\n\t\t\telse\n\t\t\t\tgrid[i][j] = 0\n\n\t\t}\n}", "function clearBoard() {\n for(x = 0; x < 7; x += 1){\n for(y = 0; x <7; x += 1){\n checkerboard[x][y] === null;\n }\n }\n \n}", "function createWalls(map)\n{\n //var n = [];\n for (var y = 0; y < map.length; y++)\n {\n for (var x = 0; x < map[0].length; x++)\n {\n if (map[y][x] === 1 && map[y][x] !== 2)\n {\n if (y > 0 && y < map.length - 1 && x > 0 && x < map[0].length - 1)\n {\n if (map[y][x + 1] === 0 || map[y + 1][x] === 0)\n map[y][x] = 2;\n if (map[y][x - 1] === 0 || map[y - 1][x] === 0)\n map[y][x] = 2;\n }\n if (y === 0) {\n if (map[y + 1][x] === 0)\n map[y][x] = 2;\n }\n if (y === map.length - 1) {\n if (map[y - 1][x] === 0)\n map[y][x] = 2;\n }\n if (x === 0) {\n if (map[y][x + 1] === 0)\n map[y][x] = 2;\n }\n if (x === map[0].length - 1) {\n if (map[y][x - 1] === 0)\n map[y][x] = 2;\n }\n }\n }\n }\n}" ]
[ "0.7318625", "0.71253294", "0.70598537", "0.7024343", "0.69079334", "0.6897713", "0.6857468", "0.68298393", "0.6694814", "0.66589856", "0.6642677", "0.66212666", "0.6602228", "0.65807366", "0.6543212", "0.6521065", "0.65134346", "0.6428458", "0.6419398", "0.63995546", "0.63595337", "0.6356803", "0.63527155", "0.6347782", "0.63047975", "0.6281024", "0.627704", "0.6262354", "0.62409717", "0.623771", "0.6211196", "0.62030023", "0.6200412", "0.6190479", "0.6188151", "0.6179899", "0.61650133", "0.61504084", "0.61486137", "0.61473846", "0.611842", "0.6111905", "0.6091794", "0.60892314", "0.6085282", "0.6072223", "0.60715383", "0.6060706", "0.60544956", "0.6046678", "0.6037999", "0.60325664", "0.60224813", "0.60224813", "0.6015661", "0.59962255", "0.59938323", "0.59926325", "0.5988741", "0.5983706", "0.5979061", "0.59632653", "0.5963058", "0.59618896", "0.59551734", "0.5943315", "0.59334296", "0.5932443", "0.5929209", "0.5929021", "0.59276897", "0.59260446", "0.5925417", "0.5924852", "0.5924024", "0.5917286", "0.5913457", "0.59108675", "0.59108675", "0.5909131", "0.59080964", "0.5907157", "0.59037435", "0.5902137", "0.590035", "0.58998644", "0.58966005", "0.5895534", "0.5895534", "0.5894387", "0.5887327", "0.58831805", "0.5873271", "0.5872718", "0.5866576", "0.5863687", "0.58606803", "0.58588666", "0.5851778", "0.58472246" ]
0.68074995
8
function for playing game with arrow keys
function moveK(e) { // When top arrow is pressed if(e.isComposing || e.keyCode === 38) { current.show(); current = current.moveUp(); current.highlight(); if(current === finish){ finishGame(); } } // When right arrow is pressed else if (e.isComposing || e.keyCode === 39) { current.show(); current = current.moveRight(); current.highlight(); if(current === finish){ finishGame(); } } // When down arrow is pressed else if (e.isComposing || e.keyCode === 40) { current.show(); current = current.moveDown(); current.highlight(); if(current === finish){ finishGame(); } } // When left arrow is pressed else if (e.isComposing || e.keyCode === 37) { current.show(); current = current.moveLeft(); current.highlight(); if(current === finish){ finishGame(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pressArrowKeys (event) {\n // console.log(event.keyCode);\n if (!gameStarted || changingTurn) { \n return; \n }\n\n let isFightMode = canFight(currentPlayer, otherPlayer);\n console.log(\"isFightMode: \" + isFightMode);\n if (isFightMode) {\n fightMode(event.keyCode)\n }else{\n boardMode(event.keyCode)\n }\n\n drawGame();\n}", "keyPressed() {\n if (this.started){\n\n switch (event.key) {\n case \"ArrowDown\":\n this.mainLoop(); //Call mainloop because funtion is the same\n break;\n case \"ArrowUp\":\n this.rotate('rotateright');\n break;\n case \"ArrowLeft\":\n this.arrowKeys(-1);\n break;\n case \"ArrowRight\":\n this.arrowKeys(1);\n break;\n case \" \": //space\n this.hardLock();\n break;\n case \"Escape\":\n // this.pauze();\n break;\n case \"z\":\n this.rotate('rotateleft');\n break;\n case \"c\":\n // this.hold();\n break;\n case \"r\":\n // this.gameover();\n // this.start();\n break;\n default:\n return; // Quit when this doesn't handle the key event.\n }\n\n }\n\n }", "function pressedKey(event) {\n let pressed = event.key;\n // Start The Game:\n moveSound.play();\n position = { x: 0, y: 1 };\n switch (pressed) {\n case 'ArrowUp':\n position.x = 0;\n position.y = -1;\n break;\n case 'ArrowDown':\n position.x = 0;\n position.y = 1;\n break;\n case 'ArrowRight':\n position.x = 1;\n position.y = 0;\n break;\n case 'ArrowLeft':\n position.x = -1;\n position.y = 0;\n break;\n case ' ':\n gamePause();\n break;\n default:\n break;\n }\n}", "function keyPressed(){\n\tgameManager.keyPressed();\n}", "function keyPressed() {\n\n // LEFT_ARROW, makes gameChar turn left\n if ( keyCode == 37 ) {\n isLeft = true;\n \n // RIGHT_ARROW, makes gameChar turn right\n } else if ( keyCode == 39 ) {\n isRight = true;\n \n // BACKSPACE, makes a new game start when gameChar is dead or level is complete\n } else if ( keyCode == 32 && ( isGameOver || isLevelComplete ) ) {\n isNewGame = true;\n loop();\n \n // BACKSPACE, makes gameChar jump when gameChar is on the floor and flagpole hasn't been reached\n } else if ( keyCode == 32 && !isFalling && !isLevelComplete ) {\n hasJumped = true;\n }\n \n // Logs values to the console if `DEBUG` and `DEBUG_KEY_PRESSES` are set to `true`\n debug_KeyPresses();\n}", "function keyPressed(){\r\n\tif (play_game == 1){\r\n\t\tif (keyCode === 32 && pause == false){\t\t// Déplacement de la boule avec la barre \"espace\"\r\n\t\t\tif (txb == 4){\r\n\t\t\t\ttxb = -4;\r\n\t\t\t\tscore_move += 1;\r\n\t\t\t\tt = 4;\r\n\t\t\t} else{\r\n\t\t\t\ttxb = 4;\r\n\t\t\t\tscore_move += 1;\r\n\t\t\t\tt = 4;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (keyCode === 80){\t\t\t\t\t\t// Mettre en pause le jeu avec la touche \"p\"\r\n\t\t\tif (pause == false){\r\n\t\t\t\tpause = true;\r\n\t\t\t} else {\r\n\t\t\t\tpause = false;\r\n\t\t\t\tt = 4;\r\n\t\t\t\trelance = score_move % 2;\r\n\t\t\t\tif (relance == 0){\r\n\t\t\t\t\ttxb = -4;\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttxb = 4;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif (play_game == 0){\t\t\t\t\t\t\t// Si le jeu est fini,\r\n\t\tif (keyCode === 82){\t\t\t\t\t\t// réinitialisation du jeu avec la touche \"r\"\r\n\t\t\treset();\r\n\t\t}\r\n\t}\t\r\n}", "function keysPressed(e){\n //store an entry for every key pressed\n keys[e.keyCode] = true;\n //left key pressed\n if ((keys[37]) && canMove(player.x-1, player.y)){\n player.x--;\n }\n //right key pressed\n if ((keys[39]) && canMove(player.x+1, player.y)){\n player.x++;\n }\n //up key pressed\n if ((keys[38]) && canMove(player.x, player.y-1)){\n player.y--;\n }\n // down key pressed\n if ((keys[40]) && canMove(player.x, player.y+1)){\n player.y++;\n }\n\n //Stop the page from using the default input of keyboard inputs\n e.preventDefault();\n // calls the draw function to draw the movement\n draw();\n }", "function onKeyDown(event) {\n\tif (paused) return;\n\tlet keyCode = event.which;\n\tswitch (keyCode) {\n\tcase 87: // W\n\tcase 38: // UP Arrow\n\t\tmovePlayer(directionX.NULL, directionZ.UP);\n\t\tbreak;\n\tcase 83: // S\n\tcase 40: // DOWN Arrow\n\t\tmovePlayer(directionX.NULL, directionZ.DOWN);\n\t\tbreak;\n\tcase 65: // A\n\tcase 37: // LEFT Arrow\n\t\tmovePlayer(directionX.LEFT, directionZ.NULL);\n\t\tbreak;\n\tcase 68: // D\n\tcase 39: // RIGHT Arrow\n\t\tmovePlayer(directionX.RIGHT, directionZ.NULL);\n\t\tbreak;\n\t}\n\treturn;\n}", "function keyPressed()\n{\n\tconsole.log(keyCode);\n\t//'Q key controls the firing of bullets'\n\tif(keyCode === 81) \n\t{\n\t\tfor(let i = 0 ; i < bulletNum; i++)\n\t\t{\n\t\t\tif(bullet[i].getUsed()===0)\n\t\t\t{\n\t\t\t\tbullet[i].init(plane.planeX,plane.planeY);\n\t\t\t\tbulletuseNum++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t//The space bar controls pause and start\n\tif(keyCode ===32) \n\t{\n\t\tif(isPause === 0)\n\t\t{\n\t\t\tisPause = 1;\n\t\t\tnoLoop();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tisPause = 0;\n\t\t\tloop();\n\t\t}\n\t}\n\t/* N next game */\n\tif(keyCode === 78) \n\t{\n\t\t/* win and next game */\n\t\tif(winlose === 2)\n\t\t{\n\t\t\tlevel++;\n\t\t\tenemyhitnum = enemyhitnum+level; //hit number\n\t\t\tenemyspeed = enemyspeed+level; //speed\n\t\t\t/* Modify the parameters for the next game */\n\t\t\tfor (let i = 1; i < enemy.length; i++)\n\t\t\t{\n\t\t\t\tenemy[i].changelevel(enemyhitnum,enemyspeed);\n\t\t\t} \n\t\t\tblood = 20;\n\t\t\tscore = 0;\n\t\t\tloop();\n\t\t}\n\t}\t\n\t/* R restart */\n\tif(keyCode === 82) \n\t{\n\t\t/* lose and restart */\n\t\tif(winlose === 1 || winlose === 2)\n\t\t{\n\t\t\tblood = 20;\n\t\t\tscore = 0;\n\t\t\tloop();\n\t\t}\n\t}\t\n}", "function keyDownEvent(e) {\n switch (e.keyCode) {\n case 37:\n nextX = -1;\n nextY = 0;\n break;\n case 38:\n nextX = 0;\n nextY = -1;\n break;\n case 39:\n nextX = 1;\n nextY = 0;\n break;\n case 40:\n nextX = 0;\n nextY = 1;\n break;\n case 32:\n if (gameActive == true) {\n pauseGame();\n }\n else {\n gameControl = startGame(x);\n }\n break;\n }\n}", "function keyPressed() {\r\n\t//if the right arrow is pressed, Mario will move to the right\r\n\tif (keyCode == RIGHT_ARROW) {\r\n\t\tposX += 25;\r\n\t}\r\n\t//if the left arrow is pressed, Mario will move to the left\r\n\telse if (keyCode == LEFT_ARROW) {\r\n\t\tposX -= 25;\r\n\t}\r\n\t//if the up arrow is pressed, Mario will move up \r\n\telse if (keyCode == UP_ARROW) {\r\n\t\t//when the up button is pressed he will jump\r\n\t\tposY -= 75;\r\n\t}\r\n\t//if the down arrow is pressed, Mario will move down\r\n\telse if (keyCode == DOWN_ARROW) {\r\n\t\tposY += 25;\r\n\t}\r\n}", "function handleKeys() {\r\n\r\n if (currentlyPressedKeys[90]) { //make camera roll to left\r\n // Left cursor key or A\r\n\t teapot_turn += 0.05;\r\n }\r\n else if (currentlyPressedKeys[88]) {\r\n // Up cursor key or W\r\n background_turn += 0.05;\r\n }\r\n\r\n\r\n}", "function keyPressed() {\n\n // If up arrow is pressed (player two)\n if (keyCode === UP_ARROW) {\n playerTwo.direction(0, -5);\n\n // if down arrow is pressed (player two)\n } else if (keyCode === DOWN_ARROW) {\n playerTwo.direction(0, 5);\n\n // if \"W\" is pressed (player one)\n } else if (keyCode === 87) {\n\n playerOne.direction(0, -5);\n\n // if \"S\" is pressed (player two)\n } else if (keyCode === 83) {\n\n playerOne.direction(0, 5);\n }\n}", "function keyPressed() {\n // if players are in gameplay or game over screen\n if (state === \"PLAY\" || state === \"END\") {\n // if the message is updating\n if (textBox.update) {\n // textBox.fullText();\n // skip text animation for the developer :)\n // could be a feature but sometimes player will miss the message entirely if the message is too short\n } else {\n // if there's a second message\n if (textBox.bufferText != null) {\n // show the second message\n textBox.insertBuffer();\n return;\n // if no, hide the message when the animation is finished\n } else {\n if (textBox.showing) {\n textBox.hide();\n return;\n }\n }\n // if in gameplay and not examining a close object\n if (state === \"PLAY\" && !closeObjShowing) {\n // pressing arrowkeys will change background\n currentDir = gameBackground.dir; // store current facing direction\n // UP\n if (keyCode === UP_ARROW) {\n // if player is facing down, go to the last direction\n if (currentDir === 4) {\n currentDir = gameBackground.lastDir;\n gameBackground.changeDirTo(currentDir);\n } else {\n // if player isn't facing up, go face up\n if (currentDir != 5) {\n currentDir = 5;\n gameBackground.changeDirTo(currentDir);\n }\n }\n showTriggers(); // update object trigger areas\n // DOWN\n } else if (keyCode === DOWN_ARROW) {\n // if player is facing up, go to the last dir\n if (currentDir === 5) {\n currentDir = gameBackground.lastDir;\n gameBackground.changeDirTo(currentDir);\n } else {\n // if not facing down, go face down\n if (currentDir != 4) {\n currentDir = 4;\n gameBackground.changeDirTo(currentDir);\n }\n }\n showTriggers();\n // LEFT\n } else if (keyCode === LEFT_ARROW) {\n // if player is facing up or down, don't change\n if (currentDir != 4 && currentDir != 5) {\n // change direction from 0 to 3 and then back to 0\n if (currentDir < 3) {\n currentDir++;\n gameBackground.changeDirTo(currentDir);\n } else if (currentDir === 3) {\n currentDir = 0;\n gameBackground.changeDirTo(currentDir);\n }\n }\n showTriggers();\n // RIGHT\n } else if (keyCode === RIGHT_ARROW) {\n if (currentDir != 4 && currentDir != 5) {\n // change direction from 3 to 0 and then back to 3\n if (currentDir > 0) {\n currentDir--;\n gameBackground.changeDirTo(currentDir);\n } else if (currentDir === 0) {\n currentDir = 3;\n gameBackground.changeDirTo(currentDir);\n }\n }\n showTriggers();\n }\n }\n }\n }\n}", "function handleKeyDown(e)\n{\n hero.jump();\n}", "function keyPressed() {\n\tswitch (keyCode){\n\t\tcase LEFT_ARROW:\n\t\t\tconsole.log('pressed', keyCode)\n\t\t\t\n\t\t\tsnake.setDir(-1, 0);\n\t\t\tbreak;\n\t\t\t\n\n\t\tcase RIGHT_ARROW:\n\t\t\tconsole.log('pressed', keyCode)\n\t\t\t\n\t\t\tsnake.setDir(1, 0);\n\t\t\tbreak;\n\t\t\t\n\n\t\tcase DOWN_ARROW:\n\t\t\tconsole.log('pressed', keyCode)\n\n\t\t\t\n\t\t\tsnake.setDir(0, 1)\n\t\t\tbreak;\n\t\t\t\n\t\tcase UP_ARROW:\n\t\t\tconsole.log('pressed', keyCode)\n\t\t\t\n\t\t\tsnake.setDir(0, -1)\n\t\t\tbreak;\n\t\t\t\n\t\tdefault:\n\t\t\tconsole.log('pressed', keyCode)\n\t\t\tbreak;\n\t}\n}", "function keyPressed() {\n if (keyCode === LEFT_ARROW){\n paddle.moveLeft();\n } else if (keyCode === RIGHT_ARROW){\n paddle.moveRight();\n }\n}", "function keyPressed() {\n if (!game.gameLost && !game.gamePaused) {\n var updateBoard = false\n if(keyCode == LEFT_ARROW) {\n updateBoard = game.movePiece(LEFT_MOVE)\n } else if (keyCode == RIGHT_ARROW) {\n updateBoard = game.movePiece(RIGHT_MOVE)\n } else if (keyCode == UP_ARROW) {\n updateBoard = game.rotatePiece()\n }\n\n if (updateBoard) {\n reDrawGame()\n }\n } \n}", "function arrowKeys(e) {\n\n // before the score hits 3 and after it goes over 9, the keyboard has the normal functions\n if (score < 3 || score >= 9 && score < 12) {\n\n switch(e.keyCode) {\n\n // the if conditions avoid to go the opposite of the current direction\n case 37: if (direction !== \"right\") \n {\n\n // setTimeout is used to avoid going the opposite direction if you hit the keys too fast\n setTimeout(function() {direction = \"left\";}, 80); \n }\n break;\n case 38: if (direction !== \"down\") \n {\n setTimeout(function() {direction = \"up\";}, 80); \n }\n break;\n case 39: if (direction !== \"left\") \n {\n setTimeout(function() {direction = \"right\";}, 80); \n }\n break;\n case 40: if (direction !== \"up\") \n {\n setTimeout(function() {direction = \"down\";}, 80); \n }\n break;\n case 83: gameOn.play();\n break;\n }\n }\n\n // when the score goes over 3 and before it hits 9, the arrow keys are inverted\n else if (score >= 3 && score <= 8) {\n\n // this inverts the direction from the pressed arrow keys after 3 eaten apples and switches back at 6 \n\n switch(e.keyCode) {\n \n case 37: if (direction !== \"left\") \n {\n setTimeout(function() {direction = \"right\";}, 80);\n }\n break;\n case 38: if (direction !== \"up\") \n {\n setTimeout(function() {direction = \"down\";}, 80);\n }\n break;\n case 39: if (direction !== \"right\") \n {\n setTimeout(function() {direction = \"left\";}, 80);\n }\n break;\n case 40: if (direction !== \"down\") \n {\n setTimeout(function() {direction = \"up\";}, 80);\n }\n break;\n }\n }\n\n // to increase difficulty, when the score goes over 12 and before it hits 20, the keys start turning in a clockwise manner\n else if ( score >= 12 && score <= 20) {\n\n switch(e.keyCode) {\n \n case 37: if (direction !== \"up\") \n {\n setTimeout(function() {direction = \"down\";}, 80); \n }\n break;\n case 38: if (direction !== \"right\") \n {\n setTimeout(function() {direction = \"left\";}, 80); \n }\n break;\n case 39: if (direction !== \"down\") \n {\n setTimeout(function() {direction = \"up\";}, 80);\n }\n break;\n case 40: if (direction !== \"left\") \n {\n setTimeout(function() {direction = \"right\";}, 80);\n }\n break;\n }\n } \n}", "function keydown(e) {\r\n if (e.keyCode == \"38\") {\r\n // called the function according to the requirement\r\n moveup();\r\n } else if (e.keyCode == \"40\") {\r\n movedown();\r\n } else if (e.keyCode == \"37\") {\r\n moveleft();\r\n } else if (e.keyCode == \"39\") {\r\n moveright();\r\n }\r\n}", "function keyPressed() {\n}", "function handleKey(event) {\n\tvar i = gGamerPos.i;\n\tvar j = gGamerPos.j;\n\n\tvar leftWindow = gWindowsPos[0].pos;\n\tvar rightWindow = gWindowsPos[1].pos;\n\tvar upWindow = gWindowsPos[2].pos;\n\tvar downWindow = gWindowsPos[3].pos;\n\n\t//arrowLeft\n\tif (event.key === 'ArrowLeft') {\n\t\tif (leftWindow.i === i && leftWindow.j === j) {\n\t\t\tmoveTo(leftWindow.matchI,leftWindow.matchJ);\n\t\t} else {\n\t\t\tmoveTo(i, j - 1);\n\t\t}\n\t}\n\n\t//arrowRight\n\tif (event.key === 'ArrowRight') {\n\t\tif (rightWindow.i === i && rightWindow.j === j) {\n\t\t\tmoveTo(rightWindow.matchI,rightWindow.matchJ);\n\t\t} else {\n\t\t\t\tmoveTo(i, j + 1);\n\t\t}\n\t}\n\t\n\t//arrowUp\n\tif (event.key === 'ArrowUp') {\n\t\tif (upWindow.i === i && upWindow.j === j) {\n\t\t\tmoveTo(upWindow.matchI,upWindow.matchJ);\n\t\t} else {\t\n\t\t\tmoveTo(i - 1, j);\n\t\t}\n\t}\n\n\t//arrowDown\n\tif (event.key === 'ArrowDown') {\n\t\tif (downWindow.i === i && downWindow.j === j) {\n\t\t\tmoveTo(downWindow.matchI,downWindow.matchJ);\n\t\t} else {\n\t\t\tmoveTo(i + 1, j);\n\t\t}\n\t}\n}", "function onKeyDown(evt) \r\n{\r\n\tif(isGameRunning && !isGameOver && !isFalling && !playingLivesLeft && !playingScoreSound && !playingFinishedSound && !introducing)\r\n\t{\r\n\t\t//Did we push the left arrow key?\r\n\t\tif (evt.keyCode == 37 && !evt.shiftKey)\r\n\t\t\tkeyPressed = 1;\r\n\t \r\n\t\t//Did we push the up arrow key?\r\n\t\telse if (evt.keyCode == 38 && !evt.shiftKey) \r\n\t\t\tkeyPressed = 2;\r\n\t\t\t\r\n\t\t//Did we push the right arrow key?\r\n\t\telse if (evt.keyCode == 39 && !evt.shiftKey)\r\n\t\t\tkeyPressed = 3;\r\n\t\t\r\n\t\t//Did we push the Enter key?\r\n\t\telse if (evt.keyCode == 13)\r\n\t\t\tplayHints();\r\n\t\t\r\n\t\t//If we pressed one of the arrow keys without pressing shift, move if we can\r\n\t\tif(evt.keyCode!=13 && !evt.shiftKey)\r\n\t\t\tmovePlayer();\r\n\t}\r\n\t\r\n\t//Have we pressed the spacebar in order to skip the introduction?\r\n\tif(introducing && evt.keyCode==32)\r\n\t{\r\n\t\taudio.stop({channel : 'default'});\r\n\t\t\r\n\t\t//Set voice to default in case spacebar is pressed when female voice was speaking\r\n\t\taudio.setProperty({name : 'voice', channel : 'default', value : 'default'});\r\n\t\t\r\n\t\tinitializeGame();\r\n\t}\r\n}", "function keyPressed() {\n\t// toggle fullscreen mode\n\tif( key === 'f') {\n\t\tfs = fullscreen();\n\t\tfullscreen(!fs);\n\t\treturn;\n\t}\n\n\t// dispatch key events for adventure manager to move from state to \n\tadventureManager.keyPressed(key); \n}", "function handleKey(event){ \n switch (event.code){\n case 'ArrowRight':\n playerOne.moveRight() \n break\n case 'ArrowLeft':\n playerOne.moveLeft() \n break \n case 'ArrowUp':\n playerOne.moveUp() \n break\n case 'ArrowDown':\n playerOne.moveDown() \n break\n }\n }", "function keyPressed() {\n if(keyCode === UP_ARROW) {\n \tsnake.direction(0,-1);\n }\n if(keyCode === DOWN_ARROW) {\n \tsnake.direction(0,1);\n }\n if(keyCode === LEFT_ARROW) {\n \tsnake.direction(-1,0);\n }\n if(keyCode === RIGHT_ARROW) {\n \tsnake.direction(1,0);\n }\n \n}", "function keyPressed() {\n if (gameView == VIEW_GAME) {\n //Ingame\n if (keyCode == UP_ARROW) {\n console.log(\"up\")\n }\n if (keyCode == DOWN_ARROW) {\n console.log(\"down\")\n }\n if (keyCode == LEFT_ARROW) {\n console.log(\"left\")\n }\n if (keyCode == RIGHT_ARROW) {\n console.log(\"right\")\n }\n if (key == ' ') {\n console.log(\"Space\");\n shakeTimer = 0.1;\n }\n\n if (key == 'p') {\n console.log(\"Pressed P key\")\n submitScore();\n }\n\n if (key == 'e') {\n console.log(\"Pressed E key\")\n\n spawnExplosion(camera.mouseX, camera.mouseY, 3);\n }\n }\n\n\n if (keyCode == ESCAPE) {\n gameView = VIEW_MAIN_MENU;\n }\n}", "function keyDown(e) {\r\n\t//If the p key is pressed run pauseGame\r\n if (e.keyCode == 80) {\r\n\t pauseGame();\r\n }\r\n}", "function setUpControl(){\n $(document).keydown( (e) => {\n switch (e.which) {\n case 27:\n if (gameStarted)\n togglePause()\n break\n case 37:\n case 65:\n if (!gameStarted || next.dir != RIGHT){\n next = { dir: LEFT, x: -1, y: 0 }\n startGame()\n }\n break\n case 38:\n case 87:\n if (!gameStarted || next.dir != DOWN){\n next = { dir: UP, x: 0, y: -1 }\n startGame()\n }\n break\n case 39:\n case 68:\n if (!gameStarted || next.dir != LEFT){\n next = { dir: RIGHT, x: 1, y: 0 }\n startGame()\n }\n break\n case 40:\n case 83:\n if (!gameStarted || next.dir != UP){\n next = { dir: DOWN, x: 0, y: 1 }\n startGame()\n }\n break\n }\n })\n}", "function keyPressed() {\n //if the spacebar is pressed (while the game is in play) call the players firePhazer function\n if (keyCode === 32 && gameState === \"playing\") {\n player.firePhazer();\n }\n}", "function keyPressed() {\n if (!options) {\n if (keyCode === CONTROLS.P) {\n paused = !paused;\n } else if (keyCode === CONTROLS.W && !paused) {\n balls.forEach((ball) => {\n if (!ball.moving) ball.launch();\n });\n } else if (keyCode === CONTROLS.SPACE && !paused) {\n paddle.fire();\n } \n if (paused && keyCode === CONTROLS.Q) {\n game.initialize();\n }\n }\n if (options) {\n if (keyCode === CONTROLS.L) {\n game.switchLevel();\n } else if (keyCode === ENTER) {\n game.startGame();\n }\n }\n return false;\n}", "function onKeyDown(event){\n \n //keyboard events\n switch(event.keyCode){\n case 48:\n case 96:\n lookUp = true;\n break;\n case 38: //up\n case 87: //w\n console.log('w');\n moveForward = true;\n break;\n case 37: //left\n case 65: //a\n moveLeft = true;\n break;\n case 40: //down \n case 83: //s\n moveBackward = true;\n break;\n case 39: //right\n case 68: //d\n moveRight = true;\n break;\n }//end switch\n}", "function keyPressed() {\n // toggle fullscreen mode\n if( key === 'f') {\n fs = fullscreen();\n fullscreen(!fs);\n return;\n }\n\n // dispatch all keys to adventure manager\n adventureManager.keyPressed(key); \n}", "function keyPressed() {\n // toggle fullscreen mode\n if( key === 'f') {\n fs = fullscreen();\n fullscreen(!fs);\n return;\n }\n\n // dispatch all keys to adventure manager\n adventureManager.keyPressed(key); \n}", "function keyPressed (){\n //KeyCode is built in variavle\n if(keyCode === UP_ARROW){\n snake.dir(0,-1);\n }else if (keyCode === DOWN_ARROW){\n snake.dir(0,1);\n }else if (keyCode === RIGHT_ARROW){\n snake.dir(1,0);\n }else if (keyCode === LEFT_ARROW){\n snake.dir(-1,0);\n }\n}", "function keydown(evt) {\r\n if (isGameOver) return false\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n var SPACE = 32;\r\n\r\n switch (keyCode) {\r\n case \"N\".charCodeAt(0):\r\n if (player.motion!=motionType.LEFT) flipPlayer = motionType.LEFT\r\n player.motion = motionType.LEFT;\r\n break;\r\n\r\n case \"M\".charCodeAt(0):\r\n if (player.motion!=motionType.RIGHT) flipPlayer = motionType.RIGHT\r\n player.motion = motionType.RIGHT;\r\n break;\r\n case \"Z\".charCodeAt(0):\r\n if (player.isOnPlatform() || player.isOnVerticalPlatform){\r\n player.verticalSpeed = JUMP_SPEED\r\n }\r\n break;\r\n case \"C\".charCodeAt(0):\r\n cheatMode = true\r\n console.log(\"cheat mode enabled\")\r\n break;\r\n case \"V\".charCodeAt(0):\r\n cheatMode = false\r\n console.log(\"cheat mode disabled\")\r\n break;\r\n case SPACE:\r\n if (bullet_count > 0 || cheatMode) shoot()\r\n evt.preventDefault()\r\n break;\r\n return false\r\n }\r\n}", "function handleKey(event) {\r\n\r\n var i = gGamerPos.i;\r\n var j = gGamerPos.j;\r\n\r\n switch (event.key) {\r\n case \"ArrowLeft\":\r\n\t\tif(gBoard[5][0].gameElement === GAMER){\r\n\t\t\tmoveTo(5,11)\r\n\t\t}else{ \r\n moveTo(i, j - 1);}\r\n break;\r\n case \"ArrowRight\":\r\n\t\tif(gBoard[5][11].gameElement === GAMER){\r\n\t\t\tmoveTo(5,0);\r\n\t\t}else{ \r\n moveTo(i, j + 1);}\r\n break;\r\n case \"ArrowUp\":\r\n if (gBoard[0][5].gameElement === GAMER) {\r\n\t\t moveTo(9, 5);\r\n\t\t}else {\r\n\t\t\tmoveTo(i - 1, j);\r\n\t\t}\r\n break;\r\n case \"ArrowDown\":\r\n\t\tif (gBoard[9][5].gameElement === GAMER) {\r\n\t\t\tmoveTo(0, 5);\r\n\t\t }else {\r\n moveTo(i + 1, j);}\r\n break;\r\n }\r\n}", "function keyControl(event) {\n if (event.keyCode == 37 && buttonPressed != true && gameOver != true) {\n keyPressed = true;\n p.moveLeft();\n } else if (event.keyCode == 38 && buttonPressed != true && gameOver != true) {\n keyPressed = true;\n p.rotate();\n rotateSound.play();\n } else if (event.keyCode == 39 && buttonPressed != true && gameOver != true) {\n keyPressed = true;\n p.moveRight();\n } else if (event.keyCode == 40 && buttonPressed != true && gameOver != true) {\n keyPressed = true;\n p.moveDown();\n }\n }", "function keyPressed(){\n\tif(key == 'a'){\n\t\t ghost.up(); //calls upon the 'this.up' function within the ghost function\n\t}\n if(key == 'a'){\n thud.play(); //plays the thud sound\n thud.setVolume(1); //sets the volume\n }\n}", "function setGameControls() {\n\n function eventHandler(event) {\n\n // Prevent arrows from moving the page around\n if(event.keyCode && [32, 37, 38, 39, 40].indexOf(event.keyCode) > -1) {\n event.preventDefault();\n }\n \n var token = event.keyCode ? event.keyCode : event.target.id;\n switch (token) {\n case \"d-pad-left\":\n moveInterval = setInterval(function() { movePlayer(\"left\") }, 100);\n case 37:\n case 65:\n // D-pad left, left arrow, keyboard \"a\" button\n movePlayer(\"left\");\n break;\n case \"d-pad-up\":\n moveInterval = setInterval(function() { movePlayer(\"up\"); }, 100);\n case 38:\n case 87:\n // D-pad up, up arrow, keyboard \"w\" button\n movePlayer(\"up\");\n break;\n case \"d-pad-right\":\n moveInterval = setInterval(function() { movePlayer(\"right\"); }, 100);\n case 39:\n case 68:\n // D-pad right, right arrow, keyboard \"d\" button\n movePlayer(\"right\");\n break;\n case \"d-pad-down\":\n moveInterval = setInterval(function() { movePlayer(\"down\"); }, 100);\n case 40:\n case 83:\n //D-pad down, down arrow, keyboard \"s\" button\n movePlayer(\"down\");\n break;\n case \"a-button\":\n case 75:\n // a-button, keyboard \"k\" button\n if (playerState !== \"locked\") {\n interactOrSelect();\n } else {\n cancelOrBack();\n }\n break;\n case \"b-button\":\n case 76:\n // b-button, keyboard \"l\" button\n cancelOrBack();\n break;\n case \"select\":\n case 71:\n // select, keyboard \"g\" button\n console.log(\"The select button was pressed\");\n break;\n case \"start\":\n case 72:\n // start, keyboard \"h\" button\n console.log(\"The start button was pressed\");\n break;\n default:\n }; \n }\n\n $(document).on(\"keydown\", eventHandler);\n $(document).on(\"mousedown\", eventHandler);\n\n $(document).on(\"keyup\", function(event) {\n var gameButtons = [37, 65, 38, 87, 39, 68, 40, 83];\n if (gameButtons.includes(event.keyCode) && playerState === \"walking\") {\n playerState = \"standing\";\n walkingAnimation(playerDirection);\n }\n });\n\n $(document).on(\"mouseup\", function(event) {\n clearInterval(moveInterval);\n if (playerState === \"walking\") {\n playerState = \"standing\";\n walkingAnimation(playerDirection);\n }\n });\n}", "function keydown(evt) {\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n player.motion = motionType.LEFT;\r\n player.facing = facingDir.LEFT;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n player.motion = motionType.RIGHT;\r\n\t\t\tplayer.facing = facingDir.RIGHT;\r\n break;\r\n\r\n case \"W\".charCodeAt(0):\r\n if (player.isOnPlatform()||cheating) {\r\n player.verticalSpeed = JUMP_SPEED;\r\n }\r\n break;\r\n\r\n\t\tcase \"C\".charCodeAt(0):\r\n\t\t\tif (!cheating){\r\n\t\t\t\tplayer.rolenode.style.setProperty(\"opacity\", 0.5, null);\r\n\t\t\t\tcheating = true;\r\n\t\t\t\tOLD_BCOUNT = BULLET_COUNT;\r\n\t\t\t\tBULLET_COUNT = Number.POSITIVE_INFINITY;\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"V\".charCodeAt(0):\r\n\t\tif (cheating){\r\n\t\t\t\tplayer.rolenode.style.setProperty(\"opacity\", 1, null);\r\n\t\t\t\tcheating = false;\r\n\t\t\t\tBULLET_COUNT = OLD_BCOUNT;\r\n\t\t}\r\n\t\t\tbreak;\r\n\r\n\t\tcase \"Q\".charCodeAt(0):\r\n\t\t\talert( player.position.x+ \", \"+ (player.position.y - 5) );\r\n\t\t\tbreak;\r\n\r\n\r\n\t\tcase 32:\r\n if (canShoot) shootBullet();\r\n break;\r\n }\r\n}", "checkKey(e) {\n if (e.keyCode == '87') { //up\n console.log(\"UP key pressed.\")\n this.moveFrog(0, -10);\n }\n else if (e.keyCode == '83') { //down\n console.log(\"DOWN key pressed.\")\n this.moveFrog(0, 10);\n }\n else if (e.keyCode == '65') { //left\n console.log(\"LEFT key pressed.\")\n this.moveFrog(-10, 0)\n }\n else if (e.keyCode == '68') { //right\n console.log(\"RIGHT key pressed.\")\n this.moveFrog(10, 0);\n }\n }", "keyHandler(scene){\n const { keys } = scene;\n // If this is the first frame it will just take the keys pressed and return.\n if (!this.prevKeys){\n this.savePreviousKeyInput(keys);\n return;\n }\n // If no key pressed, return\n if (!(keys.left.isDown || keys.right.isDown || keys.crouch.isDown || this.prevKeys.left || this.prevKeys.right || this.prevKeys.crouch)){\n return;\n }\n \n // ON PRESS LEFT\n if(keys.left.isDown && !this.prevKeys.left){\n scene.player.flipX = true;\n if(!keys.crouch.isDown){\n scene.player.play(\"move\");\n } \n }\n // ON HOLD LEFT\n if(keys.left.isDown && !keys.left.isUp && this.prevKeys.left){\n if(!keys.crouch.isDown){\n this.move(scene,this.speed,\"left\");\n } else {\n this.move(scene,this.speed/2,\"left\");\n }\n }\n // ON RELEASE LEFT\n if(!keys.left.isDown && this.prevKeys.left ){\n this.stop(scene);\n if (!keys.crouch.isDown){\n scene.player.play(\"idle\");\n }\n\n }\n // ON PRESS RIGHT\n if(keys.right.isDown && !this.prevKeys.right){\n scene.player.flipX = false;\n if(!keys.crouch.isDown){\n scene.player.play(\"move\");\n }\n }\n // ON HOLD RIGHT\n if(keys.right.isDown && !keys.right.isUp && this.prevKeys.right){\n if(!keys.crouch.isDown){\n this.move(scene,this.speed,\"right\");\n\n } else {\n this.move(scene,this.speed/2,\"right\");\n\n }\n }\n // ON RELEASE RIGHT\n if(!keys.right.isDown && this.prevKeys.right ){\n this.stop(scene);\n if (!keys.crouch.isDown){\n scene.player.play(\"idle\");\n }\n }\n // ON PRESS DOWN\n if(keys.crouch.isDown && !this.prevKeys.crouch){\n scene.player.play(\"crouch\"); \n \n this.body.setSize(16,10,true);\n this.body.setOffset(8,13);\n\n }\n // ON RELEASE DOWN\n if(!keys.crouch.isDown && this.prevKeys.crouch){\n this.jump(scene);\n\n //this.body.\n if (keys.left.isDown){\n scene.player.play(\"move\");\n } else if (keys.right.isDown){\n scene.player.play(\"move\");\n } else {\n scene.player.play(\"idle\");\n }\n\n this.body.setSize(16,17,true)\n this.body.setOffset(8,5);\n }\n\n // The last thing we do is storing keys pressed on this frame.\n this.savePreviousKeyInput(keys);\n }", "function keyPressed(evt) {\r\n //if key \"L\" is presseg, let slider look previous image\r\n if (evt.keyCode == \"76\") {\r\n slider.stepLeft();\r\n } else if (evt.keyCode == \"82\") { //if key \"R\" is presseg, let slider look next image\r\n slider.stepRight();\r\n } else if (evt.keyCode == \"65\") {\r\n // alert(\"a gedrückt!\")\r\n spriteanimation.init();\r\n spriteanimation.gameLoop(running);\r\n }\r\n\r\n}", "function keys(e) {\n const allowedKeys = {\n 37: 'left',\n 38: 'up',\n 39: 'right',\n 40: 'down'\n };\n // Send keys to Player.handleInput() method\n player.handleInput(allowedKeys[e.keyCode]);\n}", "function handleKey(e){\r\n e = e || window.event;\r\n\r\n if (e.keyCode == '38' && state != 1 && state != 3){\r\n // up arrow\r\n state = 3;\r\n play = true;\r\n }\r\n else if (e.keyCode == '40' && state != 1 && state != 3){\r\n // down arrow\r\n state = 1;\r\n play = true;\r\n }\r\n else if (e.keyCode == '37' && state != 0 && state != 2){\r\n // left arrow\r\n state = 2;\r\n play = true;\r\n }\r\n else if (e.keyCode == '39' && state != 0 && state != 2){\r\n // right arrow\r\n state = 0;\r\n play = true;\r\n }\r\n //console.log(e.keyCode);\r\n if(play)\r\n playAudio();\r\n}", "function keyPressed() {\n if (key === 'p') {\n resetGame();\n startGame = true;\n }\n}", "function keysDown(e) {\r\n if (e.keyCode == 39) {\r\n righty = true;\r\n }\r\n else if (e.keyCode == 37) {\r\n lefty = true;\r\n }\r\n else if (e.keyCode == 32 && gameOver && !played) {\r\n play();\r\n }\r\n }", "function keyBoardEventSingle(event)\n{\n if(event.type == \"keydown\")\n { \n if(!m_bGameStatus.paused)\n { \n if (event.keyCode == m_iKeyId.arrowUp) // Up arrow key was pressed.\n m_Player.up = true;\n\n else if (event.keyCode == m_iKeyId.arrowDown) // Down arrow key was pressed.\n m_Player.down = true;\n\n else if(event.keyCode == m_iKeyId.arrowRight) // Right arrow key was pressed\n m_Player.right = true;\n\n else if(event.keyCode == m_iKeyId.arrowLeft) // Right arrow key was pressed\n m_Player.left = true;\n \n else if (event.keyCode == m_iKeyId.a) // A was pressed\n m_Player.shootingLazer = true;\n } \n }\n \n if(event.type == \"keyup\")\n {\n if(!m_bGameStatus.paused)\n {\n if (event.keyCode == m_iKeyId.arrowUp) // Up arrow key was pressed.\n m_Player.up = false;\n\n else if (event.keyCode == m_iKeyId.arrowDown) // Down arrow key was pressed.\n m_Player.down = false;\n\n else if(event.keyCode == m_iKeyId.arrowRight) // Right arrow key was pressed\n m_Player.right = false;\n\n else if(event.keyCode == m_iKeyId.arrowLeft) // Right arrow key was pressed\n m_Player.left = false;\n\n else if(event.keyCode == m_iKeyId.enter)\n playSingleAgain();\n \n else if(event.keyCode == m_iKeyId.a) // A was pressed\n m_Player.shootingLazer = false;\n \n else if(event.keyCode == m_iKeyId.esc)\n showStartSingle();\n }\n\n if (event.keyCode == m_iKeyId.space && !m_bGameStatus.lost) // Space bar was pressed\n m_bGameStatus.isPaused ? unPauseGameSingle() : pauseGameSingle(true);\n }\n}", "function keyPressed(e){\n\t\t//conditional statements\n\t\tif(e.key == \"ArrowRight\" && snake.direction != \"left\"){\n\t\t\tright.play();\n\t\t\tsnake.direction = \"right\";\n\t\t}\n\t\telse if(e.key == \"ArrowLeft\" && snake.direction != \"right\"){\n\t\t\tleft.play();\n\t\t\tsnake.direction = \"left\";\n\t\t}\n\t\telse if(e.key == \"ArrowDown\" && snake.direction != \"up\"){\n\t\t\tdown.play();\n\t\t\tsnake.direction = \"down\";\n\t\t}\n\t\telse if(e.key == \"ArrowUp\" && snake.direction != \"down\"){\n\t\t\tup.play();\n\t\t\tsnake.direction = \"up\";\n\t\t}\n\t\tconsole.log(snake.direction);\n\t}", "function keyPressed () {\n // restart the game if space is pressed on either overlay\n if (keyCode === 32 && !isGameRunning) {\n lives = maxLives;\n startGame();\n return; // prevent the character from jumping when we restart the game\n }\n\n if (!isGameRunning) {\n return; // don't handle any other input\n }\n\n // 37 -> left arrow\n if (keyCode === 37) {\n character.isLeft = true;\n }\n\n // 39 -> right arrow\n if (keyCode === 39) {\n character.isRight = true;\n }\n\n // 32 -> space, 38 -> up arrow\n // character can only jump when they're on the ground!\n if ([32, 38].includes(keyCode) && character.y === world.floor) {\n jump(character);\n playSound('jump', 0.8);\n }\n\n // 16 -> shift\n // toggle debug mode on and off\n if (keyCode === 16) {\n debug = !debug;\n }\n}", "function keyPressed(){\n if (keyCode === RIGHT_ARROW){\n char1.willStop = false;\n if (char1.state !== \"right\") char1.rightState();\n\n }\n\n if (keyCode === LEFT_ARROW){\n char1.willStop = false;\n if (char1.state !== \"left\") char1.leftState();\n\n }\n\n if (keyCode === DOWN_ARROW){\n char1.willStop = false;\n if (hadouken1.alive === false){\n hadouken1.setStart(char1.charX, char1.charY);\n hadouken1.startTime = 0;\n hadouken1.lifeTime = 0;\n hadouken1.alive = true;\n\n //playing the sound effect\n char1.sound.play();\n }\n if (char1.state !== \"hadouken\") char1.hadouken();\n\n }\n}", "function handleKey(event) {\r\n\tvar i = gGamerPos.i;\r\n\tvar j = gGamerPos.j;\r\n\r\n\r\n\tswitch (event.key) {\r\n\t\tcase 'ArrowLeft':\r\n\t\t\tmoveTo(i, j - 1);\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowRight':\r\n\t\t\tmoveTo(i, j + 1);\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowUp':\r\n\t\t\tmoveTo(i - 1, j);\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowDown':\r\n\t\t\tmoveTo(i + 1, j);\r\n\t\t\tbreak;\r\n\t}\r\n}", "function keydownEventHandler(e) {\n // key movement for player up, down, left, right\n if (e.keyCode == 87) { // W key\n playerUp = true;\n }\n if (e.keyCode == 83) { // S key\n playerDown = true;\n }\n if (e.keyCode == 65) { // A key\n playerLeft = true;\n }\n if (e.keyCode == 68) { // D key\n playerRight = true;\n }\n}", "keyPressed({keyPressed, keyCode}){\n console.log('keypressed, keycode', keyPressed, keyCode);\n if(keyCode === 70){ //f\n requestFullScreen();\n return;\n }\n if(keyCode === 80){ //p\n requestPointerLock();\n return;\n }\n let key = keyCode + '';\n this.keysCurrentlyPressed[key] = {keyPressed, keyCode, clock:new Clock()};\n }", "function keyPressed() {\n if (keyCode == LEFT_ARROW) {\n rocket.left();\n //console.log(\"LEFT\");\n }\n if (keyCode == RIGHT_ARROW) {\n rocket.right();\n //console.log(\"RIGHT\");\n }\n if (keyCode == DOWN_ARROW) {\n setVolume(0);\n //console.log(\"RIGHT\");\n }\n}", "function keyPressed() {\n if (key == \"A\" || key == \"a\") {\n playerOne.move(-1);\n }\n if (key == \"D\" || key == \"d\") {\n playerOne.move(1);\n }\n if (key == \"J\" || key == \"j\") {\n playerTwo.move(-1);\n }\n if (key == \"L\" || key == \"l\") {\n playerTwo.move(1);\n }\n if (key == \"R\" || key == \"r\") {\n controller.gameState = \"PLAY\";\n }\n }", "function handleInteractions() {\n\tif (keys[38] || keys[87]) { //Up arrow\n\t\tplayer.move(0,-2);\n\t}\n\tif (keys[37] || keys[65]) { //Left Arrow\n\t\tplayer.move(-2,0);\n\t}\n\tif (keys[39] || keys[68]) { //right arrow\n\t\tplayer.move(2,0);\n\t}\n\tif (keys [40] || keys[83]) { //down arrow\n\t\tplayer.move(0,2);\n\t}\n\tif (keys [32]) { //spacebar\n\t\t\n\t}\n\tif (keys[69]) { //e\n\t\tplayer.use();\n\t}\n\tif (keys[70]) { //f\n\t\t\n\t}\n\tif (keys[71]) { //g\n\t\t\n\t}\n\tif (keys[82]) { //r\n\t\t\n\t}\n\n}", "function whenKeyDown(k) {\r\n switch (k) {\r\n case \"2\":\r\n case \"x\": \r\n case \"s\":\r\n case \"Down\":\r\n case \"ArrowDown\":\r\n moveDown();\r\n break;\r\n case \"8\":\r\n case \"w\": \r\n case \"Up\":\r\n case \"ArrowUp\":\r\n moveUp();\r\n break;\r\n case \"4\":\r\n case \"a\": \r\n case \"Left\":\r\n case \"ArrowLeft\":\r\n moveLeft();\r\n break;\r\n case \"6\":\r\n case \"d\": \r\n case \"Right\":\r\n case \"ArrowRight\":\r\n moveRight();\r\n break;\r\n case \"7\":\r\n case \"q\":\r\n moveUpLeft();\r\n break; \r\n case \"9\":\r\n case \"e\":\r\n moveUpRight();\r\n break; \r\n case \"1\":\r\n case \"z\":\r\n moveDownLeft();\r\n break; \r\n case \"3\":\r\n case \"c\":\r\n moveDownRight();\r\n break; \r\n case \" \":\r\n // pickup\r\n break;\r\n }\r\n}", "function keyPressed() {\n if (keyCode === UP_ARROW) {\n snake.dir(\"UP\");\n } else if (keyCode === DOWN_ARROW) {\n snake.dir(\"DOWN\");\n } else if (keyCode === LEFT_ARROW) {\n snake.dir(\"LEFT\");\n } else if (keyCode === RIGHT_ARROW) {\n snake.dir(\"RIGHT\");\n }\n}", "function keydown(evt) {\r\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\r\n\r\n switch (keyCode) {\r\n case \"A\".charCodeAt(0):\r\n player.motion = motionType.LEFT;\r\n if(!playFaceLeft){\r\n var player1 = svgdoc.getElementById(\"playerExceptname\");\r\n player1.setAttribute(\"transform\", \"translate(\" +PLAYER_SIZE.w + \", 0) scale(-1,1)\");\r\n\r\n }\r\n playFaceLeft = true;\r\n break;\r\n\r\n case \"D\".charCodeAt(0):\r\n player.motion = motionType.RIGHT;\r\n if(playFaceLeft){\r\n var player1 = svgdoc.getElementById(\"playerExceptname\");\r\n player1.setAttribute(\"transform\", \"translate(0, 0) scale(1,1)\");\r\n }\r\n playFaceLeft = false;\r\n break;\r\n\r\n case \"W\".charCodeAt(0):\r\n if (cheat || player.isOnPlatform()) {\r\n player.verticalSpeed = JUMP_SPEED;\r\n }\r\n break;\r\n case 32:\r\n if(canShoot)\r\n shootBullet();\r\n break;\r\n case \"C\".charCodeAt(0):\r\n cheat = true;\r\n var player2 = svgdoc.getElementById(\"playerExceptname\");\r\n player2.setAttribute(\"style\", \"opacity:0.5\");\r\n break;\r\n case \"V\".charCodeAt(0):\r\n cheat = false;\r\n var player2 = svgdoc.getElementById(\"playerExceptname\");\r\n player2.setAttribute(\"style\", \"opacity:1\");\r\n break;\r\n\r\n }\r\n}", "onArrowPressed() {\r\n var count = 0;\r\n //listener to check / execute when buttons are pressed.\r\n document.addEventListener('DOMContentLoaded', () => {\r\n 'use strict';\r\n\r\n document.addEventListener('keydown', event => {\r\n const key = event.keyCode;\r\n if (key === 37) { //left arrow pressed\r\n if (count < 1) {\r\n this.moveToLeft();\r\n this.leftTurn();\r\n count += 1;\r\n }\r\n }\r\n if (key === 39) { //right arrow pressed\r\n if (count < 1) {\r\n this.moveToRight();\r\n this.rightTurn();\r\n count += 1;\r\n }\r\n }\r\n });\r\n document.addEventListener('keyup', event => {\r\n const key = event.keyCode;\r\n if (key == 37) { //left arrow released\r\n //this.moveToRight();\r\n this.returnFromLeft();\r\n count = 0;\r\n }\r\n\r\n if (key == 39) { //right arrow released\r\n //this.moveToLeft();\r\n this.returnFromRight();\r\n count = 0;\r\n }\r\n });\r\n });\r\n }", "function checkKeyPressUp(e)\r\n{\r\n\tcheckPlayer();\r\n\tif (e.which == 65 || e.keyCode == 65 || e.which == 68 || e.keyCode == 68 || e.which == 83 || e.keyCode == 83 || e.which == 32 || e.keyCode == 32)\r\n\t{\r\n\t\tif(PlayerFace == WALKING_RIGHT)\r\n\t\t{\r\n\t\t\tPLAYER.src = IDLE_RIGHT;\r\n\t\t\trightKey = false;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(PlayerFace == WALKING_LEFT)\r\n\t\t\t{\r\n\t\t\t\tPLAYER.src = IDLE_LEFT;\r\n\t\t\t\tleftKey = false;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(PlayerFace == BLOCKING_LEFT)\r\n\t\t\t\t{\r\n\t\t\t\t\tPLAYER.src = IDLE_LEFT;\r\n\t\t\t\t\tblockKey = false;\r\n\t\t\t\t\t//positionY += 1;\r\n\t\t\t\t\tpositionX -= 1;\r\n\t\t\t\t\tplayerPos();\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(PlayerFace == BLOCKING_RIGHT)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tPLAYER.src = IDLE_RIGHT;\r\n\t\t\t\t\t\tblockKey = false;\r\n\t\t\t\t\t\t//positionY += 1;\r\n\t\t\t\t\t\tpositionX += 5;\r\n\t\t\t\t\t\tplayerPos();\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(PlayerFace == ATTACKING_LEFT)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tPLAYER.src = IDLE_LEFT;\r\n\t\t\t\t\t\t\tpositionX += 41;\r\n\t\t\t\t\t\t\tplayerPos();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(PlayerFace == ATTACKING_RIGHT)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tPLAYER.src = IDLE_RIGHT;\r\n\t\t\t\t\t\t\t\tpositionX += 41;\r\n\t\t\t\t\t\t\t\tplayerPos();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "function canvas_on_keydown(e) {\r\n if(playing && e.code == \"Space\") {\r\n plane.accellerate(-4);\r\n } \r\n \r\n if (!playing && e.code == \"Enter\") {\r\n start_playing();\r\n }\r\n}", "function keyPressed() {\n\n //Ingame\n\n if (keyCode == ESCAPE) {\n gameOver = true;\n }\n if (keyCode == UP_ARROW) {\n console.log(\"up\")\n }\n if (keyCode == DOWN_ARROW) {\n console.log(\"down\")\n }\n if (keyCode == LEFT_ARROW) {\n console.log(\"left\")\n }\n if (keyCode == RIGHT_ARROW) {\n console.log(\"right\")\n }\n\n if (key == ' ') {\n console.log(\"Space\")\n score = 50;\n submitScore();\n }\n\n if (key == 'p') {\n\n }\n\n}", "function KeyDetect(event)\r\n {\r\n var key=event.key; //storing the value in variable.\r\n \r\n Play(key); //Passing the value to Play function();\r\n Ani(key);\r\n }", "function playerOneKeyDownHandler(e) {\n if(e.keyCode == 87) {\n playerOneUpPressed = true;\n }\n else if(e.keyCode == 83) {\n playerOneDownPressed = true;\n }\n}", "function keydown(evt) {\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\n\n switch (keyCode) {\n case \"A\".charCodeAt(0):\n // if(onVertical){\n // player.verticalSpeed = 0;\n // player.verticalSpeed = motionType.NONE;\n // }\n player.motion = motionType.LEFT;\n break;\n\n case \"D\".charCodeAt(0):\n // if(onVertical){\n // player.verticalSpeed = 0;\n // player.verticalSpeed = motionType.NONE;\n // }\n player.motion = motionType.RIGHT;\n break;\n\t\t\t\n\n // Add your code here\n\t\t\n\t\t\t\n case \"W\".charCodeAt(0):\n // if(onVertical){\n // player.verticalSpeed = 0;\n // player.verticalSpeed = motionType.NONE;\n // }\n if (player.isOnPlatform()||onVertical) {\n player.verticalSpeed = JUMP_SPEED;\n }\n break;\n\n case \"H\".charCodeAt(0):\n if (canShoot) shootBullet();\n break;\n\n case \"C\".charCodeAt(0)://cheat mode on\n if(!cheat_mode)\n tempBullet = bulletNum;\n bulletNum = 999999999;\n cheat_mode = 1;\n document.getElementById(\"cheatM\").firstChild.data = \"ON\";\n document.getElementById(\"bull\").firstChild.data = \"INF\";\n \n break;\n\n case \"V\".charCodeAt(0)://exit cheat mode\n if(cheat_mode)\n bulletNum= tempBullet;\n cheat_mode = 0;\n document.getElementById(\"cheatM\").firstChild.data = \"OFF\";\n document.getElementById(\"bull\").firstChild.data = bulletNum;\n \n break;\n\n case \"R\".charCodeAt(0)://reset high score table\n clearHighScoreTable();\n \n break;\n }\n}", "function control (e) {\n if (document.getElementById('pause-button')) {\n if (e.keyCode === 37) {\n moveLeft()\n } else if (e.keyCode === 38) {\n rotate()\n } else if (e.keyCode === 39) {\n moveRight()\n } else if (e.keyCode === 40) {\n moveDown()\n }\n }\n }", "function movement() {\r\n if (cursors.left.isDown) {\r\n player.body.velocity.x = -150;\r\n keyLeftPressed.animations.play(\"leftArrow\");\r\n }\r\n if (cursors.right.isDown) {\r\n player.body.velocity.x = 150;\r\n keyRightPressed.animations.play(\"rightArrow\");\r\n }\r\n\r\n if (player.body.velocity.x > 0) {\r\n player.animations.play(\"right\");\r\n } else if (player.body.velocity.x < 0) {\r\n player.animations.play(\"left\");\r\n } else {\r\n player.animations.play(\"turn\");\r\n }\r\n if (cursors.up.isDown && player.body.onFloor()) {\r\n player.body.velocity.y = -290;\r\n keyUpPressed.animations.play(\"upArrow\");\r\n jumpSound.play();\r\n jumpSound.volume = 0.15;\r\n }\r\n }", "function handle_key_press() {\n if(key_pressed[upcode]) {\n player_one_paddle.move(2);\n }\n\n if(key_pressed[downcode]) {\n player_one_paddle.move(-2);\n }\n\n if(key_pressed[upcode_two]) {\n player_two_paddle.move(2);\n }\n\n if(key_pressed[downcode_two]) {\n player_two_paddle.move(-2);\n }\n}", "function atkGKeyListener()\n{ \n}", "function handleKeys() {\n if (currentlyPressedKeys[33]) {\n // Page Up == koda 33\n positionCubeZ -= 0.05;\n }\n if (currentlyPressedKeys[34]) {\n // Page Down\n positionCubeZ += 0.05;\n }\n if (currentlyPressedKeys[37]) {\n // Left cursor key\n rotationVelocityCubeY -= 1;\n }\n if (currentlyPressedKeys[39]) {\n // Right cursor key\n rotationVelocityCubeY += 1;\n }\n if (currentlyPressedKeys[38]) {\n // Up cursor key\n rotationVelocityCubeX -= 1;\n }\n if (currentlyPressedKeys[40]) {\n // Down cursor key\n rotationVelocityCubeX += 1;\n }\n}", "function keydown_fn(e) {\n if (e.key != 'F12' && e.key != 'F5') e.preventDefault()\n if (e.key === 'ArrowLeft') {\n gameBoard.moveLeftCurrent()\n if (!end) update()\n }\n else if (e.key === 'ArrowRight') {\n gameBoard.moveRightCurrent()\n if (!end) update()\n }\n else if (e.key === 'ArrowDown') {\n gameBoard.moveDownCurrent()\n if (!end) update()\n }\n else if (e.key === 'ArrowUp') {\n gameBoard.swapHeld()\n if (!end) update()\n }\n else if (e.key === ' ') {\n gameBoard.rotateCurrent()\n if (!end) update()\n }\n}", "function keyUpPlayFunction(e){\n switch (e.keyCode) {\n case 39: // right\n case 68: // d\n ghost.changeSpeed(0,ghost.speedY,ghost.speedZ);\n break;\n case 37: // left\n case 81: // q\n ghost.changeSpeed(0,ghost.speedY,ghost.speedZ);\n break;\n case 40: // down\n case 83: // s\n ghost.changeSpeed(ghost.speedX,ghost.speedY,0);\n break;\n case 38: // up\n case 90: // z\n ghost.changeSpeed(ghost.speedX,ghost.speedY,0);\n break;\n }\n}", "function keyPressed() {\n //Player1 keycode and movement\n if (!game.gameOver) {\n if (keyCode === 38 && player1.y >= 25) {\n player1.moveUp();\n } else if (keyCode === 40 && player1.y - 27.5 <= 500) {\n player1.moveDown();\n } else if (keyCode === 37 && player1.x >= 25) {\n player1.moveLeft();\n } else if (keyCode === 39 && player1.x - 25 <= 890) {\n player1.moveRight();\n }\n\n //Player2 keycodes and movement\n if (keyCode === 87 && player2.y >= 25) {\n player2.moveUp();\n } else if (keyCode === 83 && player2.y - 25 <= 500) {\n player2.moveDown();\n } else if (keyCode === 65 && player2.x >= 25) {\n player2.moveLeft();\n } else if (keyCode === 68 && player2.x - 25 <= 900) {\n player2.moveRight();\n }\n } else if (keyCode === 32) {\n preload();\n draw();\n game.reset();\n game.gameOver = false;\n }\n}", "function keyPressed () {\n if (activePiece.x <= 25 && key === 'ArrowLeft') {\n activePiece.boundary();\n }\n if (activePiece.x > 25 && key === 'ArrowLeft') {\n activePiece.shiftLeft();\n }\n if (activePiece.x >= 225 && key === 'ArrowRight') {\n activePiece.boundary();\n }\n if (activePiece.x < 225 && key === 'ArrowRight') {\n activePiece.shiftRight();\n }\n if (key === 'ArrowUp') {\n i++\n }\n if (i > 3) {\n i = 0\n }\n console.log(i + \" \" + key)\n}", "function doKeyDown(e){\n\tlet mapX = data.map[0].length - 1;\n\tlet mapY = data.map.length - 1;\n\t\n\tif (gameRun == false)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\n\t//The W Key -- Up\n\tif ( e.keyCode == 87 ) {\n\t\t// check if context is in suspended state (autoplay policy)\n\t\tif (audio.audioCtx.state == \"suspended\") {\n\t\t\taudio.audioCtx.resume();\n\t\t}\n\t\t// Check if movement valid\n\t\tif (data.player.y - 1 < 1){\n\t\t\toutputWindow.innerHTML = utils.updateUI(\"This is not a valid move\", outputWindow.innerHTML);\n\t\t}\n\t\telse{\n\t\t\tdata.player.y--;\n\t\t\toutputWindow.innerHTML = updateUI(\"Up\", outputWindow.innerHTML);\n\t\t\t// if player moved to open square\n\t\t\tif (data.map[data.player.y][data.player.x] == 0) data.map[data.player.y][data.player.x] = 1;\n\t\t\t// if not, check where moved\n\t\t\telse{\n\t\t\t\toutputWindow.innerHTML = checkCurrent(data.map, data.player, outputWindow.innerHTML);\n\t\t\t\tif (gameRun == false){\n\t\t\t\t\tconsole.log(\"END\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t// update map\n\t\t\tutils.drawGrid(ctx, data.map, data.player);\n\t\t\t\n\t\t\t// check proximity to user\n\t\t\tif (utils.getProximity(data.map, data.player).length != 0){\n\t\t\t\toutputWindow.innerHTML = utils.updateUI(utils.checkProximity(utils.getProximity(data.map, data.player)), outputWindow.innerHTML);\n\t\t\t}\n\t\t}\n\t}\n\t\n\t//The S Key -- Down\n\tif ( e.keyCode == 83 ) {\n\t\t// check if context is in suspended state (autoplay policy)\n\t\tif (audio.audioCtx.state == \"suspended\") {\n\t\t\taudio.audioCtx.resume();\n\t\t}\n\t\t// Check if movement valid\n\t\tif (data.player.y + 1 >= mapY){\n\t\t\toutputWindow.innerHTML = utils.updateUI(\"This is not a valid move\", outputWindow.innerHTML);\n\t\t}\n\t\telse{\n\t\t\tdata.player.y++;\n\t\t\toutputWindow.innerHTML = updateUI(\"Down\", outputWindow.innerHTML);\n\t\t\t// if player moved to open square\n\t\t\tif (data.map[data.player.y][data.player.x] == 0) data.map[data.player.y][data.player.x] = 1;\n\t\t\t// if not, check where moved\n\t\t\telse{\n\t\t\t\toutputWindow.innerHTML = checkCurrent(data.map, data.player, outputWindow.innerHTML);\n\t\t\t\tif (gameRun == false){\n\t\t\t\t\tconsole.log(\"END\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t// update map\n\t\t\tutils.drawGrid(ctx, data.map, data.player);\n\t\t\t\n\t\t\t// check proximity to user\n\t\t\tif (utils.getProximity(data.map, data.player).length != 0){\n\t\t\t\toutputWindow.innerHTML = utils.updateUI(utils.checkProximity(utils.getProximity(data.map, data.player)), outputWindow.innerHTML);\n\t\t\t}\n\t\t}\n\t}\n\t\n\t//The A Key -- Left\n\tif ( e.keyCode == 65 ) {\n\t\t// check if context is in suspended state (autoplay policy)\n\t\tif (audio.audioCtx.state == \"suspended\") {\n\t\t\taudio.audioCtx.resume();\n\t\t}\n\t\t// Check if movement valid\n\t\tif (data.player.x - 1 < 1){\n\t\t\toutputWindow.innerHTML = utils.updateUI(\"This is not a valid move\", outputWindow.innerHTML);\n\t\t}\n\t\telse{\n\t\t\tdata.player.x--;\n\t\t\toutputWindow.innerHTML = updateUI(\"Left\", outputWindow.innerHTML);\n\t\t\t// if player moved to open square\n\t\t\tif (data.map[data.player.y][data.player.x] == 0) data.map[data.player.y][data.player.x] = 1;\n\t\t\t// if not, check where moved\n\t\t\telse{\n\t\t\t\toutputWindow.innerHTML = checkCurrent(data.map, data.player, outputWindow.innerHTML);\n\t\t\t\tif (gameRun == false){\n\t\t\t\t\tconsole.log(\"END\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t// update map\n\t\t\tutils.drawGrid(ctx, data.map, data.player);\n\t\t\t\n\t\t\t// check proximity to user\n\t\t\tif (utils.getProximity(data.map, data.player).length != 0){\n\t\t\t\toutputWindow.innerHTML = utils.updateUI(utils.checkProximity(utils.getProximity(data.map, data.player)), outputWindow.innerHTML);\n\t\t\t}\n\t\t}\n\t\t\n\t}\n\t\n\t//The D Key -- Right\n\tif ( e.keyCode == 68 ) {\n\t\t// check if context is in suspended state (autoplay policy)\n\t\tif (audio.audioCtx.state == \"suspended\") {\n\t\t\taudio.audioCtx.resume();\n\t\t}\n\t\t// Check if movement valid\n\t\tif (data.player.x + 1 >= mapX){\n\t\t\toutputWindow.innerHTML = utils.updateUI(\"This is not a valid move\", outputWindow.innerHTML);\n\t\t}\n\t\telse{\n\t\t\tdata.player.x++;\n\t\t\toutputWindow.innerHTML = updateUI(\"Right\", outputWindow.innerHTML);\n\t\t\t// if player moved to open square\n\t\t\tif (data.map[data.player.y][data.player.x] == 0) data.map[data.player.y][data.player.x] = 1;\n\t\t\t// if not, check where moved\n\t\t\telse{\n\t\t\t\toutputWindow.innerHTML = checkCurrent(data.map, data.player, outputWindow.innerHTML);\n\t\t\t\tif (gameRun == false){\n\t\t\t\t\tconsole.log(\"END\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t// update map\n\t\t\tutils.drawGrid(ctx, data.map, data.player);\n\t\t\t\n\t\t\t// check proximity to user\n\t\t\tif (utils.getProximity(data.map, data.player).length != 0){\n\t\t\t\toutputWindow.innerHTML = utils.updateUI(utils.checkProximity(utils.getProximity(data.map, data.player)), outputWindow.innerHTML);\n\t\t\t}\n\t\t}\n\t}\n}", "function keyPressed(e) {\n if (e.keyCode == 90) {\n controlBlock.ascend = true;\n } else if (e.keyCode == 83) {\n controlBlock.descend = true;\n }\n\n if (e.keyCode == 38) {\n opponentBlock.ascend = true;\n } else if (e.keyCode == 40) {\n opponentBlock.descend = true;\n }\n}", "function getKey(event){\n\n var char = event.which || event.keyCode;\n var letter = String.fromCharCode(char);\n\n if(letter == \"w\"){\n up(squid[player]);\n movement = \"up\";\n }\n if (letter == \"s\"){\n down(squid[player]);\n movement = \"down\";\n }\n if (letter == \"a\"){\n left(squid[player]);\n movement = \"left\"\n }\n if (letter == \"d\"){\n right(squid[player]);\n movement = \"right\"\n }\n\n // Manually Switch which object is the \"player\"\n /* if (letter == \"n\"){\n player += 1;\n if (player >= squid.length){\n player = 0;\n }\n }*/\n\n }", "function keydown(evt) {\n var keyCode = (evt.keyCode)? evt.keyCode : evt.getKeyCode();\n\n switch (keyCode) {\n case \"N\".charCodeAt(0):\n player.motion = motionType.LEFT;\n break;\n\n case \"M\".charCodeAt(0):\n player.motion = motionType.RIGHT;\n break;\n\t\t\t\n\n // Add your code here\n\t\t\n\t\t\t\n case \"Z\".charCodeAt(0):\n if (player.isOnPlatform()) {\n player.verticalSpeed = JUMP_SPEED;\n }\n break;\n\t\t\n\t\tcase 32: // spacebar = shoot\n\t\t\tif (canShoot) shootBullet();\n\t\t\tbreak;\n }\n}", "function keyPressed() {\n if (key === \"p\" || key === \"P\") pong.pauseRound();\n if (key === \" \" && !pong.isStarted) pong.newRound();\n}", "function startRace() {\n $(window).on('keydown', function moveRight(event) {\n if (event.keyCode === pinkPlayer.keyButton) {\n pinkPlayer.drive();\n } else if(event.keyCode === greenPlayer.keyButton){\n greenPlayer.drive();\n }\n });\n }", "function onKeyDown(event) {\n\n // console.log(event);\n\n switch (event.key) {\n\n case \"ArrowLeft\":\n moveLeft = true;\n break;\n case \"ArrowRight\":\n moveRight = true;\n break;\n \n default:\n break;\n\n }\n\n}", "function keyPressed() {\n // toggle fullscreen mode\n if( key === 'f') {\n fs = fullscreen();\n fullscreen(!fs);\n return;\n } \n\n adventureManager.keyPressed(key); \n}", "function keyDown(e) {\n\t// this is the player movement (WASD)\n\tif (e.keyCode == 68) rightKey = true;\n\telse if (e.keyCode == 65) leftKey = true;\n\telse if (e.keyCode == 87) upKey = true;\n\telse if (e.keyCode == 83) downKey = true;\n\t//fire lasers if you have some ammo (SPACE)\n\tif (e.keyCode == 32 && lasers.length <= laserTotal){\n\t\tcreateLaser();\n\t}\n\t//pause menu\n\t// if the player presses \"p\" and the game ISNT paused, pause it\n\t// if the player presses \"p\" and the game IS paused, un pause it\n\t// this is a basic toggle used in my code and will be repeated\n\tif (e.keyCode == 80 && pause === false){\n\t\t// all game states are used in the toggle to allow the player to pause during an game state\n\t\talive = false;\n\t\tpause = true;\n\t\tgameover = false;\n\t\tmenu = false;\n\t\tendScore = false;\n\t\toptions = false;\n\t}else if (e.keyCode == 80 && pause === true){\n\t\t// this is a logic error\n\t\t// if the player constantly un-pauses and pauses the game they are able to continue after death\n\t\t// and keep playing, basically cheating...\n\t\talive = true;\n\t\tpause = false;\n\t\tgameover = false;\n\t\tmenu = false;\n\t\tendScore = false;\n\t\toptions = false;\n\t}\n\t//resart game when \"r\" is pressed\n\telse if (e.keyCode == 82) restart();\n\t//goto menu when \"m\" is pressed\n\telse if (e.keyCode == 77){\n\t\tmenuscreen();\n\t\t// again all variables are used so you can change the state at any point in the game\n\t\talive = false;\n\t\tpause = false;\n\t\tgameover = false;\n\t\tmenu = true;\n\t\tendScore = false;\n\t\toptions = false;\n\t}\n\t//gameover continue button\n\t// when the game over is displayed and the player presses \"enter\" button, move to the next state\n\telse if (e.keyCode == 13 && gameover === true){ \n\t\talive = false;\n\t\tpause = false;\n\t\tgameover = false;\n\t\tmenu = false;\n\t\tendScore = true;\n\t\toptions = false;\n\t}\n\t//score continue button\n\t// same as the game over continue, this allow the player to move to the next state\n\telse if (e.keyCode == 13 && endScore === true){\n\t\talive = false;\n\t\tpause = false;\n\t\tgameover = false;\n\t\tmenu = true;\n\t\tendScore = false;\n\t\toptions = false;\n\t}\n\t//menu continue button\n\t// when the player presses \"enter\" at the menu\n\t// start the game\n\telse if (e.keyCode == 13 && menu === true){\n\t\trestart();\n\t}\n\t//options menu button\n\t// this is a toggle like the pause menu that activates whe nthe player presse \"o\"\n\telse if (e.keyCode == 79 && options === false){\n\t\talive = false;\n\t\tpause = false;\n\t\tgameover = false;\n\t\tmenu = false;\n\t\tendScore = false;\n\t\toptions = true;\n\t// toggle back and go to the menu\n\t}else if (e.keyCode == 79 && options === true){\n\t\talive = false;\n\t\tpause = false;\n\t\tgameover = false;\n\t\tmenu = true;\n\t\tendScore = false;\n\t\toptions = false;\n\t}\n\t//options in options menu\n //------------------------------------------------------------------------------------------------\n\t// if the player is in the options menu and presses \"1\", open an input box to change the variable\n\t// of the asteroid spawn rate min and max\n\telse if (e.keyCode == 49 && options === true){\n\t\t//Asteroid spawn rate Max\n\t\t// display the input popup\n\t\ttimeBetweenAstsEdit = window.prompt(\"Enter Max Asteroid Spawn Rate(Milliseconds):\",\"2000\");\n\t\t// if the input is greater than the max, set it to the max\n\t\tif(timeBetweenAstsEdit >= 10000){\n\t\t\ttimeBetweenAstsEdit = 10000;\n\t\t\t // use the buffer variables to check if the input is valid\n \ttimeBetweenAst = parseInt(timeBetweenAstsEdit);\n\t\t\n\t\t// if the input is less than the minimum, set it to the minimum\n\t\t}else if(timeBetweenAstsEdit <= 250){\n\t\t\ttimeBetweenAstsEdit = 250;\n\t\t\t // use the buffer variable to check if new input is valid\n \ttimeBetweenAst = parseInt(timeBetweenAstsEdit);\t\t\n \t}else{\n \t // if everything entered is valid, update the variables\n \ttimeBetweenAst = parseInt(timeBetweenAstsEdit);\n \t}\n\t\t\n\t\t//Asteroid spawn rate Min\n\t\t// this is used to stoip the game getting infinitley harder over time but the player can change this\n\t\tminTimeBetweenAstsEdit = window.prompt(\"Enter Min Asteroid Spawn Rate(Milliseconds):\",\"250\");\n\t\tminTimeBetweenAsts = parseInt(minTimeBetweenAstsEdit);\n //------------------------------------------------------------------------------------------------\t\n // option 2\n // if the player presse \"2\", display a popup to set that asteroid speed\n\t}else if (e.keyCode == 50 && options === true){\n\t\t//Asteroid Speed\n\t\tasteroidSpeedEdit = window.prompt(\"Enter Asteroid Speed(1-5):\",\"1\");\n\t\t// if the asteroid speed is greater than the max speed, set it to the max speed\n\t\tif(asteroidSpeedEdit >= 5){\n\t\t\tasteroidSpeedEdit = 5;\n\t\t\t// parse the updated speed to the game\n\t\t\tasteroidSpeed = parseInt(asteroidSpeedEdit);\n\t\t// if the input is less than the min, set it to the min\n\t\t}else if(asteroidSpeedEdit <= 1){\n\t\t\tasteroidSpeedEdit = 1;\n\t\t\t// parse the new variables\n\t\t\tasteroidSpeed = parseInt(asteroidSpeedEdit);\n\t\t}else{\n\t\t // otherwise just update the variable with the new input\n\t\t\tasteroidSpeed = parseInt(asteroidSpeedEdit);\n\t\t}\n //------------------------------------------------------------------------------------------------\n\t\n\t//option 3\n\t// if the player presses \"3\", open an input box\n\t}else if (e.keyCode == 51 && options === true){\n\t\t//Laser Amount\n\t\t// this is used for difficulty, this sets the maxmimum amount of lasers that the player can shoot at any time\n\t\tlaserTotalEdit = window.prompt(\"Enter the amount of max lasers on the screen(6-20):\",\"6\");\n\t\t// if the input is grayer than the max, set it to the max\n\t\tif(laserTotalEdit >= 20){\n\t\t\tlaserTotalEdit = 20;\n\t\t\t// update the variables\n\t\t\tlaserTotal = parseInt(laserTotalEdit);\n\t\t// if the input is smaller than the min, set it to the min\n\t\t}else if(laserTotalEdit <= 6){\n\t\t\tlaserTotalEdit = 6;\n\t\t\t// update the variables\n\t\t\tlaserTotal = parseInt(laserTotalEdit);\n\t\t}else{\n\t\t // if everything is corerect, update the variables\n\t\t\tlaserTotal = parseInt(laserTotalEdit);\n\t\t}\n\t}\n\t//------------------------------------------------------------------------------------------------\n\t\n\t//autofire\n\t// this is another toggle used for whne the player presses \"z\" and they have unlocked the powerup\n\t// if they try to use this without the powerup unlocked it wil not run\n\telse if (e.keyCode == 90 && autofireUnlocked === true && autofire === false){\n\t\tautofire = true;\n\t}else if (e.keyCode == 90 && autofire === true){\n\t\tautofire = false;\n\t}\n\n}", "function keyPressed() {\n\n\t//Set a condition if keyCode is equal to LEFT_ARROW\n\tif (keyCode === LEFT_ARROW) {\n\n\t\t//Set helicopterSprite'x X position as 20 steps to left each time\n\t\thelicopterSprite.x = helicopterSprite.x - 20\n\n\t\t//Set packageSprite's Y position equal to helicopterSprite's Y position\n\t\tpackageSprite.y = helicopterSprite.y\n\n\t}\n\n\t//Set a condition if keyCode is equal to RIGHT_ARROW\n\tif (keyCode === RIGHT_ARROW) {\n\n\t\t//Set helicopterSprite'x X position as 20 steps to right each time\t\n\t\thelicopterSprite.x = helicopterSprite.x + 20\n\n\t\t//Set packageSprite's Y position equal to helicopterSprite's Y position\t\n\t\tpackageSprite.y = helicopterSprite.y\n\t}\n\n\t//Set a condition if keyCode is equal to RIGHT_ARROW\n\tif (keyCode === DOWN_ARROW) {\n\n\t\t//Set static of packageBody as false so that to fall the packageSprite as down arrow key is pressed.\n\t\tMatter.Body.setStatic(packageBody, false);\n\n\t}\n\n}", "function keyup_handler(event)\n{\n\tgame.handle_key(event.code, false);\n}", "function keyPressed(){\n if (state === `simulation`) {\n ant.keyPressed();\n ant.move();\n }\n}", "setupKeyControls() {\n var that = this;\n document.onkeydown = function (e) {\n switch (e.keyCode) {\n case 37: // Tecla izquierda\n case 65: // tecla a\n if (that.interfaceData.animate) {\n that.game.turnLeft();\n }\n break;\n case 39: // Tecla derecha\n case 68: // Tecla d\n if (that.interfaceData.animate) {\n that.game.turnRight();\n }\n break;\n case 72: //Tecla H - Help\n that.toggleHelp();\n break;\n case 67: //Letra C\n that.toggleView();\n break;\n case 80: //Letra P\n that.toggleAnimation();\n break;\n case 86: //Letra V\n console.log(\"Imprimir variables de control: \", this);\n break;\n }\n };\n }", "handleInput(key) {\n // update the player position: reached top of the grid, stays within the gird, collision status\n audio.src = 'sounds/step.wav';\n switch(key) {\n case 'left':\n if (this.x > 0) {\n this.x -= this.horizontal;\n audio.play();\n }\n break;\n case 'up':\n if (this.y > this.vertical) {\n this.y -= this.vertical;\n audio.play();\n }\n break;\n case 'right':\n if (this.x < (this.horizontal * 4)) {\n this.x += this.horizontal;\n audio.play();\n }\n break;\n case 'down':\n if (this.y < this.vertical * 4) {\n this.y += this.vertical;\n audio.play();\n }\n break;\n }\n }", "function handleKey(event) {\r\n\r\n\tvar i = gGamerPos.i;\r\n\tvar j = gGamerPos.j;\r\n\tconsole.log('ev', event);\r\n\r\n\tswitch (event.key) {\r\n\t\tcase 'ArrowLeft':\r\n\t\t\tif (i === 5 && j === 0) moveTo(5, 9)\r\n\t\t\telse moveTo(i, j - 1);\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowRight':\r\n\t\t\tif (i === 5 && j === 11) moveTo(5, 0)\r\n\t\t\telse moveTo(i, j + 1);\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowUp':\r\n\t\t\tif (i === 0 && j === 5) moveTo(9, 5)\r\n\t\t\telse moveTo(i - 1, j);\r\n\t\t\tbreak;\r\n\t\tcase 'ArrowDown':\r\n\t\t\tif (i === 9 && j === 5) moveTo(0, 5)\r\n\t\t\telse moveTo(i + 1, j);\r\n\t\t\tbreak;\r\n\t}\r\n\r\n}", "function keyPressed() {\n\t//Applying force to paper body when different Arrow keys are pressed and sprite's x position is 400.\n\tif(keyCode === UP_ARROW && sprite.x === 400) {\n\t\tMatter.Body.applyForce(paper.body,paper.body.position,{x:0,y:-50});\n\t\tjump.play();\n\t}\n\tif(keyCode === DOWN_ARROW && sprite.x === 400) {\n\t\tMatter.Body.applyForce(paper.body,paper.body.position,{x:0,y:50});\n\t\tjump.play();\n\t}\n\tif(keyCode === LEFT_ARROW && sprite.x === 400) {\n\t\tMatter.Body.applyForce(paper.body,paper.body.position,{x:-50,y:0});\n\t\tjump.play();\n\t}\n\tif(keyCode === RIGHT_ARROW && sprite.x === 400) {\n\t\tMatter.Body.applyForce(paper.body,paper.body.position,{x:50,y:0});\n\t\tjump.play();\n\t}\n}", "function handleKey(){\n if(keyIsDown(LEFT_ARROW)){\n if(stealer.canMoveLeft()){\n stealer.moveLeft();\n display(robberWalkImg, stealer.size2 + 10, stealer.size);\n } else {\n moveBgRight();\n display(robberWalkImg, stealer.size2 + 10, stealer.size);\n }\n }\n\n else if (keyIsDown(RIGHT_ARROW)){\n if(stealer.canMoveRight()){\n stealer.moveRight();\n display(robberWalkImg, stealer.size2 + 10, stealer.size);\n }\n else {\n moveBgLeft();\n display(robberWalkImg, stealer.size2 + 10, stealer.size);\n }\n }\n else {\n display(robberStandImg, stealer.size2, stealer.size);\n }\n}", "function handleKey(event) {\n\n\tvar i = gGamerPos.i;\n\tvar j = gGamerPos.j;\n\n\n\tswitch (event.key) {\n\t\tcase 'ArrowLeft':\n\t\t\tif (j === 0) moveTo(i, gBoard[0].length - 1);\n\t\t\telse moveTo(i, j - 1);\n\t\t\tbreak;\n\t\tcase 'ArrowRight':\n\t\t\tif (j === gBoard[0].length - 1) moveTo(i, 0);\n\t\t\telse moveTo(i, j + 1);\n\t\t\tbreak;\n\t\tcase 'ArrowUp':\n\t\t\tif (i === 0) moveTo(gBoard.length - 1, j);\n\t\t\telse moveTo(i - 1, j);\n\t\t\tbreak;\n\t\tcase 'ArrowDown':\n\t\t\tif (i === gBoard.length - 1) moveTo(0, j);\n\t\t\telse moveTo(i + 1, j);\n\t\t\tbreak;\n\n\t}\n\n}", "handleKeyPress(e) {\n if((this.gameOver() === 'won') || (this.gameOver() === 'loose')) {\n if (e.key === ' ') {\n this.restartGame();\n }\n } \n else {\n if ((e.keyCode >= 65) && (e.keyCode <= 90)) {\n this.handleKeyClick(e.key.toUpperCase());\n }\n }\n }", "function control(e) {\n\n // Remove class from squares\n squares[currentIndex].classList.remove('snake');\n\n // Check for movement key input\n if (e.keyCode === 39) {\n\n // Pressing the right arrow\n direction = 1;\n\n } else if (e.keyCode === 38) {\n\n // Pressing the up arrow\n direction = -width;\n\n } else if (e.keyCode === 37) {\n\n // Pressing the left arrow\n direction = -1;\n\n } else if (e.keyCode === 40) {\n\n // Pressing the down arrow\n direction = +width;\n }\n }", "function handleKey(event) {\n\n\tvar i = gGamerPos.i;\n\tvar j = gGamerPos.j;\n\n\n\tswitch (event.key) {\n\t\tcase 'ArrowLeft':\n\t\t\tmoveTo(i, j - 1);\n\t\t\tbreak;\n\t\tcase 'ArrowRight':\n\t\t\tmoveTo(i, j + 1);\n\t\t\tbreak;\n\t\tcase 'ArrowUp':\n\t\t\tmoveTo(i - 1, j);\n\t\t\tbreak;\n\t\tcase 'ArrowDown':\n\t\t\tmoveTo(i + 1, j);\n\t\t\tbreak;\n\n\t}\n\n}", "handleInput(keycode) {\n if (keycode !== undefined && player.moves === true) {\n key = keycode;\n }\n }", "function keyPressed() {\n if(keyCode === UP_ARROW && snake.xspeed !== 0) {\n snake.dir(0, -1);\n }\n else if(keyCode === DOWN_ARROW && snake.xspeed !== 0){\n snake.dir(0, 1);\n }\n else if(keyCode === RIGHT_ARROW && snake.yspeed !== 0){\n snake.dir(1, 0);\n }\n else if(keyCode === LEFT_ARROW && snake.yspeed !== 0){\n snake.dir(-1, 0);\n }\n}" ]
[ "0.8098633", "0.7753985", "0.77434087", "0.7593963", "0.75272375", "0.74864584", "0.7401027", "0.7370474", "0.7364861", "0.7364486", "0.7319837", "0.73161626", "0.7293669", "0.7289943", "0.7274823", "0.726557", "0.7264979", "0.7251032", "0.7239211", "0.7236777", "0.72364175", "0.7236031", "0.723567", "0.7229688", "0.7227959", "0.7226446", "0.72103554", "0.7203772", "0.7185669", "0.71701425", "0.7161078", "0.71603346", "0.715893", "0.715893", "0.7154549", "0.7127386", "0.7124448", "0.71240443", "0.7115625", "0.71101075", "0.71043086", "0.70857567", "0.70790416", "0.7075028", "0.7073109", "0.70694673", "0.7066539", "0.7064198", "0.70632064", "0.7060163", "0.70586854", "0.70446014", "0.7037369", "0.7036656", "0.70122313", "0.7009812", "0.70094705", "0.7007907", "0.7001572", "0.69989043", "0.69931597", "0.6992447", "0.6985567", "0.69796604", "0.69784665", "0.69675636", "0.6967476", "0.69643444", "0.69616336", "0.6959426", "0.6956226", "0.6952657", "0.695194", "0.6951648", "0.6940416", "0.6939414", "0.6937756", "0.6932767", "0.69306636", "0.6929058", "0.6927307", "0.6918087", "0.6911514", "0.6910366", "0.6908657", "0.6897079", "0.6896157", "0.68905807", "0.6888613", "0.6887611", "0.68843234", "0.6881178", "0.6867919", "0.68647736", "0.68618363", "0.6853512", "0.68512726", "0.68509364", "0.684134", "0.6840137" ]
0.7140463
35
hacemos que caiga / Objeto Pieza y funciones
function Pieza(tetromino, color) { this.tetromino = tetromino; this.tetrominoN = 0; this.activeTetromino = this.tetromino[this.tetrominoN]; this.color = color; this.x = 3; this.y = -2; /* Coordenadas del cuadradro */ for (let r = 0; r < this.activeTetromino.length; r++) { for (let c = 0; c < this.activeTetromino.length; c++) { if (this.activeTetromino[r][c] == 1) { dibujarCuadrado(this.x + c,this.y + r, this.color); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(nombreObjeto, apellido,altura){\n //Atributos\n this.nombre = nombreObjeto\n this.apellido = apellido\n this.altura = altura\n }", "function heredaDe(prototipoHijo, prototipoPadre) { // Esta es una funcion que recibe funciones\n var fn = function () {} // Creamos una funcion vacia\n fn.prototype = prototipoPadre.prototype // Hacemos una copia del prototipo del Padre para guardarlo en el protitipo de nuestra funcion vacia\n prototipoHijo.prototype = new fn // De esa forma evitamos acceder directamente a la funcion y no la pizamos\n prototipoHijo.prototype.constructor = prototipoHijo //Asignamos la funcion constructora\n //Si no agregamos la ultima linea se estaria llamando al constructor de prototipo padre\n}", "auxiliarPredicado(tipo, nombre, valor, objeto) {\n //Verificamos si lo que se buscó en el predicado es un atributo o etiqueta\n if (tipo == \"atributo\") {\n //Recorremos los atributos del objecto en cuestion\n for (let att of objeto.atributos) {\n //Si los nombres de atributos son iguales\n if (att.dameNombre() == nombre) {\n //Si los valores de los atributos son iguales al valor ingresado en el predicado\n if (att.dameValor() == valor) {\n //Guardamos el elemento que contiene el atributo\n this.consolaSalidaXPATH.push(objeto);\n //Esta linea de codigo para para verificar el nuevo punto de inicio de la consola final, para no redundar\n if (!this.controladorPredicadoInicio) {\n this.contadorConsola = this.consolaSalidaXPATH.length - 1;\n this.controladorPredicadoInicio = true;\n }\n } //Cierre comparacion valor\n } //Cierre comparacion nombre\n } //Cierre for para recorrer atributos\n for (let entry of objeto.hijos) {\n for (let att of entry.atributos) {\n //Si los nombres de atributos son iguales\n if (att.dameNombre() == nombre) {\n //Si los valores de los atributos son iguales al valor ingresado en el predicado\n if (att.dameValor() == valor) {\n //Guardamos el elemento que contiene el atributo\n this.consolaSalidaXPATH.push(objeto);\n //Esta linea de codigo para para verificar el nuevo punto de inicio de la consola final, para no redundar\n if (!this.controladorPredicadoInicio) {\n this.contadorConsola = this.consolaSalidaXPATH.length - 1;\n this.controladorPredicadoInicio = true;\n }\n } //Cierre comparacion valor\n } //Cierre comparacion nombre\n } //Ci\n }\n }\n else {\n //Si lo que se busca es una etiqueta en el predicado\n for (let entry of objeto.hijos) {\n //Recorremos cada uno de los hijos y verificamos el nombre de la etiqueta\n if (entry.dameID() == nombre) {\n //Sí hay concidencia, se procede a examinar si el valor es el buscado\n if (entry.dameValor().substring(1) == valor) {\n //Agregamos el objeto a la consola de salida\n this.consolaSalidaXPATH.push(objeto);\n //Al iguar que n fragmento anteriores, se establece el nuevo punto de inicio\n if (!this.controladorPredicadoInicio) {\n this.contadorConsola = this.consolaSalidaXPATH.length - 1;\n this.controladorPredicadoInicio = true;\n } //cierreControladorInicio\n } //CIERRE VALOR\n } //CIERREID\n } //CIERRE RECORRIDO DE HIJOS\n }\n //La siguiente linea comentada es para recursividad, pendiente de uso.\n }", "efficacitePompes(){\n\n }", "function dibujarFresado118(modelo,di,pos,document){\n\t\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4, pliegueInf5]\n\tEAction.handleUserMessage(\"ha entrado 11111111111111111 \");\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (n=0;n<5;n=n+1){ \n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n\t\t}\n\t}\n\t\n\t\n\t\n\t//Puntos trayectoria \n\t\n\t\n\tvar fresado11 = new RVector(pos.x-anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x-anchura1-anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x-anchura1-anchura2-anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4,pos.y+alaInferior+pliegueInferior)\n\tvar fresado15 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior) //nuevo\n\t\n\t\n\t\n\tvar fresado16 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior) \n\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x-anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x-anchura1-anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x-anchura1-anchura2-anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado22 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca) //muevo\n\t\n\tvar fresado23 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\t\n\t\n\t\n\tif (anchura5>pliegueInf5){ \n\t\tvar fresado14b = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior-pliegueInf5-alaInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado14b , fresado23 ));\n\t\top_fresado.addObject(line,false);\n\n\t}else{\n\t\tvar line = new RLineEntity(document, new RLineData( fresado15 , fresado23 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado16 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado15 , fresado22 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado13 , fresado20 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado12 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado22 ));\n\t\top_fresado.addObject(line,false);\n\n\t\n\t\n\t\n\tEAction.handleUserMessage(\"ha entrado 44444444444444444444444444 \");\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1){\n\t\t//var fresado10 = new RVector(pos.x,pos.y+pliegueInferior+alaInferior) \n\t\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t//var fresado2 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x-anchura1+pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado10,fresado1)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado2,fresado11)\n\t}\n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)){ \n\t\tvar fresado4 = new RVector(pos.x-anchura1-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x-anchura1-anchura2+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t\top_fresado.addObject(line,false);\n\n\t}\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3*2)){ \n\t\tvar fresado6 = new RVector(pos.x-anchura1-anchura2-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x-anchura1-anchura2-anchura3+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t} \n\t\n\t//anchura4 - Inferior\n\tif (anchura4>(pliegueInf4*2)){ \n\t\tvar fresado8 = new RVector(pos.x-anchura1-anchura2-anchura3-pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado9 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t} \n\n\t//anchura4 - Inferior\n\tif (anchura5>pliegueInf5){ \n\t\tvar fresado10 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-pliegueInf5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n\t\tvar fresado11 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado11 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t} \n\t\n\t\n\t\n\n\tEAction.handleUserMessage(\"ha entrado 555555555555555555555555555555555555555555555555 \");\n\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)){ \n\t\tvar fresado25 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x-anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado27 = new RVector(pos.x-anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x-anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)){ \n\t\tvar fresado31 = new RVector(pos.x-anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x-anchura1-anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado29 = new RVector(pos.x-anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x-anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado33 = new RVector(pos.x-anchura1-anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x-anchura1-anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado37 = new RVector(pos.x-anchura1-anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x-anchura1-anchura2-anchura3+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado35 = new RVector(pos.x-anchura1-anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x-anchura1-anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado39 = new RVector(pos.x-anchura1-anchura2-anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x-anchura1-anchura2-anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior*2){ \n\t\tvar fresado43 = new RVector(pos.x-anchura1-anchura2-anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado41 = new RVector(pos.x-anchura1-anchura2-anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x-anchura1-anchura2-anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado45 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado46 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado45 , fresado46 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura5 - Superior\n\tif (anchura5>pliegueSuperior){ \n\t\tvar fresado49 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado50 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado49 , fresado50 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado47 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado48 = new RVector(pos.x-anchura1-anchura2-anchura3-anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado47 , fresado48 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\treturn op_fresado;\n\t\n\t\n\t\n\t\n\t\n}", "function dibujarFresado117(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tEAction.handleUserMessage(\"ha entrado 11111111111111111 \");\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3]\n\t\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (var n=0; n<4 ;n=n+1){\n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n }\n }\n\t\n\t\n\t\n\t//Puntos trayectoria \n\t\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\t\n\tvar fresado16 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior) \n\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado22 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\t\n\tvar fresado2 = new RVector(pos.x+alaIzquierda,pos.y)\n\t\n var line = new RLineEntity(document, new RLineData( fresado16 , fresado14 ));\n\top_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado12 , fresado19 ));\n\top_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado18 , fresado11 ));\n\top_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado17 , fresado21 ));\n\top_fresado.addObject(line,false);\n\n\t\n\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1){\n\t\t//var fresado10 = new RVector(pos.x+alaIzquierda,pos.y+pliegueInferior+alaInferior) \n\t\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t//var fresado2 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchura1-pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado10,fresado1)\n var line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t op_fresado.addObject(line,false);\n\n\t\t//dibujarFresado_auxiliar(doc,fresado2,fresado11)\n }\n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)){\n\t\tvar fresado4 = new RVector(pos.x+alaIzquierda+anchura1+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n var line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t op_fresado.addObject(line,false);\n\n }\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3)){\n\t\tvar fresado6 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueDer,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n var line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t op_fresado.addObject(line,false);\n\n }\n\t\n\t\n\t\n\t\n\t\n\t//Puntos extra para esta pieza\n\tvar fresado7 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueDer,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\tvar fresado8 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueDer,pos.y+alaInferior+pliegueInferior-pliegueDer)\n var line = new RLineEntity(document, new RLineData( fresado7 , fresado8 ));\n\top_fresado.addObject(line,false);\n\n\t\n\tvar fresado9 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueDer,pos.y+alaInferior+pliegueInferior+pliegueDer)\n\tvar fresado10 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueDer,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n var line = new RLineEntity(document, new RLineData( fresado9 , fresado10 ));\n\top_fresado.addObject(line,false);\n\t\n\n var line = new RLineEntity(document, new RLineData( fresado21 , fresado10 ));\n\top_fresado.addObject(line,false);\n\t\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior)\n var line = new RLineEntity(document, new RLineData( fresado20 , fresado11 ));\n\top_fresado.addObject(line,false);\n\n\t\n\t\n\t\n\t\n\t\n\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)){\n\t\tvar fresado25 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)){\n\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\tvar fresado33 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }\n }\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado37 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado35 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado39 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }\n }\n\t\n\t\n\tvar fresado2 = new RVector(pos.x+alaIzquierda,pos.y)\n\tvar fresado25 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado2 , fresado25 ));\n\top_fresado.addObject(line,false);\n\t\n\t\n\t\n\t\n\n\treturn op_fresado; \n}", "function Copcar(){}", "function coherencia(objeto){\n // extrae las variables nesesarias para la evaluacion\n var estructura= objeto.structure;\n var nivelagregacion=objeto.aggregationlevel;\n var tipointeractividad=objeto.interactivitytype; \n var nivelinteractivo=objeto.interactivitylevel;\n var tiporecursoeducativo=objeto.learningresourcetype;\n \n //inicializa las reglas y las variables de los pesos\n var r=0;\n var pesor1=0;\n var pesor2=0;\n var pesor3=0;\n\n //verifica las reglas que se van a evaluar\n if (estructura===\"atomic\" && nivelagregacion===\"1\"){\n r++;\n pesor1=1;\n }else if (estructura===\"atomic\" && nivelagregacion===\"2\"){\n r++;\n pesor1=0.5;\n }else if (estructura===\"atomic\" && nivelagregacion===\"3\"){\n r++;\n pesor1=0.25;\n }else if (estructura===\"atomic\" && nivelagregacion===\"4\"){\n r++;\n pesor1=0.125;\n }else if (estructura===\"collection\" && nivelagregacion===\"1\"){\n r++;\n pesor1=0.5;\n }else if (estructura===\"networked\" && nivelagregacion===\"1\"){\n r++;\n pesor1=0.5; \n }else if (estructura===\"hierarchical\" && nivelagregacion===\"1\"){\n r++;\n pesor1=0.5; \n }else if (estructura===\"linear\" && nivelagregacion===\"1\"){\n r++;\n pesor1=0.5; \n }else if (estructura===\"collection\" && (nivelagregacion===\"2\" || \n nivelagregacion===\"3\" || \n nivelagregacion===\"4\") ){\n r++;\n pesor1=1; \n }else if (estructura===\"networked\" && (nivelagregacion===\"2\" || \n nivelagregacion===\"3\" || \n nivelagregacion===\"4\") ){\n r++;\n pesor1=1; \n }else if (estructura===\"hierarchical\" && (nivelagregacion===\"2\" || \n nivelagregacion===\"3\" || \n nivelagregacion===\"4\") ){\n r++;\n pesor1=1; \n }else if (estructura===\"linear\" && (nivelagregacion===\"2\" || \n nivelagregacion===\"3\" || \n nivelagregacion ===\"4\") ){\n r++;\n pesor1=1; \n }\n\n if (tipointeractividad===\"active\" && (nivelinteractivo===\"very high\" || \n nivelinteractivo===\"high\" || \n nivelinteractivo===\"medium\" || \n nivelinteractivo===\"low\" ||\n nivelinteractivo===\"very low\") ){\n $r++;\n $pesor2=1; \n }else if (tipointeractividad===\"mixed\" && (nivelinteractivo===\"very high\" || \n nivelinteractivo===\"high\" || \n nivelinteractivo===\"medium\" || \n nivelinteractivo===\"low\" ||\n nivelinteractivo===\"very low\") ){\n r++;\n pesor2=1;\n }else if (tipointeractividad===\"expositive\" && (nivelinteractivo===\"very high\" || \n nivelinteractivo===\"high\") ){\n r++;\n pesor2=0;\n }else if (tipointeractividad===\"expositive\" && nivelinteractivo===\"medium\" ){\n r++;\n pesor2=0.5;\n }else if (tipointeractividad===\"expositive\" && ( nivelinteractivo===\"low\" ||\n nivelinteractivo===\"very low\") ){\n r++;\n pesor2=1;\n } \n if ( tipointeractividad===\"active\" && (tiporecursoeducativo===\"exercise\" || \n tiporecursoeducativo===\"simulation\" || \n tiporecursoeducativo===\"questionnaire\" || \n tiporecursoeducativo===\"exam\" ||\n tiporecursoeducativo===\"experiment\" ||\n tiporecursoeducativo===\"problem statement\" ||\n tiporecursoeducativo===\"self assessment\") ){\n r++;\n pesor3=1; \n }else if (tiporecursoeducativo===\"active\" && (tiporecursoeducativo===\"diagram\" || \n tiporecursoeducativo===\"figure\" || \n tiporecursoeducativo===\"graph\" || \n tiporecursoeducativo===\"index\" ||\n tiporecursoeducativo===\"slide\" ||\n tiporecursoeducativo===\"table\" ||\n tiporecursoeducativo===\"narrative text\" ||\n tiporecursoeducativo===\"lecture\") ){\n r++;\n pesor3=0;\n \n }else if (tipointeractividad===\"expositive\" && (tiporecursoeducativo===\"exercise\" || \n tiporecursoeducativo===\"simulation\" || \n tiporecursoeducativo===\"questionnaire\" || \n tiporecursoeducativo===\"exam\" ||\n tiporecursoeducativo===\"experiment\" ||\n tiporecursoeducativo===\"problem statement\" ||\n tiporecursoeducativo===\"self assessment\") ){\n r++;\n pesor3=0; \n }else if (tipointeractividad===\"expositive\" && (tiporecursoeducativo===\"diagram\" || \n tiporecursoeducativo===\"figure\" || \n tiporecursoeducativo===\"graph\" || \n tiporecursoeducativo===\"index\" ||\n tiporecursoeducativo===\"slide\" ||\n tiporecursoeducativo===\"table\" ||\n tiporecursoeducativo===\"narrative text\" ||\n tiporecursoeducativo===\"lecture\") ){\n r++;\n pesor3=1;\n }else if (tipointeractividad===\"mixed\" && (tiporecursoeducativo===\"exercise\" || \n tiporecursoeducativo===\"simulation\" || \n tiporecursoeducativo===\"questionnaire\" || \n tiporecursoeducativo===\"exam\" ||\n tiporecursoeducativo===\"experiment\" ||\n tiporecursoeducativo===\"problem statement\" ||\n tiporecursoeducativo===\"self assessment\" ||\n tiporecursoeducativo===\"diagram\" ||\n tiporecursoeducativo===\"figure\" ||\n tiporecursoeducativo===\"graph\" ||\n tiporecursoeducativo===\"index\" ||\n tiporecursoeducativo===\"slide\" ||\n tiporecursoeducativo===\"table\" ||\n tiporecursoeducativo===\"narrative text\" ||\n tiporecursoeducativo===\"lecture\" )){\n r++;\n pesor3=1; \n } \n m_coherencia=0;\n if (r>0) {\n\n // hace la sumatoria de los pesos \n m_coherencia= ( pesor1 + pesor2 + pesor3) / r;\n \n \n //alert(mensaje);\n return m_coherencia;\n //echo \"* Coherencia de: \". m_coherencia.\"; \". evaluacion.\"<br><br>\";\n }else{\n \n return m_coherencia;\n \n }\n\n\n }", "function principal() {\n choquecuerpo();\n choquepared();\n dibujar();\n movimiento();\n \n if(cabeza.choque (comida)){\n comida.colocar();\n cabeza.meter();\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}", "metodoAbstrato(){\n throw new Error(\"Este é um método abstrato e portanto não pode ser instanciado pelo objeto Conta\")\n }", "constructor(objeto) {\n\t\tthis.posicionamento = new posicionamento(objeto.linha, objeto.coluna);\n\t\tthis.sujo = objeto.sujo;\n\t\tthis.visitado = objeto.visitado;\n\t\tthis.listado = objeto.listado;\n\t}", "function dibujarFresado110(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4]\n\t\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (var n=0; n<4 ;n=n+1){\n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n }\n }\n\t\n\t\n\tvar fresado11 = new RVector(pos.x+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\t\n\t\n\t\n\tvar fresado16 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior) \n\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado22 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\tif (anchura4>pliegueInf4){\n\t\tvar fresado15 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior-pliegueInf4-alaInferior)\n var line = new RLineEntity(document, new RLineData( fresado15 , fresado22 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }else{\n var line = new RLineEntity(document, new RLineData( fresado14 , fresado22 ));\n\t op_fresado.addObject(line,false);\n\n }\n\t var line = new RLineEntity(document, new RLineData( fresado16 , fresado14 ));\n\t op_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado20 , fresado13 ));\n\t op_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado12 , fresado19 ));\n\t op_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado18 , fresado11 ));\n\t op_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado17 , fresado21 ));\n\t op_fresado.addObject(line,false);\n\t\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1){\n\t\t//var fresado10 = new RVector(pos.x,pos.y+pliegueInferior+alaInferior) \n\t\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t//var fresado2 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x+anchura1-pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado10,fresado1)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t op_fresado.addObject(line,false);\n\t\t//dibujarFresado_auxiliar(doc,fresado2,fresado11)\n }\n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)){\n\t\tvar fresado4 = new RVector(pos.x+anchura1+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x+anchura1+anchura2-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n var line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3*2)){\n\t\tvar fresado6 = new RVector(pos.x+anchura1+anchura2+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n var line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }\n\t\n\t//anchura4 - Inferior\n\tif (anchura4>pliegueInf4){\n\t\tvar fresado8 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado9 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n var line = new RLineEntity(document, new RLineData( fresado8 , fresado9 ));\n\t op_fresado.addObject(line,false);\n\t\t\n } \n\t\n\t\n\t\n\n\t\n\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)){\n\t\tvar fresado25 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x+anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado27 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }\n }\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)){\n\t\tvar fresado31 = new RVector(pos.x+anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado29 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado33 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado37 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado35 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado39 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior){ \n\t\tvar fresado43 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado41 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t op_fresado.addObject(line,false);\n }\n }\n\t\n\t\n\t\n\treturn op_fresado;\n}", "function dibujarFresado115(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4]\n\t\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (n=1 ; n<4 ; n=n+1){\n\t\tif (pliegueInferior<plieguesInf[n]) {\n\t\t\tpliegueInferior=plieguesInf[n]\n\t\t}\n\t}\n\t\n\t\n\t\n\t//Puntos trayectoria\t\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\t\n\tvar fresado16 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior) \n\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado22 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado2 = new RVector(pos.x+alaIzquierda,pos.y)\n\t\n\t\n\tvar line = new RLineEntity(document, new RLineData( fresado16 , fresado14 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado20 , fresado13 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado12 , fresado19 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado18 , fresado11 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado21 ));\n\top_fresado.addObject(line,false);\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1) {\n\t\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchura1-pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t} \n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)) {\n\t\tvar fresado4 = new RVector(pos.x+alaIzquierda+anchura1+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3*2)) {\n\t\tvar fresado6 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t} \n\t\n\t//anchura4 - Inferior\n\tif (anchura4>pliegueInf4) {\n\t\tvar fresado8 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado9 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t} \n\t\n\t\n\t\n\n\t\n\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)) {\n\t\tvar fresado25 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) { //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)) {\n\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\tvar fresado33 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2) {\n\t\tvar fresado37 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado35 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\tvar fresado39 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior) {\n\t\tvar fresado43 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado41 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\tvar fresado2 = new RVector(pos.x+alaIzquierda,pos.y)\n\tvar fresado25 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado25 ));\n\top_fresado.addObject(line,false);\n\t\n\t\n\t\n\treturn op_fresado; \n}", "function cargarFondo()\n{\n console.log(\"Cargo Fondo\");\n fondo.cargaOK= true; \n dibujar();\n}", "function dibujarFresado111(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\t\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4, pliegueInf5]\n\t\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (var n=0 ; n<5 ; n=n+1){\n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n }\n }\n\t\n\t\n\t\n\t//Puntos trayectoria \n\n\t\n\tvar fresado11 = new RVector(pos.x+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\tvar fresado15 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior) //nuevo\n\t\n\t\n\t\n\tvar fresado16 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior) \n\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado22 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca) //muevo\n\t\n\tvar fresado23 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\t\n\t\n\t\n\tif (anchura5>pliegueInf5){\n\t\tvar fresado14b = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior-pliegueInf5-alaInferior)\n var line = new RLineEntity(document, new RLineData( fresado14b , fresado23 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }else{\n var line = new RLineEntity(document, new RLineData( fresado15 , fresado23 ));\n\t op_fresado.addObject(line,false);\n }\n\t\n\tvar line = new RLineEntity(document, new RLineData( fresado16 , fresado15 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado15 , fresado22 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado14 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado13 , fresado20 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado18 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado22 ));\n\top_fresado.addObject(line,false);\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1){\n\t\t//var fresado10 = new RVector(pos.x,pos.y+pliegueInferior+alaInferior) \n\t\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t//var fresado2 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x+anchura1-pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado10,fresado1)\n var line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t//dibujarFresado_auxiliar(doc,fresado2,fresado11)\n } \n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)){\n\t\tvar fresado4 = new RVector(pos.x+anchura1+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x+anchura1+anchura2-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n var line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t op_fresado.addObject(line,false);\n\t\t\n }\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3*2)){\n\t\tvar fresado6 = new RVector(pos.x+anchura1+anchura2+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n var line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t op_fresado.addObject(line,false);\n } \n\t\n\t//anchura4 - Inferior\n\tif (anchura4>(pliegueInf4*2)){\n\t\tvar fresado8 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado9 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n var line = new RLineEntity(document, new RLineData( fresado8 , fresado9 ));\n\t op_fresado.addObject(line,false);\n\t\t\n } \n\t\n\t//anchura4 - Inferior\n\tif (anchura5>pliegueInf5){\n\t\tvar fresado10 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueInf5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n\t\tvar fresado11 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n var line = new RLineEntity(document, new RLineData( fresado10 , fresado11 ));\n\t op_fresado.addObject(line,false);\n\t\t\n } \n\t\n\t\n\t\n\n\t\n\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)){\n\t\tvar fresado25 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x+anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado27 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t op_fresado.addObject(line,false);\n }\n }\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)){\n\t\tvar fresado31 = new RVector(pos.x+anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado29 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado33 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado37 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado35 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado39 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior*2){\n\t\tvar fresado43 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado41 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado45 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado46 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado45 , fresado46 ));\n\t op_fresado.addObject(line,false);\n }\n }\n\t\n\t//anchura5 - Superior\n\tif (anchura5>pliegueSuperior){\n\t\tvar fresado49 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado50 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado49 , fresado50 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado47 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado48 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado47 , fresado48 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t\n\treturn op_fresado;\n}", "function Pessoa(nome, sobrenome){\n\n // atributos privados\n const ID = 123123;\n const metodos = function(){\n \n }\n\n\n //atributos ou metodos publicos\n this.Pessoa = nome;\n this.sobrenome = sobrenome;\n\n this.metodo = function(){\n console.log(\"Oi sou o Metodo\");\n }\n }", "function Patrocinador(){\n\tvar nome; \n\tvar title; \n\tvar imagem; \n\tvar url; \n\t\n\tthis.getNome = function() {\n\t\treturn this.nome;\n\t}; \n\tthis.setNome = function(nome_){\n\t\tthis.nome = nome_;\n\t};\n\tthis.getTitle = function() {\n\t\treturn this.title;\n\t}; \n\tthis.setTitle = function(title_){\n\t\tthis.nome = title_;\n\t};\t\t\n\tthis.getImagem = function() {\n\t\treturn this.imagem;\n\t}; \n\tthis.setImagem = function(imagem_){\n\t\tthis.imagem = imagem_;\n\t};\n\t\tthis.getUrl = function() {\n\t\treturn this.url;\n\t}; \n\tthis.setUrl = function(url_){\n\t\tthis.url = url_;\n\t};\n}", "function dibujarFresado102(modelo,di,pos,document){\n\t\n\t\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\t\n\t////////////////////////// Modelo F2 //////////////////////-\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4, pliegueInf5, pliegueInf6, pliegueInf7]\n\n\t//sacar el mayor pliegue\n\tvar pliegueInferior=pliegueInf1\n\tfor (var n=0; n<7;n=n+1){\n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n\t\t}\n\t}\n\t\n\t\n\t\n\t//Puntos trayectoria \n\t\n\t\n\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior+pliegueInferior)\n\tvar fresado2 = new RVector(pos.x+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado3 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado4 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado5 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\tvar fresado6 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+pliegueInferior)\n\tvar fresado7 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6,pos.y+alaInferior+pliegueInferior)\n\tvar fresado8 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+anchura7,pos.y+alaInferior+pliegueInferior)\n\tvar fresado9 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado10 = new RVector(pos.x+anchura1,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado11 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado15 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\tvar fresado16 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+anchura7,pos.y+alaInferior+alturaPlaca+pliegueInferior)\n\t\n\t\n\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado8 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado16 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado10 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado11 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado13 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado14 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado15 ));\n\top_fresado.addObject(line,false);\n\t\n\t\n\t\n\n\tcrearFresado=1 \n\t//anchura1 - Superior\n\tif (anchura1>pliegueSuperior){\n\t\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado18 = new RVector(pos.x+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado19 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado20 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado20 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura2 - Superior\n\tif (anchura2>pliegueSuperior*2){ \n\t\tvar fresado23 = new RVector(pos.x+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado24 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado22 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado21 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\tvar fresado25 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado26 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado29 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado30 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado28 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado27 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\tvar fresado31 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado32 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\t\top_fresado.addObject(line,false);\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior*2 ) {\n\t\tvar fresado35 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado36 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\tif ( crearFresado==1 ) {\n\t\t\tvar fresado34 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado33 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado34 , fresado33 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\tvar fresado37 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado38 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura5 - Superior\n\tif ( anchura5>pliegueSuperior*2 ) {\n\t\tvar fresado41 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado42 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t\n\t\tif ( crearFresado==1 ) {\n\t\t\tvar fresado40 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado39 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado40 , fresado39 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\n\t\t\tvar fresado43 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado44 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t}\n\t}\n\t\n\t\n\t//anchura6 - Superior\n\tif ( anchura6>pliegueSuperior*2 ) {\n\t\tvar fresado47 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado48 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado47 , fresado48 ));\n\t\top_fresado.addObject(line,false);\n\n\t\t\n\t\tif ( crearFresado==1 ) {\n\t\t\tvar fresado46 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado45 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado46 , fresado45 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\n\t\t\tvar fresado49 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado50 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado49 , fresado50 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura7 - Superior\n\tif ( anchura7>pliegueSuperior ) {\n\t\tvar fresado53 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar fresado54 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+anchura7,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado53 , fresado54 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif ( crearFresado==1 ) {\n\t\t\tvar fresado52 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+pliegueInferior)\n\t\t\tvar fresado51 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior+pliegueInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado51 , fresado52 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Inferior\n\tif ( anchura1>(pliegueInf1) ) { \n\t\tvar fresado55 = new RVector(pos.x,pos.y+pliegueInferior+alaInferior-pliegueInf1)\n\t\tvar fresado56 = new RVector(pos.x+anchura1-pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado55 , fresado56 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura2 - Inferior\n\tif ( anchura2>(pliegueInf2)*2 ) { \n\t\tvar fresado55 = new RVector(pos.x+anchura1+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado56 = new RVector(pos.x+anchura1+anchura2-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado56 , fresado55 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura3 - Inferior\n\tif ( anchura3>(pliegueInf3)*2 ) { \n\t\tvar fresado55 = new RVector(pos.x+anchura1+anchura2+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado56 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado55 , fresado56 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t}\n\t\n\t//anchura4 - Inferior\n\tif ( anchura4>(pliegueInf4)*2 ) { \n\t\tvar fresado55 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado56 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado55 , fresado56 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t}\n\t\n\t//anchura5 - Inferior\n\tif ( anchura5>(pliegueInf5)*2 ) { \n\t\tvar fresado55 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueInf5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n\t\tvar fresado56 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5-pliegueInf5,pos.y+alaInferior+pliegueInferior-pliegueInf5)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado55 , fresado56 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura6 - Inferior\n\tif ( anchura6>(pliegueInf6)*2 ) { \n\t\tvar fresado55 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+pliegueInf6,pos.y+alaInferior+pliegueInferior-pliegueInf6)\n\t\tvar fresado56 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6-pliegueInf6,pos.y+alaInferior+pliegueInferior-pliegueInf6)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado55 , fresado56 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura7 - Inferior\n\tif ( anchura7>(pliegueInf7) ) { \n\t\tvar fresado55 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+pliegueInf7,pos.y+alaInferior+pliegueInferior-pliegueInf7)\n\t\tvar fresado56 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+anchura7,pos.y+alaInferior+pliegueInferior-pliegueInf7)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado55 , fresado56 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t\n\treturn op_fresado\n\t\n}", "function dibujarFresado109(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4]\n\t\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (var n=0; n<4 ;n=n+1){\n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n\t\t}\n\t} \n\t\n\t\n\t//Puntos trayectoria \n \n\t\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado15 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\t\n\tvar fresado16 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+pliegueIzq)\n\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado22 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\n\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado15 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado22 , fresado17 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado16 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado18 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado13 , fresado20 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado14 ));\n\top_fresado.addObject(line,false);\n\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1){\n\t\tvar fresado10 = new RVector(pos.x+alaIzquierda,pos.y+pliegueInferior+alaInferior-pliegueIzq) \n\t\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado2 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado1 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado11 ));\n\t\top_fresado.addObject(line,false);\n\n\t} \n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)){\n\t\tvar fresado4 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3*2)){\n\t\tvar fresado6 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t} \n\t\n\t//anchura4 - Inferior\n\tif (anchura4>pliegueInf4){\n\t\tvar fresado8 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado9 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t} \n\t\n\t\n\t\n\n\t\n\t\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)){\n\t\tvar fresado25 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)){\n\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado33 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){ \n\t\tvar fresado37 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\top_fresado.addObject(line,false);\n\t \n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado35 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado39 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior){\n\t\tvar fresado43 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado41 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t\n\treturn op_fresado;\n}", "function beamObj(objs){ //beam objs\r\n\t\tapplied.allobj = objs;\r\n\t\tdrawn.basic = false;\r\n\t}//reiterate members", "function heredaDe(prototipoHijo, prototipoPadre){\n var fn = function () {}\n fn.prototype = prototipoPadre.prototype\n prototipoHijo.prototype = new fn\n //asignamos la funcion constructora de la clase claseHija\n prototipoHijo.prototype.constructor = prototipoHijo\n}", "function Apuesta(){\n\tvar valor;//declaracion variable private\n\tvar tipo;\n\tvar casillero;\n\t//declaracion variable static para contar instancias del objeto\n\tif ( typeof Apuesta.nApuestas == 'undefined' ) {\n Apuesta.nApuestas = 0;\n }\n ++Apuesta.nApuestas;\n\n\tApuesta.prototype.getNapuestas = function(){\n\t\t\treturn Apuesta.nApuestas;\n\t}\n\tApuesta.prototype.getValor = function(){\n\t\t\treturn valor;\n\t}\n\tApuesta.prototype.setValor = function(n){\n\t\t//validacion\n\t\t\tvalor = n;\n\t}\n}", "constructor(nombre,apellido){\n this._nombre=nombre;\n this._apellido=apellido;\n Persona.contadorObjetosPersona++;\n }", "function dibujarFresado113(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\t//Puntos trayectoria\t\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1,pos.y+alaInferior)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3,pos.y+alaInferior)\n\tvar fresado15 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior)\n\t\n\tvar fresado16 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior)\n\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1,pos.y+alaInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3,pos.y+alaInferior+alturaPlaca)\n\tvar fresado22 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar line = new RLineEntity(document, new RLineData( fresado16 , fresado15 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado22 , fresado17 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado16 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado18 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado13 , fresado20 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado14 ));\n\top_fresado.addObject(line,false);\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)) {\n\t\tvar fresado25 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\tif (crearFresado==1) { //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)) {\n\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\tvar fresado33 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2) {\n\t\tvar fresado37 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado35 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\tvar fresado39 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior) {\n\t\tvar fresado43 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1) {\n\t\t\tvar fresado41 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\t\n\treturn op_fresado; \n}", "function dibujarFresado101(modelo,di,pos,document){\n\t\n\t\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t////////////////////////// Modelo F1 //////////////////////\n\t//Puntos trayectoria \n\t\n\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior)\n\tvar fresado2 = new RVector(pos.x+anchura1,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior)\n\tvar fresado4 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior)\n\tvar fresado5 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior)\n\tvar fresado6 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior)\n\tvar fresado7 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6,pos.y+alaInferior)\n\tvar fresado8 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+anchura7,pos.y+alaInferior)\n\tvar fresado9 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca)\n\tvar fresado10 = new RVector(pos.x+anchura1,pos.y+alaInferior+alturaPlaca)\n\tvar fresado11 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+alturaPlaca)\n\tvar fresado12 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+alturaPlaca)\n\tvar fresado13 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca)\n\tvar fresado14 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+alturaPlaca)\n\tvar fresado15 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6,pos.y+alaInferior+alturaPlaca)\n\tvar fresado16 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+anchura7,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado8 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado16 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado10 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado11 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado13 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado14 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado15 ));\n\top_fresado.addObject(line,false);\n\t\n\n\t\n\tcrearFresado=1 \n\t//anchura1\n\tif (anchura1>pliegueSuperior){\n\t\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado18 = new RVector(pos.x+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado19 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado20 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado20 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t}\n\t}\n\t\n\t\n\t//anchura2\n\tif (anchura2>pliegueSuperior*2){\n\t\tvar fresado23 = new RVector(pos.x+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado24 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\top_fresado.addObject(line,false);\n\t\n\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado22 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado21 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t\tvar fresado25 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado26 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura3\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado29 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado30 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado28 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado27 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado28 , fresado27 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\n\t\t\tvar fresado31 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado32 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\t\n\t}\n}\n\t\n\t\n\t//anchura4\n\tif (anchura4>pliegueSuperior*2){\n\t\tvar fresado35 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado36 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado34 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado33 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\n\t\t\tvar fresado37 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado38 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t//anchura5\n\tif (anchura5>pliegueSuperior*2){\n\t\tvar fresado41 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado42 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado40 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado39 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\n\t\t\tvar fresado43 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado44 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\n\t\t}\n\t}\n\t\n\t\n\t//anchura6\n\tif (anchura6>pliegueSuperior*2){\n\t\tvar fresado47 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado48 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado47 , fresado48 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado46 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado45 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado46 , fresado45 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\n\t\t\tvar fresado49 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado50 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado49 , fresado50 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t}\n\t}\n\t\n\t//anchura7\n\tif (anchura7>pliegueSuperior){\n\t\tvar fresado53 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado54 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+anchura7,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado53 , fresado54 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado52 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado51 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5+anchura6+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\t\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado51 , fresado52 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\n\t\t}\n\t}\n\n\n\treturn op_fresado;\n}", "function dibujarFresado116(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tanchura4=0\n\tanchura5=0\n\t\n\t//Puntos trayectoria \n\t\t\t//Son los mismos puntos que la figura 001 (el unico que cambia es fresado6 y fresado14)\n\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior) \n\tvar fresado2 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior)\n\tvar fresado4 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior)\n\tvar fresado5 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior)\n\t\n\tvar fresado6 = new RVector(pos.x+alaIzquierda,pos.y) //punto fresado abajo a la izquierda\n\t\n\tvar fresado7 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4+pliegueDer,pos.y+alaInferior)\n\t\n\tvar fresado9 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca)\n\tvar fresado10 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+alturaPlaca)\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+alturaPlaca)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar fresado14 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4+pliegueDer,pos.y+alaInferior+alturaPlaca)\n\t\n\t\n\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado7 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado13 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado13 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado10 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado11 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado14 ));\n\top_fresado.addObject(line,false);\n\t\n\t\n\t\n\t\n\t//anchura1\n\tif (anchura1>pliegueSuperior){\n\t\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado18 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado19 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado20 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado20 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura2\n\tif (anchura2>pliegueSuperior*2){\n\t\t\n\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado22 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado21 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado25 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura3\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura4\n\tif (anchura4>pliegueSuperior){\n\t\tvar fresado35 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado36 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado34 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado33 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\treturn op_fresado; \n}", "constructor(ojos, boca, extremidades, duenio) {\n super(ojos, boca, extremidades);\n this.duenio = duenio;\n this.estaDomesticado = true;\n }", "constructor (nombre, apellido,sueldo, cargo){ //solicitio los parametros incluidos los que vincule\n super(nombre,apellido) // con super selecciono los parametros que pide la clase vinculada\n this.sueldo= sueldo;\n this.cargo=cargo;\n }", "function IA_Objetos() {\n IA.call(this);\n\n this.pared = false;\n this.serpiente = false;\n this.manzana = false;\n this.objManzana = null;\n\n this.establecerManzana = function(objeto) {\n this.objManzana = objeto;\n }\n\n this.activarPared = function() { this.pared = true;}\n this.activarSerpiente = function() { this.serpiente = true;}\n this.activarManzana = function() { this.manzana = true;}\n this.desactivarPared = function() { this.pared = false;}\n this.desactivarSerpiente = function() { this.serpiente = false;}\n this.desactivarManzana = function() { this.manzana = false;}\n\n this.obtenerPared = function() { return this.pared;}\n this.obtenerManzana = function() { return this.manzana;}\n this.obtenerSerpiente = function() { return this.serpiente;}\n this.obtenerObjManzana = function() { return this.objManzana;}\n\n this.clone = function() {\n o = new IA_Objetos();\n return o;\n }\n}", "function heredaDe(protoHijo,protoPadre) {\n//3.Aqui le decimos al ptto hijo quien sera su padre :v\n\tvar fn = function () {} //4. funcion vacia\n\tfn.prototype = protoPadre.prototype //5. al prototipo de esta le asignamos el prototipo padre\n\tprotoHijo.prototype = new fn //6. Nuevo objeto de la funcion q creamos, es decir lo mismo pero pasamos a otro objeto.\n\t//7. asignamos constructor\n\tprotoHijo.prototype.constructor = protoHijo\n\t//Esto es algo complejo, pero en la clase q viene será más sencillo\n}", "function dibujarFresado114(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior) \n\tvar fresado2 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior)\n\tvar fresado4 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior)\n\tvar fresado5 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior)\n\t\n\t\n\t\n\t\n\t\n\tvar fresado6 = new RVector(pos.x+alaIzquierda,pos.y) //punto fresado abajo a la izquierda\n\t\n\t\n\t\n\t\n\tvar fresado9 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca)\n\tvar fresado10 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+alturaPlaca)\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+alturaPlaca)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+alturaPlaca)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar fresado14 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado5 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado13 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado10 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado11 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado14 ));\n\top_fresado.addObject(line,false);\n\n\t\n\t\n\t\n\t\n\t//anchura1\n\tif (anchura1>pliegueSuperior){\n\t\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado18 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\n\t\tif (crearFresado==1){\n\t\t\tvar fresado19 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado20 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado20 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura2\n\tif (anchura2>pliegueSuperior*2){\n\t\t\n\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado22 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado21 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\tvar fresado25 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t//anchura3\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\top_fresado.addObject(line,false);\n\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\n\t\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\t\top_fresado.addObject(line,false);\n\n\t\t}\n\t}\n\t\n\t\n\t//anchura4\n\tif (anchura4>pliegueSuperior){\n\t\tvar fresado35 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado36 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado34 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado33 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\n\t\t}\n\t}\n\t\n\t\n\n\treturn op_fresado; \n\n}", "function Cliente(cedula,nombre,apellido){\n this.cedula = cedula;\n this.nombre = nombre;\n this.apellido = apellido;\n //this.direccion = {}; //valido\n this.direccion = new Object(); //valido\n this.genero = \"\";\n this.toString = function(){\n var cadena= \"\";\n for(atributo in this){\n if(!(this[atributo] instanceof Function)){\n cadena+=atributo+ \": \" + this[atributo]+\" \"; //imprime atributos y metodos\n } \n }\n return cadena; \n /*return \"cedula: \"+this.cedula+\n \" nombre: \"+this.nombre+\n \" apellido: \"+this.apellido+\n \" genero: \"+this.genero+\n \" direccion: \"+this.direccion;*/\n }\n \n this.direccion.toString = function(){\n var cadena= \"\";\n for(atributo in this){\n if(!(this[atributo] instanceof Function)){\n cadena+=atributo+ \": \" + this[atributo]+\" \"; //imprime atributos y metodos\n } \n }\n return cadena; \n }\n \n \n \n}", "function copiafyv(principal, copia) {\n try {\n /*Analizo primero el root principal */\n principal.lista_Nodo.forEach(function (element) {\n if (element.tipo == \"Clase\") {\n MYFPrincipal = [];\n MYFfCopia = [];\n /*por cada calse encontrada, la busco en el otro arbol*/\n copia.lista_Nodo.forEach(function (element2) {\n if (element2.tipo == \"Clase\") {\n /*Por cada clase que encuentro en el otro root compruebo si son los mismos*/\n if (element.descripcion == element2.descripcion) {\n /*recorro para encontrar los metodos y funciones de la clase principal*/\n element.lista_Nodo.forEach(function (element3) {\n if (element3.tipo == \"Funcion\") {\n MYFPrincipal.push(element3.descripcion);\n /*encontramos si tiene parametros la funcion*/\n element3.lista_Nodo.forEach(function (parametrosMF) {\n if (parametrosMF.tipo == \"Parametros\") {\n var parametroslst = returnLst(parametrosMF.lista_Nodo);\n element2.lista_Nodo.forEach(function (fmCopia) {\n if (fmCopia.tipo == \"Funcion\" && element3.tipodato == fmCopia.tipodato) {\n fmCopia.lista_Nodo.forEach(function (paramCopia) {\n if (paramCopia.tipo == \"Parametros\") {\n var parametroslstCopia = returnLst(paramCopia.lista_Nodo);\n if (parametroslst.toString() == parametroslstCopia.toString()) {\n console.log(\"las funciones \" + element3.descripcion + \" Son iguales en ambos archivos,por tener los mismos tipos de parametros en el mismo orden\" + \" de la calse \" + element.descripcion);\n MYFfCopia_Clase.push(element.descripcion);\n MYFfCopia.push(element3.descripcion);\n }\n }\n });\n }\n });\n }\n });\n }\n else if (element3.tipo == \"Metodo\") {\n MYFPrincipal.push(element3.descripcion);\n /*encontramos si tiene parametros la funcion*/\n element3.lista_Nodo.forEach(function (parametrosF) {\n if (parametrosF.tipo == \"Parametros\") {\n var parametroslstM = returnLst(parametrosF.lista_Nodo);\n element2.lista_Nodo.forEach(function (mCopia) {\n if (mCopia.tipo == \"Metodo\" && element3.descripcion == mCopia.descripcion) {\n mCopia.lista_Nodo.forEach(function (paramCopiaM) {\n if (paramCopiaM.tipo == \"Parametros\") {\n var parametroslstCopiaM = returnLst(paramCopiaM.lista_Nodo);\n if (parametroslstM.toString() == parametroslstCopiaM.toString()) {\n console.log(\"los metodos \" + element3.descripcion + \" Son iguales en ambos archivos,por tener los mismos tipos de parametros en el mismo orden\" + \" de la calse \" + element.descripcion);\n MYFfCopia.push(element3.descripcion);\n MYFfCopia.push(element3.descripcion);\n }\n }\n });\n }\n });\n }\n });\n }\n });\n if (MYFPrincipal.toString() == MYFfCopia.toString()) {\n console.log(\"las clases \" + element.descripcion + \" Son iguales en ambos archivos\");\n }\n }\n }\n });\n }\n });\n }\n catch (error) {\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 _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}", "function Obj(nome){\n this.nome = nome;\n\n //Também posso colocar uma função dentro da função utilizando o This.\n this.exec = function(){\n console.log(\"Exec...\")\n }\n}", "function dibujarFresado107(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t//Puntos trayectoria \n\t\t\t//Son los mismos puntos que la figura 001 (el unico que cambia es fresado6 y fresado14)\n\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior) \n\tvar fresado2 = new RVector(pos.x+anchura1,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior)\n\tvar fresado4 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior)\n\tvar fresado5 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior)\n\t\n\t\n\t\n\t\n\t\n\tvar fresado6 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y) //punto fresado abajo a la izquierda [hay que corregirlo]\n\t\n\t\n\t\n\t\n\tvar fresado9 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca)\n\tvar fresado10 = new RVector(pos.x+anchura1,pos.y+alaInferior+alturaPlaca)\n\tvar fresado11 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+alturaPlaca)\n\tvar fresado12 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+alturaPlaca)\n\tvar fresado13 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar fresado14 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\n\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado5 ));\n\top_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado9 , fresado13 ));\n\top_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado2 , fresado10 ));\n\top_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado3 , fresado11 ));\n\top_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado4 , fresado12 ));\n\top_fresado.addObject(line,false);\n var line = new RLineEntity(document, new RLineData( fresado6 , fresado14 ));\n\top_fresado.addObject(line,false);\n\n\t\n\t\n\t\n\t//anchura1\n\tif (anchura1>pliegueSuperior){\n\t\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado18 = new RVector(pos.x+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado17 , fresado18 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado19 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado20 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado19 , fresado20 ));\n\t op_fresado.addObject(line,false);\n }\n\t}\n\t\n\t\n\t//anchura2\n\tif (anchura2>pliegueSuperior*2){\t\t\n\t\tvar fresado23 = new RVector(pos.x+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado24 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado22 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado21 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado25 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado26 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t\n\t//anchura3\n\tif (anchura3>pliegueSuperior*2){\n\t\tvar fresado29 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado30 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\n\t\tif (crearFresado==1){\n\t\t\tvar fresado28 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado27 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado28 , fresado27 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado31 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado32 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n }\n\t\n\t\n\t//anchura4\n\tif (anchura4>pliegueSuperior*2){\n\t\tvar fresado35 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n var line = new RLineEntity(document, new RLineData( fresado35 , fresado14 ));\n\t op_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado34 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado33 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n var line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t op_fresado.addObject(line,false);\n\t\t\t\n }\n\t}\n\t\n\t\n\t\n\treturn op_fresado;\n\n}", "function dibujarFresado126(modelo,di,pos,document){\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t//Puntos trayectoria \n\t\n\t\n\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior)\n\tvar fresado2 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchuraPlaca,pos.y+alaInferior)\n\t\n\tvar fresado4 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca)\n\tvar fresado5 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+alturaPlaca)\n\tvar fresado6 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchuraPlaca,pos.y+alaInferior+alturaPlaca)\n\t\n\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado4 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado5 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado6 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado6 ));\n\t\top_fresado.addObject(line,false);\n\n\t\n\n\treturn op_fresado; \n\n\t\n}", "function dibujarFresado103(modelo,di,pos,document){\n\t\n\t\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\t////////////////////////// Modelo F3 //////////////////////-\t\n\tvar alturas=[altura1,altura2,altura3,altura4,altura5,altura6,altura7,altura8,altura9,altura10]\n\t\n\tvar nPestanas=numeroPestanas003(alturas)\n\t\n\t\n\tvar fresado1\n\tvar fresado2\n\tvar fresado3\n\tvar fresado4\n\tvar fresado5\n\tvar fresado6\n\tvar fresado7\n\tvar fresado8\n\tvar fresado9\n\tvar fresado10\n\tvar fresado11\n\tvar fresado12\n\tvar fresado13\n\tvar fresado14\n\tvar fresado15\n\tvar fresado16\n\tvar fresado17\n\tvar fresado18\n\tvar fresado19\n\tvar fresado20\n\tvar fresado21\n\tvar fresado22\n\t\n\tvar x\n\tvar y\n\t\n\t//Puntos trayectoria\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y\n\tif (dibujoHorizontal==1) { //Dibujo horizontal\n\t\tfresado1 = new RVector(y,x)\n\t}else{ //dibujo vertical\n\t\tfresado1 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1\n\tif (dibujoHorizontal==1) {\n\t\tfresado2 = new RVector(y,x)\n\t}else{\n\t\tfresado2 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2\n\tif (dibujoHorizontal==1) {\n\t\tfresado3 = new RVector(y,x)\n\t}else{\n\t\tfresado3 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3\n\tif (dibujoHorizontal==1) {\n\t\tfresado4 = new RVector(y,x)\n\t}else{\n\t\tfresado4 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4\n\tif (dibujoHorizontal==1) {\n\t\tfresado5 = new RVector(y,x)\n\t}else{\n\t\tfresado5 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5\n\tif (dibujoHorizontal==1) {\n\t\tfresado6 = new RVector(y,x)\n\t}else{\n\t\tfresado6 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6\n\tif (dibujoHorizontal==1) {\n\t\tfresado7 = new RVector(y,x)\n\t}else{\n\t\tfresado7 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7\n\tif (dibujoHorizontal==1) {\n\t\tfresado8 = new RVector(y,x)\n\t}else{\n\t\tfresado8 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7+altura8\n\tif (dibujoHorizontal==1) {\n\t\tfresado9 = new RVector(y,x)\n\t}else{\n\t\tfresado9 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7+altura8+altura9\n\tif (dibujoHorizontal==1) {\n\t\tfresado10 = new RVector(y,x)\n\t}else{\n\t\tfresado10 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda+anchuraPlaca\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7+altura8+altura9+altura10\n\tif (dibujoHorizontal==1) {\n\t\tfresado11 = new RVector(y,x)\n\t}else{\n\t\tfresado11 = new RVector(x,y)\n\t}\n\t\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y\n\tif (dibujoHorizontal==1) {\n\t\tfresado12 = new RVector(y,x)\n\t}else{\n\t\tfresado12 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1\n\tif (dibujoHorizontal==1) {\n\t\tfresado13 = new RVector(y,x)\n\t}else{\n\t\tfresado13 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2\n\tif (dibujoHorizontal==1) {\n\t\tfresado14 = new RVector(y,x)\n\t}else{\n\t\tfresado14 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3\n\tif (dibujoHorizontal==1) {\n\t\tfresado15 = new RVector(y,x)\n\t}else{\n\t\tfresado15 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4\n\tif (dibujoHorizontal==1) {\n\t\tfresado16 = new RVector(y,x)\n\t}else{\n\t\tfresado16 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5\n\tif (dibujoHorizontal==1) {\n\t\tfresado17 = new RVector(y,x)\n\t}else{\n\t\tfresado17 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6\n\tif (dibujoHorizontal==1) {\n\t\tfresado18 = new RVector(y,x)\n\t}else{\n\t\tfresado18 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7\n\tif (dibujoHorizontal==1) {\n\t\tfresado19 = new RVector(y,x)\n\t}else{\n\t\tfresado19 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7+altura8\n\tif (dibujoHorizontal==1) {\n\t\tfresado20 = new RVector(y,x)\n\t}else{\n\t\tfresado20 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7+altura8+altura9\n\tif (dibujoHorizontal==1) {\n\t\tfresado21 = new RVector(y,x)\n\t}else{\n\t\tfresado21 = new RVector(x,y)\n\t}\n\t\n\tx=pos.x+alaIzquierda\n\ty=pos.y+altura1+altura2+altura3+altura4+altura5+altura6+altura7+altura8+altura9+altura10\n\tif (dibujoHorizontal==1) {\n\t\tfresado22 = new RVector(y,x)\n\t}else{\n\t\tfresado22 = new RVector(x,y)\n\t}\n\t\n\t\n\t\n\t\n\t\n\t\n\tvar fresadoIzq=[fresado12,fresado13,fresado14,fresado15,fresado16,fresado17,fresado18,fresado19,fresado20,fresado21,fresado22] //Se ponen los puntos en un vector para poder usarlos en un bucle for\n\tvar fresadoDer=[fresado1,fresado2,fresado3,fresado4,fresado5,fresado6,fresado7,fresado8,fresado9,fresado10,fresado11] //Se ponen los puntos en un vector para poder usarlos en un bucle for\n\t\n\t\n\t//Dibujar lineas horizontales\n\tif (nPestanas==2) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t} else if ( nPestanas==3) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t} else if ( nPestanas==4) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t} else if ( nPestanas==5) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t} else if ( nPestanas==6) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t} else if ( nPestanas==7) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t} else if ( nPestanas==8) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado19 ));\n\t\top_fresado.addObject(line,false);\n\t} else if (nPestanas==9) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado19 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado20 ));\n\t\top_fresado.addObject(line,false);\n\t} else if (nPestanas==10) {\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado19 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado20 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado21 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t\n\t//dibujar lineas verticales\n\tvar pliegueIzq=[pliegueIzq1,pliegueIzq2,pliegueIzq3,pliegueIzq4,pliegueIzq5,pliegueIzq6,pliegueIzq7,pliegueIzq8,pliegueIzq9,pliegueIzq10]\n\tvar pliegueDer=[pliegueDer1,pliegueDer2,pliegueDer3,pliegueDer4,pliegueDer5,pliegueDer6,pliegueDer7,pliegueDer8,pliegueDer9,pliegueDer10]\n\t\n\tfor (var n=0 ; n<nPestanas ; n=n+1){\n\t\tif (pliegueDer[n]==1) {\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresadoDer[n] , fresadoDer[n+1] ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t\tif (pliegueIzq[n]==1) {\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresadoIzq[n] , fresadoIzq[n+1] ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\treturn op_fresado;\n}", "function nombreObjeto (par1, par2, parN) {\r\n\tthis.propiedad1 = valorPropiedad1;\r\n\tthis.propiedad2 = valorPropiedad2;\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 dibujarFresado127(modelo,di,pos,document){\n\t\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t//Puntos trayectoria \n\t\n\t\n\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior)\n\tvar fresado2 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchuraPlaca,pos.y+alaInferior)\n\tvar fresado4 = new RVector(pos.x+alaIzquierda+anchuraPlaca+pliegueDer,pos.y+alaInferior)\n\t\n\tvar fresado5 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca)\n\tvar fresado6 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca)\n\tvar fresado7 = new RVector(pos.x+alaIzquierda+anchuraPlaca,pos.y+alaInferior+alturaPlaca)\n\tvar fresado8 = new RVector(pos.x+alaIzquierda+anchuraPlaca+pliegueDer,pos.y+alaInferior+alturaPlaca)\n\t\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado4 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado6 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\t\n\n\t\n\n\treturn op_fresado; \n\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 cargarFondo()\n{\n fondo.cargaOK = true;\n dibujar();\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 dibujarFresado121(modelo,di,pos,document){\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior)\n\tvar fresado2 = new RVector(pos.x+alaIzquierda+anchuraPlaca,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInf2)\n\tvar fresado4 = new RVector(pos.x+alaIzquierda+anchuraPlaca,pos.y+alaInferior+pliegueInf2)\n\tvar fresado5 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInf2+pliegueInf1)\n\tvar fresado6 = new RVector(pos.x+alaIzquierda+anchuraPlaca,pos.y+alaInferior+pliegueInf2+pliegueInf1)\n\tvar fresado7 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInf2+pliegueInf1+alturaPlaca)\n\tvar fresado8 = new RVector(pos.x+alaIzquierda+anchuraPlaca,pos.y+alaInferior+pliegueInf2+pliegueInf1+alturaPlaca)\n\tvar fresado9 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInf2+pliegueInf1+alturaPlaca+pliegueSuperior)\n\tvar fresado10 = new RVector(pos.x+alaIzquierda+anchuraPlaca,pos.y+alaInferior+pliegueInf2+pliegueInf1+alturaPlaca+pliegueSuperior)\n\t\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado2 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado4 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado6 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado10));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado10 ));\n\t\top_fresado.addObject(line,false);\n\n\treturn op_fresado; \n\n}", "function dibujarFresado124(modelo,di,pos,document){\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+anchura1)\n\t\n\tvar fresado2 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior)\n\tvar fresado4 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+alaDerecha,pos.y+alaInferior)\n\t\n\tvar fresado5 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior)\n\tvar fresado6 = new RVector(pos.x+alaIzquierda,pos.y)\n\t\n\tvar fresado7 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado8 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\t\n\t\n\t\n\t\n\tvar fresado9 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado10 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado12 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado5 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado4 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado2 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado12 ));\n\t\top_fresado.addObject(line,false);\n\n\t\n\t\n\t\n\t\n\t//anchura1\n\tif (anchura1>pliegueSuperior){ \n\t\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado18 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado19 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado20 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado20 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t//anchura2\n\tif (anchura2>pliegueSuperior*2){ \t\n\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado22 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado21 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\n\treturn op_fresado; \n\n}", "function panier() {\n for(i=0; i<objPanier.length; i++) {\n afficheCamera(i);\n }\n //affiche le prix total de la commande\n prixTotal();\n}", "function dibujarFresado119(modelo,di,pos,document){\n\t\n\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\t//Puntos trayectoria \n\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior)\n\tvar fresado2 = new RVector(pos.x,pos.y)\n\tvar fresado3 = new RVector(pos.x+anchura1,pos.y+alaInferior)\n\tvar fresado4 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior)\n\tvar fresado5 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior)\n\tvar fresado6 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior)\n\tvar fresado7 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior)\n\tvar fresado8 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+alturaPlaca)\n\tvar fresado9 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+anchura5,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado10 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado11 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+alturaPlaca)\n\tvar fresado12 = new RVector(pos.x+anchura1+anchura2+anchura3+anchura4-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado13 = new RVector(pos.x+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado14 = new RVector(pos.x+anchura1+anchura2+anchura3,pos.y+alaInferior+alturaPlaca)\n\tvar fresado15 = new RVector(pos.x+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado16 = new RVector(pos.x+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado17 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+alturaPlaca)\n\tvar fresado18 = new RVector(pos.x+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado19 = new RVector(pos.x+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado20 = new RVector(pos.x+anchura1,pos.y+alaInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado22 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado23 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca)\n\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado22 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado20 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado11 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado22 , fresado21 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado16 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado13 , fresado12 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\n\n\treturn op_fresado; \n\n}", "function iniciar() {\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 }", "constructor() {\n this.inicializar();\n this.generarSecuencia();\n this.siguienteNivel(); \n }", "function soltaObj(ele){ \n\t//console.log(\"soltou!!\");\n\t\n\tif(!elementoCarregado)return; \t\n\t\t\n\t$(\"#\"+elementoCarregado.id).css(\"pointer-events\", \"all\");\n\t$(\"#\"+elementoCarregado.id).css(\"z-index\", \"7\");\n\n\tvar pontoX = $(elementoCarregado).position().left/prop+($(elementoCarregado).width())/2;\n\tvar pontoY = $(elementoCarregado).position().top/prop+($(elementoCarregado).height())/2;\n\t\n\t\tif (pontoX > $(\"#areaDrop\").position().left/prop && pontoY > $(\"#areaDrop\").position().top/prop && pontoY < ($(\"#areaDrop\").position().top/prop+$(\"#areaDrop\").height()) && pontoX < ($(\"#areaDrop\").position().left/prop+$(\"#areaDrop\").width())) {\n\t\t\n\t\t\t\t$(elementoCarregado).fadeOut(200, function(){\n\t\t\t\t\t$(elementoCarregado).css({ top:posOriginTop, left:posORiginLeft});\n\t\t\t\t\t$(elementoCarregado).fadeIn(200);\n\t\t\t\t\telementoCarregado = null;\n\t\t\t\t\tobjEmMovimento = false;\n\n\t\t\t\t\tdinArrastado = Number(dinArrastado);\n\n\t\t\t\t\tfaltandoP -= parseFloat(dinArrastado.toFixed(2));\n\t\t\t\t\tmeuDinheiro -= parseFloat(dinArrastado.toFixed(2));\n\n\t\t\t\t\t$(\"#dinPago\").html(\"R$ \"+mascaraValor(faltandoP.toFixed(2)));\n\t\t\t\t\t$(\".boxMeuDinheiro span+span\").html(mascaraValor(meuDinheiro.toFixed(2)));\n\n\t\t\t\t\tverificaCarteira();\n\n\t\t\t\t\tif (parseFloat(faltandoP.toFixed(2)) <= 0.00) {//Math.floor(faltandoP)\n\t\t\t\t\t\t$(\"#dinPago\").html(\"R$ 0,00\");\n\t\t\t\t\t\tmeuTroco = Number(faltandoP.toFixed(2))*-1\n\t\t\t\t\t\t//$(\".boxMeuDinheiro span+span\").html(mascaraValor(meuDinheiro.toFixed(2)));\n\n\t\t\t\t\t\tconsole.log(\"TudoPago\");\n\t\t\t\t\t\tChamaModalFinal();\n\t\t\t\t\t}\n\n\t\t\t\t});\n\t\t\n\t\t\t\treturn;\n\t\t}else{\n\t\t\t\n\t\t}\t\n\t\n\t$(elementoCarregado).animate({left:posORiginLeft, top:posOriginTop},function(){\n\t\tobjEmMovimento = false;\n\t});\t\n\telementoCarregado = null;/**/\n\t\n}", "function constroiEventos(){}", "constructor(peso, color){ //propiedades\n this.peso= peso;\n this.color=color;\n }", "function dibujarFresado138(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\n\t\n\t//Puntos fresado\n\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior)\n\tvar fresado2 = new RVector(pos.x+alaIzquierda+anchura1-pliegueInferior,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchura1+pliegueInferior,pos.y+alaInferior)\n\tvar fresado4 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueInferior,pos.y+alaInferior)\n\tvar fresado5 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueInferior,pos.y+alaInferior)\n\t//var fresado6 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueInferior,pos.y+alaInferior)\n\t//var fresado7 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueInferior,pos.y+alaInferior)\n\tvar fresado8 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior)\n\tvar fresado9 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior)\n\tvar fresado10 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\t//var fresado12 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado15 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado16 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t//var fresado17 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado18 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\t\n\tvar fresado19\n\tif (anchura1>alaSuperior){ \n\t\tfresado19 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+alaSuperior)\n\t}else{ \n\t\tfresado19 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+anchura1)\n\t}\n\t\n\t\n\tvar fresado20\n\tif (anchura3>alaSuperior){ \n\t\tfresado20 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca+alaSuperior)\n\t}else{ \n\t\tfresado20 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca+anchura3)\n\t}\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado2 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado4 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\t\t/*var line = new RLineEntity(document, new RLineData( fresado7 , fresado8 ));\n\t\top_fresado.addObject(line,false);*/\n\t\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado14 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado19 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\t/*var line = new RLineEntity(document, new RLineData( fresado12 , fresado17 ));\n\t\top_fresado.addObject(line,false);*/\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado20 ));\n\t\top_fresado.addObject(line,false);\n\t\n\n\t\n\t\n\t\n\t//anchura1\n\tif (anchura1>pliegueInferior){ \n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado2 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado21 = new RVector(pos.x+alaIzquierda+anchura1-pliegueInferior+margenFresado,pos.y)\n\t\t\tvar fresado22 = new RVector(pos.x+alaIzquierda+anchura1-pliegueInferior+margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t//anchura2 \n\tif (anchura2>pliegueInferior*2){ \n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado4 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+anchura1+pliegueInferior-margenFresado,pos.y)\n\t\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+anchura1+pliegueInferior-margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\t\n\t\t\tvar fresado25 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueInferior+margenFresado,pos.y)\n\t\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueInferior+margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\t\top_fresado.addObject(line,false);\n\n\t\t}\n\t}\n\t\n\t\n\t\n\t//anchura3 \n\tif (anchura3>pliegueInferior*2){ \n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueInferior-margenFresado,pos.y)\n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueInferior-margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\t\n\t\t\t//var fresado29 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueInferior+margenFresado,pos.y)\n\t\t\t//var fresado30 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueInferior+margenFresado,pos.y+alaInferior)\n\t\t\t//dibujarFresado_auxiliar(doc,fresado29,fresado30)\n\t\t}\n\t}\n\t\n\treturn op_fresado\n}", "constructor(\n parametroNombre,\n parametroApellido,\n parametroDni,\n parametroFechaNacimiento,\n parametroEmail,\n parametroTelefono\n ) {\n //crear las propiedades del objeto\n this.nombre = parametroNombre;\n this.apellido = parametroApellido;\n this.dni = parametroDni;\n this.fechaNacimiento = parametroFechaNacimiento;\n this.email = parametroEmail;\n this.telefono = parametroTelefono;\n }", "function _ConverteFeiticos() {\n _ConverteEscolasProibidas();\n _ConverteFeiticosConhecidos();\n _ConverteFeiticosSlots();\n}", "function Mascota(nombre, especie, raza='')//no importa el orden de los datos\n//se pone comillas en la raza para que no te salga undefined por si no lo sabemos\n\n{\n this.nombre = nombre\n this.especie = especie\n this.raza = raza//los parametros de una funcion constructora son parametros y pueden tener valores por defecto\n\n}", "function funcionario(nome, sobrenome) {\n this.nome = nome;\n this.sobrenome = sobrenome;\n}", "function dibujarFresado123(modelo,di,pos,document){\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior) \n\t\n\tvar fresado2 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior)\n\t\n\tvar fresado4 = new RVector(pos.x+alaIzquierda,pos.y) \n\t\n\t\n\t\n\t\n\t\n\tvar fresado6 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y) \n\t\n\t\n\t\n\t\n\tvar fresado9 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca)\n\tvar fresado10 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+alturaPlaca)\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar fresado12 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado2 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado12 ));\n\t\top_fresado.addObject(line,false);\n\t\n\n\n\t\n\n\t\n\t//anchura1\n\tif (anchura1>pliegueSuperior){ \n\t\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado18 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado19 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado20 = new RVector(pos.x+alaIzquierda+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado20 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\n\t//anchura2\n\tif (anchura2>pliegueSuperior*2){ \t\t\n\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado22 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado21 = new RVector(pos.x+alaIzquierda+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\n\n\treturn op_fresado; \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()", "saludar (){\n console.log(`Hola, me llamo ${this.nombreObj} ${this.apellidoObj}`)\n }", "constructor(nome, idade){\n this.nome = nome; //this. esta se referindo ao proprio objeto e nao a uma variavel em especifico\n this.idade = idade;\n }", "function dibujarFresado137(modelo,di,pos,document){\n\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\n\t//Puntos fresado\n\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior)\n\tvar fresado2 = new RVector(pos.x+alaIzquierda+anchura1-pliegueInferior,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda+anchura1+pliegueInferior,pos.y+alaInferior)\n\tvar fresado4 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueInferior,pos.y+alaInferior)\n\tvar fresado5 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueInferior,pos.y+alaInferior)\n\tvar fresado6 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueInferior,pos.y+alaInferior)\n\tvar fresado7 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueInferior,pos.y+alaInferior)\n\tvar fresado8 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior)\n\tvar fresado9 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior)\n\tvar fresado10 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado15 = new RVector(pos.x+alaIzquierda+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado16 = new RVector(pos.x+alaIzquierda+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado17 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado18 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\n\tvar fresado19\n\tif (anchura1>alaSuperior){ \n\t\tfresado19 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+alaSuperior)\n\t}else{ \n\t\tfresado19 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca+anchura1)\n\t}\n\t\n\t\n\tvar fresado20\n\tif (anchura4>alaSuperior){\n\t\tfresado20 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+alaSuperior)\n\t}else{ \n\t\tfresado20 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+anchura4)\n\t}\n\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado2 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado4 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado6 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado9 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado14 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado19 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado12 , fresado17 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado20 ));\n\t\top_fresado.addObject(line,false);\n\t\n\n\t\n\t\n\t\n\t\n\t//anchura1\n\tif (anchura1>pliegueInferior){ \n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado2 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado21 = new RVector(pos.x+alaIzquierda+anchura1-pliegueInferior+margenFresado,pos.y)\n\t\t\tvar fresado22 = new RVector(pos.x+alaIzquierda+anchura1-pliegueInferior+margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t}\n\t}\n\t\n\n\t//anchura2 \n\tif (anchura2>pliegueInferior*2){ \n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado4 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+anchura1+pliegueInferior-margenFresado,pos.y)\n\t\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+anchura1+pliegueInferior-margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado25 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueInferior+margenFresado,pos.y)\n\t\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+anchura1+anchura2-pliegueInferior+margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t\n\t//anchura3 \n\tif (anchura3>pliegueInferior*2){ \n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado6 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueInferior-margenFresado,pos.y)\n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+pliegueInferior-margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\n\t\t\t\n\t\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueInferior+margenFresado,pos.y)\n\t\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3-pliegueInferior+margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\t\top_fresado.addObject(line,false);\n\n\t\t}\n\t}\n\t\n\t//anchura4 //inferior\n\tif (anchura4>pliegueInferior){ \n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueInferior-margenFresado,pos.y)\n\t\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+anchura1+anchura2+anchura3+pliegueInferior-margenFresado,pos.y+alaInferior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\t\top_fresado.addObject(line,false);\n\n\t\t}\n\t}\n\t\n\t\n\n\treturn op_fresado; \n\n}", "function prox(){\n //varrer os inputs e armazenar em object\n console.log('bt proximo clicado');\n}", "procesarControles(){\n\n }", "function fungsiObject() {\n var x = {\n pesan: hallo(),\n }\n console.log(x.pesan);\n}", "function initInterfaz() {\n let status = this.g.options.status;\n\n function reflejarOpciones(opts) {\n for(const ajuste of this.ajustes.$children) {\n const input = ajuste.$el.querySelector(\"input\");\n if(opts[input.name]) {\n input.checked = true;\n input.dispatchEvent(new Event(\"change\"));\n }\n }\n }\n\n // Nos aseguramos de que al (des)aplicarse\n // un filtro o corrección se refleja en la interfaz.\n this.g.Centro.on(\"filter:* unfilter:*\", reflejarFiltro.bind(this));\n this.g.Centro.on(\"correct:* uncorrect:*\", reflejarCorreccion.bind(this));\n\n let opciones = {};\n if(status) {\n this.g.setStatus(); // Aplicamos el estado del mapa.\n // Lo único que queda por reflejar son las opciones\n // exclusivas de la interfaz virtual.\n for(const o in defaults_v) {\n const name = o.substring(0, 3);\n if(status.visual.hasOwnProperty(name)) {\n opciones[o] = status.visual[name];\n }\n }\n if(status.esp) this.selector.cambiarSidebar(status.esp);\n }\n else opciones = this.options;\n\n reflejarOpciones.call(this, opciones);\n\n // Si no se incluyen vacantes telefónicas, entonces\n // debe deshabilitarse la corrección por adjudicaciones no telefónicas.\n if(!this.options[\"correct:vt+\"]) {\n for(const f of this.filtrador.$children) {\n if(f.c.tipo === \"correct\" && f.c.nombre === \"vt\") {\n f.$children[0].disabled = true;\n break;\n }\n }\n }\n\n // Una vez aplicados todos los cambios iniciales, definimos\n // el disparador para que vaya apuntando en local los cambios de estado.\n // TODO: Esto quizás se pueda pasar a un sitio más adecuando, haciendo uso de statusset\n this.g.on(\"statuschange\", e => {\n if(localStorage && this.options.recordar) localStorage.setItem(\"status\", this.status);\n });\n\n this.g.fire(\"statusset\", {status: !!status});\n // Guardamos el estado final de la inicialización.\n this.g.fire(\"statuschange\");\n }", "function principal(){\n\n borraCanvas();\n\n console.log(ratonX + ' - ' + ratonY);\n\n for(i=0; i<numParticulas;i++){\n particulas[i].actualiza();\n }\n\n}", "constructor(nombre, apellido, altura) {\r\n this.nombre = nombre;\r\n this.apellido = apellido;\r\n this.altura = altura;\r\n }", "function dibujarFresado125(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\t\n\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior)\n\tvar fresado2 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1,pos.y+alaInferior)\n\tvar fresado4 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior)\n\tvar fresado5 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3,pos.y+alaInferior)\n\tvar fresado6 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior)\n\tvar fresado7 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4+pliegueDer,pos.y+alaInferior)\n\t\n\tvar fresado8 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+altura1)\n\tvar fresado9 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+altura1)\n\tvar fresado10 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1,pos.y+alaInferior+altura1)\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior+altura1)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior+altura2)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3,pos.y+alaInferior+altura2)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+altura2)\n\tvar fresado15 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4+pliegueDer,pos.y+alaInferior+altura2)\n\t\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado10 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado12 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado5 , fresado13 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado14 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado7 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado11 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado12 , fresado15 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\n\n\n\treturn op_fresado; \n\n\t\n\t\n}", "constructor(nombre,saldo,telefono,tipo){\n //Va hacia elconstructor Padre\n super(nombre,saldo);//hereda el constructor\n //no existen en el constructor padre\n this.telefono = telefono;\n this.tipo = tipo;\n }", "function Fruta(nombre){\n//para poner cosas\n\n this.setNombre = function(valor){\n\n nombre=valor;\n };\n this.getNombre = function(){\n return nombre;\n };\n\n\n\n\n\n}", "function inicia(){\n controlVisualizacion.iniciaControlVisualizacion();\n controlVisualizacion.creaHTMLGeneral(); \n controlVisualizacion.iniciaElementosDOM();\n\n //iniciamos con la escena 1\n controlVisualizacion.comenzamos();\n}", "function inicia(){\n controlVisualizacion.iniciaControlVisualizacion();\n controlVisualizacion.creaHTMLGeneral(); \n controlVisualizacion.iniciaElementosDOM();\n\n //iniciamos con la escena 1\n controlVisualizacion.comenzamos();\n}", "function Buscar() {\n //todos objBusqueda esta en los respectivos js\n var objConf = objConfiguracionGlobal;\n var objBus = objBusquedaGlobal;\n\n //recibe el valor id cama.js\n var valor = get(objBus.id);\n\n //url absoluta y agrega el contenido de la tabla a divContenedor\n fetchGet(`${objBus.url}/?${objBus.nombreParametro}=` + valor, function (res) {\n var respuesta = generarTabla(objConf, res);\n document.getElementById(\"divContenedor\").innerHTML = respuesta;\n\n })\n\n /* fetch(`${objBus.url}/?${objBus.nombreParametro}=` + valor)\n .then(res => res.json())\n .then(res => {\n var respuesta = generarTabla(objConf, res);\n document.getElementById(\"divContenedor\").innerHTML = respuesta;\n\n })\n */\n\n //pintar({\n // //ahora cambia esta linea\n // url: `${objBus.url}/?${objBus.nombreParametro}=` + valor,\n // id: objConf.id,\n // cabeceras: objConf.cabeceras,\n // propiedades: objConf.propiedades\n\n //}, objBus)\n\n}", "function Manusia(nama,umur){\n let manusia = {}; //* inisiasi objek biar nanti diisi\n manusia.nama = nama; //* menambahkan properti objek manusia dengan simbol (.) dan assign (=) dari parameter\n manusia.umur = umur;\n manusia.energi = 0; //* menambahkan properti objek manusia bukan dari parameter\n\n manusia.makan = function(porsi){ //* membuat method makan untuk manusia\n this.energi += porsi \n return this.nama + \" telah makan sebanyak \" + porsi\n }\n\n return manusia //* mereturn objek yang sudah diisi\n}", "function CarregamentoInicial() {\n _CarregaTabelaNormalizacaoStrings();\n _CarregaTraducoes();\n _CarregaTitulos();\n CarregaPersonagens();\n _CarregaDominios();\n _CarregaFamiliares();\n _CarregaRacas();\n _CarregaTemplates();\n _CarregaBotoesVisao();\n _CarregaAtributos();\n _CarregaTalentos();\n\n // Monta a tabela de armas e cria as opcoes dinamicamente.\n _CarregaTabelaArmasArmaduras();\n _CarregaPericias();\n _CarregaFeiticos();\n\n _CarregaHandlers();\n\n // Inicia o objeto de personagem.\n IniciaPersonagem();\n\n if (document.URL.indexOf('testes.html') != -1) {\n return;\n }\n var indice_igual = document.URL.indexOf('=');\n if (indice_igual != -1) {\n // carrega pelos parametros. Caso contrario, usara a entrada padrao.\n var json_entradas = decodeURIComponent(document.URL.slice(indice_igual + 1));\n gEntradas = JSON.parse(json_entradas);\n CorrigePericias();\n }\n AtualizaGeralSemLerEntradas();\n}", "constructor(nombre, apellido){\n this.nombre=nombre\n this.apellido= apellido\n }", "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 loadPano(panoObjects){\n console.log('loadPano', panoObjects)\n const filePath = panoObjects.panoPath \n let newPanoId = gPanos.length\n console.log(panoObjects.data)\n const panos = Object.values(panoObjects.data)\n console.log('panos', panos, typeof panos, panos.length)\n const panoBaseId = gPanos.length-1\n let panoIdNum \n Object.values(panos).forEach(pano => { \n // debugger\n panoIdNum = panoBaseId + Number(pano.id)\n console.log('pano', pano)\n // Populate New Pano with loaded values\n //panoIdNum = Number(pano.id) + panoBaseId - 1\n let curPano = gPanos[ panoIdNum -1 ]\n if (panoIdNum %2 == 0){\n curPano.elements.main.setAttribute('class', 'pano_a')\n } else {\n curPano.elements.main.setAttribute('class', 'pano_b');\n }\n \n curPano.elements.message.innerHTML = filePath\n curPano.elements.title.innerHTML = \"<b>Pano \"+pano.id+\"</b>\"\n // curPano.elements.addButton.value = \"Save\"\n curPano.elements.addButton.setAttribute(\"hidden\", true)\n curPano.elements.deleteButton.style.display = \"block\"\n curPano.elements.viewName.setAttribute('value', pano.name)\n curPano.elements.inputFile.setAttribute('value', pano.file)\n curPano.elements.posx.setAttribute('value', pano.x) \n curPano.elements.posy.setAttribute('value', pano.y) \n curPano.elements.posz.setAttribute('value', pano.z)\n // curPano.elements.inputFile.setAttribute('onchange', 'input_file-'+newPanoId)\n // Create new Pano \n // pano object {elements, values}\n let newPano = {\n elements: { \n main: curPano.elements.main, \n title: curPano.elements.title, \n message: curPano.elements.message, \n addButton: curPano.elements.addButton,\n deleteButton: curPano.elements.deleteButton,\n inputFile: curPano.elements.inputFile,\n viewName: curPano.elements.viewName,\n viewNameEnabled: curPano.elements.viewNameEnabled, \n camPosEnabled: curPano.elements.camPosEnabled, \n posx: curPano.elements.posx,\n posy: curPano.elements.posy,\n posz: curPano.elements.posz\n },\n values:{}\n }\n\n // gPanos.push(newPano);\n \n // Create New Pano panel\n createPano(gPanos.length)\n })\n\n // Enable Make Panos button\n const makePanoBtn = document.querySelector('#submit_button')\n makePanoBtn.disabled = false\n makePanoBtn.setAttribute('class', 'submit_button')\n console.log(makePanoBtn)\n }", "function Persona(nombre, apellido, altura, edad) {\n // Al prototipo o construtor le pasamos como parametros -\n // las key de los atributos que serian nombre, apellido-\n // y para guardarlo dentro de este objeto que se esta-\n // construllendo en la memoria, podemos hacer referencia-\n // a este objeto dentro de esta funcion con this-\n // this va hacer referencia al objeto que se acaba-\n // construir this.nombre = nombre, le asignamos nombre-\n // son dos variables distintas que reciben el nombre-\n // como parametro este mismo this lo repetimos para-\n // los demas parametros del prototipo\n // implicitamente JS retorna this cuando llamamos-\n // a esta funcion con la palabra new, sino utilizamos-\n // la palabra new hay otras formas mas engorrosas-\n // de hacerlo y con new es mas prolifico 🤣🤣🤣\n this.nombre = nombre;\n this.apellido = apellido;\n this.altura = altura;\n this.edad = edad;\n}", "function Oo(){}", "function ConverteEntradasParaPersonagem() {\n // Limpa tudo antes de comecar.\n PersonagemLimpaGeral();\n\n gPersonagem.modo_mestre = gEntradas.modo_mestre;\n gPersonagem.modo_visao = gEntradas.modo_visao;\n gPersonagem.nome = gEntradas.nome;\n gPersonagem.raca = gEntradas.raca;\n gPersonagem.template = gEntradas.template || '';\n _ConverteTamanho();\n\n gPersonagem.alinhamento = gEntradas.alinhamento;\n gPersonagem.divindade = gEntradas.divindade;\n gEntradas.classes.forEach(function(classe_entrada) {\n gPersonagem.classes.push({ classe: classe_entrada.classe, nivel: classe_entrada.nivel || 0 });\n });\n gPersonagem.dominios = PersonagemNivelClasse('clerigo') > 0 && gEntradas.dominios && gEntradas.dominios.slice(0) || [];\n _ConverteFamiliar();\n _ConverteCompanheiroAnimal();\n gPersonagem.niveis_negativos = gEntradas.niveis_negativos || 0;\n\n gPersonagem.experiencia = gEntradas.experiencia;\n\n // Equipamentos podem afetar todo o resto.\n _ConverteEquipamentos();\n\n // Dados de vida afetam quase tudo.\n _ConverteDadosVida();\n\n // Atributos dependem dos dados de vida (incrementos).\n _ConverteAtributos();\n\n // Talentos dependem dos dados de vida.\n _ConverteTalentos();\n\n _ConvertePontosVida();\n\n // Tem que ser depois de conferir pre requisitos.\n _ConvertePericias();\n\n _ConverteListaArmas();\n _ConverteListaArmaduras();\n\n // Estilos tem que vir apos a atualizacao das armas do gPersonagem, talentos e lista de armas.\n _ConverteEstilos();\n\n _ConverteHabilidadesEspeciais();\n\n // Feiticos.\n _ConverteFeiticos();\n\n gPersonagem.notas = gEntradas.notas;\n}", "function dibujarFresado139(modelo,di,pos,document){\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\t\n\t\n\t//Puntos fresado\n\tvar fresado1 = new RVector(pos.x,pos.y)\n\tvar fresado2 = new RVector(pos.x,pos.y+pliegueInferior)\n\tvar fresado3 = new RVector(pos.x-anchura3,pos.y+pliegueInferior)\n\tvar fresado4 = new RVector(pos.x-anchura3-anchura2,pos.y+pliegueInferior)\n\tvar fresado5 = new RVector(pos.x-anchura3-anchura2-anchura1,pos.y+pliegueInferior)\n\tvar fresado6 = new RVector(pos.x-anchura3-anchura2-anchura1,pos.y+pliegueInferior+alturaPlaca)\n\tvar fresado7 = new RVector(pos.x-anchura3-anchura2,pos.y+pliegueInferior+alturaPlaca)\n\tvar fresado8 = new RVector(pos.x-anchura3,pos.y+pliegueInferior+alturaPlaca)\n\tvar fresado9 = new RVector(pos.x,pos.y+pliegueInferior+alturaPlaca)\n\tvar fresado10 = new RVector(pos.x,pos.y+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado10 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado3 , fresado8 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado5 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t\n\t\treturn op_fresado;\n}", "function comportement (){\n\t }", "function dibujarFresado120(modelo,di,pos,document){\n\t\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tvar fresado1 = new RVector(pos.x,pos.y+alaInferior)\n\tvar fresado2 = new RVector(pos.x+anchura1,pos.y+alaInferior)\n\tvar fresado3 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior)\n\t\n\tvar fresado8 = new RVector(pos.x+anchura1+anchura2,pos.y)\n\t\n\tvar fresado9 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca)\n\tvar fresado10 = new RVector(pos.x+anchura1,pos.y+alaInferior+alturaPlaca)\n\tvar fresado11 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+alturaPlaca)\n\t\n\tvar fresado16 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\n\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado9, fresado11 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado10 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado16 ));\n\t\top_fresado.addObject(line,false);\n\t\n\n\t\n\t\n\t\n\t//anchura1\n\tif (anchura1>pliegueSuperior){ \n\t\tvar fresado17 = new RVector(pos.x,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado18 = new RVector(pos.x+anchura1-pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado18 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado19 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado20 = new RVector(pos.x+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado20 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t//anchura2\n\tif (anchura2>pliegueSuperior*2){ \n\t\tvar fresado23 = new RVector(pos.x+anchura1+pliegueSuperior,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado24 = new RVector(pos.x+anchura1+anchura2,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado22 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado21 = new RVector(pos.x+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado22 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\treturn op_fresado;\n}", "function PratoDoDiaComponent() {\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 serVivo(especie) {\n //this.especie = especie;\n this.especie = especie;\n }", "function Persona(nombre) {\n this.nombre = nombre;\n //Esto crea una funcion por objeto instanciado. No es correcto este enfoque.\n /* this.saluda = function () {\n console.log('Hola, me llamo', this.nombre);\n \n } */\n}", "function Interfaz(){}", "afficher(){\n this.racine.afficher()\n }", "function Oggetto(_id, _anno, _trachea, _prostata, _fegato, _stomaco, _pancreas, _cervello) {\n\n // DATI E COSTRUTTORE\n this.id = Number(_id); // < Number() converte in numero intero la stringa\n this.anno = _anno;\n this.trachea = Number(_trachea);\n this.prostata = Number(_prostata);\n this.fegato = Number(_fegato);\n this.stomaco = Number(_stomaco);\n this.pancreas = Number(_pancreas);\n this.cervello = Number(_cervello);\n\n\n\n this.mostra = function() {\n // disegna, cerchio o quadrato dipende dalla forma, colore dai dati passati\n fill(this.id, this.trachea, this.prostata, this.fegato);\n\n push();\n translate(grid - 0 + this.id * grid, height / 5) + this.dy\n\n //// TESTO DATI\n fill(255);\n \n textAlign(LEFT, CENTER);\n text(this.trachea + \" \" + \"Trachea\", -65, 80);\n fill(255);\n text(this.prostata + \" \" + \"Prostata\", -65, 180);\n fill(255);\n text(this.fegato + \" \" + \"Fegato\", -65, 280);\n fill(255);\n textAlign(LEFT, CENTER);\n text(this.stomaco + \" \" + \"Stomaco\", -65, 380);\n fill(255);\n text(this.pancreas + \" \" + \"Pancreas\", -65, 480);\n fill(255);\n text(this.cervello + \" \" + \"Cervello\", -65, 580);\n\n//////////\n\n rotate(PI / 2);\n\n\n /////////////////////////////////////////////////////////////DATI \n //ELLISSE BASE\n fill(\"#ffd700\");\n noStroke(0);\n ellipse(30, 35, this.trachea*this.trachea/6, this.trachea*this.trachea/6);\n\n //ELLISSE BASE\n fill(\"#FF6347\");\n noStroke(0);\n ellipse(150, 35, this.prostata*this.prostata/6, this.prostata*this.prostata/6);\n\n //ELLISSE BASE\n fill(\"#3CB371\");\n noStroke(0);\n ellipse(250, 35, this.fegato*this.fegato/6, this.fegato*this.fegato/6);\n\n\n\n //ELLISSE BASE\n fill(\"#00CED1\");\n noStroke(0);\n ellipse(350, 35, this.stomaco*this.stomaco/6, this.stomaco*this.stomaco/6);\n\n //ELLISSE BASE\n fill(\"#FFF8DC\");\n noStroke(0);\n ellipse(450, 35, this.pancreas*this.pancreas/6, this.pancreas*this.pancreas/6);\n\n //ELLISSE BASE\n fill(\"#FF00FF\");\n noStroke(0);\n ellipse(550, 35, this.cervello*this.cervello/6, this.cervello*this.cervello/6);\n\n\n ///////////////////////////////////////////////////\n\n\n\n //ANNO\n rotate(PI / 2);\n pop();\n noStroke();\n fill(255);\n textAlign(LEFT, CENTER);\n push();\n translate(grid - 70 + (this.id * grid), height / 8);\n textSize(30);\n textStyle(BOLD);\n text(this.anno, 0, 0);\n pop();\n\n\n\n\n ///////Trachea\n pop();\n noStroke();\n fill(255);\n textAlign(LEFT, CENTER);\n push();\n translate(grid - 210, 180);\n textSize(16);\n textStyle(BOLD);\n fill(\"#ffd700\");\n text(\"Trachea\", 30, 30);\n pop();\n\n\n ///////Prostata\n pop();\n noStroke();\n fill(255);\n textAlign(LEFT, CENTER);\n push();\n translate(grid - 210, 290);\n textSize(16);\n textStyle(BOLD);\n fill(\"#FF6347\");\n text(\"Prostata\", 30, 30);\n pop();\n\n\n ///////fegato\n pop();\n noStroke();\n fill(255);\n textAlign(LEFT, CENTER);\n push();\n translate(grid - 210, 390);\n textSize(16);\n textStyle(BOLD);\n fill(\"#3CB371\");\n text(\"Fegato\", 30, 30);\n pop();\n\n ///////stomaco\n pop();\n noStroke();\n fill(255);\n textAlign(LEFT, CENTER);\n push();\n translate(grid - 210, 490);\n textSize(16);\n textStyle(BOLD);\n fill(\"#00CED1\");\n text(\"Stomaco\", 30, 30);\n pop();\n\n ///////Pacreas\n pop();\n noStroke();\n fill(255);\n textAlign(LEFT, CENTER);\n push();\n translate(grid - 210, 590);\n textSize(16);\n textStyle(BOLD);\n fill(\"#FFF8DC\");\n text(\"Pancreas\", 30, 30);\n pop();\n\n ///////Cervello\n pop();\n noStroke();\n fill(255);\n textAlign(LEFT, CENTER);\n push();\n translate(grid - 210, 690);\n textSize(16);\n textStyle(BOLD);\n fill(\"#FF00FF\");\n text(\"Cervello\", 30, 30);\n pop();\n\n\n }\n}", "function MiClaseFunction(nombre) { //la forma antigua\n this.nombre = nombre;\n}", "function SetPieza(data)\n{\n var pieza = new Pieza();\n \n pieza.PiezaId = data.PiezaId;\n pieza.Nombre = data.Nombre;\n pieza.FormulaAncho = data.FormulaAncho;\n pieza.FormulaLargo = data.FormulaLargo;\n pieza.FormulaAncho2 = data.FormulaAncho;\n pieza.FormulaLargo2 = data.FormulaLargo;\n \n if(data.Activo == \"1\")\n {\n pieza.Activo = true;\n }\n else\n {\n pieza.Activo = false;\n }\n \n return pieza;\n}", "function cumpleanosDos(persona){\n\n return {\n \n ...persona,\n edad: persona.edad + 1\n\n }\n\n /* Aqui lo que hacemos es retornar un nuevo objeto con los atributos de la\n persona y podremos cambiar los atributos y agregar atributos nuevos\n \n Esto arreglara el problema de que cuando se invoque la funcion tambien se\n cambie el objeto, con este ejemplo retornara un objeto nuevo con la \n edad modificada y si vemos el objeto este no tendra ningun cambio\n \n \n */\n}", "function Go_Funciones()\n {\n if( g_listar == 1 )\n {\n Get_Marca_Producto();\n }\n \n }", "function Producto(nombre, precio){ //Producto(\"parametros\")\n this.nombre = nombre; //Acceder a los parametros por medio del this\n this.precio = precio; \n}" ]
[ "0.659673", "0.63725376", "0.63395274", "0.62690043", "0.62068874", "0.61483926", "0.61455524", "0.6131831", "0.61301297", "0.6109071", "0.61087435", "0.6108083", "0.60952175", "0.6094972", "0.60909075", "0.60650957", "0.606131", "0.6060889", "0.6057851", "0.6055717", "0.60502005", "0.6033354", "0.6026089", "0.601528", "0.60014886", "0.5992459", "0.59923404", "0.5985747", "0.59739536", "0.59703034", "0.5959756", "0.59571123", "0.5956827", "0.595156", "0.5943669", "0.59360707", "0.5929763", "0.59199667", "0.59156865", "0.5901992", "0.58966845", "0.5893023", "0.5892822", "0.5891158", "0.58830917", "0.5883081", "0.58759993", "0.5875404", "0.5873906", "0.58733016", "0.58674914", "0.5865682", "0.5862495", "0.58548397", "0.5853525", "0.5852679", "0.58453393", "0.5843831", "0.58382976", "0.5832272", "0.5830831", "0.5829628", "0.5824862", "0.58111024", "0.5807066", "0.5804858", "0.5798396", "0.57907736", "0.5780732", "0.57794505", "0.57739574", "0.5773935", "0.5771964", "0.57666683", "0.5761", "0.5756719", "0.5756719", "0.57403344", "0.5738842", "0.57355213", "0.5734082", "0.5730761", "0.5720092", "0.57128125", "0.57097244", "0.5707664", "0.5706468", "0.5702504", "0.57014334", "0.56977946", "0.5697422", "0.5690371", "0.5689997", "0.5687043", "0.5679218", "0.5671683", "0.566965", "0.566062", "0.566034", "0.56527376", "0.5650753" ]
0.0
-1
Automatizamos la caida de la pieza
function Tirar() { let ahora = Date.now(); let intervalo = ahora - tirar; if (intervalo > 500) { p.moverAbajo(); tirar = Date.now(); } if(gameOver == false) { requestAnimationFrame(Tirar); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function principal() {\n choquecuerpo();\n choquepared();\n dibujar();\n movimiento();\n \n if(cabeza.choque (comida)){\n comida.colocar();\n cabeza.meter();\n } \n}", "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 enviataxaaula(percent_aula, id_aula, id_projeto) {\n var envio = {}\n envio.id_contato = get_data('geral').id\n envio.id_aula = id_aula\n envio.percentual = percent_aula\n envio.email = get_data('geral').email \n envio.id_projeto = id_projeto \n\n set_tempo_ondemand(envio, (stst) => {\n //console.log('inserido - ' + id_aula + ' - ' + percent_aula + ' - ' + envio.id_contato)\n })\n}", "function generarCola(usuario,permiso) {\n\tconsole.log(\"generamos cola\");\n\tlet tabla = {\n\t\t\"datos\":[\n\t\t\t{\n\t\t\t\t\"Estado\":\"Genera permiso\",\n\t\t\t\t\"Contador\":0\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"Estado\":\"Pdte. Autoriz. Permiso\",\n\t\t\t\t\"Contador\":0\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"Estado\":\"Pdtes. Justificante\",\n\t\t\t\t\"Contador\":0\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"Estado\":\"Pdte. Autoriz. Justificante\",\n\t\t\t\t\"Contador\":0\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"Estado\":\"Ausencia finalizada\",\n\t\t\t\t\"Contador\":0\n\t\t\t}\n\t\t]\n\t};\n\tswitch (permiso) {\n\t\tcase \"Profesor\":\n\t\t\tpideDatos(\"peticion\",\"?usuario=\"+usuario,(data) => {\n\t\t\t\t\t//Convertimos a JSON los datos obtenidos\n\t\t\t\t\tlet json = JSON.parse(data);\n\t\t\t\t\t//Colocamos cada permiso en su lugar\n\t\t\t\t\tfor(let dato of json){\n\t\t\t\t\t\ttabla.datos[dato[\"estado_proceso\"]-1].Contador++;\n\t\t\t\t\t}\n\t\t\t\t\tprintDatos(tabla,\"#cola\");\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tbreak;\n\t\tcase \"Directivo\":\n\t\t\tpideDatos(\"peticion\",\"?\",\n\t\t\t\t(data) => {\n\t\t\t\t\t//Convertimos a JSON los datos obtenidos\n\t\t\t\t\tlet json = JSON.parse(data);\n\t\t\t\t\t//Colocamos cada permiso en su lugar\n\t\t\t\t\tfor(let dato of json){\n\t\t\t\t\t\tif (dato[\"estado_proceso\"]===1 || dato[\"estado_proceso\"]===3){\n\t\t\t\t\t\t\tif (dato.usuario===usuario){\n\t\t\t\t\t\t\t\ttabla.datos[dato[\"estado_proceso\"]-1].Contador++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttabla.datos[dato[\"estado_proceso\"]-1].Contador++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tprintDatos(tabla,\"#cola\");\n\t\t\t\t\t//json=JSON.parse(data);\n\t\t\t\t}\n\t\t\t);\n\n\n\t\t\tbreak;\n\t\tcase \"Admin\":\n\t\t\tpideDatos(\"peticion\",\"?\",\n\t\t\t\t(data) => {\n\t\t\t\t\t//Convertimos a JSON los datos obtenidos\n\t\t\t\t\tlet json = JSON.parse(data);\n\t\t\t\t\t//Colocamos cada permiso en su lugar\n\t\t\t\t\tfor(let dato of json){\n\t\t\t\t\t\ttabla.datos[dato[\"estado_proceso\"]-1].Contador++;\n\t\t\t\t\t}\n\t\t\t\t\tprintDatos(tabla,\"#cola\");\n\t\t\t\t\t//json=JSON.parse(data);\n\t\t\t\t}\n\t\t\t);\n\t\t\tbreak;\n\t}\n}", "async function telaRespostaRelatorioDeCaixa() {\r\n\r\n await aguardeCarregamento(true)\r\n\r\n await gerarGraficoDemonstrativoVendaPorItem();\r\n await gerarGraficoGanhoGastoMensal();\r\n await gerarGraficoQuantidadeVendas();\r\n await gerarGraficoDemonstrativoVendaPorItem();\r\n await tabelaDeRelatorioCaixa();\r\n await tabelaGeralDeRelatorios();\r\n\r\n await aguardeCarregamento(false)\r\n\r\n}", "function cargarActividad(){\n\n\tmostrarActividad(); \n\n\tcomienzo = getActual();\n\n}", "function anhadir() {\n k.anhadirDatos();\n}", "function refCabecera() {\n if (currentSetId == 'analitico') {\n resumAnali();\n } else if (currentSetId == 'sinoptico') {\n resumSinop();\n } else if (currentSetId == 'recorrido') {\n resumRecorr();\n } else if (currentSetId == 'bimanual') {\n resumBim();\n } else if (currentSetId == 'hom-maq') {\n resumHM();\n }\n}", "function addCamisetaCarrito() {\n\t\t\tvar id = usuarioService.getCarrito();\n\t\t\tvar clone = setupClone();\n\t\t\tif (clone.id) {\n\t\t\t\tcarritoService.putCustom(clone, id).then(camisetaService.setTshirtDefaults);\n\t\t\t} else {\n\t\t\t\tcarritoService.postCustom(clone, id).then(camisetaService.setTshirtDefaults);\n\t\t\t}\n\t\t}", "function activarHerramientaPerfil() {\n console.log(\"Activar herramienta perfil\");\n\n crearYCargarCapaLineaPerfil();\n activarControlDibujo();\n\n\n}", "constructor() {\n this.inicializar();\n this.generarSecuencia();\n this.siguienteNivel(); \n }", "async function agregarCancha(cancha) {\n const connectionMongo = await connection.getConnection();\n cancha.numero=Number(cancha.numero);\n cancha.precio=Number(cancha.precio);\n const canchaAgregada = await connectionMongo\n .db('canchitAppDB')\n .collection('canchas')\n .insertOne(cancha);\n await connectionMongo.close();\n return canchaAgregada;\n}", "function CorrigePericias() {\n for (var chave in tabelas_pericias) {\n var achou = false;\n for (var i = 0; i < gEntradas.pericias.length; ++i) {\n var entrada_pericia = gEntradas.pericias[i];\n if (entrada_pericia.chave == chave) {\n achou = true;\n break;\n }\n }\n if (!achou) {\n gEntradas.pericias.push({ 'chave': chave, pontos: 0 });\n }\n }\n}", "function limpiarCapas(){\n limpiarCapaRecorridos();\n limpiarCapaParadas();\n limpiarCapaNuevaRuta();\n limpiarCapturaNuevaRuta();\n limpiarCapaEstudiantes();\n}", "function Buscar() {\n //todos objBusqueda esta en los respectivos js\n var objConf = objConfiguracionGlobal;\n var objBus = objBusquedaGlobal;\n\n //recibe el valor id cama.js\n var valor = get(objBus.id);\n\n //url absoluta y agrega el contenido de la tabla a divContenedor\n fetchGet(`${objBus.url}/?${objBus.nombreParametro}=` + valor, function (res) {\n var respuesta = generarTabla(objConf, res);\n document.getElementById(\"divContenedor\").innerHTML = respuesta;\n\n })\n\n /* fetch(`${objBus.url}/?${objBus.nombreParametro}=` + valor)\n .then(res => res.json())\n .then(res => {\n var respuesta = generarTabla(objConf, res);\n document.getElementById(\"divContenedor\").innerHTML = respuesta;\n\n })\n */\n\n //pintar({\n // //ahora cambia esta linea\n // url: `${objBus.url}/?${objBus.nombreParametro}=` + valor,\n // id: objConf.id,\n // cabeceras: objConf.cabeceras,\n // propiedades: objConf.propiedades\n\n //}, objBus)\n\n}", "function _AtualizaAtaque() {\n ImprimeSinalizado(gPersonagem.bba, DomsPorClasse('bba'));\n ImprimeNaoSinalizado(gPersonagem.numero_ataques,\n DomsPorClasse('numero-ataques'));\n // Corpo a corpo.\n var span_bba_cac = Dom('bba-corpo-a-corpo');\n ImprimeSinalizado(gPersonagem.bba_cac, span_bba_cac);\n var titulo_span_bba_cac = {};\n titulo_span_bba_cac[Traduz('bba')] = gPersonagem.bba;\n titulo_span_bba_cac[Traduz('força')] = gPersonagem.atributos['forca'].modificador;\n titulo_span_bba_cac[Traduz('tamanho')] = gPersonagem.tamanho.modificador_ataque_defesa;\n TituloChaves(titulo_span_bba_cac, span_bba_cac);\n\n // Distancia.\n var span_bba_distancia = Dom('bba-distancia');\n ImprimeSinalizado(gPersonagem.bba_distancia, span_bba_distancia);\n var titulo_span_bba_distancia = {};\n titulo_span_bba_distancia[Traduz('bba')] = gPersonagem.bba;\n titulo_span_bba_distancia[Traduz('destreza')] = gPersonagem.atributos['destreza'].modificador;\n titulo_span_bba_distancia[Traduz('tamanho')] = gPersonagem.tamanho.modificador_ataque_defesa;\n TituloChaves(titulo_span_bba_distancia, span_bba_distancia);\n\n // Agarrar\n var span_bba_agarrar = Dom('bba-agarrar');\n ImprimeSinalizado(gPersonagem.agarrar, span_bba_agarrar);\n var titulo_span_bba_agarrar = {};\n titulo_span_bba_agarrar[Traduz('bba')] = gPersonagem.bba;\n titulo_span_bba_agarrar[Traduz('força')] = gPersonagem.atributos['forca'].modificador;\n titulo_span_bba_agarrar[Traduz('tamanho especial')] = gPersonagem.tamanho.modificador_agarrar;\n TituloChaves(titulo_span_bba_agarrar, span_bba_agarrar);\n}", "function fnc_child_cargar_valores_iniciales() {\n\n}", "function caricaElencoScritture() {\n var selectCausaleEP = $(\"#uidCausaleEP\");\n caricaElencoScrittureFromAction(\"_ottieniListaConti\", {\"causaleEP.uid\": selectCausaleEP.val()});\n }", "async function sicronizar() {\n await tccpoo.sync();\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 }", "criaCifraBd(){\n db.execute(`INSERT INTO cifra (nome,musica) VALUES (\"${this.nome}\", \"${this.cifra}\")`)\n }", "function ClickGerarAleatorioComum() {\n GeraAleatorioComum();\n AtualizaGeral();\n}", "function iniciar(){\n for(let i = 1; i <= 31; i ++){\n let dezena = diaSorteService.montaDezena(i);\n vm.dezenas.push(dezena);\n }\n vm.selecaoAtual = -1;\n }", "async function populateThematique() {\n for (const [key, value] of Object.entries(ThematiquesDATA)) {\n let thematique = new Thematique({ name: value.name });\n thematique.save();\n }\n return \"populate Thematique Done\";\n}", "function prepararejercicio(){\n resetearimagenejercicio();\n brillo = 0;\n contraste = 0;\n saturacion = 0;\n exposicion = 0;\n ruido = 0;\n difuminacion = 0; \n elegido = prepararejerciciorandom();\n Caman(\"#canvasejercicio\", imgejercicio , function () {\n this.brightness(elegido[0]);\n this.contrast(elegido[1]);\n this.saturation(elegido[2]); \n this.exposure(elegido[3]);\n this.noise(elegido[4]);\n this.stackBlur(elegido[5]); \n this.render();\n });\n}", "efficacitePompes(){\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 }", "executarPocao() {\n\t\tlet tempoPocaoResta = null; //quanto tempo a pocao fica ativo ateh desaparecer de novo (em milisegundos)\n\t\tlet pocaoMudaPers; //soh obrigatorio para pocoes que tenham desexecutar\n\n\t\tswitch (this._codPocao) {\n\t\t\tcase TipoPocao.DiminuirTamanhoPers:\n\t\t\t\ttempoPocaoResta = 7500;\n\t\t\t\tpocaoMudaPers = true;\n\t\t\t\tControladorJogo.pers.mudarTamanho(porcentagemSetTam); //50% do tamanho\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.MatarObjetos1Tiro:\n\t\t\t\t//mudanca na propria classe Obstaculo e Inimigo\n\t\t\t\ttempoPocaoResta = 3000;\n\t\t\t\tpocaoMudaPers = false;\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.RUIMPersPerdeVel:\n\t\t\t\ttempoPocaoResta = 5000;\n\t\t\t\tpocaoMudaPers = true;\n\t\t\t\tControladorJogo.pers.mudarVelocidade(porcentagemSetVelRuim);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.TiroPersMaisRapidoMortal:\n\t\t\t\ttempoPocaoResta = 8500;\n\t\t\t\tpocaoMudaPers = true;\n\n\t\t\t\t//porque depende do aviao do personagem, qual o index que vai ter o tiro bom\n\t\t\t\tconst indexTiroMelhor = ControladorJogo.pers.indexTiroMelhor;\n\t\t\t\t//mudar frequencia\n\t\t\t\tconst freqFuncAtual = ControladorJogo.pers.getFreqFuncAtirar(indexTiroMelhor);\n\t\t\t\tthis._frequenciaAtirarAntigo = freqFuncAtual.freq;\n\t\t\t\tfreqFuncAtual.freq = freqAtirarMaisRapidoMortal;\n\t\t\t\t//mudar infoTiro\n\t\t\t\tControladorJogo.pers.getControladorTiros(indexTiroMelhor).colocarInfoTiroEspecial(ArmazenadorInfoObjetos.infoTiro(\"TiroForte\", true));\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.MatarInimigosNaoEssenc:\n\t\t\t\tControladorJogo.controladoresInimigos.forEach(controladorInims => {\n\t\t\t\t\tif (!controladorInims.ehDeInimigosEssenciais)\n\t\t\t\t\t\t//soh mata os inimigos nao essenciais\n\t\t\t\t\t\tcontroladorInims.matarTodosInim();\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.ReverterTirosJogoInimDirInim:\n\t\t\t\tthis._reverterTirosContraInimigos(false);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.GanharPoucaVida:\n\t\t\t\tControladorJogo.pers.mudarVida(qtdGanhaPoucaVida);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.RUIMPersPerdeVida:\n\t\t\t\tControladorJogo.pers.mudarVida(-qtdPerdeVida);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.ReverterTirosJogoInimSeguirInim:\n\t\t\t\tthis._reverterTirosContraInimigos(true);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.DeixarTempoMaisLento:\n\t\t\t\ttempoPocaoResta = 5000;\n\t\t\t\tpocaoMudaPers = false;\n\t\t\t\t/* para deixar tempo mais lento:\n\t\t\t\t -> tiros tela. OK\n\t\t\t\t -> inimigos (incluindo tiros deles, atirar e inimigosSurgindo). OK\n\t\t\t\t -> obstaculos. OK\n\t\t\t\t -> Timers (aqui soh os que jah existem). OK\n\t\t\t\t ps1: verificar se nao existem Timers no PersonagemPrincipal\n\t\t\t\t ps2: verificar se nao podem ser criados freqFuncs sem ser do pers durante esse tempo\n\t\t\n\t\t\t\tresto:\n\t\t\t\t -> quando Timers forem criados. OK\n\t\t\t\t -> quando tiros(sem ser do personagem), obstaculos ou inimigos(freqFuncAtirar tambem) forem criados. OK\n\t\t\t\t*/\n\t\t\t\t//tiros sem dono\n\t\t\t\tControladorJogo.controladorOutrosTirosNaoPers.mudarTempo(porcentagemDeixarTempoLento);\n\t\t\t\t//suportes aereos\n\t\t\t\tControladorJogo.controladorSuportesAereos.suportesAereos.forEach(suporteAereo => suporteAereo.mudarTempo(porcentagemDeixarTempoLento));\n\t\t\t\t//inimigos (incluindo tiros deles e freqFuncAtirar)\n\t\t\t\tControladorJogo.controladoresInimigos.forEach(controladorInims =>\n\t\t\t\t\tcontroladorInims.mudarTempo(porcentagemDeixarTempoLento));\n\t\t\t\t//obstaculos\n\t\t\t\tControladorJogo.controladoresObstaculos.forEach(controladorObsts =>\n\t\t\t\t\tcontroladorObsts.mudarTempo(porcentagemDeixarTempoLento));\n\t\t\t\t//escuridao\n\t\t\t\tif (ControladorJogo.escuridao !== undefined)\n\t\t\t\t\tControladorJogo.escuridao.mudarTempo(porcentagemDeixarTempoLento);\n\t\t\t\t//Timers\n\t\t\t\tConjuntoTimers.mudarTempo(porcentagemDeixarTempoLento);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.RUIMTirosPersDirEle:\n\t\t\t\t//virar tiros contra criador\n\t\t\t\tControladorJogo.pers.virarTirosContraCriador(false);\n\t\t\t\t//diminuir a velocidade e o dano\n\t\t\t\tControladorJogo.pers.armas.forEach(arma => {\n\t\t\t\t\tarma.controlador.mudarQtdAndarTiros(porcentagemVelTiroSeVoltarPers);\n\t\t\t\t\tarma.controlador.mudarMortalidadeTiros(porcentagemMortalidadeTiroSeVoltarPers, true);\n\t\t\t\t});\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.GanharMuitaVida:\n\t\t\t\tControladorJogo.pers.mudarVida(qtdGanhaMuitaVida);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.PersMaisRapido:\n\t\t\t\ttempoPocaoResta = 7500;\n\t\t\t\tpocaoMudaPers = true;\n\t\t\t\tControladorJogo.pers.mudarVelocidade(porcentagemSetVel);\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.PersComMissil:\n\t\t\t\ttempoPocaoResta = 4500;\n\t\t\t\tpocaoMudaPers = true;\n\n\t\t\t\t//setar novo tiro\n\t\t\t\tControladorJogo.pers.getControladorTiros(indexArmaMissilPers).colocarInfoTiroEspecial(ArmazenadorInfoObjetos.infoTiro(\"TiroMissil\", true));\n\n\t\t\t\t//guardar frequencia e atirarDireto antigo antes de muda-los\n\t\t\t\tthis._informacoesNaoMissil = {\n\t\t\t\t\tfreq: ControladorJogo.pers.getFreqFuncAtirar(indexArmaMissilPers).freq,\n\t\t\t\t\tatirarDireto: ControladorJogo.pers.getConfigArma(indexArmaMissilPers).atirarDireto\n\t\t\t\t};\n\n\t\t\t\t//mudar freqAtirar e atirarDireto\n\t\t\t\tControladorJogo.pers.getFreqFuncAtirar(indexArmaMissilPers).freq = freqMissilPers;\n\t\t\t\tControladorJogo.pers.getFreqFuncAtirar(indexArmaMissilPers).setContadorUltimaEtapa(); //ele jah vai atirar missil em seguida\n\t\t\t\tControladorJogo.pers.getConfigArma(indexArmaMissilPers).atirarDireto = true;\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.TirarVidaTodosInim:\n\t\t\t\t//passa por todos os controladores de inimigos\n\t\t\t\tControladorJogo.controladoresInimigos.forEach(controladorInims =>\n\t\t\t\t\tcontroladorInims.tirarVidaTodosInim(qtdTiraVidaTodosInim));\n\t\t\t\tbreak;\n\n\t\t\tcase TipoPocao.CongelarInimigos:\n\t\t\t\ttempoPocaoResta = 5000;\n\t\t\t\tpocaoMudaPers = false;\n\t\t\t\t//congelar todos os inimigos\n\t\t\t\tControladorJogo.controladoresInimigos.forEach(controladorInims =>\n\t\t\t\t\tcontroladorInims.mudarCongelarTodosInim(true));\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow \"Esse codigo pocao nao existe!\";\n\t\t}\n\n\t\tif (this.mudaAviaoPersTemp)\n\t\t\t//para mudancas feitas em uma certa nave do personagem nao desexecutar em outra\n\t\t\tthis._numeroAviaoPers = ControladorJogo.pers.numeroAviao;\n\n\t\tif (tempoPocaoResta !== null) //se tem que desexecutar depois de um tempo, programa esse Timer (pode ser soh uma acao pontual)\n\t\t{\n\t\t\t//programa quando quando vai parar com esse pocao\n\t\t\tthis._timerDesexecutar = new Timer(() => { this.desexecutarPocao(); }, tempoPocaoResta, false, false /*pocao transcende o level (mesmo se o level acabar ainda vai ter que desexecutar)*/,\n\t\t\t\tpocaoMudaPers, { obj: this, atr: \"_tempoRestante\" }); //atualiza quanto tempo falta\n\n\t\t\tthis._tempoTotal = tempoPocaoResta;\n\t\t\t//this._tempoRestante = tempoPocaoResta; nao precisa setar tempoRestante porque Timer jah faz isso\n\t\t} else\n\t\t\tdelete this._timerDesexecutar;\n\t}", "async function hcgen(cedula) {\r\n let cedula_buscar = await Patient.find({ cedula: cedula }).exec();\r\n let vereificar = false;\r\n vereificar = isEmpty(cedula_buscar);\r\n if (vereificar == true) {\r\n console.log(\"genere codigo de historia clinica\");\r\n let hclinicaNew = await Hclinic.find({});\r\n hclinicaNew = hclinicaNew[0];\r\n let hclinicaNew1 = parseInt(hclinicaNew.h_clinica);\r\n hclinicaNew1 = hclinicaNew1 + 1;\r\n hclinicaNew1 = hclinicaNew1.toString();\r\n hclinicaNew1 = hclinicaNew1.concat(\"-actualice\");\r\n return hclinicaNew1;\r\n } else {\r\n console.log(\"envie codigo de historia clinica\");\r\n //cedula_buscar = cedula_buscar[0];\r\n return cedula_buscar;\r\n /*\r\n let hclinicaNew2 =\r\n cedula_buscar.h_clinica +\r\n \" \" +\r\n cedula_buscar.nombres +\r\n \" \" +\r\n cedula_buscar.apellidos;\r\n\r\n return hclinicaNew2;\r\n */\r\n }\r\n}", "async function cicloCarrusel() {\n let rutaActual = await fotosIniciales(), carruselActual = 0;\n carrusel[carruselActual].src = rutasCompletas[rutaActual];\n rutaActual += 1, carruselActual += 1;\n setInterval(() => {\n carrusel[carruselActual].src = rutasCompletas[rutaActual];\n rutaActual += 1, carruselActual += 1;\n if (rutaActual === rutasCompletas.length) {\n rutaActual = 0;\n }\n if (carruselActual === carrusel.length) {\n carruselActual = 0;\n }\n }, intervaloCambio);\n}", "async function coletar() {\n try {\n console.log(\"Coletando dados do irrigador\");\n\n let res = await axios.get(URL_DISPOSITIVO);\n if (!res?.data?.status)\n throw new Error(\"Erro durante a coleta dos dados do dispositivo\");\n let status = res.data.status;\n\n // Converte a ultima irrigacao para o tempo atual\n if (!status.ultimaIrrigacao) {\n status.ultimaIrrigacao = await getUltimaIrrigacao();\n } else {\n let agora = Date.now();\n status.ultimaIrrigacao = new Date(agora - status.time + status.ultimaIrrigacao);\n }\n status.time = new Date();\n console.log(`Ultima irrigacao: ${status.ultimaIrrigacao}`);\n\n // Armazena e publica os dados\n console.log(`Armazenando Status: ${JSON.stringify(status)}`);\n udb.insert(res.data);\n if (URL_PLANILHA)\n postPlanilha({ timestamp: new Date(), ...status });\n\n } catch (ex) {\n console.error(err); F\n }\n}", "function abreCaixa() {\n let mdCx = $(\"#md-caixa\");\n\n mdCx.on(\"hidden.bs.modal\", function () {\n onCaixaClosed();\n });\n\n caixa();\n }", "function SetPieza(data)\n{\n var pieza = new Pieza();\n \n pieza.PiezaId = data.PiezaId;\n pieza.Nombre = data.Nombre;\n pieza.FormulaAncho = data.FormulaAncho;\n pieza.FormulaLargo = data.FormulaLargo;\n pieza.FormulaAncho2 = data.FormulaAncho;\n pieza.FormulaLargo2 = data.FormulaLargo;\n \n if(data.Activo == \"1\")\n {\n pieza.Activo = true;\n }\n else\n {\n pieza.Activo = false;\n }\n \n return pieza;\n}", "async genAccomodations(){\n //Not yet implemented\n }", "function mascota(name){\n\treturn{\n\t\tcomida: 0,\n\t\tnombre: name,\n\t\tcomer: function comer(){\n\t\t\tthis.comida += 3\n\t\t}\n\t}\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 cargarDatos() {\n\n return new Promise(function (resolve, reject) {\n\n fs.readFile('./lib/anuncios.json', (err, data) => {\n\n if (err) reject(err);\n\n const anuncios = (JSON.parse(data)).anuncios;\n\n for (let i = 0; i < anuncios.length; i++) {\n let anuncio = new Anuncio(anuncios[i]);\n anuncio.save((err, anuncioCreado) => { \n if (err) {\n console.log('Error:', err);\n reject(err);\n }\n console.log('Anuncio ' + anuncioCreado.nombre + ' creado');\n });\n }\n\n resolve();\n });\n });\n}", "function ClickGerarComum() {\n GeraComum();\n AtualizaGeral();\n}", "function setCajasDefault(num) {\n for (var i = 0; i < self.datosProyecto.businesModel.length; i++) {\n var cajas = [];\n for (var x = 0; x < num; x++) {\n var idContador = x + 1;\n var caja = {\n id: idContador,\n titulo: \"\",\n descripcion: \"\",\n color: \"#bad9f9\",\n textoCheck: \"\"\n };\n cajas.push(caja);\n }\n self.datosProyecto.businesModel[i].cajas = cajas;\n }\n}", "function 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}", "cargarAuto({ item }) {\n let se = this.informacion_vehiculos.find(\n automovil => automovil.placa == item.placa\n );\n this.enEdicion = true;\n this.automovil = Object.assign({}, se);\n localStorage.setItem('automoviles', JSON.stringify(this.informacion_vehiculos));\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}", "async createRoutine() {\n const routine = new Routine(null, \"\", \"\", false, \"advanced\",\n {id: parseInt(localStorage.getItem(\"magicCategory\"))});\n\n await RoutineApi.createRoutine(routine);\n\n\n this.cycleIDArray = []; //limpio cycleIDArray\n\n let array = [\n {\n name: \"Calentamiento\", type: \"warmup\", order: 1\n }, {\n name: \"Ejercitación principal\", type: \"exercise\", order: 2\n },\n {name: \"Enfriamiento\", type: \"cooldown\", order: 3}\n ];\n\n let i;\n let cycleID = [];\n for (i = 0; i < 3; i++) {\n cycleID[i] = await CycleStore.createCycle(routine.id, array[i].name, array[i].type, array[i].order);\n }\n\n\n this.cycleIDArray = cycleID;\n return routine.id;\n }", "function inicializarArrayResultados() {\r\n for(var i=1;i<=totalPreguntas;i++) {\r\n resultadoEncuesta[\"p\"+i+\"-alt\"]=[0,0,0,0];\r\n }\r\n}", "function enviarCampaniasFirebase(event){\n // A soliciud de Oscar primero generamos el auth\n //var email = event.target.correo.value;\n\n //console.log(email);\n var CodigoCamp;\n // Obtenemos la sigla de la Empresa para generar el codigo de Campaña Apropiado\n // La forma del codigo sera: SIGLA-CONTADOR ej.- INTI-1\n //refEmpresa= firebase.database().ref().child(\"Empresas\").orderByChild('id_empresa').equalTo(event.target.id_empresa.value);\n\t//CodigoCamp = refEmpresa.child(\"Sigla\");\n\t\n\n\n\t//console.log(refEmpresa);\n \n console.log('ANTES DE LA ECATOMBE');\n event.preventDefault();\n\n CodigoCamp = sigla+'-'+codigoCampania(4,'1234567890'); // GENERA LA CLAVE de 4 caracteres (solo numeros)\n var Estado = 'AC';\n switch(modo){\n case CREATE:\n\t\t \t{\n\t\t\t \trefCampanias.push({\n\t\t\t id_empresa: event.target.id_empresa.value,\n\t\t\t nombre_empresa: event.target.nombre_empresa.value,\n\t\t\t codigo: CodigoCamp, //event.target.codigo.value,\n\t\t\t nombre_campania: event.target.nombre_campania.value,\n\t\t\t fecha_inicio: event.target.fecha_inicio.value,\n\t\t\t fecha_fin: event.target.fecha_fin.value,\n\t\t\t estado: Estado\n\t\t\t \t});\n\t\t\t \tconsole.log('Ingreso a la creacion');\n\t\t\t }\n\n \t\tbreak;\n \t\tcase UPDATE:\n \t\t\t{\n\t \t\t\trefCampaniaEditar.update({\n\t\t \t\t\tnombre_campania: event.target.nombre_campania.value,\n\t\t\t\t fecha_inicio: event.target.fecha_inicio.value,\n\t\t\t\t fecha_fin: event.target.fecha_fin.value\n\t \t\t\t});\n\t \t\t\tmodo = CREATE;\n\t \tdocument.getElementById(\"boton-enviar-campania\").value = CREATE;\n\t \tconsole.log('Ingreso a UPDATE');\n\t }\n \t\tbreak;\n \t}\n // Reseteo el formulario\n console.log('antes del reset');\n formCampanias.reset();\n console.log('despues del reset');\n //window.location.href = 'http://www.ineedserv.com/ineed/web/index.php?r=site/empresa&emp='+event.target.id_empresa.value;\n\n}", "function funZaIniciranjeArtikalaUBazu(){\nvar d = new Date();\nvar t = d.getTime();\nvar counter = t;\n/* FUKCIJA ZA OCITAVANJE VRIJEDNOSTI IZ SELECTA */\nvar e = document.getElementById(\"txtOptionJedinicaMjere\");\nvar jedinicaMjere = e.options[e.selectedIndex].value;\nvar text = e.options[e.selectedIndex].text;\nconsole.log(text);\nconsole.log(jedinicaMjere);\n/* FUKCIJA ZA OCITAVANJE VRIJEDNOSTI IZ SELECTA */\n\nvar rotRef = firebase.database().ref().child('Artikli/' + counter);\n\nconsole.log(counter);\ncounter+=1;\nconsole.log(counter);\n\nrotRef.set({\n NazivArtikla: $('#txtNazivArtikla').val(),\n NazivDobavljaca: $('#txtNazivDobavljaca').val(),\n Barkod: $('#txtBarkodProizvoeda').val(),\n UkaznaCijena: $('#txtUlaznaCijenaProizvoda').val(),\n OpisArtikla: $('#txtOpisArikla').val(),\n JedinicaMjere : jedinicaMjere,\n JedinstvenaSifraArtikla: counter,\n});\n }", "adicionarCupom(codigo) {\n if (codigo === 'camp50') {\n this.cupom = 50 / 100;\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 BusquedaAuto(ObBA,IdControl,MultiSelec,urlCaida,ConsultaCampos,IdForm,CamposValidacion,NameCampo){\n \n BusquedaAccion(ObBA,IdControl,MultiSelec,urlCaida,ConsultaCampos,IdForm,CamposValidacion,NameCampo);\n}", "function ChangeEscolaProibida(chave_classe, indice, dom) {\n AtualizaGeral();\n}", "function generar(){\r\n //con estos datos obtenemos los datos de los clientes, y los ids de los productos\r\n var cc=getId(\"cedulacliente\");\r\n \r\n var idp=getId(\"idp\");\r\n var idp2=getId(\"idp2\");\r\n var idp3=getId(\"idp3\");\r\n //un arreglo que agregas los ids\r\n ides.push(idp+idp2+idp3);\r\n\r\n for(var i=0;i<=ides.length;i++){\r\n //esta variable accede a los productos\r\n var producto= firebase.database().ref('producto/'+i);\r\n producto.on('value',function(data){\r\nvar datos=data.val();\r\ndesc=datos.description;\r\n });\r\nconsole.log(desc);\r\n }\r\n //esta variable accede la nodo que contiene los \"clientes\"\r\n // var cliente= firebase.database().ref('clientes/'+cc);\r\n \r\n //con este metodo obtengo el objetp del cliente debido a que necesito\r\n // cliente.on('value',function(parameters){\r\n //aqui estoy guardando el objeto del cliente\r\n //var data=parameters.val();\r\n //ced=data.cedula;\r\n //console.log(ides);\r\n //});\r\n\r\n\r\n //ahora voy a llamar al producto que estoy insertando\r\n\r\n\r\n}", "function actualizar_esquema_comision(){\n\t\tenviarFormulario(\"#form_esquema_comision_actualizar\", 'EsquemaComision/actualizar_esquema_comision', '#cuadro4');\n\t}", "procesarControles(){\n\n }", "constructor() {\n //vamos a poner un setTimeout para que no arranque ni bien el usuario pulsa el boton\n this.inicializar();\n this.generarSecuencia();\n setTimeout(this.siguienteNivel,500);\n }", "logic(data) {\n\n firebase.database().ref('data/gamemode/' + currentGamemode.name).once(\"value\").then(function(snapshot) {\n\n var GamemodeInfo = snapshot.val();\n\n var keys = Object.keys(GamemodeInfo.palabra)\n let palabraComun = GamemodeInfo.palabra[keys[keys.length * Math.random() << 0]];\n let palabraEspia = GamemodeInfo.espia;\n\n let juego = {};\n\n //Update de que se esta creando la partida -- Enviar a firebase, para que todos se queden bloquedados (TODO)\n let numJugadores = Object.keys(data.users).length;\n\n //El minimo de espias siempre es 1;\n let numeroEspias = Math.floor(numJugadores * 10 / 100) < 1 ? 1 : Math.floor(numJugadores * 10 / 100);\n let espiasOrganitation = new Array(numJugadores);\n\n for (let i = 0; i < numeroEspias; i++) {\n\n let changed;\n do {\n changed = false;\n let position = Math.floor(Math.random() * numJugadores);\n if (espiasOrganitation[position] != \"ESPIA\") {\n espiasOrganitation[position] = \"ESPIA\";\n changed = true;\n }\n\n } while (!changed);\n }\n let index = 0;\n let positionToStart;\n\n\n if (numJugadores > 1) {\n\n positionToStart = Math.floor(Math.random() * numJugadores);\n espiasOrganitation[positionToStart] += \"*EMPEZAR\";\n }\n\n for (let userID in data.users) {\n\n if (espiasOrganitation[index] == undefined || !espiasOrganitation[index].includes(\"ESPIA\")) {\n espiasOrganitation[index] = \"APALABRADO\";\n }\n let word = (espiasOrganitation[index] == \"APALABRADO\") ? palabraComun : palabraEspia;\n let key = data.users[userID].user.Id;\n\n juego[key] = { \"rol\": espiasOrganitation[index], \"palabra\": word };\n index++;\n\n }\n\n //Eliminamos las partidas anteriores\n firebase.database().ref('rooms/' + currentGamemode.roomId + '/game').remove();\n //Añadimos la nueva partida\n firebase.database().ref('rooms/' + currentGamemode.roomId + '/game').set(juego);\n });\n\n }", "materializar() {\n\t\t// Se pueden agregar comprobaciones para evitar que haya campos en blanco cuando se guarda.\n\t\tthis.guardarObjetoEnArchivo();\n\t}", "function nombreCliente(){\n //obtenes el nombre del input.\n const nombre = document.querySelector('#nombre').value ;\n //Agregarlo a cita\n cita.nombre = nombre;\n}", "irAlBoss(){\n this.salaActual = new Sala(this.salaActual.jugador, this.salaActual, posicionSala.bossBatle, \"Boss.txt\",5, this.counterId++);\n }", "function init(){ // función que se llama así misma para indicar que sea lo primero que se ejecute\n carreraCtrl.carreras = carreraService.getCarreras();\n }", "function consola (){\r\n bienvenida_random();\r\n ayuda();\r\n}", "function cargarFondo()\n{\n console.log(\"Cargo Fondo\");\n fondo.cargaOK= true; \n dibujar();\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}", "function iniciar(){\n for(var i = 1; i <= 31; i ++){\n var dezena = diaSorteService.montaDezena(i);\n vm.dezenas.push(dezena);\n }\n }", "function obtenerPacientes() {\n return pacientes;\n}", "function caricaFatturaAssociata() {\n return $.postJSON(baseUrl + \"_ottieniFatturaAssociata.do\", {}, function(data) {\n\n if (data.documentoSpesa && data.documentoSpesa.uid !== 0) {\n impostaDatiFatturaAssociata(null, {params: {fattura: data.documentoSpesa, quote: data.listaSubdocumentoSpesa}});\n }\n });\n }", "function capturaDados(ids) {\n\n var tm = document.getElementById(\"tipoDeManejo\");\n var lt = document.getElementById(\"combo-idlotes\");\n\n var dataManejo = document.getElementById(\"dataManejo\").value;\n var dataProximo = document.getElementById(\"dataProximo\").value;\n var tipoDeManejo = tm.options[tm.selectedIndex].value;\n var anotacoes = document.getElementById(\"anotacoes\").value;\n var viaDeAplicacao = document.getElementById(\"viaDeAplicacao\").value;\n var tratamento = document.getElementById(\"tratamento\").value;\n var insumoUtilizado = document.getElementById(\"insumoUtilizado\").value;\n var custoUnitarioInsumo = document.getElementById(\"custoUnitarioInsumo\").value;\n var quantInsumo = document.getElementById(\"quantInsumo\").value;\n var custosAdicionais = document.getElementById(\"custosAdicionais\").value;\n var lote = lt.options[lt.selectedIndex].value;\n\n //var idGado = capturaIdGado();\n console.log(\"AND Now This!\")\n\n\n //Montando o objeto\n var objeto = {\n dataManejo: dataManejo,\n dataProximo: dataProximo,\n tipoDeManejo: tipoDeManejo,\n anotacoes: anotacoes,\n viaDeAplicacao: viaDeAplicacao,\n tratamento: tratamento,\n insumoUtilizado: insumoUtilizado,\n custoUnitarioInsumo: custoUnitarioInsumo,\n quantInsumo: quantInsumo,\n custosAdicionais: custosAdicionais,\n lote: {\n id: lote\n },\n rebanhoManejado: ids\n }\n\n\n //Fazer requisicao para fluxo de caixa como Saida\n var multip = custoUnitarioInsumo * quantInsumo;\n var calculoSaida = parseFloat(multip) + parseInt(custosAdicionais);\n\n console.log(\"CALCULO => \" + calculoSaida);\n enviaValorCaixa(calculoSaida, tipoDeManejo);\n\n\n console.log(JSON.stringify(objeto));\n enviaManejo(JSON.stringify(objeto));\n\n}", "function CrearCuento(){\n SeleccionLibro();\n BorrarPaginasCuento();\n\n var Cuento = {Nombre:$('#InputNombre').val(),Coleccion:$('#SelectorColecciones').val()};\n InsertarCuentos(Cuento);\n GetIDCuento(Cuento);\n CargarCuentos();\n}", "function muestraEjercicio(){\n document.getElementById(\"ejercicioDos\").innerHTML = \"La cadena mas larga es: \"+inicializa();\n}", "function criarAtualiza(){\n\t\n\t//Faz o cursor custom seguir o mouse\n\tcursor.x = stage.mouseX + cursor.regX - 20;\n\tcursor.y = stage.mouseY + cursor.regY - 20;\n\tcursor.scaleX = cursor.scaleY = 0.7;\n\t\n\tambNum.text = (contador + 1) + \" / 10\";\n\t\n\tif(criarArea.contains(retornar_bttn)){\n\t\tanimal_atual.rotation = 350;\n\t\tanimal_atual.x = 150;\n\t\tanimal_atual.y = 465;\n\t}\n\n}", "function cargarFondo()\n{\n fondo.cargaOK = true;\n dibujar();\n}", "function creaBoxOffertaAccettata(id,offerta,ifOspitato){\r\n offerteAccettate[id] = offerta;\r\n console.log(\"Offerta accettata: \" + id);\r\n \r\n var altroUtente;\r\n if(ifOspitato === \"Ospitato\") altroUtente = offerta.ospitante;\r\n else altroUtente = offerta.ospitato;\r\n\r\n var nuovaOffertaAccettata = $(\".div-offerta-accettata:first\").clone();\r\n nuovaOffertaAccettata.children(\".offerta-accettata-partita\").text(stringPartita(offerta.homeTeam,offerta.awayTeam));\r\n nuovaOffertaAccettata.children(\".offerta-accettata-id\").val(offerta._id + \"-offerta-accettata\");\r\n if(ifOspitato === \"Ospitante\"){\r\n nuovaOffertaAccettata.children(\".offerta-accettata-tipologia\").text(\"Hai ospitato:\");\r\n }\r\n else{\r\n nuovaOffertaAccettata.children(\".offerta-accettata-tipologia\").text(\"Sei stato ospitato da:\");\r\n }\r\n nuovaOffertaAccettata.children(\".offerta-accettata-altro\").text(altroUtente);\r\n\r\n $(nuovaOffertaAccettata).appendTo(\"#offerte-accettate\");\r\n}", "async function limpiarAcuifero() {\n /**\n * Limpia su porpia capa\n */\n map.off();\n map.remove();\n crearMapa();\n /**\n * Se limpia la tabla de acuiferos\n */\n tablaOC.clear().draw();\n tablaEst.clear().draw();\n tablaMun.clear().draw();\n tablaAcu.clear().draw();\n $(\"#pantalla\").hide();\n $(\"#pantalla2\").hide();\n $(\"#divPrioridad\").hide();\n $(\"#botonMapa\").hide();\n document.getElementById(\"download_shapefile\").style.display = \"none\";\n}", "function agregarCita(e) {\n\n e.preventDefault();\n // extraer la información del objeto de citas\n const {mascota,propietario,telefono,fecha,hora,sintomas} = citaObj;\n\n // validar\n if(mascota === '' || propietario === '' || telefono === '' || fecha === '' || hora === '' || sintomas === '') {\n ui.imprimirAlerta('Todos los campos son obligatorios','error');\n return;\n }\n\n if(editando) {\n // imprimir mensaje de agregado\n ui.imprimirAlerta('La cita se editó correctamente');\n \n // pasar el objeto de la cita a ediccion\n administrarCitas.editarCita({...citaObj});\n\n // regresar el botón a su estado original\n form.querySelector('button[type=\"submit\"]').textContent = 'Crear cita';\n\n // quitar modo edición\n editando = false;\n } else {\n // crear id único\n citaObj.id = Date.now();\n\n // agregando una nueva cita\n administrarCitas.crearCita({...citaObj});\n\n // imprimir mensaje de agregado\n ui.imprimirAlerta('La cita se agregó correctamente');\n }\n\n \n \n // reiniciar objeto de validación\n reiniciarObjeto();\n\n // reiniciar formulario\n form.reset();\n\n // mostrar html de las citas\n ui.imprimirCitas(administrarCitas);\n}", "function obtieneTipoFacturacion() {\n\t\tgenerarArrayDiasSemana();\n\t\tgenerarArrayMeses();\n\t\tset('frmGenerarCronograma.accion', 'obtieneTiposFacturacion');\n\t\tset('frmGenerarCronograma.conectorAction', 'LPMantieneCronograma');\n\t\tset('frmGenerarCronograma.hMarca', get('frmGenerarCronograma.cbMarcas'));\n\t\tset('frmGenerarCronograma.hCanal', get('frmGenerarCronograma.cbCanales'));\n\t\tset('frmGenerarCronograma.hCodPeriodo', get('frmGenerarCronograma.txtCodPeriod'));\n\t\tset('frmGenerarCronograma.hlblActiFija',GestionarMensaje('1002'));\n\t\tset('frmGenerarCronograma.hlblActiRefe',GestionarMensaje('1003'));\n\t\t//if (get('frmGenerarCronograma.casoDeUso') != 'Fase 2')\n\t\t\teval(\"frmGenerarCronograma.oculto = 'N'\");\n\t\tenviaSICC('frmGenerarCronograma');\n\t}", "function compraArma(i){\n\n if(mochilaArmas.length == 0){\n if(jogador1.grana < mercadoArmas[i].preco){\n console.log('Falta din!!!')\n }else{\n mochilaArmas.push(mercadoArmas[i])\n \n jogador1.grana -= mercadoArmas[i].preco \n }\n }else{\n for(let j in mochilaArmas){\n if(i == mochilaArmas[j].id){\n console.log('Já tem esta arma!')\n return\n }\n }\n if(jogador1.grana < mercadoArmas[i].preco){\n console.log('Falta din!!!')\n }else{\n jogador1.nArmas++;\n mochilaArmas.push(mercadoArmas[i])\n //localStorage.setItem(`arma${i}`, JSON.stringify(mercadoArmas[i]))\n jogador1.grana -= mercadoArmas[i].preco \n }\n }\n gravarLS('grana', jogador1.grana); \n mostraInfoJogador()\n}", "function IndicadorRangoEdad () {}", "async function Kosarajus(){}", "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 }", "async function busca() {\n try {\n const doc = await daoAlumno.doc(id).get();\n if (doc.exists) {\n const data = doc.data();\n forma.foto_file.src = await urlStorage(id);\n forma.matricula.value = data.matricula || \"\";\n forma.nombre.value = data.nombre || \"\";\n forma.correo.value = data.correo || \"\";\n forma.status.value = data.status || \"\";\n forma.telefono.value = data.telefono || \"\";\n forma.fecha.value = data.fecha || \"\";\n forma.addEventListener(\"submit\", guarda);\n forma.eliminar.addEventListener(\"click\", elimina(data.correo));\n } else {\n throw new Error(\"No se encontró.\");\n }\n } catch (e) {\n muestraError(e);\n muestraUsuarios();\n }\n}", "function accionBuscar ()\n {\n configurarPaginado (mipgndo,'DTOBuscarMatricesDTOActivas','ConectorBuscarMatricesDTOActivas',\n 'es.indra.sicc.cmn.negocio.auditoria.DTOSiccPaginacion', armarArray());\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 asignarManejadores() {\n traerPersonajes();\n}", "function ClickGastarFeitico() {\n AtualizaGeral();\n}", "constructor(ojos, boca, extremidades, duenio) {\n super(ojos, boca, extremidades);\n this.duenio = duenio;\n this.estaDomesticado = true;\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 cumpleanos(persona){\n persona.edad += 1\n\n}", "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 conArroz(plato) {\n return new Promise( (resolve, reject) => {\n setTimeout( () => {\n resolve( plato + ' arroz' );\n }, 500 );\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 principal(){\n\n borraCanvas();\n\n console.log(ratonX + ' - ' + ratonY);\n\n for(i=0; i<numParticulas;i++){\n particulas[i].actualiza();\n }\n\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 ini() {\n\n // --- Select empresa Mae ---- //\n $('#empresaMaeSelect') //select data from EmpresaMae\n\n $('#btnAddEmpresaMae') // add functions to btnEmpresaMae\n\n $('#nomeRefood') // inherit Data from Refood module DB\n\n\n //TODO $('#contactinput') --> a fazer pelo Ricardo Castro\n // Tudo neste grupo é feito com o plugIn Contacts.js do RCastro\n\n // $('contact')//\n\n\n\n\n // ---- Plugin HORÁRIO ---- // Insert PickUp Schedule\n\n $('#horarioInicio').clockpicker({\n placement: 'top',\n align: 'left',\n autoclose: true\n });\n }", "function ClickGerarAleatorioElite() {\n GeraAleatorioElite();\n AtualizaGeral();\n}", "function crearTablaAscensorValoresCabina(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_valores_cabina (k_codusuario,k_codinspeccion,k_coditem,n_calificacion,v_calificacion,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores cabina...Espere\");\n console.log('transaction creada ok');\n });\n}", "cocina(){}", "function vaciarCesta(){\n //borrar los productos guardados en el array\n arrayCesta=[];\n //Renderizar cambios\n renderCesta();\n calcularTotal();\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 cargar_exceso(uid_condominio, uid_condomino) {\n\n // console.log(uid_condominio, uid_condomino)\n\n condomino_ref.child(uid_condominio).child(uid_condomino).once(\"value\").then(function (snapshot) {\n\n if (snapshot.val()) {\n\n var condomino = snapshot.val();\n\n var dt = new Date();\n var month = dt.getMonth() + 1;\n var year = dt.getFullYear();\n var fecha_actual = \"0\" + month + \"-\" + year;\n\n var costo_cuota_agua = condomino.costo_cuota_agua_exceso;\n var cuota_agua = condomino.cuota_agua;\n\n\n console.log('||---------------------------------||')\n console.log(snapshot.key)\n console.log(condomino.contador)\n console.log(condomino.costo_cuota_agua)\n console.log(condomino.costo_cuota_agua_exceso)\n console.log(condomino.cuota_agua)\n console.log('||---------------------------------||')\n\n if (snapshot.key == uid_condomino) {\n arrayListCuotaAgua.push({\n id_condomino: snapshot.key,\n valor: condomino.costo_cuota_agua\n });\n\n $scope.cuotasAgua = arrayListCuotaAgua\n\n }\n\n\n\n var contador = condomino.contador;\n var costoCuotaAgua = condomino.costo_cuota_agua;\n var costoCuotaAguaExceso = condomino.costo_cuota_agua_exceso;\n var limite = condomino.cuota_agua;\n var contador = condomino.contador;\n }\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 }", "function MetaCaixaInit(){\n //S'executa al carregar-se la pàgina, si hi ha metacaixes,\n // s'assignen els esdeveniments als botons\n //alert(\"MetaCaixaInit\");\n \n var i=0 //Inicialitzem comptador de caixes\n for (i=0;i<=9;i++){\n var vMc = document.getElementById(\"mc\"+i);\n if (!vMc) break;\n //alert(\"MetaCaixaInit, trobada Metacaixa mc\"+i);\n \n var j=1 //Inicialitzem comptador de botons dins de la caixa\n var vPsIni = 0 //Pestanya visible inicial\n for (j=1;j<=9;j++){\n var vBt = document.getElementById(\"mc\"+i+\"bt\"+j);\n if (!vBt) break;\n //alert(\"MetaCaixaInit, trobat botó mc\"+i+\"bt\"+j);\n vBt.onclick = MetaCaixaMostraPestanya; //A cada botó assignem l'esdeveniment onclick\n //alert (vBt.className);\n if (vBt.className==\"mcBotoSel\") vPsIni=j; //Si tenim un botó seleccionat, en guardem l'index\n }\n //alert (\"mc=\"+i+\", ps=\"+j+\", psini=\"+vPsIni );\n if (vPsIni == 0) { //Si no tenim cap botó seleccionat, n'agafem un aleatòriament\n vPsIni = 1+Math.floor((j-1)*Math.random()) ;\n //alert (\"Activant Pestanya a l'atzar; _mc\"+i+\"bt\"+vPsIni +\"_\");\n document.getElementById(\"mc\"+i+\"ps\"+vPsIni).style.display = \"block\";\n document.getElementById(\"mc\"+i+\"ps\"+vPsIni).style.visibility = \"visible\";\n document.getElementById(\"mc\"+i+\"bt\"+vPsIni).className=\"mcBotoSel\";\n } \n }\n }", "function inizializzaDati(oggetto){\r\n \"use strict\";\r\n\tsessionStorage.numTurnoP = Number(sessionStorage.numTurnoP) + 1;\r\n\tnomeGruppo = oggetto.group.name;\r\n //Prelevo i dati dal server, e salvo i dati\r\n\r\n //Variabile per il numero di camion\r\n var numeroCamion = oggetto.group.transportPawns.length;\r\n\r\n caricaPillsCamion(numeroCamion);\r\n \r\n \r\n for(var j=0; j<numeroCamion; j++){\r\n var camion = new Object();\r\n\t camion.pawnID = oggetto.group.transportPawns[j].pawnID;\r\n\t for(var i=0; i<oggetto.pawnLocations.length; i++){\r\n\t\t if(oggetto.pawnLocations[i].pawnID===camion.pawnID){\r\n\t\t\t camion.origine=oggetto.pawnLocations[i].location.name;\r\n\t\t }\r\n\t }\r\n\t camion.risorseTrasportate = oggetto.group.transportPawns[j].payload.length;\r\n\t camion.quantità = [];\r\n\t camion.tipologia = [];\r\n\t\tfor(var risorse=0; risorse<camion.risorseTrasportate; risorse++){\r\n\t\t\tcamion.quantità.push(oggetto.group.transportPawns[j].payload[risorse].quantity) ;\r\n \t\tcamion.tipologia .push(oggetto.group.transportPawns[j].payload[risorse].resource) ;\r\n\t\t}\r\n \r\n camion.spostamenti= oggetto.pawnMoves[j].remainingMoves;\r\n arrCamion.push(camion);\r\n\t\t\r\n }\r\n \r\n creaTabProduzione(arrCamion);\r\n\t\r\n\tfor(var i=0; i<arrCamion.length; i++){\r\n\t\taggiornaListaDestinazioni(arrCamion, i);\r\n\t}\r\n}" ]
[ "0.6317149", "0.6249964", "0.6069885", "0.59685194", "0.59417474", "0.58946717", "0.58690196", "0.5834735", "0.5822921", "0.58184886", "0.58173984", "0.5797686", "0.5792543", "0.5762617", "0.5691861", "0.56891483", "0.5682685", "0.56727475", "0.5669907", "0.56602633", "0.564999", "0.564321", "0.56354636", "0.5607864", "0.559629", "0.5586188", "0.55706155", "0.55632836", "0.5559947", "0.5556262", "0.55435556", "0.5533757", "0.5532946", "0.55282986", "0.5486953", "0.54766446", "0.5455538", "0.5454897", "0.5445352", "0.54299027", "0.5420842", "0.54195726", "0.5418069", "0.541514", "0.5412659", "0.5411973", "0.54085016", "0.540757", "0.5406719", "0.54056436", "0.5399212", "0.53978354", "0.5397398", "0.53921807", "0.5388579", "0.53807145", "0.53763956", "0.5370341", "0.53686905", "0.5366837", "0.53653616", "0.53614086", "0.53578085", "0.53567326", "0.53454214", "0.53444135", "0.5341252", "0.53378147", "0.5336186", "0.5324519", "0.53243214", "0.53241086", "0.5317534", "0.53141034", "0.5311896", "0.5308788", "0.53075516", "0.53044134", "0.5302885", "0.5296615", "0.5294701", "0.52905905", "0.5282528", "0.5281781", "0.52799374", "0.5275812", "0.52758116", "0.52742666", "0.5274265", "0.52731603", "0.52709126", "0.5270122", "0.5265302", "0.526431", "0.5263923", "0.5260585", "0.5251109", "0.5250815", "0.5248382", "0.5246631", "0.52411705" ]
0.0
-1
When the application runs in the background
function handleBackground() { $('#statusDiv').text('status: in background '); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onAppBackground() {\n\tappscore.print.start();\n\n \tappscore.print.stop();\n}", "appHasGoneToTheBackground() {\n console.log(\"App has gone to the background.\");\n database.close();\n }", "function runBackgroundTask(){\n setTimeout(function(){\n console.log(\"background task run at \" + new Date().toUTCString());\n showNotification();\n // postJSON();\n // console.log(\"should have updated the db.json file from the background\");\n },30000);\n console.log(\"background task will run 30 seconds from now \" + new Date().toUTCString());\n }", "async appIsNowRunningInForeground() {\n console.log(\"App is now running in the foreground!\");\n return database.open().then(async () => {\n if (!this.state.init) {\n await this.prepareResources();\n await SplashScreen.hideAsync();\n }\n this.setState({\n databaseIsReady: true,\n init: true,\n });\n });\n }", "function bgInit() {\n\tlistenMUComm();\n\tlistenStartup();\n\tlistenMessages();\n\tchrome.runtime.onInstalled.addListener(bgSync);\n\tchrome.alarms.onAlarm.addListener(checkAlarm);\n\tbgLoadPrefs(function () {\n\t\tbgApplyPrefs();\n\t});\n}", "function activarBackGround(){\n\tif(!cordova.plugins.backgroundMode.isEnabled()){cordova.plugins.backgroundMode.enable();}\n\tcordova.plugins.backgroundMode.setDefaults({\n title: \"DeviceTrack\",\n ticker: \"Sincronizado\",\n text: \"Sincronizado\",\n\tsilent: true\n})\n\tcordova.plugins.backgroundMode.configure({\n title: \"DeviceTrack\",\n ticker: \"Sincronizado\",\n text: \"Sincronizado\",\n\tsilent: true\n})\n}", "onChildAppStart () {\n\n }", "function onAppForeground() {\n\tappscore.print.start();\n\n \tappscore.print.stop();\n}", "function bgSync() {\n\tpullUserSessionInfo(function (current_user_id, logged_in_user_id) {\n\t\tisFirstSession(function (first_session) {\n\t\t\tif (first_session) {\n\t\t\t\tif (logged_in_user_id && logged_in_user_id !== \"No User\") {\n\t\t\t\t\tinitializeNewSession(logged_in_user_id, function () {\n\t\t\t\t\t\tfinishFirstSession(function () {\n\t\t\t\t\t\t\tconsole.log(\"New session initialized from background script\");\n\t\t\t\t\t\t\tupdateBadge();\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpullAllData();\n\t\t\t\tupdateBadge();\n\t\t\t}\n\t\t});\n\t});\n}", "function enable_background() {\n\n //Adds device listener to keep app open in the background (stop the connection from dying)\n document.addEventListener('deviceready', function () {\n\n cordova.plugins.backgroundMode.setDefaults({\n title: \"iNetKey+\",\n text: \"Tap to Open\",\n icon: 'icon',\n color: \"2980b9\",\n resume: true,\n hidden: true,\n bigText: false\n });\n\n cordova.plugins.backgroundMode.setEnabled(true);\n cordova.plugins.backgroundMode.overrideBackButton();\n\n ready = true;\n }, false);\n\n document.addEventListener('pause', function () {\n stopAnimation();\n }, false);\n\n document.addEventListener('resume', function () {\n startAnimation();\n }, false);\n}", "handleAppStateChange(appState) {\n if (appState === \"background\") {\n // Schedule a notification\n // PushNotification.localNotificationSchedule({\n // message: \"Scheduled delay notification message\", // (required)\n // date: new Date(Date.now() + 3 * 1000) // in 3 secs\n // });\n }\n }", "function onPause() {\n // TODO: This application has been suspended. Save application state here.\n }", "function listenStartup() {\n\tchrome.runtime.onStartup.addListener(function () {\n\t\tupdateBadge();\n\t});\n}", "function onDeviceReady()\n{\n pictureSource = navigator.camera.PictureSourceType;\n destinationType = navigator.camera.DestinationType;\n// navigator.geolocation.getCurrentPosition(onSuccessGPS, onErrorGPS);\n// checkConnection();\n navigator.vibrate([1000]);\n// corre en background \n\n// cordova.plugins.backgroundMode.enable();\n// cordova.plugins.backgroundMode.configure({\n// silent: true\n// })\n /*\n cordova.plugins.backgroundMode.setDefaults({ text:'Doing heavy tasks.'});\n // Enable background mode\n cordova.plugins.backgroundMode.enable();\n \n // Called when background mode has been activated\n cordova.plugins.backgroundMode.onactivate = function () {\n setTimeout(function () {\n // Modify the currently displayed notification\n cordova.plugins.backgroundMode.configure({\n silent: true\n });\n }, 5000);\n }\n \n \n */\n}", "handleAppStateChange(appState) {\n if (appState === 'background') {\n // Schedule a notification\n PushNotification.localNotificationSchedule({\n message: 'Scheduled delay notification message', // (required)\n date: new Date(Date.now() + (3 * 1000)) // in 3 secs\n });\n }\n }", "function contentScriptWorker() {\n runtime.sendMessage({\n type: SIGN_CONNECT\n }).then(function (msg) {\n return console.info(msg);\n });\n runtime.onMessage.addListener(function (_ref) {\n var type = _ref.type,\n payload = _ref.payload;\n\n switch (type) {\n case SIGN_RELOAD:\n logger(\"Detected Changes. Reloading ...\");\n reloadPage && window.location.reload();\n break;\n\n case SIGN_LOG:\n console.info(payload);\n break;\n }\n });\n } // ======================== Called only on background scripts ============================= //", "function contentScriptWorker() {\n runtime.sendMessage({\n type: SIGN_CONNECT\n }).then(function (msg) {\n return console.info(msg);\n });\n runtime.onMessage.addListener(function (_ref) {\n var type = _ref.type,\n payload = _ref.payload;\n\n switch (type) {\n case SIGN_RELOAD:\n logger(\"Detected Changes. Reloading ...\");\n reloadPage && window.location.reload();\n break;\n\n case SIGN_LOG:\n console.info(payload);\n break;\n }\n });\n } // ======================== Called only on background scripts ============================= //", "function contentScriptWorker() {\n runtime.sendMessage({\n type: SIGN_CONNECT\n }, function (msg) {\n return console.info(msg);\n });\n runtime.onMessage.addListener(function (_ref) {\n var type = _ref.type,\n payload = _ref.payload;\n\n switch (type) {\n case SIGN_RELOAD:\n logger(\"Detected Changes. Reloading ...\");\n reloadPage && window.location.reload();\n break;\n\n case SIGN_LOG:\n console.info(payload);\n break;\n }\n });\n } // ======================== Called only on background scripts ============================= //", "start() {\r\n // Add your logic here to be invoked when the application is started\r\n }", "function onResume() {\n console.log('hahahahahahha');\n}", "function AppMonitor() {\n}", "onMessageStart() { }", "onChildAppManualRestart () {\n\n }", "backgroundApp(seconds) {\n return __awaiter(this, void 0, void 0, function* () {\n utils_1.logInfo(\"Sending the currently active app to the background ...\");\n this._args.testReporterLog(\"Sending the currently active app to the background ...\");\n yield this._driver.backgroundApp(seconds);\n });\n }", "async onShutdown() {\n // put things to do upon application shutdown here\n }", "async configAndroidBG() {\n\n // Get the current state of the app config\n let enb = await AsyncStorage.getItem( this.STORAGE_KEYS.ANDROID_CONFIG );\n let enabled = ( enb === null || typeof enb === 'undefined' ) ? 'false' : enb;\n \n // Schedule the job, only needs to run once \n // if( AppState.currentState === 'background' && enabled ) {\n if( enabled ) {\n App._log( 'Scheduling android background job' );\n\n var backgroundSchedule = {\n jobKey : \"bookadayJob\",\n timeout : 5000,\n warn : false,\n }\n\n BackgroundJob.schedule(backgroundSchedule);\n\n // Save the state so we don't try and reschedule\n // as doing so may throw warnings/errors\n AsyncStorage.setItem( this.STORAGE_KEYS.ANDROID_CONFIG, 'true' );\n }\n }", "function bgApplyPrefs() {\n\tscheduleReleaseUpdates();\n\tscheduleSyncs();\n\tlistenNotifications();\n}", "start() {\n // Add your logic here to be invoked when the application is started\n }", "function monitor(){\n\t\t\twakeWatch.unbind(wakeEvents, wake).bind(wakeEvents, wake);\n\t\t\tvar myCookie = e2.getCookie('lastActiveWindow');\n\t\t\tif (e2.now() - lastActive > e2.sleepAfter * 60000 ||\n\t\t\t\t(!e2.isChatterlight && myCookie && myCookie != windowId)) zzz('sleep');\n\t\t}", "static async isBackgroundRestricted() {\n return await ForegroundServiceModule.isBackgroundRestricted();\n }", "async handle_update() {\n\t\tthis.new_worker = await navigator.serviceWorker.getRegistration();\n\t\tif (this.new_worker.waiting) {\n\t\t\tthis.promote_app_update();\n\t\t}\n\t}", "initHooks() {\n chrome.tabs.onUpdated.addListener(this.onUpdated.bind(this));\n chrome.tabs.onActivated.addListener(this.onActivated.bind(this));\n chrome.runtime.onMessage.addListener(this.onMessage.bind(this));\n // chrome.windows.onFocusChanged is unreliable on Linux/CrOS/Windows\n // so we fall back to polling chrome.windows.getLastFocused\n // see crbug/387377#c30\n chrome.windows.onFocusChanged.addListener(this.onFocusChanged.bind(this));\n if (this.os != \"mac\") this.startPollingWindow();\n }", "function notifyApplicationStarted() {\n\t if (_isApplicationRunning) {\n\t return;\n\t }\n\n\t _isApplicationRunning = true;\n\t applicationEventListeners.forEach(function (listener) {\n\t listener('started');\n\t });\n\t}", "function startBackgroundService(data) {\n\t\n\tconsole.log(\"Starting FritsService in background\");\n\t\n\tif (data.ServiceRunning) {\n\t\t// OK\n\t\tif (data.TimerEnabled) {\n\t\t\t// OK\n\t\t} else {\n\t\t\tenableTimer();\n\t\t} \n\n\t} else { \n\t\tstartService();\n\t\tenableTimer();\n\t\t\n\t} \n\n\tif (data.RegisteredForBootStart) {\n\t\t// OK\n\t} else {\n\t\tregisterForBootStart();\n\t}\n\n\t//setBackgroundAlarm(null, \"Frits alarm!\", \"Tekst\");\n}", "function endForegroundMonitor () {\r\n\tonforeground_called\t= false;\r\n}", "relaunch() {}", "function start(){\n window.addEventListener(\"message\", _listener);\n }", "OnActivated() {}", "handleAppStateChange(nextAppState) {\n if (\n this.state.appState.match(/inactive|background/) &&\n nextAppState === \"active\"\n ) {\n // App has moved from the background (or inactive) into the foreground\n this.appIsNowRunningInForeground();\n store.dispatch(updatePlayback());\n } else if (\n this.state.appState === \"active\" &&\n nextAppState.match(/inactive|background/)\n ) {\n // App has moved from the foreground into the background (or become inactive)\n this.appHasGoneToTheBackground();\n }\n this.setState({ appState: nextAppState });\n }", "shouldBackgroundReloadAll() {\n return false;\n }", "register() {\n console.log(\"BackgroundPage::register()\");\n browser.runtime.onMessage.addListener((request, sender, sendResponse) => this.onMessage(request, sender, sendResponse));\n }", "function MobileHandler(){\n /**\n * This callback will be executed every time a geolocation is recorded in the background.\n */\n var callbackFn = function(location) {\n \n console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);\n App.Modules.GPS.state=App.Modules.GPS.STATES.ON;\n App.Modules.GPS.position=location;\n App.Modules.GPS.history.push(location);\n if(App.Modules.GPS.history.length>10){\n App.Modules.GPS.history.shift();\n } \n\n _dispatchUpdateCallbacks();\n \n /*\n IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,\n and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.\n IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.\n */\n backgroundGeolocation.finish();\n // NOW I STOP THIS SERVICE AND CONTINUE WITH NAVIGATION.\n backgroundGeolocation.stop();\n };\n\n var failureFn = function(error) {\n App.Modules.GPS.state=App.Modules.GPS.STATES.ERROR;\n App.Modules.GPS.errorMsg=error;\n console.log('BackgroundGeolocation error'); \n _dispatchUpdateCallbacks();\n };\n\n // BackgroundGeolocation is highly configurable. See platform specific configuration options\n backgroundGeolocation.configure(callbackFn, failureFn, {\n desiredAccuracy: 10,\n // stationaryRadius: 20,\n // distanceFilter: 30,\n interval: 3000\n });\n\n // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.\n backgroundGeolocation.start();\n\n // If you wish to turn OFF background-tracking, call the #stop method.\n // backgroundGeolocation.stop();\n }", "function initialCheck(){\n\t\n\t/*I forgot I could've used this\n\tchrome.storage.sync.get('Enabled', function(data){\n\t\talert(data.Enabled);\t\n\t});*/\n\t\n\tchrome.runtime.sendMessage(\"StartOrNot\");\n\n\tchrome.runtime.onMessage.addListener(function(msg){\n\t\n\tswitch(msg){\n\t\tcase \"OFF\":\n\t\t\trunning = false;\n\t\t\tbreak;\n\t\tcase \"ON\":\n\t\t\trunning = true;\n\t\t\tbreak;\n\t\t}\n\t});\n\tchrome.storage.sync.get('Blur_Strength', function(data){\n\t\tstrength = data.Blur_Strength;\n\t});\n\tchrome.storage.sync.get('Choice', function(data){\n\t\tchoice = data.Choice;\n\t});\n\tchrome.storage.sync.get('Substitute', function(data){\n\t\ttext = data.Substitute;\n\t});\n}", "function onDeviceReady() {\n\n // Enable background mode\n cordova.plugins.backgroundMode.enable();\n // Android customization\n cordova.plugins.backgroundMode.setDefaults({ text:'Doing heavy tasks.'});\n\n cordova.plugins.backgroundMode.onfailure = function(errorCode) {};\n\n // Called when background mode has been activated\n cordova.plugins.backgroundMode.onactivate = function () {\n\n setTimeout(function () {\n // Modify the currently displayed notification\n cordova.plugins.backgroundMode.configure({\n text:'Running in background for more than 5s now.',\n hidden: false,\n resume: true\n });\n }, 10000);\n }\n\n //cordova.InAppBrowser.open('http://192.168.1.6:7777', '_self', 'location=yes,hidden=no');\n var conn = new WebSocket('ws://192.168.1.6:7777');\n\n conn.onopen = function () {\n console.log(\"Connected to the signaling server\");\n cordova.plugins.notification.local.schedule({\n title: 'My first notification111',\n text: 'Connected to the signaling server',\n foreground: true\n });\n };\n\n conn.onmessage = function (msg) {\n console.log(\"Got message\", msg.data);\n var data = JSON.parse(msg.data);\n //alert(msg.data);\n switch(data.type) {\n case \"door_bell\":\n console.log('someone visit');\n var media = new Media('https://signellingsvr360owl.herokuapp.com/doorbell.mp3', function(){});\n media.play();\n cordova.plugins.notification.local.schedule({\n title: 'FirstMessage',\n text: data.message,\n foreground: true\n });\n break;\n default:\n break;\n }\n\n }\n //var ref =\n/*\n */\n}", "function sendStatus(){\n chrome.runtime.sendMessage({'message': 'update', 'running': isRunning});\n}", "_onHangup() {\n this.enable(false);\n }", "function checkCurrenState() {\r\n // console.log(\"App Current State:\" + appCurrentState);\r\n if (appCurrentState == undefined) {\r\n clearData();\r\n }\r\n if (appCurrentState == appStateEnum.signing || appCurrentState == appStateEnum.downloadFile || appCurrentState == appStateEnum.info) {\r\n console.log(\"LOADING\");\r\n // sections.changeSection(sections.section.loadingSection);\r\n showLoading(MessageType[appCurrentState]);\r\n } else if (appCurrentState == appStateEnum.complete || appCurrentState == appStateEnum.error) {\r\n clearData();\r\n }\r\n //check if exist stored data in background\r\n else if (appCurrentState == appStateEnum.running) {\r\n console.log(backgroundStoredSignatureData);\r\n if (backgroundStoredSignatureData.isEmpty() == false) {\r\n console.log(\"NEED TO RESTORE DATA\");\r\n chrome.tabs.query({\r\n active: true,\r\n currentWindow: true\r\n }, function (tab) {\r\n if (tab[0].url == backgroundStoredSignatureData.signatureData.tabUrl) {\r\n signatureData.copy(backgroundStoredSignatureData.signatureData);\r\n updateSignatureFieldList(backgroundStoredSignatureData.infoPDF);\r\n } else {\r\n console.log(\"Stored data in background belong to a different document. Clear stored data.\")\r\n clearData();\r\n }\r\n });\r\n }\r\n }\r\n }", "function onResume() {\n }", "checkActivity() {\n window.addEventListener('focus', () => {\n this.resumeWhenActive && this.play();\n\n });\n window.addEventListener('blur', () => {\n this.resumeWhenActive = this.isPlaying;\n this.pause();\n });\n }", "onChildAppRestart (/* reason */) {\n\n }", "function onStartup()\n{\n\tprintLog(\"info\", \"onStartup called\");\n}", "function LaunchpadListener() {\n}", "start() {\n this.isRunning = true;\n }", "start() {\n this.running = true;\n }", "static async isRunning() {\n return await ForegroundServiceModule.isRunning();\n }", "function startApp() {\n readSettings(storage.readJSON(\"sleeplog.json\", true) || {});\n drawNightTo(prevDays);\n Bangle.setUI(\"leftright\", (cb) => {\n if (!cb) {\n eval(storage.read(\"sleeplog.settings.js\"))(startApp);\n } else if (prevDays + cb >= -1) {\n drawNightTo((prevDays += cb));\n }\n });\n}", "function registerBackgroundTabDetection() {\n\t if (WINDOW && WINDOW.document) {\n\t WINDOW.document.addEventListener('visibilitychange', () => {\n\t const activeTransaction = getActiveTransaction() ;\n\t if (WINDOW.document.hidden && activeTransaction) {\n\t const statusType = 'cancelled';\n\n\t (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&\n\t logger.log(\n\t `[Tracing] Transaction: ${statusType} -> since tab moved to the background, op: ${activeTransaction.op}`,\n\t );\n\t // We should not set status if it is already set, this prevent important statuses like\n\t // error or data loss from being overwritten on transaction.\n\t if (!activeTransaction.status) {\n\t activeTransaction.setStatus(statusType);\n\t }\n\t activeTransaction.setTag('visibilitychange', 'document.hidden');\n\t activeTransaction.finish();\n\t }\n\t });\n\t } else {\n\t (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&\n\t logger.warn('[Tracing] Could not set up background tab detection due to lack of global document');\n\t }\n\t}", "function initBackground() {\n // Check config, init sequences\n chrome.storage.local.get(null, function(items) {\n\n // Get local strage, if undefined, Set default values\n let myLocation = items.myLocation || 'APAC';\n let instanceKeys = items.instanceKeys || ['AP0', 'CS5'];\n let intervalMin = items.intervalMin || '60';\n\n // Restore(Init) Configs\n chrome.storage.local.set({\n 'myLocation': myLocation,\n 'instanceKeys': instanceKeys,\n 'intervalMin': intervalMin,\n }, function() {\n\n // Init Instance List\n updateInstances();\n\n // Init Trust Data\n updateTrust();\n\n // Setup New-Timer\n resetUpdateTrustTimer();\n });\n });\n}", "function backgroundInit() {\n storage( 'currentTab', null );\n // When Chrome displays any tab, show the pageAction\n // icon in that tab's addressbar.\n var handleTabEvents = function( tab ) {\n storage( 'currentTab', tab.id || tab );\n chrome.pageAction.show( tab.id || tab );\n isAuthenticated( {\n 'isAuthed': function () { clearPopup(); },\n 'notAuthed': function () { setPopup(); },\n 'error': function () { setPopup(); }\n } );\n };\n chrome.tabs.onSelectionChanged.addListener( handleTabEvents );\n chrome.tabs.onUpdated.addListener( handleTabEvents );\n chrome.tabs.getSelected( null, handleTabEvents );\n\n var handleClickEvents = function( response, tab ) {\n animatedIcon.stop();\n switch ( response.status ) {\n case STATUS_CREATED:\n chrome.pageAction.setIcon( {\n \"tabId\": tab.id,\n \"path\": \"success.png\"\n } );\n break;\n case STATUS_BADREQUEST:\n case STATUS_ERROR:\n case STATUS_FORBIDDEN:\n default:\n chrome.pageAction.setIcon( {\n \"tabId\": tab.id,\n \"path\": \"failure.png\"\n } );\n break;\n }\n };\n chrome.pageAction.onClicked.addListener( function ( tab ) {\n var response = sendURL( tab, handleClickEvents );\n } );\n\n // Listen for messages from the injected content script\n chrome.extension.onRequest.addListener(\n function( request, sender, sendResponse ) {\n if ( request.action === \"sendToInstapaper\" ) {\n sendURL( sender.tab, handleClickEvents );\n }\n sendResponse( {} );\n }\n );\n }", "start() {\n console.log(\"Die Klasse App sagt Hallo!\");\n }", "function getBrowserPopupStateFromBackground(){\n let message = {command: 'BROWSER POPUP STATE'}\n return browser.runtime.sendMessage(message)\n}", "function onStop() { /* Currently empty, just to avoid annoying log message */ }", "function registerBackgroundTabDetection() {\n if (WINDOW && WINDOW.document) {\n WINDOW.document.addEventListener('visibilitychange', () => {\n const activeTransaction = getActiveTransaction() ;\n if (WINDOW.document.hidden && activeTransaction) {\n const statusType = 'cancelled';\n\n (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&\n logger.log(\n `[Tracing] Transaction: ${statusType} -> since tab moved to the background, op: ${activeTransaction.op}`,\n );\n // We should not set status if it is already set, this prevent important statuses like\n // error or data loss from being overwritten on transaction.\n if (!activeTransaction.status) {\n activeTransaction.setStatus(statusType);\n }\n activeTransaction.setTag('visibilitychange', 'document.hidden');\n activeTransaction.finish();\n }\n });\n } else {\n (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&\n logger.warn('[Tracing] Could not set up background tab detection due to lack of global document');\n }\n }", "function onDeviceReady() {\n $('#logList').append('<li>Startup');\n document.addEventListener(\"backbutton\", function (e) {\n e.preventDefault(); \n navigator.notification.confirm(\"Are you sure want to exit?\", onConfirmExit, \"Confirmation\", ['Yes','No']);\n }, false );\n document.addEventListener(\"offline\", toggleOnline, false);\n document.addEventListener(\"online\", toggleOnline, false);\n\n $('#logList').append('<li>After Load Status=' + isOnline);\n $('#logList').append('<li>Refreshing news data 1st time');\n loadNewsAtStart();\n $('#logList').append('<li>Refreshing sermon data 1st time');\n loadSermonAtStart();\n\t\n navigator.splashscreen.hide();\n $('#logList').append('<li>App load completed');\n\twindow.plugin.toast.showShortBottom('Loading complete');\n\n \n}", "function registerBackgroundTabDetection() {\n if (types.WINDOW && types.WINDOW.document) {\n types.WINDOW.document.addEventListener('visibilitychange', () => {\n const activeTransaction = utils.getActiveTransaction() ;\n if (types.WINDOW.document.hidden && activeTransaction) {\n const statusType = 'cancelled';\n\n (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&\n utils$1.logger.log(\n `[Tracing] Transaction: ${statusType} -> since tab moved to the background, op: ${activeTransaction.op}`,\n );\n // We should not set status if it is already set, this prevent important statuses like\n // error or data loss from being overwritten on transaction.\n if (!activeTransaction.status) {\n activeTransaction.setStatus(statusType);\n }\n activeTransaction.setTag('visibilitychange', 'document.hidden');\n activeTransaction.finish();\n }\n });\n } else {\n (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&\n utils$1.logger.warn('[Tracing] Could not set up background tab detection due to lack of global document');\n }\n}", "onBrowserStart(browser) {\n\n }", "onNativeResume() {\n\t\t//TODO: Implement this if required\n\t}", "persistBackground(persist) {\n try {\n if (persist) {\n this.activePorts = this.activePorts || [];\n if (!this.listeningForPorts) {\n this.listeningForPorts = true;\n chrome.runtime.onConnect.addListener((port) => {\n this.activePorts.push(port);\n console.log('New client connected. Total Alive:', this.activePorts?.length);\n port.onMessage.addListener((msg) => { console.log('Message on port:', msg); });\n port.onDisconnect.addListener(this.attachToClient);\n console.log('Attached keep-alive listener', this.listeningForPorts, this.activePorts);\n });\n this.attachToClient();\n }\n }\n } catch (err) {\n console.error('Error trying to persist background pages:', err);\n }\n }", "started() {\r\n\r\n\t}", "function listenForActivation(workbox) {\n workbox.addEventListener('activated', (evt) => {\n if (!evt.isUpdate) {\n window.dispatchEvent(\n new CustomEvent('show-toast', {\n detail: {\n message: 'Rcast is ready to be used offline.',\n duration: 3000, // 3 seconds\n },\n }),\n );\n }\n });\n}", "function onReady() {\n\tconsole.log( 'Application is ready...' ); // eslint-disable-line no-console\n\tcreateWindow( pathToOpen, ( mainWindow ) => {\n\t\tisReady = true;\n\n\t\tfunction sendStatusToWindow( text ) {\n\t\t\tmainWindow.webContents.send('message', text );\n\t\t}\n\n\t\tif ( process.env.NODE_ENV === 'production' ) {\n\t\t\tsendStatusToWindow( 'Check for updates and notify if available...' );\n\n\t\t\tautoUpdater.on( 'checking-for-update', () => {\n\t\t\t\tsendStatusToWindow('Checking for update...');\n\t\t\t});\n\n\t\t\tautoUpdater.on( 'update-available', ( info ) => {\n\t\t\t\tsendStatusToWindow('Update available.');\n\t\t\t});\n\n\t\t\tautoUpdater.on( 'update-not-available', ( info ) => {\n\t\t\t\tsendStatusToWindow('Update not available.');\n\t\t\t});\n\n\t\t\tautoUpdater.on( 'error', ( err ) => {\n\t\t\t\tsendStatusToWindow('Error in auto-updater. ' + err);\n\t\t\t});\n\n\t\t\tautoUpdater.on( 'download-progress', ( progressObj ) => {\n\t\t\t\tlet msg = 'Download speed: ' + progressObj.bytesPerSecond;\n\t\t\t\tmsg = msg + ' - Downloaded ' + progressObj.percent + '%';\n\t\t\t\tmsg = msg + ' (' + progressObj.transferred + '/' + progressObj.total + ')';\n\t\t\t\tsendStatusToWindow( msg );\n\t\t\t});\n\n\t\t\tautoUpdater.on( 'update-downloaded', ( info ) => {\n\t\t\t\tsendStatusToWindow( 'Update downloaded' );\n\t\t\t});\n\n\t\t\tautoUpdater.checkForUpdatesAndNotify();\n\t\t}\n\t});\n\tMenu.setApplicationMenu( Menu.buildFromTemplate( configureMenu({ app }) ) );\n\taddRecentFilesMenu();\n}", "onAllWindowsClosed() {\n if (process.platform !== 'darwin') {\n app.quit();\n }\n }", "function isRunning() {\n return running;\n }", "function runApp() {\n\n // your app starts here\n \n onDeviceReady();\n \n}", "function setDynamicBackground() {\n\tsetUpGame();\n\tprogressGame();\n\tsetInterval(\"progressGame()\", refreshRate);\n}", "function messageBackground(message) {\n console.log(\"Message to background\");\n console.log(message);\n try {\n port_to_background.postMessage(message);\n } catch (e) {\n port_to_background = chrome.runtime.connect({\n name: 'popup > background'\n });\n port_to_background.onDisconnect.addListener(function(msg) {\n port_to_background = null;\n port_from_background = null;\n });\n port_to_background.postMessage(message);\n }\n}", "function appStart() {\n window.start();\n}", "function isChromeApp() {\n\t return false;\n\t}", "function listenMessages() {\n\tchrome.runtime.onMessage.addListener(checkMessage);\n}", "onNativePause() {\n\t\t//TODO: Implement this if required\n\t}", "_onBackgroundCheck(backgroundCheck) {\n switch (backgroundCheck) {\n case \"clear\":\n Alert.alert(\n \"\",\n \"Congratulations! Your background report has been cleared. You are ready to start driving!\"\n );\n return;\n case \"consider\":\n Alert.alert(\"\", \"Your background check is still under review\");\n return;\n case \"pending\":\n Alert.alert(\n \"\",\n \"Your background check is pending. You should have received an email from Checkr. If you need assistance, please call (650) 935-5544 for help.\"\n );\n return;\n case \"sent\":\n Alert.alert(\n \"\",\n \"Your background check is incomplete. Please complete it following the instructions sent to your email from Checkr\"\n );\n return;\n default:\n Alert.alert(\n \"\",\n \"An email with the background report application should be sent soon with further instructions. If you need assistance, please call (650) 935-5544 for help.\"\n );\n }\n }", "suspend() {\n if (this.state_ === WindowState.LAUNCHING) {\n console.error('Call suspend() while window is still launching.');\n return;\n }\n this.state_ = WindowState.SUSPENDING;\n this.foregroundOps_.suspend();\n }", "doCallbackAndEnableBackgroundPinging() {\n this._beSatisfiedWith = {\n instant: 0,\n low: 0,\n medium: 0\n };\n this._counter = {\n instant: 0,\n low: 0,\n medium: 0\n };\n this._suitableNodeFound = true;\n this._pingInBackGround = true;\n }", "function loadApp() {\n firebaseUtils.listenToAuthStatus(logIn, logOut);\n}", "function startBackgroundMusic() {\n let backgroundMusic = new Audio(\"./sounds/scary-background.mp3\");\n backgroundMusic.play();\n backgroundMusic.volume = 0.3;\n backgroundMusic.loop = true;\n }", "function regularActivityMonitor() {\n service.user.active = true;\n service.user.action = Date.now();\n\n publish(EVENT_ACTIVITY);\n\n if (service.user.warning) {\n service.user.warning = false;\n publish(EVENT_KEEPALIVE);\n }\n }", "function update(){\r\n updateBackground();\r\n //extractData();\r\n loop();\r\n // checkStatus();\r\n \r\n}", "function onMain() {\n //get a reference to the current Application.\n const app = fin.desktop.Application.getCurrent();\n\n //we will increment on child window creation.\n let winNumber = 0;\n\n //we get the current OpenFin version\n fin.desktop.System.getVersion(version => {\n const ofVersion = document.querySelector('#of-version');\n ofVersion.innerText = version;\n });\n\n //subscribing to the run-requested events will allow us to react to secondary launches, clicking on the icon once the Application is running for example.\n //for this app we will launch child windows everytime the user clicks on the desktop.\n app.addEventListener('run-requested', () => {\n const win = fin.desktop.Window.getCurrent();\n //Only launch new windows from the main window.\n if (win.name === app.uuid) {\n var cWin = new fin.desktop.Window({\n name: `childWindow_${++winNumber}`,\n url: location.href,\n defaultWidth: 320,\n defaultHeight: 320,\n defaultTop: 10,\n defaultLeft: 300,\n autoShow: true\n }, function () {\n console.log('Child Window created');\n }, function (error) {\n console.log(error);\n });\n }\n });\n}", "onBoot() {}", "function getTimeFromBackground() {\n chrome.runtime.sendMessage({message: 'whoIsPlaying', action: true}, function (response) {\n var currentService = PlayerFactory.setCurrentService(response) || response.currentService;\n console.log('progressbar current service', currentService)\n var request = {\n message: \"checkTimeAction\",\n service: currentService\n };\n chrome.runtime.sendMessage(request, function (response) {\n $scope.duration = response.duration || $scope.duration ;\n $scope.timeElapsed = response.currentTime || $scope.timeElapsed;\n // console.log('scope time elapsed and duration', $scope.timeElapsed, $scope.duration);\n // console.log('response time elapsed and duration', response.currentTime, response.duration);\n if ($scope.duration !== max) {\n max = $scope.duration;\n theSlider.slider(\"option\", \"max\", max);\n }\n theSlider.slider({\n value: $scope.timeElapsed\n });\n $scope.$digest();\n });\n });\n }", "async handleAppStateChange(url) {\n var userName = await AsyncStorage.getItem(\"username\");\n var isFirstRun=await AsyncStorage.getItem(\"firstrun\");\n setTimeout(() => {\n if (userName != null) {\n var urlData = \"\";\n if (url != null&&userName!=commons.guestuserkey()) { //Accept shared stax \n urlData = url.split(\"#\");\n commons.replaceScreen(this, 'widgetrecievebeta', { \"launchurl\": urlData[1] });\n }\n else { \n var wIdFromHSW=\"\";\n wIdFromHSW=this.props.screenProps[\"WidgetID\"];\n if(wIdFromHSW!=null&&wIdFromHSW!='undefined'&&wIdFromHSW!=undefined&&wIdFromHSW!=\"\")\n {\n commons.replaceScreen(this, \"bottom_menu\", { \"page\": \"STAX\", \"widget_id1\": wIdFromHSW });\n }\n else{\n commons.replaceScreen(this, 'bottom_menu', {});\n } \n }\n }\n else {\n if(isFirstRun==null)\n commons.replaceScreen(this, 'userypeselector', {});\n else\n commons.replaceScreen(this, 'login', {});\n }\n }, 500); \n }", "function onPreappinit() {\n kony.print(\"LOG : onPreappinit - START\");\n gAppData = new initAppData();\n}", "function appStart() {\n\t$status.innerHTML = \"App ready!\";\n}", "function BackgroundPage() {\n this._plugin = document.getElementById(\"save-plugin\");\n this._initMessages();\n this._mapping = new FileMapping();\n chrome.extension.onRequest.addListener(this._onRequest.bind(this));\n window.addEventListener(\"storage\", this._onStorageUpdated.bind(this), false);\n}", "start () {\n\t\tthis.updateTask.setRepeating ((callback) => {\n\t\t\tthis.update (callback);\n\t\t}, App.HeartbeatPeriod, App.HeartbeatPeriod * 2);\n\t}", "shouldBackgroundReloadRecord() {\n return false;\n }", "started() {\n\n }", "started() {\n\n }", "started() {\n\n }", "enableBackgroundPinging() {\n this._beSatisfiedWith = {\n instant: 0,\n low: 0,\n medium: 0\n };\n this._counter = {\n instant: 0,\n low: 0,\n medium: 0\n };\n this._suitableNodeFound = false;\n this._pingInBackGround = true;\n }" ]
[ "0.69980395", "0.67590755", "0.6653784", "0.65710723", "0.6444786", "0.6428241", "0.6419935", "0.6405048", "0.6303666", "0.6270641", "0.620489", "0.62013495", "0.61752766", "0.6114105", "0.60336375", "0.60259926", "0.60259926", "0.6003771", "0.5994139", "0.59903693", "0.59838325", "0.5974051", "0.5961016", "0.59420455", "0.59044755", "0.58885413", "0.58867735", "0.5857386", "0.58551365", "0.5849498", "0.5823808", "0.5809635", "0.5808149", "0.5798251", "0.57915115", "0.5788271", "0.57746065", "0.5760113", "0.5757765", "0.5738483", "0.57370573", "0.57365113", "0.5732885", "0.57226604", "0.5720659", "0.5709643", "0.5699107", "0.5693297", "0.56809896", "0.5674126", "0.56384486", "0.55988514", "0.5581397", "0.5574304", "0.5570476", "0.55696917", "0.5565431", "0.55522656", "0.5542667", "0.5540821", "0.55280524", "0.5501344", "0.5496513", "0.54963285", "0.5494239", "0.5493673", "0.54893225", "0.54714584", "0.5471443", "0.5469861", "0.5457302", "0.54557884", "0.5454634", "0.5450243", "0.5443059", "0.5438229", "0.54310983", "0.5423739", "0.5413275", "0.5395646", "0.53930753", "0.53919274", "0.5389526", "0.53834385", "0.53735167", "0.53727365", "0.53698725", "0.5367974", "0.53605986", "0.5355852", "0.5354655", "0.53535515", "0.5352836", "0.5351339", "0.53476036", "0.5342969", "0.53426826", "0.53426826", "0.53426826", "0.5339066" ]
0.5575683
53
When the application doesn't rub
function handleColdStart() { $('#statusDiv').text('status: in coldstart '); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ts_skip_or_boost()\n{\n// open_application(\"INRstarWindows\");\n\n ts_skip_or_boost_sorb_button_user_permissions();\n ts_skip_or_boost_sorb_button_dosing_method_validation();\n ts_skip_or_boost_sorb_button_review_period_validation();\n ts_skip_or_boost_sorb_button_self_test_validation();\n ts_skip_or_boost_sorb_button_omit_validation();\n// ts_sorb_schedule(); // Needs to be refactored removed the 3 days form the view only displayed after ok button now\n ts_treatment_button_disabling();\n\n// close application needed here ?\n}", "_eventNoWikis() {\n console.warn('No wikis configured! Exiting program...');\n process.exit();\n }", "function OnLevelWasLoaded()\r\n{\r\n\tlaunched = false;\r\n\tgrabbed = false;\r\n}", "function isChromeApp() {\n\t return false;\n\t}", "relaunch() {}", "function runOnloadIfWidgetsEnabled () {\n\t\t\n\t}", "_onHangup() {\n this.enable(false);\n }", "function unsureIfthisIsAnActualLoadingScreen() {\n //FrameCount on the loading state to \"waste\" your time\n let wasteOfTime = 120;\n if (frameCount > wasteOfTime) {\n state = `bubblePoppin`;\n }\n\n //The text\n push();\n textSize(30);\n fill(255, 132, 0);\n stroke(0);\n strokeWeight(5);\n textAlign(CENTER, CENTER);\n text(`Loading...`, width / 2, height / 2);\n pop();\n}", "static get NOT_READY () {return 0}", "beforeCloseMain(){\n this.config.root.beforeCloseMain && this.config.root.beforeCloseMain();\n }", "get cantFireEvent(){\n return (!this._config || !this.hass || !this._firstRendered);\n }", "checkIfChildApp() {\n if (finsembleWindow.windowOptions &&\n finsembleWindow.windowOptions.customData &&\n finsembleWindow.windowOptions.customData.parentUUID &&\n finsembleWindow.windowOptions.customData.parentUUID !== system_1.System.Application.getCurrent().uuid) {\n let parent = system_1.System.Application.wrap(finsembleWindow.windowOptions.customData.parentUUID);\n parent.addEventListener(\"crashed\", this.close.bind(null, false));\n parent.addEventListener(\"initialized\", this.close.bind(null, false));\n parent.addEventListener(\"out-of-memory\", this.close.bind(null, false));\n }\n }", "function cnc_check_if_loaded() {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (typeof qx != 'undefined') {\n\t\t\t\t\t\t\ta = qx.core.Init.getApplication(); // application\n\t\t\t\t\t\t\tif (a) {\n\t\t\t\t\t\t\t\tcnctaopt_create();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twindow.setTimeout(cnc_check_if_loaded, 1000);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twindow.setTimeout(cnc_check_if_loaded, 1000);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tif (typeof console != 'undefined') console.log(e);\n\t\t\t\t\t\telse if (window.opera) opera.postError(e);\n\t\t\t\t\t\telse GM_log(e);\n\t\t\t\t\t}\n\t\t\t\t}", "function BOT_reqApplicationPostProcessing () {\r\n\treturn;\r\n}", "function notReady() {\n\t\t// If applet is not loaded, display an error\n\t\tif (!isLoaded()) {\n\t\t\treturn true;\n\t\t}\n\t\t// If a printer hasn't been selected, display a message.\n\t\telse if (!qz.getPrinter()) {\n\t\t\t$(\"textarea[name=qz_log]\").append('Proszę poprawnie skonfigurować drukarkę.\\n\\n');\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "function resetApp() {\n runTest();\n }", "__init14() {this._handleWindowBlur = () => {\n const breadcrumb = createBreadcrumb({\n category: 'ui.blur',\n });\n\n // Do not count blur as a user action -- it's part of the process of them\n // leaving the page\n this._doChangeToBackgroundTasks(breadcrumb);\n };}", "function notReady() {\n me.ready = false;\n update(\"ready\", false);\n $('#me .state').html(\"Not Ready\");\n $('#me .btn-cancel-ready').html(\"Ready\");\n $('#me .btn-cancel-ready').addClass(\"btn-ready\");\n $('#me .btn-cancel-ready').removeClass(\"btn-cancel-ready\");\n}", "function noInstallStatus () { // Timeout, we will never get the install event, assume justInstalled = false\r\n console.log(\"No install event\");\r\n getInstallStatusTimerID = undefined;\r\n justInstalled = false;\r\n gis_resolve(justInstalled);\r\n}", "function checkStatus() {\n checkWin();\n checkLose();\n }", "onLoadFail () {\n this.props.updateNoteStatus(false)\n }", "function checkAutoRun() {\n if (!run.currentRunLoop) {\n _emberMetalCore.default.assert('You have turned on testing mode, which disabled the run-loop\\'s autorun.\\n You will need to wrap any code with asynchronous side-effects in a run', !_emberMetalCore.default.testing);\n }\n }", "function checkAutoRun() {\n if (!run.currentRunLoop) {\n _emberMetalCore.default.assert('You have turned on testing mode, which disabled the run-loop\\'s autorun.\\n You will need to wrap any code with asynchronous side-effects in a run', !_emberMetalCore.default.testing);\n }\n }", "function cnc_check_if_loaded() {\n\t\ttry {\n\t\t\tif (typeof qx != 'undefined') {\n\t\t\t\ta = qx.core.Init.getApplication(); // application\n\t\t\t\tif (a) {\n\t\t\t\t\tcncloot_create();\n\t\t\t\t} else {\n\t\t\t\t\twindow.setTimeout(cnc_check_if_loaded, 1000);\n }\n\t\t\t} else {\n\t\t\t\twindow.setTimeout(cnc_check_if_loaded, 1000);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (typeof console != 'undefined') console.log(e);\n\t\t\telse if (window.opera) opera.postError(e);\n\t\t\telse GM_log(e);\n\t\t}\n\t}", "function checkEngine() {\n \n if(!engineRunning) engine();\n \n }", "static show_maybe(){\n if(!persistent_get(\"dont_show_splash_screen_on_launch\")){\n this.show()\n }\n }", "function cnc_check_if_loaded() {\n try {\n if (typeof qx != 'undefined') {\n a = qx.core.Init.getApplication(); // application\n if (a) {\n cncopt_create();\n } else {\n window.setTimeout(cnc_check_if_loaded, 1000);\n }\n } else {\n window.setTimeout(cnc_check_if_loaded, 1000);\n }\n } catch (e) {\n if (typeof console != 'undefined') console.log(e);\n else if (window.opera) opera.postError(e);\n else GM_log(e);\n }\n }", "function cnc_check_if_loaded() {\n try {\n if (typeof qx != 'undefined') {\n a = qx.core.Init.getApplication(); // application\n if (a) {\n cncopt_create();\n } else {\n window.setTimeout(cnc_check_if_loaded, 1000);\n }\n } else {\n window.setTimeout(cnc_check_if_loaded, 1000);\n }\n } catch (e) {\n if (typeof console != 'undefined') console.log(e);\n else if (window.opera) opera.postError(e);\n else console.log(e);\n }\n }", "function main() {\n hideError()\n likeListener()\n }", "filterBySuccLaunch(launch) {\n this.isLaunched = launch;\n this.isLoading = true;\n this.getSpaceData();\n setTimeout(() => {\n this.isLoading = false;\n }, 2000);\n }", "function isChromeApp$1() {\n\t return false;\n\t}", "function beginAgain () {\n new BeginApp().startApp();\n}", "onChildAppManualRestart () {\n\n }", "function alwaysRunOnload () {\n\t\n\t}", "function doResume() {\n console.log('doResume()');\n\t\t\t\t\tM2AS.indicator.set(0);\n\t\t\t\t\tblackberry.app.setHomeScreenIcon(\"local:///images/icono_BB64.png\"); \n\t\t\t\t\tisFlagForeground = true;\n }", "function checkAutoRun() {\n if (!Ember.run.currentRunLoop) {\n Ember.assert(\"You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an Ember.run\", !Ember.testing);\n }\n}", "evolutionReady(){\n // console.log(\"Game Menu evolutionReady\");\n if(!this.runningInstance || (this.runningInstance instanceof EvolutionLoadScreen)){\n this.evolutionShell.runQueue(this.startSnake, this.startRunner);\n }\n }", "earlyStart() {\n\t\treturn true;\n\t}", "onActiveScreenChanged_() {}", "function maskDesktop() {\n\t\tExt.getBody().mask(i18n.get(\"label.loadingSitools\"));\n\t\tExt.get(\"ux-taskbar\").hide();\n\t}", "function checkAppError() {\n if (options.appError === APP_ERROR.NONE) {\n return;\n }\n\n document.body.style.width = \"auto\";\n document.body.style.overflow = \"hidden\";\n\n document.getElementById(\"tabline\").style.display = \"none\";\n document.getElementById(\"sniffer\").style.display = \"none\";\n document.getElementById(\"blind-bottom\").style.display = \"none\";\n document.getElementById(\"error\").style.display = \"block\";\n\n document.getElementById(\"error-hint\").innerText = (options.appError === APP_ERROR.CONNECT)\n ? _(\"ErrorAppConnect\")\n : _(\"ErrorAppVersion\", [options.appVersion, options.minAppVersion]);\n\n var inst = document.getElementById(\"error-action-install\");\n inst.innerText = _(\"ErrorAppInstall\");\n inst.onclick = function () {\n const m = browser.runtime.getManifest();\n browser.downloads.download({\n url: m.homepage_url + \"/releases/download/v\" + m.version + \"/suckerApp-v\" + m.version + \"-setup.exe\"\n });\n };\n\n var rtfm = document.getElementById(\"error-action-rtfm\");\n rtfm.innerText = _(\"ErrorAppRTFM\");\n rtfm.onclick = () => browser.tabs.create({url: _(\"LinkWikiTechnology\")});\n}", "isIntact () {\n return false;\n }", "function BLOCKIND() {return true;}", "function AppMonitor() {\n}", "function renderHasNotSuspendedYet(){// If something errored or completed, we can't really be sure,\n// so those are false.\nreturn workInProgressRootExitStatus===RootIncomplete;}", "function renderHasNotSuspendedYet(){// If something errored or completed, we can't really be sure,\n// so those are false.\nreturn workInProgressRootExitStatus===RootIncomplete;}", "function renderHasNotSuspendedYet(){// If something errored or completed, we can't really be sure,\n// so those are false.\nreturn workInProgressRootExitStatus===RootIncomplete;}", "function renderHasNotSuspendedYet(){// If something errored or completed, we can't really be sure,\n// so those are false.\nreturn workInProgressRootExitStatus===RootIncomplete;}", "function renderHasNotSuspendedYet(){// If something errored or completed, we can't really be sure,\n// so those are false.\nreturn workInProgressRootExitStatus===RootIncomplete;}", "onChildAppRestart (/* reason */) {\n\n }", "function updateBricks() {\n if (!gBricks.length) {\n if (gDebugging) console.log(\"VOCÊ VENCEU!!!!\");\n clear();\n }\n}", "_environmentChanged() {}", "function failScreen() {\n image(introScreenBackground, 0, 0);\n\n push();\n noStroke();\n noFill();\n rect(275, 310, 340, 75);\n pop();\n\n rainRun();\n\n lightningGenerator();\n\n animation(huntAgainAnim, 450, 350);\n\n animation(brokenMaskAnim, 450, 170);\n}", "function checkingIfGameStarts(){\n $scope.socket.on(\"gameStart\", function (params) {\n if (params != {}) {\n $scope.$apply(function () {\n makeSound.stopSong();\n if($scope.currentScreen===\"game\"){\n $scope.current3DPage = \"scripts/GameMap/index.html\";\n $scope.currentPage = \"gameContainer\";\n }\n else if($scope.currentScreen===\"guide\"){\n $scope.current3DPage = \"scripts/gameMap/swingGuide.html\";\n $scope.currentPage = \"swingGuideContainer\";\n }\n else{\n updateScore();\n }\n });\n }\n });\n }", "function reInitializeFailure() {\n console.log(\"Re-Initialize Signiant App Failed, retrying\");\n alert(\"Signiant App Connection Lost, Retrying...\");\n reInitializeApp();\n}", "function UclrError()\n{\n window.status = window.defaultStatus;\n return true;\n}", "function setUIBusy() {\n $rootScope.busy = true;\n }", "function resumeInitApp() {\n // this needs the db to exist\n setLoadMessage('Initializing Handlers');\n initGlobalUIHandlers();\n\n // sections\n setLoadMessage('Loading Sections');\n loadSections();\n $('.app-version-number').text(app.getVersion());\n\n // populate some menus\n setLoadMessage('Populating Menus');\n globalDBUpdate();\n\n removeLoader();\n}", "function shutdown(data, reason) {\n // Clean up with unloaders when we're deactivating\n if (reason != APP_SHUTDOWN) {\n unload();\n Cu.unload(\"chrome://oldidentityblockstyle/content/hook.jsm\");\n Cu.unload(\"chrome://oldidentityblockstyle/content/watchwindows.jsm\");\n }\n}", "function tryAutoScrobble () {\r\n\tif (us_getValue(\"us_autoscrobble_active\", 0) == 1) {\r\n\t\tvar response = getTrackInfo();\r\n\t\tisMusicVideo(response, tryAutoScrobbleCallback);\r\n\t}\r\n}", "function initialCheck(){\n\t\n\t/*I forgot I could've used this\n\tchrome.storage.sync.get('Enabled', function(data){\n\t\talert(data.Enabled);\t\n\t});*/\n\t\n\tchrome.runtime.sendMessage(\"StartOrNot\");\n\n\tchrome.runtime.onMessage.addListener(function(msg){\n\t\n\tswitch(msg){\n\t\tcase \"OFF\":\n\t\t\trunning = false;\n\t\t\tbreak;\n\t\tcase \"ON\":\n\t\t\trunning = true;\n\t\t\tbreak;\n\t\t}\n\t});\n\tchrome.storage.sync.get('Blur_Strength', function(data){\n\t\tstrength = data.Blur_Strength;\n\t});\n\tchrome.storage.sync.get('Choice', function(data){\n\t\tchoice = data.Choice;\n\t});\n\tchrome.storage.sync.get('Substitute', function(data){\n\t\ttext = data.Substitute;\n\t});\n}", "function startApp() {\n readSettings(storage.readJSON(\"sleeplog.json\", true) || {});\n drawNightTo(prevDays);\n Bangle.setUI(\"leftright\", (cb) => {\n if (!cb) {\n eval(storage.read(\"sleeplog.settings.js\"))(startApp);\n } else if (prevDays + cb >= -1) {\n drawNightTo((prevDays += cb));\n }\n });\n}", "blocker(program, state) {\n return false;\n }", "function always () { return true }", "checkPickingState() {\n return false;\n }", "function monitor(){\n\t\t\twakeWatch.unbind(wakeEvents, wake).bind(wakeEvents, wake);\n\t\t\tvar myCookie = e2.getCookie('lastActiveWindow');\n\t\t\tif (e2.now() - lastActive > e2.sleepAfter * 60000 ||\n\t\t\t\t(!e2.isChatterlight && myCookie && myCookie != windowId)) zzz('sleep');\n\t\t}", "_doTransitionToIdle() {\n return false\n }", "_initializeProperties(){}// prevent user code in connected from running", "function healthCheck(rlc,special) {\n if ( rlc ) {\n if ( rlc.reloading && !special ) return;\n clearOutStoppedProcesses()\n workersFullHouse(rlc)\n }\n}", "function notifyBeforePostingStandup() {\n promptStandup(commons.pickRandomReminderMsg());\n}", "function executeFeelingLucky() {\n feelingLucky = true;\n executeFeelingLuckyIfConnected();\n }", "function trayCanvasApp() {\n BD18.trays[BD18.curTrayNumb].place(null);\n}", "function trayCanvasApp() {\n BD18.trays[BD18.curTrayNumb].place(null);\n}", "function alwaysRunOnload () {\n\t\t// Placeholder/Future use.\n\t}", "function launchApp() {\r\n console.log(\"Hypersubs: Launching.\");\r\n $('#hypersubs-main-dialog').dialog('open');\r\n $('#hypersubs-splash').css('display', 'none');\r\n loadFlange(0, userPreferences.smartFill);\r\n }", "function iniciandoApp() {\n // vamos a desahabilitar el btn enviar\n btnEnviar.disabled = true;\n}", "app(x, prev) {\n prev ? this.removeApplication(true) : this.callUpdate();\n }", "app(x, prev) {\n prev ? this.removeApplication(true) : this.callUpdate();\n }", "function appNotLoaded() {\n alert(\"Signiant App Failed to load. This demo will not work.\");\n}", "function start() {\n //Currently does nothing\n }", "function OnBecameInvisible () \n{\n if (onlyIfNotVisible) ReadyToDestroy = true;\n}", "function stateChangeError() {\n ctrl.isSplashShowed.value = false;\n }", "_setWindowStateBusy(winData) {\r\n this._beforeRestore(winData);\r\n }", "function gameCannotBeLoaded(){\n\t\tAlert.render(\"The game cannot be loaded. Please acquire the lock MethodLock to load the game.<br />If you are not acquiring the lock, Race Condition can be occured.\")\n\t}", "function gameNotStarted(){\n\talert(\"Press 'Start Game' to play!\");\n}", "function checkLoaded() {\n\tif(clickedOnce == false) {\n loadTest();\n\t}\n}", "function wakeUpProcedure(){\n if (appCurrentState != StateEnum.signing && appCurrentState != StateEnum.start){\n endProcedure();\n }\n}", "lostActiveStatus(_newActiveControl) {\n return true;\n }", "function windowLostFocusEvent()\n{\n if(_loadingModels.done)\n showStartMenu();\n}", "function reset_app() {\n store.set('is_registered_x', 0);\n}", "function userDown() {\n if (!isStopped) {\n while (FallingShape.isLoweringNeeded()) {\n FallingShape.lower();\n drawGame();\n }\n }\n }", "onBoot() {}", "function loadApplication() {\n console.log(\"Application loaded\");\n // Load directly to the main menu\n configureUI(displayMainMenu());\n\n}", "run() {\n console.log('HandleSelfSync will check board');\n this.checkBootLoadPending = true;\n this.sjs.ringbus(hc.RING_ADDR_CS11, hc.CHECK_BOOTLOAD_CMD | 2);\n }", "function onAppReady() {\n var deferredStore = new _.Deferred();\n\n // kiosk mode is handled in index for store password\n if (!isKioskMode()) {\n logger.info('onAppReady calling checkStorePasswordWarning');\n deferredStore = storePasswordHelpers.checkStorePasswordWarning();\n } else {\n deferredStore.resolve();\n }\n // even though we have a failure we still want the app to continue\n deferredStore.always(function() {\n if (Alloy.CFG.devices.payment_terminal_module != 'webDevice' && (Alloy.CFG.devices.verify_payment_terminal_connection_at_login || Alloy.CFG.devices.check_device_dialog_interval > 0)) {\n addPaymentDeviceTimer = true;\n checkPaymentDevice();\n }\n $.header.initNotifications();\n });\n}", "onShutdown () {\n unload()\n }", "function isSomRunning() {\n return isRunning;\n}", "function checkOffscreenBlue() {\n if (isOffscreen(circle1)) {\n state = `ignored`;\n }\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}", "async initialize() {\n // initialize system log first since it may be needed for error output\n this.onErrorMakeSystemManagerVisible = configUtil_1.ConfigUtilInstance.getDefault(this.manifest, \"manifest.finsemble.bootConfig.onErrorMakeSystemManagerVisible\", false);\n systemLog_1.default.initialize(this.onErrorMakeSystemManagerVisible);\n //make sure the essential config is available\n this.confirmConfigAndReport(this.manifest);\n // get the finsemble UUID with is unique system-wide and the same across restarts\n this.finUUID = system_1.System.Application.getCurrent().uuid;\n console.log(\"finUUID\", this.finUUID);\n // if old finsemble \"applications\" left around from when Finsemble was last running, kill then now before a fresh boot starts everything\n if (!(this.manifest.finsemble.killOrphanApplications === false)) {\n console.log(\"killing applications\");\n await common_1.killOldApplications(this.finUUID);\n }\n }", "function renderHasNotSuspendedYet() {\n // If something errored or completed, we can't really be sure,\n // so those are false.\n return workInProgressRootExitStatus === RootIncomplete;\n }" ]
[ "0.61176944", "0.5900901", "0.5820811", "0.5809142", "0.5799704", "0.57780474", "0.57692564", "0.5693567", "0.5692997", "0.5669804", "0.56598526", "0.5659485", "0.5654658", "0.56527585", "0.56492007", "0.5648123", "0.5645128", "0.5639765", "0.5618585", "0.56154007", "0.56107813", "0.55890423", "0.55890423", "0.5579937", "0.55624497", "0.55546373", "0.5551098", "0.5545328", "0.5533179", "0.55317044", "0.553066", "0.55185366", "0.5516897", "0.5512283", "0.5490437", "0.54812217", "0.54757077", "0.54726255", "0.5472307", "0.5464942", "0.5461955", "0.54589623", "0.5458433", "0.5449521", "0.5448307", "0.5448307", "0.5448307", "0.5448307", "0.5448307", "0.5436162", "0.5436048", "0.5428673", "0.5425909", "0.5419517", "0.5413835", "0.5412549", "0.5412352", "0.540793", "0.54048324", "0.5404682", "0.5392324", "0.5390174", "0.53723735", "0.5364675", "0.53616863", "0.5346184", "0.5343116", "0.5335827", "0.53356946", "0.5334767", "0.53332305", "0.5331934", "0.5331934", "0.5330604", "0.53293705", "0.5321232", "0.53211594", "0.53211594", "0.5319836", "0.5318818", "0.53184867", "0.5316815", "0.5311208", "0.52990663", "0.5291915", "0.5290446", "0.5287276", "0.52827984", "0.528211", "0.5280326", "0.5280128", "0.5271788", "0.52709615", "0.52683216", "0.5260966", "0.5260724", "0.5259845", "0.5256761", "0.52518225", "0.52517986", "0.5246047" ]
0.0
-1
this function is called after the login
function enterSys() { UserInfo.UserId = document.getElementById('userNum').value; // ajax function that registers the user/device to the server registerDevice(UserInfo, registerSuccess, registerFail); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loginCompleted() {\n }", "function login() {\n self.isLoggedIn = true;\n }", "function onLogin() {}", "function processSuccessLogin(result) {\n // Success Login save the id and the loginId to the footer\n // Can't save to session or anything here\n $($pt.landPage.session.id).text(result[0].id);\n $($pt.landPage.session.user).text(result[0].loginId);\n $($pt.landPage.session.email).text(result[0].email);\n\n // Notifications\n if (result[0].notify !== 0) {\n $($pt.landPage.session.notify).attr(\"data-badge\", result[0].notify);\n $(document).attr(\"title\", \"* PhotoThief\");\n $(\"#favicon\").attr(\"href\", \"favicon2.ico\");\n }\n\n // Hide slogan\n $($pt.landPage.section.slogan).addClass(\"hidden\").removeClass(\"show\");\n // Hide signup button\n $($pt.landPage.action.signup).addClass(\"hidden\").removeClass(\"show\");\n // Show demand button\n $($pt.landPage.action.demand).addClass(\"show\").removeClass(\"hidden\");\n // Show upload button\n $($pt.landPage.action.upload).addClass(\"show\").removeClass(\"hidden\");\n // Show user info\n $($pt.landPage.session.info).addClass(\"show\").removeClass(\"hidden\");\n\n // Toggle the login Button to say logout\n $($pt.landPage.action.icon).text(\"exit_to_app\");\n $($pt.landPage.action.text).text(\"Logout\");\n $($pt.landPage.action.login).addClass(($pt.landPage.action.logout).substr(1));\n $($pt.landPage.action.login).removeClass(($pt.landPage.action.login).substr(1));\n\n // Confirm leaving webapp\n window.onbeforeunload = function() {\n return \"\";\n };\n\n // Reload the main page with carousel with user specific data ???\n //initialize();\n }", "function loginAfterRegister()\n {\n UserService.login($scope.user)\n .then(function(response) {\n if (response.status === 200) {\n //Should return a token\n $window.localStorage[\"userID\"] = response.data.userId;\n $window.localStorage['token'] = response.data.id;\n $ionicHistory.nextViewOptions({\n historyRoot: true,\n disableBack: true\n });\n $state.go('lobby');\n } else {\n // invalid response\n $state.go('landing');\n }\n resetFields();\n }, function(response) {\n // something went wrong\n $state.go('landing');\n resetFields();\n });\n }", "function checkLastLogin() {\n\n }", "function loginUserCallback() {\n loginUser();\n }", "function login() {}", "function proceed() {\r\n $scope.status = ''\r\n $scope.logo.class = 'animated zoomOutDown'\r\n AppService.getMutualMatches() // load in the background\r\n // disable the back button\r\n $ionicHistory.nextViewOptions({\r\n historyRoot: true,\r\n disableBack: true\r\n })\r\n\r\n // the timeout is to give the drop CSS animation time\r\n $timeout(() => AppService.goToNextLoginState(), 1000)\r\n\r\n var profile = AppService.getProfile();\r\n var user = {\r\n userId: profile.uid,\r\n name: profile.name,\r\n custom_attributes: {\r\n Name: profile.name,\r\n user_id: profile.uid\r\n }\r\n };\r\n\r\n intercom.updateUser(user, function() {\r\n intercom.displayMessenger();\r\n });\r\n }", "function handleLogin() {\r\n if ((!assetEmpty(email) && !assetEmpty(password))\r\n && assertEquals(email, registeredState.email)\r\n && assertEquals(password, registeredState.password)\r\n ) {\r\n setPassword('');\r\n global.nameLogin = registeredState.name;\r\n navigation.replace('BottomStack');\r\n } else {\r\n Alert.alert(\r\n 'Não foi possível entrar:',\r\n 'E-mail/senha incorretos!'\r\n );\r\n }\r\n }", "onLoginSuccess() {\n\t\tApp.navigatePrevious();\n\t}", "function detectLogin()\n {\n $.when(api.whoami()).done(function(user)\n {\n // update the UI to reflect the currently logged in user.\n topnav.update(user.firstName + ' ' + user.lastName);\n }).fail(function()\n {\n topnav.clear();\n });\n }", "function authLoginSuccess(e) {\n\t\tif (e.origin !== global.bom.settings.url)\n\t\t\treturn;\n\t\tsetAuthCookie(e.data);\n\t\tlocation.reload(true);\n\t}", "authCallback() {\n console.log('authCallback');\n /* this.renderLoginButton().then(() => {\n console.log('redirect to the landing page');\n }).catch(() => {\n console.log('start yolo');\n this.initYolo();\n });*/\n }", "function localLogin() {\n Message.loading();\n User.login({}, LoginModel.form).$promise\n .then(function(userWrapper) {\n Message.hide();\n console.log(\"---------- userWrapper ----------\");\n console.log(userWrapper);\n AppStorage.user = userWrapper.user;\n AppStorage.token = userWrapper.token;\n AppStorage.isFirstTime = false;\n U.goToState('Main.MainTab.PostList.PostListRecent', null, 'forward');\n })\n .catch(function(err) {\n console.log(\"---------- err ----------\");\n console.log(err);\n if (err.status === 403) {\n return Message.alert('로그인 알림', '비밀번호/이메일이 틀렸습니다. 다시 입력해주세요');\n } else {\n return Message.alert();\n }\n });\n }", "function init() {\t \n\t notify = new Notify(Play.getId('altLogin'));\n\t\tform = new FormOk(frmLogin);\n\t\tif(sessionStorage.length > 0){\t\t\t\n\t\t\tvar message = sessionStorage.getItem(Constants.SESSIONSTORAGE_MESSAGE);\n\t\t\tsessionStorage.clear();\t\t\t\n\t\t\tif( message === null){\n\t\t\t\tnotify.close();\t\t\t\t\n\t\t\t}else {\n\t\t\t\tnotify.success(message);\t\t\t\t\n\t\t\t}\t\t\t\t\n\t\t} else {\t\n\t\t\tnotify.close();\n\t\t}\n\t\tformLoginAction();\t\n\t}", "function callback() {\n deleteUsuarioLogado();\n onChangeView(VIEW_LOGIN_KEY);\n }", "function authLogin() {\n\t\tpopup(tools.urlLogin, 'BOM - Login', 302, 320);\n\t\teventer(messageEvent, authLoginSuccess, false);\n\t}", "handleLogin() {\n this.authenticate();\n }", "function handleLoginOnStartUp() {\n //if user is signed in, show their profile info\n if (blockstack.isUserSignedIn()) {\n var user = blockstack.loadUserData().profile\n //blockstack.loadUserData(function(userData) {\n // showProfile(userData.profile)\n //})\n }\n //signin pending, \n else if (blockstack.isSignInPending()) {\n blockstack.handlePendingSignIn.then((userData) => {window.location = window.location.origin})\n }\n\n}", "function autoLoginAfterRefresh() {\n\t\tif(g_UserName) {\n\t\t\tconst username = localStorage.getItem(g_UserName +'.username'); // get it from cookie\n\t\t\tconst password = localStorage.getItem(g_UserName +'.password'); // get it from cookie\n\t\t\tif(username && username) login(username, password);\n\t\t}\n\t}", "function login_account () {\n\tdb_account_exists().then(function() {\n\t\tvar date;\n\t\tdate = new Date();\n\t\tdate = date.getUTCFullYear() + '-' +\n\t\t\t\t\t ('00' + (date.getUTCMonth() + 1)).slice(-2) + '-' +\n\t\t\t\t\t ('00' + date.getUTCDate()).slice(-2) + ' ' +\n\t\t\t\t\t ('00' + date.getUTCHours()).slice(-2) + ':' +\n\t\t\t\t\t ('00' + date.getUTCMinutes()).slice(-2) + ':' +\n\t\t\t\t\t ('00' + date.getUTCSeconds()).slice(-2);\n\t\tlet inputs = {\n\t\t\t\t\tusername: $(\"#loginuser\").val(),\n\t\t\t\t\tdate: date\n\t\t\t\t\t};\n\t\tlet params = {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\turl: \"/api/user/lastlogin\",\n\t\t\t\t\tdata: inputs\n\t\t\t\t\t};\n\t\t$.ajax(params).done(function(data) {\n\t\t\t\tdocument.getElementById(\"greetings\").innerHTML = \"Welcome back \"+localStorage.getItem('username')+\"!\";\n\t\t\t\tset_local($(\"#loginuser\").val());\n\t\t\t\tset_update();\n\t\t\t\tyour_stats($(\"#loginuser\").val());\n\t\t\t\tcurrent_stage=\"stage\";\n\t\t\t\tswitch_stage();\n\t\t\t});\n\t\t}).catch(function (err) {\n\t\t\tconsole.log(err);\n\t\t});\n}", "function loginComplete() \r\n {\r\n\t\t\t\t//alert('loginComplete: ' + FB.Facebook.apiClient._session);\r\n\t\t\t\t\r\n\t\t\t\tvar session = FB.Facebook.apiClient._session;\r\n\t\t\t\t\r\n\t\t\t\tvar parameters = {\r\n\t\t\t\t\tapiKey: API_KEY,\r\n\t\t\t\t\texpires: session.expires,\r\n\t\t\t\t\tsecret: session.secret,\r\n\t\t\t\t\tsessionKey: session.session_key,\r\n\t\t\t\t\tsig: session.sig,\r\n\t\t\t\t\tuid: session.uid\r\n\t\t\t\t};\r\n\t\t\t\t\r\n\t\t\t\tswfDispatcher( 'loginComplete', parameters );\r\n }", "function proceed () {\n\t\t\t/*\n\t\t\t\tIf the user has been loaded determine where we should\n\t\t\t\tsend the user.\n\t\t\t*/\n\t\t\tif (store.getters.getBearerToken) {\n\t\t\t\tnext();\n\t\t\t} else {\n\t\t\t\t//user is not logged in\n\t\t\t\tconsole.log('you are not logged in');\n\t\t\t}\n\t\t}", "function proceed () {\n\t\t\tif (!store.getters.getBearerToken) {\n\t\t\t\tnext ();\n\t\t\t} else {\n\t\t\t\tconsole.log('Already logged in');\n\t\t\t} \n\t\t}", "function loginCompleted(data) {\n if (data.token) {\n $state.go('main');\n } else { window.alert('Invalid Credentials'); }\n }", "function registerSuccessFn() {\n\t\t\t\t\tAuthentication.login($scope.username, $scope.password)\n\t\t\t\t\t\t.then(function (response) {\n\t\t\t\t\t\t\tAuthentication.setAuthenticatedAccount(response.data);\n\t\t\t\t\t\t\twindow.location = '/#/users/' + response.data.username;\n\t\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t}", "function logout()\n {\n\n }", "function login () {\n vm.isloading= true;\n authUser.loginApi(vm.credential);\n }", "function afterLoginAttemp(item) {\n\tvar ok = false;\n\n\tif (item.result != 'OK') {\n\t\talert(\"Failed to login as: \" + login.value + \", reason: \"\n\t\t\t\t+ item.message);\n\t} else {\n\t\tok = true;\n\t\tloggedInUser = item.login.replace(/['\"]+/g, '');\n\t\tstatusLogin.innerHTML = \"Logged: \" + loggedInUser;\n\t\tbtnCreateRoom.disabled = false;\n\t}\n\n\tloginPanel.style.visibility = 'hidden';\n\tglassPanel.style.visibility = 'hidden';\n\n\t/* get user location */\n\tif (ok && navigator.geolocation) {\n\t\tnavigator.geolocation.getCurrentPosition(saveGeoPosition);\n\t} else {\n\t\tconsole.log(\"unable get location!\");\n\t}\n\n}", "function handleClientLoad() {\n\t\t console.log(\"handle login\") \n gapi.client.setApiKey(apiKey);\n window.setTimeout(checkAuth,1);\n }", "orderAccess() {\n loginPage.open();\n loginPage.username.setValue('[email protected]');\n loginPage.password.setValue('pepito');\n loginPage.submit();\n }", "loginStart() {\n\n }", "login() {\n if (!this.API)\n return;\n this.API.redirectAuth();\n }", "function loginn(){\n // localStorage.setItem('user-pizza', 'Paul');\n setLog(!log)\n }", "ready(){super.ready();this.addEventListener(\"ajax-response\",e=>this._loginStatus(e))}", "function init() {\n debugger;\n $scope.GetUserInformation = SessionManagement.Get(\"UserInfo\");\n userInformation = SessionManagement.Get(\"UserInfo\");\n if ($scope.GetUserInformation == null || $scope.GetUserInformation.Role < 2)\n CommonMethod.LogOut();\n SessionManagement.Set(\"EntryManagementUserId\", 0);\n }", "function logout() {\n\n }", "login() {\n let that = this;\n if (!this.user) {\n this.clear();\n loadTemplate('templates/login.html',function(responseText) {\n hideMenu();\n $('#content').html(eval('`' + responseText + '`'));\n $('#loginAlert').hide();\n let loginForm = $('#loginForm');\n\n loginForm.submit(function(event) {\n event.preventDefault();\n deleteCookie('connect.sid');\n let username = $('input[name=username]').val();\n let password = $('input[name=password]').val();\n loadTemplate('api/login',function(userData) {\n that.user = JSON.parse(userData);\n /* First time we log in */\n if (that.user.defaultSubject === 'default') {\n console.log(\"addSubject in login\");\n addSubject(updateFromServer);\n //updateFromServer();\n /* We are veteran/recurrent users */\n }else {\n setCookie('user',userData,7);\n updateFromServer();\n }\n },'POST','username=' + username + '&password=' + password,false);\n return false; //Avoid form submit\n });\n });\n }else {\n generateMenu();\n that.getTemplateRanking();\n }\n }", "function login() {\n // We give username and password to log the user in\n // In case there is something wrong with the credentials\n // we use the setError to display it\n // If the user logs in successfully then the loginCallback is called.\n setLoading(true);\n databaseLogin(username, password, loginCallback, showError);\n }", "handleLogin() {\n notification.success({\n message: 'Abrkadabra - Dokumentų valdymo sistema - 2019',\n description: \"Prisijungimas sėkmingas.\",\n });\n this.loadCurrentUser();\n this.props.history.push(\"/pagrindinis\");\n }", "function cmisLoginOk() {\n login.loginOk(initializeCmisApp);\n}", "function login() {\n\n // User has not compeleted the tutorial\n if (!eCon.local.firstRun) {\n eCon.Container.pagecontainer('change', 'help.html');\n return;\n }\n\n /**\n * Variable tracking whether the user needs to log in\n * @type {boolean}\n */\n var login = true;\n\n\n if (eCon.local.ID) { // Previously logged into a conference\n if (moment(eCon.local.EXP).isAfter(moment())) { // Conference expiration is after now\n login = false;\n } else {\n eCon.local.ID = null;\n eCon.local.EXP = null;\n eCon.local.Profile = null;\n deleteData();\n }\n }\n\n if (!login) {\n $('body').pagecontainer('change', 'conference.html', {});\n } else {\n $('body').pagecontainer('change', 'login.html', {changeHash: 'false'});\n }\n}", "function login() {\n\n}", "function login() {\n User.login(self.user, handleLogin);\n }", "function updateUIOnUserLogin() {\n console.debug(\"updateUIOnUserLogin\");\n\n putStoriesOnPage(); \n\n // $allStoriesList.show();\n\n updateNavOnLogin();\n}", "function init(){\n if(user != null){\n userData = JSON.parse(user);\n }\n var mode = localStorage.getItem(\"Theme\");\n if(mode == \"light\"){\n lightMode();\n } else{\n darkMode();\n }\n \n var secret = localStorage.getItem(\"code\");\n if(secret == \"secret\"){\n localStorage.setItem(\"code\", \"secret\");\n } else{\n // alert(\"You have been logged out! Please Login again!\");\n localStorage.setItem(\"code\", \"\");\n window.location.href = \"sign.html\";\n }\n }", "function after_Logout() {\n\t\twindow.location = WAKL.CONST.PAGE_LOGIN;\n\t}", "_eventLogin() {\n console.info('Successfully logged in! Initializing wiki listeners...');\n this._readLine();\n }", "async handleLogin () {\n\t\tconst { email, password, teamId } = this.request.body;\n\t\tthis.user = await new LoginCore({\n\t\t\trequest: this\n\t\t}).login(email, password, teamId);\n\t}", "function onLoginComplete(res) {\n Titanium.API.info('onLoginComplete')\n Titanium.API.info('Status: ' + this.status)\n Titanium.API.info('ResponseText: ' + this.responseText)\n Titanium.API.info('ConnectionType: ' + this.connectionType)\n Titanium.API.info('Location: ' + this.location)\n\n endLoading()\n var responseJson = JSON.parse(this.responseText)\n var token = responseJson.token\n Ti.App.Properties.setString('token', token)\n Ti.App.Properties.setString('email', $.emailTextField.value)\n Alloy.createController('userBookmarks').getView().open();\n}", "function onHotmailLogin() {\r\n\t\tvar session = WL.getSession();\r\n\t\tif (session) {\r\n\t\t\tgetHotmailUser(session);\r\n\t\t}\r\n\t}", "async completeLogin(startup) {\n let loggedIn = this.accessToken && this.accountId;\n this.appObject.loggedIn = loggedIn;\n\n if (!this.accessToken || this.accountId) {\n return; // EARLY RETURN -- either we're not logged in, or we're completely logged in\n }\n\n // We have an access token and need the user info: fetch the user info\n if (process.env.OVERRIDE_ACCOUNT_ID === '0') {\n // The normal case\n await this.setDefaultAccount(startup)\n } else {\n if (startup) {this.appObject.telemetry.start()}\n this.name = process.env.OVERRIDE_NAME;\n this.email = process.env.OVERRIDE_EMAIL;\n this.accountId = process.env.OVERRIDE_ACCOUNT_ID;\n this.accountName = process.env.OVERRIDE_ACCOUNT_NAME;\n this.baseUri = process.env.OVERRIDE_BASE_URL \n }\n \n if (this.accountId) {\n // accountId and other settings were fetched\n this.appObject.loggedIn = true;\n } \n }", "authentication_complete() {\n\t\tlet selected_session = $( '.selected' ).attr( 'data-session-id' ),\n\t\t\terr_msg = _config.translations.auth_failed;\n\n\t\tthis.auth_pending = false;\n\n\t\t_config._set( selected_session, 'user', lightdm.authentication_user, 'session' );\n\n\t\t$( '#timerArea' ).hide();\n\n\t\tif ( lightdm.is_authenticated ) {\n\t\t\t// The user entered the correct password. Let's start the session.\n\t\t\t$( 'body' ).fadeOut( 1000, () => lightdm.start_session( selected_session ) );\n\n\t\t} else {\n\t\t\t// The user did not enter the correct password. Show error message.\n\t\t\tthis.show_message( err_msg, 'error' );\n\t\t}\n\t}", "function login() {\n if (ctrl.remember) {\n $window.localStorage.setItem('ldap_username', ctrl.username);\n $window.localStorage.setItem('ldap_password', ctrl.password);\n }\n ctrl.loading = true;\n ipcRenderer.send('do-log-in', ctrl.username, ctrl.password);\n }", "function loginModalCallback(){\n\t\tvar screenName;\n\t\t\n\t\tif(ScreenManager.getCurrentScreen().getDisplayName != null){\n\t\t\tscreenName = ScreenManager.getCurrentScreen().getDisplayName();\n\t\t}else{\n\t\t\tscreenName = ScreenManager.getCurrentScreen().displayName;\n\t\t}\n\t\t\n\t\tif(screenName == WelcomeScreen.displayName){\n\t\t\tModalManager.hideModal();\n\t\t\tScreenManager.changeScreen(new UserIdentityScreen())\n\t\t}else{\n\t\t\tModalManager.hideModal();\n\t\t\tScreenManager.replaceScreen(ScreenManager.getCurrentScreen());\n\t\t}\n\t}", "function doBasicLoginAuth(){\n\t\t\n\t\t$__loginKey = localStorage.getItem(\"loginKey\");\n\t\t$__identification = localStorage.getItem(\"identification\");\n\t\t\n\t\tif($__loginKey == null || $__loginKey == \"\" || $__identification == null || $__identification == \"\"){\n\t\t\t\n\t\t\twindow.location = \"do_Login.html\";\n\t\t\t\n\t\t}else{\n\t\t\t\n\t\t\twindow.location = \"main_panel.html\";\n\t\t\t\n\t\t}\t\n\t\t\n\t}", "function proceed() {\n\t\t/*\n\t\t\tIf the user has been loaded determine where we should\n\t\t\tsend the user.\n\t\t*/\n if (store.getters.getUserLoadStatus == 2) {\n next();\n } else if (store.getters.getUserLoadStatus == 3) {\n //user is not logged in\n console.log('you are not logged in');\n }\n }", "function initAuth() {\n // Check initial connection status.\n if (localStorage.token) {\n processAuth();\n }\n if (!localStorage.token && localStorage.user) {\n // something's off, make sure user is properly logged out\n GraphHelper.logout();\n }\n }", "function login(event)\n{\n event.preventDefault();\n\tvar l_username = $('#username').val();\n\tvar l_password = $('#password').val();\n var l_Storefront = 'Storefront';\n var l_start ='Storefront';\n\tapi_async.auth.login(l_username, l_password,\n\t\tfunction (p_data)\n\t\t{\n\t\t\t$.cookie('user_id', p_data.user_id, { expires: 2, path: '/' });\n\t\t\t$.cookie('user_hash', p_data.user_hash, { expires: 2, path: '/' });\n\t\t\t$.cookie('expiration_date', p_data.expiration_date, { expires: 2, path: '/' });\n var session = api_sync.auth.get_current_user();\n window.location = '/';\n if (session.scope)\n {\n if(session.scope_name[0] == '') \n {\n window.location = '/';\n $('#error_msg').text('Succes');\n }\n \n else\n {\n window.location = '/';\n $('#error_msg').text('Succes');\n }\n }\n\t\t},\n\t\tfunction ()\n\t\t{\n\t\t\t$('#password').val('');\n\t\t\t$('#error_msg').text('Wrong Credentials!');\n\t\t});\n}", "function loginClick() {\n\t username = $(\"#userName\").val();\n\t password = $(\"#password\").val();\n\t getRememberMestatus();\n\t var params = {\"username\":username,\"password\":password};\n\t var callerId = \"login\";\n\t var url = \"/logon\";\n\t reqManager.sendPost(callerId, url, params, loginSuccessHandler, loginErrorHandler, null);\n\t}", "activate() {\n if (!loginStat()) {\n this.username = ''\n // var status = window.sessionStorage.getItem('rotate')\n // console.log('rotate ' ,status);\n // window.sessionStorage.setItem('rotate', 'true')\n // console.log('rotate ' ,status);\n\n if (window.localStorage.getItem('rotate') === 'true') {\n this.picture = 'http://tse1.mm.bing.net/th?id=OIP.Me6a9845f4c2e2f7f2c43c833bbcec9ddo0&w=203&h=142&c=7&rs=1&qlt=90&o=4&pid=1.1'\n window.localStorage.setItem('rotate', 'false');\n } else {\n this.picture = 'http://tse1.mm.bing.net/th?&id=OIP.Mccf9777d953a5488e46b20840f6069f3o0&w=198&h=198&c=0&pid=1.9&rs=0&p=0'\n window.localStorage.setItem('rotate', 'true');\n }\n\n // this.username = JSON.parse(window.localStorage.getItem('profile')).nickname\n } else {\n // this.time = new Date(JSON.parse(window.localStorage.getItem('profile')).updated_at)\n this.picture = JSON.parse(window.localStorage.getItem('profile')).picture\n this.username = JSON.parse(window.localStorage.getItem('profile')).nickname\n this.logOut = !this.logOut\n }\n }", "function identifyLoginState() {\n\tif (window.sessionStorage.getItem(\"loginUser\") != \"\") {\n\t\t$(\".publish-area\").removeClass(\"hidden-window\", 700);\n\t\t$(\"#shadow\").fadeIn(700);\n\t} else {\n\t\talert(\"請先登入 !\");\n\t\t$(\".login-area\").removeClass(\"hidden-window\", 700);\n\t\t$(\"#shadow\").fadeIn(700);\n\t}\n}", "processLogin(result, platform) {\n this.setUserData(result, platform);\n this.setState({ refresh: false });\n this.props.goHome(result, platform);\n }", "function dummyLogin() {\n// loginAs( dummyFilters );\n loginAs(memberSearchFilters);\n }", "function goLogIn(){\n\t\tlocalStorage.setItem(\"Sawintro\", \"true\");\n\t\t\t$state.go(\"app.home\");\t\n\t}", "loginEventListenter() {\n\t\tdocument.querySelector('#login-btn').addEventListener('click', () => {\n\t\t\tconst emailValue = document.querySelector('#login-email').value;\n\t\t\tconst passwordValue = document.querySelector('#login-password').value;\n\n\t\t\t//fetches any user with the an email and password matching the inputs\n\t\t\tfetch(`http://localhost:8088/users?email=${emailValue}&password=${passwordValue}`)\n\t\t\t\t.then((r) => r.json())\n\t\t\t\t.then((user) => {\n\t\t\t\t\t//If a user is returned\n\t\t\t\t\tif (user.length != 0) {\n\t\t\t\t\t\t//Sets the userId in session storage to the id of the user that was fetched, deactivates the modal, and clears the values in the form\n\t\t\t\t\t\tsessionStorage.setItem('userId', user[0].id);\n sessionStorage.setItem(\"username\", user[0].username);\n nutLogin.deactivateModal();\n location.reload(true);\n\t\t\t\t\t\tdocument.querySelector('#login-email').value = '';\n\t\t\t\t\t\tdocument.querySelector('#login-password').value = '';\n\n\t\t\t\t\t\t//If it didn't find a match it returns an error message\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdocument.querySelector('#login-error-container').innerHTML = 'email or password is incorrect!';\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t});\n\t}", "function login() {\n //Stop spinner\n document.getElementById(\"loginBtnIcon\").classList.remove(\"fas\",\"fa-spinner\",\"fa-spin\");\n\n //Enable menu button:\n toggleEnable(document.getElementById(\"menuBtn\"))\n\n //Show bottom bar buttons and highlight feed mode button\n itemBlock(document.getElementById(\"bottomBar\"))\n \n //Change title bar to that of app start page\n itemHide(document.getElementById(\"topBarTitleWelcome\"))\n itemBlock(document.getElementById(\"topBarTitleData\"))\n \n // Make sure correct menu button icon is displayed\n itemBlock(document.getElementById(\"menuBtn\"))\n itemHide(document.getElementById(\"menuBtnAlt\"))\n \n //Show only the menu items for current mode\n setBlock([...document.getElementsByClassName(\"dataMenuItem\")])\n\n //hide login screen and show feed screen\n itemHide(document.getElementById(\"loginModeDiv\"))\n itemBlock(document.getElementById(\"dataPageDiv\"))\n\n\n //Save the current user name to local storage\n console.log(\"Storing: \", document.getElementById(\"emailInput\").value, \" In local storage \")\n window.localStorage.setItem(\"UserName\", document.getElementById(\"emailInput\").value)\n loggedInUser = document.getElementById(\"emailInput\").value\n //Set mode to current mode\n mode = \"dataMode\"\n}", "function init() {\n\t\t\tAuth.logout();\n\t\t}", "function login(assistant) {\n biteFunctions.biteUser(assistant);\n //biteFunctions.getUserOrders(assistant);\n }", "async function handleRedirectAfterLogin() {\n//??-- var ses = await solidClientAuthentication.handleIncomingRedirect({restorePreviousSession: true});\n await solidClientAuthentication.handleIncomingRedirect();\n\n const session = solidClientAuthentication.getDefaultSession();\n console.log('handleRedirectAfterLogin(): session:', session);\n console.log('handleRedirectAfterLogin(): session.info.isLoggedIn: ', session.info.isLoggedIn);\n if (session.info.isLoggedIn) {\n console.log('handleRedirectAfterLogin(): session.info.webId: ', session.info.webId);\n // Update the page with the login status.\n gAppState.updateLoginState();\n }\n}", "function forceNewLogin() {\n window.location.href = getWebServerRelativeUrl() + '_layouts/closeConnection.aspx?loginasanotheruser=true';\n }", "function application_post_init(){\n \tappscore.print.start();\n \tmenuVisibility = false;\n //\tgoogleAnalytics = new ganalytics.GAnalyticsLib(\"dsfhjdfhsdhskh\"); //UA-80818309-1 for MyPower\n\tkony.application.setApplicationCallbacks(callbacksObj);\n\tif(loginManager.getLogin() != null){\n\t\t// Validate token\n\t\tvar token = loginManager.getLogin().token;\n\t\t// If token is valid then navigate to FormMenu\n\t\t// invokeAppService(\"Login\", {\"token\":token}, function(){status, resultTable});\n\t\t// else navigate to FormLogin\n\t\treturn frmSplash;\n\t}\n \tappscore.print.stop(); \n}", "function onChangeLogin() {}", "usersLogIn(e){\n\t\te?e.preventDefault():'';\n\t\tlet {email, password} = this.props.users_controle;\n\t\tif(email&&password){\n\t\t\tthis.props.usersLogIn( email, password, ()=>{\n\t\t\t\tthis.props.usersGetActiveUser();\n\t\t\t\tthis.props.usersControle(this.init());\n\t\t\t\tFlowRouter.go('/');\n\t\t\t} );\n\t\t}else{\n\t\t\t//Trigger alert thanks to Bert meteor package\n\t\t\tBert.alert({\n\t\t\t\ttitle:'Error data for login',\n\t\t\t\tmessage:'give at least email & password ' ,\n\t\t\t\ttype:'info',\n\t\t\t\ticon:'fa-info'\n\t\t\t});\n\t\t}\n\t\t\n\t}", "function init() \n{\n RMPApplication.debug(\"begin init : login = \", login);\n $(\"#id_spinner_insert\").hide();\n RMPApplication.set(\"variables.location_code\", RMPApplication.get(\"location_code\"));\n RMPApplication.set(\"last_question\", \"Aucune solution trouvée, décrivez votre problème de façon précise !\");\n\n var options = {};\n var pattern = {};\n pattern.login = RMPApplication.get(\"login\");\n c_debug(dbug.init, \"=> init: pattern = \", pattern);\n\n // CAPI for getting user information\n id_get_user_info_as_admin_api.trigger (pattern, options , get_info_ok, get_info_ko); \n RMPApplication.debug(\"end init\");\n}", "async function handlerLogin() {\n // alert('Entrando');\n MyContext.setTokenUser('aasdasd7as89d7as98d7a89sd7a9s8d7')\n navigation.navigate('logged')\n }", "userLogin() {\n let logInVal = document.querySelector(\"#userNameVal\").value;\n let passwordVal = document.querySelector(\"#passwordVal\").value; //get to compare\n\n _nomadData.default.connectToData({\n \"dataSet\": \"users\",\n \"fetchType\": \"GET\",\n \"embedItem\": \"?_embed=users\"\n }).then(parsedUsers => {\n parsedUsers.forEach(user => {\n /*If login credentials match those in database.json. We want the user to be displayed their \"dashboad\"\n and navigation bar. So we need to set display to none and invoke the function - createNavBar()*/\n if (logInVal === user.userName && passwordVal === user.password) {\n //hides NOMAD heading\n $(\".t-border\").hide(); //hides the form\n\n $(\".form\").hide(); //displays navigatin bar\n\n _dashboard.default.createNavBar(); //session storage\n\n\n sessionStorage.setItem(\"userId\", user.id);\n let userId = sessionStorage.getItem(\"userId\"); //console.log verifying that credentials match and user is logged in\n\n console.log(\"logged in as\" + \" \" + user.userName);\n console.log(\"your user ID is: \" + userId);\n let usersName = \" \";\n\n _nomadData.default.connectToData({\n \"dataSet\": \"users\",\n \"fetchType\": \"GET\",\n \"dataBaseObject\": \"\",\n \"embedItem\": \"?_embed=users\"\n }).then(users => {\n users.forEach(user => {\n if (user.id === Number(userId)) {\n usersName = user.userName;\n }\n });\n let taskContainers = document.getElementById(\"#tasksContainer\");\n const targetContainer = document.getElementById(\"output\");\n\n let welcomeMessage = _domComponents.default.createDomElement({\n elementType: \"h1\",\n content: `welcome ${usersName}`,\n cssClass: \"welcome-user\"\n });\n\n targetContainer.insertBefore(welcomeMessage, taskContainers);\n });\n\n _tasks.default.createTaskTables();\n\n _nomadData.default.connectToData({\n \"dataSet\": \"users\",\n \"fetchType\": \"GET\",\n \"dataBaseObject\": \"\",\n \"embedItem\": \"?_embed=users\"\n }).then(users => {\n users.forEach(user => {\n if (user.id === Number(userId)) {\n const targetContainer = document.getElementById(\"output\");\n targetContainer.appendChild(_domComponents.default.createDomElement({\n elementType: \"h1\",\n content: `welcome ${user.userName}`,\n cssClass: \"welcome-user\"\n }));\n }\n });\n });\n }\n });\n });\n }", "function login() {\n Auth.login(authCtrl.user).then(function(){\n $state.go('home');\n });\n }", "function checkLogin() {\n return attempt(Cookies.get('Authorization'), function (response) {\n auth = Cookies.get('Authorization');\n setAuthCookie(auth);\n $(\"#span-name\").text(response.department+' '+response.name);\n }, function () {\n window.location.replace(\"login.html\");\n });\n}", "switchToLogin() {\n document.getElementById(\"login-form-container\").classList.remove('right-panel-active');\n this.clearFeedback();\n updatePageTitle(\"Logg inn\");\n }", "onlog() {}", "function loginSuccess(response) {\n\t$('.login-and-demo').remove();\n \tlocalStorage.setItem(\"TOKEN\", response.authToken);\n localStorage.setItem(\"userId\", response.userId);\n \tnewToken();\n \tshowReservationList();\n $('.logout-button').removeClass('hidden');\n $('.join-class').removeClass('hidden');\n}", "function response(result){\n if(result && !result.error){\n if(callbacks.pass) callbacks.pass(result);\n app.log('Logged in', result);\n\n isIn = true;\n authToken = gapi.auth.getToken().access_token;\n db.load();\n }\n else {\n if(callbacks.fail) callbacks.fail(result);\n app.log('Could not log in.', result);\n\n isIn = false;\n authToken = null;\n }\n checked = true;\n auth.visualize();\n }", "onLoggedIn() {\r\n this.controller = new MainController(this.login.pryvUserConnection, \"event-view\", \"category-events\");\r\n this.controller.init();\r\n }", "function login() {\n var userName = document.getElementById(\"username\");\n var password = document.getElementById(\"password\");\n\n var logonForm = document.getElementById(\"logonForm\");\n logonForm.setAttribute(\"class\", \"hiddenPage\");\n\n request.userName = userName.value;\n\n // the password has not been protected / encyrpted - please change if required.\n request.password = password.value;\n\n // retry the call to the Epicor API\n makeServiceRequest();\n }", "async login() {}", "function loginAndSubmitForm() {\n // hide the forms for logging in and signing up\n $loginForm.hide();\n $createAccountForm.hide();\n\n // reset those forms\n $loginForm.trigger(\"reset\");\n $createAccountForm.trigger(\"reset\");\n\n // show the stories\n $allStoriesList.show();\n\n // update the navigation bar\n showNavForLoggedInUser();\n fillUserInfo();\n $userProfile.show();\n }", "function UpdateAuthenticationInfo( e )\r\n{\r\n if( e.auth_done )\r\n {\r\n // If the Logout button is not visible, we were offline and now we must switch to online because the auth:done event is fired\r\n if( !$.btnLogout.visible )\r\n {\r\n $.btnLogout.visible = true ;\r\n current_logged_username = Alloy.Globals.CurrentAuthenticationInfoTitle() ;\r\n // Set welcome label text\r\n $.lblWelcome.setText( current_logged_username ) ;\r\n\r\n RebuildTable() ;\r\n }\r\n }\r\n else\r\n {\r\n Alloy.Globals.ResetSession() ;\r\n\r\n $.btnLogout.visible = false ;\r\n current_logged_username = L( 'generic_welcome_offline_text_msg' ) ;\r\n // Set welcome label text\r\n $.lblWelcome.setText( current_logged_username ) ;\r\n }\r\n}", "function handleLoginOnsubmit(evt) {\n evt.preventDefault()\n const alluser = {...loginObject}\n\t\thttpClient.logIn(alluser).then(user => {\n console.log(\"user\", user )\n\t\t\tif(user) {\n window.location.replace(\"/home\") \n this.props.onLoginSuccess(user)\n\t\t\t\tthis.props.history.push('/')\n }\n validate(user)\n }).catch(validate);\n clearForm();\n \n }", "function authenticate() {\n success.value = true;\n fail.value = false; \n setTimeout(setLoggedIn, 100);\n}", "function switchToLogin(){\n\t\tturnService.closeWaitingAlert();\n\t\t$userLoginArea.show();\t\t\n\t\t$pageWrapper.hide();\n\t}", "function login(result) {\n if (result == 2) {\n createChips('Fill in all fields!', 'yellow', 3000);\n document.querySelector('.chips-field').style.zIndex = '99999';\n } else if (result == 0) {\n createChips('User not found!', 'red', 3000);\n document.querySelector('.chips-field').style.zIndex = '99999';\n } else {\n result = JSON.parse(result);\n\n /* setting cookie */\n var d = new Date();\n d.setTime(d.getTime() + (10 * 60 * 1000)); //expires time cookie 10 min\n var expires = d.toUTCString();\n /* store user e-mail and expires time in cookie */\n document.cookie = `email=${result.email}; expires=${expires}; path=/`;\n location.href = \"cabinet.php\";\n }\n }", "function login()\r\n\t\t\t{\r\n\t\t\t\t//alert('login');\r\n\t\t\t\tFB.Connect.requireSession( loginComplete, loginCancelled );\r\n\t\t\t}", "function handleLoginSuccess(data) {\n\n if (data.message) {\n // remove loader\n $scope.loginLoader = false;\n $scope.LoginMessage = data.message;\n } else {\n // handle login success (store info in cookies and redirect to dashboard)\n $cookies.put('managerId', data.id);\n $cookies.put('managerToken', data.token);\n $state.go('loggedIn.hotels');\n }\n }", "onLogin() {\n this.userService.login(this.email, this.password)\n .then(data => {\n localStorage.setItem('usuario', this.email);\n this.router.navigate(['/Principal']);\n })\n .catch(err => {\n console.log(err);\n alert(\"Usuario no registrado\");\n });\n }", "LogOut() {\n\n if (typeof this.LogOutCallback === \"function\") {\n try {\n this.LogOutCallback();\n } catch (err) {\n console.error(err);\n }\n }\n\n this.ClearPersistant();\n if (!this.AccountInfo.ContentPrivateKey || !this.AccountInfo.ContentPublicKey) {\n\n }\n\n this.state = {};\n this.AccountInfo = {};\n this.Cryptostate = {};\n this.PeopleCashe = [];\n }", "successfulLogin(user, authHead) { //\n this.setupAxiosInterceptors(authHead)\n sessionStorage.setItem('authenticatedUserEmail', user.email);\n sessionStorage.setItem('authenticatedUserName', user.name);\n sessionStorage.setItem('authenticatedUserContact', user.contact);\n sessionStorage.setItem('authenticatedUserRole', user.role);\n }", "function onLoadCB() { \n checkAuth(true); \n }", "async handleLogin(event) {\n try {\n\n //prevent actual submit and page refresh\n event.preventDefault();\n\n const userRepository = new UserRepository();\n\n\n //Find the username and password\n const username = $(this).find(\"[name='login-username']\").val();\n const password = $(this).find(\"[name='login-password']\").val();\n\n // Check if value exists\n if (!username || !password) {\n notificationManager.alert(\"warning\", \"Vul alle velden in!\");\n return false;\n }\n\n\n if (password.length < 6) {\n notificationManager.alert(\"warning\", \"Wachtwoord is te kort!\");\n return false;\n }\n\n //await keyword 'stops' code until data is returned - can only be used in async function\n const user = await userRepository.login(username, password);\n\n sessionManager.set(\"userID\", user.userID);\n notificationManager.alert(\"success\", \"U wordt ingelogd!\");\n location.reload();\n } catch (e) {\n console.log(e);\n notificationManager.alert(\"error\", \"Account bestaat niet\");\n }\n }", "login() {\r\n this.authenticated = true;\r\n localStorage.setItem(\"islogedin\", true);\r\n }" ]
[ "0.76448536", "0.6951168", "0.68976545", "0.68782693", "0.67930317", "0.6772691", "0.67680377", "0.67315924", "0.6719814", "0.66701674", "0.6637969", "0.6613015", "0.65612966", "0.655495", "0.652538", "0.65249854", "0.6521088", "0.650381", "0.6496224", "0.64937305", "0.64869213", "0.6484934", "0.6455052", "0.6412704", "0.6411258", "0.6410401", "0.64051616", "0.63985145", "0.63983345", "0.6396003", "0.63917047", "0.63916993", "0.63756204", "0.63739395", "0.63614196", "0.6349562", "0.6348149", "0.6346926", "0.6339818", "0.633962", "0.63265663", "0.63192064", "0.6311942", "0.63089114", "0.6306406", "0.6305786", "0.6298386", "0.62754333", "0.62731296", "0.6255429", "0.6244128", "0.62414", "0.62302905", "0.62301624", "0.6221565", "0.62170655", "0.6204703", "0.6190674", "0.6188399", "0.6182935", "0.6182125", "0.6179424", "0.6175022", "0.6171246", "0.6162057", "0.61536384", "0.61508", "0.6139945", "0.61377907", "0.6137308", "0.6134682", "0.61336774", "0.61307794", "0.6130652", "0.6127568", "0.61212903", "0.61150587", "0.61144", "0.61091566", "0.6106451", "0.6103363", "0.61017793", "0.61001897", "0.60961545", "0.6089511", "0.60890895", "0.6086714", "0.60857534", "0.6081407", "0.607905", "0.60732985", "0.60726595", "0.60681814", "0.6059372", "0.6059108", "0.60544497", "0.6052803", "0.60526174", "0.60503983", "0.6042685", "0.60418147" ]
0.0
-1
Operational panel functions //////////////////////////////////////////////////
function set_pwd(value) { old_pwd = $('#I_GE1_WIDTH').val(); $('#I_GE1_WIDTH').val(value); if (!check_value("I_GE1_WIDTH")){ $('#I_GE1_WIDTH').val(old_pwd); $('#I_OPE_STEP2_GE1_PWD').val(old_pwd); return false; } commands = '"GEN C1:BSWV WIDTH,' + parseFloat(value) + '","GEN C1:OUTP?","GEN C1:BSWV?"'; to_refresh = generator_ch1_parameters input_disable(to_refresh, generator_ch1_buttons); laserServer(commands, to_refresh, 0, function() { input_enable(to_refresh, generator_ch1_buttons); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PanelHelper() {\n\t}", "function LogicPanel(params){var width=params.width; // width for the whole row\n\tvar vis=params.visElement; // the node for whole vis\n\tvar panel=params.panelElement; // panel element\n\tvar cellSize=params.cellSize; // cell size for a particular subset indicator (circle)\n\tvar usedSets=params.usedSets; // all used Sets\n\tvar grays=params.grays; // range of grays used for dot labeling\n\tvar belowVis=params.belowVis; // the vis node below the panel (to be translated)\n\tvar buttonX=params.buttonX; // button X coordinate\n\tvar buttonY=params.buttonY; // button Y coordinate\n\tvar subsets=params.subsets;var cellWidth=params.cellWidth; // width of cells\n\tvar ctx=params.ctx;var stateObject=params.stateObject;var callAfterSubmit=params.callAfterSubmit; // to be bound !!\n\t// var grays = ['#f0f0f0', '#636363'];\n\t// var groupingByList = [\n\t// {name:\"by set size\", groupFunction:function(){console.log(\"by set size\");}},\n\t// {name:\"by sets\", groupFunction:function(){console.log(\"by size\");}},\n\t// {name:\"by weather\", groupFunction:function(){console.log(\"by size\");}}\n\t// ]\n\tthis.logicState=ctx.logicStates;var me=this;var setNames={};var collapseHeight=cellSize;var uncollapseHeight=95;var isCollapsed=true;var toggleState={};var isNewPanel=true;var belowVisRestoreTranslate=\"translate(0, 90)\";var actualGroupLabel=\"Query\"; // var getListOfValues = function(){\n\t// console.log(this);\n\t// var compareList= []\n\t// this.orClauses.forEach(function(orClause){\n\t//\n\t// var compareObject = []\n\t// for (key in orClause){\n\t// compareObject.push(orClause[key].state);\n\t// }\n\t// compareList.push(compareObject)\n\t// })\n\t//\n\t// return compareList;\n\t// }\n\tvar logicExpression={};var actualOrClause=1;var initLogicExpression=function initLogicExpression(){logicExpression={groupName:\"\",orClauses:[],getListOfValues:function getListOfValues(){var compareList=[];this.orClauses.forEach(function(orClause){var compareObject=[];for(key in orClause){compareObject.push(orClause[key].state);}compareList.push(compareObject);});return compareList;}};}; // the color for logic related stuff (highlighting & button)\n\tvar logicColor=\"#a1d99b\";var addLogicButton={};var init=function init(){ //### add button ##\n\taddLogicButton=vis.append(\"g\").attr({class:\"logicAddButton\",\"transform\":\"translate(\"+buttonX+\",\"+buttonY+\")\"}); // addLogicButton.append(\"rect\").attr({\n\t// width:60,\n\t// height:18\n\t// }).style({fill: logicColor })\n\t// .on(\"click\", addLogic)\n\taddLogicButton.append(\"rect\").attr({width:20,height:20,x:0,y:0,rx:5,ry:5}).style({fill:logicColor,\"cursor\":\"pointer\",opacity:.5}).on(\"click\",addLogic).on(\"mouseover\",function(){d3.select(this).style(\"opacity\",1);}).on(\"mouseout\",function(){d3.select(this).style(\"opacity\",.5);});addLogicButton.append(\"text\").attr({class:\"selection-button\",\"transform\":\"translate(\"+3+\",\"+16+\")\",\"pointer-events\":\"none\"}).style({\"font-family\":\"FontAwesome\"}).text(\"\");addLogicButton.append(\"text\").attr({class:\"addButton\",x:25,y:10}).style({fill:\"black\",\"text-anchor\":\"start\",\"cursor\":\"auto\"}).text(\"Query\"); // .on(\"click\", addLogic)\n\tdefineDontCarePattern(panel,cellSize,grays);initLogicExpression();};var defineDontCarePattern=function defineDontCarePattern(gQuery,cellSize,grays){var patternDefAll=gQuery.selectAll(\"defs\").data([cellSize],function(d){return d;});patternDefAll.exit().remove(); // if (removed.length<1){\n\tvar patternDef=patternDefAll.enter().append(\"defs\").append(\"pattern\").attr({id:\"DontCarePattern\", // patternUnits:\"userSpaceOnUse\",\n\tpatternContentUnits:\"objectBoundingBox\",x:\"0\",y:\"0\",width:1,height:1});patternDef.append(\"rect\").attr({x:0,y:0,width:1,height:1,fill:grays[0]});patternDef.append(\"circle\").attr({cx:.5,cy:.5,r:.2,fill:grays[1]}); // patternDef.append(\"rect\").attr({\n\t// x:.5,\n\t// y:0,\n\t// width:.5,\n\t// height:1,\n\t// fill: grays[1]\n\t// })\n\t// patternDef.append(\"rect\").attr({\n\t// x:0,\n\t// y:0,\n\t// width:.5,\n\t// height:1,\n\t// fill: grays[0],\n\t// transform:\"rotate(45)\"\n\t// })\n\t};var addLogic=function addLogic(){addLogicButton.attr({\"opacity\":0});belowVisRestoreTranslate=+belowVis.attr(\"y\"); // define first orClause as dontcare ANDs\n\tlogicExpression.orClauses[0]={};usedSets.forEach(function(d){logicExpression.orClauses[0][d.id]={state:me.logicState.DONTCARE}; // logicExpression.orClauses[0][d.id]={state:Math.floor(Math.random()*3)};\n\t});logicExpression[\"id\"]=\"LogicGroup_\"+new Date().getTime();actualOrClause=0;isNewPanel=true;setNames={};usedSets.forEach(function(d){setNames[d.id]=d.elementName;});actualGroupLabel=\"Query\";renderActualPanel();};var addOrClause=function addOrClause(){var id=logicExpression.orClauses.length;logicExpression.orClauses[id]={};usedSets.forEach(function(d){logicExpression.orClauses[id][d.id]={state:me.logicState.DONTCARE}; // logicExpression.orClauses[id][d.id]={state:Math.floor(Math.random()*3)};\n\t});actualOrClause=id;renderActualPanel();};var selectRow=function selectRow(index){if(index!=actualOrClause){actualOrClause=index;renderActualPanel();}else {actualOrClause=-1;renderActualPanel();}};var removeRow=function removeRow(index){logicExpression.orClauses.splice(index,1);actualOrClause=actualOrClause-1;if(logicExpression.orClauses.length==0)destroyPanel();else renderActualPanel();};function changeState(orClause,id,state){logicExpression.orClauses[actualOrClause][id]={state:state}; // console.log(\"here\");\n\tpanel.selectAll(\".logicPanelRow\").filter(function(d,i){return i==actualOrClause;}).each(function(d){renderSelectorTable(this,true,false,actualOrClause);});}this.getTextDescription=function(actualOrClause){var actualClause=logicExpression.orClauses[actualOrClause];var collectExpressions={};Object.keys(actualClause).forEach(function(d){var setList=collectExpressions[actualClause[d].state];if(setList==null){setList=[setNames[d]];}else {setList.push(setNames[d]);}collectExpressions[actualClause[d].state]=setList;}); //console.log(\"expression\",collectExpressions);\n\tvar setNameListLength=Object.keys(setNames).length;var expression=\"\";Object.keys(me.logicState).forEach(function(dd){var d=me.logicState[dd];if(collectExpressions[d]!=null&&collectExpressions[d].length==setNameListLength){switch(d){case me.logicState.NOT:expression=\"the intersection that does not intersect with any selected set\";break;case me.logicState.DONTCARE:expression=\"all intersections of all selected sets\";break;case me.logicState.MUST:expression=\"the intersection of all selected sets\";break;default:break;}}});if(expression.length<1){expression=\"intersections of \";var but=\"\";if(collectExpressions[me.logicState.MUST]!=null){expression+=\"set\"+(collectExpressions[me.logicState.MUST].length>1?\"s \":\" \");expression+=collectExpressions[me.logicState.MUST].map(function(d){return \"[\"+d+\"]\";}).join(\" and \");but=\" but \";}if(collectExpressions[me.logicState.NOT]!=null){expression+=but+\"excluding \"+\"set\"+(collectExpressions[me.logicState.NOT].length>1?\"s \":\" \");expression+=collectExpressions[me.logicState.NOT].map(function(d){return \"[\"+d+\"]\";}).join(\" and \");}} // console.log(collectExpressions);\n\treturn expression;};function changeStateAll(actualOrClause,state){var actualClause=logicExpression.orClauses[actualOrClause];Object.keys(actualClause).forEach(function(d){actualClause[d]={state:state};}); //console.log(\"here\");\n\tpanel.selectAll(\".logicPanelRow\").filter(function(d,i){return i==actualOrClause;}).each(function(d){renderSelectorTable(this,true,false,actualOrClause);});} // function createLineWrapperField(d3Node){\n\t// d3Node.html(\n\t// '<g requiredFeatures=\"http://www.w3.org/Graphics/SVG/feature/1.2/#TextFlow\"> \\\n\t// <textArea width=\"200\" height=\"auto\" class=\"logicPanelActualText\"> \\\n\t// Text goes here \\\n\t// </textArea>\\\n\t// </g>\\\n\t// <foreignObject width=\"200\" height=\"200\" class=\"logicPanelActualText\"\\\n\t// requiredFeatures=\"http://www.w3.org/TR/SVG11/feature#Extensibility\">\\\n\t// <p xmlns=\"http://www.w3.org/1999/xhtml\">Text goes here</p>\\\n\t// </foreignObject>'\n\t// )\n\t//\n\t//\n\t//\n\t//\n\t// }\n\tfunction wrap(text,width){text.each(function(){var text=d3.select(this),words=text.text().split(/\\s+/).reverse(),word,line=[],lineNumber=0,lineHeight=1.1, // ems\n\ty=text.attr(\"y\"),dy=parseFloat(text.attr(\"dy\")),tspan=text.text(null).append(\"tspan\").attr(\"x\",0).attr(\"y\",y).attr(\"dy\",dy+\"em\");while(word=words.pop()){line.push(word);tspan.text(line.join(\" \"));if(tspan.node().getComputedTextLength()>width){line.pop();tspan.text(line.join(\" \"));line=[word];tspan=text.append(\"tspan\").attr(\"x\",0).attr(\"y\",y).attr(\"dy\",++lineNumber*lineHeight+dy+\"em\").text(word);}}});}function renderSelectorTable(node,isExpanded,animated,rowIndex){ //console.log(\"textexprssion\",getTextDescription(actualOrClause));\n\t// logicPanelSelectionTable\n\t// logicPanelSelectionHeader\n\t//\n\tvar nodeSelector=d3.select(node);var noOfSets=Object.keys(node.__data__).length; // console.log(node.__data__);\n\tvar panelTableHeader=nodeSelector.select(\".logicPanelSelectionHeader\");panelTableHeader.attr({\"transform\":\"translate(\"+90+\",\"+0+\")\"});panelTableHeader.on({click:function click(d){selectRow(rowIndex);}});var infoBarGroup=panelTableHeader.selectAll(\".logicPanelHeaderBarGroup\").data(function(){var countRation=0;var count=0;getSubsetsForMaskList(subsets,[logicExpression.getListOfValues()[rowIndex]],function(d){ // console.log(d);\n\tcountRation+=d.dataRatio;count+=d.items.length;}); // console.log(countRation,logicExpression.getListOfValues()[rowIndex] );\n\treturn [{countRatio:countRation,count:count}]; ///subsets.length\n\t});infoBarGroup.enter().append(\"g\").attr({class:\"logicPanelHeaderBarGroup\"});var infoBar=infoBarGroup.selectAll(\".logicPanelHeaderBar\").data(function(d){return [d];});infoBar.enter().append(\"rect\").attr({class:\"logicPanelHeaderBar\",x:function x(d){return ctx.xStartSetSizes;},y:2,height:cellSize-4}).style({fill:logicColor});infoBar.transition().attr({width:function width(d){return d.countRatio*ctx.subSetSizeScale.range()[1];}});infoBarGroup.selectAll(\".logicPanelHeaderBarLabel\").data(function(d){return [d];}).enter().append(\"text\").attr({class:\"logicPanelHeaderBarLabel addButton\",y:cellSize-4,x:function x(d){return ctx.xStartSetSizes+d.countRatio*ctx.subSetSizeScale.range()[1]+5;}}).style({\"text-anchor\":\"start\",\"dominant-baseline\":\"auto\"}).text(function(d){return d.count;});infoBarGroup.selectAll(\".logicPanelHeaderBarLabel\").transition().attr({x:function x(d){return ctx.xStartSetSizes+d.countRatio*ctx.subSetSizeScale.range()[1]+5;}}).text(function(d){return d.count;});var headerCircles=panelTableHeader.selectAll(\".logicPanelHeaderCircle\").data(function(d){return Object.keys(d).map(function(dd){return {subsetID:dd,state:d[dd].state};});});headerCircles.enter().append(\"circle\").attr({class:\"logicPanelHeaderCircle\",cx:function cx(d,i){return i*cellWidth+cellWidth/2;}, // TODO: add 90 as params!!\n\tcy:function cy(d,i){return cellSize/2;},r:cellSize/2-3});headerCircles.style({ // stroke:grays[1],\n\tfill:function fill(d){switch(d.state){case me.logicState.NOT:return grays[0];break;case me.logicState.MUST:return grays[1];break;default: // me.logicState.DONTCARE\n\treturn \"url(#DontCarePattern)\";}},stroke:grays[1] //function(){if (isExpanded) return logicColor; else return grays[1];}\n\t});if(isExpanded){var textDescriptionPanel=nodeSelector.selectAll(\".logicPanelActualText\").data(function(d){return [me.getTextDescription(actualOrClause)];});textDescriptionPanel.enter().append(\"text\").attr({class:\"logicPanelActualText addButton\",\"transform\":\"translate(\"+(noOfSets*cellWidth+5+90)+\",\"+0+\")\",y:cellSize,dy:1}).style({\"text-anchor\":\"start\",\"dominant-baseline\":\"auto\"});textDescriptionPanel.text(function(d){return d;}).call(wrap,width-(noOfSets*cellSize+5+90+100));var g=nodeSelector.select(\".logicPanelSelectionTable\");var nodeData=g.node().__data__;var clausesList=Object.keys(nodeData).map(function(d){return {subsetID:d,state:nodeData[d].state};}); // console.log(\"clist:\",clausesList);\n\tvar matrix=Object.keys(me.logicState).map(function(d){return {state:me.logicState[d],selectors:clausesList.map(function(dd){return {state:me.logicState[d],id:dd.subsetID,isSelected:function isSelected(){return me.logicState[d]==dd.state;}};})};});var tableRows=g.selectAll(\".logicTableRow\").data(matrix);var trEnter=tableRows.enter().append(\"g\").attr({\"class\":\"logicTableRow\"});trEnter.append(\"text\").text(function(d,i){switch(d.state){case me.logicState.NOT:return \"not\";break;case me.logicState.MUST:return \"must\";break;default: // me.logicState.DONTCARE\n\treturn \"maybe\";}}).attr({x:-4,y:cellSize/2,class:\"addButton\"}).style({\"text-anchor\":\"end\"}).on({click:function click(d){changeStateAll(actualOrClause,d.state);}});trEnter.each(function(d,i){if(i==0)d3.select(this).append(\"rect\").attr({x:0,y:-3,width:cellSize*clausesList.length,height:1});});tableRows.exit().remove();tableRows.attr({\"transform\":function transform(d,i){return \"translate(\"+90+\",\"+(animated?0.0*cellSize:(i+1.0)*cellSize+5) // ((i+1.0)*cellSize +5)\n\t+\")\";} // ,opacity:0.0001\n\t});var circles=tableRows.selectAll(\"circle\").data(function(d){return d.selectors;});circles.enter().append(\"circle\").attr({class:\"logicPanelCircle\",cx:function cx(d,i){return (i+.5)*cellWidth;}, // TODO: add 90 as params!!\n\tcy:.5*cellSize, // if (animated) return 0.5*cellSize;\n\t// else return (i+1.5)*cellSize +5},\n\tr:cellSize/2-2});circles.style({fill:function fill(d){switch(d.state){case me.logicState.NOT:return grays[0];break;case me.logicState.MUST:return grays[1];break;default: // me.logicState.DONTCARE\n\treturn \"url(#DontCarePattern)\";}},stroke:function stroke(d){if(d.isSelected())return logicColor;else return grays[1];}}).on({\"click\":function click(d){changeState(actualOrClause,d.id,d.state);}});if(animated){tableRows.transition().attr({\"transform\":function transform(d,i){return \"translate(\"+90+\",\"+((i+1.0)*cellSize+5)+\")\";}});} // .style({\n\t// \"stroke-width\":2,\n\t// fill:\"red\"\n\t// })\n\t// columns.transition().delay(50).attr({\n\t// opacity:1\n\t// })\n\t}else {d3.select(node).select(\".logicPanelSelectionTable\").selectAll(\".logicTableRow\").remove();d3.select(node).select(\".logicPanelActualText\").remove();}}function submitExpression(){logicExpression.groupName=actualGroupLabel;stateObject.logicGroups.push(logicExpression);stateObject.logicGroupChanged=true;stateObject.forceUpdate=true;if(callAfterSubmit!=null)callAfterSubmit.forEach(function(d){d();}); // console.log(logicExpression);\n\t// console.log(logicExpression.getListOfValues())\n\tdestroyPanel();}function changeGroupLabel(){ // console.log(\"enter\");\n\tvar label=prompt(\"Group label:\",actualGroupLabel);if(label!=null){actualGroupLabel=label;panel.select(\"#fakeGroup\").select(\".groupLabel\").text(actualGroupLabel);}}var renderActualPanel=function renderActualPanel(){cellSize=ctx.cellDistance;defineDontCarePattern(panel,cellSize,grays);if(isNewPanel){var fakeGroup=panel.append(\"g\").attr({id:\"fakeGroup\"});fakeGroup.append(\"rect\").attr({x:0,y:0,width:width,height:cellSize,class:\"groupBackGround\"});var labelText=fakeGroup.append(\"text\");labelText.append(\"tspan\").attr({x:12,y:cellSize-3,class:\"groupLabel\"}).text(actualGroupLabel);fakeGroup.append(\"text\").text(\"\").attr({id:\"logicPanelCancelText\",class:\"groupDeleteIcon\",\"transform\":\"translate(\"+(ctx.xStartSetSizes+ctx.leftOffset-12)+\",\"+(ctx.cellSize/2+4)+\")\" //TODO: needs context\n\t}).style({\"fill\":\"#f46d43\"}).on({\"click\":function click(){destroyPanel();}});labelText.append(\"tspan\").text(\" \").attr({id:\"logicPanelLabelChangeText\",class:\"logicButton filter-button\"}).style({\"font-size\":\"9pt\",\"dominant-baseline\":\"auto\"}).on({\"click\":function click(){changeGroupLabel();}});} // calculate y positions\n\tvar yCummulate=cellSize;var yOffsets=logicExpression.orClauses.map(function(d,i){var returnValue=yCummulate;yCummulate+=i==actualOrClause?uncollapseHeight:collapseHeight;return returnValue;});var logicPanelRows=panel.selectAll(\".logicPanelRow\").data(logicExpression.orClauses); // the newly appended row is allways uncollapsed !!\n\tvar logicPanelRowEnter=logicPanelRows.enter().append(\"g\").attr({class:\"logicPanelRow\",\"transform\":function transform(d,i){return \"translate(\"+0+\",\"+yOffsets[i]+\")\";}}).style(\"opacity\",0.000001); // add row buttons\n\tlogicPanelRowEnter.append(\"text\").text(\"V\").attr(\"class\",\"logicButton logicPanelSelect \").style(\"text-anchor\",\"start\").on(\"click\",function(d,i){selectRow(i);});logicPanelRowEnter.append(\"text\").text(\"\").attr(\"class\",\"logicButton logicPanelRemove\").style(\"text-anchor\",\"start\").on(\"click\",function(d,i){removeRow(i);});logicPanelRowEnter.append(\"rect\").attr({class:\"logicPanelRect\",width:width,height:function height(d,i){return uncollapseHeight;}}).style({fill:\"none\",stroke:\"lightgray\"});logicPanelRowEnter.append(\"g\").attr(\"class\",\"logicPanelSelectionTable\");logicPanelRowEnter.append(\"g\").attr(\"class\",\"logicPanelSelectionHeader\");logicPanelRows.exit().remove();logicPanelRows.transition().attr({\"transform\":function transform(d,i){return \"translate(\"+0+\",\"+yOffsets[i]+\")\";},height:function height(d,i){return i==actualOrClause?uncollapseHeight:collapseHeight;}}).style(\"opacity\",1);logicPanelRows.select(\".logicPanelSelect\").transition().attr({x:10,y:function y(d,i){ // if (actualOrClause==i) return uncollapseHeight/2;\n\t// else\n\treturn collapseHeight/2;}}).text(function(d,i){if(actualOrClause==i)return \"^\";else return \"\";});logicPanelRows.select(\".logicPanelRemove\").transition().attr({x:ctx.leftOffset-14,y:function y(d,i){ // if (actualOrClause==i) return uncollapseHeight/2;\n\t// else\n\treturn collapseHeight/2;}});logicPanelRows.select(\".logicPanelRect\").transition().attr({height:function height(d,i){return i==actualOrClause?uncollapseHeight:collapseHeight;}});logicPanelRows.each(function(d,i){renderSelectorTable(this,i==actualOrClause,true,i);});var endOfPanel=yCummulate+10;if(isNewPanel){var buttonGroup=panel.append(\"g\").attr({id:\"logicPanelButtons\"}).attr({\"transform\":\"translate(\"+0+\",\"+endOfPanel+\")\"});buttonGroup.append(\"text\").text(\"\").attr({id:\"logicPanelAddText\",class:\"logicButton\",x:25 // \"transform\":\"translate(\"+0+\",\"+endOfPanel+\")\"\n\t}).style({ // \"text-anchor\":\"start\"\n\t}).on({\"click\":function click(){addOrClause();}});buttonGroup.append(\"text\").text(\"\").attr({id:\"logicPanelSubmitText\",class:\"logicButton\",x:70 // \"transform\":\"translate(\"+35+\",\"+endOfPanel+\")\"\n\t}).style({\"fill\":logicColor}).on({\"click\":function click(){submitExpression();}});}else {panel.select(\"#logicPanelButtons\").transition().attr({\"transform\":\"translate(\"+0+\",\"+endOfPanel+\")\"});}isNewPanel=false; //\n\t// // add uncollapsed panel\n\t// panel.append(\"rect\").attr({\n\t// class:\"menuPlaceholder menuPlaceholderRect\",\n\t// width:width,\n\t// height:uncollapseHeight\n\t// })\n\t// .style({\n\t// fill:\"none\",\n\t// stroke: grays[1]\n\t// })\n\t//\n\tbelowVis.transition().attr({\"transform\":\"translate(\"+params.leftAlignment+\",\"+(endOfPanel+15)+\")\"}); // belowVis.transition().attr({\n\t// \"y\":+(endOfPanel+belowVisRestoreTranslate+15)\n\t// })\n\t};var destroyPanel=function destroyPanel(){panel.selectAll(\".logicPanelRow\").remove();panel.select(\"#logicPanelButtons\").remove();panel.select(\"#fakeGroup\").remove();belowVis.transition().attr({\"transform\":\"translate(\"+params.leftAlignment+\",\"+0+\")\"}); // belowVis.transition().attr({\n\t// \"y\":belowVisRestoreTranslate\n\t// })\n\taddLogicButton.attr({\"opacity\":1});initLogicExpression();};init();}", "function sel_panel(id) {}", "function Component_PanelBehavior() {}", "function Component_PanelBehavior() {}", "panel() {\n\n if (this.$p.cursor.grid_id !== this.layout.id) {\n return\n }\n\n let lbl = this.$p.cursor.y$.toFixed(this.layout.prec)\n this.ctx.fillStyle = this.$p.colors.colorPanel\n\n let panwidth = this.layout.sb + 1\n\n let x = - 0.5\n let y = this.$p.cursor.y - PANHEIGHT * 0.5 - 0.5\n let a = 5 //* 0.5\n this.ctx.fillRect(x - 0.5, y, panwidth, PANHEIGHT)\n this.ctx.fillStyle = this.$p.colors.colorTextHL\n this.ctx.textAlign = 'left'\n this.ctx.fillText(lbl, a, y + 16)\n\n }", "function render_panel() {\n\n elem.html(\"\");\n\n var el = elem[0];\n\n var parent_width = elem.parent().width(),\n height = parseInt(scope.panel.height),\n padding = 50,\n outerRadius = height / 2 - 30,\n innerRadius = outerRadius / 3;\n\n var margin = {\n top: 20,\n right: 20,\n bottom: 100,\n left: 50\n },\n width = parent_width - margin.left - margin.right;\n\n\n var plot, chartData;\n var colors = [];\n\n // IE doesn't work without this\n elem.css({height: scope.panel.height || scope.row.height});\n\n // Make a clone we can operate on.\n\n chartData = _.clone(scope.data);\n chartData = scope.panel.missing ? chartData :\n _.without(chartData, _.findWhere(chartData, {meta: 'missing'}));\n chartData = scope.panel.other ? chartData :\n _.without(chartData, _.findWhere(chartData, {meta: 'other'}));\n\n if (filterSrv.idsByTypeAndField('terms', scope.panel.field).length > 0) {\n colors.push(scope.panel.lastColor);\n } else {\n colors = scope.panel.chartColors;\n }\n\n var AP_1 = 0.0;\n var AP_2 = 0.0;\n var AP_n = 0.0;\n for (var i = 0; i < chartData.length; i++) {\n AP_n = AP_n + chartData[i].data[0][1];\n if (parseInt(chartData[i].label) <= scope.panel.threshold_first) {\n AP_1 += chartData[i].data[0][1];\n } else if (parseInt(chartData[i].label) < scope.panel.threshold_second && parseInt(chartData[i].label) > scope.panel.threshold_first) {\n AP_2 += chartData[i].data[0][1] * 0.5;\n }\n }\n var APdex = 100;\n if (AP_n != 0) {\n APdex = parseInt(100 * (AP_1 + AP_2) / AP_n);\n //APdex = (AP_1+AP_2)/AP_n;\n }\n\n\n var idd = scope.$id;\n require(['jquerymin', 'd3min', 'd3transform', 'extarray', 'misc', 'microobserver', 'microplugin', 'bubble', 'centralclick', 'lines'], function(){\n // Populate element\n try {\n\n var labelcolor = false;\n if (dashboard.current.style === 'dark') {\n labelcolor = true;\n }\n // Add plot to scope so we can build out own legend\n\n\n if (scope.panel.chart === 'd3text') {\n\n var bubbleChart = new d3.svg.BubbleChart({\n supportResponsive: true,\n //container: => use @default\n size: 600,\n //viewBoxSize: => use @default\n innerRadius: 600 / 3.5,\n //outerRadius: => use @default\n radiusMin: 50,\n //radiusMax: use @default\n //intersectDelta: use @default\n //intersectInc: use @default\n //circleColor: use @default\n data: {\n items: [\n {text: \"Java\", count: \"236\"},\n {text: \".Net\", count: \"382\"},\n {text: \"Php\", count: \"170\"},\n {text: \"Ruby\", count: \"123\"},\n {text: \"D\", count: \"12\"},\n {text: \"Python\", count: \"170\"},\n {text: \"C/C++\", count: \"382\"},\n {text: \"Pascal\", count: \"10\"},\n {text: \"Something\", count: \"170\"},\n ],\n eval: function (item) {\n return item.count;\n },\n classed: function (item) {\n return item.text.split(\" \").join(\"\");\n }\n },\n plugins: [\n {\n name: \"central-click\",\n options: {\n text: \"(See more detail)\",\n style: {\n \"font-size\": \"12px\",\n \"font-style\": \"italic\",\n \"font-family\": \"Source Sans Pro, sans-serif\",\n //\"font-weight\": \"700\",\n \"text-anchor\": \"middle\",\n \"fill\": \"white\"\n },\n attr: {dy: \"65px\"},\n centralClick: function () {\n alert(\"Here is more details!!\");\n }\n }\n },\n {\n name: \"lines\",\n options: {\n format: [\n {// Line #0\n textField: \"count\",\n classed: {count: true},\n style: {\n \"font-size\": \"28px\",\n \"font-family\": \"Source Sans Pro, sans-serif\",\n \"text-anchor\": \"middle\",\n fill: \"white\"\n },\n attr: {\n dy: \"0px\",\n x: function (d) {\n return d.cx;\n },\n y: function (d) {\n return d.cy;\n }\n }\n },\n {// Line #1\n textField: \"text\",\n classed: {text: true},\n style: {\n \"font-size\": \"14px\",\n \"font-family\": \"Source Sans Pro, sans-serif\",\n \"text-anchor\": \"middle\",\n fill: \"white\"\n },\n attr: {\n dy: \"20px\",\n x: function (d) {\n return d.cx;\n },\n y: function (d) {\n return d.cy;\n }\n }\n }\n ],\n centralFormat: [\n {// Line #0\n style: {\"font-size\": \"50px\"},\n attr: {}\n },\n {// Line #1\n style: {\"font-size\": \"30px\"},\n attr: {dy: \"40px\"}\n }\n ]\n }\n }]\n });\n }\n\n\n // Populate legend\n if (elem.is(\":visible\")) {\n setTimeout(function () {\n scope.legend = plot.getData();\n if (!scope.$$phase) {\n scope.$apply();\n }\n });\n }\n\n } catch (e) {\n elem.text(e);\n }\n });\n }", "static displayInfoPanel(panel, data) {\n // Updatte and display panel\n LibrariesMap.updatePanel(panel, data);\n panel.style(\"display\", \"block\");\n // Update pie charts\n LibrariesMap.updatePieCharts(panel, data);\n }", "mouseOver(panel) {\n\t}", "function render_panel() {\n if (shouldAbortRender()) {\n //return;\n }\n \n \n // this.seriesList = [];\n // this.data = [];\n\n var stack = panel.stack ? true : null;\n\n // Populate element\n var options = {\n hooks: {\n draw: [drawHook],\n processOffset: [processOffsetHook],\n },\n legend: { show: false },\n series: {\n stackpercent: panel.stack ? panel.percentage : false,\n stack: panel.percentage ? null : stack,\n bars: {\n show: true,\n fill: 0.9,\n barWidth: 1,\n zero: false,\n lineWidth: 0,\n align: 'center'\n },\n shadowSize: 0\n },\n yaxes: [],\n xaxis: {},\n grid: {\n minBorderMargin: 0,\n markings: [],\n backgroundColor: null,\n borderWidth: 0,\n hoverable: true,\n color: '#c8c8c8',\n margin: { left: 0, right: 0 },\n },\n selection: {\n mode: \"x\",\n color: '#666'\n },\n crosshair: {\n mode: panel.tooltip.shared || dashboard.sharedCrosshair ? \"x\" : null\n }\n };\n\n // var scopedVars = ctrl.panel.scopedVars;\n //// var bucketSize = !panel.bucketSize && panel.bucketSize !== 0 ? null : parseFloat(ctrl.templateSrv.replaceWithText(panel.bucketSize.toString(), scopedVars));\n // var minValue = !panel.minValue && panel.minValue !== 0 ? null : parseFloat(ctrl.templateSrv.replaceWithText(panel.minValue.toString(), scopedVars));\n // var maxValue = !panel.maxValue && panel.maxValue !== 0 ? null : parseFloat(ctrl.templateSrv.replaceWithText(panel.maxValue.toString(), scopedVars));\nif(!isPng){\n\n for (var i = 0; i < data.length; i++) {\n var series = data[i];\n series.data = getFFT(series);\n \n options.series.bars.barWidth = ((series.data[series.data.length-1][0] + series.data[0][0])/series.data.length);//(elem.width()/series.data.length);\n\n // if hidden remove points and disable stack\n if (ctrl.hiddenSeries[series.alias]) {\n series.data = [];\n series.stack = false;\n }\n }\n\n // if (data.length && data[0].stats.timeStep) {\n //data[0].stats.timeStep / 1.5;\n // }\n} else {\n \n addAnnotations(options); \n}\n \n // panel.yaxes[1].show = true;\n configureAxisOptions(data, options);\n // addHistogramAxis(options);\n // options.selection = {};\n\n sortedSeries = _.sortBy(data, function(series) { return series.zindex; });\n\n function callPlot(incrementRenderCounter) {\n try {\n $.plot(elem, sortedSeries, options);\n } catch (e) {\n console.log('flotcharts error', e);\n }\n\n if (incrementRenderCounter) {\n ctrl.renderingCompleted();\n }\n }\n \n scope.isPng = isPng;\n \n \n scope.zoomPlot = function(start, end) {\n \n options.xaxis.min = start;\n options.xaxis.max = end;\n\n callPlot(true);\n };\n \n scope.zoomOut = function() {\n if(isPng){\n // this.ctrl.events.emit('zoom-out');\n this.ctrl.publishAppEvent('zoom-out',2);\n } else {\n options.xaxis.min = null;\n options.xaxis.max = null;\n callPlot(true);\n }\n \n };\n \n\n if (shouldDelayDraw(panel)) {\n // temp fix for legends on the side, need to render twice to get dimensions right\n callPlot(false);\n setTimeout(function() { callPlot(true); }, 50);\n legendSideLastValue = panel.legend.rightSide;\n }\n else {\n callPlot(true);\n }\n }", "setPanel(panel){\n this.PANEL = panel;\n this.updatePanelTitle();\n }", "function showPanel(panel){\n if(actualPanel!=panel){\n //We hide the previous panel and we show the new\n $(\"#panel\"+actualPanel).slideUp(\"slow\");\n $(\"#actived\"+actualPanel).html(\"\")\n $(\"#settings\").remove();\n $(\"#making\").slideUp(\"slow\")\n $(\"#widgets\").slideUp(\"slow\");\n $(\"#companies\").slideUp(\"slow\");\n if($(\"#companiesList\").length!=0){\n $(\"#companiesList\").html(\"\")\n \n }\n $(\"#currentMenu\").remove();\n $(\"#panel\"+panel).slideDown(\"slow\");\n if($(\"#currentCreation\").length!=0){\n deleteCreation(numWidget);\n numWidget--;\n }\n actualPanel=panel;\n $(\"#actived\"+actualPanel).append('<i class=\"fa fa-fw fa-edit\"></i>')\n var panel=GetPanel(actualPanel)\n $(\"#activedPanel\").html(panel.name)\n if(dashConfiguration.indexOf(actualPanel)!=-1){\n makePanel(actualPanel)\n }\n actualReadingData=panel.reading;\n }\n\n}", "function render_panel() {\n // IE doesn't work without this\n elem.css({height:scope.panel.height||scope.row.height});\n\n var label;\n\n if(scope.panel.mode === 'goal') {\n label = {\n show: scope.panel.labels,\n radius: 0,\n formatter: function(label, series){\n var font = parseInt(scope.row.height.replace('px',''),10)/8 + String('px');\n if(!(_.isUndefined(label))) {\n return '<div style=\"font-size:'+font+';font-weight:bold;text-align:center;padding:2px;color:#fff;\">'+\n Math.round(series.percent)+'%</div>';\n } else {\n return '';\n }\n },\n };\n } else {\n label = {\n show: scope.panel.labels,\n radius: 2/3,\n formatter: function(label, series){\n return '<div \"style=\"font-size:8pt;text-align:center;padding:2px;color:white;\">'+\n label+'<br/>'+Math.round(series.percent)+'%</div>';\n },\n threshold: 0.1\n };\n }\n\n var pie = {\n series: {\n pie: {\n innerRadius: scope.panel.donut ? 0.45 : 0,\n tilt: scope.panel.tilt ? 0.45 : 1,\n radius: 1,\n show: true,\n combine: {\n color: '#999',\n label: 'The Rest'\n },\n label: label,\n stroke: {\n width: 0\n }\n }\n },\n //grid: { hoverable: true, clickable: true },\n grid: {\n backgroundColor: null,\n hoverable: true,\n clickable: true\n },\n legend: { show: false },\n colors: querySrv.colors\n };\n\n // Populate legend\n if(elem.is(\":visible\")){\n require(['jquery.flot.pie'], function(){\n scope.legend = $.plot(elem, scope.data, pie).getData();\n if(!scope.$$phase) {\n scope.$apply();\n }\n });\n }\n\n }", "get panel() {\n return this._panel;\n }", "createInfoPanel() {\n var panel = d3.select(\"#panel\");\n\n // Close panel button\n panel.append(\"button\")\n .text(\"X\")\n .on(\"click\", function () {\n panel.style(\"display\", \"none\");\n LibrariesMap.libCirclesGroup.selectAll(\"circle\").classed(\"circle-selected\", false);\n });\n\n // Create the pie charts svg\n this.pieSvg = panel.append(\"svg\")\n .attr(\"id\", \"pie-svg\")\n .attr(\"width\", \"100%\")\n .attr(\"height\", \"50%\")\n\n // Language Pie chart\n this.pieSvg.append(\"g\")\n .attr(\"id\", \"pieLg-group\")\n .attr(\"transform\", \"translate(\" + pieChartDim.left + \",\" + pieChartDim.top + \")\");\n // Public Pie chart\n this.pieSvg.append(\"g\")\n .attr(\"id\", \"piePub-group\")\n .attr(\"transform\", \"translate(\" + pieChartDim.left1 + \",\" + pieChartDim.top + \")\");\n // Format Pie chart\n this.pieSvg.append(\"g\")\n .attr(\"id\", \"pieForm-group\")\n .attr(\"transform\", \"translate(\" + pieChartDim.left2 + \",\" + pieChartDim.top + \")\");\n \n // Legend\n this.createLegend(8, LibrariesMap.pieLgColorScale, pieLgInfo.legendTexts);\n this.createLegend(pieChartDim.left1*0.75, LibrariesMap.piePubColorScale, piePubInfo.legendTexts);\n this.createLegend(pieChartDim.left2*0.8, LibrariesMap.pieFormColorScale, pieFormInfo.legendTexts);\n\n return panel;\n }", "function showPanels() \n{ \n\tvar strHide = \"HIDDEN\"; \n var strShow = \"SHOW\"; \n // Initial values \n var p_nav = strShow, \n p_zoom = strShow, \n p_overview = strShow, \n p_legend = strShow, \n p_download = strShow, \n p_measure = strShow, \n p_type = strShow, \n p_fullscreen = strShow; \n\t \n\t// get the panels to show \n\tif (g_panel != \"\") { \n\t\tvar panelsToShow = g_panel.spilt('+'); \n\t\tfor (var panel in panelsToShow) { \n\t\t\tif (panel == \"nav\") { \n\t\t\t\tp_nav = strShow; \n\t\t\t} \n\t\t\telse if (panel == \"zoom\") { \n\t\t\t\tp_zoom = strShow; \n\t\t\t} \n\t\t\telse if (panel == \"overview\") { \n\t\t\t\tp_overview = strShow; \n\t\t\t} \n\t\t\telse if (panel == \"legend\") { \n\t\t\t\tp_legend = strShow; \n\t\t\t} \n\t\t\telse if (panel == \"download\") { \n\t\t\t\tp_download = strShow; \n\t\t\t} \n\t\t\telse if (panel == \"measure\") { \n\t\t\t\tp_measure = strShow; \n\t\t\t} \n\t\t\telse if (panel == \"type\") { \n\t\t\t\tp_type = strShow; \n\t\t\t} \n\t\t\telse if (panel == \"fullscreen\") { \n\t\t\t\tp_fullscreen = strShow; \n\t\t\t} \n\t\t} \n\t} \n\t \n\t// get the panels to hide \n\tif (g_panel_hide != \"\") { \n\t\tvar panelsToHide = g_panel_hide.spilt('+'); \n\t\tfor (var panel in panelsToHide) { \n\t\t\tif (panel == \"nav\") { \n\t\t\t\tp_nav = strHide; \n\t\t\t} \n\t\t\telse if (panel == \"zoom\") { \n\t\t\t\tp_zoom = strHide; \n\t\t\t} \n\t\t\telse if (panel == \"overview\") { \n\t\t\t\tp_overview = strHide; \n\t\t\t} \n\t\t\telse if (panel == \"legend\") { \n\t\t\t\tp_legend = strHide; \n\t\t\t} \n\t\t\telse if (panel == \"download\") { \n\t\t\t\tp_download = strHide; \n\t\t\t} \n\t\t\telse if (panel == \"measure\") { \n\t\t\t\tp_measure = strHide; \n\t\t\t} \n\t\t\telse if (panel == \"type\") { \n\t\t\t\tp_type = strHide; \n\t\t\t} \n\t\t\telse if (panel == \"fullscreen\") { \n\t\t\t\tp_fullscreen = strHide; \n\t\t\t} \n\t\t} \n\t} \n\t \n\t// set visibility of the panels \n\tmap0.SetPanelVisibility(\"FLY\", p_nav); \n map0.SetPanelVisibility(\"ZOOM\", p_zoom); \n map0.SetPanelVisibility(\"OVERVIEW\", p_overview); \n map0.SetPanelVisibility(\"LEGEND\", p_legend); \n map0.SetPanelVisibility(\"BUY\", p_download); \n map0.SetPanelVisibility(\"MEASURE\", p_measure); \n map0.SetPanelVisibility(\"TYPE\", p_type); \n\tmap0.SetLogoVisibility(g_tflogo); \n\t \n\t//set legend \n\tif (p_legend == strShow && g_legend != \"\") { \n\t\tmap0.SetLegend(g_legend); \n\t} \n\t \n\t// set debug status \n\tif (g_debug == 0) { \n map0.ViewDebugPanel(false); \n map0.ViewTileURL(false); \n } \n if (g_debug == 1) { \n map0.ViewDebugPanel(false); \n map0.ViewTileURL(true); \n } \n if (g_debug == 2) { \n map0.ViewDebugPanel(true); \n map0.ViewTileURL(false); \n } \n if (g_debug == 3) { \n map0.ViewDebugPanel(true); \n map0.ViewTileURL(true); \n } \n}", "function openPanel() {\n \n // Start Override: set the flag to false and hide the image panel\n imagePanelInline = false;\n hidePanel('imageViewer');\n // End Override: set the flag to false and hide the image panel\n \n var mssArea = document.getElementById(\"mssArea\");\n var manuscriptsDiv = document.getElementById(\"manuscripts\");\n var panelButton = document.getElementById(\"newPanel\");\n var mssPanels = getElementsByClass(\"mssPanel\",manuscriptsDiv,\"div\");\n var totalPanels = mssPanels.length;\n\n if (totalPanels + 1 >= maxPanels) {\n panelButton.disabled = true;\n }\n if (totalPanels >= maxPanels) {\n alert(\"Sorry, but the number of visible versions may not exceed the total number of available witnesses.\");\n } else {\n var witnessIndex = getElementsByClass(\"witnessMenu\",mssPanels[totalPanels - 1],\"select\")[0].selectedIndex;\n var newPanel = mssPanels[totalPanels - 1].cloneNode(true);\n var newMenu = getElementsByClass(\"witnessMenu\",newPanel,\"select\")[0];\n var newWitnessIndex = witnessIndex + 1;\n if (newWitnessIndex >= newMenu.length) newWitnessIndex = witnessIndex;\n newMenu.selectedIndex = newWitnessIndex;\n manuscriptsDiv.appendChild(newPanel);\n resizePanels();\n changeWitness(newMenu.value,newPanel);\n }\n}", "clicked(panel) {\n\t}", "function render_panel() {\n\n var scripts = $LAB.script(\"common/lib/panels/jquery.flot.js\").wait()\n .script(\"common/lib/panels/jquery.flot.pie.js\")\n\n // Populate element.\n scripts.wait(function(){\n // Populate element\n try {\n // Add plot to scope so we can build out own legend \n if(scope.panel.chart === 'bar')\n scope.plot = $.plot(elem, scope.data, {\n legend: { show: false },\n series: {\n lines: { show: false, },\n bars: { show: true, fill: 1, barWidth: 0.8, horizontal: false },\n shadowSize: 1\n },\n yaxis: { show: true, min: 0, color: \"#c8c8c8\" },\n xaxis: { show: false },\n grid: {\n backgroundColor: '#272b30',\n borderWidth: 0,\n borderColor: '#eee',\n color: \"#eee\",\n hoverable: true,\n },\n colors: ['#86B22D','#BF6730','#1D7373','#BFB930','#BF3030','#77207D']\n })\n if(scope.panel.chart === 'pie')\n scope.plot = $.plot(elem, scope.data, {\n legend: { show: false },\n series: {\n pie: {\n innerRadius: scope.panel.donut ? 0.4 : 0,\n tilt: scope.panel.tilt ? 0.45 : 1,\n radius: 1,\n show: true,\n combine: {\n color: '#999',\n label: 'The Rest'\n },\n stroke: {\n color: '#272b30',\n width: 0\n },\n label: { \n show: scope.panel.labels,\n radius: 2/3,\n formatter: function(label, series){\n return '<div ng-click=\"build_search(panel.query.field,\\''+label+'\\') \"style=\"font-size:8pt;text-align:center;padding:2px;color:white;\">'+\n label+'<br/>'+Math.round(series.percent)+'%</div>';\n },\n threshold: 0.1 \n }\n }\n },\n //grid: { hoverable: true, clickable: true },\n grid: { hoverable: true, clickable: true },\n colors: ['#86B22D','#BF6730','#1D7373','#BFB930','#BF3030','#77207D']\n });\n\n // Compensate for the height of the legend. Gross\n elem.height(\n (scope.panel.height || scope.row.height).replace('px','') - $(\"#\"+scope.$id+\"-legend\").height())\n\n // Work around for missing legend at initialization\n if(!scope.$$phase)\n scope.$apply()\n\n } catch(e) {\n elem.text(e)\n }\n })\n }", "function createPanelLeft()\n{\n\tvar myPanelLeft = Ext.create('Ext.panel.Panel',{\n\t\tid: 'leftPanel',\n\t\ttitle: 'Cartografía y herramientas',\n\t\tregion: 'west',\n\t\twidth : 340,\n\t\tcollapsed: false,\n\t\tcollapsible: true,\n\t\tresizable: false,\n\t\titems:[{\n\t\t\txtype: 'tabpanel',\n\t\t\tid: 'tabpanelTools',\n\t\t\tresizable: false,\n\t\t\tborder: false,\n\t\t\tactiveTab: 0,\n\t\t\titems:[{\n\t\t\t\ttitle: 'Capas',\n\t\t\t\twidth: '100%',\n\t\t\t\tborder : true,\n\t\t\t\titems:[{\n\t\t\t\t\txtype : 'treepanel',\n\t\t\t\t\tid : 'treepanelLayers',\n\t\t\t\t\tborder : false,\n\t\t\t\t\tstore : storeAllLayers,\n\t\t\t\t\trootVisible : false,\n\t\t\t\t\tcollapsible : false,\n\t\t\t\t\tcollapsed : false,\n\t\t\t\t\tautoScroll : true,\n\t\t\t\t\tlines : true,\n\t\t\t\t\thideHeaders : true,\n\t\t \t\t\tmargin: '0 0 0 -5',\n\t\t\t\t\tcolumns : {\n\t\t\t\t\t\theader : false,\n\t\t\t\t\t\titems : [{\n\t\t\t\t\t\t\txtype : 'treecolumn',\n\t\t\t\t\t\t\tid: 'treecolumn',\n\t\t\t\t\t\t\tdataIndex : 'text',\n\t\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\t\twidth : 270,\n\t\t\t\t\t\t\tmargin: '0 0 0 0',\n\t\t\t\t\t\t\trenderer : myRenderer\n\t\t\t\t\t\t},{\n\t\t\t\t\t\t\ttext: 'Value',\n\t\t\t\t\t\t\twidth : 60,\n\t\t\t\t\t\t\txtype: 'widgetcolumn',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t\tmargin: '0 0 0 0',\n\t\t\t\t\t\t\twidget : {\n\t\t\t\t\t\t\t\txtype: 'slider',\n\t\t\t\t\t\t\t\thideLabel: true,\n\t\t\t\t\t\t\t\twidth: 50,\n\t\t\t\t\t\t\t\tminValue: 0,\n\t\t\t\t\t\t\t\tmaxValue: 100,\n\t\t\t\t\t\t\t\tvalue: 100,\n\t\t\t\t\t\t\t\ttipText : function(thumb) {\n\t\t\t\t\t\t\t\t\treturn Ext.String.format('{0}% transparencia',(100 - thumb.value));\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tlisteners : {\n\t\t\t\t\t\t\t\t\tchange : function(thisSlider, newValue, thumb, eOpts) {\n\t\t\t\t\t\t\t\t\t\t//aplicamos transparencia\n\t\t\t\t\t\t\t\t\t\tvar layerOpacity = findBy(map.getLayerGroup(), 'name', generalLayerOpacity);\n\t\t\t\t\t\t\t\t\t\tlayerOpacity.setOpacity(newValue / 100);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}]\n\t\t\t\t\t},\n\t\t\t\t\tlisteners: {\n\t\t\t\t\t\titemmouseenter: function(gridview, record) {\n\t\t\t\t\t\t\t//obtenemos el nombre de la capa sobre la que se realiza la transparencia\n\t\t\t\t\t\t\tgeneralLayerOpacity = record.get('text');\n\t\t\t\t\t\t},\n\t\t\t\t\t\trender: function(){\n\t\t\t\t\t\t\tExt.getStore('storeAllLayers').filterBy(function(record) {\n\t\t\t\t\t\t\t\tif (record.data.text != 'NoLegend' && record.data.text != nameUsuario && record.data.text.indexOf(\"geocoder-layer\")) {\n\t\t\t\t\t\t\t\t\treturn true;\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}\n\t\t\t\t\t}\n\t\t\t\t}]\n\t\t\t},{\n\t\t\t\ttitle: 'Localización de elementos',\n\t\t\t\twidth: '100%',\n\t\t\t\tborder : true,\n\t\t\t\titems:[{\n\t\t\t xtype: 'form',\n\t\t\t\tid:'LocForm',\n\t\t\t bodyPadding: 10,\n\t\t\t layout: 'anchor',\n\t\t\t scrollable:true,\n\t\t\t width: '100%',\n\t\t\t items: [{\n\t\t\t\t xtype: 'fieldset',\n\t\t\t width: '100%',\n\t\t\t title: 'Búsqueda progresiva del identificador predial',\n\t\t\t columnWidth: 0.5,\n\t\t\t labelWidth: 75,\n\t\t\t labelAlign: 'top',\n\t\t\t\t msgTarget: 'under',\n\t\t\t items: [{\n\t\t\t\t layout: 'column',\n\t\t\t\t\t margin: '10 5 0 5',\n\t\t\t\t\t border: false,\n\t\t\t\t\t items:[{\n\t\t\t\t\t\tcolumnWidth: '0.735',\n\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'vbox',\n\t\t\t\t\t\talign: 'center'\n\t\t\t\t\t\t},\n\t\t\t\t\t\titems:[{\n\t\t\t\t \t\txtype: 'combobox',\n\t\t\t\t\t\t\tname: 'ComboDepartamento',\n\t\t\t\t\t\t\tfieldLabel: 'Selecciona el Departamento',\n\t\t\t\t\t\t\tlabelAlign: 'top',\n\t\t\t\t\t\t\tmsgTarget: 'under',\n\t\t\t\t\t\t\tid: 'ComboDepartamento',\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tqueryMode: 'local',\n\t\t\t\t\t\t\tdisplayField: 'name',\n\t\t\t\t\t\t\tvalueField: 'cod',\n\t\t\t\t\t\t\tstore: Ext.create('Ext.data.Store', {\n\t\t\t\t\t\t\t\tfields: ['name', 'cod']\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tlisteners:{\n\t\t\t\t\t\t\t\trender: function (thisCombo, eOpts)\n\t\t\t\t\t\t\t\t{\n\n\t\t\t\t\t\t\t\t\tvar arr = sourceLayerDepartamentos.getFeatures();\n\n\t\t\t\t\t\t\t\t\tvar arrAuxname = [];\n\n\t\t\t\t\t\t\t\t\tfor (var i = 0; i < arr.length; i++)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t//arrAuxname.push({name: arr[i].get('departamento'), cod: arr[i].get('departamento')});\n\t\t\t\t\t\t\t\t\t\tarrAuxname.push({name: arr[i].get('dpto_cnmbr'), cod: arr[i].get('dpto_ccdgo')});\n\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tthisCombo.getStore().insert(0, arrAuxname);\n\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tselect: function (thisCombo, record, eOpts){\n\n\t\t\t\t\t\t\t\t\tExt.getCmp('Identificador').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('Identificador').setDisabled(true);\n\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboMunicipio').setDisabled(false);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('btncentrardep').setDisabled(false);\n\n\t\t\t\t\t\t\t\t\t\tcqlfilter = 'CQL_FILTER=dpto_dpto_=' + \"'\" + thisCombo.getValue() + \"'\";\n\n\t\t\t\t\t\t\t\t\t\tpropertyName = 'propertyName=mpio_cnmbr,mpio_ccdgo';\n\n\t\t\t\t\t\t\t\t\t\ttypeNameLayerMun = 'typeName=' + prefijo + ':' + capaMunicipios;\n\n\t\t\t\t\t\t\t\t\t\tordenarPor = 'sortBy=mpio_cnmbr';\n\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboMunicipio').getStore().getProxy().url = 'proxy.jsp?' + encodeURIComponent(WFS + request + '&' + service + '&' + version + '&' + typeNameLayerMun + '&' + cqlfilter + '&' + format + '&' + ordenarPor + '&' + propertyName);\n\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboMunicipio').getStore().load();\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tchange: function(){\n\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboMunicipio').setValue(\"\");\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboZona').setValue(\"\");\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboSector').setValue(\"\");\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboComuna').setValue(\"\");\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboBarrio').setValue(\"\");\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboManzana').setValue(\"\");\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboPredio').setValue(\"\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t }]\n\t\t\t\t\t\t},{ \n\t\t\t\t\t\t columnWidth: '0.265',\n\t\t\t\t\t\t border: false,\n\t\t\t\t\t\t layout: {\n\t\t\t\t\t\t\ttype: 'vbox',\n\t\t\t\t\t\t\talign: 'center'\n\t\t\t\t\t\t },\n\t\t\t\t\t\t items:[{\n\t\t\t\t\t\t\txtype: 'button',\n\t\t\t\t\t\t\ttext: 'Centrar',\n\t\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\t\tid: 'btncentrardep',\n\t\t\t\t\t\t\tmargin: '26 15 0 0',\n\t\t\t\t\t\t\tlisteners: {\n\t\t\t\t\t\t\tclick: function(thisbutton, e, eOpts){\n\t\t\t\t\t\t\t\tvar features = sourceLayerDepartamentos.getFeatures();\n\t\t\t\t\t\t\t\tvar cod = Ext.getCmp('ComboDepartamento').getValue();\n\n\t\t\t\t\t\t\t\tfor (var i = 0; i < features.length; i++) {\n\t\t\t\t\t\t\t\t\tif (features[i].getProperties().dpto_ccdgo == cod){\n\t\t\t\t\t\t\t\t\t\tvar extent = features[i].getGeometry();\n\t\t\t\t\t\t\t\t\t\tmap.getView().fit(extent, {padding: [170, 50, 30, 150], constrainResolution: false});\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}\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\t layout: 'column',\n\t\t\t\t\t\t margin: '0 5 0 5',\n\t\t\t\t\t\t border: false,\n\t\t\t\t\t\t items:[{\n\t\t\t\t\t\t\tcolumnWidth: '0.735',\n\t\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\ttype: 'vbox',\n\t\t\t\t\t\t\t\talign: 'center'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\t\txtype: 'combobox',\n\t\t\t\t\t\t\t\tname: 'ComboMunicipio',\n\t\t\t\t\t\t\t\tid: 'ComboMunicipio',\n\t\t\t\t\t\t\t\tfieldLabel: 'Selecciona el Municipio',\n\t\t\t\t\t\t\t\tlabelAlign: 'top',\n\t\t\t\t\t\t\t\tmsgTarget: 'under',\n\t\t\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\tstore: Ext.create('Ext.data.Store', {\n\t\t\t\t\t\t\t\t\tid: 'storeLocMun',\n\t\t\t\t\t\t\t\t\tmodel: 'modelLocMun',\n\t\t\t\t\t\t\t\t\tautoLoad: false,\n\t\t\t\t\t\t\t\t\tproxy: {\n\t\t\t\t\t\t\t\t\t\ttype: 'ajax',\n\t\t\t\t\t\t\t\t\t\turl: 'proxy.jsp?' + WFS + request + '&' + service + '&' + version + '&' + typeNameLayerMun + '&' + cqlfilter + '&' + format + '&' + ordenarPor,\n\t\t\t\t\t\t\t\t\t\treader: {\n\t\t\t\t\t\t\t\t\t\t\ttype: 'json',\n\t\t\t\t\t\t\t\t\t\t\trootProperty: 'features'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t displayField: 'nbMun',\n\t\t\t\t\t\t\t valueField: 'codMun',\n\t\t\t\t\t\t\t triggerAction: \"all\",\n\t\t\t\t\t\t\t queryMode: 'local',\n\t\t\t\t\t\t\t typeAhead: true,\n\t\t\t\t\t\t\t editable: true,\n\t\t\t\t\t\t\t listeners:{\n\t\t\t\t\t\t\t\t \tbeforequery: function (record) {\n\t\t\t\t\t\t\t\t \t\trecord.query = new RegExp(record.query, 'i');\n\t\t\t\t\t\t\t\t \t\trecord.forceAll = true;\n\t\t\t\t\t\t\t\t \t},\n\t\t\t\t\t\t\t\t \tselect: function(thisCombo, record, eOpts){\n\t\t\t\t\t\t\t\t \t\t\tExt.getCmp('ComboZona').setDisabled(false);\n\t\t\t\t\t\t\t\t \t\t\tExt.getCmp('btncentrarmun').setDisabled(false);\n\n\t\t\t\t\t\t\t\t\t\t\t\tcqlfilter = 'CQL_FILTER=departamento=' + \"'\" + Ext.getCmp('ComboDepartamento').getValue() + \"'%20AND%20\"+ 'municipio=' + \"'\" + thisCombo.getValue() + \"'\";\n\n\t\t\t\t\t\t\t\t\t\t\t\ttypeNameLayer = 'typeName=' + prefijo + ':' + capaTerreno;\n\n\t\t\t\t\t\t\t\t\t\t\t\tordenarPor = 'sortBy=zona';\n\n\t\t\t\t\t\t\t\t\t\t\t\tpropertyName = 'propertyName=departamento,municipio,zona';\n\n\t\t\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboZona').getStore().getProxy().url = 'proxy.jsp?' + encodeURIComponent(WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPor + '&' + propertyName);\n\n\t\t\t\t\t\t\t\t\t\t\t\tvar arr = [];\n\t\t\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboZona').getStore().load(function(){\n\t\t\t\t\t\t\t\t\t\t\t\t this.each(function(record){\n\t\t\t\t\t\t\t\t\t\t\t\t var roles = record.get('idZona');\n\t\t\t\t\t\t\t\t\t\t\t\t arr.push(record.get('idZona'));\n\t\t\t\t\t\t\t\t\t\t\t\t });\n\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t function unique(value, index, self) {\n\t\t\t\t\t\t\t\t\t\t\t\t return self.indexOf(value) === index;\n\t\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar iduniq = arr.filter(unique);\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar nbuniq = arr.filter(unique);\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar item = [];\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor (i=0;i<iduniq.length;i++){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (iduniq[i]==\"00\"){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnbuniq[i] = \"RURAL\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\titem.push({idZona:iduniq[i], nbZona:nbuniq[i]});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}else if(iduniq[i]==\"01\"){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnbuniq[i] = \"URBANO\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\titem.push({idZona:iduniq[i], nbZona:nbuniq[i]});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnbuniq[i] = \"OTROS\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\titem.push({idZona:iduniq[i], nbZona:nbuniq[i]});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboZona').getStore().removeAll();\n\t\t\t\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboZona').getStore().setData(item);\n\n\t\t\t\t\t\t\t\t\t\t\t \t});\n\t\t\t\t\t\t\t \t\t},\n\t\t\t\t\t\t\t\t\tchange: function(){\n\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboZona').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboSector').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboComuna').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboBarrio').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboManzana').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboPredio').setValue(\"\");\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 }]\n\t\t\t\t\t\t},{ \t\n\t\t\t\t\t\t columnWidth: '0.265',\n\t\t\t\t\t\t border: false,\n\t\t\t\t\t\t layout: {\n\t\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t },\n\t\t\t\t\t\t items:[{\n\t \t\t\t\t\txtype: 'button',\n\t\t\t\t\t\t\ttext: 'Centrar',\n\t\t\t\t\t\t\tid: 'btncentrarmun',\n\t\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\t\tmargin: '26 15 0 0',\n\t \t\t\t\t\t\t listeners: {\n \t\t\t\t\t\t \t\tclick: function(thisbutton, e, eOpts){\n \t\t\t\t\t\t \t\t\tvar featuresDep = sourceLayerDepartamentos.getFeatures();\n\t \t\t\t\t\t\t \t\tvar codDep = Ext.getCmp('ComboDepartamento').getValue();\n\t \t\t\t\t\t\t \t\tvar features = sourceLayerMunicipios.getFeatures();\n\t \t\t\t\t\t\t \t\tvar cod = Ext.getCmp('ComboMunicipio').getValue();\n\t \t\t\t\t\t\t \t\tfor (var i = 0; i < features.length; i++) {\n\t \t\t\t\t\t\t \t\t\tif (features[i].getProperties().mpio_ccdgo == cod && features[i].getProperties().dpto_dpto_ == codDep){\n\t \t\t\t\t\t\t \t\t\t\tvar extent = features[i].getGeometry();\n\t \t\t\t\t\t\t \t\t\t\tmap.getView().fit(extent, {padding: [170, 50, 30, 150], constrainResolution: false});\n\t \t\t\t\t\t\t \t\t\t}\n\t \t\t\t\t\t\t \t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t }]\n\t\t\t\t\t\t}]\n\t\t\t\t },{\n\t\t\t\t\t xtype: 'combobox',\n\t\t\t\t\t name: 'ComboZona',\n\t\t\t\t\t id: 'ComboZona',\n\t\t\t\t\t fieldLabel: 'Selecciona la Zona',\n\t\t\t\t\t labelAlign: 'top',\n\t\t\t\t\t msgTarget: 'under',\n\t\t\t\t\t disabled: true,\n\t\t\t\t\t width: '100%',\n\t\t\t\t\t store: Ext.create('Ext.data.Store', {\n\t\t\t\t\t\tid: 'storeLocZona',\n\t\t\t\t\t\tmodel: 'modelLocZona',\n\t\t\t\t\t\tautoLoad: false,\n\t\t\t\t\t\tproxy: {\n\t\t\t\t\t\t\ttype: 'ajax',\n\t\t\t\t\t\t\turl: 'proxy.jsp?' + WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPor,\n\t\t\t\t\t\t\treader: {\n\t\t\t\t\t\t\t\ttype: 'json',\n\t\t\t\t\t\t\t\trootProperty: 'features'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t }),\n\t\t\t\t\t displayField: 'nbZona',\n\t\t\t\t\t valueField: 'idZona',\n\t\t\t\t\t triggerAction: \"all\",\n\t\t\t\t\t queryMode: 'local',\n\t\t\t\t\t typeAhead: true,\n\t\t\t\t\t editable: true,\n\t\t\t\t\t listeners:{\n\t\t\t\t\t\t \tbeforequery: function (record) {\n\t\t\t\t\t\t \t\trecord.query = new RegExp(record.query, 'i');\n\t\t\t\t\t\t \t\trecord.forceAll = true;\n\t\t\t\t\t\t \t},\n\t\t\t\t\t\t \tselect: function(thisCombo, record, eOpts){\n\t\t\t\t\t\t\t \t\tExt.getCmp('ComboSector').setDisabled(false);\n\n\t\t\t\t\t\t\t\t\t\tcqlfilter = 'CQL_FILTER=departamento=' + \"'\" + Ext.getCmp('ComboDepartamento').getValue() + \"'%20AND%20\"+ 'municipio=' + \"'\" + Ext.getCmp('ComboMunicipio').getValue() + \"'%20AND%20\" + 'zona=' + \"'\" + thisCombo.getValue() + \"'\";\n\t\t\t\t\t\t\t\t\t\ttypeNameLayer = 'typeName=' + prefijo + ':' + capaTerreno;\n\t\t\t\t\t\t\t\t\t\tpropertyName = 'propertyName=numero_predial,departamento,municipio,zona,sector';\n\t\t\t\t\t\t\t\t\t\tordenarPor = 'sortBy=sector';\n\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboSector').getStore().getProxy().url = 'proxy.jsp?' + encodeURIComponent(WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPor + '&' + propertyName);\n\n\t\t\t\t\t\t\t\t\t\tvar arr = [];\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboSector').getStore().load(function(){\n\t\t\t\t\t\t\t\t\t\t this.each(function(record){\n\t\t\t\t\t\t\t\t\t\t var roles = record.get('idSector');\n\t\t\t\t\t\t\t\t\t\t arr.push(record.get('idSector'));\n\t\t\t\t\t\t\t\t\t\t });\n\n\t\t\t\t\t\t\t\t\t\t function unique(value, index, self) {\n\t\t\t\t\t\t\t\t\t\t return self.indexOf(value) === index;\n\t\t\t\t\t\t\t\t\t\t }\n\n\t\t\t\t\t\t\t\t\t\t\tvar iduniq = arr.filter(unique);\n\t\t\t\t\t\t\t\t\t\t\tvar item = [];\n\t\t\t\t\t\t\t\t\t\t\tfor (i=0;i<iduniq.length;i++){\n\t\t\t\t\t\t\t\t\t\t\t\titem.push({idSector:iduniq[i]});\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboSector').getStore().removeAll();\n\n\t\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboSector').getStore().setData(item);\n\n\t\t\t\t\t\t\t\t\t });\n\t\t\t\t\t\t \t},\n\t\t\t\t\t\t \tchange: function(){\n\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboSector').setValue(\"\");\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboComuna').setValue(\"\");\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboBarrio').setValue(\"\");\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboManzana').setValue(\"\");\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboPredio').setValue(\"\");\n\t\t\t\t\t\t\t}\n\t\t\t\t \t\t}\n\t\t\t \t},{\n\t\t\t\t layout: 'column',\n\t\t\t\t\t margin: '10 5 0 5',\n\t\t\t\t\t border: false,\n\t\t\t\t\t items:[{\n\t\t\t\t\t\tcolumnWidth: '0.735',\n\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t},\n\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\txtype: 'combobox',\n\t\t\t\t\t\t\tname: 'ComboSector',\n\t\t\t\t\t\t\tid: 'ComboSector',\n\t\t\t\t\t\t\tfieldLabel: 'Selecciona el Sector',\n\t\t\t\t\t\t\tlabelAlign: 'top',\n\t\t\t\t\t\t\tmsgTarget: 'under',\n\t\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tstore: Ext.create('Ext.data.Store', {\n\t\t\t\t\t\t\t\t\tid: 'storeLocSector',\n\t\t\t\t\t\t\t\t\tmodel: 'modelLocSector',\n\t\t\t\t\t\t\t\t\tautoLoad: false,\n\t\t\t\t\t\t\t\t\tproxy: {\n\t\t\t\t\t\t\t\t\t\ttype: 'ajax',\n\t\t\t\t\t\t\t\t\t\turl: 'proxy.jsp?' + WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPor,\n\t\t\t\t\t\t\t\t\t\treader: {\n\t\t\t\t\t\t\t\t\t\t\ttype: 'json',\n\t\t\t\t\t\t\t\t\t\t\trootProperty: 'features'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t }),\n\t\t\t\t\t\t\t displayField: 'idSector',\n\t\t\t\t\t\t\t valueField: 'idSector',\n\t\t\t\t\t\t\t triggerAction: \"all\",\n\t\t\t\t\t\t\t queryMode: 'local',\n\t\t\t\t\t\t\t typeAhead: true,\n\t\t\t\t\t\t\t editable: true,\n\t\t\t\t\t\t\t listeners:{\n\t\t\t\t\t\t\t\tbeforequery: function (record) {\n\t\t\t\t\t\t\t\t\trecord.query = new RegExp(record.query, 'i');\n\t\t\t\t\t\t\t\t\trecord.forceAll = true;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tselect: function(thisCombo, record, eOpts){\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboComuna').setDisabled(false);\n\t\t\t\t\t\t\t\t\tExt.getCmp('btncentrarsec').setDisabled(false);\n\n\t\t\t\t\t\t\t\t\t\tcqlfilter = 'CQL_FILTER=departamento=' + \"'\" + Ext.getCmp('ComboDepartamento').getValue() + \"'%20AND%20\"+ 'municipio=' + \"'\" + Ext.getCmp('ComboMunicipio').getValue() + \"'%20AND%20\" + 'zona=' + \"'\" + Ext.getCmp('ComboZona').getValue() + \"'%20AND%20\" + 'sector=' + \"'\" + thisCombo.getValue() + \"'\";\n\t\t\t\t\t\t\t\t\t\ttypeNameLayer = 'typeName=' + prefijo + ':' + capaTerreno;\n\t\t\t\t\t\t\t\t\t\tordenarPor = 'sortBy=comuna';\n\t\t\t\t\t\t\t\t\t\tpropertyName = 'propertyName=departamento,municipio,zona,sector,comuna';\n\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboComuna').getStore().getProxy().url = 'proxy.jsp?' + encodeURIComponent(WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPor + '&' + propertyName);\n\n\t\t\t\t\t\t\t\t\t\tvar arr = [];\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboComuna').getStore().load(function(){\n\t\t\t\t\t\t\t\t\t\t this.each(function(record){\n\t\t\t\t\t\t\t\t\t\t\tvar roles = record.get('idComuna');\n\t\t\t\t\t\t\t\t\t\t\tarr.push(record.get('idComuna'));\n\t\t\t\t\t\t\t\t\t\t });\n\n\t\t\t\t\t\t\t\t\t\t function unique(value, index, self) {\n\t\t\t\t\t\t\t\t\t\t\treturn self.indexOf(value) === index;\n\t\t\t\t\t\t\t\t\t\t }\n\n\t\t\t\t\t\t\t\t\t\t\tvar iduniq = arr.filter(unique);\n\t\t\t\t\t\t\t\t\t\t\tvar item = [];\n\t\t\t\t\t\t\t\t\t\t\tfor (i=0;i<iduniq.length;i++){\n\t\t\t\t\t\t\t\t\t\t\t\titem.push({idComuna:iduniq[i]});\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboComuna').getStore().removeAll();\n\t\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboComuna').getStore().setData(item);\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\t\tchange: function(){\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboComuna').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboBarrio').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboManzana').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboPredio').setValue(\"\");\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\t},{ \t\n\t\t\t\t\t\t columnWidth: '0.265',\n\t\t\t\t\t\t border: false,\n\t\t\t\t\t\t layout: {\n\t\t\t\t\t\t \ttype: 'vbox',\n\t\t\t\t\t\t \talign: 'center'\n\t\t\t\t\t\t },\n\t\t\t\t\t\t items:[{\n\t\t\t\t\t\t\txtype: 'button',\n\t\t\t\t\t\t\ttext: 'Centrar',\n\t\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\t\tid: 'btncentrarsec',\n\t\t\t\t\t\t\tmargin: '26 15 0 0',\n\t\t\t\t\t\t\tlisteners: {\n\t\t\t\t\t\t\t\tclick: function(thisbutton, e, eOpts){\n\t\t\t\t\t\t\t\t\t\tvar features;\n\t\t\t\t\t\t\t\t\t\tvar url = Ext.getCmp('ComboComuna').getStore().getProxy().url.replace('propertyName%3Ddepartamento%2Cmunicipio%2Czona%2Csector%2Ccomuna', '');\n\n\t\t\t\t\t\t\t\t\t\tExt.Ajax.request({\n\t\t\t\t\t\t\t\t\t\t\turl: url,\n\t\t\t\t\t\t\t\t\t\t\tasync: false,\n\t\t\t\t\t\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\t\t\t\t\t\tsuccess: function(response, opts) {\n\t\t\t\t\t\t\t\t\t\t\t\tfeatures = new ol.format.GeoJSON().readFeatures(response.responseText);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t\tvar xmin = features[0].getGeometry().getExtent()[0];\n\t\t\t\t\t\t\t\t\t\tvar ymin = features[0].getGeometry().getExtent()[1];\n\t\t\t\t\t\t\t\t\t\tvar xmax = features[0].getGeometry().getExtent()[2];\n\t\t\t\t\t\t\t\t\t\tvar ymax = features[0].getGeometry().getExtent()[3];\n\n\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < features.length; i++) {\n\t\t\t\t\t\t\t\t\t\t\tvar extentini = features[i].getGeometry().getExtent();\n\t\t\t\t\t\t\t\t\t\t\tif (extentini[0] < xmin) {\n\t\t\t\t\t\t\t\t\t\t\t\txmin = extentini[0];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif (extentini[1] < ymin) {\n\t\t\t\t\t\t\t\t\t\t\t\tymin = extentini[1];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif (extentini[2] > xmax) {\n\t\t\t\t\t\t\t\t\t\t\t\txmax = extentini[2];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif (extentini[3] > ymax) {\n\t\t\t\t\t\t\t\t\t\t\t\tymax = extentini[3];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tvar extent = [xmin, ymin, xmax, ymax];\n\t\t\t\t\t\t\t\t\t\tmap.getView().fit(extent, {padding: [170, 50, 30, 150], constrainResolution: false});\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}]\n\t\t\t \t },{\n\t\t \t\t layout: 'column',\n\t\t\t\t\t margin: '10 5 0 5',\n\t\t\t\t\t border: false,\n\t\t\t\t\t items:[{\n\t\t\t\t\t\t columnWidth: '0.735',\n\t\t\t\t\t\t border: false,\n\t\t\t\t\t\t layout: {\n\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t },\n\t\t\t\t\t\t items:[{\n\t\t\t\t\t\t\txtype: 'combobox',\n\t\t\t\t\t\t\tname: 'ComboComuna',\n\t\t\t\t\t\t\tid: 'ComboComuna',\n\t\t\t\t\t\t\tfieldLabel: 'Selecciona la Comuna',\n\t\t\t\t\t\t\tlabelAlign: 'top',\n\t\t\t\t\t\t\tmsgTarget: 'under',\n\t\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tstore: Ext.create('Ext.data.Store', {\n\t\t\t\t\t\t\t\tid: 'storeLocComuna',\n\t\t\t\t\t\t\t\tmodel: 'modelLocComuna',\n\t\t\t\t\t\t\t\tautoLoad: false,\n\t\t\t\t\t\t\t\tproxy: {\n\t\t\t\t\t\t\t\t\ttype: 'ajax',\n\t\t\t\t\t\t\t\t\turl: 'proxy.jsp?' + WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPor,\n\t\t\t\t\t\t\t\t\treader: {\n\t\t\t\t\t\t\t\t\t\ttype: 'json',\n\t\t\t\t\t\t\t\t\t\trootProperty: 'features'\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\tdisplayField: 'idComuna',\n\t\t\t\t\t\t\tvalueField: 'idComuna',\n\t\t\t\t\t\t\ttriggerAction: \"all\",\n\t\t\t\t\t\t\tqueryMode: 'local',\n\t\t\t\t\t\t\ttypeAhead: true,\n\t\t\t\t\t\t\teditable: true,\n\t\t\t\t\t\t\tlisteners:{\n\t\t\t\t\t\t\t\tbeforequery: function (record) {\n\t\t\t\t\t\t\t\t\trecord.query = new RegExp(record.query, 'i');\n\t\t\t\t\t\t\t\t\trecord.forceAll = true;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tselect: function(thisCombo, record, eOpts){\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboBarrio').setDisabled(false);\n\t\t\t\t\t\t\t\t\tExt.getCmp('btncentrarcom').setDisabled(false);\n\n\t\t\t\t\t\t\t\t\t\tcqlfilter = 'CQL_FILTER=departamento=' + \"'\" + Ext.getCmp('ComboDepartamento').getValue() + \"'%20AND%20\"+ 'municipio=' + \"'\" + Ext.getCmp('ComboMunicipio').getValue() + \"'%20AND%20\" + 'zona=' + \"'\" + Ext.getCmp('ComboZona').getValue() + \"'%20AND%20\" + 'sector=' + \"'\" + Ext.getCmp('ComboSector').getValue() + \"'%20AND%20\" + 'comuna=' + \"'\" + thisCombo.getValue() + \"'\";\n\t\t\t\t\t\t\t\t\t\ttypeNameLayer = 'typeName=' + prefijo + ':' + capaTerreno;\n\t\t\t\t\t\t\t\t\t\tordenarPor = 'sortBy=barrio';\n\t\t\t\t\t\t\t\t\t\tpropertyName = 'propertyName=departamento,municipio,zona,sector,comuna,barrio';\n\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboBarrio').getStore().getProxy().url = 'proxy.jsp?' + encodeURIComponent(WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPor + '&' + propertyName);\n\n\t\t\t\t\t\t\t\t\t\tvar arr = [];\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboBarrio').getStore().load(function(){\n\t\t\t\t\t\t\t\t\t\t\t this.each(function(record){\n\t\t\t\t\t\t\t\t\t\t\t var roles = record.get('idBarrio');\n\t\t\t\t\t\t\t\t\t\t\t arr.push(record.get('idBarrio'));\n\t\t\t\t\t\t\t\t\t\t\t });\n\n\t\t\t\t\t\t\t\t\t\t\t function unique(value, index, self) {\n\t\t\t\t\t\t\t\t\t\t\t return self.indexOf(value) === index;\n\t\t\t\t\t\t\t\t\t\t\t }\n\n\t\t\t\t\t\t\t\t\t\t\t var iduniq = arr.filter(unique);\n\t\t\t\t\t\t\t\t\t\t\t var item = [];\n\t\t\t\t\t\t\t\t\t\t\t for (i=0;i<iduniq.length;i++){\n\t\t\t\t\t\t\t\t\t\t\t\t item.push({idBarrio:iduniq[i]});\n\t\t\t\t\t\t\t\t\t\t\t }\n\n\t\t\t\t\t\t\t\t\t\t\t Ext.getCmp('ComboBarrio').getStore().removeAll();\n\n\t\t\t\t\t\t\t\t\t\t\t Ext.getCmp('ComboBarrio').getStore().setData(item);\n\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\t\tchange: function(){\n\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboBarrio').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboManzana').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboPredio').setValue(\"\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t \t}]\n\t\t\t\t\t},{ \n\t\t\t\t\t\tcolumnWidth: '0.265',\n\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t},\n\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\txtype: 'button',\n\t\t\t\t\t\t\ttext: 'Centrar',\n\t\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\t\tid: 'btncentrarcom',\n\t\t\t\t\t\t\tmargin: '26 15 0 0',\n\t\t\t\t\t\t\tlisteners: {\n\t\t\t\t\t\t\tclick: function(thisbutton, e, eOpts){\n\t\t\t\t\t\t\t\tvar features;\n\t\t\t\t\t\t\t\tvar url = Ext.getCmp('ComboBarrio').getStore().getProxy().url.replace('propertyName%3Ddepartamento%2Cmunicipio%2Czona%2Csector%2Ccomuna%2Cbarrio', '');\n\n\t\t\t\t\t\t\t\tExt.Ajax.request({\n\t\t\t\t\t\t\t\t\turl: url,\n\t\t\t\t\t\t\t\t\tasync: false,\n\t\t\t\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\t\t\t\tsuccess: function(response, opts) {\n\t\t\t\t\t\t\t\t\t\tfeatures = new ol.format.GeoJSON().readFeatures(response.responseText);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tvar xmin = features[0].getGeometry().getExtent()[0];\n\t\t\t\t\t\t\t\tvar ymin = features[0].getGeometry().getExtent()[1];\n\t\t\t\t\t\t\t\tvar xmax = features[0].getGeometry().getExtent()[2];\n\t\t\t\t\t\t\t\tvar ymax = features[0].getGeometry().getExtent()[3];\n\n\t\t\t\t\t\t\t\tfor (var i = 0; i < features.length; i++) {\n\t\t\t\t\t\t\t\t\tvar extentini = features[i].getGeometry().getExtent();\n\n\t\t\t\t\t\t\t\t\tif (extentini[0] < xmin) {\n\t\t\t\t\t\t\t\t\t\txmin = extentini[0];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (extentini[1] < ymin) {\n\t\t\t\t\t\t\t\t\t\tymin = extentini[1];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (extentini[2] > xmax) {\n\t\t\t\t\t\t\t\t\t\txmax = extentini[2];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (extentini[3] > ymax) {\n\t\t\t\t\t\t\t\t\t\tymax = extentini[3];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvar extent = [xmin, ymin, xmax, ymax];\n\n\t\t\t\t\t\t\t\tmap.getView().fit(extent, {padding: [170, 50, 30, 150], constrainResolution: false});\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}]\n\t\t\t\t\t}]\n\t\t\t \t},{\n\t\t\t\t layout: 'column',\n\t\t\t\t\t margin: '10 5 0 5',\n\t\t\t\t\t border: false,\n\t\t\t\t\t items:[{\n\t\t\t\t\t\tcolumnWidth: '0.735',\n\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t},\n\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\txtype: 'combobox',\n\t\t\t\t\t\t\tname: 'ComboBarrio',\n\t\t\t\t\t\t\tid: 'ComboBarrio',\n\t\t\t\t\t\t\tfieldLabel: 'Selecciona el Barrio',\n\t\t\t\t\t\t\tlabelAlign: 'top',\n\t\t\t\t\t\t\tmsgTarget: 'under',\n\t\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tstore: Ext.create('Ext.data.Store', {\n\t\t\t\t\t\t\t\tid: 'storeLocBarrio',\n\t\t\t\t\t\t\t\tmodel: 'modelLocBarrio',\n\t\t\t\t\t\t\t\tautoLoad: false,\n\t\t\t\t\t\t\t\tproxy: {\n\t\t\t\t\t\t\t\t\ttype: 'ajax',\n\t\t\t\t\t\t\t\t\turl: 'proxy.jsp?' + WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPor,\n\t\t\t\t\t\t\t\t\treader: {\n\t\t\t\t\t\t\t\t\t\ttype: 'json',\n\t\t\t\t\t\t\t\t\t\trootProperty: 'features'\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 displayField: 'idBarrio',\n\t\t\t\t\t\t valueField: 'idBarrio',\n\t\t\t\t\t\t triggerAction: \"all\",\n\t\t\t\t\t\t queryMode: 'local',\n\t\t\t\t\t\t typeAhead: true,\n\t\t\t\t\t\t editable: true,\n\t\t\t\t\t\t listeners:{\n\t\t\t\t\t\t\t\tbeforequery: function (record) {\n\t\t\t\t\t\t\t\t\trecord.query = new RegExp(record.query, 'i');\n\t\t\t\t\t\t\t\t\trecord.forceAll = true;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tselect: function(thisCombo, record, eOpts){\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboManzana').setDisabled(false);\n\t\t\t\t\t\t\t\t\tExt.getCmp('btncentrarbarr').setDisabled(false);\n\n\t\t\t\t\t\t\t\t\t\tcqlfilter = 'CQL_FILTER=departamento=' + \"'\" + Ext.getCmp('ComboDepartamento').getValue() + \"'%20AND%20\"+ 'municipio=' + \"'\" + Ext.getCmp('ComboMunicipio').getValue() + \"'%20AND%20\" + 'zona=' + \"'\" + Ext.getCmp('ComboZona').getValue() + \"'%20AND%20\" + 'sector=' + \"'\" + Ext.getCmp('ComboSector').getValue() + \"'%20AND%20\" + 'comuna=' + \"'\" + Ext.getCmp('ComboComuna').getValue() + \"'%20AND%20\" + 'barrio=' + \"'\" + thisCombo.getValue() + \"'\";\n\t\t\t\t\t\t\t\t\t\ttypeNameLayer = 'typeName=' + prefijo + ':' + capaTerreno;\n\t\t\t\t\t\t\t\t\t\tpropertyName = 'propertyName=departamento,municipio,zona,sector,comuna,barrio,manzana';\n\t\t\t\t\t\t\t\t\t\tordenarPor = 'sortBy=manzana';\n\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboManzana').getStore().getProxy().url = 'proxy.jsp?' + encodeURIComponent(WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPor + '&' + propertyName);\n\n\t\t\t\t\t\t\t\t\t\tvar arr = [];\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboManzana').getStore().load(function(){\n\t\t\t\t\t\t\t\t\t\t\t this.each(function(record){\n\t\t\t\t\t\t\t\t\t\t\t var roles = record.get('idManzana');\n\t\t\t\t\t\t\t\t\t\t\t arr.push(record.get('idManzana'));\n\t\t\t\t\t\t\t\t\t\t\t });\n\n\t\t\t\t\t\t\t\t\t\t\t function unique(value, index, self) {\n\t\t\t\t\t\t\t\t\t\t\t return self.indexOf(value) === index;\n\t\t\t\t\t\t\t\t\t\t\t }\n\n\t\t\t\t\t\t\t\t\t\t\t var iduniq = arr.filter(unique);\n\t\t\t\t\t\t\t\t\t\t\t var item = [];\n\t\t\t\t\t\t\t\t\t\t\t for (i=0;i<iduniq.length;i++){\n\t\t\t\t\t\t\t\t\t\t\t\t item.push({idManzana:iduniq[i]});\n\t\t\t\t\t\t\t\t\t\t\t }\n\n\t\t\t\t\t\t\t\t\t\t\t Ext.getCmp('ComboManzana').getStore().removeAll();\n\t\t\t\t\t\t\t\t\t\t\t Ext.getCmp('ComboManzana').getStore().setData(item);\n\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\t\tchange: function(){\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboManzana').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboPredio').setValue(\"\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t }]\n\t\t\t\t\t\t},{ \n\t\t\t\t\t\t\tcolumnWidth: '0.265',\n\t\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\titems:[{\n \t\t\t\t\t\t\txtype: 'button',\n\t \t\t\t\t\t\t\ttext: 'Centrar',\n\t \t\t\t\t\t\t\tdisabled: true,\n\t \t\t\t\t\t\t\tid: 'btncentrarbarr',\n\t \t\t\t\t\t\t\tmargin: '26 15 0 0',\n \t\t\t\t\t\t \t\tlisteners: {\n\t\t\t\t\t\t\t\t\tclick: function(thisbutton, e, eOpts){\n\t\t\t\t\t\t\t\t\t\tvar features;\n\t\t\t\t\t\t\t\t\t\tvar url = Ext.getCmp('ComboManzana').getStore().getProxy().url.replace('propertyName%3Ddepartamento%2Cmunicipio%2Czona%2Csector%2Ccomuna%2Cbarrio%2Cmanzana', '');\n\n\t\t\t\t\t\t\t\t\t\tExt.Ajax.request({\n\t\t\t\t\t\t\t\t\t\t\turl: url,\n\t\t\t\t\t\t\t\t\t\t\tasync: false,\n\t\t\t\t\t\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\t\t\t\t\t\tsuccess: function(response, opts) {\n\t\t\t\t\t\t\t\t\t\t\t\tfeatures = new ol.format.GeoJSON().readFeatures(response.responseText);\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t\tvar xmin = features[0].getGeometry().getExtent()[0];\n\t\t\t\t\t\t\t\t\t\tvar ymin = features[0].getGeometry().getExtent()[1];\n\t\t\t\t\t\t\t\t\t\tvar xmax = features[0].getGeometry().getExtent()[2];\n\t\t\t\t\t\t\t\t\t\tvar ymax = features[0].getGeometry().getExtent()[3];\n\n\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < features.length; i++) {\n\t\t\t\t\t\t\t\t\t\t\tvar extentini = features[i].getGeometry().getExtent();\n\t\t\t\t\t\t\t\t\t\t\tif (extentini[0] < xmin) {\n\t\t\t\t\t\t\t\t\t\t\t\txmin = extentini[0];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif (extentini[1] < ymin) {\n\t\t\t\t\t\t\t\t\t\t\t\tymin = extentini[1];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif (extentini[2] > xmax) {\n\t\t\t\t\t\t\t\t\t\t\t\txmax = extentini[2];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif (extentini[3] > ymax) {\n\t\t\t\t\t\t\t\t\t\t\t\tymax = extentini[3];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tvar extent = [xmin, ymin, xmax, ymax];\n\n\t\t\t\t\t\t\t\t\t\tmap.getView().fit(extent, {padding: [170, 50, 30, 150], constrainResolution: false});\n\t\t\t\t\t\t\t\t\t}\n \t\t\t\t\t\t \t\t}\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t}]\n\t\t\t\t \t\n\t\t\t\t },{\n\t\t\t\t layout: 'column',\n\t\t\t\t\t margin: '10 5 0 5',\n\t\t\t\t\t border: false,\n\t\t\t\t\t items:[{\n\t\t\t\t\t\tcolumnWidth: '0.735',\n\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t},\n\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\txtype: 'combobox',\n\t\t\t\t\t\t\tname: 'ComboManzana',\n\t\t\t\t\t\t\tid: 'ComboManzana',\n\t\t\t\t\t\t\tfieldLabel: 'Selecciona la Manzana o Vereda',\n\t\t\t\t\t\t\tlabelAlign: 'top',\n\t\t\t\t\t\t\tmsgTarget: 'under',\n\t\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tstore: Ext.create('Ext.data.Store', {\n\t\t\t\t\t\t\t\tid: 'storeLocManzana',\n\t\t\t\t\t\t\t\tmodel: 'modelLocManzana',\n\t\t\t\t\t\t\t\tautoLoad: false,\n\t\t\t\t\t\t\t\tproxy: {\n\t\t\t\t\t\t\t\t\ttype: 'ajax',\n\t\t\t\t\t\t\t\t\turl: 'proxy.jsp?' + WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPor,\n\t\t\t\t\t\t\t\t\treader: {\n\t\t\t\t\t\t\t\t\t\ttype: 'json',\n\t\t\t\t\t\t\t\t\t\trootProperty: 'features'\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\tdisplayField: 'idManzana',\n\t\t\t\t\t\t\tvalueField: 'idManzana',\n\t\t\t\t\t\t\ttriggerAction: \"all\",\n\t\t\t\t\t\t\tqueryMode: 'local',\n\t\t\t\t\t\t\ttypeAhead: true,\n\t\t\t\t\t\t\teditable: true,\n\t\t\t\t\t\t\tlisteners:{\n\t\t\t\t\t\t\t\tbeforequery: function (record) {\n\t\t\t\t\t\t\t\t\trecord.query = new RegExp(record.query, 'i');\n\t\t\t\t\t\t\t\t\trecord.forceAll = true;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tselect: function(thisCombo, record, eOpts){\n\n\t\t\t\t\t\t\t\t\tExt.getCmp('ComboPredio').setDisabled(false);\n\t\t\t\t\t\t\t\t\tExt.getCmp('btncentrarman').setDisabled(false);\n\n\t\t\t\t\t\t\t\t\t\tcqlfilter = 'CQL_FILTER=departamento=' + \"'\" + Ext.getCmp('ComboDepartamento').getValue() + \"'%20AND%20\"+ 'municipio=' + \"'\" + Ext.getCmp('ComboMunicipio').getValue() + \"'%20AND%20\" + 'zona=' + \"'\" + Ext.getCmp('ComboZona').getValue() + \"'%20AND%20\" + 'sector=' + \"'\" + Ext.getCmp('ComboSector').getValue() + \"'%20AND%20\" + 'comuna=' + \"'\" + Ext.getCmp('ComboComuna').getValue() + \"'%20AND%20\" + 'barrio=' + \"'\" + Ext.getCmp('ComboBarrio').getValue() + \"'%20AND%20\" + 'manzana=' + \"'\" + thisCombo.getValue() + \"'\";\n\t\t\t\t\t\t\t\t\t\ttypeNameLayer = 'typeName=' + prefijo + ':' + capaTerreno;\n\t\t\t\t\t\t\t\t\t\tpropertyName = 'propertyName=departamento,municipio,zona,sector,comuna,barrio,manzana,predio';\n\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboPredio').getStore().getProxy().url = 'proxy.jsp?' + encodeURIComponent(WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPorNumPredial + '&' + propertyName);\n\n\t\t\t\t\t\t\t\t\t\tvar arr = [];\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboPredio').getStore().load(function(){\n\t\t\t\t\t\t\t\t\t\t\t\t this.each(function(record){\n\t\t\t\t\t\t\t\t\t\t\t\t var roles = record.get('idPredio');\n\t\t\t\t\t\t\t\t\t\t\t\t arr.push(record.get('idPredio'));\n\n\t\t\t\t\t\t\t\t\t\t\t\t });\n\n\t\t\t\t\t\t\t\t\t\t\t\t function unique(value, index, self) {\n\t\t\t\t\t\t\t\t\t\t\t\t return self.indexOf(value) === index;\n\t\t\t\t\t\t\t\t\t\t\t\t }\n\n\t\t\t\t\t\t\t\t\t\t\t\t var iduniq = arr.filter(unique);\n\t\t\t\t\t\t\t\t\t\t\t\t var item = [];\n\t\t\t\t\t\t\t\t\t\t\t\t for (i=0;i<iduniq.length;i++){\n\t\t\t\t\t\t\t\t\t\t\t\t\t item.push({idPredio:iduniq[i]});\n\t\t\t\t\t\t\t\t\t\t\t\t }\n\n\t\t\t\t\t\t\t\t\t\t\t\t Ext.getCmp('ComboPredio').getStore().removeAll();\n\t\t\t\t\t\t\t\t\t\t\t\t Ext.getCmp('ComboPredio').getStore().setData(item);\n\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\t\tchange: function(){\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboPredio').setValue(\"\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t }]\n\t\t\t\t\t\t},{ \n\t\t\t\t\t\t\tcolumnWidth: '0.265',\n\t\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\t\txtype: 'button',\n\t\t\t\t\t\t\t\ttext: 'Centrar',\n\t\t\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\t\t\tid: 'btncentrarman',\n\t\t\t\t\t\t\t\tmargin: '26 15 0 0',\n\t\t\t\t\t\t\t\tlisteners: {\n\t\t\t\t\t\t\t\t click: function(thisbutton, e, eOpts){\n\t\t\t\t\t\t\t\t\tvar features;\n\t\t\t\t\t\t\t\t\tvar url = Ext.getCmp('ComboPredio').getStore().getProxy().url.replace('propertyName%3Ddepartamento%2Cmunicipio%2Czona%2Csector%2Ccomuna%2Cbarrio%2Cmanzana%2Cpredio', '');;\n\n\t\t\t\t\t\t\t\t\tExt.Ajax.request({\n\t\t\t\t\t\t\t\t\t\turl: url,\n\t\t\t\t\t\t\t\t\t\tasync: false,\n\t\t\t\t\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\t\t\t\t\tsuccess: function(response, opts) {\n\t\t\t\t\t\t\t\t\t\t\tfeatures = new ol.format.GeoJSON().readFeatures(response.responseText);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\tvar xmin = features[0].getGeometry().getExtent()[0];\n\t\t\t\t\t\t\t\t\tvar ymin = features[0].getGeometry().getExtent()[1];\n\t\t\t\t\t\t\t\t\tvar xmax = features[0].getGeometry().getExtent()[2];\n\t\t\t\t\t\t\t\t\tvar ymax = features[0].getGeometry().getExtent()[3];\n\n\t\t\t\t\t\t\t\t\tfor (var i = 0; i < features.length; i++) {\n\t\t\t\t\t\t\t\t\t\tvar extentini = features[i].getGeometry().getExtent();\n\t\t\t\t\t\t\t\t\t\tif (extentini[0] < xmin) {\n\t\t\t\t\t\t\t\t\t\t\txmin = extentini[0];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (extentini[1] < ymin) {\n\t\t\t\t\t\t\t\t\t\t\tymin = extentini[1];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (extentini[2] > xmax) {\n\t\t\t\t\t\t\t\t\t\t\txmax = extentini[2];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (extentini[3] > ymax) {\n\t\t\t\t\t\t\t\t\t\t\tymax = extentini[3];\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tvar extent = [xmin, ymin, xmax, ymax];\n\n\t\t\t\t\t\t\t\t\tmap.getView().fit(extent, {padding: [170, 50, 30, 150], constrainResolution: false});\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}]\n\t\t\t\t\t\t}]\n\t\t\t\t\t},{\n\t\t\t\t\t xtype: 'combobox',\n\t\t\t\t\t name: 'ComboPredio',\n\t\t\t\t\t id: 'ComboPredio',\n\t\t\t\t \t fieldLabel: 'Selecciona el Predio',\n\t\t\t\t\t labelAlign: 'top',\n\t\t\t\t margin:'0 0 10 0',\n\t\t\t\t\t msgTarget: 'under',\n\t\t\t\t\t disabled: true,\n\t\t\t\t width: '100%',\n\t\t\t\t\t store: Ext.create('Ext.data.Store', {\n\t\t\t\t\t\t\tid: 'storeLocPredio',\n\t\t\t\t\t\t\tmodel: 'modelLocPredio',\n\t\t\t\t\t\t\tautoLoad: false,\n\t\t\t\t\t\t\tproxy: {\n\t\t\t\t\t\t\t\ttype: 'ajax',\n\t\t\t\t\t\t\t\turl: 'proxy.jsp?' + WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPorNumPredial,\n\t\t\t\t\t\t\t\treader: {\n\t\t\t\t\t\t\t\t\ttype: 'json',\n\t\t\t\t\t\t\t\t\trootProperty: 'features'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t }),\n\t\t\t\t\t displayField: 'idPredio',\n\t\t\t\t\t valueField: 'idPredio',\n\t\t\t\t\t triggerAction: \"all\",\n\t\t\t\t\t queryMode: 'local',\n\t\t\t\t\t typeAhead: true,\n\t\t\t\t\t editable: true,\n\t\t\t\t\t listeners:{\n\t\t\t\t\t\tbeforequery: function (record) {\n\t\t\t\t\t\t\trecord.query = new RegExp(record.query, 'i');\n\t\t\t\t\t\t\trecord.forceAll = true;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tselect: function(thisCombo, record, eOpts){\n\t\t\t\t\t\t\tExt.getCmp('Buscar').setDisabled(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 xtype: 'fieldset',\n\t\t\t\t width: '100%',\n\t\t\t\t title: 'Búsqueda directa del identificador predial',\n\t\t\t\t columnWidth: 0.5,\n\t\t\t\t labelWidth: 75,\n\t\t\t\t labelAlign: 'top',\n\t\t\t\t msgTarget: 'under',\n\t\t\t\t items: [{\n\t\t\t\t xtype: 'textfield',\n\t\t\t\t name: 'Identificador',\n\t\t\t\t id: 'Identificador',\n\t\t\t\t margin:'0 0 10 0',\n\t\t\t\t fieldLabel: 'Escribe el identificador',\n\t\t\t\t labelAlign: 'top',\n\t\t\t\t msgTarget: 'under',\n\t\t\t\t width: '100%',\n\t\t\t\t allowBlank: true,\n\t\t\t\t listeners:{\n\t\t\t\t\tchange: function(thisField, newValue, oldValue, eOpts ){\n\t\t\t\t\t\tExt.getCmp('ComboDepartamento').setDisabled(true);\n\t\t\t\t\t\tExt.getCmp('Buscar').setDisabled(false);\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 \tlayout: 'column',\n\t\t\t\t\tmargin: '10 5 0 5',\n\t\t\t\t\tborder: false,\n\t\t\t\t\titems:[{\n\t\t\t\t\t\tcolumnWidth: '0.5',\n\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t},\n\t\t\t\t\t\titems:[{\n\t\t\t\t \t\txtype: 'button',\n\t\t\t\t\t\t\ttext: 'Buscar',\n\t\t\t\t\t\t\tid: 'Buscar',\n\t\t\t\t\t\t\tdisabled: true,\n\t\t\t\t\t\t\tlisteners: {\n\t\t\t\t\t\t\t\t click: function(thisbutton, e, eOpts){\n\t\t\t\t\t\t\t\t\t\t\tvar features;\n\t\t\t\t\t\t\t\t\t\t\tif(popup != \"\"){\n\t\t\t\t\t\t\t\t\t\t\t\t\tmap.removeOverlay(popup);\n\t\t\t\t\t\t\t\t\t\t\t\t\tpopup = \"\";\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tvar id = Ext.getCmp('Identificador').getValue();\n\t\t\t\t\t\t\t\t\t\t\tvar ID = Ext.getCmp('ComboPredio').getValue();\n\n\t\t\t\t\t\t\t\t\t\t\tif ((id == null || id == \"\") && (ID == null || ID == \"\")) {\n\t\t\t\t\t\t\t\t\t\t\t\tExt.Msg.alert('Advertencia', 'Por favor, seleccione o escriba un identificador', Ext.emptyFn);\n\t\t\t\t\t\t\t\t\t\t\t}else if (id == null || id == \"\"){\n\n\t\t\t\t\t\t\t\t\t\t\t\tcqlfilter = 'CQL_FILTER=departamento=' + \"'\" + Ext.getCmp('ComboDepartamento').getValue() + \"'%20AND%20\"+ 'municipio=' + \"'\" + Ext.getCmp('ComboMunicipio').getValue() + \"'%20AND%20\" + 'zona=' + \"'\" + Ext.getCmp('ComboZona').getValue() + \"'%20AND%20\" + 'sector=' + \"'\" + Ext.getCmp('ComboSector').getValue() + \"'%20AND%20\" + 'comuna=' + \"'\" + Ext.getCmp('ComboComuna').getValue() + \"'%20AND%20\" + 'barrio=' + \"'\" + Ext.getCmp('ComboBarrio').getValue() + \"'%20AND%20\" + 'manzana=' + \"'\" + Ext.getCmp('ComboManzana').getValue() + \"'%20AND%20\" + 'predio=' + \"'\" + Ext.getCmp('ComboPredio').getValue() + \"'\";\n\t\t\t\t\t\t\t\t\t\t\t\ttypeNameLayer = 'typeName=' + prefijo + ':' + capaElPredialesUnion;\n\n\t\t\t\t\t\t\t\t\t\t\t\tvar url = 'proxy.jsp?' + encodeURIComponent(WFS + request + '&' + service + '&' + version + '&' + typeNameLayer + '&' + cqlfilter + '&' + format + '&' + ordenarPorNumPredial);\n\n\t\t\t\t\t\t\t\t\t\t\t\tExt.Ajax.request({\n\t\t\t\t\t\t\t\t\t\t\t\t\turl: url,\n\t\t\t\t\t\t\t\t\t\t\t\t\tasync: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\t\t\t\t\t\t\t\tsuccess: function(response, opts) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfeatures = new ol.format.GeoJSON().readFeatures(response.responseText);\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\t\t\t\tvar xmin = features[0].getGeometry().getExtent()[0];\n\t\t\t\t \t\t\t\t\t\t \t\tvar ymin = features[0].getGeometry().getExtent()[1];\n\t\t\t\t \t\t\t\t\t\t \t\tvar xmax = features[0].getGeometry().getExtent()[2];\n\t\t\t\t \t\t\t\t\t\t \t\tvar ymax = features[0].getGeometry().getExtent()[3];\n\t\n\t\t\t\t \t\t\t\t\t\t \t\tvar fase = 0;\n\t\n\t\t\t\t \t\t\t\t\t\t \t\tvar arraytipos = [];\n\t\n\t\t\t\t \t\t\t\t\t\t \t\tfor (var i = 0; i < features.length; i++) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarraytipos.push(features[i].getProperties().tipopredio);\n\t\t\t\t \t\t\t\t\t\t \t\t}\n\n\t\t\t\t \t\t\t\t\t\t \t\tselect.getFeatures().clear();\n\t\t\t\t \t\t\t\t\t\t \t\tmap.addInteraction(select);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFeaturesSelect = select.getFeatures();\n\t\n\t\t\t\t \t\t\t\t\t\t \t\tif (arraytipos.includes(capaTerreno.replace(\"vw_\", \"\"))){\n\t\t\t \t\t\t\t\t\t \t\t\t\tfor (var i = 0; i < features.length; i++) {\n\t\t\t \t\t\t\t\t\t \t\t\t\t\tif (arraytipos.includes(capaTerreno.replace(\"vw_\", \"\")) && features[i].getProperties().tipopredio == capaTerreno.replace(\"vw_\", \"\")){\n\t\t\t\t\t \t\t\t\t\t\t \t\t\t\tfeatures[i].setProperties(Object.assign({'Tipo': nbTerreno}, features[i].getProperties()));\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFeaturesSelect.push(features[i]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar extent = features[i].getGeometry();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//map.getView().fit(extent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmap.getView().fit(extent, {padding: [170, 50, 30, 150], constrainResolution: false});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t \t\t\t\t\t\t \t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}else if (arraytipos.includes(capaConstruccion.replace(\"vw_\", \"\"))){\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < features.length; i++) {\n\t\t\t\t\t\t \t\t\t\t\t\t \t\tif (arraytipos.includes(capaConstruccion.replace(\"vw_\", \"\")) && features[i].getProperties().tipopredio == capaConstruccion.replace(\"vw_\", \"\")){\n\t\t\t\t\t\t\t \t\t\t\t\t\t \t\tfeatures[i].setProperties(Object.assign({'Tipo': nbConstruccion}, features[i].getProperties()));\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFeaturesSelect.push(features[i]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar extent = features[i].getGeometry();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//map.getView().fit(extent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmap.getView().fit(extent, {padding: [170, 50, 30, 150], constrainResolution: false});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t \t\t\t\t\t\t \t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}else if (arraytipos.includes(capaUnidad.replace(\"vw_\", \"\"))){\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < features.length; i++) {\n\t\t\t\t\t\t \t\t\t\t\t\t \t\tif (arraytipos.includes(capaUnidad.replace(\"vw_\", \"\")) && features[i].getProperties().tipopredio == capaUnidad.replace(\"vw_\", \"\")){\n\t\t\t\t\t\t\t \t\t\t\t\t\t \t\t\tfeatures[i].setProperties(Object.assign({'Tipo': nbUnion}, features[i].getProperties()));\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFeaturesSelect.push(features[i]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar extent = features[i].getGeometry();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//map.getView().fit(extent);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmap.getView().fit(extent, {padding: [170, 50, 30, 150], constrainResolution: false});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t \t\t\t\t\t\t \t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t}else if(ID == null || ID == \"\"){\n\t\t\t\t\t\t\t\t\t\t\t\tvar message = SelectElements(id);\n\t\t\t\t\t\t\t\t\t\t\t\tif(message == true){\n\t\t\t\t\t\t\t\t\t\t\t\t\tExt.Msg.alert('Advertencia', 'El identificador ' + id + ' no existe ', Ext.emptyFn);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t \t}]\n\t\t\t\t \t \t},{ \n\t\t\t\t \t \t\tcolumnWidth: '0.5',\n\t\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\titems:[{\n\t\t\t\t \t\t\txtype: 'button',\n\t\t\t\t\t\t\t\ttext: 'Borrar',\n\t\t\t\t\t\t\t\tlisteners: {\n\t\t\t\t\t\t\t\t\tclick: function(thisbutton, e, eOpts){\n\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('Identificador').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('Identificador').setDisabled(false);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboDepartamento').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboDepartamento').setDisabled(false);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('btncentrardep').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboMunicipio').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboMunicipio').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('btncentrarmun').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboZona').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboZona').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboSector').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboSector').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('btncentrarsec').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboComuna').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboComuna').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('btncentrarcom').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboBarrio').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboBarrio').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('btncentrarbarr').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboManzana').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboManzana').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('btncentrarman').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboPredio').setValue(\"\");\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('ComboPredio').setDisabled(true);\n\t\t\t\t\t\t\t\t\t\tExt.getCmp('Buscar').setDisabled(true);\n\n\t\t\t\t\t\t\t\t\t\tselect.getFeatures().clear();\n\t\t\t\t\t\t\t\t\t\tmap.removeInteraction(select);\n\t\t\t\t\t\t\t\t\t\tif(popup != \"\"){\n\t\t\t\t\t\t\t\t\t\t\tmap.removeOverlay(popup);\n\t\t\t\t\t\t\t\t\t\t\tpopup = \"\";\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tmap.removeInteraction(draw);\n\t\t\t\t\t\t\t\t\t\tmap.removeInteraction(measure);\n\t\t\t\t\t\t\t\t\t\tlayerMeasure.getSource().clear();\n\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t \t\t}\n\t\t\t\t \t}]\n\t\t\t\t\t}]\n\t\t\t }\n\t\t ]\n\t\t\t }]\n\t \t },{\n\t\t\ttitle: 'Medición',\n\t\t\twidth: '100%',\n\t\t\tborder : true,\n\t\t\titems:[{\n\t\t\t\t\txtype: 'form',\n\t\t\t\t\tid: 'MedForm',\n\t\t\t\t\tborder: false,\n\t\t\t\t\titems:[{\n\t\t\t\t\t\tlayout: 'column',\n\t\t\t\t\t\tmargin: '10 5 0 5',\n\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\tcolumnWidth: '0.5',\n\t\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\t\txtype: 'button',\n\t\t\t\t\t\t\t\ttext: 'Área',\n\t\t\t\t\t\t\t\ticonCls: 'icoMedirArea',\n\t\t\t\t\t\t\t\tcls: 'btnAniadirWMS',\n\t\t\t\t\t\t\t\twidth: 110,\n\t\t\t\t\t\t\t\thandler: function() {\n\n\t\t\t\t\t\t\t\t\tExt.getBody().setStyle(\"cursor\", \"default\");\n\t\t\t\t\t\t\t\t\tol.Observable.unByKey(eventMapSingleClick);\n\n\t\t\t\t\t\t\t\t\tif (Ext.getStore('storeMeasureUnid').count() > 0)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tExt.getStore('storeMeasureUnid').removeAll();\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tExt.getCmp('comboMeasureUnid').clearValue();\n\t\t\t\t\t\t\t\t\tExt.getStore('storeMeasureUnid').filter('tipo', 1);\n\t\t\t\t\t\t\t\t\tExt.getCmp('comboMeasureUnid').select(Ext.getStore('storeMeasureUnid').getAt(0));\n\n\t\t\t\t\t\t\t\t\tlayerMeasure.getSource().clear();\n\t\t\t\t\t\t\t\t\tol.Observable.unByKey(eventpointermove);\n\t\t\t\t\t\t\t\t\tif (helpTooltipElement) {\n\t\t\t\t\t\t\t\t\t\thelpTooltipElement.innerHTML = '';\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tExt.getCmp('lblMeasureResult').setText('', false);\n\n\t\t\t\t\t\t\t\t\teventpointermove = map.on('pointermove', pointerMoveHandler);\n\t\t\t\t\t\t\t\t\tmap.removeInteraction(draw);\n\t\t\t\t\t\t\t\t\tmap.removeInteraction(measure);\n\t\t\t\t\t\t\t\t\tselect.getFeatures().clear();\n\t\t\t\t\t\t\t\t\tmap.removeInteraction(select);\n\t\t\t\t\t\t\t\t\tif(popup != \"\"){\n\t\t\t\t\t\t\t\t\t\tmap.removeOverlay(popup);\n\t\t\t\t\t\t\t\t\t\tpopup = \"\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taddInteraction('area');\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t},{\n\t\t\t\t\t\t\tcolumnWidth: '0.5',\n\t\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\t\txtype: 'button',\n\t\t\t\t\t\t\t\ttext: 'Distancia',\n\t\t\t\t\t\t\t\ticonCls: 'icoMedirDistancia',\n\t\t\t\t\t\t\t\tcls: 'btnAniadirWMS',\n\t\t\t\t\t\t\t\twidth: 110,\n\t\t\t\t\t\t\t\thandler: function() {\n\n\t\t\t\t\t\t\t\t\tExt.getBody().setStyle(\"cursor\", \"default\");\n\t\t\t\t\t\t\t\t\tol.Observable.unByKey(eventMapSingleClick);\n\n\t\t\t\t\t\t\t\t\tExt.getCmp('comboMeasureUnid').clearValue();\n\t\t\t\t\t\t\t\t\tExt.getStore('storeMeasureUnid').filter('tipo', 2);\n\t\t\t\t\t\t\t\t\tExt.getCmp('comboMeasureUnid').select(Ext.getStore('storeMeasureUnid').getAt(0));\n\n\t\t\t\t\t\t\t\t\tlayerMeasure.getSource().clear();\n\t\t\t\t\t\t\t\t\tol.Observable.unByKey(eventpointermove);\n\t\t\t\t\t\t\t\t\tif (helpTooltipElement) {\n\t\t\t\t\t\t\t\t\t\thelpTooltipElement.innerHTML = '';\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tExt.getCmp('lblMeasureResult').setText('', false);\n\n\t\t\t\t\t\t\t\t\teventpointermove = map.on('pointermove', pointerMoveHandler);\n\t\t\t\t\t\t\t\t\tmap.removeInteraction(draw);\n\t\t\t\t\t\t\t\t\tmap.removeInteraction(measure);\n\t\t\t\t\t\t\t\t\tselect.getFeatures().clear();\n\t\t\t\t\t\t\t\t\tmap.removeInteraction(select);\n\t\t\t\t\t\t\t\t\tif(popup != \"\"){\n\t\t\t\t\t\t\t\t\t\tmap.removeOverlay(popup);\n\t\t\t\t\t\t\t\t\t\tpopup = \"\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taddInteraction('length');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t}]\n\t\t\t\t\t},{\n\t\t\t\t\t\tlayout: 'column',\n\t\t\t\t\t\tmargin: '10 5 0 5',\n\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\tcolumnWidth: '1',\n\t\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\t\txtype: 'combo',\n\t\t\t\t\t\t\t\tid: 'comboMeasureUnid',\n\t\t\t\t\t\t\t\tmargin: '5 5 0 5',\n\t\t\t\t\t\t\t\tfieldLabel: 'Unidades',\n\t\t\t\t\t\t\t\tvalueField: 'uni',\n\t\t\t\t\t\t\t\tdisplayField: \"unidad\",\n\t\t\t\t\t\t\t\tlabelWidth: 60,\n\t\t\t\t\t\t\t\twidth: 310,\n\t\t\t\t\t\t\t\tstore: Ext.create('Ext.data.Store', {\n\t\t\t\t\t\t\t\t\tid: 'storeMeasureUnid',\n\t\t\t\t\t\t\t\t\tfields: ['uni', 'unidad', 'tipo'],\n\t\t\t\t\t\t\t\t\tdata : [\n\t\t\t\t\t\t\t\t\t\t\t{uni: 'ha', unidad: 'Hectáreas', tipo: 1},\n\t\t\t\t\t\t\t\t\t\t\t{uni: 'km2', unidad: 'Kilómetros cuadrados', tipo: 1},\n\t\t\t\t\t\t\t\t\t\t\t{uni: 'm2', unidad: 'Metros cuadrados', tipo: 1},\n\t\t\t\t\t\t\t\t\t\t\t{uni: 'km', unidad: 'Kilómetros', tipo: 2},\n\t\t\t\t\t\t\t\t\t\t\t{uni: 'm', unidad: 'Metros', tipo: 2}\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\tfilters: [{\n\t\t\t\t\t\t\t\t\t\tproperty: 'tipo',\n\t\t\t\t\t\t\t\t\t\tvalue: 0\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\tlisteners:{\n\t\t\t\t\t\t\t\t\tselect: function (thisCombo, record, eOpts)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvar length;\n\t\t\t\t\t\t\t\t\t\tvar area;\n\n\t\t\t\t\t\t\t\t\t\tif (layerMeasure.getSource().getFeatures().length > 0)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tvar geom = layerMeasure.getSource().getFeatures()[0].getGeometry();\n\n\t\t\t\t\t\t\t\t\t\t\tif (geom instanceof ol.geom.Polygon) {\n\t\t\t\t\t\t\t\t\t\t\t\tarea = geom.getArea();\n\t\t\t\t\t\t\t\t\t\t\t} else if (geom instanceof ol.geom.LineString) {\n\t\t\t\t\t\t\t\t\t\t\t \tlength = Math.round(geom.getLength() * 100) / 100;\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\tvar output;\n\t\t\t\t\t\t\t\t\t\t \tif (thisCombo.getValue() == 'km2')\n\t\t\t\t\t\t\t\t\t\t \t{\n\t\t\t\t\t\t\t\t\t\t \t\toutput = 'Área: ' + (Math.round(area / 1000000 * 100) / 100).toFixed(2) + ' ' + 'Km<sup>2</sup>';\n\t\t\t\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t\t\t\t\t \telse if (thisCombo.getValue() == 'ha')\n\t\t\t\t\t\t\t\t\t\t \t{\n\t\t\t\t\t\t\t\t\t\t \t\toutput = 'Área: ' + (Math.round(area * 100) / 100 / 10000).toFixed(2) + ' ' + 'ha';\n\t\t\t\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t\t\t\t\t \telse if (thisCombo.getValue() == 'm2')\n\t\t\t\t\t\t\t\t\t\t \t{\n\t\t\t\t\t\t\t\t\t\t \t\toutput = 'Área: ' + (Math.round(area * 100) / 100).toFixed(2) + ' ' + 'm<sup>2</sup>';\n\t\t\t\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t\t\t\t\t \telse if (Ext.getCmp('comboMeasureUnid').getValue() == 'km')\n\t\t\t\t\t\t\t\t\t\t \t{\n\t\t\t\t\t\t\t\t\t\t \t\toutput = 'Distancia: ' + (Math.round(length / 1000 * 100) / 100).toFixed(2) + ' ' + 'km';\n\t\t\t\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t\t\t\t\t \telse if (Ext.getCmp('comboMeasureUnid').getValue() == 'm') {\n\t\t\t\t\t\t\t\t\t\t \t\toutput = 'Distancia: ' + (Math.round(length * 100) / 100).toFixed(2) + ' ' + 'm';\n\t\t\t\t\t\t\t\t\t\t \t}\n\t\t\t\t\t\t\t\t\t\t \tExt.getCmp('lblMeasureResult').setText(output, false);\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t}]\n\t\t\t\t\t},{\n\t\t\t\t\t\tlayout: 'column',\n\t\t\t\t\t\tmargin: '20 5 0 5',\n\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\tcolumnWidth: '0.8',\n\t\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\t\titems:[{\n\t\t\t\t\t \txtype: 'label',\n\t\t\t\t\t \tid: 'lblMeasureResult',\n\t\t\t\t\t \tcls: 'labelMeasureResult',\n\t\t\t\t\t \thtml: '',\n\t\t\t\t\t \tmargin: '5 5 0 5'\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t},{\n\t\t\t\t\t\t\tcolumnWidth: '0.2',\n\t\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\t\txtype: 'button',\n\t\t\t\t\t\t text: 'Borrar',\n\t\t\t\t\t\t\t\tlisteners: {\n\t\t\t\t\t\t\t\t\tclick: function(thisbutton, e, eOpts) {\n\n\t\t\t\t\t\t\t\t\t\t\tif (helpTooltipElement) {\n\t\t\t\t\t\t\t\t\t\t\t\thelpTooltipElement.innerHTML = '';\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tol.Observable.unByKey(eventpointermove);\n\t\t\t\t\t\t\t\t\t\t\tmap.removeInteraction(measure);\n\t\t\t\t\t\t\t\t\t\t\tlayerMeasure.getSource().clear();\n\n\t\t\t\t\t\t\t\t\t\t\tExt.getCmp('lblMeasureResult').setText('', false);\n\t\t\t\t\t\t\t\t\t\t\tExt.getStore('storeMeasureUnid').filter('tipo', 0);\n\t\t\t\t\t\t\t\t\t\t\tExt.getCmp('comboMeasureUnid').select(null);\n\n\t\t\t\t\t\t\t\t\t\t\teventpointermove = map.on('pointermove', pointermoveIdentificar);\n\t\t\t\t\t\t\t\t\t\t\teventMapSingleClick = map.on('singleclick', singleclickIdentificar);\n\t\t\t\t\t\t\t\t\t\t\tmap.removeOverlay(helpTooltip);\n\t\t\t\t\t\t\t\t\t\t\tmap.removeOverlay(measureTooltip);\n\n\t\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}]\n\t\t\t\t\t}]\n\t\t\t\t}]\n\t\t\t},{\n\t\t\t\ttitle: 'Impresión',\n\t\t\t\twidth: '100%',\n\t\t\t\tborder : true,\n\t\t\t\titems:[{\n\t\t\t\t\txtype: 'form',\n\t\t\t\t\tid: 'ImpForm',\n\t\t\t\t\tborder: false,\n\t\t\t\t\titems: [{\n\t\t \t\txtype: 'fieldset',\n\t\t\t \twidth: '100%',\n\t\t\t \ttitle: 'PDF',\n\t\t\t \tcolumnWidth: 0.5,\n\t\t\t \tlabelWidth: 75,\n\t\t\t\t\tmargin: '10 10 0 10',\n\t \t\t\tlabelAlign: 'top',\n\t\t\t\t\tmsgTarget: 'under',\n\t\t\t\t\tlayout: 'anchor',\n\t\t\t\t\tdefaults: {\n\t\t\t\t\t\tlayout: '100%'\n\t\t\t\t\t},\n\t\t\t\t\tdefaultType: 'combobox',\n\t\t\t\t\titems: [{\n\t\t\t \t\txtype: 'combobox',\n\t\t\t \t\tid: 'combosize',\n\t\t\t \t\tfieldLabel: 'Tamaño de página',\n\t\t\t\t\t\tlabelAlign: 'top',\n\t\t\t\t\t\tmsgTarget: 'under',\n\t\t\t\t\t\tmargin: '0 0 10 0',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\tflex: 1,\n\t\t\t\t\t \tqueryMode: 'local',\n\t\t\t\t\t \tdisplayField: 'name',\n\t\t\t\t\t \t valueField: 'value',\n\t\t\t\t\t \t store: Ext.create('Ext.data.Store', {\n\t\t\t\t\t\t\tfields: ['name', 'value'],\n\t\t\t\t\t\t\tdata : [\n\t\t\t\t\t\t\t\t{\"name\":\"A3\", 'value': 'a3'},\n\t\t\t\t\t\t\t\t{\"name\":\"A4\", 'value': 'a4'}\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\tlayout: 'column',\n\t\t\t\t\tmargin: '10 5 0 5',\n\t\t\t\t\tborder: false,\n\t\t\t\t\titems:[{\n\t\t\t\t\t\tcolumnWidth: '1.755',\n\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t},\n\t\t\t\t\t\titems:[{\n\t\t\t\t\t\t\txtype: 'button',\n\t\t \t\t\t\ttext: 'Imprimir',\n\t\t\t\t\t\t\tid: 'imprimir',\n\t\t\t\t\t\t\tlisteners: {\n\t\t\t\t\t\t\t\tclick: function(){\n\n\t\t\t\t\t\t\t\t\tvar format = Ext.getCmp('combosize').value;\n\t\t\t\t\t\t\t\t\tvar resolution = '72';\n\n\t\t\t\t\t\t\t\t\tvar myMask = new Ext.LoadMask({\n\t\t\t\t\t\t\t\t\t\t msg : \"Imprimiendo...\",\n\t\t\t\t\t\t\t\t\t\t target : Ext.getCmp(\"ImpForm\")\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\tif (format == null && resolution == null){\n\t\t\t\t\t\t\t\t\t\tExt.Msg.alert('Advertencia', 'Por favor, selecione un tamaño de página y una resolución', Ext.emptyFn);\n\t\t\t\t\t\t\t\t\t}else if (format == null){\n\t\t\t\t\t\t\t\t\t\tExt.Msg.alert('Advertencia', 'Por favor, selecione un tamaño de página', Ext.emptyFn);\n\t\t\t\t\t\t\t\t\t}else if (resolution == null){\n\t\t\t\t\t\t\t\t\t\tExt.Msg.alert('Advertencia', 'Por favor, selecione una resolución', Ext.emptyFn);\n\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t print(format, resolution, myMask);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t \t\t}]\n\t\t\t\t\t}]\n\t\t\t\t\t}]\n\t\t \t\t}]\n\t\t\t},{\n\t\t\t\ttitle: 'Dibujar',\n\t\t\t\twidth: '100%',\n\t\t\t\tborder : true,\n\t\t\t\titems:[{\n\t\t\t\t\txtype: 'form',\n\t\t\t\t\tid: 'DrawForm',\n\t\t\t\t\tborder: false,\n\t\t\t\t\titems: [{\n\t\t\t \txtype: 'fieldset',\n\t\t\t\t width: '100%',\n\t\t\t\t columnWidth: 0.5,\n\t\t\t\t\tmargin: '10 10 0 10',\n\t\t\t \tlabelWidth: 75,\n\t\t\t \tlabelAlign: 'top',\n\t\t\t\t\tmsgTarget: 'under',\n\t\t\t \titems: [{\n\t\t\t\t \txtype: 'combobox',\n\t\t\t\t \tid: 'combodraw',\n\t\t\t\t \tfieldLabel: 'Tipo de geometría',\n\t\t\t\t\t\tlabelAlign: 'top',\n\t\t\t\t\t\tmsgTarget: 'under',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\tmargin: '0 0 10 0',\n\t\t\t\t\t\tflex: 1,\n\t\t\t\t\t\tqueryMode: 'local',\n\t\t\t\t\t\tdisplayField: 'name',\n\t\t\t\t\t\tvalueField: 'value',\n\t\t\t\t\t\tstore: Ext.create('Ext.data.Store', {\n\t\t\t\t \t fields: ['name', 'value'],\n\t\t\t\t \t data : [\n\t\t\t\t \t {\"name\":\"Punto\", \"value\": 'Point'},\n\t\t\t\t \t {\"name\":\"Línea\", \"value\": 'LineString'},\n\t\t\t\t \t {\"name\":\"Polígono\", \"value\": 'Polygon'},\n\t\t\t\t \t {\"name\":\"Círculo\", \"value\": 'Circle'}\n\t\t\t\t \t ]\n\t\t\t\t \t})\n\t\t \t\t},{\n\t\t\t\t\t\txtype: 'label',\n\t\t\t\t\t\tforId: 'myFieldId',\n\t\t\t\t\t\ttext: 'Selección del color',\n\t\t\t\t\t\tmargin: '10 0 0 0'\n\t\t\t\t \t},{\n\t\t \t\t\txtype: 'colorpicker',\n\t\t \t\t\tid: 'colorpicker',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\tmargin: '5 0 0 0'\n\t\t\t\t \t}]\n\t\t\t\t},{\n\t\t\t\t\t layout: 'column',\n\t\t\t\t\t margin: '10 5 0 5',\n\t\t\t\t\t border: false,\n\t\t\t\t\t items:[{\n\t\t\t\t\t\tcolumnWidth: '0.5',\n\t\t\t\t\t\tborder: false,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t\t},\n\t\t\t\t\t\titems:[{\n\t\t\t\t\txtype: 'button',\n\t\t\t\t\ttext: 'Dibujar',\n\t\t\t\t\tid: 'dibujar',\n\t\t\t\t\tlisteners: {\n\t\t\t\t\t\tclick: function(){\n\n\t\t\t\t\t\t\tvar typeSelect = Ext.getCmp('combodraw').getValue();\n\t\t\t\t\t\t\tExt.getBody().setStyle(\"cursor\", \"default\");\n\t\t\t\t\t\t\tol.Observable.unByKey(eventMapSingleClick);\n\n\t\t\t\t\t\t\tol.Observable.unByKey(eventpointermove);\n\n\t\t\t\t\t\t\tvar value = Ext.getCmp('colorpicker').getValue();\n\n\t\t\t\t\t\t\tif (value == null && typeSelect == null){\n\t\t\t\t\t\t\t\tExt.Msg.alert('Advertencia', 'Por favor, selecione un tipo de geometría y un color', Ext.emptyFn);\n\t\t\t\t\t\t\t}else if (value == null){\n\t\t\t\t\t\t\t\tExt.Msg.alert('Advertencia', 'Por favor, selecione un color', Ext.emptyFn);\n\t\t\t\t\t\t\t}else if (typeSelect == null){\n\t\t\t\t\t\t\t\tExt.Msg.alert('Advertencia', 'Por favor, selecione un tipo de geometría', Ext.emptyFn);\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tvar a = \"#\";\n\n\t\t\t\t\t\t\t\tvar position = 0;\n\n\t\t\t\t\t\t\t\tcolor = [value.slice(0, position), a, value.slice(position)].join('');\n\n\t\t\t\t\t\t\t\tmap.removeInteraction(draw);\n\t\t\t\t\t\t\t\tmap.removeInteraction(measure);\n\t\t\t\t\t\t\t\tselect.getFeatures().clear();\n\t\t\t\t\t\t\t\tmap.removeInteraction(select);\n\n\t\t\t\t\t\t\t\tif(popup != \"\"){\n\t\t\t\t\t\t\t\t\tmap.removeOverlay(popup);\n\t\t\t\t\t\t\t\t\tpopup = \"\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taddInteractionDraw(typeSelect);\n\n\t\t\t\t\t\t\t\tlayerDraw.setStyle(new ol.style.Style({\n\n\t\t\t\t\t\t\t\t stroke: new ol.style.Stroke({\n\t\t\t\t\t\t\t\t color: color,\n\t\t\t\t\t\t\t\t width: 2\n\t\t\t\t\t\t\t\t }),\n\t\t\t\t\t\t\t\t image: new ol.style.Circle({\n\t\t\t\t\t\t\t\t radius: 7,\n\t\t\t\t\t\t\t\t fill: new ol.style.Fill({\n\t\t\t\t\t\t\t\t\tcolor: color\n\t\t\t\t\t\t\t\t })\n\t\t\t\t\t\t\t\t })\n\t\t\t\t\t\t\t\t}))\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t }]\n\t\t\t\t},{ \n\t\t\t\t\tcolumnWidth: '0.5',\n\t\t\t\t\tborder: false,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t type: 'vbox',\n\t\t\t\t\t\t align: 'center'\n\t\t\t\t\t},\n\t\t\t\t\titems:[{\n\t\t\t \t\txtype: 'button',\n\t\t\t \t\ttext: 'Borrar',\n\t\t\t\t\t\tlisteners: {\n\t\t\t\t\t\t\tclick: function(thisbutton, e, eOpts) {\n\n\t\t\t\t\t\t\t\tol.Observable.unByKey(eventpointermove);\n\t\t\t\t\t\t\t\tmap.removeInteraction(draw);\n\t\t\t\t\t\t\t\tlayerDraw.getSource().clear();\n\n\t\t\t\t\t\t\t\teventpointermove = map.on('pointermove', pointermoveIdentificar);\n\t\t\t\t\t\t\t\teventMapSingleClick = map.on('singleclick', singleclickIdentificar);\n\t\t\t\t\t\t\t\tmap.removeOverlay(helpTooltip);\n\t\t\t\t\t\t\t\tmap.removeOverlay(measureTooltip);\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t }\n\t\t\t\t\t }]\n\t\t\t\t }]\n\t\t\t\t}]\n\t\t\t }]\n\t\t\t}]\n\t\t}],\n\t\tlisteners:{\n\t\t\texpand: function (p, eOpts)\n\t\t\t{\n\t\t\t\tvar altoTree = p.getHeight() - 110;\n\t\t\t\tExt.getCmp('treepanelLayers').setHeight(altoTree);\n\t\t\t\tExt.getCmp('LocForm').setHeight(altoTree);\n\t\t\t\tExt.getCmp('MedForm').setHeight(altoTree);\n\t\t\t\tExt.getCmp('ImpForm').setHeight(altoTree);\n\t\t\t\tExt.getCmp('DrawForm').setHeight(altoTree);\n\n\t\t\t},\n\t\t\tresize: function (thisPanel, width, height, oldWidth, oldHeight, eOpts)\n\t\t\t{\n\t\t\t\tvar altoTree = thisPanel.getHeight() - 110;\n\t\t\t\tExt.getCmp('treepanelLayers').setHeight(altoTree);\n\t\t\t\tExt.getCmp('LocForm').setHeight(altoTree);\n\t\t\t\tExt.getCmp('MedForm').setHeight(altoTree);\n\t\t\t\tExt.getCmp('ImpForm').setHeight(altoTree);\n\t\t\t\tExt.getCmp('DrawForm').setHeight(altoTree);\n\t\t\t}\n\t\t},\n\t\tbuttons: ['->',{\n\t\t\ttext: \"Buscar por topónimos\",\n\t\t\ticonCls: 'icoLocalizar',\n\t\t\tcls: 'btnLocalizar',\n\t\t\tlisteners: {\n\t\t\t\tclick: function (){\n\n\t\t\t\t\tvar controls = map.getControls().getArray();\n\t\t\t\t\tif (controls.length > 5){\n\t\t\t\t\t\tmap.removeControl(geocoder);\n\t\t\t\t\t\tgeocoder.getSource().clear();\n\t\t\t\t\t\tmap.removeLayer(layergeocoder);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tmap.addControl(geocoder);\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},{\n\t\t\ttext: \"Añadir WMS/WMTS\",\n\t\t\ticonCls: 'icoAniadirWMS',\n\t\t\tcls: 'btnAniadirWMS',\n\t\t\thandler: function(){\n\t\t\t\tcreateWindowServices();\n\t\t\t}\n\t\t}]\n\t});\n\n\tExt.getCmp('treepanelLayers').getRootNode().getChildAt(1).expand();\n\tExt.getCmp('treepanelLayers').getRootNode().getChildAt(3).expand();\n\tExt.getCmp('treepanelLayers').getRootNode().getChildAt(6).expand();\n\tExt.getCmp('treepanelLayers').getRootNode().getChildAt(4).set('checked',false);\n\tExt.getCmp('treepanelLayers').getRootNode().getChildAt(5).set('checked',false);\n\n\treturn myPanelLeft;\n}", "function AddPanel(factorSelections){\r\n this.stage = [];\r\n this.current = -1;\r\n this.factorSelections = factorSelections || [];\r\n this.isGroup = true;\r\n}", "function PanelCreation(color,name,reading){\n numPanel+=1;\n if(name==undefined){\n name=$(\"#namep\").val() || $(\"#namep\").attr(\"placeholder\")\n\n }\n \n if(color==undefined){\n color=$(\"#colorp\").val() || $(\"#colorp\").attr(\"placeholder\")\n }\n if(reading==undefined){\n reading={\n \"scm\":\"scm\",\n \"its\":\"its\",\n \"mls\":\"mls\",\n \"scr\":\"scr\",\n \"irc\":\"irc\"\n };\n }\n\n var panel= new Panel(numPanel,color,name,reading)\n\n $(\"#panelConten\").html(\"\")\n $(\"#panelMaker\").slideUp()\n\n panels.push(panel)\n $(\".container-fluid\").append(panel.getContent())\n $(\".gridster ul\").gridster({\n widget_margins: [6, 6],\n widget_base_dimensions: [20, 20],\n serialize_params: function($w, wgd) { \n return { \n id: $($w).attr('id'), \n col: wgd.col, \n row: wgd.row, \n size_x: wgd.size_x, \n size_y: wgd.size_y \n };\n }\n }).data('gridster');\n if(actualPanel==0){\n $(\"#panels\").append('<li onclick=\"showPanel('+numPanel+')\"><a href=\"javascript:;\" data-toggle=\"collapse\" data-target=\"#scrollPanel'+numPanel+'\"><i id=\"actived'+numPanel+'\"><i class=\"fa fa-fw fa-edit\"></i></i></i><i id=\"scrollPanelName'+numPanel+'\"> '+panel.name+' </i><i class=\"fa fa-fw fa-caret-down\"></i></a><ul id=\"scrollPanel'+numPanel+'\" class=\"collapse\"><li><a onclick=\"showSettings('+numPanel+')\" href=\"javascript:void(0)\">Add Graph</a></li><li><a onclick=\"deleteAllWidgets('+numPanel+')\" href=\"javascript:void(0)\">Delete all</a></li><li><a onclick=\"CompaniesSettings('+numPanel+')\" href=\"javascript:void(0)\">Companies</a></li><li><a onclick=\"PanelSettings('+numPanel+')\" href=\"javascript:void(0)\">Settings</a></li></ul></li>')\n $(\"#activedPanel\").html(panel.name)\n\n }else{\n $(\"#panels\").append('<li onclick=\"showPanel('+numPanel+')\"><a href=\"javascript:;\" data-toggle=\"collapse\" data-target=\"#scrollPanel'+numPanel+'\"><i id=\"actived'+numPanel+'\"></i></i><i id=\"scrollPanelName'+numPanel+'\"> '+panel.name+' </i><i class=\"fa fa-fw fa-caret-down\"></i></a><ul id=\"scrollPanel'+numPanel+'\" class=\"collapse\"><li><a onclick=\"showSettings('+numPanel+')\" href=\"javascript:void(0)\">Add Graph</a></li><li><a onclick=\"deleteAllWidgets('+numPanel+')\" href=\"javascript:void(0)\">Delete all</a></li><li><a onclick=\"CompaniesSettings('+numPanel+')\" href=\"javascript:void(0)\">Companies</a></li><li><a onclick=\"PanelSettings('+numPanel+')\" href=\"javascript:void(0)\">Settings</a></li></ul></li>')\n\n }\n if(actualPanel==0){\n actualPanel=1;\n }\n}", "function panels (weight = 80, widht = windowWidth , paint = true, angle = 45 , rectan = 1) {\r\n\tthis.weightt = weight;\r\n\tthis.widthh = widht;\r\n\tthis.painter = paint;\r\n\tthis.anglee = angle;\r\n\tthis.rectShape = rectan;\r\n\tthis.panel = true;\r\n\tthis.matrix = [];\r\n\tthis.colored;\r\n\r\n//fundamenal dimensiones, stroke/color, tr\r\n\t\r\n\tthis.stand = function() {\r\n\t\tfor(let i = this.weightt; i <= this.widthh; i+= 2*this.weightt) {\r\n\t\t\tthis.matrix.push([i*this.rectShape,i,color(0)]);\r\n\t\t}\r\n\t}\r\n\r\n\tthis.moveLight = function(){\r\n\t\t\r\n\t}\r\n\r\n\tthis.draw = function() {\r\n\t\tif (this.panel){\r\n\t\t\tpush();\r\n\t\t\trotate(this.anglee);\r\n\t\t\tnoFill();\r\n\t\t\tstrokeWeight(this.weightt);\r\n\t\t\trectMode(CENTER);\r\n\t\t\tscale(1);\r\n\t\t\tvar shades = 0;\r\n\t\t\tfor(let i = 0; i < this.matrix.length; i++){\r\n\t\t\t\tif (this.painter == true){ \r\n\t\t\t\t\tstroke(this.matrix[0][2]);\r\n\t\t\t\t\t//stroke(color(shades/5,shades*13,shades*19));\r\n\t\t\t\t\t//shades++;\r\n\t\t\t\t}\r\n\t\t\t\telse noStroke();\r\n\t\t\t\trect(0,0,this.matrix[i][0],this.matrix[i][1]);\t\r\n\t\t\t\tthis.painter = !this.painter;\r\n\t\t\t}\r\n\t\t\tpop();\r\n\t\t\t//if (frameCount%10== 0 || frameCount%1001 == 0) pain = !pain\r\n\t\t}\r\n\t}\r\n\t\r\n}", "function updatePanel() {\n var panelDiv = document.getElementById(\"panel\");\n panelDiv.style.textAlign = \"center\";\n // title\n var titleElement = document.createElement(\"h2\");\n titleElement.innerText = title;\n panelDiv.appendChild(titleElement);\n // description\n var descriptionElement = document.createElement(\"div\");\n descriptionElement.style.paddingBottom = \"10px\";\n descriptionElement.innerText = appDescription;\n panelDiv.appendChild(descriptionElement);\n // attribute field select\n var selectElement = createSelect(variables);\n panelDiv.appendChild(selectElement);\n view.ui.add(panelDiv, \"bottom-left\");\n selectElement.addEventListener(\"change\", selectVariable);\n // generate the renderer for the first selected attribute\n selectVariable();\n }", "renderPanel() {\n this.element.innerHTML = template({\n baseLayers: this.manager.baseLayers,\n overlayLayers: this.manager.overlayLayers,\n });\n\n this.button = this.element.getElementsByClassName('panel-switcher')[0];\n this.panel = this.element.getElementsByClassName('panel')[0];\n\n const inputs = this.element.getElementsByTagName('input');\n for (let i = 0; i < inputs.length; i += 1) {\n inputs[i].addEventListener('change', (event) => {\n this.dispatchEvent('layerChanged');\n this.setVisible(this.manager.getLayerById(event.target.id), event.target.checked);\n }, false);\n }\n\n this.button.addEventListener('click', () => {\n if (window.getComputedStyle(this.panel).display === 'none') {\n this.panel.style.display = 'block';\n return;\n }\n this.panel.style.display = 'none';\n });\n }", "function makeDataPanel() {\n var dataPanel,\n panelProperties = new Ext.Panel({\n region: 'north',\n height: 30,\n cls: 'properties-panel',\n html: '<div class=\"properties\">'\n + '<div class=\"left\"><p class=\"label\"><label for=\"speed\">Facteur de vitesse(kme/h) : </label></p><p><input id=\"speed\" class=\"speed\" type=\"number\" name=\"speed\" value=\"4\" /></p></div>'\n + '<div class=\"right\" style=\"display:none;\"><p class=\"label\"><label for=\"maps\">Cartes topographiques : </label></p><p><input id=\"maps\" type=\"text\" name=\"maps\" /></p></div>'\n + '</div>'\n });\n\n this.tabPanel = this.makeGridsTabPanel();\n\n dataPanel = new Ext.Panel({\n title: 'Informations',\n layout: 'border',\n region: 'south',\n height: 300,\n split: true,\n cls: 'data-panel',\n items: [\n panelProperties,\n this.tabPanel,\n this.makeFooter()\n ]\n });\n\n return dataPanel;\n}", "function openPanel(msg){\t \t \r\n var bot = $('iframe#canvas_frame', parent.document).contents().find('div.J-Zh-I.J-J5-Ji.bot'); //get the button recentily created\r\n\t\t if(bot.is('*')){\r\n\t\t\t\tbot.remove();\r\n\t\t }\r\n\t\t \r\n\t\t Panel = $('iframe#canvas_frame', parent.document).contents().find('div.aC').find('div.no');//Takes the Div where the panel will be\r\n if(Panel.is('*')){ //take a div to put the panel\r\n\t\t\r\n\t\t\t\tvar tab = $('iframe#canvas_frame', parent.document).contents().find('div.no').find('div#filterPanel');\r\n\t\t\t\tif(tab.is('*')){ //test if the panel is already present and remove it if it's truth\r\n\t\t\t\t\ttab.remove();\r\n\t\t\t\t}\r\n\t\t\t\tvar modulos;//this variable will store the modules in use for each state.\r\n\t\t\t\tswitch (state){\r\n\t\t\t\t\tcase 0: // unloged filterMenu state\r\n\t\t\t\t\t\tupdateModules();\r\n\t\t\t\t\t\tmodulos = userPswd; \r\n\t\t\t\t\t\tPanel.append(drawPanel(modulos));\r\n\t\t\t\t\t\taccess_panel_handler();\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 1: // loged and waiting filterMenu state\r\n\t\t\t\t\t\tmsgLog = \"Select SuggestFilter in a Label Menu\";\r\n\t\t\t\t\t\tupdateModules();\r\n\t\t\t\t\t\tmodulos = logMsg;\r\n\t\t\t\t\t\tPanel.append(drawPanel(modulos));\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 2: // loged and processing filterMenu state\r\n\t\t\t\t\t\tmsgLog = msg;\r\n\t\t\t\t\t\tupdateModules();\r\n\t\t\t\t\t\tmodulos = logMsg;\r\n\t\t\t\t\t\tPanel.append(drawPanel(modulos));\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 3: // loged and conclude filterMenu state\r\n\t\t\t\t\t\tmsgLb = msg;\r\n\t\t\t\t\t\tupdateModules();\r\n\t\t\t\t\t\tmodulos = apply;\r\n\t\t\t\t\t\tPanel.append(drawPanel(modulos));\r\n\t\t\t\t\t\tapply_panel_handler();\r\n\t\t\t\t\t\tremove_panel_handler();\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 4: // login ERROR filterMenu state\r\n\t\t\t\t\t\tupdateModules();\r\n\t\t\t\t\t\tmodulos = erroPswd+userPswd;\r\n\t\t\t\t\t\tPanel.append(drawPanel(modulos));\r\n\t\t\t\t\t\taccess_panel_handler();\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 5: // general error filterMenu state\r\n\t\t\t\t\t\tmsgError = msg;\r\n\t\t\t\t\t\tupdateModules();\r\n\t\t\t\t\t\tmodulos = erroMsg;\r\n\t\t\t\t\t\tPanel.append(drawPanel(modulos));\r\n\t\t\t\t\t\treturn_panel_handler();\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tclose_panel_handler();\r\n\r\n\t\t } else{GM_log(\"Div for the panel was not found\");} \r\n\t\t}", "function setupPanel() {\n // calculate client rect\n opts['panel-before']['clientRect'] = opts['panel-before'][0].getBoundingClientRect();\n opts['panel-after']['clientRect'] = opts['panel-after'][0].getBoundingClientRect();\n pEl['clientRect'] = pEl[0].getBoundingClientRect();\n\n // calculate width/height value of prev, and next sibling node\n opts.panelBeforeSize = opts['panel-before']['clientRect'][opts.size];\n opts.panelAfterSize = opts['panel-after']['clientRect'][opts.size];\n\n opts.elSize = el[0].getBoundingClientRect()[opts.size];\n\n // total width or height for splitter's container node\n setContainerSize(opts.panelBeforeSize + opts.panelAfterSize);\n\n // parent element\n pEl.css(opts.size, pEl['clientRect'][opts.size])\n .attr(opts['namespace'], opts['namespace']);\n }", "function addPanel(container, param, el, state) {\n param.region = param.region || 'center';\n if (!state) state = $.data(container, 'layout');\n var panels = state.panels;\n var cc = $(container);\n var dir = param.region;\n\n if (panels[dir].length) return;\t// the region panel is already exists\n var pp;\n if (el) pp = $(el);\n else pp = cc.children('div[region=' + dir + ']');\n\n// var pp = cc.children('div[region=' + dir + ']');\n if (!pp.length) {\n pp = $('<div></div>').appendTo(cc);\t// the predefined panel isn't exists, create a new panel instead\n }\n\n // create region panel\n // 当panell不允许收缩时,去掉收缩按钮\n var opt = $.extend({}, {\n width: (pp.length ? parseInt(pp[0].style.width) || pp.outerWidth() : 'auto'),\n height: (pp.length ? parseInt(pp[0].style.height) || pp.outerHeight() : 'auto'),\n split: (pp.attr('split') ? pp.attr('split') == 'true' : undefined),\n doSize: false,\n cls: ('layout-panel layout-panel-' + dir),\n bodyCls: 'layout-body',\n collapsible: false\n }, param);\n if (pp.attr('collapsible')) opt.onOpen = function () {\n var buttonDir = {north: 'up', south: 'down', east: 'right', west: 'left'};\n if (!buttonDir[dir]) return;\n\n var iconCls = 'layout-button-' + buttonDir[dir];\n\n // add collapse tool to panel header\n var tool = $(this).panel('header').children('div.panel-tool');\n if (!tool.children('a.' + iconCls).length) {\n var t = $('<a href=\"javascript:void(0)\"></a>').addClass(iconCls).appendTo(tool);\n t.bind('click', {dir: dir, container: container}, function (e) {\n collapsePanel(e.data.container, e.data.dir);\n return false;\n });\n }\n };\n pp.panel(opt);\n\n panels[dir] = pp;\n\n if (pp.panel('options').split) {\n var panel = pp.panel('panel');\n panel.addClass('layout-split-' + dir);\n\n var handles = '';\n if (dir == 'north') handles = 's';\n else if (dir == 'south') handles = 'n';\n else if (dir == 'east') handles = 'w';\n else if (dir == 'west') handles = 'e';\n\n panel.resizable({\n handles: handles,\n onStartResize: function (e) {\n var panel = $(this);\n var container = panel.parents(\".layout\")[0];\n var cc = $(container);\n resizing = true;\n var proxy;\n if (dir == 'north' || dir == 'south') {\n proxy = $('>div.layout-split-proxy-v', container);\n } else {\n proxy = $('>div.layout-split-proxy-h', container);\n }\n var top = 0, left = 0, width = 0, height = 0;\n var pos = {display: 'block'};\n if (dir == 'north') {\n pos.top = parseInt(panel.css('top')) + panel.outerHeight() - proxy.height();\n pos.left = parseInt(panel.css('left'));\n pos.width = panel.outerWidth();\n pos.height = proxy.height();\n } else if (dir == 'south') {\n pos.top = parseInt(panel.css('top'));\n pos.left = parseInt(panel.css('left'));\n pos.width = panel.outerWidth();\n pos.height = proxy.height();\n } else if (dir == 'east') {\n pos.top = parseInt(panel.css('top')) || 0;\n pos.left = parseInt(panel.css('left')) || 0;\n pos.width = proxy.width();\n pos.height = panel.outerHeight();\n } else if (dir == 'west') {\n pos.top = parseInt(panel.css('top')) || 0;\n pos.left = panel.outerWidth() - proxy.width();\n pos.width = proxy.width();\n pos.height = panel.outerHeight();\n }\n proxy.css(pos);\n\n $('<div class=\"layout-mask\"></div>').css({\n left: 0,\n top: 0,\n width: cc.width(),\n height: cc.height()\n }).appendTo(cc);\n },\n onResize: function (e) {\n var panel = $(this);\n var container = panel.parents(\".layout\")[0];\n var proxy;\n if (dir == 'north' || dir == 'south') {\n proxy = $('>div.layout-split-proxy-v', container);\n proxy.css('top', e.pageY - $(container).offset().top - proxy.height() / 2);\n } else {\n proxy = $('>div.layout-split-proxy-h', container);\n proxy.css('left', e.pageX - $(container).offset().left - proxy.width() / 2);\n }\n return false;\n },\n onStopResize: function () {\n var panel = $(this);\n var container = panel.parents(\".layout\")[0];\n var cc = $(container);\n $('>div.layout-split-proxy-v', container).css('display', 'none');\n $('>div.layout-split-proxy-h', container).css('display', 'none');\n var opts = pp.panel('options');\n opts.width = panel.outerWidth();\n opts.height = panel.outerHeight();\n opts.left = panel.css('left');\n opts.top = panel.css('top');\n pp.panel('resize');\n setSize(container);\n resizing = false;\n\n cc.find('>div.layout-mask').remove();\n }\n });\n }\n }", "function manageSidePanel(data) {\n var controls = d3.select(\"#controls\");\n\n // remove current elements\n controls.selectAll(\"p\").remove();\n\n // add new p elements\n controls.selectAll(\"p\")\n .data(data)\n .enter().append(\"p\")\n .html(function (d) {\n return d;\n })\n }", "function ceateDrawPanel(rId) {\n\t\t\t\t\t\t\treturn\tExt.create('Ext.panel.Panel', {\n\t\t\t\t\t\t\t\tautoShow:true,\n\t\t\t\t\t\t\t\tid:rId,\n\t\t\t\t\t\t\t\twidth:mySignet1.width,\n\t\t\t\t\t\t\t\theight:mySignet1.height,\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t'padding': '0 0 0 0',\n\t\t\t\t\t\t\t\t\t'background-color': 'transparent',\n\t\t\t\t\t\t\t\t\t'border': '1px dotted blue',\n\t\t\t\t\t\t\t\t\t'-moz-user-select':'none'\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tbodyStyle: {\n\t\t\t\t\t\t\t\t\t'background-image': 'url(resources/images/s.gif)',//图路径\n\t\t\t\t\t\t\t\t\t'background-repeat': 'no-repeat',\n\t\t\t\t\t\t\t\t\t'background-color': 'transparent',\n\t\t\t\t\t\t\t\t\t'-moz-opacity': '1',\n\t\t\t\t\t\t\t\t\t'opacity':'1',\n\t\t\t\t\t\t\t\t\t'border': '0px dotted blue',\n\t\t\t\t\t\t\t\t\t'-moz-user-select':'none',\n\t\t\t\t\t\t\t\t\t'filter':\"progid:DXImageTransform.Microsoft.Chroma(color='white')\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tlisteners: {\n\t\t\t\t\t\t\t\t\t// beforerender: function (com, opts) {\n\t\t\t\t\t\t\t\t\t// mySignet1.setPanelDimension(com);\n\t\t\t\t\t\t\t\t\t// },\n\t\t\t\t\t\t\t\t\trender: function (com, opts) {\n\n\t\t\t\t\t\t\t\t\t\tvar img = com.getEl();\n\n\t\t\t\t\t\t\t\t\t\t// img.on('select', function() {\n\t\t\t\t\t\t\t\t\t\t// return false;\n\t\t\t\t\t\t\t\t\t\t// });\n\t\t\t\t\t\t\t\t\t\t//ie下取消选择\n\t\t\t\t\t\t\t\t\t\timg.dom.onselectstart= function() {\n\t\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\timg.on('mousedown', function (event, htmel, object, opts) {\n\t\t\t\t\t\t\t\t\t\t\tif(stampcls.getIsDrawing()) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tmySignet1.isDrag = true;\n\n\t\t\t\t\t\t\t\t\t\t\tmySignet1.offsetLeft = img.getX() - event.getX();\n\t\t\t\t\t\t\t\t\t\t\tmySignet1.offsetTop = img.getY() - event.getY();\n\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\twin.getEl().on('mousemove', function (event, htmel, object, opts) {\n\n\t\t\t\t\t\t\t\t\t\t\tif (!mySignet1.isDrag)\n\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\t\t\t\t\t\timg.setStyle('cursor', 'pointer');\n\n\t\t\t\t\t\t\t\t\t\t\tcom.setPagePosition(event.getX() + mySignet1.offsetLeft, event.getY() + mySignet1.offsetTop, false);\n\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\timg.on('mouseup', function (event, htmel, object, opts) {\n\t\t\t\t\t\t\t\t\t\t\tif(stampcls.getIsDrawing()) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tmySignet1.isDrag = false;\n\t\t\t\t\t\t\t\t\t\t\timg.setStyle('cursor', 'auto');\n\t\t\t\t\t\t\t\t\t\t\t//移动后重置cX,cY\n\t\t\t\t\t\t\t\t\t\t\tvar temp = stampcls.getStampList().getByKey(com.id);\n\t\t\t\t\t\t\t\t\t\t\t//- win.down('#currImage').getPosition()[0]\n\t\t\t\t\t\t\t\t\t\t\ttemp.cX = com.getEl().getXY()[0]- win.down('#currImage').getEl().getXY()[0];\n\t\t\t\t\t\t\t\t\t\t\ttemp.cY = com.getEl().getXY()[1]- win.down('#currImage').getEl().getXY()[1];\n\t\t\t\t\t\t\t\t\t\t\t//getPosition\n\t\t\t\t\t\t\t\t\t\t\t//stampcls.getStampList().add(com.id,temp);\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t//img单击选中事件\n\t\t\t\t\t\t\t\t\t\timg.on('click', function (e, htmel, object, opts) {\n\t\t\t\t\t\t\t\t\t\t\t//alert(com.id);\n\t\t\t\t\t\t\t\t\t\t\tstampcls.getStampList().eachKey( function(item) {\n\t\t\t\t\t\t\t\t\t\t\t\tif(com.id == item) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar curSel = win.down('#'+com.id+'');\n\t\t\t\t\t\t\t\t\t\t\t\t\tcurSel.getEl().setStyle('border','1px solid blue');\n\t\t\t\t\t\t\t\t\t\t\t\t\tstampcls.getSelList().add('cursel',curSel);\n\t\t\t\t\t\t\t\t\t\t\t\t\twin.down('#delStamps').setDisabled(false);\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\tvar other = win.down('#'+item+'');\n\t\t\t\t\t\t\t\t\t\t\t\t\tother.getEl().setStyle('border','1px dotted blue');\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\te.stopEvent();\n\t\t\t\t\t\t\t\t\t\t\t//win.down\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t//img双击事件\n\t\t\t\t\t\t\t\t\t\timg.on('dblclick', function (e, htmel, object, opts) {\n\t\t\t\t\t\t\t\t\t\t\t//alert(com.id);\n\t\t\t\t\t\t\t\t\t\t\tstampcls.getStampList().eachKey( function(item) {\n\t\t\t\t\t\t\t\t\t\t\t\tif(com.id == item) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlineEditor.comId=com.id;\n\t\t\t\t\t\t\t\t\t\t\t\t\tlineEditor.show();\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\te.stopEvent();\n\t\t\t\t\t\t\t\t\t\t\t//win.down\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}", "function openpanel()\r\n{\r\n\tlet topcell=document.getElementById(\"topcell\");\r\n\tlet new_margin=\"350px\";\r\n\r\n\tpanelstatus=true;\r\n\tsidepanel.style.width=\"300px\";\r\n\tsidepanel.style.paddingRight=\"10px\";\r\n\r\n\tcontainer.style.marginLeft=new_margin;\r\n\tpara.style.marginLeft=new_margin;\r\n\ttopcell.style.marginLeft=new_margin;\r\n\r\n}", "function showPanel(e, theInstance, x, y) {\n var offx = (x)? x - 0 : 20;\n var offy= (y)? y - 0 : 20;\n var theHandle = document.getElementById(\"handle\" + \"_\" + theInstance);\n var theRoot = document.getElementById(\"panel\" + \"_\" + theInstance);\n \n Drag.init(theHandle, theRoot);\n /* theRoot.onDragStart=makePanelTop; */\n theRoot.onDrag=pStyleDrag;\n theRoot.onDragEnd=pStyleDragEnd;\n panels[panels.length]=theRoot;\n /* panels[panels.length-1].style.zIndex = panels.length-1; */\n positionPanel(e,theRoot,offx,offy);\n theRoot.style.visibility = \"visible\";\n \n }", "make_control_panel() {\n this.key_triggered_button(\"Pause Time\", [\"n\"], () => {\n this.paused = !this.paused;\n });\n this.new_line();this.new_line();\n this.control_panel.innerHTML += \"Move the ball using the following buttons:<br>\";\n this.key_triggered_button(\"Move ball left\", [\"j\"], ()=>this.left_ctrl = 1, undefined, ()=>this.left_ctrl = 0);\n this.key_triggered_button(\"Move ball right\", [\"l\"], ()=>this.right_ctrl = 1, undefined, ()=>this.right_ctrl = 0);\n this.new_line();\n this.key_triggered_button(\"Move ball up\", [\"i\"], ()=>this.up_ctrl = 1, undefined, ()=>this.up_ctrl = 0);\n this.key_triggered_button(\"Move ball down\", [\"k\"], ()=>this.down_ctrl = 1, undefined, ()=>this.down_ctrl = 0);\n }", "async setPanel(_) {\n if (!arguments.length)\n return this._irisPanel;\n this._irisPanel = _;\n }", "async setPanel(_) {\n if (!arguments.length)\n return this._irisPanel;\n this._irisPanel = _;\n }", "function show_additional_panel(tool){\n var new_panel = '';\n switch(tool){\n case 'polyline':\n case 'line':\n case 'path':\n case 'multipath':\n new_panel = 'open_shape_style';\n break;\n case 'polygon':\n case 'rect':\n case 'circle':\n new_panel = 'closed_shape_style';\n break;\n case 'image':\n new_panel = 'image_style';\n break;\n }\n if(g['additional_panel'] != new_panel){\n if(g['additional_panel'] != '')\n // Hide old panel\n getById(g['additional_panel']).className = 'hidden';\n if(new_panel != ''){\n var panel = getById(new_panel);\n // Show the new panel\n panel.className = 'new_panel';\n }\n // Save changes\n g['additional_panel'] = new_panel;\n }\n}", "function refreshPanelStats(panel) {\n\t var data = panel.$el.coords().grid;\n\t panel.size_x = data.size_x;\n\t panel.size_y = data.size_y;\n\t panel.col = data.col;\n\t panel.row = data.row;\n\t }", "function sidePanel() {\n strokeWeight(0);\n textSize(36);\n textStyle(BOLD);\n textAlign(CENTER);\n textFont(\"Cambria\");\n\n //This makes the side pannel\n fill(0, 45, 72);\n rect(width - 400, 0, width, height);\n\n //This is for the dividers on the side pannel\n fill(0, 140, 174);\n rect(width - 400, 445, width, 8);\n rect(width - 400, 545, width, 8);\n rect(width - 400, 715, width, 8);\n\n //This is just used to label the pen color and pan size sliders\n fill(200, 241, 247);\n text(\"Pen Color\", width - 200, 40);\n text(\"Pen Size\", width - 200, 490);\n}", "function BuildPanel() {\n\n\t\tconst btnData = [\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\t'title' : 'Edit',\n\t\t\t\t\t'fn' : _ => edit(),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t'title' : 'Show Options',\n\t\t\t\t\t'fn' : _ => $sudoku.toggleClass( 'showoptions' ),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t'title' : '+',\n\t\t\t\t\t'fn' : _ => ChangeSize( 6 ),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t'title' : '-',\n\t\t\t\t\t'fn' : _ => ChangeSize( -6 ),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t'title' : 'Update',\n\t\t\t\t\t'fn' : update,\n\t\t\t\t},\n\t\t\t],\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\t'title' : 'Set as base',\n\t\t\t\t\t'fn' : _ => setBase(),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t'title' : 'Export Data',\n\t\t\t\t\t'fn' : _ => {\n\t\t\t\t\t\texportData();\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t];\n\t\tconst $panel = $( '<panel>' )\n\t\t\t.appendTo( $wrap );\n\n\t\tfor ( let d of btnData ) {\n\t\t\tlet $div = $( '<div>' ).appendTo( $panel );\n\t\t\tfor ( let b of d ) {\n\t\t\t\t$( '<button>' )\n\t\t\t\t\t.html( b.title )\n\t\t\t\t\t.click( b.fn )\n\t\t\t\t\t.appendTo( $div );\n\t\t\t}\n\t\t}\n\n\t\treturn $panel;\n\n\t}", "function returnControlPanelCreation(app, panel) {\n\n /* Variaveis do painel de controle de tentativas */\n var grid = app.createGrid(9, 2).setId('returnGrid');\n var welcomeLabel = app.createLabel().setStyleAttribute(\"fontSize\", \"14\").setVisible(false).setId('returnLabel');\n var confirmButton = app.createButton('Confirmar').setVisible(false).setId('confirmButton');\n var forfeitButton = app.createButton('Desistir').setVisible(false).setId('forfeitButton');\n var infoLabel = app.createLabel().setStyleAttribute(\"fontSize\", \"14\").setVisible(false).setId('infoLabel1');\n var infoLabel2 = app.createLabel().setStyleAttribute(\"fontSize\", \"14\").setVisible(false).setId('infoLabel2');\n var infoLabel3 = app.createLabel().setStyleAttribute(\"fontSize\", \"14\").setVisible(false).setId('infoLabel3');\n var infoLabel4 = app.createLabel().setStyleAttribute(\"fontSize\", \"14\").setVisible(false).setId('infoLabel4');\n var infoLabel5 = app.createLabel().setStyleAttribute(\"fontSize\", \"14\").setVisible(false).setId('infoLabel5');\n \n /* Criacao do painel de controle de tentativas */\n grid.setWidget(2, 0, confirmButton)\n .setWidget(3, 0, forfeitButton)\n .setWidget(4, 0, infoLabel)\n .setWidget(5, 0, infoLabel2)\n .setWidget(6, 0, infoLabel3)\n .setWidget(7, 0, infoLabel4)\n .setWidget(8, 0, infoLabel5);\n \n /* Criacao do tratador do botao de confirmacao */\n var triesHandler = app.createServerClickHandler('validateTry');\n triesHandler.addCallbackElement(panel);\n app.getElementById('confirmButton').addClickHandler(triesHandler);\n \n /* Criacao do tratador do botao de desistencia */\n var forfeitHandler = app.createServerClickHandler('userForfeit');\n forfeitHandler.addCallbackElement(panel);\n app.getElementById('forfeitButton').addClickHandler(forfeitHandler);\n \n return grid;\n}", "function advancedPanel(obj) {\n const basePanel=document.querySelector(\".basepanel\");\n const advanceBtn=document.querySelectorAll('.advanced');\n basePanel.classList.add(\"showhide\");\n advanceBtn.forEach((button)=>{\n button.addEventListener('click',(event)=>{\n advancedOperationHandling(obj,event.target.id);\n display(obj);\n });\n });\n}", "function panelView(input) {\n oldNodes = document.getElementById(\"ui\")\n while(oldNodes.firstChild) {\n oldNodes.removeChild(oldNodes.firstChild)\n }\n webCheck = false\n whichPanel = input\n ctx.clearRect(0, 0, canvas.width, canvas.height)\n for(i = 0; i < panels[whichPanel].length; i++)\n {\n ctx.beginPath()\n ctx.rect(panels[whichPanel][i].x, panels[whichPanel][i].y, panels[whichPanel][i].width, panels[whichPanel][i].height)\n ctx.stroke()\n ctx.closePath()\n }\n barNum = input\n bottomBar(barNum)\n document.addEventListener('mousedown', whileDrawing)\n document.addEventListener('mousemove', dontDraw)\n document.addEventListener('mousedown', resizePanel)\n document.addEventListener('mousedown', movePanel)\n document.addEventListener('mousedown', deletePanel)\n document.addEventListener('mousedown', checkBox)\n setPanelNumber(input)\n}", "function togglePanels(){\n $('#addLPanel').toggle();\n $('#updateLPanel').toggle();\n}", "function panel(panel, direction) {\r\t//var height = $(window).height();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// \r\t$('.panel__trigger--' + panel).click(function() {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// 1.\r\t\tif ($('.panel__trigger--' + panel).hasClass('panel__trigger--active')) {\t\t\t\t// 2.\r\t\t\t$('body').toggleClass('panel__helper--push-to' + direction);\t\t\t\t\t\t\t\t\t// 3.\r\t\t\t$('.panel__' + panel ).toggleClass('panel__helper--open');\t\t\t\t\t\t\t\t\t\t// 4.\r\t\t\t$('.panel__trigger').removeClass('panel__trigger--active');\t\t\t\t\t\t\t\t\t\t// 5.\r\t\t\tif ($('.panel__' + panel).hasClass('panel__helper--open')) {\t\t\t\t\t\t\t\t\t// 6.\r\t\t\t\t//$('.panel__' + panel + ' .panel__content').css('height', (height - 25));\t// \r\t\t\t\t$('.panel__trigger--' + panel).addClass('panel__trigger--active');\t\t\t\t\t// 7.\r\t\t\t\t$('.overlay').show();\r\t\t\t} else {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// 8.\r\t\t\t\t$('.panel__trigger').addClass('panel__trigger--active');\t\t\t\t\t\t\t\t\t\t// 9.\r\t\t\t\t$('.overlay').hide();\r\t\t\t}\r\t\t}\r\t\treturn false;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// z.\r\t});\r}", "async setPanel(_) {\n if (!arguments.length)\n return this._clusterVisPanel;\n this._clusterVisPanel = _;\n }", "function __onClickPanelButton() {\n $('body').removeClass('wcDisableSelection');\n for (var i = 0; i < self._frameList.length; ++i) {\n var frame = self._frameList[i];\n if (frame.$close[0] === this) {\n self.__closePanel(frame.panel());\n return;\n }\n if (frame.$collapse[0] === this) {\n var $icon = frame.$collapse.children('div');\n var position = wcDocker.DOCK.BOTTOM;\n if ($icon.hasClass('wcCollapseLeft')) {\n position = wcDocker.DOCK.LEFT;\n } else if ($icon.hasClass('wcCollapseRight')) {\n position = wcDocker.DOCK.RIGHT;\n }\n if (frame.isCollapser()) {\n // Un-collapse\n // var target;\n var opts = {};\n switch (position) {\n case wcDocker.DOCK.LEFT:\n // target = frame._parent._parent.right();\n opts.w = frame.$frame.width();\n break;\n case wcDocker.DOCK.RIGHT:\n // target = frame._parent._parent.left();\n opts.w = frame.$frame.width();\n break;\n case wcDocker.DOCK.BOTTOM:\n // target = frame._parent._parent.top();\n opts.h = frame.$frame.height();\n break;\n }\n var target = self._collapser[wcDocker.DOCK.LEFT]._parent.right();\n frame.collapse(true);\n self.movePanel(frame.panel(), position, target, opts);\n } else {\n // collapse.\n self.movePanel(frame.panel(), position, wcDocker.COLLAPSED);\n }\n self.__update();\n return;\n }\n if (frame.$tabLeft[0] === this) {\n frame._tabScrollPos -= frame.$tabBar.width() / 2;\n if (frame._tabScrollPos < 0) {\n frame._tabScrollPos = 0;\n }\n frame.__updateTabs();\n return;\n }\n if (frame.$tabRight[0] === this) {\n frame._tabScrollPos += frame.$tabBar.width() / 2;\n frame.__updateTabs();\n return;\n }\n\n for (var a = 0; a < frame._buttonList.length; ++a) {\n if (frame._buttonList[a][0] === this) {\n var $button = frame._buttonList[a];\n var result = {\n name: $button.data('name'),\n isToggled: false\n };\n\n if ($button.hasClass('wcFrameButtonToggler')) {\n $button.toggleClass('wcFrameButtonToggled');\n if ($button.hasClass('wcFrameButtonToggled')) {\n result.isToggled = true;\n }\n }\n\n var panel = frame.panel();\n panel.buttonState(result.name, result.isToggled);\n panel.__trigger(wcDocker.EVENT.BUTTON, result);\n return;\n }\n }\n }\n }", "getPanel() {\n\t\tif (this.inProgress()) {\n\t\t\treturn (\n\t\t\t<Panel className='listingItemPanelMargins' bsStyle='primary' header={this.getHeader()}>\n\t\t \t<Grid>\n\t\t \t\t{this.getListing()}\n\t\t \t</Grid>\n\t\t </Panel>\n\t\t\t);\n\t\t}\n\t\treturn (\n\t\t\t<Panel className='listingItemPanelMargins' header={this.getHeader()}>\n\t\t \t<Grid>\n\t\t \t\t{this.getListing()}\n\t\t \t</Grid>\n\t\t </Panel>\n\t\t);\n\t}", "function add_control() {\n\t\t\t\t$(\"<div id='p4_panel'></div>\").insertAfter(target);\n\t\t\t\t$('#p4_panel').width(target.width);\n\t\t\t\t$(\"#p4_panel\").css({\"margin-left\": \"30%\", \"margin-top\": \"30px\"});\n\t\t\t\t$(\"#p4_panel\").append(\"<p id='p4_current'></p>\");\n\t\t\t\t$(\"#p4_panel\").append(\"<button id='p4_undo' style='float: right'> Undo </button>\");\n\t\t\t\t$(\"#p4_panel\").append(\"<div style='display: inline-block; width:45%; min-height:1px'>\" +\n\t\t\t\t\"</div><div id='p4_p1' style='border-radius= 100%'><p id='p4_score_p1'></p>\" + \n\t\t\t\t\"</div><div id='p4_p2' style='border-radius= 100%;width= 30px;height= 30px'><p id='p4_score_p2'></p></div>\");\n\t\t\t\t$(\"#p4_p1\").css({\"color\": \"blue\",\"background-color\": parameters.color_player.p1, 'border-radius': '100%', \"width\": \"50px\",\n\t\t\t\t\"height\": \"50px\", \"display\": \"inline-block\", \"margin-right\": \"20px\", \"border\": \"1px solid black\",\"text-align\": \"center\"});\n\t\t\t\t$(\"#p4_p2\").css({\"color\": \"blue\",\"background-color\": parameters.color_player.p2, 'border-radius': '100%', \"width\": \"50px\",\n\t\t\t\t\"height\": \"50px\", \"display\": \"inline-block\", \"border\": \"1px solid black\", \"text-align\": \"center\"});\n\t\t\t\tundo_event();\n\t\t\t\tif (parameters.man[0]) {\n\t\t\t\t\tadd_man();\n\t\t\t\t}\n\t\t\t}", "function ProgressCenterPanel() {}", "function LGraphGUIPanel()\r\n\t{\r\n\t\tthis.addOutput(\"pos\",\"vec2\");\r\n\t\tthis.addOutput(\"enabled\",\"boolean\");\r\n\t\tthis.properties = { enabled: true, draggable: false, title: \"\", color: [0.1,0.1,0.1], opacity: 0.7, titlecolor: [0,0,0], position: [10,10], size: [300,200], rounding: 8, corner: LiteGraph.CORNER_TOP_LEFT };\r\n\t\tthis._area = vec4.create();\r\n\t\tthis._color = vec4.create();\r\n\t\tthis._titlecolor = vec4.create();\r\n\t\tthis._offset = [0,0];\r\n\t}", "function showPanel(arr, value) {\n var controlMargin, // update variable for control margin\n activePanelObject, // set variable for object\n activePanel; // set variable for panel\n for (var i = 0; i <= arr.length - 1; i++) {\n // for each object in array\n if (arr[i].panelID == value) {\n // if the value of \"panelID\" is equal to the value of value of the \"aria-controls\" attribute of the clicked button\n activePanelObject = arr[i]; // var activePanelObject is equal to the current object\n activePanel = activePanelObject.panelEl; // var activePanel is equal to the value of the current object's \"panelEL\" property\n activePanel.setAttribute(attrPanel, \"active\"); // set the value of the attribute to \"active\"\n activePanel.setAttribute(\"aria-hidden\", \"false\"); // expose panel to AT\n if (control.className === \"tabs\") {\n // if the element is a \"tabs\" group\n controlMargin = activePanel.scrollHeight; // set teh control margin to the height of the active panel\n }\n // console.log(controlMargin);\n control.style.marginBottom = controlMargin + 10 + \"px\"; // set the bottom margin of the \"tabs\" or \"accordion\" element\n }\n }\n }", "function build_newShotPanel (shotObj, compItem, stat)\r\n {\r\n // define UI panel specifities\r\n // title for shot panel\r\n var title = undefined;\r\n if (showShotStatus_inPanelName == true) var title = shotObj.name + \" [\" + stat +\"]\";\r\n else title = shotObj.name;\r\n var compPanel = TabbedPanel.add(\"tab\");\r\n compPanel.text = title ;\r\n compPanel.comp = compItem; // extra argument passed through panel object \r\n compPanel.appFolder = shotObj.appFolder; // extra argument passed through panel object \r\n compPanel.orientation = \"column\";\r\n compPanel.margins = [10,5,10,5];\r\n compPanel.grp = compPanel.add(\"group\");\r\n compPanel.grp.alignment = ['fill','fill'];\r\n /* Export Option Master Group */\r\n compPanel.ExportOptionsGrp = compPanel.grp.add(\"group\", undefined, undefined, {name: 'ExportOptionsGrp'});\r\n compPanel.ExportOptionsGrp.orientation = \"row\";\r\n compPanel.ExportOptionsGrp.alignment = ['fill','middle'];\r\n compPanel.ExportOptionsGrp.alignChildren = ['center','middle'];\r\n compPanel.AECheck = compPanel.ExportOptionsGrp.add(\"checkbox\", undefined, \"AE\", {name: 'AECheck'}); // 0\r\n compPanel.AECheck.value = shotObj.exportAE;\r\n compPanel.AECheck.helpTip = \"Export After Effect project for this shot if checked\";\r\n compPanel.QTCheck = compPanel.ExportOptionsGrp.add(\"checkbox\", undefined, \"QT\", {name: 'QTCheck'}); // 1\r\n compPanel.QTCheck.value = shotObj.exportQT;\r\n compPanel.QTCheck.helpTip = \"Export Quicktime file for this shot if checked\";\r\n compPanel.FramingCheck = compPanel.ExportOptionsGrp.add(\"checkbox\", undefined, \"Framing\", {name: 'FramingCheck'}); // 2\r\n compPanel.FramingCheck.value = shotObj.exportFraming;\r\n compPanel.FramingCheck.helpTip = \"Export framing of this shot for animators if checked\";\r\n compPanel.MultiFramingCheck = compPanel.ExportOptionsGrp.add(\"checkbox\", undefined, \"Multi-Framing\", {name: 'MultiFramingCheck'}); // 2\r\n compPanel.MultiFramingCheck.value = (shotObj.exportMultiFraming == true);\r\n compPanel.MultiFramingCheck.helpTip = \"Export start frame, end frame and wide\";\r\n compPanel.MACheck = compPanel.ExportOptionsGrp.add(\"checkbox\", undefined, \"3D Anim\", {name: 'MACheck'}); // 3\r\n compPanel.MACheck.value = false;\r\n compPanel.MACheck.helpTip = \"Export maya file for 3D anim if checked\";\r\n compPanel.export_status = compPanel.grp.add(\"group\", undefined, undefined, {name: 'export_status'}); // 4\r\n compPanel.export_status.alignment = ['right','middle'];\r\n compPanel.AddBGAssetBttn = compPanel.export_status.add(\"button\", undefined, \"Add BG asset\", {name: 'AddBGAssetBttn'});\r\n compPanel.appFolder_bttn_obj = compPanel.export_status.add(\"image {name: \\\"appFolder_bttn_obj\\\", helpTip:\\\"Open approved folder\\\", image: \\\"\"+(icons_folder+\"folder_icon_3.png\")+\"\\\"}\");\r\n \r\n /* This grp will contains assets and files to export */\r\n compPanel.assets_grp = compPanel.add(\"group\", undefined, \"assets_group\", {name: 'assets_grp'});\r\n compPanel.assets_grp.orientation = \"column\";\r\n compPanel.assets_grp.margins = [0,10,0,10];\r\n compPanel.assets_grp.id = 1;\r\n compPanel.assets_grp.alignment = ['fill','top'];\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t// J Hearn - this panel contains notes\r\n\t\t\t\t\t\tcompPanel.notes_panel = compPanel.add(\"panel\", undefined, \"Notes\");\r\n compPanel.notes_panel.orientation = \"column\";\r\n compPanel.notes_panel.margins = [0,5,0,5];\r\n compPanel.notes_panel.id = 2;\r\n\t\t\t\t\t\t\tcompPanel.notes_panel.alignment = ['fill','top'];\r\n\t\t\t\t\t\t\tcompPanel.notes_panel.alignChildren = ['fill','fill'];\r\n\t\t\t\t\t\tcompPanel.notes_to_grp = compPanel.notes_panel.add(\"group\");\r\n\t\t\t\t\t\t\tcompPanel.notes_to_grp.orientation = \"row\";\r\n\t\t\t\t\t\t\tcompPanel.notes_to_grp.alignment = ['fill','top'];\r\n\t\t\t\t\t\tcompPanel.notes_to_grp.add(\"statictext\", undefined, \"To:\");\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tcompPanel.notes_to = new TagEditor(compPanel.notes_to_grp, usersAndDepts.users.sort(), shotObj.notesTo);\r\n\t\t\t\t\t\tcompPanel.notes_depts_grp = compPanel.notes_panel.add(\"group\");\r\n\t\t\t\t\t\t\tcompPanel.notes_depts_grp.orientation = \"row\";\r\n\t\t\t\t\t\t\tcompPanel.notes_depts_grp.alignment = ['fill','top'];\r\n\t\t\t\t\t\tcompPanel.notes_depts_grp.add(\"statictext\", undefined, \"Departments:\");\r\n\t\t\t\t\t\tcompPanel.notes_depts = new TagEditor(compPanel.notes_depts_grp, usersAndDepts.departments.sort(), shotObj.notesDepts);\r\n\t\t\t\t\t\tcompPanel.notes_edit = compPanel.notes_panel.add(\"edittext\", undefined, shotObj.notes, {multiline: true});\r\n \r\n // ACTIONS\r\n compPanel.AddBGAssetBttn.onClick = function ()\r\n { \r\n // create BGcreationPanel\r\n newAsset = bgassettool (this, shotObj, episodeFolder, compItem, undefined);\r\n if (newAsset instanceof Object)\r\n { \r\n // build ui panel for this new asset\r\n new_panel = build_bg_asset_panel (this.parent.parent.parent.children[1], newAsset, shotObj);\r\n // update assets Lists!\r\n if (newAsset.status.match(/re-use|locked/gi))\r\n {\r\n assets_list = readFile (episodeFolder, 'asset');\r\n if (newAsset.name in assets_list)\r\n {\r\n bg_reuse = assets_list[newAsset.name];\r\n // it is a bg re-use of an asset of the episode.\r\n newAsset.sg_id = bg_reuse['sg_id'];\r\n // add the actual shot to list of parent shots of the asset\r\n bg_reuse['parentShot'].push(shotObj.name);\r\n addAssetToFile (episodeFolder, bg_reuse);\r\n }\r\n // add the bg-asset to the .shots List\r\n updateAssetInShotFile (appFolder, newAsset, 'add', newAsset['sg_id']);\r\n }\r\n else\r\n {\r\n // get export status checkbox's value\r\n queueStatus = new_panel.children[2].children[2].value;\r\n // add the bg-asset to the .asset List\r\n addAssetToFile (episodeFolder, newAsset);\r\n // add the bg-asset to the .shots List\r\n updateAssetInShotFile (appFolder, newAsset, 'add', queueStatus);\r\n }\r\n // update the ui\r\n new_panel.parent.parent.layout.layout(true);\r\n // make sure there is a maya file for 3D BGs\r\n if (newAsset.id.match(/3D|camera/gi))\r\n {\r\n //we need 3D for this BG\r\n if (compPanel.MACheck.value == false) compPanel.MACheck.notify();\r\n }\r\n }\r\n };\r\n compPanel.appFolder_bttn_obj.onClick = function ()\r\n { \r\n appDir = new Folder(shotObj.appFolder);\r\n appDir.execute();\r\n getExportedFiles (this, shotObj);\r\n };\r\n \r\n compPanel.MACheck.onClick = function () {\r\n maya_file = shotObj.maFile;\r\n if (maya_file) { build_maya_file_panel (compPanel.assets_grp, this, maya_file, appFolder); }\r\n else { build_maya_file_panel (compPanel.assets_grp, this, undefined, appFolder); };\r\n \r\n };\r\n compPanel.AECheck.onClick = function () { updateEntryInShotFile (appFolder, this.value, \"AE\"); };\r\n compPanel.QTCheck.onClick = function () { updateEntryInShotFile (appFolder, this.value, \"QT\"); };\r\n compPanel.FramingCheck.onClick = function ()\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tcompPanel.MultiFramingCheck.enabled = this.value;\r\n\t\t\t\t\t\t\tif (!this.value && compPanel.MultiFramingCheck.value)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tcompPanel.MultiFramingCheck.value = false;\r\n\t\t\t\t\t\t\t\tupdateEntryInShotFile (appFolder, compPanel.MultiFramingCheck.value, \"MultiFraming\");\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tupdateEntryInShotFile (appFolder, this.value, \"Framing\");\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tcompPanel.MultiFramingCheck.onClick = function () { updateEntryInShotFile (appFolder, this.value, \"MultiFraming\"); };\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tcompPanel.notes_to.onChange = function () { updateEntryInShotFile(appFolder, compPanel.notes_to.tags, \"NotesTo\");};\r\n\t\t\t\t\t\tcompPanel.notes_depts.onChange = function () { updateEntryInShotFile(appFolder, compPanel.notes_depts.tags, \"NotesDepts\");};\r\n\t\t\t\t\t\tcompPanel.notes_edit.onChange = function () { updateEntryInShotFile(appFolder, compPanel.notes_edit.text, \"Notes\");};\r\n\t\t\t\t\t\t\r\n // \r\n // re build the panel\r\n TabbedPanel.layout.layout(true);\r\n return compPanel;\r\n }", "function show_hide_panel(e){\n\t\t\t\t\tif($mainContainer.length === 0)\n\t\t\t\t\t\t$mainContainer = $(\"#mainContainer\");\n\t\t\t\t\t\n\t\t\t\t\tif($panel.is_visible()){\n\t\t\t\t\t\t$mainContainer.removeClass(\"lyrics_visible\");\n\t\t\t\t\t}else {\n\t\t\t\t\t\tif($panel.is_popped_in()) $mainContainer.addClass(\"lyrics_visible\");\n\t\t\t\t\t\tif(!cur_song.gotLyrics && cur_song.artist !== \"\"){\n\t\t\t\t\t\t\tcur_song.cur_time = $(\"#time_container_current\").text();\n\t\t\t\t\t\t\t$lyrics.get_lyrics(cur_song, true, [$panel.autoscroll, manual_search]);\n\t\t\t\t\t\t\tcur_song.gotLyrics = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$panel.show_hide_panel(e, site);\n\t\t\t\t}", "function makePanels() {\n this.makeChart();\n //Arrange and display panels\n new Ext.Viewport({\n layout: 'border',\n rendreTo: Ext.getBody(),\n items: [\n this.makeHeader(),\n this.makeMapPanel(),\n this.makeDataPanel()\n ]\n });\n this.setLinesSelector(true);\n this.tabPanel.setHeight(271); //@fix me\n}", "_hide() {\n this.panelElem.addClass(\"hidden\");\n }", "openPanel() {\n this.overlay.openPanel();\n }", "function showPanel(panel) {\n if ( $('#' + panel).length === 0 && $('#' + panel + 'Panel').length === 1) {\n $('#' + panel + 'Panel').clone().attr('id', panel).appendTo('#board');\n $('#' + panel + 'Panel').remove();\n if (panel === 'pause' || panel === 'gameOver') {\n $('#play').css('opacity', 0.3);\n }\n // Google Analytics tracking of activated panel\n offlineAnalytics.push({ name: 'view', value: '/' + panel + '/' });\n }\n }", "_initPanelAdapter() {\n }", "get panelClass() { return this._panelClass; }", "function loadPanels() {\n\t\t\tloadMonthlyCelebrants();\n\t\t\t//loadNewlyBaptized();\n\t\t}", "function buildAndAddControlPanel() {\r\n\r\n\t// Panel\r\n\r\n\tleaderboard = document.getElementById('leaderboard');\r\n\tpager_top = document.getElementsByClassName('leaderboard_container')[0].getElementsByTagName('p')[0];\r\n\tdatas = leaderboard.getElementsByTagName('tbody')[0];\r\n\tleaderboardRows = leaderboard.getElementsByTagName('TR');\r\n\r\n\ttableLine1 = document.createElement('DIV');\r\n\ttableLine2 = document.createElement('DIV');\r\n\ttableLine3 = document.createElement('DIV');\r\n\ttableLine4 = document.createElement('DIV');\r\n\t\r\n\ttableLine1.innerHTML = firstLineLabelsHTML;\r\n\ttableLine2.innerHTML = firstLineSettingsHTML;\r\n\ttableLine3.innerHTML = secondLineLabelsHTML;\r\n\ttableLine4.innerHTML = secondLineSettingsHTML;\r\n\t\r\n\tpager_top.appendChild(tableLine1);\r\n\tpager_top.appendChild(tableLine2);\r\n\tpager_top.appendChild(tableLine3);\r\n\tpager_top.appendChild(tableLine4);\r\n\r\n\tfilterRadios = document.getElementById('firstLineSettings').getElementsByTagName('INPUT');\r\n\tradioLabels = document.getElementById('firstLineLabels').getElementsByTagName('td');\r\n\t\r\n\tfilterCheckboxes = document.getElementById('secondLineSettings').getElementsByTagName('INPUT');\r\n\tcheckboxesLabels = document.getElementById('secondLineLabels').getElementsByTagName('td');\r\n\t\r\n\t(GM_getValue('firstLineVisible', null) == null) ? (GM_setValue('firstLineVisible', true)) : (radioSettingsVisible = GM_getValue('firstLineVisible', null));\r\n\t(GM_getValue('secondLineVisible', null) == null) ? (GM_setValue('secondLineVisible', true)) : (checkboxSettingsVisible = GM_getValue('secondLineVisible', null));\r\n\t\r\n\t(radioSettingsVisible) ? (document.getElementById('firstLineSettings').style.display = \"block\") : (document.getElementById('firstLineSettings').style.display = \"none\");\r\n\t\r\n\t(checkboxSettingsVisible) ? (document.getElementById('secondLineSettings').style.display = \"block\") : (document.getElementById('secondLineSettings').style.display = \"none\");\r\n\t\r\n\t// Buttons\r\n\t\r\n\tfilterButton = document.createElement('INPUT');\r\n\tfilterButton.type = 'button';\r\n\tfilterButton.value = 'FILTER NOW';\r\n\tfilterButton.style.color = \"red\";\r\n\r\n\tdisableFilteringButton = document.createElement('INPUT');\r\n\tdisableFilteringButton.type = 'button';\r\n\tdisableFilteringButton.value = 'DISABLE FILTERING';\r\n\r\n\tsetFilterToDefaultButton = document.createElement('INPUT');\r\n\tsetFilterToDefaultButton.type = 'button';\r\n\tsetFilterToDefaultButton.value = 'SET FILTER TO DEFAULT';\r\n\tsetFilterToDefaultButton.style.marginLeft = 20 + 'px';\r\n\r\n\tsaveFilterButton = document.createElement('INPUT');\r\n\tsaveFilterButton.type = 'button';\r\n\tsaveFilterButton.style.width = 180 + 'px';\r\n\tsaveFilterButton.value = 'SAVE FILTER SETTINGS';\r\n\tsaveFilterButton.disabled = true;\r\n\r\n\tpager_top.appendChild(filterButton);\r\n\tpager_top.appendChild(disableFilteringButton);\r\n\tpager_top.appendChild(setFilterToDefaultButton);\r\n\tpager_top.appendChild(saveFilterButton);\r\n\r\n\tfilterButton.addEventListener(\"click\", filter, false);\r\n\tdisableFilteringButton.addEventListener(\"click\", disableFilter, false);\r\n\tsetFilterToDefaultButton.addEventListener(\"click\", setFilterToDefault, false);\r\n\tsaveFilterButton.addEventListener(\"click\", saveFilterSettings, false);\r\n}", "function positionPanel() {\n $(\"#ad-hoc-panel\").position({\n my: \"left+10 top\",\n at: \"right top\",\n of: model.selectedAnchor,\n collision: \"flipfit fit\"\n })\n}", "function panel(id) {\n $('.panel').slideUp(500);\n $('#' + id).slideDown(500);\n }", "createPanels() {\n const { palette, isLastPanelHidden, cta } = this.state;\n const isSlim = this.isSlim;\n const ctaPanel = this.createSwatchPanel({ name: 'Call to action', mix: CALL_TO_ACTION, onChanged: swatch => this.chooseCta(swatch), swatch: cta, isSlim });\n\n const panels = palette.map((panel, index, list) => {\n const onChanged = (swatch) => this.chooseSwatch(swatch, index);\n let canRemove = false;\n let canHide = false;\n if (index > 0 && index === list.length - 1) {\n canHide = true;\n }\n else if (isLastPanelHidden && index === list.length - 2 && index > 0) {\n canRemove = true;\n }\n let isShowIncluded = false;\n if (isLastPanelHidden && index === list.length - 2) {\n isShowIncluded = true;\n }\n return this.createSwatchPanel({ name: panel.name, mix: panel.mix, onChanged, isGrouped: panel.isGrouped, canRemove, canHide, isSlim, isShowIncluded })\n });\n\n if (isLastPanelHidden && palette.length > 1) {\n panels.pop();\n }\n return [ctaPanel, ...panels];\n }", "function subPanels(p)\n{\n\tvar i, e, t;\n\n\tif (typeof(p) == 'string')\n\t{\n\t\tshow_panel = p;\n\t}\n\n\tfor (i = 0; i < panels.length; i++)\n\t{\n\t\te = document.getElementById(panels[i]);\n\t\tt = document.getElementById(panels[i] + '-tab');\n\n\t\tif (e)\n\t\t{\n\t\t\tif (panels[i] == show_panel)\n\t\t\t{\n\t\t\t\te.style.display = 'block';\n\t\t\t\tif (t)\n\t\t\t\t{\n\t\t\t\t\tt.className = 'activetab';\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\te.style.display = 'none';\n\t\t\t\tif (t)\n\t\t\t\t{\n\t\t\t\t\tt.className = '';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function ac_rebuild_panel(self, event, kw, src)\n {\n rebuild(self);\n return 0;\n }", "function handlePanelClick(event){\n showPanel(event.currentTarget);\n }", "make_control_panel() {\n this.key_triggered_button(\"Hover in Place\", [\"m\"], () => {\n this.hover = !this.hover;\n });\n this.key_triggered_button(\"Pause Time\", [\"n\"], () => {\n this.paused = !this.paused;\n });\n }", "function showOverpanel(pullFrom, slotName, pageNum) {\n //console.log(\"Overpanel Function Acitvted\");\n var itemsPerPage = columns * rows;\n var start = pageNum * itemsPerPage;\n if (start == pullFrom.length - 1)\n start -= 3;\n var stopHere = pullFrom.length;\n if (pageNum < 0 || start > stopHere) {\n //console.log(\"Page number is less than 0 or the start number is beyond stophere\");\n return 0;\n }\n var i;\n var j;\n var itemRarity;\n var itemCount = start;\n document.getElementById(\"overpanel\").style.display = \"block\";\n var finalHTML = \"<table id=\" + toHTML(\"opTable\") + \">\";\n for (i = 0; i < rows; i++) {\n if (itemCount >= stopHere)\n break;\n finalHTML += \"<tr>\"\n for (j = 0; j < columns; j++) {\n itemRarity = pullFrom[itemCount].rarity;\n finalHTML += \"<th class=\" + toHTML(\"cellcontainer\") + \"onclick=\" + toHTML(\"siteManager.guiSelectItem(siteManager.sManager.\" + slotName + \", \" + pullFrom[itemCount].pKey + \")\") + \"><div class=\" + toHTML(\"holdicon\") + \" style=\" + toHTML(\"background-color:\" + getColor(itemRarity)) + \"><img src=\" + toHTML(filePath + pullFrom[itemCount].icon) + \"></div><div class=\" + toHTML(\"holdname\") + \">\" + pullFrom[itemCount].name + \"</div></th>\";\n itemCount++;\n if (itemCount >= stopHere) {\n finalHTML += \"</tr>\";\n break;\n }\n }\n }\n finalHTML += \"</table><table id=\" + toHTML(\"bottomNav\") + \"><tr><th class=\" + toHTML(\"menuNav\") + \" onclick=\" + toHTML(\"clickedPrev(\" + pageNum + \", siteManager.sManager.\" + slotName + \")\") + \">&lt; PREV</th><th class=\" + toHTML(\"menuBlank\") + \"onclick=\" + toHTML(\"clickedClear(siteManager.sManager.\" + slotName + \")\") + \">CLEAR</th><th class=\" + toHTML(\"menuClose\") + \" onclick=\" + toHTML(\"clickedClose()\") + \">CLOSE</th><th class=\" + toHTML(\"menuNav\") + \" onclick=\" + toHTML(\"clickedNext(\" + pageNum + \", \" + \"siteManager.sManager.\" + slotName + \")\") + \">NEXT &gt;</th></tr></table>\";\n //console.log(finalHTML);\n document.getElementById(\"overpanel\").innerHTML = finalHTML;\n}", "function functionToPanel(panel, func){\n\t\t\tif(Atm.inProcess){\n\t\t\t\tfunctionButton[panel].style.background = functionPanel[func].color;\n\t\t\t\tfunctionButton[panel].innerHTML = functionPanel[func].status;\n\t\t\t\tfunctionButton[panel].onclick = functionPanel[func].func;\n\t\t\t}\n\t\t}", "function convertToPanel(div, title, start_open) {\n var id = div.id;\n\n var content = document.createElement(\"span\");\n content.innerHTML = div.innerHTML;\n div.innerHTML = \"\";\n div.id += \"-wrapper\";\n content.id = id;\n\n div.style.border = '1px solid #b3c9ef';\n div.style.margin = '0.2em 0.2em 0.2em 0.2em';\n div.style.MozBorderRadius = '0.5em';\n div.style.display = 'block';\n\n var tabheader = document.createElement(\"span\");\n tabheader.id = id + \"-tab\";\n\n tabheader.style.backgroundColor = \"#C3D9FF\";\n tabheader.style.color = \"#333333\";\n tabheader.style.fontWeight = \"bold\";\n tabheader.style.paddingBottom = \"0.25em\";\n tabheader.style.paddingLeft = \"0.5em\";\n tabheader.style.paddingTop = \"0.25em\";\n tabheader.style.cursor = \"pointer\";\n tabheader.style.display = \"block\";\n\n content.style.display = \"none\";\n content.style.margin = '0.5em 0.5em 0.5em 0.5em';\n\n tabheader.onclick = function () {\n togglePanelVisibility(id);\n }\n addElement(tabheader, \"img\");\n tabheader.childNodes[0].id = id + \"-img\";\n tabheader.childNodes[0].src = \"/images/arrow-closed.png\";\n addText(tabheader, title);\n\n div.appendChild(tabheader);\n div.appendChild(content);\n\n if (start_open) togglePanelVisibility(id);\n}", "function controlPanel(){\n // Left blue button, turns the ship left\n if(blue1){\n // Button is bright blue and transparent\n fill('rgba(0, 0, 255, 0.5)');\n stroke(0);\n ellipse(width/24, height - height/6, width/15, width/15);\n } else {\n // When pressed the button turns darker\n fill('rgba(0, 0, 100, 0.5)');\n stroke(0);\n ellipse(width/24, height - height/6, width/15, width/15);\n }\n // Right blue button, turns the ship right\n if(blue2){\n // Button is bright blue and transparent\n fill('rgba(0, 0, 255, 0.5)');\n stroke(0);\n ellipse(width/6.2, height - height/6, width/15, width/15);\n } else {\n // When pressed the button turns darker\n fill('rgba(0, 0, 100, 0.5)');\n stroke(0);\n ellipse(width/6.2, height - height/6, width/15, width/15);\n }\n // Middle blue button, moves the ship forward\n if(blue3){\n // Button is bright blue and transparent\n fill('rgba(0, 0, 255, 0.5)');\n stroke(0);\n ellipse(width/9.9, height - height/3.3, width/15, width/15);\n } else {\n // When pressed the button turns darker\n fill('rgba(0, 0, 100, 0.5)');\n stroke(0);\n ellipse(width/9.9, height - height/3.3, width/15, width/15);\n }\n // Right red button, shoots a bullet/blueberry\n if(red1){\n // Button is bright red and transparent\n fill('rgba(255, 0, 0, 0.5)');\n stroke(0);\n ellipse(width - width/11.5, height - height/6, width/15, width/15);\n } else {\n // When pressed the button turns darker\n fill('rgba(100, 0, 0, 0.5)');\n stroke(0);\n ellipse(width - width/11.5, height - height/6, width/15, width/15);\n }\n // Right red button, jumps ship around screen\n if(red2){\n // Button is bright red and transparent\n fill('rgba(255, 0, 0, 0.5)');\n stroke(0);\n ellipse(width - width/5, height - height/6, width/15, width/15);\n } else {\n // When pressed the button turns darker\n fill('rgba(100, 0, 0, 0.5)');\n stroke(0);\n ellipse(width - width/5, height - height/6, width/15, width/15);\n }\n}", "function _setupPanel(panel){\r\n\treturn panel\r\n\t\t.on('panelClosing', function(){\r\n\t\t\tif($('.sub-panel').length <= 1){\r\n\t\t\t\t// XXX when not only the editor is using the panels, this\r\n\t\t\t\t// \t\tis not the correct way to go...\r\n\t\t\t\ttoggleEditor('off')\r\n\t\t\t}\r\n\t\t})\r\n\t\t.on('newPanel', function(evt, panel){\r\n\t\t\t_setupPanel(panel)\r\n\t\t})\r\n\t\t// make clicks on unfocusable elements remove focus...\r\n\t\t.click(function(){\r\n\t\t\tif(event.target != $('.panel :focus')[0]){\r\n\t\t\t\t$('.panel :focus').blur()\r\n\t\t\t}\r\n\t\t})\r\n}", "function surveyControlPanelCreation(app, panel) {\n\n /* Variaveis do painel de controle do survey */\n var grid = app.createGrid(9, 1).setId('surveyGrid');\n var continueLabel = app.createLabel('Para finalizar, responda as perguntas abaixo.').setStyleAttribute(\"fontSize\", \"14\").setVisible(false).setId('continueLabel');\n var referenceLabel = app.createLabel('Por onde você ficou sabendo desse estudo?').setStyleAttribute(\"fontSize\", \"14\").setVisible(false).setId('referenceLabel');\n var referenceListBox = app.createListBox().setName('referenceListBox').setPixelSize(200, 19).setVisible(false).setId('referenceListBoxId');\n referenceListBox.setVisibleItemCount(1);\n referenceListBox.addItem('');\n referenceListBox.addItem('Facebook');\n referenceListBox.addItem('E-mail');\n referenceListBox.addItem('Amigos');\n referenceListBox.addItem('Outro');\n \n var escolarityLabel = app.createLabel('Qual seu grau de escolaridade?').setStyleAttribute(\"fontSize\", \"14\").setVisible(false).setId('escolarityLabel');\n var escolarityListBox = app.createListBox().setName('escolarityListBox').setPixelSize(200, 19).setVisible(false).setId('escolarityListBoxId');\n escolarityListBox.setVisibleItemCount(1);\n escolarityListBox.addItem('');\n escolarityListBox.addItem('1° Grau incompleto');\n escolarityListBox.addItem('1º Grau completo');\n escolarityListBox.addItem('2º Grau completo');\n escolarityListBox.addItem('Especialização ou Ensino Técnico');\n escolarityListBox.addItem('Ensino Superior completo');\n escolarityListBox.addItem('Mestrado');\n escolarityListBox.addItem('Doutorado');\n \n var wroteDownLabel = app.createLabel('Você chegou a anotar a senha atribuida em algum lugar? (online, em e-mails ou serviços de armazenamento; ou offline, em cadernos, folhas ou até mesmo arquivos no computador)').setStyleAttribute(\"fontSize\", \"14\").setVisible(false).setId('wroteDownLabel');\n var wroteDownListBox = app.createListBox().setName('wroteDownListBox').setPixelSize(200, 19).setId('wroteDownListBoxId').setVisible(false);\n wroteDownListBox.setVisibleItemCount(1);\n wroteDownListBox.addItem('');\n wroteDownListBox.addItem('Não');\n wroteDownListBox.addItem('Sim, online');\n wroteDownListBox.addItem('Sim, offline');\n \n var submitButton2 = app.createButton('Submeter!').setVisible(false).setId('submitButton2');\n var thanksLabel = app.createLabel('Novamente agradecemos sua participação. Até logo!').setStyleAttribute(\"fontSize\", \"14\").setVisible(false).setId('thanksLabel');\n \n /* Criacao do painel de controle do survey */\n grid.setWidget(0, 0, continueLabel)\n .setWidget(1, 0, referenceLabel)\n .setWidget(2, 0, referenceListBox)\n .setWidget(3, 0, escolarityLabel)\n .setWidget(4, 0, escolarityListBox)\n .setWidget(5, 0, wroteDownLabel)\n .setWidget(6, 0, wroteDownListBox)\n .setWidget(7, 0, submitButton2)\n .setWidget(8, 0, thanksLabel);\n \n /* Criacao do tratador do botao de submissao */\n var answersHandler = app.createServerClickHandler('submitAnswers');\n answersHandler.addCallbackElement(panel);\n answersHandler.addCallbackElement(referenceListBox);\n answersHandler.addCallbackElement(escolarityListBox);\n answersHandler.addCallbackElement(wroteDownListBox);\n app.getElementById('submitButton2').addClickHandler(answersHandler);\n \n return grid;\n}", "function show_hide_panel(e){\n\t\t\t\t\tif($panel.is_visible()){\n\t\t\t\t\t\t$mainContainer.removeClass(\"lyrics_visible\");\n\t\t\t\t\t}else {\n\t\t\t\t\t\tif($panel.is_popped_in()) $mainContainer.addClass(\"lyrics_visible\");\n\t\t\t\t\t\tif(!cur_song.gotLyrics && cur_song.artist !== \"\"){\n\t\t\t\t\t\t\tcur_song.cur_time = $(\"#time_container_current\").text();\n\t\t\t\t\t\t\t$lyrics.get_lyrics(cur_song, true, [$panel.autoscroll, manual_search]);\n\t\t\t\t\t\t\tcur_song.gotLyrics = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$panel.show_hide_panel(e, site);\n\t\t\t\t}", "function toggleBtnAndPanel(btn, panel){\t\r\n\t\t\t\tvar existingPanel = $(\".sub_panel.shown\");\r\n\t\t\t\tif(!panel.hasClass(\"shown\")) panel.addClass(\"shown\");\r\n\t\t\t\tif(existingPanel) existingPanel.removeClass(\"shown\");\r\n\t\t\t\t\r\n\t\t\t\tvar existingBtn = $(\".panel_btn.active\");\r\n\t\t\t\tif(!btn.hasClass(\"active\"))\tbtn.addClass(\"active\");\r\n\t\t\t\tif(existingBtn)\texistingBtn.removeClass(\"active\");\r\n\r\n\t\t\t\t// we need these checks as another might have been clicked\r\n\t\t\t\t// to remove the search/checkbox panel and so we need to remove\r\n\t\t\t\t// their type of list\r\n\t\t\t\tif(!$searchPanel.hasClass(\"shown\") &&\r\n\t\t\t\t\tFolder.getListedFolder().isSearchResultFolder)\r\n\t\t\t\t\tData.snippets.listSnippets();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t// if checkbox style list is still shown\r\n\t\t\t\tif($containerSnippets.querySelector(\"input[type=\\\"checkbox\\\"]\") &&\r\n\t\t\t\t\t!$bulkActionPanel.hasClass(\"shown\"))\r\n\t\t\t\t\tData.snippets.getUniqueFolder($bulkActionPanel.dataset.originalShownFolderName)\r\n\t\t\t\t\t\t.listSnippets();\t\t\t\t\t\r\n\t\t\t}", "function _imcomp_set_panel(panel_id, is_navigation) {\n\n\tif ( panel_id === IMCOMP_PANEL_NAME.STEP1 ) {\n\t\tdocument.getElementById('top_panel').style.display = 'none';\n\t\tdocument.getElementById('step1_text').style.border = '';\n\t\tshow_instruction(\"Upload at least two of your images below to compare them. <br/> Or try our demo images at the bottom of the page by clicking on them.\");\n\t}\n\n if ( panel_id === IMCOMP_PANEL_NAME.STEP3 ) {\n\n if ( _imcomp.m.file_count < 2 ) {\n\t\t\tshow_instruction(\"Please upload at least two images before moving to the next step.\");\n _imcomp_set_panel(IMCOMP_PANEL_NAME.STEP1, false);\n return;\n }\n\t\tdocument.getElementById('top_panel').style.display = '';\n\t\t// always show the first two images in files panel as the now files\n\t\t_imcomp.c.set_now('base', 0);\n\t\t_imcomp.c.set_now('comp', 1);\n }\n\n // update all buttons\n var blist = document.getElementsByClassName('panel_selector_button');\n var n = blist.length;\n var i;\n for ( i = 0; i < n; ++i ) {\n if ( blist[i].id.startsWith(panel_id) ) {\n blist[i].classList.add('stepn_button_activate');\n blist[i].classList.remove('stepn_button_deactivate');\n } else {\n blist[i].classList.add('stepn_button_deactivate');\n blist[i].classList.remove('stepn_button_activate');\n document.getElementById(panel_id + '_panel').style.display = 'none';\n }\n }\n\n // update all content\n var clist = document.getElementsByClassName('panel_content');\n var n = clist.length;\n var i;\n for ( i = 0; i < n; ++i ) {\n if ( clist[i].id.startsWith(panel_id) ) {\n clist[i].style.display = 'block';\n _imcomp_set_panel_content(panel_id, is_navigation);\n } else {\n clist[i].style.display = 'none';\n }\n }\n\t// highlight instructions for the page\n\t_imcomp.c.brighten_instructions(panel_id);\n}", "function CreateSpecialOfferPanel(name, percentage, command)\n{\n /**\n Create a panel for insert/editing special_offers and add on the body\n\n :param name String:\n The name of the special_offer that will be showing on the input name\n\n :param percentage String:\n The percentage of the special_offer that will be showing on the input percentage\n\n :param command String:\n 'Insert'\n 'Edit'\n 'Delete'\n */\n\n // Format the title according the Command parameter\n var title = '';\n switch (command) {\n case COMMAND_INSERT : title = PANEL_TITLE_ADDING_SPECIAL_ORDER; break;\n case COMMAND_EDIT : title = PANEL_TITLE_EDITING_SPECIAL_ORDER; break;\n case COMMAND_DELETE : title = PANEL_TITLE_DELETING_SPECIAL_ORDER; break;\n }\n\n // Create the background panel element object\n panel_bg = document.createElement('div');\n panel_bg.className = 'panel_bg';\n panel_bg.id = 'panel_bg';\n\n // Create the panel element object\n panel = document.createElement('div');\n panel.className = 'panel';\n panel.id = 'panel';\n\n // Create the content of the panel\n var panel_content = '';\n panel_content += ' <div class=\"tit\">' + title + '</div>';\n panel_content += ' <div class=\"lin\">';\n panel_content += ' <label>Name</label>';\n panel_content += ' <input type=\"text\" id=\"spo_name\" value=\"' + name + '\" placeholder=\"SpecialOffer name\" />';\n panel_content += ' </div>';\n panel_content += ' <div class=\"lin\">';\n panel_content += ' <label>Percentage</label>';\n panel_content += ' <input type=\"text\" id=\"spo_percentage\" value=\"' + percentage + '\" placeholder=\"only the number\" />';\n panel_content += ' </div>';\n panel_content += ' <div class=\"buttons\">';\n panel_content += ' <div class=\"btn\" id=\"panel_save\" onclick=\"Do' + command + 'SpecialOffer();\">Save</div>';\n panel_content += ' <div class=\"btn\" id=\"panel_cancel\" onclick=\"DoCancel' + command + 'SpecialOffer();\">Cancel</div>';\n panel_content += ' <div style=\"clear:both;\"></div>';\n panel_content += ' </div>';\n\n panel.innerHTML = panel_content;\n\n // Insert the panel and background panel to the body\n document.body.appendChild(panel_bg);\n document.body.appendChild(panel);\n\n // Associate the objects of the panel into variables\n obj_spo_name = document.getElementById('spo_name');\n obj_spo_percentage = document.getElementById('spo_percentage');\n}", "function PanelDeleteTip() {\r\n\r\n this.actv= function( ast ) {\r\n let ids= ast.editor.map.selection.getIds();\r\n let panelObjects= [];\r\n let panelLegIds= [];\r\n let panelLegColor= [];\r\n let panelLegIndices= [];\r\n\r\n // save data of every deleted Panel to array\r\n for( let i= 0; i!= ids.length; i++ ) {\r\n panelObjects[i]= ast.editor.map.get(ids[i]);\r\n panelLegIds[i]= panelObjects[i].panelLegId;\r\n panelLegIndices[i]= panelObjects[i].panelLegIndex;\r\n if(panelObjects[i].panelLegId !== -1) {\r\n panelLegColor[i]= ast.editor.map.legs.arr[ panelLegIds[i] ].getHexColor();\r\n }\r\n ast.editor.map.removePanel( ids[i] );\r\n }\r\n\r\n if(panelObjects.length > 0) {\r\n ast.pushAction( 'panel-delete', { panelObjects: panelObjects, legIds: panelLegIds,\r\n legIndices: panelLegIndices, legColor: panelLegColor\r\n } );\r\n }\r\n ast.setToolTip( 'cursor-tip' ); // go back to simple cursor\r\n }\r\n\r\n this.undo= function( ast, t, d ) {\r\n // for each panel which has been deleted\r\n for( let i= d.panelObjects.length-1; i >= 0; i-- ) {\r\n d.panelObjects[i].requestScreen();\r\n if(d.legIds[i] !== -1) {\r\n // if leg was deleted -> recreate leg\r\n if(ast.editor.map.legs.get(d.legIds[i]) === null) {\r\n //recreate leg with last color\r\n ast.editor.map.legs.addLeg(d.legIds[i]);\r\n ast.editor.map.legs.arr[d.legIds[i]].setHexColor(d.legColor[i]);\r\n // set background color of sidebar Leg element\r\n let ele= document.getElementById(\"panelLegHolder\");\r\n ele.legArray[d.legIds[i]].childNodes[0].style.backgroundColor= d.legColor[i];\r\n }\r\n }\r\n // reassign lost Leg data\r\n d.panelObjects[i].panelLegId= d.legIds[i];\r\n d.panelObjects[i].panelLegIndex= d.legIndices[i];\r\n // recreate Panel\r\n ast.editor.map.attachPanel( d.panelObjects[i] );\r\n\r\n }\r\n }\r\n\r\n this.redo= function( ast, t, d ) {\r\n for( let i= 0; i!= d.panelObjects.length; i++ ) {\r\n ast.editor.map.removePanel( d.panelObjects[i].panelId );\r\n }\r\n }\r\n\r\n this.intf= new ActionInterface( this, 'panel-delete', [this.actv, null, null, null, null, null, null, null, this.undo, this.redo]);\r\n\r\n}", "function togglePanel() {\n renewElement($(\".anim-wrap\"));\n var $animated = $(\".anim-wrap\");\n var shown = $animated.hasClass('on');\n $animated.toggleClass('on', !shown).toggleClass('off', shown);\n }", "function xTabPanelGroup(id, w, h, th, clsTP, clsTG, clsTD, clsTS) // object prototype\r\n{\r\n // Private Methods\r\n\r\n function onClick() //r7\r\n {\r\n paint(this);\r\n return false;\r\n }\r\n function onFocus() //r7\r\n {\r\n paint(this);\r\n }\r\n function paint(tab)\r\n {\r\n tab.className = clsTS;\r\n xZIndex(tab, highZ++);\r\n xDisplay(panels[tab.xTabIndex], 'block'); //r6\r\n if (selectedIndex != tab.xTabIndex) {\r\n xDisplay(panels[selectedIndex], 'none'); //r6\r\n tabs[selectedIndex].className = clsTD;\r\n selectedIndex = tab.xTabIndex;\r\n }\r\n }\r\n\r\n // Private Properties\r\n\r\n var panelGrp, tabGrp, panels, tabs, highZ, selectedIndex;\r\n \r\n // Public Methods\r\n\r\n this.select = function(n) //r7\r\n {\r\n if (n && n <= tabs.length) {\r\n var t = tabs[n-1];\r\n if (t.focus) t.focus();\r\n else t.onclick();\r\n }\r\n };\r\n this.onUnload = function()\r\n {\r\n if (!window.opera) for (var i = 0; i < tabs.length; ++i) {tabs[i].onfocus = tabs[i].onclick = null;}\r\n };\r\n this.onResize = function(newW, newH) //r9\r\n {\r\n var x = 0, i;\r\n // [r9\r\n if (newW) {\r\n w = newW;\r\n xWidth(panelGrp, w);\r\n }\r\n else w = xWidth(panelGrp);\r\n if (newH) {\r\n h = newH;\r\n xHeight(panelGrp, h);\r\n }\r\n else h = xHeight(panelGrp);\r\n // r9]\r\n xResizeTo(tabGrp[0], w, th);\r\n xMoveTo(tabGrp[0], 0, 0);\r\n w -= 2; // remove border widths\r\n var tw = w / tabs.length;\r\n for (i = 0; i < tabs.length; ++i) {\r\n xResizeTo(tabs[i], tw, th); \r\n xMoveTo(tabs[i], x, 0);\r\n x += tw;\r\n tabs[i].xTabIndex = i;\r\n tabs[i].onclick = onClick;\r\n tabs[i].onfocus = onFocus; //r7\r\n xDisplay(panels[i], 'none'); //r6\r\n xResizeTo(panels[i], w, h - th - 2); // -2 removes border widths\r\n xMoveTo(panels[i], 0, th);\r\n }\r\n highZ = i;\r\n tabs[selectedIndex].onclick(); //r9\r\n };\r\n\r\n // Constructor Code\r\n\r\n panelGrp = xGetElementById(id);\r\n if (!panelGrp) { return null; }\r\n panels = xGetElementsByClassName(clsTP, panelGrp);\r\n tabs = xGetElementsByClassName(clsTD, panelGrp);\r\n tabGrp = xGetElementsByClassName(clsTG, panelGrp);\r\n if (!panels || !tabs || !tabGrp || panels.length != tabs.length || tabGrp.length != 1) { return null; }\r\n selectedIndex = 0;\r\n this.onResize(w, h); //r9\r\n}", "addPanel(component) {\nthis\n.addInfoToComponent(component, formEditorConstants.COMPONENT_TYPE_PANEL)\n.addProperty(component, 'name', this._componentList.findComponentText(component.type, 'name', 'Panel'))\n.addProperty(component, 'zIndex', 0)\n.addProperty(component, 'width', 200)\n.addProperty(component, 'height', 128);\nif (!('containerIds' in component)) {\nthis.addProperty(component, 'containerIds', [this._formEditorState.getNextId()]);\n}\nreturn component;\n}", "addPanel(params) {\n // Remove existing one. Can be added by a reload.\n if (this.getPropertyValue(params.id, 'id')) {\n this.removePanel(params.id);\n }\n\n const newPanel = {\n [params.id]: {\n id: params.id,\n $panel: $('#' + params.id),\n visible: params.visible,\n closeSelector: params.closeSelector,\n url: params.url,\n modal: params.modal,\n triggerElement: null,\n triggeredActive: { element: null, css: null },\n warning: { selector: params.warning.selector, trigger: params.warning.trigger },\n clearable: params.clearable,\n loader: { selector: params.loader.selector, trigger: params.loader.trigger },\n hasClickAway: params.hasClickAway,\n hasEscAway: params.hasEscAway,\n modalAction: null,\n },\n };\n\n // add click handler for closing panel.\n newPanel[params.id].$panel.on('click', params.closeSelector, () => {\n this.closePanel(params.id);\n });\n\n newPanel[params.id].$panel.appendTo($('.atk-side-panels'));\n\n this.service.panels.push(newPanel);\n }", "function createPanels() {\n // Create styles\n let style = document.createElement(\"style\");\n style.innerHTML = `\n .conv-div-panel {\n background-color: #fafafa !important;\n display: inline-block !important;\n padding: 0px !important;\n text-align: center !important;\n max-width: 300px !important;\n border: 1px solid #3FA9D3 !important;\n border-radius: 10px !important;\n position: fixed !important;\n right: 20px !important;\n top: 20px !important;\n z-index: 1000000 !important;\n user-select: none !important;\n cursor: pointer !important;\n }\n .conv-p-title {\n margin: 0px !important;\n padding: 6px 12px 2px 12px !important;\n font-size: 14px !important;\n text-indent: 0px !important;\n color: #0067e5 !important;\n }\n .conv-p-result {\n margin: 0px !important;\n padding: 2px 12px 6px 12px !important;\n font-size: 14px !important;\n text-indent: 0px !important;\n color: #000 !important;\n }\n .conv-p-red {\n color: red !important;\n }\n .conv-hide {\n display: none !important;\n }\n .conv-div-count {\n background-color: #fafafa !important;\n padding: 0px !important;\n text-align: center !important;\n min-width: min-content !important;\n border: 1px solid #3FA9D3 !important;\n border-radius: 10px !important;\n position: fixed !important;\n right: 10px !important;\n bottom: 10px !important;\n z-index: 1000000 !important;\n user-select: none !important;\n margin: 0px !important;\n padding: 3px 6px 3px 6px !important;\n font-size: 12px !important;\n text-indent: 0px !important;\n color: #2f2f2f !important;\n }\n .conv-span-blue {\n color: #0067e5 !important;\n color: #0051b5 !important;\n }\n `;\n document.querySelector(\"head\").appendChild(style);\n\n // Top right panel\n\n // Create div\n let divPanel = document.createElement(\"div\");\n divPanel.id = \"convertPanel\";\n divPanel.className = \"conv-div-panel conv-hide\";\n divPanel.title = \"Click to copy result\";\n\n // Create title\n let pTitle = document.createElement(\"p\");\n pTitle.className = \"conv-p-title\";\n let tTitle = document.createTextNode(\"\");\n pTitle.appendChild(tTitle);\n\n // Create result box\n let pResult = document.createElement(\"p\");\n pResult.className = \"conv-p-result\";\n let tResult = document.createTextNode(\"\");\n pResult.appendChild(tResult);\n\n // Create horz line for separation\n let hr = document.createElement(\"hr\");\n hr.style.maxWidth = \"95%\";\n hr.style.margin = \"0 auto\";\n\n // Append to page\n divPanel.appendChild(pTitle);\n divPanel.appendChild(hr);\n divPanel.appendChild(pResult);\n document.body.appendChild(divPanel);\n\n // Better readability\n panel = document.querySelector(\"#convertPanel\");\n title = document.querySelector(\"#convertPanel p.conv-p-title\");\n line = document.querySelector(\"#convertPanel hr\");\n result = document.querySelector(\"#convertPanel p.conv-p-result\");\n\n // Initially hide them\n finalText = \"...\";\n\n // Event listeners\n // When user hovers over panel\n panel.addEventListener(\"mouseover\", (event) => (canHide = false));\n panel.addEventListener(\"mouseout\", (event) => {\n if (!canHide) {\n title.textContent = finalTitle;\n }\n canHide = true;\n });\n panel.addEventListener(\"click\", async (event) => {\n try {\n if (finalText != \"...\") {\n await navigator.clipboard.writeText(finalText);\n title.textContent = \"copied\";\n }\n } catch (err) {\n console.error(\"Failed to copy!\", err);\n }\n });\n\n // Bottom right panel\n\n // Create div\n let divCount = document.createElement(\"div\");\n divCount.id = \"convCountPanel\";\n divCount.className = \"conv-div-count conv-hide\";\n\n // Create count box\n let pCount = document.createElement(\"p\");\n pCount.className = \"conv-p-count\";\n pCount.appendChild(tResult);\n\n // Create spans\n let pSpan1 = document.createElement(\"span\");\n pSpan1.className = \"conv-span-blue\";\n let tSpan1 = document.createTextNode(\"\");\n pSpan1.appendChild(tSpan1);\n\n let pSpan2 = document.createElement(\"span\");\n pSpan2.className = \"\";\n let tSpan2 = document.createTextNode(\" chars. \");\n pSpan2.appendChild(tSpan2);\n\n let pSpan3 = document.createElement(\"span\");\n pSpan3.className = \"conv-span-blue\";\n let tSpan3 = document.createTextNode(\"\");\n pSpan3.appendChild(tSpan3);\n\n let pSpan4 = document.createElement(\"span\");\n pSpan4.className = \"\";\n let tSpan4 = document.createTextNode(\" words. \");\n pSpan4.appendChild(tSpan4);\n\n // Append\n Object.values([pSpan1, pSpan2, pSpan3, pSpan4]).forEach((span) => {\n divCount.appendChild(span);\n });\n\n document.body.appendChild(divCount);\n\n count = document.querySelector(\"#convCountPanel\");\n span1 = document.querySelector(\"#convCountPanel :nth-child(1)\");\n span2 = document.querySelector(\"#convCountPanel :nth-child(2)\");\n span3 = document.querySelector(\"#convCountPanel :nth-child(3)\");\n span4 = document.querySelector(\"#convCountPanel :nth-child(4)\");\n}", "function showImgPanel(e, theInstance, theImgSrc, theWitness, theFolioString, theFolio, x, y, panZoom) {\n \n var offx = (x)? x-0 : 20;\n var offy = (y)? y-0: 20;\n var theHandle = document.getElementById(\"handle\" + \"_\" + theInstance);\n var theRoot = document.getElementById(\"panel\" + \"_\" + theInstance);\n var theContent = document.getElementById(\"content\" + \"_\" + theInstance);\n var theTitle = document.getElementById(\"title\" + \"_\" + theInstance);\n var theImg = \"<img title='Page image' alt='Page image' src='\"+ theImgSrc + \"'>\";\n \n // Override: set our global imagePanelId according to the argument sent\n imagePanelId = \"panel\" + \"_\" + theInstance;\n \n // Start Override: change theImg if the panZoom flag has been passed\n if (panZoom) {\n // get the folio from theImgSrc, not from theFolio (which is just the folio number without identifying the witness)\n folio = folioFromImageSrc(theImgSrc);\n theImg = \"<div id='\" + mapContainerId + \"'></div>\";\n }\n // End Override: change theImg if the panZoom flag has been passed\n \n Drag.init(theRoot, theRoot);\n /* theRoot.onDragStart=makePanelTop; */\n theRoot.onDrag=pStyleDrag;\n \n // Start Override: we want to reset originalImagePanelPos at the end of dragging\n theRoot.onDragEnd= function() {\n pStyleDragEnd.apply(this);\n //this.style.opacity = '1.0'; \n //this.style.filter = \"alpha(opacity=100)\";\n \t originalImagePanelSize = getImagePanelSize();\n originalImagePanelPos.x = theRoot.offsetLeft;\n originalImagePanelPos.y = theRoot.offsetTop;\n \n } \n \n // Override: set the cursor back to the move cursor (we change it later for inline panel)\n theRoot.root.style.cursor = \"move\";\n \n panels[panels.length]=theRoot;\n /* panels[panels.length-1].style.zIndex = panels.length - 1; */\n \n // Override: test for e (MouseEvent). If not the panel will be positioned later \n if (e) {\n positionPanel(e,theRoot,offx,offy);\n originalImagePanelPos.x = theRoot.offsetLeft;\n originalImagePanelPos.y = theRoot.offsetTop;\n }\n \n theContent.innerHTML = theImg;\n \n /*if (theWitness != '' && theFolioString != '' && theFolio != '') {\n theTitle.innerHTML = \"Image Viewer [witness \" + theWitness + \", \" + theFolioString + \" \" + theFolio + \"]\";\n }\n else if (theWitness != '' && folio != '') {\n theTitle.innerHTML = \"Image Viewer [witness \" + theWitness + \", folio \" + folio + \"]\";\n }\n else*/ if (theWitness != '') {\n theTitle.innerHTML = \"Image Viewer [witness \" + theWitness + \"]\"; \n }/*\n else if (folio != '') {\n theTitle.innerHTML = \"Image Viewer [folio \" + folio + \"]\"; \n }\n else {\n theTitle.innerHTML = \"Image Viewer\";\n }*/\n theRoot.style.visibility = \"visible\";\n \n // Start Override:\n // if our panel is to be displayed inline with other panels\n // we need to resize all panels to accommodate, and disable dragging. If not\n // displayed in a panel we need to set the imagePanel's width back to its\n // original width in case it was resized before. Add the PanZoom image\n // and call functions to resize and scroll the panel to the appropriate\n // size and location\n if (imagePanelInline) {\n resizePanels(); \n // disable Drag - we need to because the imagePanel Object was only hidden \n // before, and still has these properties if it was previously a pop up\n theRoot.onmousedown\t= null;\n theRoot.root.onDragStart\t= null;\n theRoot.root.onDragEnd\t= null;\n theRoot.root.onDrag\t\t= null;\n theRoot.root.style.cursor = \"default\";\n // avoid covering popup notes (z-index of 24)\n theRoot.style.zIndex = \"10\";\n }\n else {\n if (originalImagePanelSize) theRoot.style.width = originalImagePanelSize.w + \"px\";\n // popup notes are children of the links that pop them, so if our z-index is lower\n // than the popup notes, the links will also be above the image\n theRoot.style.zIndex = \"100\";\n } \n if (panZoom) {\n addPanZoomImage(mapContainerId);\n onscroll=function(){ scrollPanZoomImage(); }; \n onresize=function(){ resizePanels(); };\n // if imagePanel is inline we will have already called resizePanZoomImage through resizePanels\n if (!imagePanelInline) resizePanZoomImage(); \n scrollPanZoomImage();\n }\n \n // if the image is in a popup, adjust its position\n // if it is partially offscreen\n if (!imagePanelInline) {\n adjustIfImagePanelIsOffscreen();\n }\n // end Override\n \n}", "function initPanel() {\n\tvar i;\n\tallpanel = document.getElementsByClassName(\"settingPanel\");\n\tallpanelholder = document.getElementById(\"settingpanelgroup\");\n\tfor (i = 0;i < allpanel.length;++i)\n\t{\n\t\tallpanel[i].style.height = allpanel[i].offsetHeight + \"px\";\n\t\tallpanel[i].firstElementChild.addEventListener('click',changePanel);\n\t\tallpanel[i].classList.remove(\"selected\");\n\t}\n\tallpanel[0].firstElementChild.click();\n\tallpanelholder.setAttribute(\"contextualType\",\"normal\");\n}", "function ControlPanel(options, containerId, factorSelections, multiSelect, theme){\r\n this.selected = [];\r\n this.panels = {};\r\n this.container = containerId;\r\n this.controls = options.Options;\r\n this.misc = [options.DateCreated, options.ManagerID, options.ID, options.Name, options.Tickers, options.ProfileName];\r\n this.current = '';\r\n this.factorSelections = factorSelections || [];\r\n this.groups = {}\r\n this.ap = new AddPanel();\r\n this.multiSelect = multiSelect || false;\r\n this.theme = theme || 'default';\r\n\r\n $(\"#\"+this.container).data({cp: this});\r\n}", "function TcPermDetailsPanel() {}", "function addPanel(panel) {\n\t _.defaults(panel, {\n\t size_x: 3,\n\t size_y: 2\n\t });\n\n\t // ignore panels that don't have vis id's\n\t if (!panel.id) {\n\t // In the interest of backwards compat\n\t if (panel.visId) {\n\t panel.id = panel.visId;\n\t panel.type = 'visualization';\n\t delete panel.visId;\n\t } else {\n\t throw new Error('missing object id on panel');\n\t }\n\t }\n\n\t panel.$scope = $scope.$new();\n\t panel.$scope.panel = panel;\n\t panel.$scope.parentUiState = $scope.uiState;\n\n\t panel.$el = $compile('<li><dashboard-panel></li>')(panel.$scope);\n\n\t // tell gridster to use the widget\n\t gridster.add_widget(panel.$el, panel.size_x, panel.size_y, panel.col, panel.row);\n\n\t // update size/col/etc.\n\t refreshPanelStats(panel);\n\n\t // stash the panel and it's scope in the element's data\n\t panel.$el.data('panel', panel);\n\t panel.$el.data('$scope', panel.$scope);\n\t }", "make_control_panel()\r\n {\r\n /* Add a button for controlling the scene. */\r\n this.key_triggered_button( \"Change Colors\", [ \"c\" ], this.set_colors );\r\n\r\n /* toggle your outline on and off */\r\n this.key_triggered_button( \"Outline\", [ \"o\" ], () => {\r\n this.drawing_outlines = !this.drawing_outlines;\r\n } );\r\n\r\n /* toggle swaying on and off */\r\n this.key_triggered_button( \"Sit still\", [ \"m\" ], () => {\r\n this.is_swaying = !this.is_swaying;\r\n } );\r\n\r\n /* toggle extra credit scaling on and off */\r\n this.new_line();\r\n this.key_triggered_button( \"Extra credit part II\", [ \"x\" ], () => {\r\n this.extraCreditII = !this.extraCreditII;\r\n } );\r\n\r\n /* change the max angle */\r\n this.new_line();\r\n this.key_triggered_button( \"max angle-\", [ \"k\" ], () => {\r\n this.maxAngle += 0.01\r\n } );\r\n this.live_string( box => { box.textContent = \"max angle: \" + (-1*this.maxAngle.toFixed(2)) } );\r\n this.key_triggered_button( \"max angle+\", [ \"l\" ], () => {\r\n this.maxAngle -= 0.01;\r\n } );\r\n\r\n /* change the hertz */\r\n this.new_line();\r\n this.key_triggered_button( \"hertz-\", [ \"[\" ], () => {\r\n this.hertz -= 0.1;\r\n if (this.hertz < 0) this.hertz = 0;\r\n } );\r\n this.live_string( box => { box.textContent = \"Hertz: \" + this.hertz.toFixed(1) } );\r\n this.key_triggered_button( \"hertz+\", [ \"]\" ], () => {\r\n this.hertz += 0.1;\r\n } );\r\n }", "function McSuperPanel(d){\"use strict\";var A=\"replace\",k=\"display\",h=\"className\",e=\"length\",q=\"addEventListener\",b=\"style\";if(typeof String.prototype.trim!==\"function\")String.prototype.trim=function(){return this[A](/^\\s+|\\s+$/g,\"\")};var l=document,r=\"getElementById\",i=setTimeout,n=function(a,b){return l[a](b)},L=function(a,d){if(typeof getComputedStyle!=\"undefined\")var c=getComputedStyle(a,null);else if(a.currentStyle)c=a.currentStyle;else c=a[b];return c[d]},v=0,p,a,f=[],c=0,j=0,g=0,E=function(a){if(g){g[b].opacity=0;if(a){g[b][k]=\"block\";i(function(){g[b].opacity=1},0)}else i(function(){g[b][k]=\"none\"},350)}},m=function(a,c,b){if(a[q])a[q](c,b,false);else a.attachEvent&&a.attachEvent(\"on\"+c,b)},K=function(a,c){var b=a[e];while(b--)if(a[b]===c)return true;return false},z=function(b,a){return K(b[h].split(\" \"),a)},y=function(a,b,c){if(!z(a,b))if(!a[h])a[h]=b;else if(c)a[h]=b+\" \"+a[h];else a[h]+=\" \"+b},F=function(c,f){if(c[h]){for(var d=\"\",b=c[h].split(\" \"),a=0,g=b[e];a<g;a++)if(b[a]!==f)d+=b[a]+\" \";c[h]=d.trim()}},G=function(a){if(a&&a.stopPropagation)a.stopPropagation();else if(window.event)window.event.cancelBubble=true},J=function(b){var a=b||window.event;if(a.preventDefault)a.preventDefault();else if(a)a.returnValue=false},t=function(h){h&&o(0);clearTimeout(c.g);for(var g=0;g<f[e];g++)F(f[g],\"active\");if(!v)if(c.a==\"default\")a[b].opacity=0;else{a[b].opacity=0;var d=\"0,0\";switch(c.a){case\"top\":d=\"0,-\"+c.b;break;case\"bottom\":d=\"0,\"+c.b;break;case\"right\":d=c.b+\",0\";break;case\"left\":d=\"-\"+c.b+\",0\"}a[b].transform=a[b].WebkitTransform=\"translate(\"+d+\") translateZ(0)\"}c.g=i(function(){F(a,\"active\");a[b][k]=\"none\";o(p)},p+20);E(0)},x=function(g){g&&o(0);clearTimeout(c.g);for(var d=0;d<f[e];d++)y(f[d],\"active\");y(a,\"active\");a[b][k]=\"\";if(!v)if(c.a===0)i(function(){a[b].opacity=1},0);else i(function(){a[b].opacity=1;a[b].transform=a[b].WebkitTransform=\"translate(0,0) translateZ(0)\";o(p)},0);E(1)},H=function(d){if(z(f[0],\"active\"))t();else{var e=d.target||d.srcElement,a=e.getAttribute(\"data-click\");if(a){a=s(a);window[a[0]]&&window[a[0]].apply(a.splice(0,1),a)}var b=e.getAttribute(\"data-ajax\");if(b){b=s(b);var c=new XMLHttpRequest;c.onreadystatechange=function(){if(c.readyState==4&&c.status==200){var a=c.responseText,d=/^[\\s\\S]*<body[^>]*>([\\s\\S]+)<\\/body>[\\s\\S]*$/i;if(d.test(a))a=a[A](d,\"$1\");a=a.trim();window[b[1]].apply(b.splice(0,2,a),b)}};c.open(\"GET\",b[0],true);c.send()}(a||b)&&e.getAttribute(\"href\")==\"#\"&&J(d);x()}G(d)},C=function(){return window.innerWidth||l.documentElement.clientWidth||l.body.clientWidth},D=function(){return window.screen.width},B=function(){var a=c.e[0],d=c.e[1],h=c.f===1;if(c.c){var i=c.d?D():C();if(i>c.c){a=c.e[2];d=c.e[3]}if(c.f[0]!=a||c.f[1]!=d){h=1;c.f=[a,d]}}if(h){for(var g=0;g<f[e];g++)f[g][b][k]=a?\"\":\"none\";if(d)x(1);else t(1)}},o=function(c){a[b].transition=a[b].WebkitTransition=a[b].msTransition=\"all \"+c+\"ms ease-in\"},M=function(){var c,g,a;if(l.getElementsByClassName)c=n(\"getElementsByClassName\",\"panel-button\");else{c=[];var h=l.getElementsByTagName(\"*\");a=h[e];while(a--)z(h[a],\"panel-button\")&&c.push(h[a])}a=c[e];while(a--){g=c[a].getAttribute(\"data-panel\");if(!g||g==d.panelId){c[a][b].zIndex=j+1;f.push(c[a])}}},u=function(c,b){var a=false;if(c[e]>b){a=c.charAt(b).toLowerCase()==\"y\";if(!b&&!f)a=false}return a},s=function(a){return a[A](/\\s/g,\"\").split(\",\")},w=function(){a=n(r,d.panelId);if(a){v=typeof a[b].transition==\"undefined\"&&typeof a[b].WebkitTransition==\"undefined\";p=v?0:d.speed;j=L(a,\"zIndex\");if(/^[\\d\\-]+$/.test(j))j=parseInt(j);else j=2;M();var w,x,k,l,h=[];w=k=f?1:0;x=l=0;if(d.showMode&&d.showMode!=\"default\"){h=s(d.showMode);if(h[e]>0){w=k=u(h[0],0);x=l=u(h[0],1);if(h[e]>2){k=u(h[2],0);l=u(h[2],1)}}}var q=s(d.slideInFrom),A=q[e]>1?q[1]:\"120%\";c={a:q[0],b:A,c:h[e]>1?parseInt(h[1]):0,d:h[e]>1?h[1].indexOf(\"d\")!=\"-1\":0,e:[w,x,k,l],f:1,g:1};if(d.transparentLayer){g=n(\"createElement\",\"div\");y(g,\"transparent-layer\");a.parentNode.insertBefore(g,a);g[b].zIndex=j-1;m(a,\"click\",G);m(g,\"click\",function(){t(0)})}for(var z=0;z<f[e];z++)m(f[z],\"click\",H);o(p);B();c.c&&m(window,\"resize\",B);a[b].visibility=\"visible\"}typeof d.initCallback==\"function\"&&i(d.initCallback,0);if(d.resizeCallback){m(window,\"resize\",d.resizeCallback);i(d.resizeCallback,0)}},I=function(c){var a=0;function b(){if(a)return;a=1;i(c,14)}if(l[q])l[q](\"DOMContentLoaded\",b,false);else m(window,\"load\",b)};if(n(r,d.panelId))w();else I(w);return{init:function(){!a&&w()},getDeviceWidth:D,getBrowserWidth:C,show:function(d){var c=n(r,d);if(c)if(c==a)x(1);else c[b][k]=\"\"},hide:function(d){var c=n(r,d);if(c)if(c==a)t(1);else c[b][k]=\"none\"}}}", "function showNextPanel() {\r\n $(this).removeClass('active');\r\n\r\n $('#'+panelToShow).fadeIn(function() {\r\n $(this).addClass('active');\r\n });\r\n }", "function panelShow(to, name){\n\n\tpanelView = name;\n\t$('#panel, #action').css({'height' : to+'px', 'display' : 'block', 'opacity' : '0'});\n\t\n\t$('#main_').animate({\n\t\t'top' : (paneltop + to)\n\t}, 218, function() {\n\t\t$('#panel, #action').fadeTo(150, 1);\n\t});\n\n\t$('#button-hidepanel').css('display', '');\n\t\n}", "function sidePanel() {\n var x = document.getElementById(\"panelOpen\");\n if (x.style.display === \"none\") {\n x.style.display = \"block\";\n } else {\n x.style.display = \"none\";\n }\n}", "function mostrarPanel(panel) {\n let expandedPanel = accordionElem.querySelector(\".active\");\n if (expandedPanel) {\n expandedPanel.classList.remove(\"active\");\n } else {\n panel.classList.add(\"active\");\n }\n }", "function getPanelFor(el) {\n\t var $panel = el.jquery ? el : $(el);\n\t var panel = $panel.data('panel');\n\n\t panel.$el = $panel;\n\t panel.$scope = $panel.data('$scope');\n\n\t return panel;\n\t }", "function control(params) {\n \n // we are being told that the helper is hiding/showing - we can decide to follow this\n // in this example, we dont follow the 'hide' messages, but we do listen to changes and choose to show the panel\n \n if (params.hidden != undefined) {\n tml3dRenderer.setProperties ('opboard',{ // let's use the default look of the control panel shader:twx.app.isPreview() ? \"Default\" : \"foggedLit\", \n hidden:false}); // dont listen to hide messages params.hidden});\n tml3dRenderer.setProperties ('nextButton', {hidden:$scope.pois.length<=1}); \n tml3dRenderer.setProperties ('addButton', {hidden:false}); \n }\n \n // we are being told the helper is moving - we can decide to follow this\n if (params.location != undefined) {\n tml3dRenderer.setTranslation('opboard',params.location.X(), params.location.Y(), params.location.Z());\n tml3dRenderer.setRotation ('opboard',params.orientation.X(),params.orientation.Y(),params.orientation.Z());\n \n // we can also place other content on/relative to the helper - here's an example of a 3d button\n positionwidget('nextButton',params);\n positionwidget('addButton', params);\n \n }\n \n }", "toggle() {\n this.panelOpen ? this.close() : this.open();\n }", "setNextPanel() {\n\n this.panels.forEach( ( panel ) => {\n\n this.remove( panel );\n\n });\n\n this.currentPanel = (this.currentPanel + 1) % (this.panels.length);\n\n this.add( this.panels[ this.currentPanel ] );\n\n this.update( true, true, true );\n\n }", "showPanel()\n\t{\n\t\tthis.modalPanel.show();\n\t}" ]
[ "0.74158674", "0.6937558", "0.66936165", "0.66304797", "0.66304797", "0.6625742", "0.6581457", "0.6517481", "0.651188", "0.6504578", "0.64080423", "0.6366527", "0.63622344", "0.6327781", "0.63234264", "0.6313651", "0.62925214", "0.6292424", "0.629154", "0.62834483", "0.62818676", "0.62783974", "0.62628996", "0.625666", "0.62459874", "0.62374896", "0.6217725", "0.62084746", "0.6200496", "0.61866367", "0.6173892", "0.6169779", "0.6160589", "0.6158159", "0.61556566", "0.61556566", "0.6154611", "0.6146101", "0.61447984", "0.6093155", "0.6083652", "0.6080157", "0.6069133", "0.6060856", "0.606012", "0.6032873", "0.60039735", "0.5987065", "0.5976774", "0.5975412", "0.5975104", "0.59728277", "0.59719396", "0.5957108", "0.5953871", "0.59471965", "0.59414", "0.5938212", "0.59339005", "0.59306157", "0.5927339", "0.59199953", "0.5913345", "0.59111595", "0.59038985", "0.5897239", "0.5889901", "0.5889317", "0.5887348", "0.5886135", "0.58817506", "0.58816767", "0.5871196", "0.58647466", "0.5863937", "0.5860229", "0.5858956", "0.5856532", "0.5855096", "0.58490294", "0.58452684", "0.5841791", "0.5839425", "0.58215195", "0.5821104", "0.5820073", "0.5811488", "0.58098346", "0.58012366", "0.5796537", "0.5795824", "0.57800746", "0.57745075", "0.57696974", "0.57569814", "0.5753679", "0.57493466", "0.574329", "0.5741782", "0.57417023", "0.5741565" ]
0.0
-1
Attenuator interface functions /////////////////////////////////////////////////
function set_db(value, data) { commands = ""; if (value == "field") { if (data) { value = data; } else if ($('#I_ATT_DB').val() == "") { alert("ERROR: Empty dB value"); return; } else { value = $('#I_ATT_DB').val(); } commands = '"STA OPE 0",' } commands = commands + '"ATT A' + Math.round(parseFloat(value)*100)/100 + '","ATT D"'; to_refresh = '"ATT_LAST","ATT_DB","ATT_PERCENT","ATT_POS"' input_disable(to_refresh, attenuator_buttons); laserServer(commands, to_refresh, 0, function() { input_enable(to_refresh, attenuator_buttons + "," + attenuator_fields); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Alerter() {}", "function Assoc(){}", "function ea(){}", "function IndividualAttestation() {}", "function IUIMenuBaseProcessor() {}", "function VIEWAS_aim_IMme(obj) {\n var anchor = myDocument.createElement('a');\n anchor.setAttribute('href', \"aim:goim?screenname=\" + obj.value + \"&message=hello\");\n anchor.setAttribute('title', \"IM me!\");\n anchor.appendChild(myDocument.createTextNode(obj.value));\n return anchor;\n } //aim_IMme", "function i(e){this._aladdin=e}", "function Atm() {\r\n }", "function AttributeExtras() {}", "function addAttender(event, ui){\n attending.push($(ui.item).attr('data-id'));\n updatePubList();\n}", "_init() {\r\n this.initAttentionArea(this.attentionRange); // From CanAttack component\r\n this.owner.aggroAreas.add(this.attentionArea);\r\n }", "function Adaptor() {}", "$attachEventListeners() {\n\t\tlet action = (event, key) => {\n\t\t\ttry {\n\t\t\t\tlet target = event.composedPath()[0];\n\t\t\t\t// let target = event.target;\n\t\t\t\tlet action = target.closest(`[${key}]`);\n\t\t\t\t// console.log('EEE', key, event.composedPath(), target, action, 'called by', this, event)\n\t\t\t\t// console.log('PATH', event.composedPath().map(x => this.$1(x)))\n\t\t\t\tthis[action.getAttribute(key)](action, event, target)\n\t\t\t}\n\t\t\tcatch { }\n\t\t}\n\n\n\n\n\n\n\n\n\t}", "function Annotate() {\r\n}", "function appxextraattributeshandler(x) { }", "get appetizers(){\n \n }", "function AttributeDecorator(){}// WARNING: interface has both a type and a value, skipping emit", "submitAttributes_() {\n chrome.send('oauthEnrollAttributes', [this.assetId_, this.deviceLocation_]);\n }", "private public function m246() {}", "function attributesViewer()\n{\n /**\n * Updates the view for the given accessible.\n *\n * @param aAccessible\n * The given accessible\n */\n this.update = function attributesViewer_update(aAccessible)\n {\n var attrs = aAccessible.attributes;\n if (attrs) {\n var enumerate = attrs.enumerate();\n while (enumerate.hasMoreElements())\n this.addAttribute(enumerate.getNext());\n }\n\n return true;\n }\n\n /**\n * Clear the view's data.\n */\n this.clear = function attributesViewer_clear()\n {\n var trAttrBody = document.getElementById(\"trAttrBody\");\n while (trAttrBody.hasChildNodes())\n trAttrBody.removeChild(trAttrBody.lastChild)\n }\n\n //////////////////////////////////////////////////////////////////////////////\n //// private\n\n this.addAttribute = function attrbiutesViewer_addAttribute(aElement)\n {\n var prop = XPCU.QI(aElement, nsIPropertyElement);\n \n var trAttrBody = document.getElementById(\"trAttrBody\");\n \n var ti = document.createElement(\"treeitem\");\n var tr = document.createElement(\"treerow\");\n \n var tc = document.createElement(\"treecell\");\n tc.setAttribute(\"label\", prop.key);\n tr.appendChild(tc);\n \n tc = document.createElement(\"treecell\");\n tc.setAttribute(\"label\", prop.value);\n tr.appendChild(tc);\n \n ti.appendChild(tr);\n \n trAttrBody.appendChild(ti);\n }\n}", "function DomAutomationController() {}", "checkActivateAuthor () {\n /* nothing */\n }", "function AI(identifier,automation)\r\n{\r\n\tconsole.log(identifier,automation)\r\n}", "static get observedAttributes(){\n return ['nombre', 'apellido'];//lista de los atributos que tiene el componente\n }", "setShowAttText(active) {\n this.setAttributeColorText(active);\n this.setAttributeColorArrow(active);\n this.setAttributeDimmedBlock(active);\n }", "UpdateAriaLabel() {\n // subclasses should override\n }", "_createPart(){return new AttributePart(this);}", "function setupMastheadAccessibility () {\n\t\tIBM.common.util.a11y.makeMenuAccessible({\n\t\t\tel: $(\"#ibm-masthead .ibm-masthead-iconsonly\")\n\t\t});\n\t\tIBM.common.util.a11y.makeToolbarAccessible({\n\t\t\tel: $(\"#ibm-masthead .ibm-masthead-categories\")[0]\n\t\t});\n\t}", "function $add_att(aElem, attributes) {\r\n\tif (attributes) {\r\n\t\tvar xi;\r\n\t\tfor (xi = 0; xi < attributes.length; xi++) {\r\n\t\t\tvar attribute = attributes[xi];\r\n\t\t\tif (attribute instanceof Array && attribute.length >= 2) {\r\n\t\t\t\taElem.setAttribute(attribute[0], attribute[1]);\r\n\t\t\t\tif ( attribute[0].toUpperCase() === 'TITLE' ) {\r\n\t\t\t\t\taElem.setAttribute('alt', attribute[1]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "arangeItems () {\r\n // TODO: Add code here\r\n }", "incapacitate(){\n\t\t//\n\t}", "GetCustomAttributes() {\n\n }", "addAppetizer(appetizer){\n this._appetizers.push(appetizer);\n }", "domListener(){\n this.menuDisplay([\"file\",\"rotate\",\"brush\",\"outline\",\"fills\",\"size\"]);\n }", "function AppMeasurement_Module_AudienceManagement(d){var a=this;a.s=d;var b=window;b.s_c_in||(b.s_c_il=[],b.s_c_in=0);a._il=b.s_c_il;a._in=b.s_c_in;a._il[a._in]=a;b.s_c_in++;a._c=\"s_m\";a.setup=function(c){b.DIL&&c&&(c.disableDefaultRequest=!0,c.disableScriptAttachment=!0,c.disableCORS=!0,c.secureDataCollection=!1,a.instance=b.DIL.create(c),a.tools=b.DIL.tools)};a.isReady=function(){return a.instance?!0:!1};a.getEventCallConfigParams=function(){return a.instance&&a.instance.api&&a.instance.api.getEventCallConfigParams?\na.instance.api.getEventCallConfigParams():{}};a.passData=function(b){a.instance&&a.instance.api&&a.instance.api.passData&&a.instance.api.passData(b)}}", "_createPart(){return new AttributePart(this)}", "_createPart(){return new AttributePart(this)}", "obtain(){}", "function AeUtil() {}", "get appetizers() {}", "_updateAriaLabel() {\n var displayable = this.getTopDisplayable();\n if (displayable && !dvt.Agent.deferAriaCreation())\n displayable.setAriaProperty('label', this.getAriaLabel());\n }", "_overriddenMenuHandler() { }", "interact(){}", "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 clickTaleATIntegration() {\r\n var events = [];\r\n for (var i = 0; i < ttMETA.length; i++) {\r\n if (ttMETA[i].CampaignName != '' && ttMETA[i].RecipeName != '') {\r\n events.push('Campaign: ' + ttMETA[i].CampaignName + ' | Experience: ' + ttMETA[i].RecipeName);\r\n }\r\n }\r\n ClicktaleIntegrationExperienceHandler(events, \"Adobe\");\r\n}", "async genAccomodations(){\n //Not yet implemented\n }", "constructor() {\n this.requirements = {};\n this.extensions = {};\n \n this.event_opcodes = ['event_whenflagclicked', 'event_whenthisspriteclicked','event_whenbroadcastreceived','event_whenkeypressed', 'event_whenbackdropswitchesto','event_whengreaterthan'];\n }", "attributeChangedCallback() { }", "function Aa(e,t,n,i){xa.call(this,e,t,n,i)}", "get appetizers(){\n\n }", "onAttach() {}", "attach(targetElement, onEnter) {\n // place keyboard right in front of the user\n // TODO abstract over how to get the user's position/whether there is a single user\n this.visualRepresentation.setAttribute(\"is-open\", true);\n\n const userPosition = document\n .querySelector(\"[look-controls]\")\n .getAttribute(\"position\");\n this.visualRepresentation.setAttribute(\"position\", {\n x: userPosition.x - 0.3,\n y: userPosition.y - 0.5,\n z: userPosition.z - 1\n });\n const inputElement = document.createElement(\"a-input\");\n // for some reason an input element does not render correctly\n // if the keyboard starts as hidden and the input is a child\n // so render it here for now\n inputElement.setAttribute(\"position\", { y: 1 });\n inputElement.setAttribute(\"placeholder\", \"hello\");\n inputElement.setAttribute(\"color\", \"black\");\n inputElement.setAttribute(\"background-color\", \"white\");\n inputElement.setAttribute(\"width\", 1);\n inputElement.classList.add(\"pointable\");\n this.visualRepresentation.appendChild(inputElement);\n inputElement.focus();\n\n this.visualRepresentation.addEventListener(\"enter\", onEnter, {\n once: true\n });\n this.visualRepresentation.addEventListener(\n \"enter\",\n () => {\n inputElement.parentNode.removeChild(inputElement);\n },\n { once: true }\n );\n }", "function init(){\n var numId=createId();\n addAntInfo(numId,0);\n addId(numId,0);\n addInputEvent(numId);\n }", "constructor(element) {\r\n super(element); \r\n this.element = element;\r\n this.attributeManager = new AttributeManager(this.element);\r\n }", "constructor(element) {\r\n super(element); \r\n this.element = element;\r\n this.attributeManager = new AttributeManager(this.element);\r\n }", "constructor(element) {\r\n super(element); \r\n this.element = element;\r\n this.attributeManager = new AttributeManager(this.element);\r\n }", "function avanti11() {\nvar ogg = new AgganciaController();\nogg.avanti();\n}", "initializeActivityCheck() {\n\n //TODO: CHECK HOW THESE CUSTOM JQUERY LISTENERS WORK TO MIMIC EFFECT\n $(document).on('keypress.PLH',this.recordUserInteraction.bind(this)); // keystroke.\n $(document).on('click.PLH',this.recordUserInteraction.bind(this)); // Mouse click\n }", "_updateAriaAttribute() {\n const ariaIds = [this._helperId];\n\n ariaIds.push(this._errorId);\n\n // TODO: commented for testing\n // if (invalid) {\n // ariaIds.push(this._errorId);\n // }\n\n const value = ariaIds.join(' ');\n\n if (this.__datePicker) {\n this.__datePicker._inputNode.setAttribute('aria-describedby', value);\n }\n\n if (this.__timePicker) {\n this.__timePicker._inputNode.setAttribute('aria-describedby', value);\n }\n }", "attachAM(apicalMeristem){\n this.apicalMeristem = apicalMeristem;\n }", "addEventListeners() {\n // Empty in base class.\n }", "onAddTag() {}", "function handleAttributes(){\n \n console.log(\"Handling attributes...\");\n \n let deviceType = document.getElementById(\"deviceType\");\n let displayContext = document.getElementById(\"displayContext\");\n let theme = document.getElementById(\"theme\");\n let language = document.getElementById(\"language\");\n let sdkVersion = document.getElementById(\"sdkVersion\");\n let about = document.getElementById(\"about\");\n \n deviceType.innerHTML = app.deviceType; // e.g. DESKTOP\n displayContext.innerHTML = app.displayContext; // One of: [\"MEETING_SIDEBAR\", \"MEETING_STANDALONE_WINDOW\", \"MEETING_MAINVIEW\", \"SPACETAB\"]\n theme.innerHTML = app.theme; // light or dark\n language.innerHTML = app.language; // e.g. en-US\n sdkVersion.innerHTML = app.sdkVersion; // e.g. 1\n about.innerHTML = app.about; // e.g. Webex App, Version: 41.8.0.19299\n \n log('app', app);\n console.log(\"...attributes handled.\");\n \n}", "getAttributes() {}", "activate() {\n\n\t\tthis.arbitrate();\n\n\t}", "function setupCustomInteraction(htmlInteraction) {\n let identifier = htmlInteraction.getAttribute(ID);\n let type = htmlInteraction.getAttribute(\"type\");\n let ci = QTI.CUSTOM_INTERACTIONS[identifier]\n || QTI.CUSTOM_INTERACTIONS[type];\n if (ci && typeof ci.setupInteraction===\"function\") {\n let qtiInteraction = QTI.DOM.getElementById(htmlInteraction.id);\n ci.setupInteraction(htmlInteraction, qtiInteraction);\n }\n}", "decorate() {\n let commandId;\n if ((commandId = this.getAttribute('command'))) {\n this.setCommand(commandId);\n }\n\n this.addEventListener('click', this.handleClick_.bind(this));\n }", "function gA(item, att) { return item.getAttribute('data-'+att+''); }", "function gA(item, att) { return item.getAttribute('data-'+att+''); }", "static get tag() {\n return \"a11y-media-transcript\";\n }", "function onSilencerAttachClick(){\r\n\r\n\tif (!AKS74u.silencerAttached){\r\n\tAKS74u.addAttachment(attachments[4]);\r\n} else {\r\n\tAKS74u.addAttachment(attachments[10]);\r\n\r\n}\r\nscreenage.scrollTop = screenage.scrollHeight;\r\n}", "click_extra() {\r\n }", "function apia_input(apxml)\r\n{\r\n // Forward APXML to xMatters.\r\n return apxml;\r\n}", "function GivenIAmATrustAdmin() {}", "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 Atan() {\r\n}", "function attachEventHandlers() {\n // TODO arrow: attach events for functionality like in assignment-document described\n var clicked;\n $(\"#\"+_this.id).click(function(event){\n clicked = true;\n diagram.selectArrow(_this);\n });\n $(\"#\"+_this.id).contents().on(\"dblclick contextmenu\", function(event){\n clicked = true;\n event.preventDefault();\n });\n\n // TODO arrow optional: attach events for bonus points for 'TAB' to switch between arrows and to select arrow\n $(\"#\"+_this.id).contents().attr(\"tabindex\",\"0\");\n\n $(\"#\"+_this.id).keydown(function(event){\n if(event.which == \"13\"){\n diagram.selectArrow(_this);\n }\n if(event.which == \"9\"){\n clicked = false;\n }\n })\n $(\"#\"+_this.id).contents().focusin(function(event){\n if(!clicked){\n setActive(true);\n }\n });\n $(\"#\"+_this.id).contents().focusout(function(event){\n setActive(false);\n });\n }", "function menuHandler() {\n console.log('menuHandler');\n\n agent.add('Questi sono alcuni dei modi in cui posso aiutarti nella tua visita al nostro store online')\n agent.add(new Suggestion(`Esplorazione delle categorie`));\n agent.add(new Suggestion(`Ricerca prodotto specifico`));\n agent.add(new Suggestion(`Suggerimento prodotto`));\n}", "function px(){var t=this;ze(this);var e=ki(this.$interaction,[\"modifystart\",\"modifyend\"]);this.subscribeTo(e,function(e){++t.rev,t.$emit(e.type,e)})}", "function getAstronaut(astronaut){\n\t\t\t\t// console.log(astronaut);\n\t\t\t}", "function IM() {\n\t}", "getAttractsIcons(){\n return this.attracts.join('-');\n }", "function AttributeDecorator() {} // WARNING: interface has both a type and a value, skipping emit", "function AttributeDecorator() {} // WARNING: interface has both a type and a value, skipping emit", "function AttributeDecorator() {} // WARNING: interface has both a type and a value, skipping emit", "function TipoServico_elementsExtraJS() {\n // screen (TipoServico) extra code\n\n }", "function userinfo_dispatcher_routines() {\n\n\n}", "attach() { }", "attach() { }", "onModifyAtk() {}", "setUpEventListeners() {\n chrome.clipboard.onClipboardDataChanged.addListener(\n () => this.onClipboardDataChanged_());\n document.addEventListener('paste', evt => this.onClipboardPaste_(evt));\n document.addEventListener('copy', evt => this.onClipboardCopy_(evt));\n chrome.accessibilityPrivate.onSelectToSpeakKeysPressedChanged.addListener(\n (keysPressed) => {\n this.onKeysPressedChanged_(new Set(keysPressed));\n });\n chrome.accessibilityPrivate.onSelectToSpeakMouseChanged.addListener(\n (eventType, mouseX, mouseY) => {\n this.onMouseEvent_(eventType, mouseX, mouseY);\n });\n }", "generateAutocadExtras() {\n\t if (!this.headers[\"ACADVER\"]) {\n\t /* AutoCAD 2007 version. */\n\t this.header(\"ACADVER\", [[1, \"AC1021\"]]);\n\t }\n\n\t if (!this.lineTypes[\"ByBlock\"]) {\n\t this.addLineType(\"ByBlock\", \"\", []);\n\t }\n\t if (!this.lineTypes[\"ByLayer\"]) {\n\t this.addLineType(\"ByLayer\", \"\", []);\n\t }\n\n\t let vpTable = this.tables[\"VPORT\"];\n\t if (!vpTable) {\n\t vpTable = this.addTable(\"VPORT\");\n\t }\n\t let styleTable = this.tables[\"STYLE\"];\n\t if (!styleTable) {\n\t styleTable = this.addTable(\"STYLE\");\n\t }\n\t if (!this.tables[\"VIEW\"]) {\n\t this.addTable(\"VIEW\");\n\t }\n\t if (!this.tables[\"UCS\"]) {\n\t this.addTable(\"UCS\");\n\t }\n\t let appIdTable = this.tables[\"APPID\"];\n\t if (!appIdTable) {\n\t appIdTable = this.addTable(\"APPID\");\n\t }\n\t if (!this.tables[\"DIMSTYLE\"]) {\n\t const t = new DimStyleTable(\"DIMSTYLE\");\n\t this.tables[\"DIMSTYLE\"] = t;\n\t }\n\n\t vpTable.add(new Viewport(\"*ACTIVE\", 1000));\n\n\t /* Non-default text alignment is not applied without this entry. */\n\t styleTable.add(new TextStyle(\"standard\"));\n\n\t appIdTable.add(new AppId(\"ACAD\"));\n\n\t this.modelSpace = this.addBlock(\"*Model_Space\");\n\t this.addBlock(\"*Paper_Space\");\n\n\t const d = new Dictionary();\n\t this.dictionary.addChildDictionary(\"ACAD_GROUP\", d);\n\t }", "_getAttributeManager() {\n return new AttributeManager(this.context.gl, {\n id: this.props.id,\n stats: this.context.stats,\n timeline: this.context.timeline\n });\n }", "get attenuation() { return this._attenuation; }", "attach() {}", "function Clicker2(evt) {\n\t\t\n\t\tvar newAttr = evt.target.innerHTML,\n\t\tcurrentAttr = document.getElementById('selectedAttributes').innerHTML.split(\" | \", 1);\n\t\tdocument.getElementById(\"selectedAttributes\").innerHTML = newAttr + \" | \" + currentAttr;\n\t\t\n\t}", "function activateInteraction(){element.addClass('md-clickable');// close on backdrop click\n\tif(opts.backdrop)opts.backdrop.on('click',onBackdropClick);// Wire up keyboard listeners.\n\t// - Close on escape,\n\t// - focus next item on down arrow,\n\t// - focus prev item on up\n\topts.menuContentEl.on('keydown',onMenuKeyDown);opts.menuContentEl[0].addEventListener('click',captureClickListener,true);// kick off initial focus in the menu on the first element\n\tvar focusTarget=opts.menuContentEl[0].querySelector(prefixer.buildSelector(['md-menu-focus-target','md-autofocus']));if(!focusTarget){var firstChild=opts.menuContentEl[0].firstElementChild;focusTarget=firstChild&&(firstChild.querySelector('.md-button:not([disabled])')||firstChild.firstElementChild);}focusTarget&&focusTarget.focus();return function cleanupInteraction(){element.removeClass('md-clickable');if(opts.backdrop)opts.backdrop.off('click',onBackdropClick);opts.menuContentEl.off('keydown',onMenuKeyDown);opts.menuContentEl[0].removeEventListener('click',captureClickListener,true);};// ************************************\n\t// internal functions\n\t// ************************************\n\tfunction onMenuKeyDown(ev){var handled;switch(ev.keyCode){case $mdConstant.KEY_CODE.ESCAPE:opts.mdMenuCtrl.close(false,{closeAll:true});handled=true;break;case $mdConstant.KEY_CODE.UP_ARROW:if(!focusMenuItem(ev,opts.menuContentEl,opts,-1)&&!opts.nestLevel){opts.mdMenuCtrl.triggerContainerProxy(ev);}handled=true;break;case $mdConstant.KEY_CODE.DOWN_ARROW:if(!focusMenuItem(ev,opts.menuContentEl,opts,1)&&!opts.nestLevel){opts.mdMenuCtrl.triggerContainerProxy(ev);}handled=true;break;case $mdConstant.KEY_CODE.LEFT_ARROW:if(opts.nestLevel){opts.mdMenuCtrl.close();}else{opts.mdMenuCtrl.triggerContainerProxy(ev);}handled=true;break;case $mdConstant.KEY_CODE.RIGHT_ARROW:var parentMenu=$mdUtil.getClosest(ev.target,'MD-MENU');if(parentMenu&&parentMenu!=opts.parent[0]){ev.target.click();}else{opts.mdMenuCtrl.triggerContainerProxy(ev);}handled=true;break;}if(handled){ev.preventDefault();ev.stopImmediatePropagation();}}function onBackdropClick(e){e.preventDefault();e.stopPropagation();scope.$apply(function(){opts.mdMenuCtrl.close(true,{closeAll:true});});}// Close menu on menu item click, if said menu-item is not disabled\n\tfunction captureClickListener(e){var target=e.target;// Traverse up the event until we get to the menuContentEl to see if\n\t// there is an ng-click and that the ng-click is not disabled\n\tdo{if(target==opts.menuContentEl[0])return;if((hasAnyAttribute(target,['ng-click','ng-href','ui-sref'])||target.nodeName=='BUTTON'||target.nodeName=='MD-BUTTON')&&!hasAnyAttribute(target,['md-prevent-menu-close'])){var closestMenu=$mdUtil.getClosest(target,'MD-MENU');if(!target.hasAttribute('disabled')&&(!closestMenu||closestMenu==opts.parent[0])){close();}break;}}while(target=target.parentNode);function close(){scope.$apply(function(){opts.mdMenuCtrl.close(true,{closeAll:true});});}function hasAnyAttribute(target,attrs){if(!target)return false;for(var i=0,attr;attr=attrs[i];++i){if(prefixer.hasAttribute(target,attr)){return true;}}return false;}}}", "function a(){this.title=void 0,this.actors=[],this.signals=[]}", "function AccessibilityManager(plugin) {\n this.plugin_ = plugin;\n\n plugin.addMessageListener('jsAccessibility', this.handleMessage.bind(this));\n}", "function $A(){var t=this;ze(this);var e=ki(this.$interaction,\"select\");this.subscribeTo(e,function(e){var n=e.selected,i=e.deselected,r=e.mapBrowserEvent;++t.rev,i.forEach(function(e){return t.$emit(\"unselect\",{feature:e,mapBrowserEvent:r})}),n.forEach(function(e){return t.$emit(\"select\",{feature:e,mapBrowserEvent:r})}),t.$emit(\"update:features\",t.$features.map(t.writeFeatureInDataProj.bind(t)))})}", "get appetizers() {\n return this._appetizers;\n }" ]
[ "0.62196976", "0.6131821", "0.58408445", "0.58085287", "0.5683437", "0.5656472", "0.56421614", "0.562133", "0.5612589", "0.5587436", "0.55552125", "0.53921574", "0.53584594", "0.53532565", "0.53484136", "0.53453946", "0.5339503", "0.5330586", "0.53237593", "0.53137827", "0.5250643", "0.5242683", "0.5230796", "0.5223032", "0.52176714", "0.5216796", "0.5192088", "0.5179277", "0.51779014", "0.5160127", "0.5151038", "0.5149115", "0.5147152", "0.5144769", "0.5141134", "0.5137352", "0.5137352", "0.51104146", "0.51092607", "0.5098392", "0.5086951", "0.5082522", "0.5081296", "0.5074722", "0.50708973", "0.50668985", "0.5057975", "0.5048739", "0.504375", "0.5042093", "0.50286955", "0.50269663", "0.5015416", "0.50067353", "0.50067353", "0.50067353", "0.5003798", "0.5000678", "0.50002044", "0.49984154", "0.49974164", "0.49961588", "0.4993006", "0.49720043", "0.4966289", "0.496214", "0.49620384", "0.49614248", "0.49614248", "0.4958693", "0.4950654", "0.49442926", "0.4936895", "0.49332204", "0.49292657", "0.49286482", "0.4926987", "0.49262488", "0.49164048", "0.49130037", "0.490859", "0.4908356", "0.4905796", "0.4905796", "0.4905796", "0.49003726", "0.48998135", "0.48977965", "0.48977965", "0.4896123", "0.48920646", "0.48915964", "0.48884198", "0.4887132", "0.48805052", "0.48784027", "0.48675457", "0.48639226", "0.48625082", "0.48621032", "0.48593003" ]
0.0
-1
Generator interface functions //////////////////////////////////////////////////
function load_default(channel) { input_disable(generator_parameters, generator_buttons); values = channel_defaults[channel]; for (var key in values) { $('#I_' + key).val(values[key]); } input_enable(generator_parameters, generator_buttons); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}" ]
[ "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606" ]
0.0
-1
Managing elements readability //////////////////////////////////////////////////
function input_disable(values, extra_disable) { if (values) { var arrayValues = values.split(","); var arrayLength = arrayValues.length; for (var i = 0; i < arrayLength; i++) { $('[id=' + arrayValues[i].replace('"', '"I_') + ']').prop('disabled', true); } } if (extra_disable) { arrayValues = extra_disable.split(","); arrayLength = arrayValues.length; for (var i = 0; i < arrayLength; i++) { $('[id=' + arrayValues[i] + ']').prop('disabled', true); } } // Extra for coloring an update while on stages 2 or 3 $('[id^="I_OPE_STEP"]').prop('disabled', true); if (operational == 2) { $('[id="I_OPE_STEP2_GE1_FRQ"]').removeClass('uncompleted'); $('[id="I_OPE_STEP2_GE1_PWD"]').removeClass('uncompleted'); $('[id="I_OPE_STEP2_ATT_DB"]').removeClass('uncompleted'); } else if (operational == 3) { $('[id="I_OPE_STEP3_GE1_FRQ"]').removeClass('uncompleted'); $('[id="I_OPE_STEP3_ATT_DB"]').removeClass('uncompleted'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readElement(_element)\r\n{\r\n\r\n}", "element(element){\r\n element.setInnerContent(this.content);\r\n}", "function Elements() {\n}", "element(element) {\n const attributeToChange = element.getAttribute(this.name)\n\n // console.log(`Name: ${this.name}`)\n // console.log(`Incoming element: ${element.tagName}`)\n // console.log(`action: ${this.action}`)\n // console.log(`attribute to change: ${attributeToChange}`)\n\n //Add additional cases as needed to make more element-related methods available.\n switch(this.action){\n case 'setAttribute':\n //Diagnostic block to observe attribute names.\n // var attr = element.attributes\n // for(let at of attr){\n // console.log(`Attribute: ${at}`)\n // }\n element.setAttribute(this.name,this.newValue, { html: Boolean })\n break\n\n case 'append':\n // console.log(`Incoming element: ${element.tagName}`)\n element.append(this.newValue, { html: Boolean })\n break\n\n //Defaults to setInnerContent.\n default:\n // console.log(`Incoming: ${this.name}`)\n element.setInnerContent(this.newValue, { html: Boolean })\n break\n }\n }", "majHTML(){\r\n this.$element.css(\"left\",this.positionX);\r\n this.$element.css(\"top\",this.positionY);\r\n }", "readingComponent() {\n this.readingCompTrans(this.element.getElementsByTagName('transformation')[0]);\n this.readingTextures(this.element.getElementsByTagName('texture')[0]);\n this.readingMaterials(this.element.getElementsByTagName('materials')[0]);\n this.readingAnimations(this.element.getElementsByTagName('animation')[0]);\n this.readingChildren(this.element.getElementsByTagName('children')[0]);\n\n }", "function treeHTML(element, object) {\n var typeName = element.nodeName;\n //Personalized converter types\n typeName = \"I\" + typeName;\n object[\"elemento\"] = typeName;\n\n var nodeList = element.childNodes;\n if (nodeList !== null) {\n if (nodeList.length) {\n object[\"content\"] = [];\n for (var i = 0; i < nodeList.length; i++) {\n if (nodeList[i].nodeType === 3) {// 1 Element 2 Attr 3 Text\n if (!nodeList[i].nodeValue.startsWith('\\n')) {\n object[\"texto\"] = nodeList[i].nodeValue;\n }\n } else {\n object[\"content\"].push({});\n treeHTML(nodeList[i], object[\"content\"][object[\"content\"].length - 1]);\n }\n }\n }\n }\n if (element.attributes !== null) {\n if (element.attributes.length) {\n object[\"attributes\"] = {};\n for (var i = 0; i < element.attributes.length; i++) {\n if (element.value) {\n object[\"attributes\"][\"valor\"] = element.value;\n }\n if (element.attributes[i].nodeName === \"style\") {\n //Get style an remove spaces to separated after\n var styles = element.attributes[i].nodeValue.toString().replace(/ /g, '');\n var arrayStyle = styles.split(\";\");\n for (var p = 0; p < arrayStyle.length; p++) {\n if (arrayStyle[p] !== \"\") {//Add another estilos\n var getPropertie = arrayStyle[p].split(\":\");\n if (getPropertie[0] === \"width\") {\n object[\"attributes\"][\"ancho\"] = getPropertie[1];\n } else if (getPropertie[0] === \"height\") {\n object[\"attributes\"][\"alto\"] = getPropertie[1];\n } else if (getPropertie[0] === \"display\") {\n object[\"attributes\"][\"display\"] = getPropertie[1];\n } else if (getPropertie[0] === \"max-width\") {\n object[\"attributes\"][\"maxAlto\"] = getPropertie[1];\n }\n //display\n // console.log(\"NameProp: \" + getPropertie[0] + \" Valueprop: \" + getPropertie[1]);\n }\n }\n }\n else {\n object[\"attributes\"][element.attributes[i].nodeName] = element.attributes[i].nodeValue;\n }\n }\n }\n }\n }", "function TextLayouter(element){return _super.call(this,element)||this;}", "restyleElement() {\n this._restyle_plugin();\n }", "static _justText(el) {\nvar i, len, nd, ref, res;\nres = \"\";\nref = el.childNodes;\nfor (i = 0, len = ref.length; i < len; i++) {\nnd = ref[i];\nif (nd.nodeType === Node.ELEMENT_NODE) {\nres += Access._justText(nd);\n} else if (nd.nodeType === Node.TEXT_NODE) {\nres += nd.nodeValue;\n}\n}\nreturn res;\n}", "reArrangeElementsForRtl(line, isParaBidi) {\n if (line.children.length === 0) {\n return;\n }\n let lastAddedElementIsRtl = false;\n let lastAddedRtlElementIndex = -1;\n let tempElements = [];\n for (let i = 0; i < line.children.length; i++) {\n let element = line.children[i];\n let elementCharacterFormat = undefined;\n if (element.characterFormat) {\n elementCharacterFormat = element.characterFormat;\n }\n let isRtl = false;\n let text = '';\n //let containsSpecchrs: boolean = false;\n if (element instanceof BookmarkElementBox) {\n if (isParaBidi) {\n if (lastAddedElementIsRtl || element.bookmarkType === 0 && element.nextElement\n && element.nextElement.nextElement instanceof TextElementBox\n && this.viewer.textHelper.isRTLText(element.nextElement.nextElement.text)\n || element.bookmarkType === 1 && element.nextElement instanceof TextElementBox\n && this.viewer.textHelper.isRTLText(element.nextElement.text)) {\n tempElements.splice(0, 0, element);\n }\n else {\n tempElements.splice(lastAddedElementIsRtl ? lastAddedRtlElementIndex : lastAddedRtlElementIndex + 1, 0, element);\n }\n lastAddedRtlElementIndex = tempElements.indexOf(element);\n }\n else {\n tempElements.push(element);\n }\n continue;\n }\n if (element instanceof TextElementBox) {\n text = element.text;\n }\n // The list element box shold be added in the last position in line widget for the RTL paragraph \n // and first in the line widget for LTR paragrph.\n if (element instanceof ListTextElementBox) {\n isRtl = isParaBidi;\n }\n else { // For Text element box we need to check the character format and unicode of text to detect the RTL text. \n isRtl = this.viewer.textHelper.isRTLText(text) || elementCharacterFormat.bidi\n || elementCharacterFormat.bdo === 'RTL';\n }\n // If the text element box contains only whitespaces, then need to check the previous and next elements.\n if (!isRtl && !isNullOrUndefined(text) && text !== '' && text.trim() === '') {\n let elements = line.children;\n //Checks whether the langugae is RTL.\n if (elementCharacterFormat.bidi) {\n // If the last added element is rtl then current text element box also considered as RTL for WhiteSpaces.\n if (lastAddedElementIsRtl) {\n isRtl = true;\n // Else, Check for next element.\n }\n else if (i + 1 < line.children.length && line.children[i + 1] instanceof TextElementBox) {\n text = elements[i + 1].text;\n isRtl = this.viewer.textHelper.isRTLText(text) || elements[i + 1].characterFormat.bidi\n || elements[i + 1].characterFormat.bdo === 'RTL';\n } // If the last added element is rtl then current text element box also considered as RTL for WhiteSpaces.\n }\n else if (lastAddedElementIsRtl) {\n isRtl = true;\n }\n }\n // Preserve the isRTL value, to reuse it for navigation and selection.\n element.isRightToLeft = isRtl;\n //Adds the text element to the line\n if (isRtl && elementCharacterFormat.bdo !== 'LTR') {\n if (lastAddedElementIsRtl) {\n tempElements.splice(lastAddedRtlElementIndex, 0, element);\n }\n else {\n if (!isParaBidi) {\n tempElements.push(element);\n }\n else {\n tempElements.splice(0, 0, element);\n }\n lastAddedElementIsRtl = true;\n lastAddedRtlElementIndex = tempElements.indexOf(element);\n }\n }\n else {\n if (lastAddedElementIsRtl && element instanceof ImageElementBox) {\n if (elementCharacterFormat.bidi) {\n tempElements.splice(lastAddedRtlElementIndex + 1, 0, element);\n }\n else {\n tempElements.splice(lastAddedRtlElementIndex, 0, element);\n }\n }\n else {\n if (!isParaBidi) {\n tempElements.push(element);\n }\n else {\n if (lastAddedElementIsRtl) {\n tempElements.splice(0, 0, element);\n }\n else {\n tempElements.splice(lastAddedRtlElementIndex + 1, 0, element);\n }\n lastAddedRtlElementIndex = tempElements.indexOf(element);\n }\n lastAddedElementIsRtl = false;\n }\n }\n }\n // Clear the elemnts and reassign the arranged elements.\n line.children = [];\n line.children = tempElements;\n }", "function ITextElement() {\n }", "function StyleContent() { }", "function changeElementContent(element, content) {\n saferInnerHTML(element, content);\n}", "function setElement(elem, data) {\n elem\n .css({\n top: `${data.positionTop}px`,\n left: `${data.positionLeft}px`,\n width: `${data.width}px`,\n \"font-family\": data.fontFamily,\n \"font-size\": `${data.fontSize}px`,\n \"line-height\": data.lineHeight,\n color: data.color,\n \"text-align\": data.textAlign\n })\n .text(data.value);\n // set font-style and font-weight\n switch (data.fontStyle) {\n case \"normal\":\n elem.css({\n \"font-style\": \"normal\",\n \"font-weight\": \"normal\"\n });\n break;\n case \"bold\":\n elem.css({\n \"font-style\": \"normal\",\n \"font-weight\": \"bold\"\n });\n break;\n case \"italic\":\n elem.css({\n \"font-style\": \"italic\",\n \"font-weight\": \"normal\"\n });\n break;\n case \"boldItalic\":\n elem.css({\n \"font-style\": \"italic\",\n \"font-weight\": \"bold\"\n });\n break;\n default:\n elem.css({\n \"font-style\": \"normal\",\n \"font-weight\": \"normal\"\n });\n }\n // set alignment\n switch (data.textAlign) {\n case \"left\":\n elem.css(\"text-align\", \"left\");\n break;\n case \"right\":\n elem.css(\"text-align\", \"right\");\n break;\n case \"center\":\n elem.css(\"text-align\", \"center\");\n break;\n case \"justify\":\n elem.css(\"text-align\", \"justify\");\n break;\n default:\n elem.css(\"text-align\", \"left\");\n break;\n }\n}", "function yst_overrideElemFunction() {\n\treturn;\n}", "function element() {\n\n\t\t/* -------------------------------------------------- */\n\t\t/* FUNCTIONS\n\t\t/* -------------------------------------------------- */\n\n\t\t//removeIf(production)\n\t\tfunction log(eventName, element) {\n\n\t\t\tconsole.log(Date.now(), eventName, element.getAttribute('data-src'));\n\n\t\t}\n\t\t//endRemoveIf(production)\n\n\n\t\t/* -------------------------------------------------- */\n\t\t/* ANIMATIONS\n\t\t/* -------------------------------------------------- */\n\n\t\tfunction revealCopy(element) {\n\n\t\t\tif ( $(element).find('.section-container-text-block').find('h1').length ) {\n\n\t\t\t\tconsole.log('elements exist.');\n\n\t\t\t\tvar h1 = new SplitText($(element).find('h1'), {type: 'words, lines, chars', reduceWhiteSpace: true, position: null}), \n\t\t\t\t\t$h1 = h1.lines;\n\n\t\t\t\tvar tlH1 = new Timeline({paused: false, onComplete: function() { h1.revert(); } });\n\t\t\t\t\ttlH1.staggerFrom($h1, 1, {autoAlpha: 0, y: 25, ease: Expo.easeInOut}, 0.025);\n\n\t\t\t\t\ttlH1.delay(2).play(0);\n\n\t\t\t}\n\n\t\t\tif ( $(element).find('.section-container-text-block').find('p').length ) {\n\n\t\t\t\tconsole.log('elements exist.');\n\n\t\t\t\tvar p = new SplitText($(element).find('p'), {type: 'words, lines, chars', reduceWhiteSpace: true, position: null}), \n\t\t\t\t\t$p = p.lines;\n\n\t\t\t\tvar tlP = new Timeline({paused: false, onComplete: function() { p.revert(); } });\n\t\t\t\t\ttlP.staggerFrom($p, 1, {autoAlpha: 0, y: 25, ease: Expo.easeInOut}, 0.025);\n\n\t\t\t\t\ttlP.delay(2).play(0);\n\n\t\t\t}\n\n\t\t\tif ( $(element).find('.section-container-text-block').find('ul').length ) {\n\n\t\t\t\tconsole.log('elements exist.');\n\n\t\t\t\tvar list = new SplitText($(element).find('ul').children(), {type: 'words, lines, chars', reduceWhiteSpace: true, position: null}), \n\t\t\t\t\t$list = list.lines;\n\n\t\t\t\tvar tlList = new Timeline({paused: false, onComplete: function() { list.revert(); } });\n\t\t\t\t\ttlList.staggerFrom($list, 1, {autoAlpha: 0, y: 25, ease: Expo.easeInOut}, 0.025);\n\n\t\t\t\t\ttlList.delay(2).play(0);\n\n\t\t\t}\n\n\t\t}\t\t\n\n\n\t\t/* -------------------------------------------------- */\n\t\t/* OPTIONS\n\t\t/* -------------------------------------------------- */\n\n\t\tvar options = {\n\t\t\tcontainer: document,\n\t\t\telements_selector: '.section-container',\n\t\t\tthreshold: 0,\n\t\t\tthresholds: '0% 0% 0% 0%', // top, right, bottom, left\n\t\t\t//load_delay: 100,\n\t\t\tauto_unobserve: false,\n\t\t\tuse_native: false,\n\n\t\t\tcallback_enter: function(element) {\n\n\t\t\t\t//console.log('Entered the viewport', element);\n\t\t\t\t$(element).addClass('in-view');\n\t\t\t\t//revealCopy(element);\n\n\t\t\t},\n\n\t\t\tcallback_exit: function(element) {\n\n\t\t\t\t//console.log('Left the viewport', element);\n\t\t\t\t$(element).removeClass('in-view');\n\n\t\t\t}\n\n\t\t};\n\n\n\t\t/* -------------------------------------------------- */\n\t\t/* INIT\n\t\t/* -------------------------------------------------- */\n\n\t\tvar lazyLoad = new LazyLoad(options);\n\n\n\t\t/* -------------------------------------------------- */\n\t\t/* HELPERS\n\t\t/* -------------------------------------------------- */\n\n\t\t//lazyLoad.update();\n\t\t//lazyLoad.load(element, force);\n\t\t//lazyLoad.loadAll();\n\t\t//lazyLoad.destroy();\n\n\t}", "function updateDisplay(elem){\n \n activeContent = elem.innerHTML.replace(/<.+?>/g,\"\");\n if(activeContent == \"profiles\"){\n activeContent = \"SearchSpan\"\n toggle_visibility(\"SearchSpan\", \"SEARCHdiv\");\n } else if (activeContent == \"barplot\"){\n toggle_visibility(\"barplot\", \"VISUALIZEdiv\")\n } \n }", "function formAtt(elem){\n\t//changing element border width to draw more attention\n\tdocument.getElementById(elem).style.borderWidth=\"4px\";\n\t//changing element background to highlight the problem field\n\tdocument.getElementById(elem).style.backgroundColor=\"pink\";\n\t//change border color to add more emphasis\n\tdocument.getElementById(elem).style.borderColor=\"white\";\n}", "function domHelp() {\n\n // high-level helpers for HTML-DOM\n function para(args) {\n var p;\n \n p = node(\"p\");\n p.className = args.className||\"\";\n p.innerHTML = args.text||\"\";\n\n return p; \n }\n\n function option(args) {\n var opt;\n\n opt = node(\"option\");\n opt.text = args.text||\"item\";\n opt.value = args.value||\"\";\n opt.className = args.className||\"\";\n\n return opt;\n }\n \n function input(args) {\n var p, lbl, inp;\n\n p = node(\"p\");\n lbl = node(\"label\");\n inp = node(\"input\");\n lbl.className = \"data\";\n lbl.innerHTML = args.prompt||\"\";\n inp.name = args.name||\"\";\n inp.className = \"value\";\n inp.value = args.value.toString()||\"\";\n inp.required = (args.required||false);\n inp.readOnly = (args.readOnly||false);\n push(lbl,p);\n push(inp,p);\n \n return p;\n }\n \n function data(args) {\n var p, s1, s2;\n\n p = node(\"p\");\n p.className = args.className||\"\";\n s1 = node('span');\n s1.className = \"prompt\";\n s1.innerHTML = args.text||\"\";;\n s2 = node(\"span\");\n s2.className = \"value\";\n s2.innerHTML = args.value||\"\";\n push(s1,p);\n push(s2,p);\n\n return p;\n }\n \n function anchor(args) {\n var a;\n\n a = node(\"a\");\n a.rel = args.rel||\"\";\n a.href = args.href||\"\";\n a.className = args.className||\"\";\n a.title = args.text||\"link\";\n a.type = args.type||\"\";\n push(text(args.text||\"link\"), a);\n\n return a;\n }\n \n function image(args) {\n var img;\n\n img = node(\"img\")\n img.src = args.href||\"\";\n img.className = args.rel||\"\";\n img.title = args.title||\"\";\n\n return img;\n }\n \n function link(args) {\n var lnk; \n\n lnk = node(\"link\");\n lnk.rel = args.rel||\"\";\n lnk.href = args.href||\"\";\n lnk.title = args.title||\"\";\n lnk.className = args.className||\"\";\n\n return lnk;\n }\n \n // low-level helpers for DOM\n function push(source,target) {\n target.appendChild(source);\n }\n\n function tags(tag,elm) {\n var rtn;\n \n if(elm) {\n rtn = elm.getElementsByTagName(tag);\n }\n else {\n rtn = document.getElementsByTagName(tag);\n }\n return rtn;\n }\n\n function find(id) {\n return document.getElementById(id);\n }\n\n function text(txt) {\n return document.createTextNode(txt);\n }\n\n function node(type) {\n return document.createElement(type);\n }\n\n function clear(elm) {\n while (elm.firstChild) {\n elm.removeChild(elm.firstChild);\n }\n }\n\n // publish functions\n that = {};\n that.push = push;\n that.tags = tags;\n that.find = find;\n that.text = text;\n that.node = node;\n that.clear = clear;\n that.link = link;\n that.image = image;\n that.anchor = anchor;\n that.data = data; \n that.input = input;\n that.para = para;\n that.option = option;\n \n return that;\n}", "function changeElementsVisibility(element) {\n var paymentMethod = $(element).val();\n\n toggleRequiredClass();\n togglePriceVisibility(paymentMethod);\n toggleQuantityVisibility(paymentMethod);\n validateQuantity();\n toggleEditableLoadElementsStructure(paymentMethod);\n}", "ToElements(array) {\n let elements = [];\n\n let section_counter = 0;\n let subsection_counter = 0;\n let subsubsection_counter = 0;\n\n let listType = 0;\n\n let isNewParagraph = false;\n\n array.forEach(element => {\n const tagRegex = new RegExp(/^\\\\\\w*/g);\n const fullTagRegex = new RegExp(/^\\\\\\w{2,}(\\{([^{}]+)\\})*/g);\n\n let tagName = '';\n let fullTagName = '';\n let property = '';\n\n if (tagRegex.test(element))\n tagName = element.match(tagRegex).toString();\n \n if (fullTagRegex.test(element))\n fullTagName = element.match(fullTagRegex).toString();\n\n const content = element.substring(fullTagName.length).trim();\n\n if (fullTagName.indexOf('{') !== -1)\n property = fullTagName.substring(\n fullTagName.indexOf('{') + 1, \n fullTagName.indexOf('}')\n );\n\n // Check if new paragraph\n if (fullTagName === '' && content === '')\n {\n isNewParagraph = true;\n return;\n }\n\n switch (tagName)\n {\n // Titles\n case '\\\\title':\n section_counter = 0;\n subsection_counter = 0;\n subsubsection_counter = 0;\n\n elements.push(\n <TitleEditor\n key={ elements.length }\n type={ 0 }\n content={ content }/>\n );\n break;\n case '\\\\subtitle':\n elements.push(\n <TitleEditor\n key={ elements.length }\n type={ 1 }\n content={ content }/>\n );\n break;\n\n // Sections\n case '\\\\section':\n section_counter++;\n subsection_counter = 0;\n subsubsection_counter = 0;\n\n elements.push(\n <SectionEditor\n key={ elements.length }\n index={ section_counter }\n type={ 0 }\n content={ content }/>\n );\n break;\n case '\\\\unsection':\n elements.push(\n <SectionEditor\n key={ elements.length }\n index={ 0 }\n type={ 0 }\n content={ content }/>\n );\n break;\n case '\\\\newsection':\n section_counter = 1;\n subsection_counter = 0;\n\n elements.push(\n <SectionEditor\n key={ elements.length }\n index={ section_counter }\n type={ 0 }\n content={ content }/>\n );\n break;\n case '\\\\subsection':\n subsection_counter++;\n subsubsection_counter = 0;\n \n elements.push(\n <SectionEditor\n key={ elements.length }\n index={ subsection_counter }\n type={ 1 }\n content={ content }/>\n );\n break;\n case '\\\\unsubsection':\n elements.push(\n <SectionEditor\n key={ elements.length }\n index={ 0 }\n type={ 1 }\n content={ content }/>\n );\n break;\n case '\\\\subsubsection':\n subsubsection_counter++;\n \n elements.push(\n <SectionEditor\n key={ elements.length }\n index={ subsubsection_counter }\n type={ 2 }\n content={ content }/>\n );\n break;\n case '\\\\unsubsubsection':\n elements.push(\n <SectionEditor\n key={ elements.length }\n index={ 0 }\n type={ 2 }\n content={ content }/>\n );\n break;\n \n // Paragraphs\n case '\\\\base':\n elements.push(\n <ParagraphEditor\n key={ elements.length }\n type=\"base\"\n content={ content }/>\n );\n break;\n case '\\\\italic':\n elements.push(\n <ParagraphEditor\n key={ elements.length }\n type=\"italic\"\n content={ content }/>\n );\n break;\n case '\\\\centred':\n if (isNewParagraph)\n {\n elements.push(\n <ParagraphEditor\n key={ elements.length }\n type=\"center new\"\n content={ content }/>\n );\n\n isNewParagraph = false;\n }\n else\n elements.push(\n <ParagraphEditor\n key={ elements.length }\n type=\"center\"\n content={ content }/>\n );\n break;\n case '\\\\important':\n elements.push(\n <ParagraphEditor\n key={ elements.length }\n type=\"center important\"\n content={ content }/>\n );\n break;\n\n // Properties\n case '\\\\remark':\n elements.push(\n <PropertyEditor\n key={ elements.length }\n type={ 0 }\n property={ property }\n content={ content }/>\n );\n break;\n case '\\\\definition':\n elements.push(\n <PropertyEditor\n key={ elements.length }\n type={ 1 }\n property={ property }\n content={ content }/>\n );\n break;\n case '\\\\theorem':\n elements.push(\n <PropertyEditor\n key={ elements.length }\n type={ 2 }\n property={ property }\n content={ content }/>\n );\n break;\n\n // Lists\n case '\\\\list':\n elements.push(\n <ListEditor\n key={ elements.length }\n type={ listType }\n content={ content }/>\n );\n break;\n case '\\\\listDash':\n listType = 0;\n\n elements.push(\n <ListEditor\n key={ elements.length }\n type={ listType }\n content={ content }/>\n );\n break;\n case '\\\\listBullet':\n listType = 1;\n\n elements.push(\n <ListEditor\n key={ elements.length }\n type={ listType }\n content={ content }/>\n );\n break;\n \n // Maths\n case '\\\\maths':\n elements.push(\n <MathsEditor\n key={ elements.length }\n content={ content }\n isImportant={ false }/>\n );\n break;\n case '\\\\mathsImportant':\n elements.push(\n <MathsEditor\n key={ elements.length }\n content={ content }\n isImportant={ true }/>\n );\n break;\n default:\n if (isNewParagraph)\n {\n elements.push(<ParagraphEditor\n key={ elements.length }\n type=\"paragraph\"\n content={ element } />\n );\n\n isNewParagraph = false;\n }\n else\n elements.push(<ParagraphEditor key={ elements.length } content={ element }/>);\n\n break;\n }\n });\n\n return elements;\n }", "function ElementLayouter(element){this.layoutElement=element;}", "function setElementDisplay(Element, state) {\n\toElement = createReference(Element)\n if (!isNav) { oElement.display = state.toLowerCase(); }\t\t//This function does not work in NAV4!\n}", "function revealCopy(element) {\n\n\t\t\tif ( $(element).find('.section-container-text-block').find('h1').length ) {\n\n\t\t\t\tconsole.log('elements exist.');\n\n\t\t\t\tvar h1 = new SplitText($(element).find('h1'), {type: 'words, lines, chars', reduceWhiteSpace: true, position: null}), \n\t\t\t\t\t$h1 = h1.lines;\n\n\t\t\t\tvar tlH1 = new Timeline({paused: false, onComplete: function() { h1.revert(); } });\n\t\t\t\t\ttlH1.staggerFrom($h1, 1, {autoAlpha: 0, y: 25, ease: Expo.easeInOut}, 0.025);\n\n\t\t\t\t\ttlH1.delay(2).play(0);\n\n\t\t\t}\n\n\t\t\tif ( $(element).find('.section-container-text-block').find('p').length ) {\n\n\t\t\t\tconsole.log('elements exist.');\n\n\t\t\t\tvar p = new SplitText($(element).find('p'), {type: 'words, lines, chars', reduceWhiteSpace: true, position: null}), \n\t\t\t\t\t$p = p.lines;\n\n\t\t\t\tvar tlP = new Timeline({paused: false, onComplete: function() { p.revert(); } });\n\t\t\t\t\ttlP.staggerFrom($p, 1, {autoAlpha: 0, y: 25, ease: Expo.easeInOut}, 0.025);\n\n\t\t\t\t\ttlP.delay(2).play(0);\n\n\t\t\t}\n\n\t\t\tif ( $(element).find('.section-container-text-block').find('ul').length ) {\n\n\t\t\t\tconsole.log('elements exist.');\n\n\t\t\t\tvar list = new SplitText($(element).find('ul').children(), {type: 'words, lines, chars', reduceWhiteSpace: true, position: null}), \n\t\t\t\t\t$list = list.lines;\n\n\t\t\t\tvar tlList = new Timeline({paused: false, onComplete: function() { list.revert(); } });\n\t\t\t\t\ttlList.staggerFrom($list, 1, {autoAlpha: 0, y: 25, ease: Expo.easeInOut}, 0.025);\n\n\t\t\t\t\ttlList.delay(2).play(0);\n\n\t\t\t}\n\n\t\t}", "function traverseReadingOrder(element, ariaHidden) {\n\n //Check for aria-hidden=true\n ariaHidden = (ariaHidden || $(element).attr(\"aria-hidden\") === \"true\") ? true : false;\n\n for (var z = 0; z < element.childNodes.length; z++) {\n\n //if child is an element object that is visible\n if (element.childNodes[z].nodeType === 1) {\n if (!$(element.childNodes[z]).is(exclusions) && $(element.childNodes[z]).is(\":shown\")) {\n if ($(element.childNodes[z]).is(inclusions)) {//no need to look at this element's childNodes\n insertReadingOrder(ariaHidden, element.childNodes[z]);\n z++;//because a new node was inserted, the indexes changed\n }\n else {//recursion here:\n traverseReadingOrder(element.childNodes[z], ariaHidden);\n }\n }\n }\n //else if child is a text node\n else if (element.childNodes[z].nodeType === 3) {\n if ($.trim(element.childNodes[z].nodeValue) !== \"\") {\n //Found some text\n insertReadingOrder(ariaHidden, element.childNodes[z]);\n z++;//because a new node was inserted, the indexes changed\n }\n }\n }\n\n //this function inserts the reading order overlay\n //if it's hidden using aria-hidden it will insert an alert overlay\n function insertReadingOrder(ariaHidden, node) {\n if (ariaHidden) {\n overlayObject = andiOverlay.createOverlay(\"ANDI508-overlay-alert ANDI508-overlay-readingOrder\", \"X\", \"hidden from screen reader using aria-hidden=true\");\n }\n else {\n readingSequence++;\n overlayObject = andiOverlay.createOverlay(\"ANDI508-overlay-readingOrder\", readingSequence);\n }\n andiOverlay.insertAssociatedOverlay(node, overlayObject);\n }\n }", "function initElement(el) {\n // samurize() jQuery plugin (below) calls this to make an element editable\n var $el = $(el);\n\n // Do not re-apply\n if ($el.data('cmsItem'))\n return;\n\n var cmsItem = _getCmsItemInfo($el);\n if (!cmsItem) { // apparently we couldn't get hold of any cmsItemInfo\n return;\n }\n $el.data('cmsItem', cmsItem);\n\n // Ignore this element altogether if this is specified in its attributes\n if (cmsItem.ignoreMe)\n return;\n\n // If we have set \"parent\" containers for SamuraiCMS, we should ignore any \n // elements which fall outside of these containers.\n if (samuraiContainers && !$el.parents().filter(samuraiContainers).length) {\n // Remove any cmsitem'y classes from elements which aren't enabled for SamuraiCMS\n $el.removeClass('sm-js-cmsitem')\n .removeClass('sm-js-cmsitem_editable')\n .removeClass('sm-js-cmsitem_linkable');\n return;\n }\n if (typeof $(mov.vars.samuraiContainerBlockSelector) != \"undefined\" && $(mov.vars.samuraiContainerBlockSelector) && $el.parents().filter($(mov.vars.samuraiContainerBlockSelector)).length) {\n // Remove any cmsitem'y classes from elements which aren't enabled for SamuraiCMS\n $el.removeClass('sm-js-cmsitem')\n .removeClass('sm-js-cmsitem_editable')\n .removeClass('sm-js-cmsitem_linkable');\n return;\n }\n\n // Turn \"page\" linkable into special addSkipped-style entry\n if (cmsItem.isPage) {\n _$id('skippedItemsDropdown').addClass(_cls.dropdownContainsPage);\n _$id('skippedCmsItemsLinkable')\n .html('Content on this page is drawn from: ')\n .append($(\n '<a ' +\n 'href=\"' + cmsItem.href + '\" ' +\n 'title=\"Samurai Admin - Edit ' + cmsItem.type + \" #\" + cmsItem.id + '\" ' +\n 'target=\"_blank\">' +\n cmsItem.type + ' #' + cmsItem.id +\n '</a>'\n ));\n $el.remove();\n return;\n }\n\n // Wire-up cms item\n $el.mouseenter(_cmsItem_onMouseEnter);\n $el.mouseleave(_cmsItem_onMouseLeave);\n\n // Give item-list items (containers) a special appearance\n if (cmsItem.actions['add-child']) {\n $el.addClass(_cls.cmsItemContainer);\n }\n\n // Ensure inline elements highlight like a box (not like a set of line-boxes)\n if (_getComputedStyle($el[0], 'display') == 'inline') {\n var hasChildren = $el.children().length != 0;\n \n var message_id = $el.attr('message_id');\n\n var hasBlockChildren = hasChildren && _getComputedStyle($el.children()[0], 'display') == 'block' && $el.children()[0].tagName.toLowerCase() != 'img';\n\n // Need \"inline-block\" instead of \"black\" for display, if the element contains other block elements (except images), and we also don't worry about WYSIYWG snippet types\n var disp = ( hasBlockChildren || _displayCmsItemAsBlock( cmsItem ) ) ? 'block' : 'inline-block';\n\n if (hasChildren) {\n // Sections commented out to fix MOV2360-28 - underline missing from login\n $el.css({\n 'display': disp,\n //'display': 'block' ,\n 'zoom': 1,\n 'text-indent': 0\n });\n }\n }\n }", "function showElement(el1) {\n el1.style.display = \"inline-block\";\n }", "function changeElementCss () {\n\t\t\t// console.log(element);style.display\n\t\t\telement.style.color = color;\n\t\t\telement.style.visibility = 'visible';\n\t\t\tconsole.dir(element);\n\t\t}", "get innerElements() {\n return [this.setInputAttributes(this.inputElement)];\n }", "function Elements (){\n\t\n\treturn (\n\t\t<div id=\"Elements\">\n\t\t\t<section id=\"main\">\n\t\t\t\t<div className=\"inner\">\n\t\t\t\t\t<header className=\"major special\">\n\t\t\t\t\t\t<h1>Elements</h1>\n\t\t\t\t\t\t<p>Lorem ipsum dolor sit amet nullam id egestas urna aliquam</p>\n\t\t\t\t\t</header>\n\n\t\t\t\t\t\t<section>\n\t\t\t\t\t\t\t<h3>Text</h3>\n\t\t\t\t\t\t\t<p>This is <b>bold</b> and this is <strong>strong</strong>. This is <i>italic</i> and this is <em>emphasized</em>.\n\t\t\t\t\t\t\tThis is <sup>superscript</sup> text and this is <sub>subscript</sub> text.\n\t\t\t\t\t\t\tThis is <u>underlined</u> and this is code: <code>for (;;) &lbrace; ... &rbrace;</code>. Finally, <a href=\"#\">this is a link</a>.</p>\n\n\t\t\t\t\t\t\t<hr />\n\n\t\t\t\t\t\t\t<header>\n\t\t\t\t\t\t\t\t<h3>Heading with a Subtitle</h3>\n\t\t\t\t\t\t\t\t<p>Lorem ipsum dolor sit amet nullam id egestas urna aliquam</p>\n\t\t\t\t\t\t\t</header>\n\t\t\t\t\t\t\t<p>Nunc lacinia ante nunc ac lobortis. Interdum adipiscing gravida odio porttitor sem non mi integer non faucibus ornare mi ut ante amet placerat aliquet. Volutpat eu sed ante lacinia sapien lorem accumsan varius montes viverra nibh in adipiscing blandit tempus accumsan.</p>\n\t\t\t\t\t\t\t<header>\n\t\t\t\t\t\t\t\t<h4>Heading with a Subtitle</h4>\n\t\t\t\t\t\t\t\t<p>Lorem ipsum dolor sit amet nullam id egestas urna aliquam</p>\n\t\t\t\t\t\t\t</header>\n\t\t\t\t\t\t\t<p>Nunc lacinia ante nunc ac lobortis. Interdum adipiscing gravida odio porttitor sem non mi integer non faucibus ornare mi ut ante amet placerat aliquet. Volutpat eu sed ante lacinia sapien lorem accumsan varius montes viverra nibh in adipiscing blandit tempus accumsan.</p>\n\n\t\t\t\t\t\t\t<hr />\n\n\t\t\t\t\t\t\t<h2>Heading Level 2</h2>\n\t\t\t\t\t\t\t<h3>Heading Level 3</h3>\n\t\t\t\t\t\t\t<h4>Heading Level 4</h4>\n\t\t\t\t\t\t\t<h5>Heading Level 5</h5>\n\t\t\t\t\t\t\t<h6>Heading Level 6</h6>\n\n\t\t\t\t\t\t\t<hr />\n\n\t\t\t\t\t\t\t<h4>Blockquote</h4>\n\t\t\t\t\t\t\t<blockquote>Fringilla nisl. Donec accumsan interdum nisi, quis tincidunt felis sagittis eget tempus euismod. Vestibulum ante ipsum primis in faucibus vestibulum. Blandit adipiscing eu felis iaculis volutpat ac adipiscing accumsan faucibus. Vestibulum ante ipsum primis in faucibus lorem ipsum dolor sit amet nullam adipiscing eu felis.</blockquote>\n\n\t\t\t\t\t\t\t<h4>Preformatted</h4>\n\t\t\t\t\t\t\t<pre>\n\t\t\t\t\t\t\t\t<code>\n\t\t\t\t\t\t\t\t\there your code\n\t\t\t\t\t\t\t\t</code>\n\t\t\t\t\t\t\t</pre>\n\t\t\t\t\t\t</section>\n\n\t\t\t\t\t\t<section>\n\t\t\t\t\t\t\t<h3>Lists</h3>\n\t\t\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t\t\t<div className=\"6u 12u$(xsmall)\">\n\n\t\t\t\t\t\t\t\t\t<h4>Unordered</h4>\n\t\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t\t<li>Dolor pulvinar etiam magna etiam.</li>\n\t\t\t\t\t\t\t\t\t\t<li>Sagittis adipiscing lorem eleifend.</li>\n\t\t\t\t\t\t\t\t\t\t<li>Felis enim feugiat dolore viverra.</li>\n\t\t\t\t\t\t\t\t\t</ul>\n\n\t\t\t\t\t\t\t\t\t<h4>Alternate</h4>\n\t\t\t\t\t\t\t\t\t<ul className=\"alt\">\n\t\t\t\t\t\t\t\t\t\t<li>Dolor pulvinar etiam magna etiam.</li>\n\t\t\t\t\t\t\t\t\t\t<li>Sagittis adipiscing lorem eleifend.</li>\n\t\t\t\t\t\t\t\t\t\t<li>Felis enim feugiat dolore viverra.</li>\n\t\t\t\t\t\t\t\t\t</ul>\n\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div className=\"6u$ 12u$(xsmall)\">\n\n\t\t\t\t\t\t\t\t\t<h4>Ordered</h4>\n\t\t\t\t\t\t\t\t\t<ol>\n\t\t\t\t\t\t\t\t\t\t<li>Dolor pulvinar etiam magna etiam.</li>\n\t\t\t\t\t\t\t\t\t\t<li>Etiam vel felis at lorem sed viverra.</li>\n\t\t\t\t\t\t\t\t\t\t<li>Felis enim feugiat dolore viverra.</li>\n\t\t\t\t\t\t\t\t\t\t<li>Dolor pulvinar etiam magna etiam.</li>\n\t\t\t\t\t\t\t\t\t\t<li>Etiam vel felis at lorem sed viverra.</li>\n\t\t\t\t\t\t\t\t\t\t<li>Felis enim feugiat dolore viverra.</li>\n\t\t\t\t\t\t\t\t\t</ol>\n\n\t\t\t\t\t\t\t\t\t<h4>Icons</h4>\n\t\t\t\t\t\t\t\t\t<ul className=\"icons\">\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"icon fa-twitter\"><span className=\"label\">Twitter</span></a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"icon fa-facebook\"><span className=\"label\">Facebook</span></a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"icon fa-instagram\"><span className=\"label\">Instagram</span></a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"icon fa-github\"><span className=\"label\">Github</span></a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"icon fa-dribbble\"><span className=\"label\">Dribbble</span></a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"icon fa-tumblr\"><span className=\"label\">Tumblr</span></a></li>\n\t\t\t\t\t\t\t\t\t</ul>\n\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<h4>Actions</h4>\n\t\t\t\t\t\t\t<ul className=\"actions\">\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button special\">Special</a></li>\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button\">Default</a></li>\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button alt\">Alternate</a></li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t<ul className=\"actions small\">\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button special small\">Small</a></li>\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button small\">Small</a></li>\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button alt small\">Small</a></li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t\t\t<div className=\"3u 6u(small) 12u$(xsmall)\">\n\t\t\t\t\t\t\t\t\t<ul className=\"actions vertical\">\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button special\">Vertical</a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button\">Vertical</a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button alt\">Vertical</a></li>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div className=\"3u 6u$(small) 12u$(xsmall)\">\n\t\t\t\t\t\t\t\t\t<ul className=\"actions vertical small\">\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button special small\">Small</a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button small\">Small</a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button alt small\">Small</a></li>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div className=\"3u 6u(small) 12u$(xsmall)\">\n\t\t\t\t\t\t\t\t\t<ul className=\"actions vertical\">\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button special fit\">Fit</a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button fit\">Fit</a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button alt fit\">Fit</a></li>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div className=\"3u$ 6u$(small) 12u$(xsmall)\">\n\t\t\t\t\t\t\t\t\t<ul className=\"actions vertical small\">\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button special small fit\">Small</a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button small fit\">Small</a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button alt small fit\">Small</a></li>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</section>\n\n\t\t\t\t\t\t<section>\n\t\t\t\t\t\t\t<h3>Table</h3>\n\t\t\t\t\t\t\t<h4>Default</h4>\n\t\t\t\t\t\t\t<div className=\"table-wrapper\">\n\t\t\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<th>Name</th>\n\t\t\t\t\t\t\t\t\t\t\t<th>Description</th>\n\t\t\t\t\t\t\t\t\t\t\t<th>Price</th>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>Item 1</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>Ante turpis integer aliquet porttitor.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>29.99</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>Item 2</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>Vis ac commodo adipiscing arcu aliquet.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>19.99</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>Item 3</td>\n\t\t\t\t\t\t\t\t\t\t\t<td> Morbi faucibus arcu accumsan lorem.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>29.99</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>Item 4</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>Vitae integer tempus condimentum.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>19.99</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>Item 5</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>Ante turpis integer aliquet porttitor.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>29.99</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t\t\t\t<tfoot>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td colSpan=\"2\"></td>\n\t\t\t\t\t\t\t\t\t\t\t<td>100.00</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</tfoot>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<h4>Alternate</h4>\n\t\t\t\t\t\t\t<div className=\"table-wrapper\">\n\t\t\t\t\t\t\t\t<table className=\"alt\">\n\t\t\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<th>Name</th>\n\t\t\t\t\t\t\t\t\t\t\t<th>Description</th>\n\t\t\t\t\t\t\t\t\t\t\t<th>Price</th>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>Item 1</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>Ante turpis integer aliquet porttitor.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>29.99</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>Item 2</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>Vis ac commodo adipiscing arcu aliquet.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>19.99</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>Item 3</td>\n\t\t\t\t\t\t\t\t\t\t\t<td> Morbi faucibus arcu accumsan lorem.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>29.99</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>Item 4</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>Vitae integer tempus condimentum.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>19.99</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>Item 5</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>Ante turpis integer aliquet porttitor.</td>\n\t\t\t\t\t\t\t\t\t\t\t<td>29.99</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t\t\t\t<tfoot>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td colSpan=\"2\"></td>\n\t\t\t\t\t\t\t\t\t\t\t<td>100.00</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</tfoot>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</section>\n\n\t\t\t\t\t\t<section>\n\t\t\t\t\t\t\t<h3>Buttons</h3>\n\t\t\t\t\t\t\t<ul className=\"actions\">\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button special\">Special</a></li>\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button\">Default</a></li>\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button alt\">Alternate</a></li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t<ul className=\"actions\">\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button special big\">Big</a></li>\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button\">Default</a></li>\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button alt small\">Small</a></li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t\t\t<div className=\"6u 12u$(xsmall)\">\n\t\t\t\t\t\t\t\t\t<ul className=\"actions fit\">\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button fit\">Fit</a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button alt fit\">Fit</a></li>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div className=\"6u$ 12u$(xsmall)\">\n\t\t\t\t\t\t\t\t\t<ul className=\"actions fit small\">\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button fit small\">Fit + Small</a></li>\n\t\t\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button alt fit small\">Fit + Small</a></li>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<ul className=\"actions\">\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button special icon fa-download\">Icon</a></li>\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button icon fa-download\">Icon</a></li>\n\t\t\t\t\t\t\t\t<li><a href=\"#\" className=\"button alt icon fa-download\">Icon</a></li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t<ul className=\"actions\">\n\t\t\t\t\t\t\t\t<li><span className=\"button special disabled\">Special</span></li>\n\t\t\t\t\t\t\t\t<li><span className=\"button disabled\">Default</span></li>\n\t\t\t\t\t\t\t\t<li><span className=\"button alt disabled\">Alternate</span></li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</section>\n\n\t\t\t\t\t\t<section>\n\t\t\t\t\t\t\t<h3>Form</h3>\n\t\t\t\t\t\t\t<form method=\"post\" action=\"#\">\n\t\t\t\t\t\t\t\t<div className=\"row uniform 50%\">\n\t\t\t\t\t\t\t\t\t<div className=\"6u 12u$(xsmall)\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"demo-name\" id=\"demo-name\" defaultValue=\"\" placeholder=\"Name\" />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"6u$ 12u$(xsmall)\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"email\" name=\"demo-email\" id=\"demo-email\" defaultValue=\"\" placeholder=\"Email\" />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"12u$\">\n\t\t\t\t\t\t\t\t\t\t<div className=\"select-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<select name=\"demo-category\" id=\"demo-category\">\n\t\t\t\t\t\t\t\t\t\t\t\t<option defaultValue=\"\">- Category -</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option defaultValue=\"1\">Manufacturing</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option defaultValue=\"1\">Shipping</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option defaultValue=\"1\">Administration</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option defaultValue=\"1\">Human Resources</option>\n\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"4u 12u$(xsmall)\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"priority-low\" name=\"priority\" defaultChecked />\n\t\t\t\t\t\t\t\t\t\t<label htmlFor=\"priority-low\">Low Priority</label>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"4u 12u$(xsmall)\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"priority-normal\" name=\"priority\" />\n\t\t\t\t\t\t\t\t\t\t<label htmlFor=\"priority-normal\">Normal Priority</label>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"4u$ 12u$(xsmall)\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"radio\" id=\"priority-high\" name=\"priority\" />\n\t\t\t\t\t\t\t\t\t\t<label htmlFor=\"priority-high\">High Priority</label>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"6u 12u$(small)\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" id=\"copy\" name=\"copy\" />\n\t\t\t\t\t\t\t\t\t\t<label htmlFor=\"copy\">Email me a copy of this message</label>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"6u$ 12u$(small)\">\n\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" id=\"human\" name=\"human\" defaultChecked />\n\t\t\t\t\t\t\t\t\t\t<label htmlFor=\"human\">I am a human and not a robot</label>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"12u$\">\n\t\t\t\t\t\t\t\t\t\t<textarea name=\"demo-message\" id=\"demo-message\" placeholder=\"Enter your message\" rows=\"6\"></textarea>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div className=\"12u$\">\n\t\t\t\t\t\t\t\t\t\t<ul className=\"actions\">\n\t\t\t\t\t\t\t\t\t\t\t<li><input type=\"submit\" defaultValue=\"Send Message\" className=\"special\" /></li>\n\t\t\t\t\t\t\t\t\t\t\t<li><input type=\"reset\" defaultValue=\"Reset\" /></li>\n\t\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t</section>\n\n\t\t\t\t\t\t<section>\n\t\t\t\t\t\t\t<h3>Image</h3>\n\t\t\t\t\t\t\t<h4>Fit</h4>\n\t\t\t\t\t\t\t<div className=\"box alt\">\n\t\t\t\t\t\t\t\t<div className=\"row 50% uniform\">\n\t\t\t\t\t\t\t\t\t<div className=\"12u$\"><span className=\"image fit\"><img src=\"images/pic11.jpg\" alt=\"\" /></span></div>\n\t\t\t\t\t\t\t\t\t<div className=\"4u\"><span className=\"image fit\"><img src=\"images/pic03.jpg\" alt=\"\" /></span></div>\n\t\t\t\t\t\t\t\t\t<div className=\"4u\"><span className=\"image fit\"><img src=\"images/pic04.jpg\" alt=\"\" /></span></div>\n\t\t\t\t\t\t\t\t\t<div className=\"4u$\"><span className=\"image fit\"><img src=\"images/pic05.jpg\" alt=\"\" /></span></div>\n\t\t\t\t\t\t\t\t\t<div className=\"4u\"><span className=\"image fit\"><img src=\"images/pic05.jpg\" alt=\"\" /></span></div>\n\t\t\t\t\t\t\t\t\t<div className=\"4u\"><span className=\"image fit\"><img src=\"images/pic03.jpg\" alt=\"\" /></span></div>\n\t\t\t\t\t\t\t\t\t<div className=\"4u$\"><span className=\"image fit\"><img src=\"images/pic04.jpg\" alt=\"\" /></span></div>\n\t\t\t\t\t\t\t\t\t<div className=\"4u\"><span className=\"image fit\"><img src=\"images/pic04.jpg\" alt=\"\" /></span></div>\n\t\t\t\t\t\t\t\t\t<div className=\"4u\"><span className=\"image fit\"><img src=\"images/pic05.jpg\" alt=\"\" /></span></div>\n\t\t\t\t\t\t\t\t\t<div className=\"4u$\"><span className=\"image fit\"><img src=\"images/pic03.jpg\" alt=\"\" /></span></div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<h4>Left &amp; Right</h4>\n\t\t\t\t\t\t\t<p><span className=\"image left\"><img src=\"images/pic06.jpg\" alt=\"\" /></span>Fringilla nisl. Donec accumsan interdum nisi, quis tincidunt felis sagittis eget. tempus euismod. Vestibulum ante ipsum primis in faucibus vestibulum. Blandit adipiscing eu felis iaculis volutpat ac adipiscing accumsan eu faucibus. Integer ac pellentesque praesent tincidunt felis sagittis eget. tempus euismod. Vestibulum ante ipsum primis in faucibus vestibulum. Blandit adipiscing eu felis iaculis volutpat ac adipiscing accumsan eu faucibus. Integer ac pellentesque praesent. Donec accumsan interdum nisi, quis tincidunt felis sagittis eget. tempus euismod. Vestibulum ante ipsum primis in faucibus vestibulum. Blandit adipiscing eu felis iaculis volutpat ac adipiscing accumsan eu faucibus. Integer ac pellentesque praesent tincidunt felis sagittis eget. tempus euismod. Vestibulum ante ipsum primis in faucibus vestibulum. Blandit adipiscing eu felis iaculis volutpat ac adipiscing accumsan eu faucibus. Integer ac pellentesque praesent.</p>\n\t\t\t\t\t\t\t<p><span className=\"image right\"><img src=\"images/pic06.jpg\" alt=\"\" /></span>Fringilla nisl. Donec accumsan interdum nisi, quis tincidunt felis sagittis eget. tempus euismod. Vestibulum ante ipsum primis in faucibus vestibulum. Blandit adipiscing eu felis iaculis volutpat ac adipiscing accumsan eu faucibus. Integer ac pellentesque praesent tincidunt felis sagittis eget. tempus euismod. Vestibulum ante ipsum primis in faucibus vestibulum. Blandit adipiscing eu felis iaculis volutpat ac adipiscing accumsan eu faucibus. Integer ac pellentesque praesent. Donec accumsan interdum nisi, quis tincidunt felis sagittis eget. tempus euismod. Vestibulum ante ipsum primis in faucibus vestibulum. Blandit adipiscing eu felis iaculis volutpat ac adipiscing accumsan eu faucibus. Integer ac pellentesque praesent tincidunt felis sagittis eget. tempus euismod. Vestibulum ante ipsum primis in faucibus vestibulum. Blandit adipiscing eu felis iaculis volutpat ac adipiscing accumsan eu faucibus. Integer ac pellentesque praesent.</p>\n\t\t\t\t\t\t</section>\n\n\t\t\t\t</div>\n\t\t\t</section>\n\n\n\t\t\t<section id=\"footer\">\n\t\t\t\t<div className=\"inner\">\n\t\t\t\t\t<header>\n\t\t\t\t\t\t<h2>Get in Touch</h2>\n\t\t\t\t\t</header>\n\t\t\t\t\t<form method=\"post\" action=\"#\">\n\t\t\t\t\t\t<div className=\"field half first\">\n\t\t\t\t\t\t\t<label htmlFor=\"name\">Name</label>\n\t\t\t\t\t\t\t<input type=\"text\" name=\"name\" id=\"name\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"field half\">\n\t\t\t\t\t\t\t<label htmlFor=\"email\">Email</label>\n\t\t\t\t\t\t\t<input type=\"text\" name=\"email\" id=\"email\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"field\">\n\t\t\t\t\t\t\t<label htmlFor=\"message\">Message</label>\n\t\t\t\t\t\t\t<textarea name=\"message\" id=\"message\" rows=\"6\"></textarea>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<ul className=\"actions\">\n\t\t\t\t\t\t\t<li><input type=\"submit\" defaultValue=\"Send Message\" className=\"alt\" /></li>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</form>\n\t\t\t\t\t<div className=\"copyright\">\n\t\t\t\t\t\t&copy; Untitled Design: <a href=\"https://templated.co/\">TEMPLATED</a>. Images <a href=\"https://unsplash.com/\">Unsplash</a>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</section>\n\t\t</div>\n\t);\n\n\t\n}", "function _element(name, contents) {\n\t\t\treturn '<div' + (name ? ' class=\"' + BOXPLUS + '-' + ($.isArray(name) ? name.join(' ') : name) + '\"' : '') + '>' + (contents ? contents : '') + '</div>';\n\t\t}", "function RenderableDOMElement() {\n }", "function changeElements(){\n let objectIndex = carData[this.id];\n\n //change the text using the values of the properties in the object\n modelName.firstChild.nodeValue = objectIndex.headline;\n priceInfo.firstChild.nodeValue = objectIndex.price;\n theDetails.firstChild.nodeValue = objectIndex.details;\n\n\n //adding the content from contentObject.js\n modelName.classList.add(this.id);\n priceInfo.classList.add(this.id);\n theDetails.classList.add(this.id);\n\n //remove the colours we applied on the last click\n focusMini.classList.remove(appliedClass);\n\n appliedClass = this.id;\n }", "function updateElementProperties() {\n // evaluation of current selected element.\n //chrome.devtools.inspectedWindow.eval(\"$0.tagName\", th)\n chrome.devtools.inspectedWindow.eval(\"$0.tagName || $0.localName || $0.nodeName\", function(result, error) {\n // Pushing the result.\n console.log(result);\n dataObj.tagName = result;\n\n chrome.devtools.inspectedWindow.eval(\"$0.innerText\", function(result, error) {\n // Pushing the result. JSON.stringify(result);\n console.log(result);\n dataObj.innerText = result;\n\n chrome.devtools.inspectedWindow.eval(\"$0.getAttributeNames()\", function(result, error) {\n // Pushing the result. JSON.stringify(result);\n console.log(result);\n dataObj.attributeKeys = result;\n\n chrome.devtools.inspectedWindow.eval(\"($0.getAttributeNames()).map(function(attrib){ return ('@' + attrib +'=\\\"'+ $0.getAttribute(attrib) +'\\\"'); });\", function(result, error) {\n // Pushing the result.\n console.log(result);\n dataObj.attributeData = result;\n\n chrome.devtools.inspectedWindow.eval(\"if($0.childNodes.length > 0) { $0.firstElementChild.tagName; } else {'No child'}\", function(result, error) {\n // Pushing the result. JSON.stringify(result);\n console.log(result);\n dataObj.firstChildNode = result;\n\n chrome.devtools.inspectedWindow.eval(\"if($0.nextElementSibling !== null) { $0.nextElementSibling.tagName; } else {'No Sibling'}\", function(result, error) {\n // Pushing the result. JSON.stringify(result);\n console.log(result);\n dataObj.nextSiblingNode = result;\n\n chrome.devtools.inspectedWindow.eval(\"$0.parentElement.tagName\", function(result, error) {\n // Pushing the result. JSON.stringify(result);\n console.log(result);\n dataObj.parentNode = result;\n\n // Update the data of the side panel.\n //sidebar.setPage('panel.html'); // Showing a page on this sidebar.\n //sidebar.setHeight(\"100px\");\n sidebar.setObject(updatePanelWithData(), \"Extracted Data for the current Selected element\", function(obj) {});\n\n });\n });\n });\n });\n });\n });\n });\n }", "function initSpanLabel(element) {\n $(element).each(function() {\n var description = $(this).html();\n while (description.length != 0 && (description[0] == '\\n' ||\n description[0] == ' ' || description[0] == '\\r')) {\n description = description.substring(1, description.length)\n }\n while (description.length != 0 && (description[description.length - 1] == '\\n' ||\n description[description.length - 1] == ' ' || description[description.length - 1] == '\\r')) {\n description = description.substring(0, description.length - 1)\n }\n description = \"<div>\" + convertDescription(description) + \"</div>\";\n var html = $(description);\n $(\"span br\", html).remove();\n description = html.html();\n $(this).html(description);\n });\n}", "display(ele) {\n // make sure ele is a DOM element\n if (this.isDOM(ele)) {\n ele.style.display = 'block';\n } else {\n console.error('Error while trying to display a non DOM object');\n }\n }", "function populateStyleLayout(clicked_element) {\n\tvar element_id = clicked_element.attr('element_id')\n\tvar property = properties[element_id]\n\tvar template = get_template('element_style.template')\n\tvar output = Mustache.render(template, property)\n\t$(\"#style\").html(output);\n\t$(\"#style #text\").html(clicked_element.html())\n}", "getElement(){return this.__element}", "function RElement() { }", "function RElement() { }", "function separateElements() {\r\n\tvar r = 0; var c = 0; var t = 0; var rl = 0; var cl = 0; var tl = 0; var b = 0;\r\n\tfor (var q = 0; q < inputs.length; q++) {\r\n\t\tif(inputs[q].type == \"radio\") {\r\n\t\t\tradios[r] = inputs[q]; ++r;\r\n\t\t\tfor(var w = 0; w < labels.length; w++) {\r\n\t\t\t\tif((inputs[q].id) && labels[w].htmlFor == inputs[q].id)\r\n\t\t\t\t{\r\n\t\t\t\t\tradioLabels[rl] = labels[w];\r\n\t\t\t\t\t++rl;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(inputs[q].type == \"checkbox\") {\r\n\t\t\tcheckboxes[c] = inputs[q]; ++c;\r\n\t\t\tfor(var w = 0; w < labels.length; w++) {\r\n\t\t\t\tif((inputs[q].id) && (labels[w].htmlFor == inputs[q].id))\r\n\t\t\t\t{\r\n\t\t\t\t\tcheckboxLabels[cl] = labels[w];\r\n\t\t\t\t\t++cl;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "adjustDom() {\n this.mergeAdjacentCommentLevels();\n this.mergeAdjacentCommentLevels();\n if (\n controller.rootElement.querySelector('.cd-commentLevel:not(ol) + .cd-commentLevel:not(ol)')\n ) {\n console.warn('.cd-commentLevel adjacencies have left.');\n }\n\n this.items.slice(1).forEach((comment) => {\n comment.maybeSplitParent();\n });\n }", "function format_html_input() {\r\n var text = String(this);\r\n\r\n var element = Element(\"body\");\r\n element.innerHTML = text;\r\n\r\n if (Prototype.Browser.Gecko || Prototype.Browser.WebKit) {\r\n element.select('strong').each(function(element) {\r\n element.replace('<span style=\"font-weight: bold;\">' + element.innerHTML + '</span>');\r\n });\r\n element.select('em').each(function(element) {\r\n element.replace('<span style=\"font-style: italic;\">' + element.innerHTML + '</span>');\r\n });\r\n element.select('u').each(function(element) {\r\n element.replace('<span style=\"text-decoration: underline;\">' + element.innerHTML + '</span>');\r\n });\r\n }\r\n\r\n if (Prototype.Browser.WebKit)\r\n element.select('span').each(function(span) {\r\n if (span.getStyle('fontWeight') == 'bold')\r\n span.addClassName('Apple-style-span');\r\n\r\n if (span.getStyle('fontStyle') == 'italic')\r\n span.addClassName('Apple-style-span');\r\n\r\n if (span.getStyle('textDecoration') == 'underline')\r\n span.addClassName('Apple-style-span');\r\n });\r\n\r\n text = element.innerHTML;\r\n text = text.tidy_xhtml();\r\n\r\n text = text.replace(/<\\/p>(\\n)*<p>/g, \"\\n\\n\");\r\n\r\n text = text.replace(/(\\n)?<br( \\/)?>(\\n)?/g, \"\\n\");\r\n\r\n text = text.replace(/^<p>/g, '');\r\n text = text.replace(/<\\/p>$/g, '');\r\n\r\n if (Prototype.Browser.Gecko) {\r\n text = text.replace(/\\n/g, \"<br>\");\r\n text = text + '<br>';\r\n } else if (Prototype.Browser.WebKit) {\r\n text = text.replace(/\\n/g, \"</div><div>\");\r\n text = '<div>' + text + '</div>';\r\n text = text.replace(/<div><\\/div>/g, \"<div><br></div>\");\r\n } else if (Prototype.Browser.IE || Prototype.Browser.Opera) {\r\n text = text.replace(/\\n/g, \"</p>\\n<p>\");\r\n text = '<p>' + text + '</p>';\r\n text = text.replace(/<p><\\/p>/g, \"<p>&nbsp;</p>\");\r\n text = text.replace(/(<p>&nbsp;<\\/p>)+$/g, \"\");\r\n }\r\n\r\n return text;\r\n }", "function read() {\n var html = element.html();\n // When we clear the content editable the browser leaves a <br> behind\n // If strip-br attribute is provided then we strip this out\n if( attrs.stripBr && html == '<br>' ) {\n html = '';\n }\n // some tags are discarded by the contenteditable\n // bring those back\n html = \"<html><body>\" + html + \"</body></html>\";\n ngModel.$setViewValue(html);\n }", "validateTextContent(el) {\n let extractedText = $.axs.properties.getTextFromDescendantContent(el);\n return {\n extractedText: extractedText,\n result: this.isDescriptiveText(extractedText),\n };\n }", "function mostraretro1() {\n retrouno.style.display=\"block\";\n fronte1fronte1.replaceChild(retrouno,fronte1);\n //modifica delle descrizioni con il contenuto della lettera\n testo.style.display=\"block\";\n descrizionedescrizione.replaceChild(testo, descrizione); \n }", "function showInEditor(){\n playAnimation(t1);\n const headline = this.previousElementSibling.outerHTML.trim()\n .replace(/(?<=>|^|\\s)\\.{1,}(?=\\s|$|<)/g, \" <mark></mark> \");\n review.innerHTML = headline;\n placeholders = review.querySelectorAll(\"mark\");\n}", "function stylePub(el, data) {\r\n\t tram(el).set(tramify(data));\r\n\t }", "function doMOver() {\r\n var dom = window.event.srcElement;\r\n dom = __getReal(dom, \"tagName\", \"SPAN\");\r\n if (_MY_SET['ToolBar']==\"A\"||_MY_SET['ToolBar']==\"C\") {\r\n var it = dom.all.ITEXT;\r\n it.style.textDecoration = \"underline\";\r\n it.style.color = \"red\";\r\n /**\r\n dom.style.padding = \"1 4 1 4\";\r\n dom.style.color = \"#000000\";\r\n dom.style.borderStyle = \"solid\";\r\n dom.style.backgroundColor = \"#ADB9D8\";\r\n */\r\n }else if (_MY_SET['ToolBar']==\"B\"){\r\n dom.style.color = \"#FF0000\";\r\n dom.style.borderStyle = \"inset\";\r\n }\r\n }", "showDetails(element)\n\t{\n\t\tthrow new Error(\"Not implemented\");\n\t}", "function doMOut() {\r\n var dom = window.event.srcElement;\r\n dom = __getReal(dom, \"tagName\", \"SPAN\");\r\n if (_MY_SET['ToolBar']==\"A\"||_MY_SET['ToolBar']==\"C\") {\r\n var it = dom.all.ITEXT;\r\n it.style.textDecoration = \"none\";\r\n it.style.color = \"black\";\r\n /**\r\n dom.style.borderStyle = \"none\";\r\n dom.style.color = \"black\";\r\n dom.style.padding = \"2 5 2 5\";\r\n dom.style.backgroundColor = \"transparent\";\r\n */\r\n }else if (_MY_SET['ToolBar']==\"B\"){\r\n dom.style.color = \"#000000\";\r\n dom.style.borderStyle = \"outset\";\r\n }\r\n }", "function populateHTML(){\n console.log('textProps.styleRunData',textProps.styleRun);\n\n var styleRunData = textProps.styleRun;\n\n // var leftArrowPositions = [];\n\n\n\n\n\n\n var styleRunData = styleRunData.slice(styleRunData.indexOf('<'));\n\n styleRunData = removeFontParts(styleRunData);\n var textIndex = styleRunData.indexOf('<..>');\n var text = styleRunData.slice(textIndex + 4);\n if(text.indexOf('<EOT>') >= 0)\n {\n text = text.slice(0,text.indexOf('<EOT>'));\n }\n\n var styleRun = styleRunData.slice(0,textIndex-1);\n console.log('text', text);\n console.log('styleRun', styleRun);\n var soloStyleElements = styleRun.split(' ');\n console.log('soloStyleElements',soloStyleElements);\n var lastStyles = {\n color: 0,\n underline: false,\n font: 'atypewriter'\n\n };\n\n var styleElements = [];\n\n for (var i = 0, iLength = soloStyleElements.length; i < iLength; i++)\n {\n var styleElement, color, underline,font,stringLength;\n\n\n var styleStringTags = soloStyleElements[i].split('>');\n console.log('styleStringTags',styleStringTags);\n\n // Do not use last value as this will be the length of the style run\n for ( var j = 0, jLength = styleStringTags.length; j < jLength - 1; j++)\n {\n if (styleStringTags[j].slice(1,3) === 'tc')\n {\n color = styleStringTags[j].slice(3);\n underline = lastStyles.underline;\n font = lastStyles.font;\n lastStyles.color = color;\n }\n else if (styleStringTags[j].slice(1,2) === 'u')\n {\n color = lastStyles.color;\n underline = !lastStyles.underline;\n font = lastStyles.font;\n lastStyles.underline = underline;\n }\n else if (styleStringTags[j].slice(1,3) === 'fn')\n {\n color = lastStyles.color;\n underline = lastStyles.underline;\n font = styleStringTags[j].slice(3);\n lastStyles.font = font;\n }\n\n }\n\n styleElement = {\n color: parseInt(color),\n underline: underline,\n font: font,\n length: parseInt(styleStringTags[j])\n };\n\n styleElements.push(styleElement);\n\n\n\n\n\n\n }\n\n console.log('styleElements',styleElements);\n\n var fragment = new DocumentFragment();\n\n var countLength = 0;\n\n for (var i = 0, iLength = styleElements.length; i < iLength; i++)\n {\n var span = document.createElement('SPAN');\n span.innerText = text.slice(countLength,countLength + styleElements[i].length);\n console.log('text',text);\n countLength += styleElements[i].length;\n applyColorClassFromInt(span,styleElements[i].color);\n applyUnderlineClass(span,styleElements[i].underline);\n applyFontClass(span,styleElements[i].font);\n fragment.append(span);\n }\n\n console.log(fragment,fragment);\n\n while (textProps.editableDivNode.firstChild)\n {\n textProps.editableDivNode.removeChild(textProps.editableDivNode.firstChild);\n }\n textProps.editableDivNode.append(fragment);\n\n\n\n }", "function showDetails(element)\n{\n element.lastChild.style.display = \"inline\";\n}", "function showElements( id ) {\n showElement( id );\n showElement( id + '-toc' );\n}", "function walkDOM(element) {\n var elements = getParents(element);\n for (var i = 0; i < elements.length; i++) {\n elements[i].setAttribute('aria-hidden', isHidden);\n }\n }", "function showElement(element) {\n element.style.display = \"inline\";\n}", "function balanceTextAndWatch(elements) {\n if (typeof elements === 'string') {\n watching.sel.push(elements);\n } else {\n forEach(getElementsList(elements), function (el) {\n watching.el.push(el);\n });\n }\n\n initHandlers();\n updateWatched();\n }", "function manipulateelements(item){\n /*do soemthing to item*/\n}", "function displayDOM(){\r\n\t\tvar str = '';\r\n\t\tcontainer.getChildren().each(function(item){\r\n\t\t\tstr += '<div style=\"' + item.style.cssText + '\">' + item.get('text') + '</div>\\n';\r\n\t\t});\r\n\t\tdocument.id('output').set('text', str);\r\n\t}", "function RElement() {}", "function RElement() {}", "function RElement() {}", "function typistUpdateHtml(element, state) {\n var text = state.texts[state.currentTextIndex];\n var typed = text.substring(0, state.currentTypedChars);\n var untyped = text.substring(state.currentTypedChars);\n \n element.innerHTML = typed + \" <span class=\\\"typist-untyped\\\">\" + untyped + \"</span>\";\n}", "getLeftInternal(widget, elementBox, index) {\n let left = widget.paragraph.x;\n let paraFormat = widget.paragraph.paragraphFormat;\n if (this.isParagraphFirstLine(widget) && !paraFormat.bidi) {\n // tslint:disable-next-line:max-line-length\n left += HelperMethods.convertPointToPixel(widget.paragraph.paragraphFormat.firstLineIndent);\n }\n let isRtlText = false;\n let isParaBidi = false;\n if (elementBox instanceof TextElementBox) {\n isRtlText = elementBox.isRightToLeft;\n isParaBidi = elementBox.line.paragraph.paragraphFormat.bidi;\n }\n //when line contains normal text and para is RTL para.\n //if home key is pressed, update caret position after the last element in a line.\n //if end key pressed, update caret position before the first element in a line. \n if (isParaBidi) {\n if (!isRtlText) {\n if (this.viewer.moveCaretPosition === 1 && widget.children.length > 0) {\n elementBox = widget.children[widget.children.length - 1];\n }\n else if (this.viewer.moveCaretPosition === 2) {\n elementBox = widget.children[0];\n }\n if (elementBox instanceof ListTextElementBox && widget.children.length > 2) {\n elementBox = widget.children[widget.children.length - 3];\n }\n }\n }\n let count = widget.children.indexOf(elementBox);\n if ((widget.children.length === 1 && widget.children[0] instanceof ListTextElementBox) || (widget.children.length === 2\n && widget.children[0] instanceof ListTextElementBox && widget.children[1] instanceof ListTextElementBox)) {\n count = widget.children.length;\n }\n for (let i = 0; i < count; i++) {\n let widgetInternal = widget.children[i];\n // if (widgetInternal instanceof FieldElementBox) {\n // continue;\n // }\n if (i === 1 && widget.children[i] instanceof ListTextElementBox) {\n left += widget.children[i].width;\n }\n else if (widget.children[i] instanceof TabElementBox && elementBox === widgetInternal) {\n left += widget.children[i].margin.left;\n }\n else {\n left += widget.children[i].margin.left + widget.children[i].width;\n }\n }\n if (!isNullOrUndefined(elementBox)) {\n left += elementBox.margin.left;\n if (isRtlText || (this.viewer.moveCaretPosition === 1 && !isRtlText && isParaBidi)) {\n left += elementBox.width;\n }\n }\n let width = 0;\n if (elementBox instanceof TextElementBox) {\n if ((this.viewer.moveCaretPosition !== 0) && (isParaBidi || isRtlText)) {\n if ((isRtlText && isParaBidi && this.viewer.moveCaretPosition === 2)\n || (isRtlText && !isParaBidi && this.viewer.moveCaretPosition === 1)) {\n left -= elementBox.width;\n }\n this.viewer.moveCaretPosition = 0;\n return left;\n }\n if (index === elementBox.length && !isRtlText) {\n left += elementBox.width;\n }\n else if (index > elementBox.length) {\n width = this.viewer.textHelper.getParagraphMarkWidth(elementBox.line.paragraph.characterFormat);\n if (isRtlText) {\n left -= elementBox.width + width;\n }\n else {\n left += elementBox.width + width;\n }\n }\n else {\n // tslint:disable-next-line:max-line-length\n width = this.viewer.textHelper.getWidth(elementBox.text.substr(0, index), elementBox.characterFormat);\n if (isRtlText) {\n left -= width;\n }\n else {\n left += width;\n }\n }\n this.viewer.moveCaretPosition = 0;\n }\n else if (index > 0) {\n if (!isNullOrUndefined(elementBox) && !(elementBox instanceof ListTextElementBox)) {\n left += elementBox.width;\n if (index === 2) {\n let paragraph = elementBox.line.paragraph;\n left += this.viewer.textHelper.getParagraphMarkWidth(paragraph.characterFormat);\n }\n }\n else {\n left += this.viewer.textHelper.getParagraphMarkWidth(widget.paragraph.characterFormat);\n }\n }\n return left;\n }", "function read() {\n\t\t\t\t\t\tvar html = element.html();\n\t\t\t\t\t\t// When we clear the content editable the browser leaves a <br> behind\n\t\t\t\t\t\t// If strip-br attribute is provided then we strip this out\n\t\t\t\t\t\tif (attrs.stripBr && html == \"<br>\") {\n\t\t\t\t\t\t\thtml = \"\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tngModel.$setViewValue(html);\n\t\t\t\t\t}", "function coolText(thing) {\n $(thing).html( fillWhitespace(thing) );\n $(thing).lettering().children(\"span\").addClass(\"coolText\");\n}", "function changeTheDOM()\n{\n\tconsole.log('DOM change call');\n\tdocument.getElementById('passage').setAttribute('style','display: block');\n\tdocument.getElementById('playagain').setAttribute('style','display: block');\n\tdocument.getElementById('madlibs-entry').setAttribute('style','display: none');\n\n\tdocument.getElementById('classics').innerHTML = selectedPassageTitle;\n}", "function gatherElements(){elements={main:$element[0],scrollContainer:$element[0].querySelector('.md-virtual-repeat-container'),scroller:$element[0].querySelector('.md-virtual-repeat-scroller'),ul:$element.find('ul')[0],input:$element.find('input')[0],wrap:$element.find('md-autocomplete-wrap')[0],root:document.body};elements.li=elements.ul.getElementsByTagName('li');elements.snap=getSnapTarget();elements.$=getAngularElements(elements);inputModelCtrl=elements.$.input.controller('ngModel');}", "function lessContent(){\n\t//var less = document.getElementById(\"less\"); same concept of why not needed as last problem\n\tless.style.display = \"none\";\n\n\t//you could also do less.HTML = \"\"; or \n\t\n}", "function elementStyling(classBindingNames,styleBindingNames,styleSanitizer,directive){var tNode=getPreviousOrParentTNode();if(!tNode.stylingTemplate){tNode.stylingTemplate=createEmptyStylingContext();}updateContextWithBindings(tNode.stylingTemplate,directive||null,classBindingNames,styleBindingNames,styleSanitizer,hasClassInput(tNode));}", "function _getRulaiHtml(content){\n\n}", "function setNameLookHTML() {\n let HTML = \"<div><strong>Names:</strong> \";\n for (let i = 0; i < vm.classData[vm.class].names.length; i++) { HTML += vm.classData[vm.class].names[i] + (i === vm.classData[vm.class].names.length - 1 ? \" \" : \", \"); }\n HTML += \"<br /><strong>Eyes:</strong> \";\n for (let i = 0; i < vm.classData[vm.class].look.eyes.length; i++) { HTML += vm.classData[vm.class].look.eyes[i] + (i === vm.classData[vm.class].look.eyes.length - 1 ? \" \" : \", \"); }\n HTML += \"<br /><strong>Face:</strong> \";\n for (let i = 0; i < vm.classData[vm.class].look.face.length; i++) { HTML += vm.classData[vm.class].look.face[i] + (i === vm.classData[vm.class].look.face.length - 1 ? \" \" : \", \"); }\n HTML += \"<br /><strong>Body:</strong> \";\n for (let i = 0; i < vm.classData[vm.class].look.body.length; i++) { HTML += vm.classData[vm.class].look.body[i] + (i === vm.classData[vm.class].look.body.length - 1 ? \" \" : \", \"); }\n HTML += \"<br /><strong>Wear:</strong> \";\n for (let i = 0; i < vm.classData[vm.class].look.wear.length; i++) { HTML += vm.classData[vm.class].look.wear[i] + (i === vm.classData[vm.class].look.wear.length - 1 ? \" \" : \", \"); }\n HTML += \"<br /><strong>Skin:</strong> \";\n for (let i = 0; i < vm.classData[vm.class].look.skin.length; i++) { HTML += vm.classData[vm.class].look.skin[i] + (i === vm.classData[vm.class].look.skin.length - 1 ? \" \" : \", \"); }\n HTML += \"</div>\";\n return HTML;\n }", "function changetextitalic() {\n var currentIndex = findCurrentIndex(tempKey);\n if (mainDiagram.model.nodeDataArray[currentIndex].Italic) {\n mainDiagram.model.nodeDataArray[currentIndex].Italic = false\n }\n else {\n mainDiagram.model.nodeDataArray[currentIndex].Italic = true;\n }\n getRadio(mainDiagram.selection.Ca.value);\n}", "function understand(html) {\n\t\t\tif(Array.isArray(html)){\n\t\t var complex = html;\n\t\t\t\tvar complexResult = complex.map(understand);\n\t\t\t\treturn complexResult;\n\t\t\t}else {\n\t\t\t\tvar element = html;\n\t \t var textNodes = Array.from(element.childNodes).filter(f => f.nodeName === '#text');\n\t \t\treturn textNodes.reduce(concatTextNode, '');\n\t\t\t}\n \t}", "function understand(html) {\n\t\t\tif(Array.isArray(html)){\n\t\t var complex = html;\n\t\t\t\tvar complexResult = complex.map(understand);\n\t\t\t\treturn complexResult;\n\t\t\t}else {\n\t\t\t\tvar element = html;\n\t \t var textNodes = Array.from(element.childNodes).filter(f => f.nodeName === '#text');\n\t \t\treturn textNodes.reduce(concatTextNode, '');\n\t\t\t}\n \t}", "function addInlineStyle() {\n angular.element($element).css('display', 'block');\n }", "get content_element() {\n return this.element;\n }", "function addFormatting(article){\n\tif(document.getElementById('ce-side-title').style.visibility != 'hidden')\n\t\tdocument.getElementById('ce-side-title').innerHTML = article.data('title');\n\tif(document.getElementById('ce-side-speaker').style.visibility != 'hidden')\n\t\tdocument.getElementById('ce-side-speaker').innerHTML = '<strong style=\"font-size:1.1em\">Speaker:</strong> ' + article.data('speaker') + '</br>';\n\tif(document.getElementById('ce-side-bio').style.visibility != 'hidden')\n\t\tdocument.getElementById(\"ce-side-bio\").innerHTML = '<strong style=\"font-size:1.2em\">About ' + article.data('speaker') + ':</strong></br><div style=\"padding-left:2em\">' + article.data('bio') + '</div></br>';\n\tif(document.getElementById('ce-side-prelude').style.visibility != 'hidden')\n\t\tdocument.getElementById(\"ce-side-prelude\").innerHTML = '<strong style=\"font-size:1.2em\">Abstract:</strong></br><div style=\"padding-left:2em\">' + article.data('prelude') + '</div></br>';\n\tif(document.getElementById('ce-side-article').style.visibility != 'hidden')\n\t\tdocument.getElementById(\"ce-side-article\").innerHTML = '<strong style=\"font-size:1.2em\">Description:</strong></br><div style=\"padding-left:2em\">' + article.data('article') + '</div></br>';\n\tif(document.getElementById('ce-side-postlude').style.visibility != 'hidden')\n\t\tdocument.getElementById(\"ce-side-postlude\").innerHTML = '<strong style=\"font-size:1.1em\">Additional Notes:</strong></br><div style=\"padding-left:2em\">' + article.data('postlude') + '</div></br>';\n\tif(document.getElementById('ce-side-location').style.visibility != 'hidden')\n\t\tdocument.getElementById('ce-side-location').innerHTML = '<strong style=\"font-size:1.1em\">Location: </strong></br>' + article.data('location') + '</br>';\n\t//if(document.getElementById('ce-side-author').style.visibility != 'hidden')\n\t//\tdocument.getElementById('ce-side-author').innerHTML = '<strong style=\"font-size:1.1em\">Author: </strong>' + article.data('author') + '</br>';\n}", "function ElementData(){}", "set element(element) {}", "set element(element) {}", "function _buildElements() {\n\t\t\t_buildGroup(_settings.layout.left);\n\t\t\t_buildGroup(_settings.layout.right, -1);\n\t\t\t_buildGroup(_settings.layout.center);\n\t\t}", "getElements(){\n const thisWidget = this; \n \n thisWidget.dom.input = thisWidget.dom.wrapper.querySelector(select.widgets.amount.input);\n thisWidget.dom.linkDecrease = thisWidget.dom.wrapper.querySelector(select.widgets.amount.linkDecrease);\n thisWidget.dom.linkIncrease = thisWidget.dom.wrapper.querySelector(select.widgets.amount.linkIncrease);\n }", "function updateTagNameDisplayer(element) {\n $(\"#tag-name\").text(\"<\" + element.tagName + \">\");\n}", "function AddProjectOrLearningSection(element, name) {\n //setting the variable\n var i, arr1, arr2;\n //spliting the class to get each individual class\n arr1 = element.className.split(\" \");\n //split the name\n arr2 = name.split(\" \");\n //loop through elements\n for (i = 0; i < arr2.length; i++) {\n // if get to negative\n if (arr1.indexOf(arr2[i]) == -1) {\n //add show to it\n element.className += \" \" + arr2[i];\n }\n }\n}", "function changeAlignment()\n {\n if (vm.element.tag == 'text')\n {\n styler.styleAlignment(vm.element, vm.element.inner);\n }\n else\n {\n styler.styleAlignment(vm.element, vm.themeStyle);\n }\n }", "renderElement(elem, pos, len) {\n if (\"groups\" in this.state.nodes[elem]) {\n return (\n //GROUP\n this.renderGroup(elem, pos, len)\n );\n } else {\n //GROUPITEM\n return this.renderItem(elem, pos, len);\n }\n }", "onAriaDescribedbyAssociationChange() {\n this.removeAttributeFromAllElements( 'aria-describedby' );\n\n for ( let i = 0; i < this.node.ariaDescribedbyAssociations.length; i++ ) {\n const associationObject = this.node.ariaDescribedbyAssociations[ i ];\n\n // Assert out if the model list is different than the data held in the associationObject\n assert && assert( associationObject.otherNode.nodesThatAreAriaDescribedbyThisNode.indexOf( this.node ) >= 0,\n 'unexpected otherNode' );\n\n\n this.setAssociationAttribute( 'aria-describedby', associationObject );\n }\n }", "function setElementText(element, text) {\n /// <summary>\n /// atualiza o texto de um element DOM (ex: label)\n /// DEPRICATED -> Usuar funções do namespace de cada app.\n /// </summary>\n var olabel;\n if (typeof element == \"string\") {\n olabel = $get(element);\n } else { olabel = element; }\n // remove o texto antigo\n if (olabel) {\n if (olabel.childNodes[0]) {\n olabel.removeChild(olabel.childNodes[0]);\n }\n var newtext = document.createTextNode(text);\n olabel.appendChild(newtext);\n }\n}", "function drawelements() {\n\t// show state\n\tif (showstate) {\n\t\t//eoutstateman.firstChild.nodeValue = \"State \" + state;\n\t\tprintareadraw(eoutstateman,\"State \" + statelist.indexOf(state));\n\t}\n\t\n\t// show scroll\n\tif (showscroll) {\n\t\t//escroll.firstChild.nodeValue = \n\t\t//\t\" sclvel = \" + scrollvelx + \",\" + scrollvely + \" scl = \" + scrollx + \",\" + scrolly;\n\t\tprintareadraw(escroll,\"sclvel = \" + scrollvelx + \",\" + scrollvely + \" scl = \" + scrollx + \",\" + scrolly);\n\t}\n\t\t\n\t// show much stuff\n\tif (showprint) {\n\t\tvar maxsize = 300;\n\t\t// show keystate\n\t\tvar ks = \"keystate = \";\n\t\tvar len = input.keystate.length;\n\t\tvar i;\n\t\tfor (i=0;i<len;++i) {\n\t\t\tif (input.keystate[i])\n\t\t\t\tks += i.toString(16) + \" \";\n\t\t}\n\t\t//eoutkeystate.firstChild.nodeValue = ks;\n\t\tprintareadraw(eoutkeystate,ks);\n\t\t\n\t\t// show input\n\t\t//eoutinputstate.firstChild.nodeValue = \"inputstate = mx \" + input.mx + \" my \" + input.my + \" mbut \" + input.mbut + \" mclick \" + input.mclick + \" key \" + input.key;\n\t\tprintareadraw(eoutinputstate,\"inputstate = mx \" + input.mx + \" my \" + input.my + \" mbut \" + input.mbut + \" mwheel \" + \n\t\tinput.wheelPos + \" mclick0 \" + input.mclick[0] + \" mclick1 \" + input.mclick[1] + \" mclick2 \" + \n\t\tinput.mclick[2] + \" key \" + input.key.toString(16) + \" keybufflen \" + input.keybuff.length);\n\t\t\n\t\t// show inputevents\n\t\tif (inputevents.length > maxsize) {\n\t\t\tinputevents = inputevents.substr(inputevents.length-maxsize,maxsize);\n\t\t}\n\t\t//eoutinputevents.firstChild.nodeValue = inputevents;\n\t\tprintareadraw(eoutinputevents,inputevents);\n\t\t\n\t\t// show logger\n/*\t\tif (logger_str.length > maxsize) {\n//\t\t\tlogger_str = logger_str.substr(logger_str.length-maxsize,maxsize);\n\t\t} */\n\t\t//eoutlogger.outerHTML = \"Howdy!\";\n\t\t//eoutlogger.firstChild.nodeValue = logger_str;\n\t\tif (logmode)\n\t\t\tprintareadraw(eoutlogger,logger_str);\n\t\telse {\n\t\t\tprintareadraw(eoutlogger,\"logger disabled\");\n\t\t\tlogger_str = \"\";\n\t\t}\n\t}\n\t\n\t// show image cache\n/*\tvar str = \"\";\n\tfor (var nam in imagecacher) {\n\t\tstr += \"C[\" + nam + \"] = \" + imagecacher[nam].size+ \",\";\t\n\t} */\n}", "addElementToLine(paragraph, element) {\n this.viewer.cutFromLeft(this.viewer.clientActiveArea.x + element.width);\n if (paragraph.paragraphFormat.textAlignment === 'Justify' && element instanceof TextElementBox) {\n this.splitTextElementWordByWord(element);\n }\n }", "function expand_basic(name){\n\tvar elem = get(name)\n\tif (elem) {\n\t\tif (elem.style.display==\"none\"){\n\t\t\telem.style.display=\"block\"\n\t\t} else {\n\t\t\telem.style.display=\"none\"\n\t\t}\n\t}\n}", "updateStyle(e) {\n e.preventDefault();\n let newel = this.getActiveTags();\n let style = this.getActiveStyle();\n let newTag = document.createElement(this.getTagType(newel));\n newTag.style = style;\n var li;\n if ((newel == \"order-list\" && this.isList(this.focusedElement)) ||\n (newel == \"unorder-list\" && this.isList(this.focusedElement))) {\n var list = this.listToList(this.focusedElement.parentNode.childNodes);\n list.forEach(item => {\n var li = document.createElement(\"li\");\n li.innerHTML = item.innerHTML;\n newTag.appendChild(li);\n });\n newTag.contentEditable = true;\n let parent = this.focusedElement.parentNode.parentNode;\n parent.replaceChild(newTag, this.focusedElement.parentNode);\n this.focusedElement = newTag.lastChild;\n } else if (newel == \"order-list\" || newel == \"unorder-list\") {\n li = document.createElement(\"li\");\n li.innerHTML = this.focusedElement.innerHTML;\n newTag.appendChild(li);\n newTag.contentEditable = true;\n this.focusedElement.parentNode.replaceChild(newTag, this.focusedElement);\n this.focusedElement = newTag.lastChild;\n } else {\n\n newTag.contentEditable = true;\n if (this.isList(this.focusedElement)) {\n newTag.innerHTML = this.getListContents(this.focusedElement);\n let parent = this.focusedElement.parentNode.parentNode;\n parent.replaceChild(newTag, this.focusedElement.parentNode);\n this.focusedElement = newTag.lastChild;\n } else {\n\n newTag.innerHTML = this.focusedElement.innerHTML;\n this.focusedElement.parentNode.replaceChild(newTag, this.focusedElement);\n this.focusedElement = newTag;\n\n }\n }\n }", "get sectionText() {\n return this._sectionText.elements;\n }", "get innerElements() {\n return [this.inputElement, {\n tag: 'label',\n class: 'b-checkbox-label',\n for: `${this.id}-input`,\n reference: 'textLabel',\n html: this.text || ''\n }];\n }", "function S(n,e,t,o){var a,i,u,h=n.nodeType,r=n.childNodes,s=r.length,l=_[h],d=0;// Passes directly elemets with uneditable class\nif(o&&1===h&&wysihtml5.dom.hasClass(n,o))return n;// Remove or unwrap node in case of return value null or false\nif(i=l&&l(n,t),!i){if(!1===i){for(a=n.ownerDocument.createDocumentFragment(),d=s;d--;)r[d]&&(u=S(r[d],e,t,o),u&&(r[d]===u&&d--,a.insertBefore(u,a.firstChild)));return\"block\"===wysihtml5.dom.getStyle(\"display\").from(n)&&a.appendChild(n.ownerDocument.createElement(\"br\")),!wysihtml5.lang.array([\"div\",\"pre\",\"p\",\"table\",\"td\",\"th\",\"ul\",\"ol\",\"li\",\"dd\",\"dl\",\"footer\",\"header\",\"section\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"]).contains(n.nodeName.toLowerCase())||n.parentNode.lastChild===n||n.nextSibling&&3===n.nextSibling.nodeType&&/^\\s/.test(n.nextSibling.nodeValue)||a.appendChild(n.ownerDocument.createTextNode(\" \")),a.normalize&&a.normalize(),a}// Remove\nreturn null}// Converts all childnodes\nfor(d=0;d<s;d++)r[d]&&(u=S(r[d],e,t,o),u&&(r[d]===u&&d--,i.appendChild(u)));// Cleanup senseless <span> elements\nif(e&&\"span\"===i.nodeName.toLowerCase()&&(!i.childNodes.length||/^\\s*$/gi.test(i.innerHTML)&&(t||\"_wysihtml5-temp-placeholder\"!==n.className&&\"rangySelectionBoundary\"!==n.className)||!i.attributes.length)){for(a=i.ownerDocument.createDocumentFragment();i.firstChild;)a.appendChild(i.firstChild);return a.normalize&&a.normalize(),a}return i.normalize&&i.normalize(),i}", "setStyles() {\n\n // determine the display type of the element as we can't support inline\n if (this.$element.css('display') === 'inline') {\n this.$element.css('display', 'inline-block');\n }\n\n // apply the style to keep it on one line and show ellipsis\n this.$element.css({ overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' });\n }", "function init_module() {\n\n var sANDIVersionNumber = \"4.1.4\";\n\n //create sANDI instance\n var sANDI = new AndiModule(sANDIVersionNumber, \"s\");\n\n var langAttributesCount = 0;\n var roleAttributesCount = 0;\n\n AndiModule.initActiveActionButtons({\n readingOrder: false,\n roleAttributes: false,\n langAttributes: false\n });\n\n //This function will analyze the test page for graphics/image related markup relating to accessibility\n sANDI.analyze = function () {\n\n //Loop through every visible element\n $(TestPageData.allElements).each(function () {\n //For all elements on the page\n if ($.trim($(this).attr(\"role\")))\n roleAttributesCount++;\n if ($.trim($(this).prop(\"lang\")))\n langAttributesCount++;\n });\n };\n\n //This function determine's if the element looks like a heading but is not semantically a heading\n sANDI.isFakeHeading = function (element) {\n\n var isFakeHeading = false;\n\n var limit_textLength = 30; //text longer than this will not be considered a fake heading\n\n var limit_fontSize = 22; //px (an h2 starts around 24px)\n var limit_boldFontSize = 15; //px\n\n var text = $.trim($(element).text());\n if (text.length > 0 && text.length < limit_textLength) {\n //text is not empty, but less than char limit\n\n var fakeHeading_fontSize = parseInt($(element).css(\"font-size\"));\n var fakeHeading_fontWeight = $(element).css(\"font-weight\");\n\n if (fakeHeading_fontSize > limit_fontSize ||\n (isBold(fakeHeading_fontWeight) && fakeHeading_fontSize > limit_boldFontSize)\n ) { //fakeHeading_fontSize is greater than size limit\n\n var nextElement = $(element).next().filter(\":visible\");\n\n if ($.trim($(nextElement).text()) !== \"\") { //next element has text\n\n var nextElement_fontWeight = $(nextElement).css(\"font-weight\");\n var nextElement_fontSize = parseInt($(nextElement).css(\"font-size\"));\n\n if (nextElement_fontSize < fakeHeading_fontSize) {\n //next element's font-size is smaller than fakeHeading font-size\n isFakeHeading = true;\n }\n else if (isBold(fakeHeading_fontWeight) && !isBold(nextElement_fontWeight)) {\n //next element's font-weight is lighter than fakeHeading font-weight\n isFakeHeading = true;\n }\n }\n }\n }\n return isFakeHeading;\n\n function isBold(weight) {\n return (weight === \"bold\" || weight === \"bolder\" || weight >= 700);\n }\n };\n\n //Initialize outline\n sANDI.outline = \"<h3 tabindex='-1' id='sANDI508-outline-heading'>Headings List (ordered by occurance):</h3><div class='ANDI508-scrollable'>\";\n\n //This function will display the heading list (headings outline)\n //It should only be called on heading elements\n sANDI.getOutlineItem = function (element) {\n var displayCharLength = 60; //for truncating innerText\n var tagName = $(element).prop(\"tagName\").toLowerCase();\n var role = $(element).attr(\"role\");\n var ariaLevel = $(element).attr(\"aria-level\");\n\n //Indent the heading according to the level\n //Results in h1 = 1% left margin, h2 = 2% left margin, etc.\n var indentLevel;\n if (ariaLevel) {\n //Check if positive integar\n if (parseInt(ariaLevel) > 0 && parseInt(ariaLevel) == ariaLevel)\n indentLevel = parseInt(ariaLevel);\n else //aria-level is not a positive integar, default to 2 (defined in ARIA spec, and screen readers are doing this)\n indentLevel = 2;\n }\n else {\n if (role === \"heading\")\n indentLevel = 2; //no aria-level and role=heading, so default to 2 (defined in ARIA spec)\n else\n indentLevel = parseInt(tagName.slice(1)); //get second character from h tag\n }\n\n var outlineItem = \"<a style='margin-left:\" + indentLevel + \"%' href='#' data-andi508-relatedindex='\" + $(element).attr('data-andi508-index') + \"'>&lt;\" + tagName;\n\n //display relevant attributes\n if (role)\n outlineItem += \" role='\" + role + \"' \";\n if (ariaLevel)\n outlineItem += \" aria-level='\" + ariaLevel + \"' \";\n\n outlineItem += \"&gt;\";\n outlineItem += \"<span class='ANDI508-display-innerText'>\";\n outlineItem += $.trim(andiUtility.formatForHtml($(element).text().substring(0, displayCharLength)));\n if ($(element).html().length > displayCharLength) {\n outlineItem += \"...\";\n }\n outlineItem += \"</span>\";\n outlineItem += \"&lt;/\" + tagName + \"&gt;</a>\";\n outlineItem += \"<br />\";\n return outlineItem;\n };\n\n //This function adds the finishing touches and functionality to ANDI's display once it's done scanning the page.\n sANDI.results = function () {\n\n var moduleActionButtons = \"\";\n moduleActionButtons += \"<button id='ANDI508-readingOrder-button' aria-pressed='false'>reading order\" + overlayIcon + \"</button>\";\n\n var moreDetails = \"<button id='ANDI508-pageTitle-button'>page title</button>\" +\n \"<button id='ANDI508-pageLanguage-button'>page language</button>\" +\n \"<button id='ANDI508-roleAttributes-button' aria-pressed='false' aria-label='\" + roleAttributesCount + \" Role Attributes'>\" + roleAttributesCount + \" role attributes\" + overlayIcon + \"</button>\" +\n \"<button id='ANDI508-langAttributes-button' aria-pressed='false' aria-label='\" + langAttributesCount + \" Lang Attributes'>\" + langAttributesCount + \" lang attributes\" + overlayIcon + \"</button>\";\n\n moduleActionButtons += \"<div class='ANDI508-moduleActionGroup'><button class='ANDI508-moduleActionGroup-toggler'>more details</button><div class='ANDI508-moduleActionGroup-options'>\" + moreDetails + \"</div></div>\";\n\n $(\"#ANDI508-module-actions\").html(moduleActionButtons);\n\n andiBar.initializeModuleActionGroups();\n\n //Define readingOrder button functionality\n $(\"#ANDI508-readingOrder-button\").click(function () {\n if ($(this).attr(\"aria-pressed\") == \"false\") {\n andiOverlay.overlayButton_on(\"overlay\", $(this));\n andiOverlay.overlayReadingOrder();\n AndiModule.activeActionButtons.readingOrder = true;\n }\n else {\n andiOverlay.overlayButton_off(\"overlay\", $(this));\n andiOverlay.removeOverlay(\"ANDI508-overlay-readingOrder\");\n AndiModule.activeActionButtons.readingOrder = false;\n }\n andiResetter.resizeHeights();\n return false;\n });\n\n //Define the lang attributes button\n $(\"#ANDI508-langAttributes-button\").click(function () {\n if ($(this).attr(\"aria-pressed\") == \"false\") {\n andiOverlay.overlayButton_on(\"overlay\", $(this));\n\n var langOverlayText = \"\";\n var overlayObject;\n var langOfPartsCount = 0;\n $(\"#ANDI508-testPage [lang]\").filter(\":visible\").each(function () {\n if ($(this).prop(\"lang\").trim() != \"\") {\n langOverlayText = $(this).prop(\"tagName\").toLowerCase() + \" lang=\" + $(this).prop(\"lang\");\n overlayObject = andiOverlay.createOverlay(\"ANDI508-overlay-langAttributes\", langOverlayText);\n andiOverlay.insertAssociatedOverlay(this, overlayObject);\n langOfPartsCount++;\n }\n });\n\n AndiModule.activeActionButtons.langAttributes = true;\n }\n else {\n andiOverlay.overlayButton_off(\"overlay\", $(this));\n andiOverlay.removeOverlay(\"ANDI508-overlay-langAttributes\");\n AndiModule.activeActionButtons.langAttributes = false;\n }\n andiResetter.resizeHeights();\n\n return false;\n });\n\n //Define the lang attributes button\n $(\"#ANDI508-roleAttributes-button\").click(function () {\n if ($(this).attr(\"aria-pressed\") == \"false\") {\n andiOverlay.overlayButton_on(\"overlay\", $(this));\n\n var langOverlayText = \"\";\n var overlayObject, role;\n $(\"#ANDI508-testPage [role]:not('.ANDI508-overlay')\").filter(\":visible\").each(function () {\n role = $.trim($(this).attr(\"role\")).toLowerCase();\n if (role) { //if role is not empty\n langOverlayText = $(this).prop(\"tagName\").toLowerCase() + \" role=\" + role;\n overlayObject = andiOverlay.createOverlay(\"ANDI508-overlay-roleAttributes\", langOverlayText);\n andiOverlay.insertAssociatedOverlay(this, overlayObject);\n }\n });\n\n AndiModule.activeActionButtons.roleAttributes = true;\n }\n else {\n andiOverlay.overlayButton_off(\"overlay\", $(this));\n andiOverlay.removeOverlay(\"ANDI508-overlay-roleAttributes\");\n AndiModule.activeActionButtons.roleAttributes = false;\n }\n andiResetter.resizeHeights();\n return false;\n });\n\n //Define the page title button\n $(\"#ANDI508-pageTitle-button\").click(function () {\n andiOverlay.overlayButton_on(\"overlay\", $(this));\n if (document.title)\n alert(\"The page title is: \" + document.title);\n else\n alert(\"There is no page title.\");\n andiOverlay.overlayButton_off(\"overlay\", $(this));\n });\n\n //Define the page language button\n $(\"#ANDI508-pageLanguage-button\").click(function () {\n andiOverlay.overlayButton_on(\"overlay\", $(this));\n //get the lang attribute from the HTML element\n var htmlLangAttribute = $.trim($(\"html\").first().prop(\"lang\"));\n //pop up the lang value of the HTML element\n if (htmlLangAttribute)\n alert(\"The <html> element has a lang attribute value of: \" + htmlLangAttribute + \".\");\n else\n alert(\"The <html> element does not have a lang attribute.\");\n andiOverlay.overlayButton_off(\"overlay\", $(this));\n });\n\n //Deselect all mode buttons\n $(\"#ANDI508-module-actions button.sANDI508-mode\").attr(\"aria-selected\", \"false\");\n\n $(\"#sANDI508-outline-container\")\n .html(sANDI.outline)\n .find(\"a[data-andi508-relatedindex]\").each(function () {\n andiFocuser.addFocusClick($(this));\n var relatedIndex = $(this).attr(\"data-andi508-relatedindex\");\n var relatedElement = $(\"#ANDI508-testPage [data-andi508-index=\" + relatedIndex + \"]\").first();\n andiLaser.createLaserTrigger($(this), $(relatedElement));\n $(this)\n .hover(function () {\n if (!event.shiftKey)\n AndiModule.inspect(relatedElement[0]);\n })\n .focus(function () {\n AndiModule.inspect(relatedElement[0]);\n });\n });\n\n $(\"#sANDI508-outline-container\")\n .html(sANDI.outline)\n .find(\"a[data-andi508-relatedindex]\").each(function () {\n andiFocuser.addFocusClick($(this));\n var relatedIndex = $(this).attr(\"data-andi508-relatedindex\");\n var relatedElement = $(\"#ANDI508-testPage [data-andi508-index=\" + relatedIndex + \"]\").first();\n andiLaser.createLaserTrigger($(this), $(relatedElement));\n $(this)\n .hover(function () {\n if (!event.shiftKey)\n AndiModule.inspect(relatedElement[0]);\n })\n .focus(function () {\n AndiModule.inspect(relatedElement[0]);\n });\n });\n\n andiAlerter.updateAlertList();\n\n AndiModule.engageActiveActionButtons([\n \"readingOrder\",\n \"roleAttributes\",\n \"langAttributes\"\n ]);\n\n $(\"#ANDI508\").focus();\n\n };\n\n //This function will update the info in the Active Element Inspection.\n //Should be called after the mouse hover or focus in event.\n AndiModule.inspect = function (element) {\n if ($(element).hasClass(\"ANDI508-element\")) {\n andiBar.prepareActiveElementInspection(element);\n\n var elementData = $(element).data(\"andi508\");\n\n\n\n var addOnProps = AndiData.getAddOnProps(element, elementData,\n [\n \"aria-level\",\n getDefault_ariaLive(element, elementData),\n getDefault_ariaAtomic(element, elementData),\n \"aria-busy\",\n \"aria-relevant\"\n ]);\n\n andiBar.displayTable(elementData, element, addOnProps);\n\n if (AndiModule.activeActionButtons.liveRegions) { //For Live Region mode, update the output live\n //Copy from the AC table\n var innerText = $(\"#ANDI508-accessibleComponentsTable td.ANDI508-display-innerText\").first().html();\n if (innerText) {\n elementData.accName = \"<span class='ANDI508-display-innerText'>\" + innerText + \"</span>\";\n }\n }\n\n andiBar.displayOutput(elementData, element, addOnProps);\n }\n\n //This function assumes the default values of aria-live based on the element's role as defined by spec\n function getDefault_ariaLive(element, elementData) {\n var val = $.trim($(element).attr(\"aria-live\"));\n if (!val) {\n if (elementData.role === \"alert\")\n val = \"assertive\";\n else if (elementData.role === \"log\" || elementData.role === \"status\")\n val = \"polite\";\n else if (elementData.role === \"marquee\" || elementData.role === \"timer\")\n val = \"off\";\n else return; //no default\n }\n return [\"aria-live\", val];\n }\n\n //This function assumes the default values of aria-atomic based on the element's role as defined by spec\n function getDefault_ariaAtomic(element, elementData) {\n var val = $.trim($(element).attr(\"aria-atomic\"));\n if (!val) {\n if (elementData.role === \"alert\" || elementData.role === \"status\")\n val = \"true\";\n else if (elementData.role === \"log\" || elementData.role === \"marquee\" || elementData.role === \"timer\")\n val = \"false\";\n else return; //no default\n }\n return [\"aria-atomic\", val];\n }\n };\n\n //This function will overlay the reading order sequence.\n AndiOverlay.prototype.overlayReadingOrder = function () {\n //Elements that should be excluded from the scan, hidden elements will automatically be filtered out\n var exclusions = \"option,script,style,noscript\";\n //Elements that should be included in the scan even if they don't have innerText\n var inclusions = \"select,input,textarea\";\n\n var readingSequence = 0;\n var overlayObject;\n\n traverseReadingOrder(document.getElementById(\"ANDI508-testPage\"));\n\n //This recursive function traverses the dom tree and inserts the reading order overlay\n //It distinguishes between element nodes and text nodes\n //It will check for aria-hidden=true (with inheritance)\n function traverseReadingOrder(element, ariaHidden) {\n\n //Check for aria-hidden=true\n ariaHidden = (ariaHidden || $(element).attr(\"aria-hidden\") === \"true\") ? true : false;\n\n for (var z = 0; z < element.childNodes.length; z++) {\n\n //if child is an element object that is visible\n if (element.childNodes[z].nodeType === 1) {\n if (!$(element.childNodes[z]).is(exclusions) && $(element.childNodes[z]).is(\":shown\")) {\n if ($(element.childNodes[z]).is(inclusions)) {//no need to look at this element's childNodes\n insertReadingOrder(ariaHidden, element.childNodes[z]);\n z++;//because a new node was inserted, the indexes changed\n }\n else {//recursion here:\n traverseReadingOrder(element.childNodes[z], ariaHidden);\n }\n }\n }\n //else if child is a text node\n else if (element.childNodes[z].nodeType === 3) {\n if ($.trim(element.childNodes[z].nodeValue) !== \"\") {\n //Found some text\n insertReadingOrder(ariaHidden, element.childNodes[z]);\n z++;//because a new node was inserted, the indexes changed\n }\n }\n }\n\n //this function inserts the reading order overlay\n //if it's hidden using aria-hidden it will insert an alert overlay\n function insertReadingOrder(ariaHidden, node) {\n if (ariaHidden) {\n overlayObject = andiOverlay.createOverlay(\"ANDI508-overlay-alert ANDI508-overlay-readingOrder\", \"X\", \"hidden from screen reader using aria-hidden=true\");\n }\n else {\n readingSequence++;\n overlayObject = andiOverlay.createOverlay(\"ANDI508-overlay-readingOrder\", readingSequence);\n }\n andiOverlay.insertAssociatedOverlay(node, overlayObject);\n }\n }\n };\n\n sANDI.analyze();\n sANDI.results();\n\n}//end init", "_updateDOM() {\n this._updateAttributes();\n this._updateStyles();\n }", "toggleElementFields () {\n const element = this.input.element_element.value;\n this.input.element_link.classList.toggle('fedex-hidden', element !== 'link');\n this.input.element_category.classList.toggle('fedex-hidden', element !== 'button');\n }" ]
[ "0.5704688", "0.5665996", "0.5547745", "0.54517716", "0.5433795", "0.54307806", "0.5415638", "0.53849494", "0.53634727", "0.53288925", "0.53286797", "0.5307545", "0.53017116", "0.5292224", "0.5291478", "0.528939", "0.5288277", "0.5278258", "0.5258134", "0.5256301", "0.52518", "0.52391976", "0.52269614", "0.5226733", "0.5221007", "0.5200141", "0.5176394", "0.51763827", "0.51735276", "0.51709414", "0.5163644", "0.51614106", "0.51545954", "0.515086", "0.5150807", "0.5150021", "0.51434726", "0.5129682", "0.51265174", "0.5117758", "0.5117758", "0.5117129", "0.5116248", "0.51092976", "0.5109065", "0.5108986", "0.5097992", "0.5095731", "0.5095066", "0.5094521", "0.50923014", "0.5086412", "0.50707173", "0.50690717", "0.5067922", "0.5065763", "0.5061587", "0.50403565", "0.50393116", "0.50392234", "0.50332755", "0.50332755", "0.50332755", "0.50317794", "0.5030304", "0.50284743", "0.50233847", "0.5022892", "0.501845", "0.50131685", "0.5011141", "0.500897", "0.5001731", "0.500075", "0.4998273", "0.4998273", "0.49848226", "0.49844983", "0.4980569", "0.49800467", "0.49780786", "0.49780786", "0.49756327", "0.49714148", "0.49663845", "0.49652562", "0.49577937", "0.4957172", "0.49528304", "0.4948319", "0.49480826", "0.4943659", "0.4942987", "0.493935", "0.49387765", "0.4935173", "0.4933559", "0.4933297", "0.49320552", "0.4931744", "0.4927603" ]
0.0
-1
Main laserServer interaction tool //////////////////////////////////////////////
function log_access() { $.getJSON('http://gd.geobytes.com/GetCityDetails?callback=?', function(data) { $.post("lib/laserAccess.php", { random: Math.random(), request: JSON.stringify(data, null, 2) }, /* Callback */ ); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\r\n this.serverInstance = new Server();\r\n this.firstLab = false; // Flag for whether the first lab command has been received\r\n }", "function Server() {}", "function Main(){\n\t/**\n\t * @property _http\n\t * @type http\n\t * @private\n\t */\n\tthis._http = require('http');\n\t\n\t/**\n\t * @property _express\n\t * @type express\n\t * @private\n\t */\n\tthis._express = require('express');\n\t\n\t/**\n\t * @property _bodyParser\n\t * @type body-parser\n\t * @private\n\t */\n\tthis._bodyParser = require('body-parser');\n\t\n\t/**\n\t * @property _app\n\t * @type express-instance\n\t * @private\n\t */\n\tthis._app = this._express();\n\tthis._app.use(this._bodyParser());\n\t\n\t/**\n\t * @property _httpserver\n\t * @type httpserver\n\t * @private\n\t */\n\tthis._httpserver = this._http.createServer(this._app).listen(CONFIG.port);\n\t\n\t/**\n\t * @property _gameServer\n\t * @type server.Server\n\t * @private\n\t */\n\tthis._gameServer = new Server(this._httpserver);\n\t\n\t/**\n\t * @property _commandLine\n\t * @type server.CommandLine\n\t * @private\n\t */\n\tthis._commandLine = new CommandLine(this);\n\t\n\t/**\n\t * @property _router\n\t * @type server.Router\n\t * @private\n\t */\n\tthis._router = new Router(this._app, this._gameServer);\n\tthis._router.bindRouters();\n}", "function startServer()\n{\n\tconsole.log(\"Starting web controller...\");\n\n\tvar http = require('http');\n\thttp.createServer(function (req, res) {\n\n\t\t function respond() {\n\t\t\tres.writeHead(200, { \"Content-Type\": \"text/html\" });\n\t\t\tres.write(\"<!DOCTYPE html><html><body>\");\t\t\n\t\t\tres.write(\"<h1>Intel Galileo web controller</h1>\");\n\t\t\tres.write(\"</p><p>LED Status : \");\n\t\t\tres.write(ledstatus);\n\t\t\tres.write(\"</p><p>Actions</p>\");\n\t\t\tres.write(\"<p><input type='button' onclick='location.pathname = \\\"/ledOn\\\"' value='Turn LED on'/></p>\");\n\t\t\tres.write(\"<p><input type='button' onclick='location.pathname = \\\"/ledOff\\\"' value='Turn LED off'/></p>\");\n res.write(\"<p><input type='button' onclick='location.pathname = \\\"/hit\\\"' value='Hit'/></p>\");\n\t\t\tres.write(\"</body></html>\");\n\t \t\tres.end();\n\t\t}\n\n\t\tconsole.log(\"Request: \" + req.url);\n\t\tvar mraa = require('mraa');\n \n\t\tif(req.url === \"/ledOn\")\n\t\t\tturnOnLed();\n\t\telse if(req.url === \"/ledOff\")\n\t\t\tturnOffLed();\n else if(req.url === \"/hit\")\n\t\t\thit(mraa);\n\n\t\trespond();\n \t\t\n\t}).listen(1337);\n\tconsole.log('Server running at http://localhost:1337/');\n}", "function gestionServer()\n{\n\tlet myClient = MyClient.getInstance()\n\tmyClient.onReady().then(async() =>\n\t{\n\t\tclient = myClient.client\n\t\tloggedAccount = client.user\n\t\tobjActualServer = new actualServer()\n\t\tchooseServer()\n\n\t})\n}", "startServer() {\n window.addEventListener('storage', this._answerReqest.bind(this), false);\n this._startHardbeat();\n }", "function main() {\n getIpLocation();\n setHandlers();\n }", "start() {\n const { email, password } = this.config.credentials || {};\n verboseLog('Starting server', (!email && !password ? 'with' : 'without').yellow, 'credentials');\n verboseLog('Running', (this.config.server.__LOCAL ? path.join(__dirname, '../../tools/brickadia.sh') : 'brickadia launcher').yellow);\n\n // handle local launcher support\n const launchArgs = [\n this.config.server.__LOCAL\n ? path.join(__dirname, '../../tools/brickadia.sh')\n : 'brickadia',\n this.config.server.branch && `--branch=${this.config.server.branch}`,\n '--server',\n '--',\n ];\n\n // Either unbuffer or stdbuf must be used because brickadia's output is buffered\n // this means that multiple lines can be bundled together if the output buffer is not full\n // unfortunately without stdbuf or unbuffer, the output would not happen immediately\n this.#child = spawn('stdbuf', [\n '--output=L',\n '--',\n ...launchArgs,\n this.config.server.map && `${this.config.server.map}`,\n '-NotInstalled', '-log',\n this.path ? `-UserDir=\"${this.path}\"` : null,\n email ? `-User=\"${email}\"` : null, // remove email argument if not provided\n password ? `-Password=\"${password}\"` : null, // remove password argument if not provided\n `-port=\"${this.config.server.port}\"`,\n ].filter(v => v)); // remove unused arguments\n\n verboseLog('Spawn process', this.#child ? this.#child.pid : 'failed'.red);\n\n this.#child.stdin.setEncoding('utf8');\n this.#outInterface = readline.createInterface({input: this.#child.stdout, terminal: false});\n this.#errInterface = readline.createInterface({input: this.#child.stderr, terminal: false});\n this.attachListeners();\n verboseLog('Attached listeners');\n }", "function startServer() {\n\tserver = require(__dirname + '/NetworkServer');\n\tserver.startServer();\n}", "function main() {\n client.waitForReady(4000, () => {\n async.series([\n runGetFeature,\n runListFeatures,\n runRecordRoute,\n runRouteChat\n ]); \n });\n}", "function trainerBLEinit () {\n trainerBLE = new TrainerBLE(options = {\n name: 'Jo1'\n },serverCallback);\n\ntrainerBLE.on('disconnect', string => {\n io.emit('control', 'disconnected')\n controlled = false;\n});\n\ntrainerBLE.on('key', string => {\n if (DEBUG) console.log('[server.js] - key: ' + string)\n io.emit('key', '[server.js] - ' + string)\n})\ntrainerBLE.on('error', string => {\n if (DEBUG) console.log('[server.js] - error: ' + string)\n io.emit('error', '[server.js] - ' + string)\n})\n\n\n}", "function main () {\n console.log(\"Registering Events...\");\n gm.events.register();\n\n console.log(\"Server started!\");\n Query(8080); //You can change your port\n\n // ---- This is for check database connection ----- //\n\n /*let testdb = gm.utility.dbConnect();\n\n testdb.connect(function(err) {\n if(err) {\n console.log(\"Error connecting to the database ... \");\n throw err;\n } else {\n console.log('Database connected!')\n }\n });\n\n testdb.end();*/\n}", "function main() {\nmforServer.run(mforSnapshotsPath, mforGenerator.generateData(mforSnapshotsPath), mforPort)\n}", "function main() {\n\n // create the server\n var server = restify.createServer( { name : hostName } );\n server.use(restify.bodyParser());\n // set up the route\n server.post('/incoming-webhook', processIncoming);\n server.get('/health-check', processHealthCheck);\n\n server.listen(port, function() {\n });\n}", "function _main() {\n log('> lesslms init...', 'info');\n _buildTree();\n _setupMenu();\n}", "function serverConnected() {\n println(\"Connected to Server\");\n}", "function main() {\n var server = new grpc.Server();\n var remotingConfig = app.get('remoting') || {};\n var grpcConfig = remotingConfig.grpc || {};\n var host = grpcConfig.host || '0.0.0.0';\n var port = grpcConfig.port || 50051;\n var address = host + ':' + port;\n var zipkinServerUrl = grpcConfig.zipkinServerUrl || 'http://localhost:9411';\n\n var zipkinFactory = zipkinAgent.serverInterceptorFactory(\n {zipkinServerUrl: zipkinServerUrl});\n server.addService(proto.note.NoteService.service, {\n create: zipkinFactory('note-loopback.create', create),\n findById: zipkinFactory('note-loopback.findById', findById),\n find: zipkinFactory('note-loopback.find', find),\n });\n\n server.bind(address, grpc.ServerCredentials.createInsecure());\n server.start();\n console.log('Note gRPC service is running at %s', address);\n }", "function start() {\n console.log(\"server start . . .\");\n initialize();\n}", "function onStart(data)\n{\n\tconsole.log('Received start request.');\n\tconsole.log(data);\n var args = Config.arguments ;\n\n // If we specified a leve\n var level ;\n if(data.level)\n level = data.level;\n else\n level = Config.level; \n\n //Configure UT3 server parameters\n Config.parameters.password = generateGUID();\n\n args.push(Config.getParameters());\n\n\tvar ut3 = spawn(Config.exe(),args);\n\t// reguster ccallbacks\n\tut3.on('exit',onUT3exit);\n\tut3.stderr.on('data',onUT3stderr);\n\tut3.stdout.on('data',onUT3stdout);\n\n\tconsole.log('Started game server process');\n\n //Configure the return message\n var message = { \n password: Config.password,\n }\n\n\tsocket.emit('started',message);\n}", "function run() {\r\n setupDatabase();\r\n setupServer();\r\n startServer();\r\n}", "async function main () {\n // Create a runtime instance\n const runtime = await loc.createRuntime()\n\n // Load my custom components\n // await runtime.addCoreComponents()\n await runtime.addComponents(`${__dirname}/components`)\n\n // Load design file\n console.log(`Downloading design...${DESIGN}`)\n const design = await fetch(DESIGN).then(res => res.json())\n console.log('done')\n\n // Start the engine\n await runtime.run(design)\n\n // Start monitor on our design, needed for design ui to connect to the app\n if (MONITOR) {\n const logs = `${__dirname}/tmp`\n\n // Make sure logs directory exist\n if (!fs.existsSync(logs)) {\n fs.mkdirSync(logs)\n }\n\n await loc.start(runtime, {\n logs\n })\n }\n\n // The monitor is live at...\n console.log(`Server live at : http://localhost:${process.env.PORT || 5000}/_system`)\n}", "__prepareServer () {\n\n\t\tthis.server.inject(`sharedLogger`, sharedLogger);\n\n\t\tthis.server.mount(`/health-check`, (req, res) => res.respond({ healthy: true, version: this.appVersion }));\n\t\tthis.server.mount(`/webview`, this.workflowManager.handleWebviewRequests.bind(this.workflowManager));\n\t\tthis.server.mount(`/track-link`, this.workflowManager.handleLinkTrackingRequests.bind(this.workflowManager));\n\t\tthis.server.mount(`/api/flow/reload-dynamic`, this.workflowManager.reloadDynamicFlows.bind(this.workflowManager));\n\n\t}", "function main() {\n console.log('Ready!\\n');\n _hcsr04.fn.startMonitoring();\n}", "function startApp() {\n Owners.init();\n TXID.blocknumber = 0\n if(config.ipfshost == 'ipfs')ipfs.id(function (err, res) {\n if(err){}\n if(res)plasma.id = res.id\n })\n processor = hiveState(client, startingBlock, config.prefix, config.username);\n processor.on('send', HR.send);\n processor.on('claim', HR.claim);\n processor.on('node_add', HR.node_add);\n //processor.on('node_delete', HR.node_delete);\n processor.on('report', HR.report);\n processor.on('gov_down', HR.gov_down);\n processor.on('gov_up', HR.gov_up);\n processor.onOperation('account_update', HR.account_update);\n processor.onOperation('comment', HR.comment);\n processor.on('queueForDaily', HR.q4d)\n processor.on('nomention', HR.nomention)\n if(config.features.pob){\n processor.on('power_up', HR.power_up); // power up tokens for vote power in layer 2 token proof of brain\n processor.on('power_down', HR.power_down);\n processor.on('power_grant', HR.power_grant);\n processor.on('vote_content', HR.vote_content);\n processor.onOperation('vote', HR.vote) //layer 2 voting\n processor.onOperation('delegate_vesting_shares', HR.delegate_vesting_shares);\n processor.onOperation('comment_options', HR.comment_options);\n processor.on('cjv', HR.cjv);\n processor.on('cert', HR.cert); // json.cert is an open ended hope to interact with executable posts... unexplored\n }\n if(config.features.dex){\n processor.on('dex_sell', HR.dex_sell);\n processor.on('dex_clear', HR.dex_clear);\n processor.on('sig_submit', HR.sig_submit); //dlux is for putting executable programs into IPFS... this is for additional accounts to sign the code as non-malicious\n processor.on('osig_submit', HR.osig_submit);\n }\n if(config.features.dex || config.features.nft || config.features.ico){\n processor.onOperation('transfer', HR.transfer);\n }\n if(config.features.nft){\n processor.on('ft_bid', HR.ft_bid)\n processor.on('ft_auction', HR.ft_auction)\n processor.on('ft_sell_cancel', HR.ft_sell_cancel)\n processor.on('ft_buy', HR.ft_buy)\n processor.on('ft_sell', HR.ft_sell)\n processor.on('ft_escrow_cancel', HR.ft_escrow_cancel)\n processor.on('ft_escrow_complete', HR.ft_escrow_complete)\n processor.on('ft_escrow', HR.ft_escrow)\n processor.on('fts_sell_h', HR.fts_sell_h)\n processor.on('fts_sell_hcancel', HR.fts_sell_hcancel)\n processor.on('nft_buy', HR.nft_buy)\n processor.on('nft_sell', HR.nft_sell)\n processor.on('nft_sell_cancel', HR.nft_sell_cancel)\n processor.on('ft_transfer', HR.ft_transfer)\n processor.on('ft_airdrop', HR.ft_airdrop)\n processor.on('nft_transfer', HR.nft_transfer)\n processor.on('nft_auction', HR.nft_auction)\n processor.on('nft_hauction', HR.nft_hauction)\n processor.on('nft_bid', HR.nft_bid)\n processor.on('nft_transfer_cancel', HR.nft_transfer_cancel)\n processor.on('nft_reserve_transfer', HR.nft_reserve_transfer)\n processor.on('nft_reserve_complete', HR.nft_reserve_complete)\n processor.on('nft_define', HR.nft_define)\n processor.on('nft_add_roy', HR.nft_add_roy)\n processor.on('nft_div', HR.nft_div)\n processor.on('nft_define_delete', HR.nft_define_delete)\n processor.on('nft_melt', HR.nft_delete)\n processor.on('nft_mint', HR.nft_mint)\n processor.on('nft_pfp', HR.nft_pfp)\n }\n //do things in cycles based on block time\n processor.onBlock(\n function (num, pc, prand, bh) {\n Log.block(num);\n if(num < TXID.blocknumber){\n require('process').exit(2)\n } else {TXID.clean(num)}\n return new Promise((resolve, reject) => {\n let Pchron = getPathSome(['chrono'],{\n gte: \"\" + num - 1,\n lte: \"\" + (num + 1)\n })\n let Pmss = getPathSome(['mss'],{\n gte: \"\" + (num - 1000000),\n lte: \"\" + (num - 100)\n }) //resign mss\n let Pmsso = getPathSome(['msso'],{\n gte: \"\" + (num - 1000000),\n lte: \"\" + (num - 100)\n })\n let Pmsa = getPathObj(['msa'])\n let Pmso = getPathObj(['mso'])\n Promise.all([Pchron, Pmss, Pmsa, Pmso, Pmsso]).then(mem => {\n var a = mem[0],\n mss = mem[1], //resign mss\n msa = mem[2], //if length > 80... sign these\n mso = mem[3],\n msso = mem[4],\t\n mso_keys = Object.keys(mso)\n let chrops = {},\n msa_keys = Object.keys(msa)\n mso_keys = Object.keys(mso)\n for (var i in a) {\n chrops[a[i]] = a[i]\n }\n var ints = 0\n let j = Object.keys(chrops)\n loop(0,ints,j)\n function loop (i,ints, j){\n ints++\n let delKey = chrops[j[i]]\n if(i<j.length)ChonOp(delKey, ints, prand, num).then(x=>{\n i++\n if(i<j.length)loop(i,ints,j)\n else every()\n })\n else every()\n function ChonOp (delKey, ints, prand, num){\n return new Promise((res,rej)=>{\n store.getWith(['chrono', chrops[j[i]]], {delKey, ints}, function(e, b, passed) {\n switch (b.op) {\n case 'mint':\n //{op:\"mint\", set:json.set, for: from}\n let setp = getPathObj(['sets', b.set]);\n NFT.mintOp([setp], passed.delKey, num, b, `${passed.ints}${prand}`)\n .then(x=>res(x))\n break;\n case 'ahe':\n let ahp = getPathObj(['ah', b.item]),\n setahp = ''\n if (b.item.split(':')[0] != 'Qm') setahp = getPathObj(['sets', b.item.split(':')[0]])\n else setahp = getPathObj(['sets', `Qm${b.item.split(':')[1]}`])\n NFT.AHEOp([ahp, setahp], passed.delKey, num, b)\n .then(x=>res(x))\n break;\n case 'ahhe':\n let ahhp = getPathObj(['ahh', b.item]),\n setahhp = ''\n if (b.item.split(':')[0] != 'Qm') setahhp = getPathObj(['sets', b.item.split(':')[0]])\n else setahhp = getPathObj(['sets', `Qm${b.item.split(':')[1]}`])\n NFT.AHHEOp([ahhp, setahhp], passed.delKey, num, b, bh.timestamp)\n .then(x=>res(x))\n break;\n case 'ame':\n let amp = getPathObj(['am', b.item]),\n setamp = ''\n if (b.item.split(':')[0] != 'Qm') setamp = getPathObj(['sets', b.item.split(':')[0]])\n else setamp = getPathObj(['sets', `Qm${b.item.split(':')[1]}`])\n NFT.AMEOp([amp, setamp], passed.delKey, num, b)\n .then(x=>res(x))\n break;\n case 'div':\n let contract = getPathObj(['div', b.set]),\n set = getPathObj(['sets', b.set]),\n sales = getPathObj(['ls']),\n auctions = getPathObj(['ah'])\n NFT.DividendOp([contract, set, sales, auctions], passed.delKey, num, b)\n .then(x=>res(x))\n break;\n case 'del_pend':\n store.batch([{ type: 'del', path: ['chrono', passed.delKey] }, { type: 'del', path: ['pend', `${b.author}/${b.permlink}`]}], [res, rej,'info'])\n break;\n case 'ms_send':\n recast(b.attempts, b.txid, num)\n store.batch([{ type: 'del', path: ['chrono', passed.delKey] }], [res, rej,'info'])\n break;\n case 'expire':\n release(b.from, b.txid, num)\n store.batch([{ type: 'del', path: ['chrono', passed.delKey] }], [res, rej,'info'])\n break;\n case 'check':\n enforce(b.agent, b.txid, { id: b.id, acc: b.acc }, num)\n store.batch([{ type: 'del', path: ['chrono', passed.delKey] }], [res, rej,'info'])\n break;\n case 'denyA':\n enforce(b.agent, b.txid, { id: b.id, acc: b.acc }, num)\n store.batch([{ type: 'del', path: ['chrono', passed.delKey] }], [res, rej,'info'])\n break;\n case 'denyT':\n enforce(b.agent, b.txid, { id: b.id, acc: b.acc }, num)\n store.batch([{ type: 'del', path: ['chrono', passed.delKey] }], [res, rej,'info'])\n break;\n case 'gov_down': //needs work and testing\n let plb = getPathNum(['balances', b.by]),\n tgovp = getPathNum(['gov', 't']),\n govp = getPathNum(['gov', b.by])\n Chron.govDownOp([plb, tgovp, govp], b.by, passed.delKey, num, passed.delKey.split(':')[1], b)\n .then(x=>res(x))\n break;\n case 'power_down': //needs work and testing\n let lbp = getPathNum(['balances', b.by]),\n tpowp = getPathNum(['pow', 't']),\n powp = getPathNum(['pow', b.by])\n Chron.powerDownOp([lbp, tpowp, powp], b.by, passed.delKey, num, passed.delKey.split(':')[1], b)\n .then(x=>res(x))\n break;\n case 'post_reward':\n Chron.postRewardOP(b, num, passed.delKey.split(':')[1], passed.delKey)\n .then(x=>res(x))\n break;\n case 'post_vote':\n Chron.postVoteOP(b, passed.delKey)\n .then(x=>res(x))\n break;\n default:\n\n }\n })\n })\n }\n }\n function every(){\n return new Promise((res, rej)=>{\n let promises = [HR.margins()]\n if(num % 100 !== 50){\t\n if(mso_keys.length){\t\n promises.push(new Promise((res,rej)=>{\t\n osig_submit(osign(num, 'mso', mso_keys, bh))\t\n .then(nodeOp => {\t\n res('SAT')\t\n try{\t\n if(plasma.rep && JSON.parse(nodeOp[1][1].json).sig)NodeOps.unshift(nodeOp)\t\n }catch(e){}\t\n })\t\n .catch(e => { rej(e) })\t\n }))\t\n } else if(msso.length){\t\n promises.push(new Promise((res,rej)=>{\t\n osig_submit(osign(num, 'msso', msso, bh))\t\n .then(nodeOp => {\t\n res('SAT')\t\n try {\t\n if(plasma.rep && JSON.parse(nodeOp[1][1].json).sig)NodeOps.unshift(nodeOp) //check to see if sig\t\n }catch(e){}\t\n })\t\n .catch(e => { rej(e) })\t\n }))\t\n } else if(msa_keys.length > 80){\n promises.push(new Promise((res,rej)=>{\n sig_submit(consolidate(num, plasma, bh))\n .then(nodeOp => {\n res('SAT')\n if(plasma.rep)NodeOps.unshift(nodeOp)\n })\n .catch(e => { rej(e) })\n }))\n }\n for(var missed = 0; missed < mss.length; missed++){\n if(mss[missed].split(':').length == 1){\n missed_num = mss[missed]\n promises.push(new Promise((res,rej)=>{\n sig_submit(sign(num, plasma, missed_num, bh))\n .then(nodeOp => {\n res('SAT')\n if(JSON.parse(nodeOp[1][1].json).sig){\n NodeOps.unshift(nodeOp)\n }\n })\n .catch(e => { rej(e) })\n })) \n break;\n }\n }\n }\n if (num % 100 === 0 && processor.isStreaming()) {\n client.database.getDynamicGlobalProperties()\n .then(function(result) {\n console.log('At block', num, 'with', result.head_block_number - num, `left until real-time. DAO in ${30240 - ((num - 20000) % 30240)} blocks`)\n });\n }\n if (num % 100 === 50) {\n promises.push(new Promise((res,rej)=>{\n report(plasma, consolidate(num, plasma, bh))\n .then(nodeOp => {\n res('SAT')\n if(processor.isStreaming())NodeOps.unshift(nodeOp)\n })\n .catch(e => { rej(e) })\n }))\n }\n if ((num - 18505) % 28800 === 0) { //time for daily magic\n promises.push(dao(num))\n block.prev_root = block.root\n block.root = ''\n }\n if (num % 100 === 0) {\n promises.push(tally(num, plasma, processor.isStreaming()));\n }\n if (num % 100 === 99) {\n if(config.features.liquidity)promises.push(Liquidity());\n }\n if ((num - 2) % 3000 === 0) {\n promises.push(voter());\n }\n Promise.all(promises).then(()=>resolve(pc))\n })\n }\n if (num % 100 === 1 && !block.root) {\n block.root = 'pending'\n block.chain = []\n block.ops = []\n store.get([], function(err, obj) {\n const blockState = Buffer.from(stringify([num + 1, obj]))\n\n ipfsSaveState(num, blockState, ipfs)\n .then(pla => {\n TXID.saveNumber = pla.hashBlock\n block.root = pla.hashLastIBlock\n plasma.hashSecIBlock = plasma.hashLastIBlock\n plasma.hashLastIBlock = pla.hashLastIBlock\n plasma.hashBlock = pla.hashBlock\n })\n .catch(e => { console.log(e) })\n\n })\n } else if (num % 100 === 1) {\n const blockState = Buffer.from(stringify([num + 1, block]))\n block.ops = []\n issc(num, blockState, null, 0, 0)\n }\n if (config.active && processor.isStreaming() ) {\n store.get(['escrow', config.username], function(e, a) {\n if (!e) {\n for (b in a) {\n if (!plasma.pending[b]) {\n NodeOps.push([\n [0, 0],\n typeof a[b] == 'string' ? JSON.parse(a[b]) : a[b]\n ]);\n plasma.pending[b] = true\n }\n }\n var ops = [],\n cjbool = false,\n votebool = false\n signerloop: for (i = 0; i < NodeOps.length; i++) {\n if (NodeOps[i][0][1] == 0 && NodeOps[i][0][0] <= 100) {\n if (NodeOps[i][1][0] == 'custom_json' && JSON.parse(NodeOps[i][1][1].json).sig_block && num - 100 > JSON.parse(NodeOps[i][1][1].json).sig_block){\n NodeOps.splice(i, 1)\n continue signerloop\n }\n if (NodeOps[i][1][0] == 'custom_json' && !cjbool ) {\n ops.push(NodeOps[i][1])\n NodeOps[i][0][1] = 1\n cjbool = true\n } else if (NodeOps[i][1][0] == 'custom_json'){\n // don't send two jsons at once\n } else if (NodeOps[i][1][0] == 'vote' && !votebool){\n ops.push(NodeOps[i][1])\n NodeOps[i][0][1] = 1\n votebool = true\n } else if (NodeOps[i][1][0] == 'vote'){\n // don't send two votes at once\n } else { //need transaction limits here... how many votes or transfers can be done at once?\n ops.push(NodeOps[i][1])\n NodeOps[i][0][1] = 1\n }\n } else if (NodeOps[i][0][0] < 100) {\n NodeOps[i][0][0]++\n } else if (NodeOps[i][0][0] == 100) {\n NodeOps[i][0][0] = 0\n }\n }\n for (i = 0; i < NodeOps.length; i++) {\n if (NodeOps[i][0][2] == true) {\n NodeOps.splice(i, 1)\n }\n }\n if (ops.length) {\n console.log('attempting broadcast', ops)\n broadcastClient.broadcast.send({\n extensions: [],\n operations: ops\n }, [config.active], (err, result) => {\n if (err) {\n console.log(err) //push ops back in.\n for (q = 0; q < ops.length; q++) {\n if (NodeOps[q][0][1] == 1) {\n NodeOps[q][0][1] = 3\n }\n }\n } else {\n console.log('Success! txid: ' + result.id)\n for (q = ops.length - 1; q > -1; q--) {\n if (NodeOps[q][0][0] = 1) {\n NodeOps.splice(q, 1)\n }\n }\n }\n });\n }\n } else {\n console.log(e)\n }\n })\n }\n })\n })\n });\n processor.onStreamingStart(HR.onStreamingStart);\n processor.start();\n setTimeout(function(){\n API.start();\n }, 3000);\n}", "function runProgramLogic() {\n fcl\n .config() \n .put(\"accessNode.api\", \"https://access-testnet.onflow.org\") // connect to Flow testnet\n .put(\"challenge.handshake\", \"https://fcl-discovery.onflow.org/testnet/authn\")\n\n subscribeEvents()\n\n app.listen(port, () => {\n console.log(`Example app listening at http://localhost:${port}`)\n })\n}", "function startServer() {\r\n\tif ((process.argv[2] == 'help' || !process.argv[2]) && useCommandLine) {\r\n\t\tconsole.log('node index.js {local,online} [shutdownKey] [port]');\r\n\t\tprocess.exit(0);\r\n\t}\r\n\tvar local = process.argv[2] == 'local';\r\n\tvar shutdownK = process.argv[3] || 'q';\r\n\tvar port = process.argv[4] || 8000;\r\n\tif (local) {\r\n\t\tinitServer('localhost', port);\r\n\t} else {\r\n\t\tvar ip = ipGetter.address();\r\n\t\tconsole.log('Connect to: http://' + ip + ':8000/');\r\n\t\tinitServer(ip, port);\r\n\t}\r\n\tif (useCommandLine) {\r\n\t\tbindShutdownKey(shutdownK);\r\n\t}\r\n\tnetInit();\r\n\tMaps.forEach(map => map.data.id = newID(false));\r\n\tlog(0, 'Map id\\'s set');\r\n\tloadMap(Maps[0]);\r\n\tsetInterval(mainLoop, msPerFrame);\r\n}", "function Server() {\n this.esitScale = new EsitScale(); \n //this.log = new Log();\n \n}", "function startServer() {\n var server = new Server();\n console.log('server started');\n}", "function startServer() {\r\n // Start listening on port 3000\r\n httpServer.listen(Constants.PORT, function () {\r\n console.log('listening on *: ', Constants.PORT);\r\n });\r\n\r\n // Start serving the game\r\n let server = new GameServer(io);\r\n server.init();\r\n}", "async function p() {\n localServerStart();\n consoleCommands();\n}", "init()\r\n {\r\n var self = this;\r\n\r\n // set the template file for uri set method\r\n this.raumkernel.getSettings().uriMetaDataTemplateFile = \"node_modules/node-raumkernel/lib/setUriMetadata.template\";\r\n\r\n // set some other settings from the config/settings file\r\n // TODO: @@@\r\n //this.raumkernel.getSettings().\r\n\r\n // if there is no logger defined we do create a standard logger\r\n if(!this.parmLogger())\r\n this.createLogger(this.settings.loglevel, this.settings.logpath);\r\n\r\n this.logInfo(\"Welcome to raumserver v\" + PackageJSON.version +\" (raumkernel v\" + Raumkernel.PackageJSON.version + \")\");\r\n\r\n // log some information of the network interfaces for troubleshooting\r\n this.logNetworkInterfaces();\r\n\r\n // Do the init of the raumkernel. This will include starting for the raumfeld multiroom system and we\r\n // do hook up on some events so the raumserver knows the status of the multiroom system\r\n this.logVerbose(\"Setting up raumkernel\");\r\n this.raumkernel.parmLogger(this.parmLogger());\r\n // TODO: listen to events like hostOnline/hostOffline\r\n this.raumkernel.init();\r\n\r\n this.logVerbose(\"Starting HTTP server to receive requests\");\r\n this.startHTTPServer();\r\n\r\n this.logVerbose(\"Starting bonjour server for advertising\");\r\n // TODO: @@@\r\n }", "start () {}", "start() {\n const { server, port } = this\n\n server.listen(port, () => {\n this.log(`Start at http://localhost:${port}. Starting election...`)\n this.getLeader()\n })\n }", "function main() {\n setReqURL()\n startMicroservice()\n registerWithCommMgr()\n}", "function myServer() {\n\tthis.server = server;\n}", "function startServer(){\n listDevices.startAttendaceServer(UserName);\n startMessageServer();\n console.log('did');\n}", "_bootstrap() {\n global.Console.log(global.Console.color('Gorgon Server' + ' v' + this.GorgonConfig.data.version, 'green'));\n global.Console.log('Author: Ryan Rentfro <rrentfro at gmail dot com>');\n global.Console.log('Project: https://github.com/manufacturing-industry/gorgon');\n this._motd();\n global.Console.log('Press ' + global.Console.color('cntrl+c', 'yellow') + ' to exit the server');\n global.Version = this.GorgonConfig.data.version;\n }", "readCLI() {\n\n }", "function serverConnected() {\n infoData=\"Connected to /node backend\";\n println(\"Connected to /node backend\");\n}", "function main() {\n // we need a port to connect to for the fun to start.\n var serverPort = env.get('FAKESERVER_IPC_PORT');\n if (!serverPort)\n return dump('pass environment variable FAKESERVER_IPC_PORT ! (stopping)');\n\n\n // initialize the handler\n var handler = new FakeServerProxyHandler(parseInt(serverPort, 10));\n}", "function serverConnected() {\n print(\"Connected to Server\");\n}", "function LedControl(log, config, api) {\n log('LED-control Init');\n let platform = this;\n this.log = log;\n this.config = config;\n this.accessories = [];\n\n this.requestServer = http.createServer(((request, response) => {\n if (request.url === '/add') {\n this.addAccessory('LedLamp');\n response.writeHead(204);\n response.end();\n }\n\n if (request.url == '/reachability') {\n this.updateAccessoriesReachability();\n response.writeHead(204);\n response.end();\n }\n\n if (request.url == '/remove') {\n this.removeAccessory();\n response.writeHead(204);\n response.end();\n }\n }).bind(this));\n\n this.requestServer.listen(18081, () => {\n platform.log('Server Listening...');\n });\n\n if (api) {\n this.api = api;\n\n this.api.on('didFinishLaunching', function() {\n platform.log('DidFinishLaunching');\n }.bind(this));\n }\n}", "'starting up server'(){\n console.log(this.name+' is starting up...');\n }", "function serverConnected() {\n print(\"We are connected!\");\n}", "function listener() {\r\n if (logged == 1) return;\r\n logged = 1;\r\n cfg.port = app.address().port;\r\n csl.log('Server running on port := ' + cfg.port);\r\n // Log the current configuration\r\n for (var key in cfg) {\r\n if (key != 'spdy' || key != 'https')\r\n csl.log(key + ' : ' + cfg[key]);\r\n }\r\n\r\n // If browser is true, launch it.\r\n if (cfg.browser) {\r\n var browser;\r\n switch (process.platform) {\r\n case \"win32\":\r\n browser = \"start\";\r\n break;\r\n case \"darwin\":\r\n browser = \"open\";\r\n break;\r\n default:\r\n browser = \"xdg-open\";\r\n break;\r\n }\r\n csl.warn('Opening a new browser window...');\r\n require('child_process').spawn(browser, ['http://localhost:' + app.address().port]);\r\n }\r\n }", "start(){\n this.applyMiddleWare();\n this.init();\n this.instance.listen(process.env.SERVER_PORT,()=>{\n console.log(`Server started on port ${process.env.SERVER_HOST}.`);\n console.log(`Navigate to http://${process.env.SERVER_HOST}:${process.env.SERVER_PORT}`);\n });\n }", "function init () {\n log.info('Hyperion Remote starting...')\n createSSDPHandler()\n createWebsocketHandler()\n createWindow()\n}", "function main() {\n var server = new grpc.Server();\n server.addService(math_proto.Math.service, {\n Div: Div,\n Fib: Fib,\n Sum: Sum,\n DivMany: DivMany,\n });\n server.bind('0.0.0.0:50052', grpc.ServerCredentials.createInsecure());\n var fs = require('fs');\n var key_data = fs.readFileSync(__dirname + '/../data/server1.key');\n var pem_data = fs.readFileSync(__dirname + '/../data/server1.pem');\n server.bind('0.0.0.0:50051', grpc.ServerCredentials.createSsl(null, [{private_key: key_data,\n cert_chain: pem_data}])); \n server.start();\n}", "function serverConnected() {\n infoData=\"Connected to Server\";\n println(\"Connected to Server\");\n}", "function NetWorthApp() {\n\tconsole.log('NetWorth has started. Thank you.');\n\t// variables, setup, shared functions\n}", "_main () {\n const n = Object.keys(this._accessories).length\n if (n > 0) {\n this.log('restored %d accessories from cache', n)\n }\n if (this.listenerCount('heartbeat') > 0) {\n let beat = -1\n setInterval(() => {\n beat += 1\n this.emit('heartbeat', beat)\n }, 1000)\n }\n this._upnpConfig(this._configJson.upnp || {})\n if (this.listenerCount('upnpDeviceAlive') > 0) {\n this._upnpMonitor.listen()\n }\n if (this.listenerCount('upnpDeviceFound') > 0) {\n this._upnpMonitor.search()\n }\n }", "function ElstrServerRpcCallsAdmin (){}", "start () {\n const serv = NET.createServer(client => {\n console.log('client connected from', client.remoteAddress)\n client.write('hello\\r\\n') // say hello to client\n\n // create a new canvas for this client\n let canvas = new CANVAS(client)\n\n // once the client has exited, do any clean necessary\n client.on('end', () => {\n console.log('client', client.remoteAddress, 'disconnected')\n canvas = undefined\n })\n })\n\n // bad thing happen, throw error\n serv.on('error', (err) => {\n throw err\n })\n\n // turn on server and listen on specificed port\n serv.listen(this.port, () => {\n console.log('server bound and listening on', this.port)\n })\n }", "_serveBall() {\r\n\r\n }", "function invokeServer(syncMode) {\n\tvar className = \"flowMapSolutions_dev.EzPassData\";\n\tvar webORBURL = \"http://flowmap.nyctmc.org/weborb4/weborb.aspx\";\n\tproxy = webORB.bind(className, webORBURL);\n\tproxy.getMidtownEzPassLocations(new Async(successReaderLocation, errorDownloadingData));\n\t//proxy.getMidtownEzpassLinks(new Async(successMimPolylines, errorDownloadingData));\n\tproxy.getWebCameras(new Async(successGotCamera, errorDownloadingData));\n}", "function startServer() {\n if (!opts.p) {\n console.log(opts.p)\n }else\n {\n if (opts.f === '') {\n fs.writeFileSync(tileDirectory + 'index.html', preview(geojsonFiles[0],mapCenter.geometry.coordinates,8));\n }else{\n fs.writeFileSync(tileDirectory + 'index.html', preview(tileLayerName,mapCenter.geometry.coordinates,8));\n }\n var StaticServer = require('static-server');\n var server = new StaticServer({\n rootPath: tileDirectory, // required, the root of the server file tree\n name: 'my-http-server', // optional, will set \"X-Powered-by\" HTTP header\n port: 80, // optional, defaults to a random port\n host: '127.0.0.1', // optional, defaults to any interface\n cors: '*', // optional, defaults to undefined\n followSymlink: true, // optional, defaults to a 404 error\n templates: {\n index: 'index.html', // optional, defaults to 'index.html'\n notFound: '404.html' // optional, defaults to undefined\n }\n });\n\n server.start(function () {\n console.log('Server listening to', server.port);\n });\n opener('http://127.0.0.1/')\n }\n}", "initializeServer() {\n this.createRoutes();\n\n // Create an Express app\n this.app = express();\n\n // Create a server\n this.server = http.createServer(this.app);\n\n // Health endpoint\n this.app.get('/health', (req, res) => { res.json({ status: 'healthy' }) });\n\n //setup basic authentication\n this.app.use(auth);\n\n // Initialize the runtime with a server and settings\n RED.init(this.server, this.redSettings);\n console.log('%s is the userDir for RED', this.redSettings.userDir);\n\n // Serve the editor UI from /red\n this.app.use(this.redSettings.httpAdminRoot,RED.httpAdmin);\n\n // Serve the http nodes UI from /api\n this.app.use(this.redSettings.httpNodeRoot,RED.httpNode);\n\n // Add a simple route for static content served from 'public'\n //self.app.use(\"/\",express.static(\"public\"));\n\n // Add handlers for the app (from the routes).\n for (let r in this.routes) {\n this.app.get(r, this.routes[r]);\n }\n }", "startWebServer() {\n express.listen(this.master.CLA.port, () => console.log(`Running on port ${this.master.CLA.port}`))\n this.loadRoutes()\n }", "function main() {\n\tconst server = new grpc.Server();\n\tserver.addService(lhkwmp.Voucher.service,\n\t\trequire('./rpcServiceFunction/VoucherService')\n\t);\n\tlet credentials = grpc.ServerCredentials.createSsl(\n\t\tfs.readFileSync(__dirname + '/keys/ca.crt'), [{\n\t\t\tcert_chain: fs.readFileSync(__dirname + '/keys/server.crt'),\n\t\t\tprivate_key: fs.readFileSync(__dirname + '/keys/server.key')\n\t\t}], true);\n\tserver.bind('0.0.0.0:2333',credentials);\n\tserver.start();\n}", "function serverController(hostname) {\n const server = http.createServer((request, response) => {\n \n // Creates space around .html requests so that they stand out more in the console\n if (path.extname(request.url) == '.html' || request.url == '/') {\n console.log(`\\nPage Requested: ${request.url}\\n`);\n } else {\n console.log(`Request came: ${request.url}`);\n }\n \n // Sends the requested resources to the response stream\n if (request.url == '/') {\n var file = path.join(__dirname, landing); // delivers index.html by default\n sendFile(file, landing, 'text/html', response);\n } else {\n var file = path.join(__dirname, request.url); // delivers requested resource\n sendFile(file, request.url, getContentType(request.url), response);\n };\n });\n \n // Gives server a port to listen to and gives an IP address to find it\n server.listen(port, hostname, () => {\n console.log(`Server running at ${hostname}:${port}\\n`);\n });\n}", "function start() {\n // in case we fail over to a new server,\n // listen for wsock-open events\n openListener = wss.addOpenListener(wsOpen);\n wss.sendEvent('topo2Start');\n $log.debug('topo2 comms started');\n }", "function serverConnected() {\n print(\"Connected to Server\");\n}", "function main() {\n init();\n enable();\n}", "init() {\n // hello from the other side\n }", "function main() {\n const config = createConfig();\n const server = createServer(config);\n\n const {hostname, port} = config.getWebserverHost();\n console.error(`Starting rpi-clock webserver on ${hostname}:${port}`);\n server.listen(port, hostname);\n}", "function runServer() {\n server.listen(port);\n server.on('error', onError);\n server.on('listening', onListening);\n /**\n * Signaling Server\n */\n require('../Signaling-Server.js')(server);\n}", "function main() {\n\n\t\tfbor = new FBOCompositor( renderer, 512, SHADER_CONTAINER.passVert );\n\t\tfbor.addPass( 'velocity', SHADER_CONTAINER.velocity );\n\t\tfbor.addPass( 'position', SHADER_CONTAINER.position, { velocityBuffer: 'velocity' } );\n\n\n\t\tpsys = new ParticleSystem();\n\t\tvar initialPositionDataTexture = psys.generatePositionTexture();\n\t\tfbor.renderInitialBuffer( initialPositionDataTexture, 'position' );\n\n\n\t\thud = new HUD( renderer );\n\n\tinitGui();\n\n}", "start() {}", "start() {}", "start() {}", "start() {}", "start() {}", "start() {}", "function iLabServer(params, logStream, callback)\n\t{\n\t\t//Fix the parameters\n\t\tvar n = params.host.split(\":\");\n\t\tif (n.length == 2)\n\t\t{\n\t\t\tparams.host = n[0];\n\t\t\tparams.port = n[1];\n\t\t}\n\t\telse\n\t\t\tparams.port = 80;\n\n this.stream = logStream;\n this.stream.write(\"Connecting to Legacy iLab \" + params.host + \" \" + params.port + \"\\n\");\n this.stream.write(params.host + '/'+params.service + \"\\n\");\n\n\t\t//Connect to the iLab\n\t\tif (config.verbose)\n {\n console.log(\"Connecting to Legacy iLab \" + params.host + \" \" + params.port);\n console.log(params.host + '/'+params.service);\n }\n\t\t//Connect to the SOAP\n\t\tvar soap_connection = soap.createConnection(\n\t\t\t\t\t\tparams.host, //Host name\n\t\t\t\t\t\tparams.port, //Port\n\t\t\t\t\t\t'/'+params.service,\n\t\t\t\t\t\t'/'+params.service+'?wsdl', //Wsdl file\n\t\t\t\t\t\tparams.guid,\n\t\t\t\t\t\tparams.key,\n this.stream);\n\n\t\tthis.params = params;\n this.host = params.host;\n this.soap_connection = soap_connection;\n\n\t\t//Create the functions to handle replies\n this.stream.write(\"SOAP: Connecting (\" + params.host+\")\" + \"\\n\");\n\t\tconsole.log(\"SOAP: Connecting (\" + params.host+\")\");\n\t\tsoap_connection.once('initialized', function(lab_server, callback) {\n return function()\n {\n lab_server.stream.write(\"SOAP: Connected (\" + params.host+\")\" + \"\\n\");\n console.log(\"SOAP: Connected (\" + params.host+\")\");\n callback(lab_server);\n };\n }(this, callback));\n\t\tsoap_connection.init();\n\t}", "start() {\n if (this.server) {\n throw Error(\"InvokeServer already started\")\n }\n this.cb = null\n this.err = null\n this.msg = null\n\n this.server = http.createServer((request,response) => this._recieve(request,response))\n this.server.listen(8999)\n }", "function Spacelet()\n{\nvar self = this;\n\nvar lib = (window.WEBPACK_MAIN_LIBRARY ? window.WEBPACK_MAIN_LIBRARY : window);\n\nvar core = new lib.SpaceifyCore();\n//var logger = new lib.SpaceifyLogger(\"Spacelet\");\nvar serviceInterface = new lib.ServiceInterface();\nvar spaceifyNetwork = new lib.SpaceifyNetwork();\n\nself.start = function(application, unique_name, callback)\n\t{ // callback takes preference over application context\n\ttry {\n\t\tcore.startSpacelet(unique_name, function(err, services)\n\t\t\t{\n\t\t\tif(err)\n\t\t\t\t{\n\t\t\t\tif(typeof application == \"function\")\n\t\t\t\t\tapplication(err, false);\n\t\t\t\telse if(application && application.fail)\n\t\t\t\t\tapplication.fail(err);\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tfor(var i = 0; i < services.length; i++)\n\t\t\t\t\t{\n\t\t\t\t\tserviceInterface.connect(service[i].service_name, service[i].unique_name, spaceifyNetwork.isSecure(), (i + 1 != serviceobj.serviceNames.length ? null : function(err, data)\n\t\t\t\t\t\t{\n\t\t\t\t\t\tif(typeof application == \"function\")\n\t\t\t\t\t\t\tapplication(null, true);\n\t\t\t\t\t\telse if(application && application.start)\n\t\t\t\t\t\t\tapplication.start();\n\t\t\t\t\t\t}));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tif(typeof application == \"function\")\n\t\t\tapplication(err, false);\n\t\telse if(application && application.fail)\n\t\t\tapplication.fail(err);\n\t\t}\n\t}\n\nself.getRequiredService = function(service_name, isSecure)\n\t{\n\treturn serviceInterface.getRequiredService(service_name, isSecure);\n\t}\n\nself.isSpaceifyNetwork = function(timeout, callback)\n\t{\n\tspaceifyNetwork.isSpaceifyNetwork(timeout, callback);\n\t}\n\n}", "function onListening() {\n const addr = server.address()\n const bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port: ' + addr.port\n //打印log\n console.log(CGlobal.logLang('clothingshop:server HTTP启动成功,{0} IP地址为:{1}', bind, ip || 'localhost'))\n console.timeEnd('HTTP service start time is')\n console.log('界面访问 http://%s:%s%s/index', 'localhost', addr.port, contextPath === '/' ? '' : contextPath)\n console.log('swagger界面访问 http://%s:%s%s/swagger-ui/', 'localhost', addr.port, contextPath === '/' ? '' : contextPath)\n // console.log('Node 界面访问 http://%s:%s/superLogin', hostname, addr.port);\n // console.log('Vue 界面访问 http://%s:%s/v-index', hostname, addr.port);\n // console.log('Angular 界面访问 http://%s:%s/ng-index', hostname, addr.port);\n }", "startListening() {\n\t\tthis.server.listen(this.port, () => {\n\t\t\tconsole.log('Server started listening on port', this.port);\n\t\t});\n\t}", "async prepareServer() {\n this.options.server && (this.server = await this.addService('server', new this.ServerTransport(this.options.server))); \n }", "startHTTPServer()\r\n {\r\n var self = this;\r\n if(!this.httpServer)\r\n {\r\n this.httpServer = Http.createServer();\r\n this.httpServer.on(\"request\", function(_request, _response){\r\n self.requestReceived(_request, _response);\r\n });\r\n\r\n // start the server on the port given in the settings\r\n this.httpServer.listen(this.settings.port, function() {\r\n self.logVerbose('Raumserver listening on port ' + self.settings.port.toString());\r\n });\r\n }\r\n }", "function main() {\n\t// panelVisible(1, false);\n\t// panelVisible(2, false);\n\n\tconsole.log(\"initializing 2 elevators\");\n\tleftElevator = new Elevator(ELEV_LEFT);\n\trightElevator = new Elevator(ELEV_RIGHT);\n\tconsole.log(leftElevator);\n}", "run() {\n \n console.log(\"Booting up\");\n //so can call methods inside other function\n var self = this; //so can call inside callback function\n\n \n \n let serverHandler = function (request, response) {\n try {\n\n if(self.blacklist[response.connection.remoteAddress]) {\n response.destroy();\n }\n let sentUrl = url.parse(request.url, true);\n let method = request.method;\n console.log(\"Request Recieved: \" + method + \": \" + sentUrl.pathname);\n \n \n //determine action required\n if (method == \"GET\") {\n //sentUrl.pathname = removeExtraPaths(sentUrl.pathname);\n if (sentUrl.pathname.startsWith(self.databaseActions[0])) { //GET request for problem\n self.getProblem(sentUrl.pathname, response);\n } else if (sentUrl.pathname.startsWith(self.databaseActions[1])) { //GET request for Lesson\n self.getLesson(sentUrl.pathname, response);\n } else if (sentUrl.pathname.startsWith(self.databaseActions[2])) { //GET request for an account\n self.getAccount(sentUrl.pathname, response);\n } else if (sentUrl.pathname === self.databaseActions[3]) {\n self.queryProblems(sentUrl.query, response);\n } else if (sentUrl.pathname === self.databaseActions[4]) {\n self.queryLessons(sentUrl.query, response);\n } else { //GET request for a webpage\n self.getPage(sentUrl.pathname, response);\n }\n \n } else if (method == \"POST\") {\n let body = \"\";\n \n request.on('data', function (data) { //event listener for data received from POST request\n body += data;\n if (body.length > maxPostSize) { //stops outside from sending enormous file and crashing server\n request.connection.destroy();\n }\n });\n \n request.on('end', function () { //event listener for when data finished coming from POST request\n let jsonData;\n try {\n jsonData = JSON.parse(body);\n } catch (error) {\n console.log(\"============ Error =============\");\n console.log(\"Error parsing posted data\");\n console.log(error);\n console.log(\"==========End of Error =========\");\n return self.respondWithError(response, 400, \"Error 400: JSON POST data has bad syntax\");\n }\n \n self.authenticatedUserFromToken(response, self.getSentToken(request), function (accountID) {\n if (sentUrl.pathname.startsWith(self.databaseActions[0])) { //POST request for problem\n self.saveProblem(sentUrl.pathname, response, jsonData, accountID);\n } else if (sentUrl.pathname.startsWith(self.databaseActions[1])) { //POST request for Lesson\n self.saveLesson(sentUrl.pathname, response, jsonData, accountID);\n } else if (sentUrl.pathname.startsWith(self.databaseActions[2])) { //POST request for account\n self.saveAccount(response, jsonData, accountID);\n } else {\n console.log(\"============ Error =============\");\n console.log(\"Sent POST request does not match any api call\");\n console.log(\"==========End of Error =========\");\n return self.respondWithError(response, 400, \"Error 400: Bad Request\");\n }\n \n });\n //let accountID = self.authenticatedUser(self.getSentAccountID(request));\n });\n \n \n } else if (method == \"DELETE\") {\n self.authenticatedUserFromToken(response, self.getSentToken(request), function (accountID) {\n if (accountID === undefined) {\n return self.respondWithError(response, 401, \"Error 401: No Authorization Provided\");\n }\n if (sentUrl.pathname.startsWith(self.databaseActions[0])) { //DELETE request for problem\n self.deleteProblem(response, sentUrl.pathname, accountID);\n } else if (sentUrl.pathname.startsWith(self.databaseActions[1])) { //DELETE request for Lesson\n self.deleteLesson(response, sentUrl.pathname, accountID);\n } else if (sentUrl.pathname.startsWith(self.databaseActions[2])) { //DELETE request for account\n self.deleteAccount(response, sentUrl.pathname, accountID);\n } else {\n return self.respondWithError(response, 400, \"Error 400: Bad Request\");\n }\n });\n } else { // we do not handle other methods \n return self.respondWithError(response, 400, \"Error 400: Method not supported\");\n }\n } catch (error) {\n console.error(\"============ Error =============\");\n console.error(\"Uncaught Error!!!\");\n console.error(error);\n console.error(\"==========End of Error =========\");\n }\n }\n\n\n //https has a required options section, but http does not allow it on older versions of node\n if(this.PORT_NUMBER === 443) {\n this.http.createServer(this.options, serverHandler).listen(this.PORT_NUMBER, '0.0.0.0');\n\n const h = require('http');\n let redirectServerHandler = function (request, response) {\n let sentUrl = url.parse(request.url, true);\n console.log('Redirecting to: https://visualalgebra.org' + sentUrl.pathname);\n response.writeHead(301, { Location: 'https://visualalgebra.org' + sentUrl.pathname});\n response.end();\n }\n h.createServer(redirectServerHandler).listen(80, '0.0.0.0');\n } else {\n this.http.createServer(serverHandler).listen(this.PORT_NUMBER, '0.0.0.0');\n }\n }", "function onListening() \n{\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n console.log('init - awesome server');\n // logger.info('init - awesome server');\n}", "started() {\n\n\t\tthis.app.listen(Number(this.settings.port), err => {\n\t\t\tif (err)\n\t\t\t\treturn this.broker.fatal(err);\n\t\t\tthis.logger.info(`API Server started on port ${this.settings.port}`);\n\t\t});\n\n\t}", "start(cb) {\n let app = require('../pomelo').app;\n let self = this;\n\n let gensocket = function(socket) {\n let hybridsocket = new HybridSocket(curId++, socket);\n hybridsocket.on('handshake', self.handshake.handle.bind(self.handshake, hybridsocket));\n hybridsocket.on('heartbeat', self.heartbeat.handle.bind(self.heartbeat, hybridsocket));\n hybridsocket.on('disconnect', self.heartbeat.clear.bind(self.heartbeat, hybridsocket.id));\n hybridsocket.on('closing', Kick.handle.bind(null, hybridsocket));\n self.emit('connection', hybridsocket);\n };\n\n this.connector = app.components.__connector__.connector;\n this.dictionary = app.components.__dictionary__;\n this.protobuf = app.components.__protobuf__;\n this.decodeIO_protobuf = app.components.__decodeIO__protobuf__;\n\n if(!this.ssl) {\n this.listeningServer = net.createServer();\n } else {\n this.listeningServer = tls.createServer(this.ssl);\n }\n this.switcher = new Switcher(this.listeningServer, self.opts);\n\n this.switcher.on('connection', function(socket) {\n gensocket(socket);\n });\n\n if(!!this.distinctHost) {\n this.listeningServer.listen(this.port, this.host);\n } else {\n this.listeningServer.listen(this.port);\n }\n\n process.nextTick(cb);\n }", "function ListenServer (){\r\n kango.console.log (\"Listen\");\r\n var allcookie = document.cookie.split(\";\");\r\n kango.console.log (\"Lenght\",allcookie.length-1);\r\n for (i=0;i < allcookie.length-1;i++)\r\n { \r\n\r\n if (allcookie[i].split('=')[0] == \" BAseURI\")\r\n {var BAseURI = decodeURIComponent(allcookie[i].split('=')[1])}\r\n if (allcookie[i].split('=')[0] == \"TraceName\")\r\n {var TraceName = allcookie[i].split('=')[1]}\r\n if (allcookie[i].split('=')[0] == \" Model_URI\")\r\n {var Model_URI = decodeURIComponent(allcookie[i].split('=')[1])}\r\n }\t\r\n if ( (BAseURI) && (TraceName) && (Model_URI) )\r\n {\r\n Trace_Information ={TraceName:TraceName,BaseURI:BAseURI,ModelURI:Model_URI};\r\n kango.dispatchMessage('TraceInfo',Trace_Information);\r\n var encoded_trace_uri = encodeURIComponent(Trace_Information.BaseURI+Trace_Information.TraceName+\"/\");\r\n var URL = \"http://dsi-liris-silex.univ-lyon1.fr/fderbel/Assistant-Samo-Trace-Me/Index.php?mode=utilisateur&&page=TraceView&trace_uri=\"+encoded_trace_uri ;\r\n // window.open(URL,\"assistant\",\"menubar=no, status=no, scrollbars=no, menubar=no, width=800, height=400\");\r\n kango.dispatchMessage('OpenAssist',URL); \r\n \r\n }\r\n}", "startFractalServer () {\n const server = fractal.web.server(this.generateServerSettings('fractal'))\n return server.start().then(() => {\n console.log(`Fractal server is now running at:\\nLocal: ${server.url}\\nExternal: ${server.urls.sync.external}\\nBS UI: ${server.urls.sync.ui}`)\n })\n }", "function main(){\n userInterface();\n bindings();\n console.log(stutter(\"I like to eat bananas for dinner. Yeah.\"));\n}", "function main() {\r\n startMicroservice()\r\n registerWithCommMgr()\r\n}", "function main() {\n autoRelog = function(password){\n ServerSocket.on(\"connect\", function (){\n console.log(\"getting back in\");\n setTimeout(function(){\n ElementValue(\"InputPassword\",password)\n RelogSend()\n },2000)\n\n })\n }\n\n //---------------------------------------------------------------------------------------------------------------------------------------------\n console.log(\"auto login done\")\n }", "async function init() {\n // Configure plug-ins.\n await server.register([\n require('vision'),\n require('inert'),\n require('lout')\n ]);\n\n await server.register(require('blipp'));\n\n // Configure logging.\n await server.register({\n plugin: require('hapi-pino'),\n options: {\n prettyPrint: true\n }\n });\n\n // Start the server.\n await server.start();\n console.log(`Server running at ${server.info.uri}`);\n}", "function _main() {\n try {\n // the modules own main routine\n //_logCalls();\n\n // enable a global accessability from window\n window.tools = {} || window.tools;\n window.tools._log = _log;\n window.tools._addNavigation = _addNavigation;\n } catch (error) {\n console.log(error);\n }\n\n }", "function main() {\n toggleForm()\n fetchToys()\n createFormListener()\n createLikeListener()\n}", "function main() {\n let msinfo = {\n cfg: null,\n acc: null,\n }\n loadConfig(msinfo)\n\n loadWallet(msinfo, (err) => {\n if(err) u.showErr(err)\n startMicroservice(msinfo)\n registerWithCommMgr()\n })\n}", "function HostGame() {\n\t// Your code goes here for hosting a game\n\tprint(\"Complete this method in Multiplayer.js\");\n}", "function start_server () {\n var server = new msp.Proxy();\n server.listen(8050);\n log('Proxying from http://:8050');\n}", "function scene::ConnToMaster()\r\n{\r\n /*\r\n local idx = 0;\r\n local uiman = system.GetUIMan();\r\n local scrsz = SIZE();\r\n local xpos = 2;\r\n local menuYpos = uiman.GetScreenGridY(0)-16; // font index(0-3)\r\n local slot = 0;\r\n \r\n maps.resize(0);\r\n menubar.resize(0);\r\n\r\n local levemanager = LevelMan();\r\n local servers = levemanager.QueryMaster(\"localhost\",8080,\"\",0); \r\n if(servers)\r\n {\r\n maps.resize(servers);\r\n menubar.resize(servers+4); // for top and remote\r\n }\r\n \r\n menubar[slot] = UiControl();\r\n menubar[slot].Create(0, xpos, menuYpos, xpos+70, menuYpos + 7);\r\n menubar[slot].SetFont(3);\r\n menubar[slot].SetText(\"Curent Folder: \" + folder, 0);\r\n menubar[slot].SetImage(\"topmenu.bmp\");\r\n menubar[slot].SetColor(0xCCCCCC, 0xCCCCCC);\r\n slot++;\r\n menuYpos -= 4;\r\n\r\n// makes button for remote downloading\r\n menuYpos-=3;\r\n menubar[slot] = UiControl();\r\n menubar[slot].Create(100, xpos, menuYpos, xpos+40, menuYpos+3);\r\n menubar[slot].SetFont(1);\r\n menubar[slot].SetText(\"> Remote Levels\", 0);\r\n menubar[slot].SetImage(\"topmenu.bmp\");\r\n menubar[slot].SetColor(0xCCCC00, 0xCCCCCC);\r\n slot++;\r\n \r\n \r\n // makes button for getting back to bspmaps\r\n menubar[slot] = UiControl();\r\n menubar[slot].Create(101, xpos+40, menuYpos, xpos+80, menuYpos+3);\r\n menubar[slot].SetFont(1);\r\n menubar[slot].SetText(\"> Local levels\", 0);\r\n menubar[slot].SetImage(\"topmenu.bmp\");\r\n menubar[slot].SetColor(0xCCCC00, 0xCCCCCC);\r\n slot++;\r\n \r\n // makes button for getting back to bspmaps\r\n menubar[slot] = UiControl();\r\n menubar[slot].Create(102, xpos+80, menuYpos, xpos+120, menuYpos+3);\r\n menubar[slot].SetFont(1);\r\n menubar[slot].SetText(\"> Master Server\", 0);\r\n menubar[slot].SetImage(\"topmenu.bmp\");\r\n menubar[slot].SetColor(0xCCCC00, 0xCCCCCC);\r\n slot++;\r\n \r\n menuYpos -= 4;\r\n\r\n for( idx=0; idx < servers; idx+=1)\r\n {\r\n local server = fb.GetAt(idx);\r\n if(server != null)\r\n {\r\n local srviunfo = levemanager.GetServerAt(idx);\r\n \r\n menubar[slot] = UiControl();\r\n menubar[slot].Create(idx, xpos+(idx), menuYpos, xpos+(idx)+40, menuYpos+3);\r\n menubar[slot].SetFont(1);\r\n menubar[slot].SetText(\"adsfasd\", 0);\r\n menubar[slot].SetImage(\"freebut.bmp\");\r\n menubar[slot].SetColor(0xDDCC44, 0x22CCCC);\r\n\r\n menuYpos-=3;\r\n slot++;\r\n \r\n }\r\n }\r\n */\r\n}", "function main() {\n\n //Own libraries\n const LogWrapper = require('castv2-player').LogWrapper;\n const Scanner = require('castv2-player').Scanner(new LogWrapper(adapter.log));\n\n const ChromecastDevice = require('./lib/chromecastDevice')(adapter);\n\n //var chromecastDevices = {};\n new Scanner (connection => {\n /*chromecastDevices[name] = */new ChromecastDevice(connection);\n });\n\n // in this template all states changes inside the adapters namespace are subscribed\n adapter.subscribeStates('*');\n}", "function runLocal(useSockets=true, showGUI=true, allowVRControls=false, startStereo=false, pSize=null){\n\td3.select(\"#splashdiv5\").text(\"Loading particle data...\");\n\tviewerParams.local = true;\n\tviewerParams.usingSocket = useSockets;\n\tforGUI = [];\n\tforGUI.push({'setGUIParamByKey':[viewerParams.usingSocket, \"usingSocket\"]});\n\tforGUI.push({'setGUIParamByKey':[viewerParams.local, \"local\"]});\n\tsendToGUI(forGUI);\n\n\tviewerParams.initialStereo = startStereo;\n\tviewerParams.allowVRControls = allowVRControls;\n\n\t// it appears that in order for Firefly to start correctly, it must be initialized to non-stereo and trackbacl\n\t// I will re-initialize them to the proper values after the first render pass\n\tviewerParams.useTrackball = true;\n\tviewerParams.useStereo = false;\n\n\t//both of these start setIntervals to wait for the proper variables to be set\n\tmakeViewer(pSize);\n\tif (showGUI) {\n\t\tmakeUI(local=true);\n\t} else {\n\t\td3.selectAll('.UIcontainer').classed('hidden', true)\n\t}\n\t\n\t//This will load the data, and then start the WebGL rendering\n\tgetFilenames(prefix = \"static/\");\n\n}", "function doLoadClient() { /* exported doLoadClient */\n let client;\n let config = {};\n\n /* Hook Logger messages to display in chat */\n Util.Logger.add_hook(function(sev, with_stack, ...args) {\n if (Util.DebugLevel >= Util.LEVEL_DEBUG) {\n let msg = Util.Logger.stringify(...args);\n Content.addErrorText(\"ERROR: \" + msg);\n }\n }, \"ERROR\");\n Util.Logger.add_hook(function(sev, with_stack, ...args) {\n let msg = Util.Logger.stringify(...args);\n if (args.length === 1 && args[0] instanceof TwitchEvent) {\n if (Util.DebugLevel >= Util.LEVEL_TRACE) {\n Content.addNoticeText(\"WARNING: \" + JSON.stringify(args[0]));\n }\n } else if (Util.DebugLevel >= Util.LEVEL_DEBUG) {\n Content.addNoticeText(\"WARNING: \" + msg);\n }\n }, \"WARN\");\n Util.Logger.add_hook(function(sev, with_stack, ...args) {\n if (Util.DebugLevel >= Util.LEVEL_TRACE) {\n let msg = Util.Logger.stringify(...args);\n Content.add(\"DEBUG: \" + msg);\n }\n }, \"DEBUG\");\n Util.Logger.add_hook(function(sev, with_stack, ...args) {\n if (Util.DebugLevel >= Util.LEVEL_TRACE) {\n let msg = Util.Logger.stringify(...args);\n Content.add(\"TRACE: \" + msg);\n }\n }, \"TRACE\");\n\n if (Util.DebugLevel < Util.LEVEL_TRACE) {\n /* Filter out PING/PONG messages */\n Util.Logger.add_filter(/^ws recv> \"PING :tmi.twitch.tv\"$/);\n Util.Logger.add_filter(/^ws send> \"PONG :tmi.twitch.tv\"$/);\n\n /* Filter out users joining/parting channels */\n Util.Logger.add_filter(/tmi.twitch.tv (JOIN|PART) #/);\n }\n\n /* Clear txtName and txtPass (to fix problems with browser autofills) */\n $(\"#txtNick\").val();\n $(\"#txtPass\").val();\n\n /* Add the //config command */\n ChatCommands.add(\"config\", function(cmd, tokens, client_) {\n let cfg = getConfigObject(true);\n let t0 = tokens.length > 0 ? tokens[0] : \"\";\n if (tokens.length === 0) {\n let mcfgs = [];\n Content.addHelp(`<em>Global Configuration Values:</em>`);\n for (let [k, v] of Object.entries(cfg)) {\n let key = k;\n let val = (typeof(v) === \"object\" ? JSON.stringify(v) : `${v}`);\n if (k === \"Layout\") {\n val = FormatLayout(v);\n } else if (k === \"ClientID\") {\n val = \"Omitted for security; use //config clientid to show\";\n } else if (k === \"Pass\") {\n val = \"Omitted for security; use //config pass to show\";\n } else if (typeof(v) === \"object\" && v.Name && v.Name.length > 0) {\n key = val = null;\n mcfgs.push([k, v]);\n }\n if (key !== null) {\n Content.addHelpLine(key, val);\n }\n }\n Content.addHelp(`<em>Window Configuration Values:</em>`);\n for (let [k, v] of mcfgs) {\n let quote = (e) => `&quot;${e}&quot`;\n let kstr = `<span class=\"arg\">${k}</span>`;\n let vstr = `&quot;${v.Name}&quot;`;\n Content.addHelpText(`Module ${kstr}: ${vstr}`);\n for (let [ck, cv] of Object.entries(v)) {\n if (ck !== \"Name\") {\n Content.addHelpLine(ck, quote(cv));\n }\n }\n }\n } else if (t0 === \"help\") {\n Content.addHelpLine(\"//config\", \"Show and manipulate configuration\");\n Content.addHelpText(\"//config parameters:\");\n Content.addHelpLine(\"export\", \"Export *all* of localStorage to a new tab (contains passwords!)\");\n Content.addHelpLine(\"purge\", \"Clear localStorage (cannot be undone!)\");\n Content.addHelpLine(\"clientid\", \"Display ClientID\");\n Content.addHelpLine(\"pass\", \"Dislay OAuth token (if one is present)\");\n Content.addHelpLine(\"url\", \"Generate a URL from the current configuration\");\n Content.addHelpText(\"//config url parameters (can be used in any order):\");\n Content.addHelpLine(\"git\", \"Force URL to target github.io\");\n Content.addHelpLine(\"text\", \"Force URL to be un-encoded\");\n Content.addHelpLine(\"auth\", \"Include passwords in URL\");\n Content.addHelpLine(\"tag=&lt;value&gt;\", \"Set the tag to &lt;value&gt;\");\n Content.addHelpText(\"//config set <key> <value>: Change <key> to <value> (dangerous!)\");\n Content.addHelpText(\"//config setobj <key> <value>: Change <key> to JSON-encoded <value> (dangerous!)\");\n Content.addHelpText(\"//config unset <key>: Remove <key> (dangerous!)\");\n } else if (t0 === \"export\") {\n Util.Open(AssetPaths.CONFIG_EXPORT_WINDOW, \"_blank\", {});\n } else if (t0 === \"purge\") {\n Util.SetWebStorage({});\n window.liveStorage = {};\n Content.addNoticeText(`Purged storage \"${Util.GetWebStorageKey()}\"`);\n } else if (t0 === \"clientid\") {\n Content.addHelpLine(\"ClientID\", cfg.ClientID);\n } else if (t0 === \"pass\") {\n Content.addHelpLine(\"Pass\", cfg.Pass);\n } else if (t0 === \"url\") {\n /* Generate a URL with the current configuration, omitting items\n * left at default values */\n\n /* Base URL, query string array, and function to add items */\n let url = tokens.indexOf(\"git\") > -1 ? GIT_URL : CUR_URL;\n let qs = [];\n let qsAdd = (k, v) => qs.push(`${k}=${encodeURIComponent(v)}`);\n\n /* Generate and append query string items */\n if (cfg.Debug > 0) {\n qsAdd(\"debug\", cfg.Debug);\n }\n if (cfg.__clientid_override) {\n qsAdd(\"clientid\", cfg.ClientID);\n }\n qsAdd(\"channels\", cfg.Channels.join(\",\"));\n if (cfg.NoAssets) {\n qsAdd(\"noassets\", cfg.NoAssets);\n }\n if (cfg.NoFFZ) {\n qsAdd(\"noffz\", cfg.NoFFZ);\n }\n if (cfg.NoBTTV) {\n qsAdd(\"nobttv\", cfg.NoBTTV);\n }\n if (cfg.HistorySize) {\n qsAdd(\"hmax\", cfg.HistorySize);\n }\n for (let module of Object.keys(getModules())) {\n qsAdd(module, formatModuleConfig(cfg[module]));\n }\n qsAdd(\"layout\", FormatLayout(cfg.Layout));\n if (cfg.Transparent) {\n qsAdd(\"trans\", \"1\");\n }\n if (cfg.NoAutoReconnect) {\n qsAdd(\"norec\", \"1\");\n }\n let font_curr = Util.CSS.GetProperty(\"--body-font-size\");\n let font_dflt = Util.CSS.GetProperty(\"--body-font-size-default\");\n if (font_curr !== font_dflt) {\n qsAdd(\"size\", font_curr.replace(/[^0-9]/g, \"\"));\n }\n if (cfg.Plugins) {\n qsAdd(\"plugins\", \"1\");\n }\n if (cfg.MaxMessages !== TwitchClient.DEFAULT_MAX_MESSAGES) {\n qsAdd(\"max\", `${cfg.MaxMessages}`);\n }\n if (cfg.Font) {\n qsAdd(\"font\", cfg.Font);\n }\n if (cfg.Scroll) {\n qsAdd(\"scroll\", \"1\");\n }\n if (cfg.ShowClips) {\n qsAdd(\"clips\", \"1\");\n }\n if (tokens.indexOf(\"auth\") > -1) {\n qsAdd(\"user\", cfg.Name);\n qsAdd(\"pass\", cfg.Pass);\n }\n if (cfg.DisableEffects) {\n qsAdd(\"disable\", cfg.DisableEffects.join(\",\"));\n }\n if (cfg.EnableEffects) {\n qsAdd(\"enable\", cfg.EnableEffects.join(\",\"));\n }\n if (cfg.PluginConfig) {\n qsAdd(\"plugincfg\", JSON.stringify(cfg.PluginConfig));\n }\n if (cfg.ColorScheme === \"dark\") {\n qsAdd(\"scheme\", \"dark\");\n } else if (cfg.ColorScheme === \"light\") {\n qsAdd(\"scheme\", \"light\");\n }\n if (cfg.NoForce) {\n qsAdd(\"noforce\", \"1\");\n }\n if (cfg.Fanfare) {\n qsAdd(\"fanfare\", JSON.stringify(cfg.Fanfare));\n }\n\n /* Append a tag */\n let custom_tag = cfg.tag ? cfg.tag : \"\";\n for (let t of tokens.slice(1)) {\n if (t.startsWith(\"tag=\")) {\n custom_tag = t.substr(4);\n }\n }\n if (custom_tag) {\n qsAdd(\"tag\", custom_tag);\n }\n\n /* Append query string to the URL */\n if (tokens.includes(\"text\")) {\n url += \"?\" + qs.join(\"&\");\n } else {\n url += \"?base64=\" + encodeURIComponent(btoa(qs.join(\"&\")));\n }\n\n Content.addHelp($(`<a></a>`).attr(\"href\", url).text(url));\n } else if ((t0 === \"set\" || t0 === \"setobj\") && tokens.length > 2) {\n /* Allow changing configuration by command (dangerous) */\n let key = tokens[1];\n let val = tokens.slice(2).join(\" \");\n let newval = null;\n if (t0 === \"setobj\") {\n newval = JSON.parse(val);\n } else if (val === \"true\") {\n newval = true;\n } else if (val === \"false\") {\n newval = false;\n } else if (val === \"Infinity\") {\n newval = Infinity;\n } else if (val === \"-Infinity\") {\n newval = -Infinity;\n } else if (val === \"NaN\") {\n newval = NaN;\n } else if (val.match(/^[+-]?(?:\\d|[1-9]\\d*)$/)) {\n newval = Number.parseInt(val);\n } else if (val.match(/^[-+]?(?:\\d*\\.\\d+|\\d+)$/)) {\n newval = Number.parseFloat(val);\n } else {\n newval = val;\n }\n let newstr = JSON.stringify(newval);\n if (Util.ObjectHas(cfg, key)) {\n let oldval = Util.ObjectGet(cfg, key);\n let oldstr = JSON.stringify(oldval);\n Content.addHelpText(`Changing ${key} from \"${oldstr}\" to \"${newstr}\"`);\n Content.addHelpLine(key, oldstr);\n Content.addHelpLine(key, newstr);\n Util.ObjectSet(cfg, key, newval);\n mergeConfigObject(cfg);\n } else {\n Content.addHelpText(`Adding key ${key} with value \"${newstr}\"`);\n Content.addHelpLine(key, newstr);\n Util.ObjectSet(cfg, key, newval);\n mergeConfigObject(cfg);\n }\n } else if (t0 === \"unset\" && tokens.length > 1) {\n let t1 = tokens[1];\n if (Util.ObjectRemove(cfg, t1)) {\n Content.addHelpText(`Removed key ${t1} from localStorage`);\n Util.SetWebStorage(cfg);\n } else {\n Content.addHelpText(`Failed to remove key ${t1} from localStorage`);\n }\n if (window.liveStorage) {\n if (Util.ObjectRemove(window.liveStorage, t1)) {\n Content.addHelpText(`Removed key ${t1} from liveStorage`);\n } else {\n Content.addHelpText(`Failed to removed key ${t1} from liveStorage`);\n }\n }\n } else if (Util.ObjectHas(cfg, t0)) {\n Content.addHelpText(\"Configuration:\");\n Content.addHelpLine(t0, JSON.stringify(Util.ObjectGet(cfg, t0)));\n } else {\n let tok = `\"${t0}\"`;\n Content.addErrorText(`Unknown config command or key ${tok}`, true);\n }\n }, \"Obtain and modify configuration information; use //config help for details\");\n\n /* Obtain configuration, construct client */\n (function _configure_construct_client() {\n let cfg = getConfigObject(true);\n client = new TwitchClient(cfg);\n Util.DebugLevel = cfg.Debug;\n\n /* Change the document title to show our authentication state */\n document.title += \" -\";\n if (cfg.Pass && cfg.Pass.length > 0) {\n document.title += \" Authenticated\";\n } else {\n document.title += \" Read-Only\";\n if (cfg.Layout.Chat) {\n /* Change the chat placeholder and border to reflect read-only */\n $(\"#txtChat\").attr(\"placeholder\", \"Authentication needed to send messages\");\n Util.CSS.SetProperty(\"--chat-border\", \"#cd143c\");\n }\n }\n\n /* Set values we'll want to use later */\n config = getConfigObject();\n config.Plugins = Boolean(cfg.Plugins);\n /* Absolutely ensure the public config object lacks private fields */\n config.Pass = config.ClientID = null;\n delete config[\"Pass\"];\n delete config[\"ClientID\"];\n })();\n\n /* After all that, sync the final settings up with the html */\n $(\".module\").each(function() {\n setModuleSettings(this, config[$(this).attr(\"id\")]);\n });\n\n /* Disable configured events */\n if (config.DisableEffects) {\n for (let effect of config.EnableEffects) {\n if (CSSCheerStyles[effect]) {\n CSSCheerStyles[effect]._disabled = true;\n }\n }\n }\n\n /* Enable configured effects */\n if (config.EnableEffects) {\n for (let effect of config.EnableEffects) {\n if (CSSCheerStyles[effect]) {\n CSSCheerStyles[effect]._disabled = false;\n }\n }\n }\n\n /* Simulate clicking cbTransparent if config.Transparent is set */\n if (config.Transparent) {\n updateTransparency(true);\n $(\"#cbTransparent\").check();\n } else {\n $(\"#cbTransparent\").uncheck();\n }\n\n /* Set the text size if given */\n if (config.Size) {\n Util.CSS.SetProperty(\"--body-font-size\", config.Size);\n }\n\n /* Set the font if given */\n if (config.Font) {\n Util.CSS.SetProperty(\"--body-font\", config.Font);\n }\n\n /* If scrollbars are configured, enable them */\n if (config.Scroll) {\n $(\".module .content\").css(\"overflow-y\", \"scroll\");\n $(\"#cbScroll\").check();\n } else {\n $(\"#cbScroll\").uncheck();\n }\n\n /* If no channels are configured, show the settings panel */\n if (config.Channels.length === 0) {\n $(\"#settings\").fadeIn();\n }\n\n /* Apply the show-clips config to the settings div */\n if (config.ShowClips) {\n $(\"#cbClips\").check();\n } else {\n $(\"#cbClips\").uncheck();\n }\n\n /* Apply the no-force config to the settings div */\n if (config.NoForce) {\n $(\"#cbForce\").check();\n } else {\n $(\"#cbForce\").uncheck();\n }\n\n /* Apply the selected color scheme; if any */\n if (config.ColorScheme === \"dark\") {\n setDarkScheme();\n } else if (config.ColorScheme === \"light\") {\n setLightScheme();\n }\n\n if (config.NoAnim) {\n $(\"#cbAnimCheers\").uncheck();\n } else {\n $(\"#cbAnimCheers\").check();\n }\n\n $(\"#txtBGStyle\").val(\"\");\n\n if (config.Font) {\n $(\"#txtFont\").val(config.Font);\n } else {\n $(\"#txtFont\").val(Util.CSS.GetProperty(\"--body-font\"));\n }\n\n if (config.Size) {\n $(\"#txtFontSize\").val(config.Size);\n } else {\n $(\"#txtFontSize\").val(Util.CSS.GetProperty(\"--body-font-size\"));\n }\n\n if (config.tag) {\n $(\"#txtTag\").val(config.tag);\n }\n\n /* Construct the HTMLGenerator and Fanfare objects */\n client.set(\"HTMLGen\", new HTMLGenerator(client, config));\n client.set(\"Fanfare\", new Fanfare(client, config));\n\n /* Function for syncing configuration with HTMLGen */\n function updateHTMLGenConfig() {\n for (let [k, v] of Object.entries(getConfigObject())) {\n client.get(\"HTMLGen\").setValue(k, v);\n }\n }\n\n /* Construct the plugins */\n if (config.Plugins) {\n Plugins.loadAll(client, config);\n } else {\n Plugins.disable();\n }\n\n /* Allow JS access if debugging is enabled */\n if (Util.DebugLevel >= Util.LEVEL_DEBUG) {\n window.client = client;\n }\n\n /* Add documentation for the moderator chat commands */\n ChatCommands.addHelp(\"Moderator commands:\", {literal: true});\n ChatCommands.addHelp(\"!tfc reload: Reload the page\",\n {literal: true, command: true});\n ChatCommands.addHelp(\"!tfc force-reload: Reload the page, discarding cache\",\n {literal: true, command: true});\n ChatCommands.addHelp(\"!tfc nuke: Clear the chat\",\n {literal: true, command: true});\n ChatCommands.addHelp(\"!tfc nuke <user>: Clear messages sent by <user>\",\n {command: true, args: true});\n\n /* Close the main settings window */\n function closeSettings() {\n updateModuleConfig();\n $(\"#settings\").fadeOut();\n }\n\n /* Open the main settings window */\n function openSettings() {\n let cfg = getConfigObject(true);\n $(\"#txtChannel\").val(cfg.Channels.join(\",\"));\n $(\"#txtNick\").val(cfg.Name || Strings.NAME_AUTOGEN);\n if (cfg.Pass && cfg.Pass.length > 0) {\n $(\"#txtPass\").attr(\"disabled\", \"disabled\").hide();\n $(\"#txtPassDummy\").show();\n }\n $(\"#selDebug\").val(`${cfg.Debug}`);\n $(\"#settings\").fadeIn();\n }\n\n /* Toggle the main settings window */\n function toggleSettings() {\n if ($(\"#settings\").is(\":visible\")) {\n closeSettings();\n } else {\n openSettings();\n }\n }\n\n /* Close a module's settings window */\n function closeModuleSettings(module) {\n /* Update module configurations on close */\n updateModuleConfig();\n let $ms = $(module).find(\".settings\");\n let $in = $ms.siblings(\"input.name\");\n let $ln = $ms.siblings(\"label.name\");\n $in.hide();\n $ln.html($in.val()).show();\n $ms.fadeOut();\n }\n\n /* Open a module's settings window */\n function openModuleSettings(module) {\n let $ms = $(module).find(\".settings\");\n let $in = $ms.siblings(\"input.name\");\n let $ln = $ms.siblings(\"label.name\");\n $ln.hide();\n $in.val($ln.html()).show();\n $ms.fadeIn();\n }\n\n /* Toggle a module's settings window */\n function toggleModuleSettings(module) {\n let $ms = $(module).find(\".settings\");\n if ($ms.is(\":visible\")) {\n closeModuleSettings(module);\n } else {\n openModuleSettings(module);\n }\n }\n\n /* Reset chat auto-completion variables */\n function resetChatComplete() {\n let $c = $(\"#txtChat\");\n $c.attr(\"data-complete-text\", \"\");\n $c.attr(\"data-complete-pos\", \"-1\");\n $c.attr(\"data-complete-index\", \"0\");\n }\n\n /* Reset chat history recall */\n function resetChatHistory() {\n $(\"#txtChat\").attr(\"data-hist-index\", \"-1\");\n }\n\n /* Initialize chat auto-completion and history */\n resetChatComplete();\n resetChatHistory();\n\n /* Open the settings builder page */\n function openSettingsTab() {\n Util.Open(AssetPaths.BUILDER_WINDOW, \"_blank\", {});\n }\n\n /* Add command to open the settings builder page */\n ChatCommands.add(\"builder\", function _on_cmd_builder(cmd, tokens, client_) {\n Util.Open(AssetPaths.BUILDER_WINDOW, \"_blank\", {});\n }, \"Open the configuration builder wizard\");\n\n /* Pressing a key on the chat box */\n $(\"#txtChat\").keydown(function(e) {\n let t = event.target;\n if (e.key === \"Enter\") {\n if (t.value.trim().length > 0) {\n if (ChatCommands.isCommandStr(t.value)) {\n ChatCommands.execute(t.value, client);\n } else {\n client.SendMessageToAll(t.value);\n }\n client.AddHistory(t.value);\n t.value = \"\";\n resetChatComplete();\n resetChatHistory();\n }\n /* Prevent bubbling */\n e.preventDefault();\n return false;\n } else if (e.key === \"Tab\") {\n /* TODO: Complete command arguments and @user names */\n let orig_text = t.getAttribute(\"data-complete-text\") || t.value;\n let orig_pos = Number.parseInt(t.getAttribute(\"data-complete-pos\"));\n let compl_index = Number.parseInt(t.getAttribute(\"data-complete-index\"));\n if (Number.isNaN(orig_pos) || orig_pos === -1) {\n orig_pos = t.selectionStart;\n }\n if (Number.isNaN(compl_index)) {\n compl_index = 0;\n }\n let compl_obj = {\n orig_text: orig_text,\n orig_pos: orig_pos,\n curr_text: t.value,\n curr_pos: t.selectionStart,\n index: compl_index\n };\n compl_obj = ChatCommands.complete(client, compl_obj);\n t.setAttribute(\"data-complete-text\", compl_obj.orig_text);\n t.setAttribute(\"data-complete-pos\", compl_obj.orig_pos);\n t.setAttribute(\"data-complete-index\", compl_obj.index);\n t.value = compl_obj.curr_text;\n requestAnimationFrame(() => {\n t.selectionStart = compl_obj.curr_pos;\n t.selectionEnd = compl_obj.curr_pos;\n });\n resetChatHistory();\n e.preventDefault();\n return false;\n } else if (e.key === \"ArrowUp\" || e.key === \"ArrowDown\") {\n /* Handle traversing message history */\n let i = Number.parseInt($(this).attr(\"data-hist-index\"));\n let d = (e.key === \"ArrowUp\" ? 1 : -1);\n /* Restrict i to [-1, length-1] */\n i = Math.clamp(i + d, -1, client.GetHistoryLength() - 1);\n let val = client.GetHistoryItem(i);\n if (val !== null) {\n t.value = val.trim();\n }\n t.setAttribute(\"data-hist-index\", `${i}`);\n /* Delay moving the cursor until after the text is updated */\n requestAnimationFrame(() => {\n t.selectionStart = t.value.length;\n t.selectionEnd = t.value.length;\n });\n resetChatComplete();\n } else {\n resetChatComplete();\n resetChatHistory();\n }\n });\n\n /* Pressing enter while on the settings box */\n $(\"#settings\").keyup(function(e) {\n if (e.key === \"Enter\") {\n toggleSettings();\n }\n });\n\n /* Clicking the settings button */\n $(\"#btnSettings\").click(function(e) {\n toggleSettings();\n });\n\n /* Clicking on the `?` in the settings box header */\n $(\"#btnSettingsHelp\").click(function(e) {\n Util.Open(AssetPaths.HELP_WINDOW, \"_blank\", {});\n });\n\n /* Clicking on the \"Builder\" link in the settings box header */\n $(\"#btnSettingsBuilder\").click(function(e) {\n Util.Open(AssetPaths.BUILDER_WINDOW, \"_blank\", {});\n });\n\n /* Changing the \"Channels\" text box */\n onChange($(\"#txtChannel\"), function(e) {\n setChannels(client, $(this).val().split(\",\"));\n mergeConfigObject({\"Channels\": client.GetJoinedChannels()});\n });\n\n /* Changing the \"Scrollbars\" checkbox */\n $(\"#cbScroll\").change(function(e) {\n let scroll = $(this).is(\":checked\");\n mergeConfigObject({\"Scroll\": scroll});\n $(\".module .content\").css(\"overflow-y\", scroll ? \"scroll\" : \"hidden\");\n });\n\n /* Changing the \"stream is transparent\" checkbox */\n $(\"#cbTransparent\").change(function() {\n let val = $(this).is(\":checked\");\n updateTransparency(val);\n updateHTMLGenConfig();\n });\n\n /* Changing the \"Show Clips\" checkbox */\n $(\"#cbClips\").change(function(e) {\n mergeConfigObject({\"ShowClips\": $(this).is(\":checked\")});\n updateHTMLGenConfig();\n });\n\n /* Clicking on the \"No Force\" checkbox */\n $(\"#cbForce\").change(function(e) {\n mergeConfigObject({\"NoForce\": $(this).is(\":checked\")});\n updateHTMLGenConfig();\n });\n\n /* Changing the debug level */\n $(\"#selDebug\").change(function(e) {\n let v = parseInt($(this).val());\n Util.Log(`Changing debug level from ${Util.DebugLevel} to ${v}`);\n Util.DebugLevel = v;\n });\n\n /* Clicking on the reconnect link in the settings box */\n $(\"#btnReconnect\").click(function(e) {\n client.Connect();\n });\n\n /* Clicking on the \"Advanced Settings\" or \"Hide Advanced Settings\" links */\n $(\"#btnAdvanced, #btnAdvHide\").click(function(e) {\n $(\"#advSettings\").slideToggle();\n });\n\n /* Changing the \"Animated Cheers\" checkbox */\n $(\"#cbAnimCheers\").change(function(e) {\n mergeConfigObject({NoAnim: !$(this).is(\":checked\")});\n updateHTMLGenConfig();\n });\n\n /* Changing the \"Background Image\" text box */\n onChange($(\"#txtBGStyle\"), function(e) {\n $(\".module\").css(\"background-image\", $(this).val());\n });\n\n /* Changing the font text box */\n onChange($(\"#txtFont\"), function(e) {\n let v = $(this).val();\n if (v) {\n if (v === \"default\") {\n Util.CSS.SetProperty(\"--body-font\", \"var(--body-font-default)\");\n } else {\n Util.CSS.SetProperty(\"--body-font\", v);\n }\n }\n });\n\n /* Changing the font size text box */\n onChange($(\"#txtFontSize\"), function(e) {\n let v = $(this).val();\n if (v) {\n if (v === \"default\") {\n Util.CSS.SetProperty(\"--body-font-size\", \"var(--body-font-size-default)\");\n } else {\n Util.CSS.SetProperty(\"--body-font-size\", v);\n }\n }\n });\n\n /* Changing the tag */\n onChange($(\"#txtTag\"), function(e) {\n mergeConfigObject({tag: $(this).val()});\n });\n\n /* Pressing enter or escape on the module's name text box */\n $(\".module .header input.name\").keyup(function(e) {\n let $m = $(this).parentsUntil(\".column\").last();\n if (e.key === \"Enter\") {\n closeModuleSettings($m);\n } else if (e.key === \"Escape\") {\n /* Revert name change */\n $m.find(\"input.name\").val($m.find(\"label.name\").html());\n closeModuleSettings($m);\n }\n });\n\n /* Clicking on a \"Clear\" link */\n $(\".module .header .clear-link\").click(function(e) {\n $(this).parentsUntil(\".column\").find(\".line-wrapper\").remove();\n });\n\n /* Pressing enter or escape on one of the module menu text boxes */\n $(`.module .settings input[type=\"text\"]`).keyup(function(e) {\n if (e.key === \"Enter\") {\n let v = $(this).val();\n if (v.length > 0) {\n let $cli = $(this).closest(\"li\");\n let cls = $cli.attr(\"class\").replace(\"textbox\", \"\").trim();\n let cb = client.get(\"HTMLGen\").checkbox(v, null, cls, true);\n let val = $cli.find(\"label\").html();\n let $li = $(`<li><label>${cb}${val} ${v}</label></li>`);\n $cli.before($li);\n $(this).val(\"\");\n updateModuleConfig();\n }\n } else if (e.key === \"Escape\") {\n closeModuleSettings($(this).parentsUntil(\".column\").last());\n }\n });\n\n /* Key presses at the document level */\n $(document).keyup(function(e) {\n if (e.key === \"ScrollLock\") {\n /* ScrollLock: pause or resume auto-scroll */\n let $c = $(\".module .content\");\n let val = $c.attr(\"data-no-scroll\");\n if (val) {\n /* Enable scrolling */\n $c.removeAttr(\"data-no-scroll\");\n Util.Log(\"Auto-scroll enabled\");\n Content.addHelpText(\"Auto-scroll enabled\");\n } else {\n /* Disable scrolling */\n $c.attr(\"data-no-scroll\", \"1\");\n Util.Log(\"Auto-scroll disabled\");\n Content.addHelpText(\"Auto-scroll disabled\");\n }\n } else if (e.key === \"Escape\") {\n /* Escape: hide all open settings windows */\n if ($(\"#settings\").is(\":visible\")) {\n $(\"#settings\").fadeOut();\n }\n for (let m of Object.values(getModules())) {\n if ($(m).find(\".settings\").is(\":visible\")) {\n closeModuleSettings($(m));\n }\n }\n } else if (e.key === \"F1\") {\n /* F1: open configuration help window */\n openSettingsTab();\n }/* else if (!e.key.match(/^[A-Za-z0-9_]$/)) {\n if ([\"Shift\", \"Control\", \"Alt\", \"Tab\"].indexOf(e.key) === -1) {\n Util.LogOnly(e.key);\n Util.DebugOnly(e);\n }\n }*/\n });\n\n /* Clicking elsewhere on the document: reconnect, username context window */\n $(document).click(function(e) {\n let $t = $(e.target);\n\n /* Clicking on or off of the module settings button or box */\n for (let module of Object.values(getModules())) {\n let $m = $(module);\n let $mm = $m.find(\".menu\");\n let $mh = $m.find(\".header\");\n let $ms = $m.find(\".settings\");\n if (Util.PointIsOn(e.clientX, e.clientY, $mm)) {\n toggleModuleSettings($m);\n } else if ($ms.is(\":visible\")) {\n if (!Util.PointIsOn(e.clientX, e.clientY, $ms)) {\n if (!Util.PointIsOn(e.clientX, e.clientY, $mh)) {\n closeModuleSettings($m);\n }\n }\n }\n }\n\n /* Clicking off the main settings window */\n let $sw = $(\"#settings\");\n if ($sw.is(\":visible\")) {\n if (!Util.PointIsOn(e.clientX, e.clientY, $sw)) {\n closeSettings();\n }\n }\n\n /* Clicking on the username context window */\n let $cw = $(\"#userContext\");\n if (Util.PointIsOn(e.clientX, e.clientY, $cw)) {\n let ch = $cw.attr(\"data-channel\");\n let user = $cw.attr(\"data-user\");\n let userid = $cw.attr(\"data-user-id\");\n if (!client.IsUIDSelf(userid)) {\n if ($t.attr(\"id\") === \"cw-unmod\") {\n /* Clicked on the \"unmod\" link */\n Util.Log(`Unmodding ${user} in ${ch}`);\n client.SendMessage(ch, `/unmod ${user}`);\n } else if ($t.attr(\"id\") === \"cw-unvip\") {\n /* Clicked on the \"unvip\" link */\n Util.Log(`Removing VIP for ${user} in ${ch}`);\n client.SendMessage(ch, `/unvip ${user}`);\n } else if ($t.attr(\"id\") === \"cw-make-mod\") {\n /* Clicked on the \"mod\" link */\n Util.Log(`Modding ${user} in ${ch}`);\n client.SendMessage(ch, `/mod ${user}`);\n } else if ($t.attr(\"id\") === \"cw-make-vip\") {\n /* Clicked on the \"vip\" link */\n Util.Log(`VIPing ${user} in ${ch}`);\n client.SendMessage(ch, `/vip ${user}`);\n }\n }\n } else if ($t.attr(\"data-username\") === \"1\") {\n /* Clicked on a username; show context window */\n let $l = $t.parent();\n if ($cw.is(\":visible\")) {\n if ($cw.attr(\"data-user-id\") === $l.attr(\"data-user-id\")) {\n /* Clicked on the same name: fade out */\n $cw.fadeOut();\n } else {\n /* Clicked on a different name */\n /* FIXME: Slide to new user rather than teleport */\n showUserContextWindow(client, $cw, $l);\n }\n } else {\n showUserContextWindow(client, $cw, $l);\n }\n } else if ($cw.is(\":visible\")) {\n /* Clicked somewhere else: close context window */\n $cw.fadeOut();\n }\n\n /* Clicking on a \"Reconnect\" link */\n if ($t.attr(\"data-reconnect\") === \"1\") {\n Content.addNoticeText(\"Reconnecting...\");\n client.Connect();\n }\n\n /* Clicking on an emote\n if ($t.attr(\"data-is-emote\") === \"1\") {\n Util.LogOnly(`Clicked on an emote: ${$t.parent().html()}`);\n }\n */\n });\n\n /* WebSocket opened */\n client.bind(\"twitch-open\", function _on_twitch_open(e) {\n $(\".loading\").remove();\n $(\"#debug\").hide();\n if (Util.DebugLevel >= Util.LEVEL_DEBUG) {\n if (client.IsAuthed()) {\n Content.addInfoText(\"Connected (authenticated)\");\n } else {\n Content.addInfoText(\"Connected (unauthenticated)\");\n }\n }\n if (getConfigValue(\"Channels\").length === 0) {\n Content.addInfoText(\"No channels configured; type //join <channel> to join one!\");\n }\n });\n\n /* WebSocket closed */\n client.bind(\"twitch-close\", function _on_twitch_close(e) {\n let code = e.object.event.code;\n let reason = e.object.event.reason;\n let msg = `(code ${code} ${Util.WSStatus[code]})`;\n if (reason) {\n msg = `(code ${code} ${Util.WSStatus[code]}: ${reason})`;\n }\n if (getConfigValue(\"NoAutoReconnect\")) {\n Content.addErrorText(`Connection closed ${msg} ${Strings.RECONNECT}`);\n } else {\n Content.addErrorText(`Connection closed ${msg}; reconnecting in 5 seconds...`);\n if (!client.connecting) {\n window.setTimeout(() => { client.Connect(); }, 5000);\n }\n }\n });\n\n /* Client joined a channel */\n client.bind(\"twitch-joined\", function _on_twitch_joined(e) {\n let layout = getConfigValue(\"Layout\");\n if (!layout.Slim) {\n Content.addInfoText(`Joined ${Twitch.FormatChannel(e.channel)}`);\n }\n });\n\n /* Client left a channel */\n client.bind(\"twitch-parted\", function _on_twitch_parted(e) {\n let layout = getConfigValue(\"Layout\");\n if (!layout.Slim) {\n Content.addInfoText(`Left ${Twitch.FormatChannel(e.channel)}`);\n }\n });\n\n /* Notice (or warning) from Twitch */\n client.bind(\"twitch-notice\", function _on_twitch_notice(e) {\n let channel = Twitch.FormatChannel(e.channel);\n let message = e.message;\n Content.addNoticeText(`${channel}: ${message}`);\n if (e.noticeMsgId === \"cmds_available\") {\n Content.addInfoText(\"Use //help to see Twitch Filtered Chat commands\");\n }\n });\n\n /* Error from Twitch or Twitch Client API */\n client.bind(\"twitch-error\", function _on_twitch_error(e) {\n Util.Error(e);\n let user = e.user;\n let command = e.values.command;\n let message = e.message;\n Content.addErrorText(`Error for ${user}: ${command}: ${message}`);\n });\n\n /* Message received from Twitch */\n client.bind(\"twitch-message\", function _on_twitch_message(e) {\n if (Util.DebugLevel >= Util.LEVEL_TRACE) {\n if (e instanceof TwitchEvent) {\n Content.addPreText(e.repr());\n } else {\n Content.addPreText(JSON.stringify(e));\n }\n }\n /* Avoid flooding the DOM with stale chat messages */\n let max = getConfigValue(\"MaxMessages\");\n /* FIXME: Causes flickering for some reason */\n for (let c of $(\".content\")) {\n while ($(c).find(\".line-wrapper\").length > max) {\n $(c).find(\".line-wrapper\").first().remove();\n }\n }\n });\n\n /* Received streamer info */\n client.bind(\"twitch-streaminfo\", function _on_twitch_streaminfo(e) {\n let layout = getConfigValue(\"Layout\");\n let cinfo = client.GetChannelInfo(e.channelString) || {};\n if (layout && !layout.Slim) {\n if (cinfo.online) {\n try {\n let url = cinfo.stream.channel.url;\n let name = cinfo.stream.channel.display_name;\n let game = cinfo.stream.game;\n let viewers = cinfo.stream.viewers;\n Content.addNotice(Strings.StreamInfo(url, name, game, viewers));\n if (cinfo.stream.channel.status) {\n Content.addNoticeText(cinfo.stream.channel.status);\n }\n }\n catch (err) {\n Util.ErrorOnly(\"Failed to obtain stream information:\", cinfo);\n Util.Error(err);\n Content.addNotice(Strings.StreamOnline(e.channelString));\n }\n } else {\n Content.addNotice(Strings.StreamOffline(e.channelString));\n }\n }\n });\n\n /* Received chat message */\n client.bind(\"twitch-chat\", function _on_twitch_chat(e) {\n if (e instanceof TwitchChatEvent) {\n let m = typeof(e.message) === \"string\" ? e.message : \"\";\n if (e.flags && e.flags.mod && m.indexOf(\" \") > -1) {\n let tokens = m.split(\" \");\n if (tokens[0] === \"!tfc\") {\n if (tokens[1] === \"reload\") {\n location.reload();\n } else if (tokens[1] === \"force-reload\") {\n location.reload(true);\n } else if (tokens[1] === \"clear\") {\n $(\".content\").children().remove();\n } else if (tokens[1] === \"nuke\") {\n if (tokens[2] && tokens[2].length > 1) {\n let name = CSS.escape(tokens[2].toLowerCase());\n $(`[data-user=\"${name}\"]`).parent().remove();\n } else {\n $(\".content\").children().remove();\n }\n }\n return;\n }\n }\n }\n $(\".module\").each(function() {\n let H = client.get(\"HTMLGen\");\n if (!shouldFilter($(this), e)) {\n let $c = $(this).find(\".content\");\n let $w = $(`<div class=\"line line-wrapper\"></div>`);\n let $e = H.gen(e);\n let $clip = $e.find(\".message[data-clip]\");\n if ($clip.length > 0) {\n let slug = $clip.attr(\"data-clip\");\n client.GetClip(slug)\n .then((clip_data) => {\n client.GetGame(clip_data.game_id)\n .then((game_data) => {\n Content.addHTML(H.genClip(slug, clip_data, game_data), $c);\n });\n });\n }\n $w.append($e);\n Content.addHTML($w, $c);\n }\n });\n });\n\n /* Received CLEARCHAT event */\n client.bind(\"twitch-clearchat\", function _on_twitch_clearchat(e) {\n if (e.flags[\"target-user-id\"]) {\n /* Moderator timed out a user */\n let r = CSS.escape(e.flags[\"room-id\"]);\n let u = CSS.escape(e.flags[\"target-user-id\"]);\n let l = $(`.chat-line[data-channel-id=\"${r}\"][data-user-id=\"${u}\"]`);\n l.parent().remove();\n } else {\n /* Moderator cleared the chat */\n $(\"div.content\").find(\".line-wrapper\").remove();\n }\n });\n\n /* Received CLEARMSG event */\n client.bind(\"twitch-clearmsg\", function _on_twitch_clearmsg(e) {\n Util.StorageAppend(LOG_KEY, e);\n Util.Warn(\"Unhandled CLEARMSG:\", e);\n });\n\n /* User subscribed */\n client.bind(\"twitch-sub\", function _on_twitch_sub(e) {\n Util.StorageAppend(LOG_KEY, e);\n Content.addHTML(client.get(\"HTMLGen\").sub(e));\n });\n\n /* User resubscribed */\n client.bind(\"twitch-resub\", function _on_twitch_resub(e) {\n Util.StorageAppend(LOG_KEY, e);\n Content.addHTML(client.get(\"HTMLGen\").resub(e));\n /* Display the resub message, if one is present */\n if (e.message) {\n let $msg = client.get(\"HTMLGen\").gen(e);\n $msg.addClass(\"message\");\n $msg.addClass(\"sub-message\");\n $msg.addClass(\"sub-user-message\");\n Content.addHTML($msg);\n }\n });\n\n /* User gifted a subscription */\n client.bind(\"twitch-giftsub\", function _on_twitch_giftsub(e) {\n Util.StorageAppend(LOG_KEY, e);\n Content.addHTML(client.get(\"HTMLGen\").giftsub(e));\n });\n\n /* Anonymous user gifted a subscription */\n client.bind(\"twitch-anongiftsub\", function _on_twitch_anongiftsub(e) {\n Util.StorageAppend(LOG_KEY, e);\n Content.addHTML(client.get(\"HTMLGen\").anongiftsub(e));\n });\n\n /* Channel was raided */\n client.bind(\"twitch-raid\", function _on_twitch_raid(e) {\n Util.StorageAppend(LOG_KEY, e);\n Content.addHTML(client.get(\"HTMLGen\").raid(e));\n });\n\n /* New user's YoHiYo */\n client.bind(\"twitch-newuser\", function _on_twitch_newuser(e) {\n Util.StorageAppend(LOG_KEY, e);\n let H = client.get(\"HTMLGen\");\n let $msg = H.newUser(e);\n $msg.find(\".message\").addClass(\"effect-rainbow\").addClass(\"effect-disco\");\n Content.addHTML($msg);\n Content.addHTML(H.gen(e));\n });\n\n /* User gifting rewards to the community */\n client.bind(\"twitch-rewardgift\", function _on_twitch_rewardgift(e) {\n Util.StorageAppend(LOG_KEY, e);\n Content.addHTML(client.get(\"HTMLGen\").rewardGift(e));\n });\n\n /* User gifting a subscription to the community */\n client.bind(\"twitch-mysterygift\", function _on_twitch_mysterygift(e) {\n Util.StorageAppend(LOG_KEY, e);\n Content.addHTML(client.get(\"HTMLGen\").mysteryGift(e));\n });\n\n /* User continuing their gifted subscription */\n client.bind(\"twitch-giftupgrade\", function _on_twitch_giftupgrade(e) {\n Util.StorageAppend(LOG_KEY, e);\n Content.addHTML(client.get(\"HTMLGen\").giftUpgrade(e));\n });\n\n /* User continuing their gifted subscription via Twitch Prime */\n client.bind(\"twitch-primeupgrade\", function _on_twitch_primegiftupgrade(e) {\n Util.StorageAppend(LOG_KEY, e);\n Content.addHTML(client.get(\"HTMLGen\").giftUpgrade(e));\n });\n\n /* User continuing their anonymously-gifted subscription */\n client.bind(\"twitch-anongiftupgrade\", function _on_twitch_anongiftupgrade(e) {\n Util.StorageAppend(LOG_KEY, e);\n Content.addHTML(client.get(\"HTMLGen\").giftUpgrade(e));\n });\n\n /* Received some other kind of usernotice */\n client.bind(\"twitch-otherusernotice\", function _on_twitch_otherusernotice(e) {\n Util.StorageAppend(LOG_KEY, e);\n Util.Warn(\"Unknown USERNOTICE\", e);\n /* TODO: unraid, bitsbadgetier */\n });\n\n /* Received a reconnect request from Twitch */\n client.bind(\"twitch-reconnect\", function _on_twitch_reconnect(e) {\n /* Client will reconnect automatically */\n });\n\n /* Bind to the rest of the events */\n client.bind(\"twitch-join\", function _on_twitch_join(e) {});\n client.bind(\"twitch-part\", function _on_twitch_part(e) {});\n client.bind(\"twitch-hosttarget\", function _on_twitch_hosttarget(e) {});\n client.bind(\"twitch-userstate\", function _on_twitch_userstate(e) {});\n client.bind(\"twitch-roomstate\", function _on_twitch_roomstate(e) {});\n client.bind(\"twitch-globaluserstate\", function _on_twitch_globaluserstate(e) {});\n client.bind(\"twitch-usernotice\", function _on_twitch_usernotice(e) {});\n client.bind(\"twitch-ack\", function _on_twitch_ack(e) {});\n client.bind(\"twitch-ping\", function _on_twitch_ping(e) {});\n client.bind(\"twitch-names\", function _on_twitch_names(e) {});\n client.bind(\"twitch-topic\", function _on_twitch_topic(e) {});\n client.bind(\"twitch-privmsg\", function _on_twitch_privmsg(e) {});\n client.bind(\"twitch-whisper\", function _on_twitch_whisper(e) {});\n client.bind(\"twitch-mode\", function _on_twitch_mode(e) {});\n client.bind(\"twitch-other\", function _on_twitch_other(e) {});\n\n /* Warn about unbound events */\n client.bindDefault(function _on_default(e) {\n Util.Warn(\"Unbound event:\", e);\n Util.StorageAppend(LOG_KEY, e);\n });\n\n /* Finally, connect */\n client.Connect();\n}", "start() {\n this._.on('request', this.onRequest.bind(this));\n this._.on('error', this.onError.bind(this));\n this._.on('listening', this.onListening.bind(this));\n\n this._.listen(this.config.port);\n }" ]
[ "0.6596127", "0.6475046", "0.6358283", "0.63549477", "0.63181895", "0.62134886", "0.6182677", "0.61457354", "0.6034331", "0.6022438", "0.59755063", "0.59675527", "0.59551495", "0.5926308", "0.5904621", "0.5901326", "0.58987087", "0.5894966", "0.58764446", "0.5853212", "0.5851227", "0.5850018", "0.5844391", "0.58324087", "0.58235896", "0.581677", "0.5815492", "0.58140343", "0.58109885", "0.5808177", "0.5803194", "0.57838076", "0.57827854", "0.577572", "0.5769051", "0.57549226", "0.57476693", "0.5735299", "0.57308877", "0.5725457", "0.5722795", "0.57136905", "0.57129943", "0.5709344", "0.56967854", "0.5692302", "0.5683252", "0.56812674", "0.56742454", "0.5672334", "0.566929", "0.56677103", "0.566445", "0.566441", "0.5663249", "0.56610364", "0.5655186", "0.5653042", "0.56530076", "0.5652572", "0.5650334", "0.5647866", "0.56442946", "0.5631114", "0.56271976", "0.56160283", "0.56093866", "0.5602776", "0.5602776", "0.5602776", "0.5602776", "0.5602776", "0.5602776", "0.5600344", "0.5599973", "0.5599272", "0.5593006", "0.55865514", "0.5571396", "0.5568341", "0.55676", "0.55674785", "0.55661803", "0.55657023", "0.55612344", "0.55605173", "0.55599195", "0.55573964", "0.5551833", "0.5550658", "0.55497175", "0.55442536", "0.55429053", "0.55406004", "0.55376554", "0.553731", "0.55262774", "0.55254793", "0.552488", "0.5522096", "0.5519586" ]
0.0
-1
The code supports the following hooks: dartPrint(message) if this function is defined it is called instead of the Dart [print] method. dartMainRunner(main) if this function is defined, the Dart [main] method will not be invoked directly. Instead, a closure that will invoke [main] is passed to [dartMainRunner].
function Isolate() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function print() { console.log('Hello') }", "function printHello(){\n console.log(\"Hello World\");\n}", "function printHello() {\n console.log( \"Hello, World!\");\n }", "function printHello(){\n console.log( \"Hello, World!\");\n}", "function print() {\n console.log('print'); \n}", "print() {\n }", "function main() {\n}", "function printHello(){\n console.log(\"Hello\");\n}", "function print(toPrint) {\n Console.out.println(toPrint);\n}", "function main() {\n return 'Hello, World!';\n}", "function main(){\n userInterface();\n bindings();\n console.log(stutter(\"I like to eat bananas for dinner. Yeah.\"));\n}", "function main() {\n\n}", "function printOne(){\n console.log('one')\n}", "function main(){\r\n}", "function printHello() {\n return \"Hello there!\";\n }", "function main(){\n\t\n}", "function print(text){\n\tconsole.log(text)\n}", "function print(message) {\n console.log(message);\n}", "function hello(name, print){\n print(name);\n}", "function do_print(message) {\n console.log(message);\n}", "function pr(string)\n{\n console.log(string);\n}", "function Main()\n {\n \n }", "function startup()\r\n{\r\n\tconsole.log(\"#include<stdio.h> \\n void main()\");\r\n}", "function Printer() {}", "function printGreeting() {\n console.log(\"Oh, Hello!\");\n}", "function main(){\n\n\n}", "function printName() {\n console.log(\"Sarah Osgood\");\n}", "static function main(args : string[]) :void {\n\t\tlog \"Hello, world!\";\n\t\tdom.\n\t}", "function print(input) {\n console.log(input);\n}", "function Main()\n {\n console.log(\"%cMain Program Body\", \"color: green;\")\n }", "function printMyName(name) {\n console.log(\"Printing name through normal function \" + name);\n}", "function helloWorld() {\n console.log(\"hello world\", helloWorld)\n}", "function printSomething(string){\n\tconsole.log(string);\n}", "function printHello(){\n//This code will run when the function run or is called upon\n console.log(\"This Function is working\");\n\n}", "function func() {\n console.log(\"Hello world\");\n}", "function dogBark(){\n console.log('Bark!');\n}", "function printHelloAgain() {\n console.log(\"Hello\");\n}", "function printSomething(thing) {\n console.log(thing);\n}", "function display() {\n console.log('hello world');\n}", "function helloWorld() {\n console.log('hello');\n}", "function printIt(answer){\n console.log(\"the answer is: \", answer);\n}", "function helloWorld() {\n console.log('Hello world!');\n}", "function printSomething(){\n console.log(\"Something..\");\n }", "function helloWorld() {\n console.log(\"Hello world!\");\n}", "function __consolePrintHandle__(msg){\n print(msg);\n}", "helloWorld () {\n console.log('hello world!')\n }", "function main(){\n//CODE//\n}", "function println(message){\r\n\tjava.lang.System.out.println(message)\r\n\t}", "function print() {\r\n return \"Lara Mahfouz\";\r\n }", "function helloWorld() {\n console.log('Hello, World!');\n}", "function helloWorld() {\n console.log('Hello, World!');\n}", "function main() {\n console.log('Print something out in the terminal');\n foo = 123;\n}", "function main(input) {\r\n var output = \"Hello World\";\r\n return output;\r\n}", "function DebugConsole() {\n}", "function DebugConsole() {\n}", "function DebugConsole() {\n}", "function sayHowdy() {\n console.log(\"Howdy\");\n}", "function helloWorld() {\n\tconsole.log('Hello, World!');\n}", "function createFunctionPrinter(input) {\n\tfunction print()\n {\n console.log(input);\n }\n\n return print;\n}", "printMessageManualy(message) {\n console.log(`Message: ${message}`);\n }", "function print () {\n var msg = _.toArray(arguments).join(' ')\n process.stdout.write(msg)\n}", "function helloWord() {\n console.log(\"hello\");\n}", "enterProgram(ctx) { console.log(\" %s: %s\", __function, ctx.getText()); }", "function debug_print(message)\n{\n if (debug_output_target == 1)\n console.log(message);\n else\n alert(message);\n}", "function basicFunc() {\n console.log('Hello, from a basic function!');\n}", "function logFunnyJoke() {\r\n console.log(\"This is a good Joke\");\r\n}", "function createFunctionPrinter(input) {\n return () => console.log(input);\n}", "function printToConsole( text ) {\n console.log( text );\n}", "function Program(node, print) {\n\t print.sequence(node.body);\n\t}", "function Program(node, print) {\n\t print.sequence(node.body);\n\t}", "function p(text){\n\tconsole.log(text);\n}", "function main() {\n return _main.apply(this, arguments);\n}", "function printName() {\n console.log(\"Severus Snape\");\n}", "function printName() {\n console.log(\"Severus Snape\");\n}", "function printName() {\n console.log(\"Severus Snape\");\n}", "function printName() {\n console.log(\"Severus Snape\");\n}", "function Main() {\n console.log(`%c Main Function`, \"color: grey; font-size: 14px; font-weight: bold;\");\n buildInterface();\n interfaceLogic();\n }", "function println(text) {\r\n print(text + '\\n');\r\n}", "function hello() {\n console.log('Hello world!')\n}", "function dprint(x1)\n{console.log(x1);\n console.log(x1);\n}", "function Program(node, print) {\n print.sequence(node.body);\n}", "function t_println(message) {\r\n t_ln();\r\n t_print(message);\r\n}", "function print(str){ printwp(str, 0); }", "function print(s) {\n // TODO: implement this method!\n}", "function print(a) { \r\n console.log(\"Result: \" + a); \r\n \r\n}", "function print(s) {\n\t\t// console.log(s);\n\t}", "function helloWorld(){\n console.log(\"Hello World11\");\n}", "function x(){\n\t//create a function inside function, it's not allowed in Java\n\tconsole.log(\"x\");\n\t}", "function sayHello() {\n console.log(\"Hello\");\n}", "function sayHello() {\n console.log(\"Hello\");\n}", "function debug(whatToPrint, exit) {\n console.log(whatToPrint);\n if (exit) {\n process.exit();\n }\n}", "function myFunction(arg) {\n console.log(\"Hello!\");\n}", "function $PRINT(s){ }", "function printApple (word) {\n console.log(word);\n}", "function printHelloWorld() {\n\tvar _args = arguejs2.getArguments(arguments);\n\tconsole.log(\"hello world\");\n}", "function helloWorld(fn) {\n fn();\n}", "function printNew(additionalMessage) {\n console.log(additionalMessage);\n}", "function sayHello() {\n console.log(\"Hello World!!\");\n}", "function createFunctionPrinter(input) {\n return function() {\n console.log(input);\n }\n}", "function main() {\n\tvar docs;\n\n\tdebug( 'Generating REPL help documentation.' );\n\tcreateHelp();\n\n\tdebug( 'Loading REPL help documentation.' );\n\tdocs = require( HELP_OUTPUT );\n\n\tdebug( 'Generating REPL examples.' );\n\tcreateExamples( docs );\n} // end FUNCTION main()", "function testFunction() {\n console.log('How are you?');\n}" ]
[ "0.7041391", "0.6483073", "0.64380515", "0.64020544", "0.63678986", "0.6344778", "0.63120365", "0.629683", "0.6288885", "0.62705487", "0.62030035", "0.6201771", "0.61412853", "0.61379194", "0.61365175", "0.6077598", "0.6071957", "0.6062781", "0.60190004", "0.6003274", "0.5993837", "0.59690875", "0.5933333", "0.58241343", "0.58220243", "0.58187115", "0.57757425", "0.5772531", "0.573295", "0.57324165", "0.572515", "0.57240814", "0.5715147", "0.5710473", "0.57059646", "0.57013655", "0.5693894", "0.56865907", "0.56792563", "0.5678052", "0.5677106", "0.5669787", "0.56627417", "0.56488067", "0.564756", "0.56404364", "0.5578169", "0.5574602", "0.55503154", "0.5537794", "0.5537794", "0.5530456", "0.5501275", "0.5492259", "0.5492259", "0.5492259", "0.54873383", "0.547336", "0.54680675", "0.54650205", "0.5462681", "0.5451867", "0.54516435", "0.5429485", "0.5421862", "0.54149073", "0.5414677", "0.54068226", "0.5406505", "0.5406505", "0.53972816", "0.53924406", "0.53912044", "0.53912044", "0.53912044", "0.53912044", "0.53893685", "0.5387845", "0.5386441", "0.53816324", "0.5376743", "0.5371903", "0.5366343", "0.53658587", "0.53642297", "0.5356821", "0.5352528", "0.5350484", "0.5340361", "0.5340361", "0.5335288", "0.5329636", "0.53289646", "0.5327949", "0.5325083", "0.5321732", "0.53205025", "0.5320113", "0.53162146", "0.53159994", "0.5315676" ]
0.0
-1
! SCOREBOARD ASSETS This is the function that runs to add scoreboard assets
function addScoreboardAssets(){ manifest.push({src:'assets/scoreboard/bg_scoreboard.png', id:'bgScoreboard'}); manifest.push({src:'assets/scoreboard/icon_replay.png', id:'iconReplay'}); manifest.push({src:'assets/scoreboard/icon_save.png', id:'iconSave'}); manifest.push({src:'assets/scoreboard/icon_scoreboard.png', id:'iconScoreboard'}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AddAssets()\n{\n\t//Add static background sprites\n\tbackColor = gfx.CreateRectangle(1, 1, 0xfffdad )\n\tgfx.AddGraphic( backColor, 0 , 0 )\n\tgfx.AddSprite( face, 0, 0.886, 1 )\n\tgfx.AddSprite( pasta, 0.85, 0.08, 0.1 )\n\tgfx.AddSprite( pastaIcon, 0.85, 0.08, 0.1 )\n\tgfx.AddSprite( paperIcon, 0.86, 0.15, 0.08 )\n \n //Add counters.\n\tgfx.AddText( pastaTxt, 0.8, 0.09 );\n\tgfx.AddText( paperTxt, 0.8, 0.15 );\n \n //Add scores\n\tgfx.AddText( score, 0.012, 0.01 );\n\tgfx.AddText( immune, 0.68, 0.02 );\n\tgfx.AddSprite( heart, 0.86, 0.02, 0.08 )\n\t\n\t//Add game objects to screen.\n\tAddHandSan()\n \n //Create a batch containers for our virus and drop sprites.\n //(gives higher performance for lots of same sprite/particle)\n batchVirus = gfx.CreateBatch()\n gfx.AddBatch( batchVirus )\n batchDrops = gfx.CreateBatch()\n gfx.AddBatch( batchDrops )\n \n //Hack to provide missing funcs in GameView.\n batchVirus.RemoveSprite = function( sprite ) { batchVirus.removeChild( sprite.sprite ); sprite.added = false; }\n batchDrops.RemoveSprite = function( sprite ) { batchDrops.removeChild( sprite.sprite ); sprite.added = false; }\n \n\t//Show splash screen.\n gfx.AddSprite( screens, 0, 0, 1,1 )\n \n \n //Start game.\n gfx.Play()\n \n\n\tscreens.PlayRange(2,8,0.08*animationSpeed,false)\n\tsetTimeout(function(){screens.Goto(0); ready=true},2500)\n}", "function drawAssets(loadImageDataArray) {\n const assetBoard = document.getElementById('assetBoard');\n const keys = Object.keys(assetData);\n loadImageDataArray = []\n for(i = 0; i < keys.length; i++) { \n assetBoard.appendChild(cloneAssetCategory(keys[i]));\n let d1 = assetData[keys[i]];\n let d1Keys = Object.keys(d1); \n for(ii=0; ii < d1Keys.length; ii++) {\n document.getElementById(`ac_${keys[i]}`).appendChild(cloneAssetGroup(d1Keys[ii]));\n d1[d1Keys[ii]].forEach( function(ele) {\n document.getElementById(`ag_${d1Keys[ii]}`).appendChild(cloneAsset(ele));\n loadImageDataArray.push(`asset_${ele.name.split('.')[0]}`)\n })\n }\n }\n return loadImageDataArray \n }", "function loadAssets() {\n PIXI.loader\n .add([\n \"./assets/tileset10.png\",\n ])\n .load(gameCreate);\n}", "function storeAssets(pRawAssets, pAssets) {\n var i;\n for (i = 0; i < pRawAssets.length; i++) {\n\n var item = pRawAssets[i];\n\n switch (item.type) {\n\n case \"json\":\n var ssdata = JSON.parse(item.result.toString());\n var key;\n for (key in ssdata) {\n if (ssdata.hasOwnProperty(key)) {\n var spData = ssdata[key];\n pAssets[key + \"SpriteSheet\"] = new createjs.SpriteSheet(spData);\n }\n }\n\n break;\n\n case \"image\":\n pAssets[item.id + \"Img\"] = item.result;\n break;\n }\n }\n }", "function addAsset(assets, asset) {\n if (asset) {\n assets.push(asset);\n }\n}", "set mainAsset(value) {}", "function storeAssets(rawAssets, assets) {\n \n var i;\n for (i = 0; i < rawAssets.length; i++) {\n\n var item = rawAssets[i];\n\n switch (item.type) {\n \n case \"json\":\n // convert json text to js objects\n var ssdata = JSON.parse(item.result.toString());\n // create spritsheets (here we assume all json describe spritesheets)\n assets[item.id + \"SpriteSheet\"] = new createjs.SpriteSheet(ssdata);\n break;\n\n case \"image\":\n assets[item.id + \"Img\"] = item.result;\n break;\n }\n }\n }", "function game_queueData() {\n\t\tvar data = [\n\t\t\t\"img/awesome.png\",\n\t\t\t\"img/awesome_rays.png\"\n\t\t];\n\t\tg_ASSETMANAGER.queueAssets(data);\n\t\tdata = [\n\t\t];\n\t\tg_SOUNDMANAGER.loadSounds(data);\n}", "function Main() {\n\n MyGL.AssetsManager.getInstance().addGroup([\n //new MyGL.AssetData('standard_mat_bp_vshader', MyGL.AssetData.TEXT, './src/shaders/standard_material/phong-f/vert.glsl'),\n //new MyGL.AssetData('standard_mat_bp_fshader', MyGL.AssetData.TEXT, './src/shaders/standard_material/phong-f/frag.glsl'),\n //new MyGL.AssetData('standard_mat_bp_vshader_nt', MyGL.AssetData.TEXT, './src/shaders/standard_material/phong-f/vert_no_texture.glsl'),\n //new MyGL.AssetData('standard_mat_bp_fshader_nt', MyGL.AssetData.TEXT, './src/shaders/standard_material/phong-f/frag_no_texture.glsl'),\n new MyGL.AssetData('img_earth', MyGL.AssetData.IMAGE, './resource/earth.bmp'),\n new MyGL.AssetData('img_earth01', MyGL.AssetData.IMAGE, './resource/earth01.jpg'),\n new MyGL.AssetData('img_crate', MyGL.AssetData.IMAGE, './resource/crate.gif'),\n\n //new MyGL.AssetData('cube_mat_vshader', MyGL.AssetData.TEXT, './src/shaders/cube_material/base/vert.glsl'),\n //new MyGL.AssetData('cube_mat_fshader', MyGL.AssetData.TEXT, './src/shaders/cube_material/base/frag.glsl'),\n /*new AssetData('sky_n_x', AssetData.IMAGE, './resource/sky_n_x.jpg'),\n new AssetData('sky_n_y', AssetData.IMAGE, './resource/sky_n_y.jpg'),\n new AssetData('sky_n_z', AssetData.IMAGE, './resource/sky_n_z.jpg'),\n new AssetData('sky_p_x', AssetData.IMAGE, './resource/sky_p_x.jpg'),\n new AssetData('sky_p_y', AssetData.IMAGE, './resource/sky_p_y.jpg'),\n new AssetData('sky_p_z', AssetData.IMAGE, './resource/sky_p_z.jpg'),*/\n\n new MyGL.AssetData('cloudy_noon_nx', MyGL.AssetData.IMAGE, './resource/cloudy_noon_nx.jpg'),\n new MyGL.AssetData('cloudy_noon_ny', MyGL.AssetData.IMAGE, './resource/cloudy_noon_ny.jpg'),\n new MyGL.AssetData('cloudy_noon_nz', MyGL.AssetData.IMAGE, './resource/cloudy_noon_nz.jpg'),\n new MyGL.AssetData('cloudy_noon_px', MyGL.AssetData.IMAGE, './resource/cloudy_noon_px.jpg'),\n new MyGL.AssetData('cloudy_noon_py', MyGL.AssetData.IMAGE, './resource/cloudy_noon_py.jpg'),\n new MyGL.AssetData('cloudy_noon_pz', MyGL.AssetData.IMAGE, './resource/cloudy_noon_pz.jpg'),\n\n new MyGL.AssetData('land', MyGL.AssetData.IMAGE, './resource/land.png'),\n new MyGL.AssetData('grass', MyGL.AssetData.IMAGE, './resource/grass.png'),\n\n new MyGL.AssetData('drone', MyGL.AssetData.TEXT, './resource/drone.obj')\n //new AssetData('drone_diffuse', AssetData.IMAGE, './resource/drone_diffuse_01.png')\n ]);\n MyGL.AssetsManager.getInstance().addEventListener(MyGL.AssetsManager.GROUP_LOAD_COMPLETE, this.loadComplete, this);\n MyGL.AssetsManager.getInstance().load();\n}", "addAssets(match) {\n\t\tlet files = findFiles(this.scriptdir, match);\n\t\tfor (let f of files) {\n\t\t\tlet file = path.parse(f);\n\t\t\tlet name = file.name;\n\t\t\tlet type = 'blob';\n\t\t\tif (file.ext === '.png' || file.ext === '.jpg' || file.ext === '.jpeg') {\n\t\t\t\ttype = 'image';\n\t\t\t}\n\t\t\telse if (file.ext === '.wav') {\n\t\t\t\ttype = 'sound';\n\t\t\t}\n\t\t\telse if (file.ext === '.ttf') {\n\t\t\t\ttype = 'font';\n\t\t\t}\n\t\t\telse if (file.ext === '.mp4' || file.ext === '.webm' || file.ext === '.wmv' || file.ext === '.avi') {\n\t\t\t\ttype = 'video';\n\t\t\t}\n\t\t\telse {\n\t\t\t\tname = file.base;\n\t\t\t}\n\n\t\t\tif (!file.name.startsWith('.') && file.name.length > 0) {\n\t\t\t\tthis.assets.push({\n\t\t\t\t\tname: name,\n\t\t\t\t\tfile: f,\n\t\t\t\t\ttype: type\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}", "function preload() {\n game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;\n game.scale.pageAlignHorizontally = true;\n game.scale.pageAlignVertically = true;\n game.stage.backgroundColor = 'grey';\n \n ASSETS.foreach((asset, index) => {\n game.load.image(ASSET_NAME[index], asset);\n });\n // add button separately\n game.load.spritesheet('button', 'assets/button.png', 120, 40);\n}", "addAsset(asset, position) {\n this.assets.push(asset);\n asset.setPosition(position);\n }", "loadAssets() {\n AssetLoader.load(this.setupGame, this.onLoadProgress);\n }", "function loadAssets () {\n OasisAssets = {};\n\n // terrain\n OasisAssets['grass'] = getImage('../../res/', 'grass.png');\n OasisAssets['sand'] = getImage('../../res/', 'sand.png');\n OasisAssets['shore'] = getImage('../../res/', 'shore.png');\n OasisAssets['ocean'] = getImage('../../res/', 'ocean.png');\n OasisAssets['stone'] = getImage('../../res/', 'stone.png');\n OasisAssets['tree'] = getImage('../../res/', 'tree.png');\n OasisAssets['leaves'] = getImage('../../res/', 'leaves.png');\n}", "function preload() {\n costumeObjectArray[0] = new CostumeObject(780, 300, 100, 70, \"assets/lips.png\");\n costumeObjectArray[1] = new CostumeObject(780, 150, 150, 43, \"assets/moustache.png\");\n costumeObjectArray[2] = new CostumeObject(780, 400, 200, 139, \"assets/beard.png\");\n costumeObjectArray[3] = new CostumeObject(780, 10, 200, 100, \"assets/glasses.png\");\n costumeObjectArray[4] = new CostumeObject(5, 170, 325, 449, \"assets/hair.png\");\n costumeObjectArray[5] = new CostumeObject(25, 5, 210, 167, \"assets/hat.png\"); \n// loading the buttons \n imgReset = loadImage(\"assets/buttonReset.png\");\n imgSave = loadImage(\"assets/buttonSave.png\");\n imgFilters = loadImage(\"assets/buttonFilters.png\"); \n imgStage = loadImage(\"assets/backgroundStage.png\")\n}", "LoadAllAssets() {}", "function main() {\n //add field object to stage\n field = new objects.Field(assets.getResult(\"field\"));\n stage.addChild(field);\n //add ball object to stage\n ball = new objects.Ball(assets.getResult(\"ball\"));\n stage.addChild(ball);\n // add player object to stage\n player = new objects.Player(assets.getResult(\"player\"));\n stage.addChild(player);\n // add 3 opposition objects to stage\n for (var cloud = 0; cloud < 3; cloud++) {\n clouds[cloud] = new objects.Cloud(assets.getResult(\"cloud\"));\n stage.addChild(clouds[cloud]);\n }\n //add scoreboard\n scoreboard = new objects.ScoreBoard();\n //add collision manager\n collision = new managers.Collision();\n}", "loadAssets() {\n this.load.image('room2_one_lesson_BG', 'assets/one_lesson_BG.png');\n this.load.image('room2_character_north', 'assets/character_north.png');\n this.load.image('room2_character_east', 'assets/character_east.png');\n this.load.image('room2_character_south', 'assets/character_south.png');\n this.load.image('room2_character_west', 'assets/character_west.png');\n this.load.image('room2_activity1A', 'assets/Panels/RoomTwo/PanelOneA.png');\n\t// this.load.image('room2_activity1B', 'assets/Panels/RoomTwo/PanelOneB.png');\n\t// this.load.image('room2_activity1C', 'assets/Panels/RoomTwo/PanelOneC.png');\n\t// this.load.image('room2_activity1D', 'assets/Panels/RoomTwo/PanelOneD.png');\n this.load.image('room2_activity2A', 'assets/Panels/RoomTwo/PanelTwoA.png');\n this.load.image('room2_activity2B', 'assets/Panels/RoomTwo/PanelTwoB.png');\n\t// this.load.image('room2_activity2C', 'assets/Panels/RoomTwo/PanelTwoC.png');\n\t// this.load.image('room2_activity2D', 'assets/Panels/RoomTwo/PanelTwoD.png');\n this.load.image('room2_activity3A', 'assets/Panels/RoomTwo/PanelThreeA.png');\n this.load.image('room2_activity3B', 'assets/Panels/RoomTwo/PanelThreeB.png');\n this.load.image('room2_activity4A', 'assets/Panels/RoomTwo/PanelFourA.png');\n this.load.image('room2_activity4B', 'assets/Panels/RoomTwo/PanelFourB.png');\n\t// this.load.image('room2_activity4C', 'assets/Panels/RoomTwo/PanelFourC.png');\n\t// this.load.image('room2_activity4D', 'assets/Panels/RoomTwo/PanelFourD.png');\n\t// this.load.image('room2_activity4E', 'assets/Panels/RoomTwo/PanelFourE.png');\n this.load.image('room2_activity5A', 'assets/Panels/RoomTwo/PanelFiveA.png');\n this.load.image('room2_activity5B', 'assets/Panels/RoomTwo/PanelFiveB.png');\n\t// this.load.image('room2_activity5C', 'assets/Panels/RoomTwo/PanelFiveC.png');\n\t// this.load.image('room2_activity5D', 'assets/Panels/RoomTwo/PanelFiveD.png');\n\t// this.load.image('room2_activity5E', 'assets/Panels/RoomTwo/PanelFiveE.png');\n\t// this.load.image('room2_activity5F', 'assets/Panels/RoomTwo/PanelFiveF.png');\n this.load.image('room2_activity6A', 'assets/Panels/RoomTwo/PanelSixA.png');\n this.load.image('room2_activity6B', 'assets/Panels/RoomTwo/PanelSixB.png');\n this.load.image('room2_activity6C', 'assets/Panels/RoomTwo/PanelSixC.png');\n this.load.image('room2_activity6D', 'assets/Panels/RoomTwo/PanelSixD.png');\n this.load.image('room2_activity6E', 'assets/Panels/RoomTwo/PanelSixE.png');\n this.load.image('room2_E_KeyImg', 'assets/E_Key.png');\n this.load.image('room2_wall_info_1', 'assets/wall_art.png');\n this.load.image('room2_wall_info_2', 'assets/wall_art.png');\n this.load.image('room2_wall_info_3', 'assets/wall_art.png');\n this.load.image('room2_wall_info_4', 'assets/wall_art.png');\n this.load.image('room2_wall_info_5', 'assets/wall_art.png');\n this.load.image('room2_wall_info_6', 'assets/wall_art.png');\n this.load.image('room2_floor', 'assets/Room2/floor_1.jpg');\n this.load.image('room2_hole_activity', 'assets/Room2/crackedHole.png');\n this.load.image('room2_hole_nextRoom', 'assets/hole.png');\n this.load.image('room2_map', 'assets/featNotAvail.png');\n this.load.image('room2_notebook', 'assets/featNotAvail.png');\n this.load.image('room2_activityLocked', 'assets/activityLocked.png');\n this.load.image('room2_help_menu', 'assets/help_menu.png');\n this.load.image('rightArrow' , 'assets/rightArrowTest.png');\n\tthis.load.image('returnDoor', 'assets/dooropen_100x100.png');\n this.load.image('singleCoin', 'assets/Coin/singleCoin.png');\n this.load.image('profile','assets/character_south.png');\n }", "LoadAssetWithSubAssets() {}", "function preload() {\n //spritesheets\n playerSS = loadImage('assets/collector.png');\n playerJSON = loadJSON('assets/collector.json');\n trashSS = loadImage('assets/bottle.png');\n trashJSON = loadJSON('assets/bottle.json');\n}", "static preload() {\n\n\t\tlet _onAssetsLoaded = function(e, ressources) {\n\t\t\tShooter.assets = ressources;\n\n\t\t\tShooter.setup();\n\t\t}\n\n\t\tShooter.loader\n\t\t\t.add(Shooter.assetsDir + \"background.jpg\") //TODO : use json objects with index\n\t\t\t.add(Shooter.assetsDir + \"space_ship.png\")\n\t\t\t.add(Shooter.assetsDir + \"space_ship_hit.png\")\n\t\t\t.add(Shooter.assetsDir + \"enemy.png\")\n\t\t\t.add(Shooter.assetsDir + \"bullet.png\")\n\t\t\t.add(Shooter.assetsDir + \"explode.json\");\n\t\t\t\n\t\tShooter.loader.load(_onAssetsLoaded);\n\t}", "function buildScoreBoardCanvas(){\n\tif(!displayScoreBoard){\n\t\treturn;\t\n\t}\n\t\n\t//buttons\n\tresultContainer.removeChild(replayButton);\n\t\n\tbuttonReplay = new createjs.Bitmap(loader.getResult('iconReplay'));\n\tcenterReg(buttonReplay);\n\tcreateHitarea(buttonReplay);\n\tsaveButton = new createjs.Bitmap(loader.getResult('iconSave'));\n\tcenterReg(saveButton);\n\tcreateHitarea(saveButton);\n\tscoreboardButton = new createjs.Bitmap(loader.getResult('iconScoreboard'));\n\tcenterReg(scoreboardButton);\n\tcreateHitarea(scoreboardButton);\n\t\n\tresultContainer.addChild(buttonReplay, saveButton, scoreboardButton);\n\t\n\t//scoreboard\n\tscoreBoardContainer = new createjs.Container();\n\tbgScoreboard = new createjs.Bitmap(loader.getResult('bgScoreboard'));\n\t\n\tscoreTitle = new createjs.Text();\n\tscoreTitle.font = \"80px bariol_regularregular\";\n\tscoreTitle.color = \"#ffffff\";\n\tscoreTitle.text = scoreBoardTitle;\n\tscoreTitle.textAlign = \"center\";\n\tscoreTitle.textBaseline='alphabetic';\n\tscoreTitle.x = canvasW/2;\n\tscoreTitle.y = canvasH/100*14;\n\t\n\tscoreBackTxt = new createjs.Text();\n\tscoreBackTxt.font = \"50px bariol_regularregular\";\n\tscoreBackTxt.color = \"#ffffff\";\n\tscoreBackTxt.text = scoreBackText;\n\tscoreBackTxt.textAlign = \"center\";\n\tscoreBackTxt.textBaseline='alphabetic';\n\tscoreBackTxt.x = canvasW/2;\n\tscoreBackTxt.y = canvasH/100*95;\n\tscoreBackTxt.hitArea = new createjs.Shape(new createjs.Graphics().beginFill(\"#000\").drawRect(-200, -30, 400, 40));\n\tscoreBoardContainer.addChild(bgScoreboard, scoreTitle, scoreBackTxt);\n\t\n\tvar scoreStartY = canvasH/100*23;\n\tvar scoreSpanceY = 49.5;\n\tfor(scoreNum=0;scoreNum<=10;scoreNum++){\n\t\tfor(scoreColNum=0;scoreColNum<score_arr.length;scoreColNum++){\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum] = new createjs.Text();\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].font = \"35px bariol_regularregular\";\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].color = \"#ffffff\";\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].textAlign = score_arr[scoreColNum].align;\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].textBaseline='alphabetic';\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].x = canvasW/100 * score_arr[scoreColNum].percentX;\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].y = scoreStartY;\n\t\t\t\n\t\t\tif(scoreColNum == 0){\n\t\t\t\t//position\n\t\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].text = scoreRank_arr[scoreNum-1];\t\n\t\t\t}\n\t\t\t\n\t\t\tif(scoreNum == 0){\n\t\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].text = score_arr[scoreColNum].col;\t\n\t\t\t}\n\t\t\t\n\t\t\tscoreBoardContainer.addChild($.scoreList[scoreNum+'_'+scoreColNum]);\n\t\t}\n\t\tscoreStartY += scoreSpanceY;\n\t}\n\t\n\tscoreBoardContainer.visible = false;\n\tcanvasContainer.addChild(scoreBoardContainer);\n\t\n\t$.get('submit.html', function(data){\n\t\t$('#canvasHolder').append(data);\n\t\tbuildScoreboardButtons();\n\t\ttoggleSaveButton(true);\n\t\tresizeScore();\n\n\t});\n}", "preload() {\n //images for intro scene\n this.load.image(\"play\", \"src/assets/images/play.png\");\n this.load.image(\n \"lighthouseIntro\",\n \"src/assets/images/lighthouse-intro.png\"\n );\n this.load.image(\"lighthouseColor\", \"src/assets/images/lighthouseColor.png\");\n\n //load sprite sheets for level characters\n this.load.atlas(\n \"player\",\n \"src/assets/spritesheets/Tommy.png\",\n \"src/assets/spritesheets/Tommy.json\"\n );\n this.load.atlas(\n \"robot\",\n \"src/assets/spritesheets/Robot.png\",\n \"src/assets/spritesheets/Robot.json\"\n );\n this.load.atlas(\n \"python\",\n \"src/assets/spritesheets/Python.png\",\n \"src/assets/spritesheets/Python.json\"\n );\n this.load.atlas(\n \"bat\",\n \"src/assets/spritesheets/Bat.png\",\n \"src/assets/spritesheets/Bat.json\"\n );\n this.load.atlas(\n \"monitor\",\n \"src/assets/spritesheets/Monitor.png\",\n \"src/assets/spritesheets/Monitor.json\"\n );\n this.load.atlas(\n \"roach\",\n \"src/assets/spritesheets/Roach.png\",\n \"src/assets/spritesheets/Roach.json\"\n );\n this.load.atlas(\n \"tweeter\",\n \"src/assets/spritesheets/Tweeter.png\",\n \"src/assets/spritesheets/Tweeter.json\"\n );\n //score increasing items\n this.load.image(\"gem\", \"src/assets/images/gem.png\");\n this.load.image(\"ruby\", \"src/assets/images/ruby.png\");\n\n //images for level one scene\n //images for level one Parallax backgrounds\n this.load.image(\n \"Level1CloseSky\",\n \"src/assets/images/Level1/Level1CloseSky.png\"\n );\n this.load.image(\n \"Level1MidSky\",\n \"src/assets/images/Level1/Level1MidSky.png\"\n );\n this.load.image(\n \"Level1FarSky\",\n \"src/assets/images/Level1/Level1FarSky.png\"\n );\n this.load.image(\n \"Level1Clouds\",\n \"src/assets/images/Level1/Level1Clouds.png\"\n );\n\n //load tileset images for layers\n this.load.image(\"labTiles\", \"src/assets/tilesets/prop pack.png\");\n this.load.image(\n \"exitDoorTiles\",\n \"src/assets/tilesets/House (Outside And Inside) Tileset.png\"\n );\n this.load.image(\"windowTiles\", \"src/assets/tilesets/background-tiles.png\");\n this.load.image(\n \"darkIndustrialTiles\",\n \"src/assets/tilesets/0x72-industrial-tileset-32px-extruded.png\"\n );\n this.load.image(\n \"invisibleWalls\",\n \"src/assets/tilesets/Blocks (16 x 16).png\"\n );\n this.load.image(\"closeDaySky\", \"src/assets/tilesets/Day Close.png\");\n this.load.image(\"midDaySky\", \"src/assets/tilesets/Day Mid.png\");\n this.load.image(\"farDaySky\", \"src/assets/tilesets/Day Far.png\");\n this.load.image(\"cloudyDaySky\", \"src/assets/tilesets/Day Far.png\");\n //load map from Json file\n this.load.tilemapTiledJSON(\"level1map\", \"src/assets/tilemaps/Level1.json\");\n\n //images for level two scene\n //images for level two Parallax backgrounds\n this.load.image(\n \"Level2Background\",\n \"src/assets/images/Level2/Level2Background.png\"\n );\n //load tileset images for layers\n this.load.image(\n \"greyTiles\",\n \"src/assets/tilesets/Gray_Tile_Terrain (16 x 16).png\"\n );\n this.load.image(\n \"scaffoldingTiles\",\n \"src/assets/tilesets/Scaffolding_and_BG_Parts (16 x 16).png\"\n );\n //load map from Json file\n this.load.tilemapTiledJSON(\"level2map\", \"src/assets/tilemaps/Level2.json\");\n\n //images for level three scene\n //images for level three Parallax backgrounds\n this.load.image(\"Level3Close\", \"src/assets/images/Level3/Level3Close.png\");\n this.load.image(\"Level3Far\", \"src/assets/images/Level3/Level3Far.png\");\n this.load.image(\"Level3Mid\", \"src/assets/images/Level3/Level3Mid.png\");\n this.load.image(\"Level3Moon\", \"src/assets/images/Level3/Level3Moon.png\");\n this.load.image(\"Level3Sky\", \"src/assets/images/Level3/Level3Sky.png\");\n this.load.image(\"darkLabTiles\", \"src/assets/tilesets/DarkLab.png\");\n this.load.image(\"closeNightSky\", \"src/assets/tilesets/Night Close.png\");\n this.load.image(\"farNightSky\", \"src/assets/tilesets/Night Far.png\");\n this.load.image(\"moonNightSky\", \"src/assets/tilesets/NightSky.png\");\n //load map from Json file\n this.load.tilemapTiledJSON(\"level3map\", \"src/assets/tilemaps/Level3.json\");\n\n //images for level four scene\n //images for level four Parallax backgrounds\n this.load.image(\n \"Level4Cloudcover\",\n \"src/assets/images/Level4/Level4Cloudcover.png\"\n );\n this.load.image(\n \"Level4Clouds\",\n \"src/assets/images/Level4/Level4Clouds.png\"\n );\n this.load.image(\n \"Level4Foreground\",\n \"src/assets/images/Level4/Level4Foreground.png\"\n );\n this.load.image(\"Level4Hills\", \"src/assets/images/Level4/Level4Hills.png\");\n this.load.image(\n \"Level4Preforeground\",\n \"src/assets/images/Level4/Level4Preforeground.png\"\n );\n this.load.image(\"Level4Sky\", \"src/assets/images/Level4/Level4Sky.png\");\n this.load.image(\n \"lightBrownTiles\",\n \"src/assets/tilesets/Terrain (16 x 16).png\"\n );\n this.load.image(\n \"fenceTiles\",\n \"src/assets/tilesets/Grassland_entities (16 x 16).png\"\n );\n this.load.image(\n \"foregroundTreeTiles\",\n \"src/assets/tilesets/1 - Foreground_scenery.png\"\n );\n this.load.image(\"greenHillTiles\", \"src/assets/tilesets/2 - Hills.png\");\n this.load.image(\n \"largeCloudTiles\",\n \"src/assets/tilesets/4 - Cloud_cover_2.png\"\n );\n this.load.image(\n \"smallCloudTiles\",\n \"src/assets/tilesets/3 - Cloud_cover_1.png\"\n );\n this.load.image(\"blueSkyTiles\", \"src/assets/tilesets/5 - Sky_color.png\");\n this.load.tilemapTiledJSON(\"level4map\", \"src/assets/tilemaps/Level4.json\");\n\n //Sound for Sprites\n this.load.audio(\"jump\", \"src/assets/audio/Jump.mp3\");\n this.load.audio(\"playerDeath\", \"src/assets/audio/Player Death.mp3\");\n this.load.audio(\"enemyDeath\", \"src/assets/audio/Enemy Death.mp3\");\n this.load.audio(\"fanfare\", \"src/assets/audio/Fanfare.mp3\");\n\n //Sound for Gems\n this.load.audio(\"gem\", \"src/assets/audio/Gem.mp3\");\n\n //Sound for title screen\n this.load.audio(\"start-menu\", \"src/assets/audio/Start Menu.mp3\");\n //Sound for Story screen\n this.load.audio(\"story\", \"src/assets/audio/Story.mp3\");\n //Sound for Transition screens\n this.load.audio(\"transition\", \"src/assets/audio/Transition.mp3\");\n //Sound for Game Over screen\n this.load.audio(\"gameOver\", \"src/assets/audio/Game Over.mp3\");\n //Sound for Game Win screen\n this.load.audio(\"gameWin\", \"src/assets/audio/Game Win.mp3\");\n //Sound for level 1\n this.load.audio(\"level1\", \"src/assets/audio/Level1.mp3\");\n //Sound for level 2\n this.load.audio(\"level2\", \"src/assets/audio/Level2.mp3\");\n //Sound for level 3\n this.load.audio(\"level3\", \"src/assets/audio/Level3.mp3\");\n //Sound for level 4\n this.load.audio(\"level4\", \"src/assets/audio/Level4.mp3\");\n }", "function loadAssetsAndCreateScenes() {\r\n\r\n function loadLensflaresSceneAssets() {\r\n var get1 = $.get( \"./glsl/simple.vert\", function( vert ) { LensflareVert = vert; });\r\n var get2 = $.get( \"./glsl/swimmingColors.frag\", function( frag ) { LensflareFrag = frag; });\r\n\r\n $.when( get1, get2).done( function() {\r\n createLensflaresScene();\r\n startInitialScene();\r\n var button = $(\"#me\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.Lensflares;\r\n ContentDiv.html( MeHTML);\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n\r\n button = $(\"#bsc\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.Lensflares;\r\n ContentDiv.html( BscHTML);\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n\r\n button = $(\"#msc\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.Lensflares;\r\n ContentDiv.html( MscHTML);\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n });\r\n }\r\n\r\n function loadLavalampSceneAssets() {\r\n var get1 = $.get( \"./glsl/perlinWobbly.vert\", function( vert ) { LavalampVert = vert; });\r\n var get2 = $.get( \"./glsl/perlinWobbly.frag\", function( frag ) { LavalampFrag = frag; });\r\n\r\n $.when( get1, get2).done( function() {\r\n createLavaLampScene();\r\n\r\n var button = $(\"#can\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.Lavalamp;\r\n ContentDiv.html(DoHTML);\r\n\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n });\r\n }\r\n\r\n function loadBuckminsterSceneAssets() {\r\n var cubeTextures = [\r\n './res/Vindelalven/posx.jpg',\r\n './res/Vindelalven/negx.jpg',\r\n './res/Vindelalven/posy.jpg',\r\n './res/Vindelalven/negy.jpg',\r\n './res/Vindelalven/posz.jpg',\r\n './res/Vindelalven/negz.jpg'\r\n ];\r\n\r\n BuckminsterCubemap = THREE.ImageUtils.loadTextureCube(cubeTextures);\r\n createBuckminsterScene();\r\n\r\n var button = $(\"#want\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.Buckminster;\r\n ContentDiv.html( WantHTML);\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n\r\n }\r\n\r\n function loadVogelkindSceneAssets() {\r\n var loader = new THREE.OBJLoader();\r\n loader.load(\r\n // resource URL\r\n \"./res/Vogelkind.obj\",\r\n // Function when resource is loaded\r\n function ( object ) {\r\n VogelkindVogel = object;\r\n createVogelkindScene();\r\n var button = $(\"#vita\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.Vogelkind;\r\n ContentDiv.html( VitaHTML);\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n }\r\n );\r\n }\r\n\r\n function loadSoapBubblesSceneAssets() {\r\n // TODO BUTTON FREISCHALTEN\r\n\r\n var cubeTextures = [\r\n './res/Vindelalven/posx.jpg',\r\n './res/Vindelalven/negx.jpg',\r\n './res/Vindelalven/posy.jpg',\r\n './res/Vindelalven/negy.jpg',\r\n './res/Vindelalven/posz.jpg',\r\n './res/Vindelalven/negz.jpg'\r\n ];\r\n\r\n SoapBubblesCubemap = THREE.ImageUtils.loadTextureCube(cubeTextures);\r\n createSoapBubblesScene();\r\n\r\n var button = $(\"#about\");\r\n button.click(function(){\r\n ENGINE.currentUpdateFunction = scenes.SoapBubbles;\r\n ContentDiv.html( AboutHTML);\r\n });\r\n button.removeClass(\"blocked_link\").addClass(\"active_link\");\r\n }\r\n\r\n loadLensflaresSceneAssets();\r\n loadLavalampSceneAssets();\r\n loadBuckminsterSceneAssets();\r\n loadVogelkindSceneAssets();\r\n loadSoapBubblesSceneAssets();\r\n}", "function assetsLoadedHandler ()\n{\n\tvar data = {\n\t\timages: [\"./assets/dot.png\"],\n\t\tframes: [\n\t\t\t// x, y, width, height, imageIndex*, regX*, regY*\n\t\t\t[0, 0, 128, 128, 0, 64, 64]\n\t\t],\n\t\tanimations: {\n\t\t\tdot: 0\n\t\t}\n\t};\n\n\tspriteSheet = new createjs.SpriteSheet (data);\n\n\tcreateBeams ();\n}", "function loadComplete(event) {\n console.log(\"Finished Loading Assets\");\n\n stage.addChild(background);\n stage.update();\n initGraphics();\n}", "function loadAssets(callback){\n\n // This function will load the sprite images\n function loadSprite(filename){\n asseetsStillLoading ++; \n\n let spriteImage = new Image();\n spriteImage.src = \"assets/sprites/\" + filename;\n\n // This is event handler and once the image has fully loaded, the function inside it will execute\n spriteImage.onload = function(){\n asseetsStillLoading --;\n }\n\n return spriteImage;\n }\n\n function loadSound(sound, loop){\n return new Sound(\"assets/sounds/\" + sound, loop);\n }\n\n sprites.background = loadSprite(\"board.png\");\n sprites.hand = loadSprite(\"hand2.png\"); \n sprites.blueBall = loadSprite(\"pointer.png\");\n sprites.queen = loadSprite(\"queen.png\");\n sprites.yellowBall = loadSprite(\"yellow.png\");\n sprites.blackBall = loadSprite(\"black.png\");\n sprites.gameOver = loadSprite(\"gameOver.png\");\n sprites.continue = loadSprite(\"continue.png\");\n sprites.winner = loadSprite(\"finalScore.png\");\n \n sounds.collide = loadSound(\"BallsCollide\");\n sounds.pocket = loadSound(\"pocket\");\n sounds.side = loadSound(\"Side\");\n\n assetsLoadingLoop(callback);\n}", "incrementLoadedAssets () {\n this._loadedAssets += 1;\n }", "static initialize() {\n // HTML からステージの元となる要素を取得し、大きさを設定する\n const stageElement = document.getElementById(\"stage\");\n stageElement.style.width = Config.puyoImgWidth * Config.stageCols + 'px';\n stageElement.style.height = Config.puyoImgHeight * Config.stageRows + 'px';\n stageElement.style.backgroundColor = Config.stageBackgroundColor;\n this.stageElement = stageElement;\n\n const zenkeshiImage = document.getElementById(\"zenkeshi\");\n zenkeshiImage.width = Config.puyoImgWidth * 6;\n zenkeshiImage.style.position = 'absolute';\n zenkeshiImage.style.display = 'none';\n this.zenkeshiImage = zenkeshiImage;\n stageElement.appendChild(zenkeshiImage);\n const scoreElement = document.getElementById(\"score\");\n scoreElement.style.backgroundColor = Config.scoreBackgroundColor;\n scoreElement.style.top = Config.puyoImgHeight * Config.stageRows + 'px';\n scoreElement.style.width = Config.puyoImgWidth * Config.stageCols + 'px';\n scoreElement.style.height = Config.fontHeight + \"px\";\n this.scoreElement = scoreElement;\n // メモリを準備する\n this.board = [\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n ];\n let puyoCount = 0;\n for(let y = 0; y < Config.stageRows; y++) {\n const line = this.board[y] || (this.board[y] = []);\n\n for(let x = 0; x < Config.stageCols; x++) {\n const puyo = line[x];\n if(puyo >= 1 && puyo <= 5) {\n // line[x] = {puyo: puyo, element: this.setPuyo(x, y, puyo)};\n this.setPuyo(x, y, puyo);\n puyoCount++;\n } else {\n line[x] = null;\n }\n }\n }\n this.puyoCount = puyoCount;\n }", "addAsset(assetConfig) {\n const asset = new resources_1.Asset({\n input: slash_1.default(assetConfig.input),\n output: slash_1.default(assetConfig.output)\n });\n this.assets.push(asset);\n return asset;\n }", "function AssetManager()\n{\n var assets = [];\n var selectedAssets = [];\n\n var createAssetAction;\n\n this.CreateAsset = function (assetType, asset, notPhysical)\n {\n window.scene.add(asset);\n\n if (!notPhysical)\n {\n asset.userData.isAsset = true;\n collidableMeshList.push(asset);\n }\n\n asset.name = assetType + \" \" + asset.id;\n\n if (!createAssetAction)\n {\n createAssetAction = new CreateAction();\n createAssetAction.Initialize(asset);\n\n actionManager.ActionPerformed(createAssetAction);\n\n createAssetAction = null;\n }\n\n\n assets.push(asset);\n\n Efficio.MessagingSystem.Bus.publish({\n channel: 'Asset',\n topic: 'Create',\n source: \"Charet\",\n data: {\n asset: asset,\n physics: !notPhysical\n }\n });\n }\n\n this.GetAssets = function ()\n {\n return assets;\n }\n\n this.UpdateAsset = function (asset)\n {\n var sceneAsset = scene.getObjectById(asset.name);\n\n sceneAsset.position.copy(asset.position);\n }\n\n this.SelectAsset = function (asset)\n {\n asset.AddHandlesToAsset();\n asset.ChangeAssetColorSelected();\n\n selectedAssets.push(asset);\n }\n\n this.SelectAllAssets = function ()\n {\n for (var asset in assets)\n {\n this.SelectAsset(asset);\n }\n }\n\n this.GetSelectedAssets = function ()\n {\n return selectedAssets;\n }\n\n this.IsSelectedAsset = function (asset)\n {\n for (var i = 0; i < selectedAssets.length; i++)\n {\n if (asset.name === selectedAssets[i].name)\n {\n return true;\n }\n }\n\n return false;\n }\n\n this.DeselectAsset = function (asset)\n {\n for (var i = 0; i < selectedAssets.length; i++)\n {\n if (asset.name === selectedAssets[i].name)\n {\n selectedAssets[i].RemoveHandlesFromAsset();\n selectedAssets[i].ChangeAssetColorDeselected();\n selectedAssets.splice(i, 1);\n }\n }\n }\n\n this.DeselectAllAssets = function ()\n {\n for (var asset in this.GetSelectedAssets())\n {\n asset.RemoveHandlesFromAsset();\n asset.ChangeAssetColorDeselected();\n }\n\n selectedAssets = [];\n } \n\n var updateBoundingBoxesOfSelectedAssets = function (frame)\n {\n var selectedAssets = assetManager.GetSelectedAssets();\n\n for (var i = 0; i < selectedAssets.length; i++)\n {\n if (selectedAssets[i].hasBeenMoved)\n {\n selectedAssets[i].geometry.computeBoundingBox();\n }\n }\n }\n\n frameActions.RegisterAction(\"UpdateBoundingBoxesOfSelectedAssets\", updateBoundingBoxesOfSelectedAssets);\n}", "function loadAssets () {\n game.load.image(\"Tesla\", \"assets/sprites/tesla2.png\");\n game.load.image(\"Barrier\", \"assets/sprites/barrier.png\");\n game.load.image(\"Cloud\", \"assets/sprites/cloud.png\");\n game.load.audio(\"meow1\", [\"assets/sounds/meow1.mp3\", \"assets/sounds/meow1.ogg\"]);\n game.load.audio(\"meow2\", [\"assets/sounds/meow2.mp3\", \"assets/sounds/meow2.ogg\"]);\n game.load.audio(\"meow3\", [\"assets/sounds/meow3.mp3\", \"assets/sounds/meow3.ogg\"]);\n game.load.audio(\"meow4\", [\"assets/sounds/meow4.mp3\", \"assets/sounds/meow4.ogg\"]);\n game.load.audio(\"meow5\", [\"assets/sounds/meow5.mp3\", \"assets/sounds/meow5.ogg\"]);\n game.load.audio(\"meow6\", [\"assets/sounds/meow6.mp3\", \"assets/sounds/meow6.ogg\"]);\n game.load.audio(\"flap\", [\"assets/sounds/Jump9.mp3\", \"assets/sounds/Jump9.ogg\"]);\n game.load.audio(\"hit\", [\"assets/sounds/Hit_Hurt2.mp3\", \"assets/sounds/Hit_Hurt2.ogg\"]);\n game.load.bitmapFont(\"font\", \"assets/fonts/font.png\", \"assets/fonts/font.fnt\");\n}", "function preload() {\n //level one, acorns to collet\n nbHeart.image = loadImage(\"assets/images/NB_heart.png\");\n supportToken.image = loadImage(\"assets/images/supportToken.png\");\n supportToken2.image = loadImage(\"assets/images/supportToken2.png\");\n\n for (let i = 0; i < 11; i++) {\n agroImages[i] = loadImage(`assets/images/agro-${i}.png`);\n }\n}", "preload() {\n const images = Object.keys(ASSET.IMAGE).map(\n (imgKey) => ASSET.IMAGE[imgKey]\n );\n for (let image of images) {\n this.load.image(image.KEY, image.ASSET);\n }\n }", "function Asset(name, imgPath) {\n this.name = name;\n this.imgPath = imgPath;\n this.votes = 0;\n this.timesShown = 0;\n\n // you might not see this in production code depending on where you work but it is a handy way of getting every goat into the allGoat array every time you make one\n Asset.allAssets.push(this)\n}", "prepareScoring() {\n let plants = [], plantModels = {};\n for (const id in this.imagesMapping) {\n const plantView = this.imagesMapping[id];\n const plant = plantView.getPlant();\n plants.push(plantView.toJSON());\n if (!(plant.id in plantModels)) {\n plantModels[plant.id] = plant;\n }\n }\n const scoreInput = new ScoreInput(plants, plantModels, {\n sizeMeter: this.grid.sizeMeter\n });\n // Call score process by dispatching save event with plants data\n this.actionDispatcher.dispatch({type: actions.SCORE, data: {\n input: scoreInput,\n }});\n }", "function loadAssets() {\n\thasLoaded = false;\n\tgame.load.onLoadComplete.add(loadComplete, this);\n\n\t// Load enemies defined for this level\n\tfor (const enemy of enemyChoices) {\n\t\tgame.load.image(enemy, getEnemySprite(enemy));\n\t}\n\n\tgame.load.start();\n}", "function updateScoreboard() {\n scoreboardGroup.clear(true, true);\n\n const scoreAsString = score.toString();\n if (scoreAsString.length === 1) {\n scoreboardGroup.create(assets.scene.width, 30, assets.scoreboard.base + score).setDepth(10);\n } else {\n let initialPosition = assets.scene.width - ((score.toString().length * assets.scoreboard.width) / 2);\n\n for (let i = 0; i < scoreAsString.length; i++) {\n scoreboardGroup.create(initialPosition, 30, assets.scoreboard.base + scoreAsString[i]).setDepth(10);\n initialPosition += assets.scoreboard.width;\n }\n }\n}", "function preload() {\n\n\n //LoadSounds();\n //LoadAssets();\n \n\n}", "set assetNames(value) {}", "_onAddAsset(asset) {\n // remove from waiting list\n var index = this._waitingAssets.indexOf(asset);\n if (index >= 0) {\n this._waitingAssets.splice(index, 1);\n }\n\n this._assets.push(asset);\n var i;\n var l = this._assets.length;\n for (i = 0; i < l; i++) {\n asset = this._assets[i];\n\n if (!asset.loading && !asset.loaded) {\n this._registry.load(asset);\n }\n }\n }", "function add_assets(input_txt){\n input_txt = input_txt.replace(/\\r?\\n/g,\"<br>\");\n var b_color = get_random_bg_color();\n var count = $('#contents').find('.draggable').length;\n $('.none-asset').css('display', 'none');\n $('.palette').append('<div class=\"draggable '+b_color+' ui-draggable circle asset-'+(count+=1)+'\">'+input_txt+'</div>');\n do_draggable();\n}", "function onAssetsLoaded()\r\n{\r\n // create an array of textures from an image path\r\n // var frames = [];\r\n//32\r\n for (var i = 0; i < 48; i++) {\r\n var val = i < 10 ? '0' + i : i;\r\n\r\n // magically works since the spritesheet was loaded with the pixi loader\r\n var temptext = PIXI.Texture.fromFrame('playerOne00' + val + '.png')\r\n playerText.push(temptext);\r\n // pt = PIXI.Texture.fromFrame('playerOne0000.png');\r\n // playerText.push(PIXI.Texture.fromFrame('playerOne0001.png'));\r\n\r\n }\r\n\r\n // movie = new PIXI.extras.MovieClip(playerText);\r\n // movie.animationSpeed = 0.11;\r\n\r\n // movie.play();\r\n\r\n\r\n\r\n // animate();\r\n}", "function preload() {\n //fatcat_sprite_sheet = loadSpriteSheet('images/fatcat.png', 123, 112, 8);\n //hitcat_sprite_sheet = loadSpriteSheet('images/hitcat.png', 124, 116, 10);\n \n fatcat = loadImage(\"images/fatcat.png\");\n hitcat = loadImage(\"images/hitcat.png\");\n yarn = loadImage(\"images/yarn.png\");\n \n}", "function onAllAssetsLoaded()\n{\n\n console.log(\"assets loaded\");\n initUI();\n /* Initialise the canvas and associated variables */\n /* This code never changes */\n canvas = document.getElementById(\"gameCanvas\");\n ctx = canvas.getContext(\"2d\");\n // canvas.width = canvas.clientWidth;\n // canvas.height = canvas.clientHeight;\n console.log({canvas: window.screen});\n // canvas.width = canvas.offsetWidth;\n // canvas.height = canvas.offsetHeight;\n\n var windowWidth = window.innerWidth;\nvar windowHeight = window.innerHeight;\n// var pixelRatio = window.devicePixelRatio || 1; /// get pixel ratio of device\n\n\ncanvas.width = windowWidth ; /// resolution of canvas\ncanvas.height = windowHeight ;\n\n playGame(); // Each game will include its own .js file, which will hold the game's palyGame() function\n}", "function assetsLoaded() {\n if (canonImage2Loaded == true && canonImageLoaded == true && torreImageLoaded == true && bombaImageLoaded == true && bombaImage2Loaded == true && fondoImageLoaded == true) {\n update();\n }\n}", "function preload() {\n //images\n intro1BgImg = loadImage('assets/images/stage1.jpg');\n intro2BgImg = loadImage('assets/images/stage2.jpg');\n gameOverBgImg = loadImage('assets/images/gameOverImg.jpg');\n gameWonBgImg = loadImage('assets/images/gameWonImg.jpg');\n backgroundImage = loadImage('assets/images/backgroundImg.jpg');\n planetAmazonImg = loadImage('assets/images/planetAmazon.png');\n crosshairs = loadImage('assets/images/crosshairs.png');\n cockpit = loadImage('assets/images/cockpit.png');\n enemyImage[0] = loadImage('assets/images/drone0Damage.png');\n enemyImage[1] = loadImage('assets/images/drone1Damage.png');\n bossImage[0] = loadImage('assets/images/boss0damage.png');\n bossImage[1] = loadImage('assets/images/boss0damage.png');\n bossImage[2] = loadImage('assets/images/boss0damage.png');\n bossImage[3] = loadImage('assets/images/boss0damage.png');\n bossImage[4] = loadImage('assets/images/boss1damage.png');\n bossImage[5] = loadImage('assets/images/boss1damage.png');\n bossImage[6] = loadImage('assets/images/boss1damage.png');\n bossImage[7] = loadImage('assets/images/boss1damage.png');\n bossImage[8] = loadImage('assets/images/boss2damage.png');\n bossImage[9] = loadImage('assets/images/boss2damage.png');\n bossImage[10] = loadImage('assets/images/boss2damage.png');\n bossImage[11] = loadImage('assets/images/boss2damage.png');\n bossBulletImg[0] = loadImage('assets/images/bossBullet0.png');\n bossBulletImg[1] = loadImage('assets/images/bossBullet1.png');\n bossBulletImg[2] = loadImage('assets/images/bossBullet2.png');\n explosionGif = loadImage('assets/images/explosion.gif');\n\n //sounds\n ambience = loadSound('assets/sounds/ambience.mp3');\n ambience.playMode('untilDone');\n\n siren = loadSound('assets/sounds/siren.mp3');\n siren.playMode('untilDone');\n siren.setVolume(.1);\n\n lowCharge = loadSound('assets/sounds/lowCharge.mp3');\n lowCharge.playMode('untilDone');\n lowCharge.setVolume(.2);\n\n laserCharging = loadSound('assets/sounds/laserCharging.mp3');\n laserCharging.playMode('untilDone');\n laserCharging.setVolume(2);\n\n laserBlast = loadSound('assets/sounds/laserBlast.wav');\n laserBlast.setVolume(.2);\n\n firstHit = loadSound('assets/sounds/firstHit.wav');\n firstHit.setVolume(.7);\n\n secondHit = loadSound('assets/sounds/secondHit.wav');\n secondHit.setVolume(.4);\n\n crash = loadSound('assets/sounds/crash.wav');\n\n gameWonSong = loadSound('assets/sounds/gameWonSong.mp3');\n gameWonSong.playMode('untilDone');\n\n bossHello = loadSound('assets/sounds/bossHello.wav');\n bossHello.playMode('untilDone');\n bossHello.setVolume(2);\n\n evilLaugh = loadSound('assets/sounds/evilLaugh.wav');\n evilLaugh.playMode('untilDone');\n\n bossDeath = loadSound('assets/sounds/bossDeath.wav');\n bossDeath.playMode('untilDone');\n bossDeath.setVolume(2);\n\n gameOverBells = loadSound('assets/sounds/gameOverBells.mp3');\n gameOverBells.playMode('untilDone')\n}", "function loadAssets(event)\r\n{\r\n\tfor (var i = 0; i < buttons.length; i++)\r\n\t{\r\n\t\tvar tempBtn = new Image();\r\n\t\ttempBtn.src = buttons[i].img;\r\n\t\ttempBtn.addEventListener(\"load\", onAssetLoad);\r\n\t\tbuttons[i].img = tempBtn; // .img used to hold the path string, now it holds the actual image object.\r\n\t\tvar tempBtnO = new Image();\r\n\t\ttempBtnO.src = buttons[i].imgO;\r\n\t\ttempBtnO.addEventListener(\"load\", onAssetLoad);\r\n\t\tbuttons[i].imgO = tempBtnO;\r\n\t}\r\n}", "saveGraph(editor) {\n var vertexes = [];\n var cells = editor.graph.getModel().cells \n\n for (var id in cells) {\n let cell = cells[id] \n\n // parent nodes and shots\n if (cell.value === undefined || cell.value === null) {\n\n }\n\n else if (!cell.value.startsWith(\"Shot\")) {\n var template = document.createElement('template');\n var value = cell.value.trim()\n template.innerHTML = value;\n value = template.content.firstChild;\n\n var title = value.getElementsByTagName(\"h4\")[0].innerHTML\n var name = value.getElementsByTagName(\"h3\")[0].innerHTML\n var artists = value.getElementsByTagName(\"h5\")[0].dataset.artist\n \n\n var flag = false\n var DBasset\n var cellID = parseInt(cell.id, 10)\n this.props.project.assets.map(asset => {\n\n if (asset.id === cellID) {\n\n flag = true\n DBasset = asset\n }\n return \"\"\n })\n //already added in DB\n if (flag) {\n DBasset.name = name\n DBasset.typeOf = title\n DBasset.artists = artists\n vertexes.push(DBasset)\n //add new asset in DB\n } else {\n let asset = {\n id: parseInt(cell.id, 10),\n name: name,\n typeOf: title,\n desc: \"\",\n comments: [],\n artists: artists,\n supervisor: this.props.project.supervisor,\n status: \"notstarted\",\n versions: []\n\n }\n\n vertexes.push(asset)\n }\n\n }\n\n }\n\n \n\n this.setState({\n assets: vertexes\n })\n var assets = vertexes\n \n\n var encoder = new mxCodec();\n var node = encoder.encode(editor.graph.getModel());\n var assetsXML = mxUtils.getPrettyXml(node) \n\n\n\n //update on server\n this.props.updateGraphAssetsOnServer(assetsXML, assets)\n\n this.setState({\n changed: false\n })\n }", "function saveImageManifest() {\n // checks to see if data from all teams have been collected\n if (loaded_images_from_tba == teams.length) {\n fs.writeFileSync(\"data/images/manifest.json\", JSON.stringify(manifest_images));\n // reloads the page afterwards\n window.location.reload();\n }\n}", "function preload() {\n managers.Assets.init();\n //after assets loaded, invoke init function\n managers.Assets.loader.addEventListener(\"complete\", init);\n}", "function initialize(stage, assets, gameInfo) {\n\n\t// Note that the background is provided as part of the assets.\n\tGameLibs.GameUI.changeBackground(assets.background);\n}", "function assetsLoaded()\n{\n APP.isAssetsLoaded = true;\n // once we finished preloading \n console.log(\"Loaded assets.\");\n\n if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))\n USING_PHONE = true;\n\n HUD.onAssetsLoaded();\n\n //CAMERA.setTargetPosition(50 * 256, 50 * 256);\n CAMERA.setPosition(50 * -256 + (window.innerWidth / 2), 50 * -256 - (window.innerHeight / 2));\n\n CAMERA.interruptedCameraPathing = true;\n\n ticker.maxFPS = 144;\n // render loop\n ticker.add((delta) => \n {\n\n APP.elapsedTime += ticker.elapsedMS;\n\n CAMERA.update();\n HUD.update();\n \n devContainer.visible = DEVELOPER_MODE;\n \n renderer.render(stage);\n })\n\n ConnectToBackend();\n ticker.start();\n \n document.body.appendChild(APP.view);\n}", "function setupManifest() {\n manifest = [\n {\n src: \"images/background.png\",\n id: \"background\"\n },\n {\n src: \"images/treaties/1.png\",\n id: \"treaty_1\"\n },\n {\n src: \"images/treaties/2.png\",\n id: \"treaty_2\"\n },\n {\n src: \"images/treaties/3.png\",\n id: \"treaty_3\"\n },\n {\n src: \"images/treaties/4.png\",\n id: \"treaty_4\"\n },\n {\n src: \"images/treaties/5.png\",\n id: \"treaty_5\"\n },\n {\n src: \"images/treaties/6.png\",\n id: \"treaty_6\"\n },\n {\n src: \"images/treaties/7.png\",\n id: \"treaty_7\"\n },\n {\n src: \"images/treaties/8.png\",\n id: \"treaty_8\"\n },\n {\n src: \"images/treaties/9.png\",\n id: \"treaty_9\"\n },\n {\n src: \"images/treaties/10.png\",\n id: \"treaty_10\"\n },\n {\n src: \"images/treaties/11.png\",\n id: \"treaty_11\"\n },\n {\n src: \"images/treaties/douglas.png\",\n id: \"treaty_douglas\"\n },\n {\n src: \"images/treaties/peace.png\",\n id: \"treaty_peace\"\n },\n {\n src: \"images/treaties/robinson.png\",\n id: \"treaty_robinson\"\n },\n {\n src: \"images/treaties/upper.png\",\n id: \"treaty_upper\"\n },\n {\n src: \"images/treaties/williams.png\",\n id: \"treaty_williams\"\n },\n {\n src: \"images/panel.png\",\n id: \"panel\"\n }\n ];\n}", "preload() {\n // this.load.image('kraken', './assets/kraken.png');\n // Loop through monster configuration and load each image\n for (let i = 0; i < MONSTERS.length; i++) {\n this.load.image(MONSTERS[i].name, `./assets/${MONSTERS[i].image}`);\n }\n this.load.image('bolt', './assets/bolt.png');\n this.load.image('door', './assets/door.png');\n // Load sound effects\n this.load.audio('hit', './assets/hit_001.wav');\n }", "function createAssets(){\n assets = [];\n assets.push(path.join(__dirname, '../plug/pip_resolve.py'));\n assets.push(path.join(__dirname, '../plug/distPackage.py'));\n assets.push(path.join(__dirname, '../plug/package.py'));\n assets.push(path.join(__dirname, '../plug/reqPackage.py'));\n assets.push(path.join(__dirname, '../plug/utils.py'));\n\n assets.push(path.join(__dirname, '../plug/requirements/fragment.py'));\n assets.push(path.join(__dirname, '../plug/requirements/parser.py'));\n assets.push(path.join(__dirname, '../plug/requirements/requirement.py'));\n assets.push(path.join(__dirname, '../plug/requirements/vcs.py'));\n assets.push(path.join(__dirname, '../plug/requirements/__init__.py'));\n\n return assets;\n}", "function loadAssets(callback) {\n // Increase number of assets loading\n function loadSprite(fileName) {\n assetsStillLoading++;\n\n let spriteImage = new Image();\n spriteImage.src = \"./assets/sprites/\" + fileName;\n // Once image is done loading, Decease number of assets loading\n spriteImage.onload = function() {\n assetsStillLoading--;\n }\n\n return spriteImage;\n }\n sprites.background = loadSprite('spr_background5.png');\n sprites.stick = loadSprite('spr_stick.png');\n sprites.whiteBall = loadSprite('spr_ball2.png');\n sprites.redBall = loadSprite('spr_redBall2.png');\n sprites.yellowBall = loadSprite('spr_yellowBall2.png');\n sprites.blackBall = loadSprite('spr_blackBall2.png');\n\n assetsLoadingLoop(callback);\n}", "function doneLoading(e)\n{\n // Create all sprite sheets\n createPlayerSheet();\n createEnemySheet();\n createBackgroundSheet()\n createTileSheet();\n createWaveSheet();\n createDoorSheet();\n createBulletSheet();\n\n // Place the background\n for(let i = 0; i < 8; i++)\n {\n createBackground(i * 600, 0);\n }\n\n // Load in the level\n loadLevel();\n\n\n\n // Start the game loop\n app.ticker.add(gameLoop);\n \n}", "function makeScoreAssetsWorldReadable() {\n // TODO(janakr): Consider sharing cache with list_ee_assets.js. Not trivial\n // because that code does additional EE requests to look at geometries, so\n // we would need a two-level cache, one raw and one with geometries.\n listEeAssets(eeLegacyPathPrefix + getDisaster()).then((listedAssets) => {\n if (!listedAssets) {\n return;\n }\n const paths = new Set([getScoreAssetPath(), getBackupScoreAssetPath()]);\n const numAssets = paths.size;\n let foundAssets = 0;\n for (const {id} of listedAssets) {\n if (paths.has(id)) {\n foundAssets++;\n ee.data.getIamPolicy(eeLegacyPrefix + id, () => {}).then((policy) => {\n for (const binding of policy.bindings) {\n // Only want to modify 'reader' permissions.\n if (binding.role === 'roles/viewer') {\n if (!binding.members.includes('allUsers')) {\n binding.members.push('allUsers');\n ee.data.setIamPolicy(eeLegacyPrefix + id, policy, () => {});\n }\n return;\n }\n }\n // TODO(janakr): Do better. See what EE says.\n // If we got here, no roles/viewer binding. Use some Javascript magic.\n const BindingConstructor = policy.bindings[0].constructor;\n policy.bindings.push(new BindingConstructor(allReadBinding));\n ee.data.setIamPolicy(eeLegacyPrefix + id, policy, () => {});\n });\n }\n if (foundAssets === numAssets) {\n return;\n }\n }\n });\n}", "function preload() {\n images[0] = loadImage('assets/up.png');\n images[1] = loadImage('assets/down.png');\n\n \n clickablesManager = new ClickableManager('data/clickableLayout.csv');\n content = new Content_Man('data/Content.csv');\n adventureManager = new AdventureManager(\"data/adventureStates.csv\", \"data/interactionTable.csv\");\n}", "function preload() {\n \n var moviePath;\n \n selectedMovie = options[getRandomInt(0, 4)];\n \n moviePath = \"assets/collections/90s/Movie/\" + selectedMovie + \".jpg\";\n \n game.load.image('Movie', moviePath);\n \n game.load.image('greenBlock', 'assets/images/block1.png');\n game.load.image('blueBlock', 'assets/images/block2.png');\n \n game.load.image('Button', 'assets/images/Button2.png');\n \n}", "function preload() {\n\n//preload = called once at the very beginning it uploads resources e.g images and sounds\n // resources can be given a name here\n\n game.load.image(\"playerImg\", \"../assets/kitten.png\");\n // this loads the image into the program\n game.load.audio(\"score\", \"../assets/point.ogg\");\n\n game.load.image(\"pipe\", \"../assets/pipe.png\");\n\n game.load.image(\"pipeEnd\", \"../assets/pipe-end.png\");\n\n game.load.image(\"yarn\", \"../assets/yarn1.png\");\n //game.load.image(\"\" , \"../assets/png\");\n}", "function setup() {\n createCanvas(1280, 720);\n\n // setting up class for scorecard function\n stressCard = new scoreCard();\n\n // setup the clickables = this will allocate the array\n clickables = clickablesManager.setup();\n\n \n // based on the state name in the clickableLayout\n adventureManager.setClickableManager(clickablesManager);\n\n // This will load the images, go through state and interation tables, etc\n adventureManager.setup();\n\n // load all text screens\n loadAllText();\n\n // call OUR function to setup additional information about the p5.clickables\n setupClickables(); \n\n fs = fullscreen();\n}", "function addShipImage(playerObj){\r\n if(colorblind){\r\n playerObj.img.src = \"all assets/colorblind/ship/spaceship.png\";\r\n }\r\n else{\r\n playerObj.img.src = \"all assets/normal/ship/spaceship.png\";\r\n }\r\n}", "function preload() {\n println(\"loading images\")\n img = [loadImage(\"./assets/AmericaFirst.png\"), loadImage(\"./assets/AuditTheVote.png\"), loadImage(\"./assets/Hillary.png\"), loadImage(\"./assets/MAGA.png\"), loadImage(\"./assets/TrumpTrain.png\")];\n\n}", "function create_ruleset(){\n active = true;\n stage = 1;\n banner();\n}", "LoadAsset() {}", "function preload() {\n stage = new createjs.Stage(document.getElementById(\"canvas\"));\n progressText.x = 300 - progressText.getMeasuredWidth() / 2;\n progressText.y = 20;\n stage.addChild(progressText);\n stage.update();\n queue = new createjs.LoadQueue();\n queue.on(\"progress\", handleFileProgress);\n queue.installPlugin(createjs.Sound);\n queue.addEventListener(\"complete\", init);\n\n queue.loadManifest([\n //{ id: \"elf\", src: \"images/elf.gif\" },\n { id: \"spriteSheet\", src: \"images/sprite.png\" },\n { id: \"forest\", src: \"images/background.png\" },\n { id: \"bush\", src: \"images/bush1.png\" },\n //{ id: \"bunny\", src: \"images/bunny.gif\" },\n { id: \"apple\", src: \"images/apple.png\" },\n { id: \"clouds\", src: \"images/clouds.png\" },\n { id: \"arrow\", src: \"images/arrow.png\" },\n { id: \"mainScreen\", src: \"images/mainscreen.png\" },\n { id: \"playButton\", src: \"images/playButton.png\" },\n { id: \"playAgainButton\", src: \"images/playAgain.png\" },\n { id: \"instructions\", src: \"images/instructions.png\" },\n { id: \"instructionButton\", src: \"images/instructionButton.png\" },\n { id: \"yay\", src: \"images/gameover.png\" },\n { id: \"gameover\", src: \"images/gameoverscreen.png\" },\n { id: \"heart\", src: \"images/heart.png\" },\n //sounds\n { id: \"main\", src: \"sounds/piano.mp3\" },\n { id: \"bell\", src: \"sounds/bell.mp3\" },\n { id: \"appleCrunch\", src: \"sounds/apple.mp3\" },\n { id: \"leafHit\", src: \"sounds/leafHit.mp3\" },\n { id: \"arrowHit\", src: \"sounds/leather.mp3\" },\n { id: \"thud\", src: \"sounds/thud.mp3\" }\n ]);\n queue.addEventListener(\"complete\", handleComplete);\n this.atlas = new createjs.SpriteSheet(this.spriteSheetData);\n}", "function loadImages(image, name, xPos, yPos, cursor, rot, container,scale){\n var _bitmap = new createjs.Bitmap(image).set({});\n if (name == 'grating_table' || name == 'vernier_table') {\n \n _bitmap.regX = _bitmap.image.width/2;\n _bitmap.regY = _bitmap.image.height/2;\n \n }\n _bitmap.x = xPos;\n _bitmap.y = yPos;\n _bitmap.scaleX=_bitmap.scaleY=scale;\n _bitmap.name = name;\n _bitmap.alpha = 1;\n _bitmap.rotation = rot; \n _bitmap.cursor = cursor; \n container.addChild(_bitmap); /** Adding bitmap to the container */ \n stage.update();\n}", "function preload() {\n mural = loadImage(\"assets/images/mural.png\");\n fontGame = loadFont(\"assets/fonts/cabin.ttf\");\n mushroomImage = loadImage(\"assets/images/mushroom.png\");\n ambianceSFX = loadSound(\"assets/sounds/ambiance.wav\");\n\n\n imageArray = [\n loadImage(\"assets/images/muscle.png\"),\n loadImage(\"assets/images/heart.png\"),\n loadImage(\"assets/images/banana.png\"),\n loadImage(\"assets/images/arch.png\"),\n loadImage(\"assets/images/crystal.png\"),\n loadImage(\"assets/images/david.png\"),\n loadImage(\"assets/images/diva.png\"),\n loadImage(\"assets/images/fuck.png\"),\n loadImage(\"assets/images/mercury.png\"),\n loadImage(\"assets/images/sun.png\"),\n loadImage(\"assets/images/tilt.png\"),\n loadImage(\"assets/images/bolt.png\"),\n loadImage(\"assets/images/steve.png\"),\n loadImage(\"assets/images/clown.png\"),\n loadImage(\"assets/images/astroboy.png\"),\n loadImage(\"assets/images/atlas.png\"),\n loadImage(\"assets/images/keith.png\"),\n ]\n}", "function Start(){\n\tvar team0 = new JRTSResourceData();\n\tteam0.teamid = 0;\n\tteam0.metals = 1000;\n\tteam0.crystals = 1000;\n\tteam0.fuels = 1000;\n\tteam0.credits = 1000;\n\tteamresource.Add(team0);\t\n\t\n\tvar team1 = new JRTSResourceData();\n\tteam1.teamid = 1;\n\tteamresource.Add(team1);\n\tCheckstorageMaxTeams();\n}", "preloadAssets()\n {\n // Create our manifest of files to load\n // PreloadJS will try to automatically parse what kind of file we're loading \n // We can consider making a seperate JSON file that has all of this info in it\n manifest = [\n\t\t\t{\n src: \"leave_these_alone/audio.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/utils.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/ui/screen.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/ui/ui.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/ui/endscreen.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/ui/gamescreen.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/ui/helpscreen.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/ui/mainmenu.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/gameobjects/actor.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/gameobjects/bullet.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/gameobjects/enemy.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/gameobjects/pickups.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/effects/particle.js\",\n },\n\t\t\t{\n src: \"leave_these_alone/effects/effects.js\",\n },\n \n ];\n\n\t\t// Add user defined assets to the manifest\n\t\tmanifest = manifest.concat(mediaManifest);\n\n // Set the root filepath for our assets\n this.queue = new createjs.LoadQueue(true);\n \n // Use the following to use 'mp3' if 'ogg' doesn't work on browser\n createjs.Sound.alternateExtensions = [\"mp3\"];\n\n // Be sure to install the createjs sound plugin or your sounds won't play\n this.queue.installPlugin(createjs.Sound);\n \n // Set some callbacks\n this.queue.on(\"progress\", this.loadProgress, this);\n this.queue.on(\"fileload\", this.fileLoaded, this);\n this.queue.on(\"complete\", this.loadComplete, this);\n this.queue.loadManifest(manifest);\n }", "function populate() {\n Odyssey.View.SpriteIndex.populateResourceManager(spriteIndex, view.getResourceManager());\n }", "function preload() {\n trump = new Trump();\n trump.preloadAssets(); // Preload all image assets.\n}", "preload() {\n\n // get game width and height\n let gw = this.sys.game.config.width;\n let gh = this.sys.game.config.height;\n\n // load fonts (using the web font file loader)\n this.load.addFile(new WebFontFile(this.load, ['VT323']));\n\n // show logo\n let logo = this.add.image(gw/2, gh / 2, 'logo').setScale(5, 5); // logo is already preloaded in 'Boot' scene\n\n // text\n this.add.text(gw/2, gh * 0.20, 'CLOWNGAMING', {fontSize: '70px', color: '#FFFF00', fontStyle: 'bold'}).setOrigin(0.5);\n this.add.text(gw/2, gh * 0.73, 'Loading', {fontSize: '30px', color: '#4888b7'}).setOrigin(0.5);\n\n // progress bar background\n let bgBar = this.add.graphics();\n let barW = gw * 0.3; // progress bar width\n let barH = barW * 0.1; // progress bar height\n let barX = gw / 2 - barW / 2; // progress bar x coordinate (origin is 0, 0)\n let barY = gh * 0.8 - barH / 2; // progress bar y coordinate (origin is 0, 0)\n bgBar.setPosition(barX, barY);\n bgBar.fillStyle(0x4888b7, 1);\n bgBar.fillRect(0, 0, barW, barH); // position is 0, 0 as it was already set with \".setPosition()\"\n\n // progress bar\n let progressBar = this.add.graphics();\n progressBar.setPosition(barX, barY);\n\n // listen to the 'progress' event (fires every time an asset is loaded and 'value' is the relative progress from 0 (nothing loaded) to 1 (fully loaded))\n this.load.on('progress', function(value) {\n\n // clearing progress bar (to draw it again)\n progressBar.clear();\n\n // set style\n progressBar.fillStyle(0x8cefb6, 1);\n\n // draw rectangle\n progressBar.fillRect(0, 0, value * barW, barH);\n\n }, this);\n\n // load images\n this.load.image('background', 'assets/images/background.png'); // game background\n this.load.image('menu', 'assets/images/Menu.png'); // menu background\n this.load.image('danger', 'assets/images/Danger.png'); // danger block\n this.load.image('indicator', 'assets/images/Indicator.png'); // mirror indicator\n this.load.image('pointer', 'assets/images/Pointer.png'); // mirror indicator pointer\n this.load.image('arrow', 'assets/images/Arrow.png'); // arrow (for the tasks)\n this.load.image('frame', 'assets/images/Frame.png'); // frame (for text)\n this.load.image('note', 'assets/images/Note.png'); // note (for music composer)\n\n // load spritesheets\n this.load.spritesheet('block1', 'assets/images/Block1.png', {frameWidth: 25, frameHeight: 25}); // block 1 (normal)\n this.load.spritesheet('block2', 'assets/images/Block2.png', {frameWidth: 25, frameHeight: 25}); // block 2 (pirate)\n this.load.spritesheet('block3', 'assets/images/Block3.png', {frameWidth: 25, frameHeight: 25}); // block 3 (glasses)\n this.load.spritesheet('checkpoint', 'assets/images/Checkpoints.png', {frameWidth: 25, frameHeight: 25}); // checkpoints\n this.load.spritesheet('eyes', 'assets/images/Eyes.png', {frameWidth: 240, frameHeight: 44}); // inspector eyes\n\n // load audio\n this.load.audio('cnorm', 'assets/audio/Cnorm.mp3'); // playing, C, normal\n this.load.audio('fnorm', 'assets/audio/Fnorm.mp3'); // playing, F, normal\n this.load.audio('gnorm', 'assets/audio/Gnorm.mp3'); // playing, G, normal\n this.load.audio('anorm', 'assets/audio/Anorm.mp3'); // playing, Am, normal\n this.load.audio('cfast', 'assets/audio/Cfast.mp3'); // playing, C, fast\n this.load.audio('ffast', 'assets/audio/Ffast.mp3'); // playing, C, fast\n this.load.audio('gfast', 'assets/audio/Gfast.mp3'); // playing, C, fast\n this.load.audio('afast', 'assets/audio/Afast.mp3'); // playing, C, fast\n this.load.audio('cmenu', 'assets/audio/Cmenu.mp3'); // menu, C\n this.load.audio('fmenu', 'assets/audio/Fmenu.mp3'); // menu, F\n this.load.audio('gmenu', 'assets/audio/Gmenu.mp3'); // menu, G\n this.load.audio('amenu', 'assets/audio/Amenu.mp3'); // menu, Am\n this.load.audio('gameover', 'assets/audio/GameOver.mp3'); // Game Over\n this.load.audio('level', 'assets/audio/LevelComplete.mp3'); // level complete\n this.load.audio('mission', 'assets/audio/Mission.mp3'); // mission complete\n this.load.audio('game', 'assets/audio/GameComplete.mp3'); // game complete\n\n }", "function scaffolds_Activate()\n{\n if (!scaffolds_loaded) {\n \tscaffolds_sketch = GetData(\"sketch\", \"scaffolds\");\n\tscaffolds_sketch = scaffolds_sketch.split(\"|\").join(\"\\n\");\n\t\n\t // Setup a request to download the list of unassigned scaffolds,\n\t // which will be filled in whenever the result is ready. In the\n\t // meanwhile, we continue on our merry way.\n\t\n\ttry {\n\t scaffolds_xmlHttp = GetXmlHttpObject(ReceiveUnassigned);\n\t scaffolds_xmlHttp.open('GET', 'unmatched.sdf', true);\n\t if (scaffolds_xmlHttp.overrideMimeType) {\n\t \tscaffolds_xmlHttp.overrideMimeType('text/plain'); // (not XML)\n\t }\n\t scaffolds_xmlHttp.send(\"\");\n\t} catch (ex) {\n\t // if file isn't there, don't freak out\n\t}\n }\n scaffolds_loaded = true;\n\n var html = BuildEditing() + BuildUnusedList() + BuildClipInfo();\n\n return html;\n}", "function initAvengers(){\n var ironMan = new avenger(\"IRONMAN\" , 1000, 75, 80, \"./assets/images/ironManPic.jpg\");\n var thor = new avenger(\"THOR\" , 1400, 100, 120, \"./assets/images/thor.jpg\" );\n var hulk = new avenger(\"HULK\" , 2000, 150, 150, \"./assets/images/hulk.jpeg\");\n var capAmerica = new avenger(\"CAPTAINAMERICA\" , 1000, 75, 80, \"./assets/images/captainAmerica.jpg\");\n playersArray.push(ironMan,thor,hulk,capAmerica);\n}", "initializeGrid() {\n const tanks = this.filterAsset(\"tank\");\n for(const tank of tanks) {\n this.addTank(tank);\n }\n\n const tubes = this.filterAsset(\"tube\");\n for(const tube of tubes) {\n this.placeTube(tube.path);\n }\n\n const miscs = this.filterAsset(\"misc\");\n for(const misc of miscs) {\n this.addMiscAsset(misc);\n }\n\n this.cleanupData();\n }", "loadStage(stage, firstStage) {\n \n this.stage = stage;\n\n // Clear previous render items\n this.renderItems = new Array();\n this.renderItemsAnimated = new Array();\n\n // Add the Static Items\n this.stage.getStaticItems().map( (item) => { \n item.scenario = this; // Pass this scenario class as an argument, so other functions can refer to this\n this.addStaticItem(item);\n });\n\n // Only set player start at first load\n if(firstStage) {\n this.setPlayer1StartX( this.stage.getPlayer1StartX() );\n this.setPlayer1StartY( this.stage.getPlayer1StartY() );\n this.setPlayer2StartX( this.stage.getPlayer2StartX() );\n this.setPlayer2StartY( this.stage.getPlayer2StartY() );\n } else {\n window.game.players.map( (player) => {\n player.checkGrabbingObjects();\n });\n }\n \n }", "function generateAssets() {\r\n\r\n\r\n loadJSON('json/assets.json', function (text) {\r\n\r\n var allItems = JSON.parse(text);\r\n\t\tvar arrID = [];\r\n var arrLand = [];\r\n var arr2013 = [];\r\n var arr2014 = [];\r\n var arr2015 = [];\r\n var arr2016 = [];\r\n\t\tvar arr2017 = [];\r\n \r\n\r\n\r\n var arrLength = allItems.assetList.length;\r\n\r\n for (var i = 0; i < allItems.assetList.length; i++) {\r\n\r\n var singleAsset = allItems.assetList[i];\r\n var AssetID = singleAsset.ID;\r\n\t\t var AssetLand = singleAsset.Land;\r\n var Asset2013 = singleAsset.j2013;\r\n var Asset2014 = singleAsset.j2014;\r\n var Asset2015 = singleAsset.j2015;\r\n var Asset2016 = singleAsset.j2016;\r\n var Asset2017 = singleAsset.j2017;\r\n \r\n \r\n\t \t\tarrID.push(AssetID);\r\n arrLand.push(AssetLand);\r\n arr2013.push(Asset2013);\r\n arr2014.push(Asset2014);\r\n arr2015.push(Asset2015);\r\n arr2016.push(Asset2016);\r\n arr2017.push(Asset2017);\r\n\r\n }\r\n\t\t\t\t\t\r\n\t\t for (var i = 1; i < allItems.assetList.length; i++) {\r\n\r\n\t\t\t mouseLand(arrID, arrID[i], arrLand[i], arr2013[i], arr2014[i], arr2015[i], arr2016[i], arr2017[i]);\r\n\t\t\t \r\n\t\t\t }\r\n\r\n svgButtons (arrID, arrLand, arr2013, arr2014, arr2015, arr2016, arr2017);\r\n\r\n });\r\n\r\n}", "function Start() {\n\tloadBoardSkins();\n}", "async function configureAssets(iosProjectPath, imagePath) {\n const imageSetPath = path_1.default.resolve(iosProjectPath, FILES_PATHS.IMAGESET);\n // ensure old SplashScreen imageSet is removed\n if (await fs_extra_1.default.pathExists(imageSetPath)) {\n await fs_extra_1.default.remove(imageSetPath);\n }\n if (imagePath) {\n await fs_extra_1.default.mkdirp(imageSetPath);\n const contentJson = {\n images: [\n {\n idiom: 'universal',\n filename: SPLASH_SCREEN_FILENAME,\n scale: '1x',\n },\n {\n idiom: 'universal',\n scale: '2x',\n },\n {\n idiom: 'universal',\n scale: '3x',\n },\n ],\n info: {\n version: 1,\n author: 'xcode',\n },\n };\n await fs_extra_1.default.writeFile(path_1.default.resolve(iosProjectPath, FILES_PATHS.IMAGESET_CONTENTS), JSON.stringify(contentJson, null, 2));\n await fs_extra_1.default.copyFile(imagePath, path_1.default.resolve(iosProjectPath, FILES_PATHS.PNG));\n }\n}", "load_done(loader, resources) {\n // Make a button to clear screen\n this.wipe_screen();\n\n // Score text\n this.score = 0;\n this.scoreText = new PIXI.Text('Score: 0', {\n fill: '#ff4500',\n fontWeight: 'bold',\n });\n\n app.stage.addChild(this.scoreText);\n\n // Updates score\n let setScore = value => {\n this.score = value;\n this.scoreText.text = ('Score: ' + this.score);\n };\n this.scoreText.x = app.screen.width - (this.scoreText.width + 40);\n setScore(0);\n\n // Create a text box for user to type word in\n this.input = new PixiTextInput();\n this.input.position.x = 150;\n this.input.position.y = 350;\n this.input.width = 250;\n this.input.text = \"\";\n app.stage.addChild(this.input);\n\n // Dinosaur/life creation\n let dino = new Dinosaur();\n dino.x = app.screen.width - 50;\n dino.y = app.screen.height - 50;\n dino.scale.x = .04;\n dino.scale.y = .04;\n this.dinos.push(dino);\n app.stage.addChild(dino);\n\n let dino2 = new Dinosaur();\n dino2.x = app.screen.width - 150;\n dino2.y = app.screen.height - 50;\n dino2.scale.x = .04;\n dino2.scale.y = .04;\n this.dinos.push(dino2);\n app.stage.addChild(dino2);\n\n let dino3 = new Dinosaur();\n dino3.x = 80;\n dino3.y = app.screen.height - 50;\n dino3.scale.x = .04;\n dino3.scale.y = .04;\n this.dinos.push(dino3);\n app.stage.addChild(dino3);\n\n // Display instructions as forefront\n this.popup_instructions();\n }", "function preload() {\n socialMediaGirl.image = loadImage(\"assets/images/matrixgirlsocialmedia.png\");\n societyGirl.image = loadImage(\"assets/images/matrixgirlsociety.png\");\n othernessGirl.image = loadImage(\"assets/images/matrixgirlfinalstep.png\");\n originalGirl.image = loadImage(\"assets/images/matrixgirlalmostfree.png\");\n almostFreeGirl.image = loadImage(\"assets/images/matrixgirlfree.png\");\n matrixEntry.image = loadImage(\"assets/images/matrixentry.jpg\");\n matrixFail.image = loadImage(\"assets/images/matrixsucked.jpg\");\n instagram.image = loadImage(\"assets/images/IG.png\");\n youtube.image = loadImage(\"assets/images/yt.png\");\n facebook.image = loadImage(\"assets/images/fb.png\");\n pinterest.image = loadImage(\"assets/images/pinterest.png\");\n twitter.image = loadImage(\"assets/images/twitter.png\");\n snapchat.image = loadImage(\"assets/images/sc.png\");\n society1.image = loadImage(\"assets/images/societyblue.png\");\n society2.image = loadImage(\"assets/images/societyred.png\");\n freedom.image = loadImage(\"assets/images/freedom.jpg\");\n}", "merge() {\n this.assets.push(this.files.merge(this.data.output, this.data.babel));\n }", "function countLoadedSoundsAndLaunchIfReady() {\n assetsToLoad--;\n if (assetsToLoad == 0) {\n\n launchGame();\n\n } else {\n // TODO render a progress bar\n }\n //console.log(assetsToLoad);\n}", "async _loadAssetsAsync() {\n\n const imageAssets = _cacheFiles([\n ..._getImages()\n ])\n\n const soundsAsset = _cacheFiles([\n ..._getAudios()\n ])\n\n const fontAssets = _cacheFonts([\n {name: 'alcubierre', font: require('./src/assets/fonts/Alcubierre/Alcubierre.otf')},\n {name: 'rubik-black', font: require('./src/assets/fonts/Rubik/Rubik-Black.ttf')},\n {name: 'rubik-bold', font: require('./src/assets/fonts/Rubik/Rubik-Bold.ttf')},\n {name: 'rubik-medium', font: require('./src/assets/fonts/Rubik/Rubik-Medium.ttf')},\n {name: 'rubik-regular', font: require('./src/assets/fonts/Rubik/Rubik-Regular.ttf')},\n {name: 'rubik-light', font: require('./src/assets/fonts/Rubik/Rubik-Light.ttf')}\n ])\n\n //await Promise.all([...fontAssets])\n await Promise.all([...fontAssets, ...imageAssets, ...soundsAsset])\n\n }", "function loadImages(image, name, xPos, yPos, cursor, rot, alpha_value, container) {\n\tregistration_point_y = 21.5;\n var _bitmap = new createjs.Bitmap(image).set({});\n _bitmap.x = xPos;\n _bitmap.y = yPos;\n _bitmap.name = name;\n _bitmap.alpha = alpha_value;\n _bitmap.rotation = rot;\n _bitmap.cursor = cursor;\n\tif ( name == \"scale\" ) {\n\t\t_bitmap.regX = _bitmap.image.width/2.5;\n\t\t_bitmap.regY = registration_point_y; //initial registration point\n\t}\n container.addChild(_bitmap); /** Adding bitmap to the stage */\n}", "preload() {\n\t\tvar loadingLabel = game.add.text(80, 150, 'loading...', {font: '30px Courier', fill: '#ffffff'});\n\n\t\t// Load all assets. The first parameter is the variable that \n\t\t// will point to the image, and the second parameter is the \n\t\t// image file itself.\n\t\tgame.load.image('tiledBackground', 'assets/img/tiledBackground.gif');\n\t\tgame.load.image('A', 'assets/img/A.png');\n\t\tgame.load.image('E', 'assets/img/E.png');\n\t\tgame.load.image('I', 'assets/img/I.png');\n\t\tgame.load.image('O', 'assets/img/O.png');\n\t\tgame.load.image('U', 'assets/img/U.png');\n\t\tgame.load.image('questionMark1', 'assets/img/questionMark1.png');\n\t\tgame.load.image('questionMark2', 'assets/img/questionMark2.png');\n\t\tgame.load.image('questionMark3', 'assets/img/questionMark3.png');\n\t\tgame.load.image('questionMark4', 'assets/img/questionMark4.png');\n\t\tgame.load.image('speaker', 'assets/img/speaker.png');\n\t\tgame.load.image('escucha', 'assets/img/escucha.png');\n\t\tgame.load.image('avalancha', 'assets/img/avalancha.png');\n\t\tgame.load.image('restart', 'assets/img/restart.png');\n\t\tgame.load.image('lee', 'assets/img/lee.png');\n\t\tgame.load.image('home', 'assets/img/home.png');\n\t\tgame.load.image('background1', 'assets/img/background1.jpg');\n\t\tgame.load.audio('A', 'assets/audio/A.m4a');\n\t\tgame.load.audio('E', 'assets/audio/E.m4a');\n\t\tgame.load.audio('I', 'assets/audio/I.m4a');\n\t\tgame.load.audio('O', 'assets/audio/O.m4a');\n\t\tgame.load.audio('U', 'assets/audio/U.m4a');\n\t\tgame.load.audio('encuentra', 'assets/audio/encuentra.m4a');\n\n\t}", "function setStage(stageType){\t\n\tif(stageType == \"duet_ash\"){\n\t\t//draw backgrounds\n\t\tctx.fillStyle = \"#C97ED6\";\n\t\tctx.fillRect(0,0,canvas.width,96);\n\t\tctx.fillStyle = \"#343434\";\n\t\tctx.fillRect(0,96,canvas.width,112);\n\n\t\tashDuet.show = true;\n\n\t\t//draw characters\n\t\tonceAnim(ashDuet);\n\t\trendersprite(ashDuet);\n\n\t\t//draw hearts\n\t\tctx.drawImage(ashHeart,0,0,64,64,24,112,24,24);\n\t\tctx.drawImage(natHeart,0,0,64,64,112,112,24,24);\n\t}\n\telse if(stageType == \"duet_nat\"){\n\t\t//draw backgrounds\n\t\tctx.fillStyle = \"#7EC5D6\";\n\t\tctx.fillRect(0,0,canvas.width,96);\n\t\tctx.fillStyle = \"#343434\";\n\t\tctx.fillRect(0,96,canvas.width,112);\n\n\t\tnatDuet.show = true;\n\n\t\t//draw characters\n\t\tonceAnim(natDuet);\n\t\trendersprite(natDuet);\n\n\t\t//draw hearts\n\t\tctx.drawImage(ashHeart,0,0,64,64,24,112,24,24);\n\t\tctx.drawImage(natHeart,0,0,64,64,112,112,24,24);\n\t}else{\n\t\t//draw backgrounds\n\t\tctx.fillStyle = \"#cdcdcd\";\n\t\tctx.fillRect(0,0,canvas.width,96);\n\t\tctx.fillStyle = \"#343434\";\n\t\tctx.fillRect(0,96,canvas.width,112);\n\n\t\tnatBand.show = true;\n\t\tashBand.show = true;\n\t\tdamonBand.show = true;\n\n\t\t//draw characters\n\t\tonceAnim(natBand);\n\t\trendersprite(natBand);\n\t\tonceAnim(ashBand);\n\t\trendersprite(ashBand);\n\t\tonceAnim(damonBand);\n\t\trendersprite(damonBand);\n\n\n\t\t//draw hearts\n\t\tctx.drawImage(ashHeart,0,0,64,64,20,112,24,24);\n\t\tctx.drawImage(natHeart,0,0,64,64,110,112,24,24);\n\t\tctx.drawImage(damonHeart,0,0,64,64,64,112,24,24);\n\t}\n}", "function main() {\n addImage();\n hideRules();\n}", "function registerAsset(asset){// `push` returns new array length, so the first asset will\n// get id 1 (not 0) to make the value truthy\nreturn assets.push(asset);}", "function preload() {\n managers.Assets.init();\n managers.Assets.loader.addEventListener(\"complete\", init);\n}", "function preload() {\n managers.Assets.init();\n managers.Assets.loader.addEventListener(\"complete\", init);\n}", "function assetFinder(combatChoice) {\n return \"assets/\" + combatChoice + \".png\"\n }", "function preload() {\n angry = loadAnimation(\"public/assets/angry-1.png\", \"public/assets/angry-2.png\");\n bashful = loadAnimation(\"public/assets/bashful-1.png\", \"public/assets/bashful-2.png\");\n cry = loadAnimation(\"public/assets/cry-1.png\", \"public/assets/cry-2.png\");\n idle = loadAnimation(\"public/assets/idle-1.png\", \"public/assets/idle-2.png\");\n disappointed = loadAnimation(\"public/assets/disappointed-1.png\", \"public/assets/disappointed-2.png\");\n shiver = loadAnimation(\"public/assets/shiver-1.png\", \"public/assets/shiver-2.png\");\n sick = loadAnimation(\"public/assets/sick-1.png\", \"public/assets/sick-2.png\");\n dead = loadAnimation(\"public/assets/dead-1.png\", \"public/assets/dead-2.png\");\n pout = loadAnimation(\"public/assets/pout-1.png\", \"public/assets/pout-2.png\");\n nightmare = loadAnimation(\"public/assets/nightmare-1.png\", \"public/assets/nightmare-2.png\");\n lick = loadAnimation(\"public/assets/lick-1.png\", \"public/assets/lick-2.png\");\n bath = loadAnimation(\"public/assets/bath-1.png\", \"public/assets/bath-2.png\");\n wave = loadAnimation(\"public/assets/wave-1.png\", \"public/assets/wave-2.png\", \"public/assets/wave-3.png\");\n happywalk = loadAnimation(\"public/assets/happy-walk-1.png\", \"public/assets/happy-walk-2.png\", \"public/assets/happy-walk-3.png\");\n \n}", "function scoreCounter() {\n $('#points').append('<img class=\"points\" src=\"assets/images/scoring-images/star-point-removebg-preview.png\" alt=\"star-points\">');\n }", "parseAssets () {\n const { data : { assets, framework } } = this;\n\n if (framework.frameworkPath) {\n assets.forEach(asset => {\n if (asset.remote) {\n if (asset.code) {\n asset.code = asset.code.replace('{frameworkPath}', framework.frameworkPath);\n }\n\n if (asset.name) {\n asset.name = asset.name.replace('{frameworkPath}', framework.frameworkPath);\n }\n }\n });\n }\n\n assets.forEach(asset => {\n if (asset.remote) {\n if (/^http/i.test(asset.code)) {\n asset.name = asset.code;\n asset.code = '__remote__';\n }\n }\n });\n }", "function allocateContent()\n{\n\tfor(item in dataModel)\n\t{\n\t\t//[tile,minerals,tileImage]\n\t\tdataModel[item] = [\"grass\",0,\"g1\"];\n\t}\n\n\t\t//add features\n\t\tloadLayouts();\n}", "function loadResources(assets, whenLoaded) {\n document.fonts.load('30px AtariST').then(() => {\n let imgCounter = 0;\n let sfxCounter = 0;\n assets.IMGS.forEach(function(path){\n let img = document.createElement('img');\n img.src = path;\n let fileName = path.split(/[\\./]/).slice(-2, -1)[0];\n img.onload = function(){\n ctx.clearRect(15, 50, gameWindow.width, 30);\n ctx.fillText(\"Img \" + imgCounter + \"/\" + assets.IMGS.length, 15, 80);\n imgs[fileName] = img;\n imgCounter++;\n (assets.IMGS.length == imgCounter) && (assets.SFX.length == sfxCounter) ? whenLoaded() : console.log('suspenseful loading time...');\t\n };\n });\n assets.SFX.forEach(function(path){\n let sfx = document.createElement('audio');\n sfx.src = path;\n let fileName = path.split(/[\\./]/).slice(-2, -1)[0];\n sfx.onloadeddata = function() {\n ctx.clearRect(15, 100, gameWindow.width, gameWindow.height);\n ctx.fillText(\"Sfx \" + sfxCounter + \"/\" + assets.SFX.length, 15, 130);\n sfxs[fileName] = sfx;\n\t\t\t sfxCounter++;\n (assets.IMGS.length == imgCounter) && (assets.SFX.length == sfxCounter) ? whenLoaded() : console.log('suspenseful loading time...');\n };\n });\n });\n}" ]
[ "0.665967", "0.618519", "0.6041548", "0.5946782", "0.590872", "0.58981675", "0.5803563", "0.57757103", "0.5715938", "0.56942326", "0.5668764", "0.5655068", "0.5628573", "0.5514279", "0.5502467", "0.5500538", "0.54809815", "0.5478778", "0.546091", "0.54503673", "0.53984475", "0.5372879", "0.5369335", "0.5342394", "0.53336686", "0.53204495", "0.53072447", "0.5300039", "0.5292319", "0.52847314", "0.5284203", "0.5281124", "0.52800333", "0.52742296", "0.52721643", "0.52582884", "0.5237237", "0.521102", "0.51998043", "0.51777595", "0.51757735", "0.5169479", "0.5163972", "0.5162063", "0.5158354", "0.5156058", "0.5150093", "0.51475793", "0.51403683", "0.5135464", "0.51261675", "0.5123816", "0.51115847", "0.51087254", "0.5103241", "0.5099501", "0.50968766", "0.5096745", "0.5093234", "0.5090666", "0.5085315", "0.50788987", "0.50732696", "0.5069653", "0.5069055", "0.506893", "0.50658053", "0.506429", "0.50637937", "0.50603974", "0.5056651", "0.5055387", "0.5052943", "0.50519055", "0.5048162", "0.50450504", "0.5044359", "0.5041113", "0.50407803", "0.50389785", "0.5038749", "0.50385803", "0.50288457", "0.50269854", "0.5026625", "0.5024076", "0.5023414", "0.50209683", "0.50198627", "0.5015299", "0.50148684", "0.50135845", "0.50111395", "0.50111395", "0.5010797", "0.50058234", "0.5002085", "0.49962553", "0.49958336", "0.49883237" ]
0.7803341
0
! SCOREBOARD CANVAS This is the function that runs to build scoreboard canvas
function buildScoreBoardCanvas(){ if(!displayScoreBoard){ return; } //buttons resultContainer.removeChild(replayButton); buttonReplay = new createjs.Bitmap(loader.getResult('iconReplay')); centerReg(buttonReplay); createHitarea(buttonReplay); saveButton = new createjs.Bitmap(loader.getResult('iconSave')); centerReg(saveButton); createHitarea(saveButton); scoreboardButton = new createjs.Bitmap(loader.getResult('iconScoreboard')); centerReg(scoreboardButton); createHitarea(scoreboardButton); resultContainer.addChild(buttonReplay, saveButton, scoreboardButton); //scoreboard scoreBoardContainer = new createjs.Container(); bgScoreboard = new createjs.Bitmap(loader.getResult('bgScoreboard')); scoreTitle = new createjs.Text(); scoreTitle.font = "80px bariol_regularregular"; scoreTitle.color = "#ffffff"; scoreTitle.text = scoreBoardTitle; scoreTitle.textAlign = "center"; scoreTitle.textBaseline='alphabetic'; scoreTitle.x = canvasW/2; scoreTitle.y = canvasH/100*14; scoreBackTxt = new createjs.Text(); scoreBackTxt.font = "50px bariol_regularregular"; scoreBackTxt.color = "#ffffff"; scoreBackTxt.text = scoreBackText; scoreBackTxt.textAlign = "center"; scoreBackTxt.textBaseline='alphabetic'; scoreBackTxt.x = canvasW/2; scoreBackTxt.y = canvasH/100*95; scoreBackTxt.hitArea = new createjs.Shape(new createjs.Graphics().beginFill("#000").drawRect(-200, -30, 400, 40)); scoreBoardContainer.addChild(bgScoreboard, scoreTitle, scoreBackTxt); var scoreStartY = canvasH/100*23; var scoreSpanceY = 49.5; for(scoreNum=0;scoreNum<=10;scoreNum++){ for(scoreColNum=0;scoreColNum<score_arr.length;scoreColNum++){ $.scoreList[scoreNum+'_'+scoreColNum] = new createjs.Text(); $.scoreList[scoreNum+'_'+scoreColNum].font = "35px bariol_regularregular"; $.scoreList[scoreNum+'_'+scoreColNum].color = "#ffffff"; $.scoreList[scoreNum+'_'+scoreColNum].textAlign = score_arr[scoreColNum].align; $.scoreList[scoreNum+'_'+scoreColNum].textBaseline='alphabetic'; $.scoreList[scoreNum+'_'+scoreColNum].x = canvasW/100 * score_arr[scoreColNum].percentX; $.scoreList[scoreNum+'_'+scoreColNum].y = scoreStartY; if(scoreColNum == 0){ //position $.scoreList[scoreNum+'_'+scoreColNum].text = scoreRank_arr[scoreNum-1]; } if(scoreNum == 0){ $.scoreList[scoreNum+'_'+scoreColNum].text = score_arr[scoreColNum].col; } scoreBoardContainer.addChild($.scoreList[scoreNum+'_'+scoreColNum]); } scoreStartY += scoreSpanceY; } scoreBoardContainer.visible = false; canvasContainer.addChild(scoreBoardContainer); $.get('submit.html', function(data){ $('#canvasHolder').append(data); buildScoreboardButtons(); toggleSaveButton(true); resizeScore(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showScoreBoard() {\n let title = level >= 15 ? 'Congrats, you won!' : 'Ah, you lost!',\n titleX = level >= 15 ? 152 : 220,\n titleY = 280,\n totalScore = level * 60 + GemsCollected.blue * 30 + GemsCollected.green * 40 + GemsCollected.orange * 50,\n scoreBoard = Resources.get('images/score-board.jpg'),\n starResource = Resources.get('images/Star.png'),\n gemBlueResource = Resources.get('images/Gem-Blue.png'),\n gemGreenResource = Resources.get('images/Gem-Green.png'),\n gemOrangeResource = Resources.get('images/Gem-Orange.png'),\n offset = 70;\n // Draw image assets\n ctx.drawImage(scoreBoard, (canvas.width - scoreBoard.width) / 2, (canvas.height - scoreBoard.height - offset) / 2);\n ctx.drawImage(starResource, 175, 260 - offset, starResource.width / 1.5, starResource.height / 1.5);\n ctx.drawImage(gemBlueResource, 180, 345 - offset, gemBlueResource.width / 1.8, gemBlueResource.height / 1.8);\n ctx.drawImage(gemGreenResource, 180, 425 - offset, gemGreenResource.width / 1.8, gemGreenResource.height / 1.8);\n ctx.drawImage(gemOrangeResource, 180, 505 - offset, gemOrangeResource.width / 1.8, gemOrangeResource.height / 1.8);\n // Draw text\n ctx.font = \"50px Gaegu\";\n ctx.fillStyle = \"#fff\";\n ctx.strokeStyle = \"#000\";\n ctx.lineWidth = 3;\n ctx.strokeText(title, titleX, titleY - offset);\n ctx.fillText(title, titleX, titleY - offset);\n ctx.font = \"45px Gaegu\";\n ctx.strokeText(level + ' x 60 = ' + level * 60, 270, 340 - offset);\n ctx.fillText(level + ' x 60 = ' + level * 60, 270, 340 - offset);\n ctx.strokeText(GemsCollected.blue + ' x 30 = ' + GemsCollected.blue * 30, 270, 420 - offset);\n ctx.fillText(GemsCollected.blue + ' x 30 = ' + GemsCollected.blue * 30, 270, 420 - offset);\n ctx.strokeText(GemsCollected.green + ' x 40 = ' + GemsCollected.green * 40, 270, 500 - offset);\n ctx.fillText(GemsCollected.green + ' x 40 = ' + GemsCollected.green * 40, 270, 500 - offset);\n ctx.strokeText(GemsCollected.orange + ' x 50 = ' + GemsCollected.orange * 50, 270, 580 - offset);\n ctx.fillText(GemsCollected.orange + ' x 50 = ' + GemsCollected.orange * 50, 270, 580 - offset);\n ctx.strokeText('_______', 270, 640 - offset);\n ctx.fillText('_______', 270, 640 - offset);\n ctx.strokeText('Total: ' + totalScore.toString(), 270, 640 - offset);\n ctx.fillText('Total: ' + totalScore.toString(), 270, 640 - offset);\n ctx.strokeText('Spacebar to restart', 170, 680);\n ctx.fillText('Spacebar to restart', 170, 680);\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}", "static initialize() {\n // HTML からステージの元となる要素を取得し、大きさを設定する\n const stageElement = document.getElementById(\"stage\");\n stageElement.style.width = Config.puyoImgWidth * Config.stageCols + 'px';\n stageElement.style.height = Config.puyoImgHeight * Config.stageRows + 'px';\n stageElement.style.backgroundColor = Config.stageBackgroundColor;\n this.stageElement = stageElement;\n\n const zenkeshiImage = document.getElementById(\"zenkeshi\");\n zenkeshiImage.width = Config.puyoImgWidth * 6;\n zenkeshiImage.style.position = 'absolute';\n zenkeshiImage.style.display = 'none';\n this.zenkeshiImage = zenkeshiImage;\n stageElement.appendChild(zenkeshiImage);\n const scoreElement = document.getElementById(\"score\");\n scoreElement.style.backgroundColor = Config.scoreBackgroundColor;\n scoreElement.style.top = Config.puyoImgHeight * Config.stageRows + 'px';\n scoreElement.style.width = Config.puyoImgWidth * Config.stageCols + 'px';\n scoreElement.style.height = Config.fontHeight + \"px\";\n this.scoreElement = scoreElement;\n // メモリを準備する\n this.board = [\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n [0, 0, 0, 0, 0, 0],\n ];\n let puyoCount = 0;\n for(let y = 0; y < Config.stageRows; y++) {\n const line = this.board[y] || (this.board[y] = []);\n\n for(let x = 0; x < Config.stageCols; x++) {\n const puyo = line[x];\n if(puyo >= 1 && puyo <= 5) {\n // line[x] = {puyo: puyo, element: this.setPuyo(x, y, puyo)};\n this.setPuyo(x, y, puyo);\n puyoCount++;\n } else {\n line[x] = null;\n }\n }\n }\n this.puyoCount = puyoCount;\n }", "function paintCanvas() {\n /*\n * This function paints all the game components on the canvas. This includes the background, the snake, the food, and the score\n */\n\n // Paint canvas background\n ctx.fillStyle = \"black\";\n ctx.fillRect(0, 0, boardwidth, boardheight);\n ctx.strokeStyle = \"black\";\n ctx.strokeRect(0, 0, boardwidth, boardheight);\n\n // Paint Snake\n /*\n * TODO 4: Paint the snake by iterating through the snake_array and painting each cell of the snake by calling paintCell.\n * Hint: See initSnake() for how snake_array is constructed.\n */\n for (var i = 0; i < snake_array.length; i++) {\n paintCell(snake_array[i].x, snake_array[i].y);\n }\n\n // Paint Food\n // TODO 5: uncomment the following when you finish implementing paintCell\n // Checkpoint: At the end of this step, you should be able to see the snake array in the upper and a food cell appear randomly on the canvas when you refresh.\n paintCell(food.x, food.y);\n\n // Paint score\n var score_text = \"Score: \" + score;\n ctx.fillText(score_text, 5, boardheight-5);\n\n }", "initBoard() {\n this.canvas = document.createElement('canvas');\n this.ctx = this.canvas.getContext('2d');\n this.width = this.canvas.width = this.tileWidth * this.columns;\n this.height = this.canvas.height = this.tileHeight * this.rows;\n this.canvas.style.border = \"none\";\n this.initStage();\n }", "function drawCanvas() {\n\t\tdrawing(context, drawer, colours, solver, selectedSpacesGrid);\n\t\tsolver.callStateForItem(spanState);\n\t}", "function Leaderboard() {\n ctx.fillStyle = \"white\";\n ctx.fillRect(0 + 30, 0 + 30, canvas.width - 60, canvas.height - 150);\n\n ctx.fillStyle = brandColor;\n ctx.fillRect(0 + 35, 0 + 35, canvas.width - 70, canvas.height - 160);\n\n ctx.fillStyle = questionBarColor;\n ctx.fillRect(0 + 35, 0 + 35, canvas.width - 70, canvas.height - 625);\n\n ctx.fillStyle = questionBarColor;\n ctx.fillRect(0 + 110, 0 + 180, 790, 65);\n\n var startPos = 295;\n for (i = 0; i < 3; i++) {\n ctx.fillStyle = topBarColor;\n ctx.fillRect(35, startPos, canvas.width - 70, 60);\n startPos = startPos + 120;\n }\n\n ctx.fillStyle = questionBarColor;\n ctx.fillRect(canvas.width / 2, 295, 2.5, 300);\n\n ctx.font = \"96px cymraeg\";\n ctx.fillStyle = \"white\";\n ctx.fillText(\"Leaderboard\", 240, 30);\n\n var leaderboardNum = 1;\n var startPosX = 50;\n var startPosY = 315;\n for (i = 0; i < 2; i++) {\n for (j = 0; j < 5; j++) {\n ctx.font = \"36px cymraeg\";\n ctx.fillStyle = \"white\";\n ctx.fillText(leaderboardNum, startPosX, startPosY);\n leaderboardNum = leaderboardNum + 1;\n startPosY = startPosY + 60;\n }\n startPosY = 315;\n startPosX = startPosX + 480;\n }\n}", "function initializeCanvas()\r\n{\r\n\tcanvas = document.querySelector('canvas');\r\n\tcanvas.style.display = 'block';\r\n\twidth = 800;\r\n\theight = 400;\r\n\tcanvas.width = width;\r\n\tcanvas.height = height + 100; // add an extra 100 displaying score and lives\r\n\tctx = canvas.getContext(\"2d\");\r\n}", "_draw_scores () {\n\n\t\tvar cw = this._deck_blue ['musician'].w\n\t\tvar ch = this._deck_blue ['musician'].h\n\t\tvar colors = [\"rgba(200, 0, 0, 0.6)\", \"rgba(0, 0, 200, 0.6)\"]\n\n\t\tvar font_height = ch/3\n\t\tcanvas.style.font = this.context.font;\n\t\tcanvas.style.fontSize = `${font_height}px`;\n\t\tthis.context.font = canvas.style.font;\n\t\tthis.context.textAlign = \"center\";\n\t\tthis.context.textBaseline = \"middle\"; \n\n\t\tfor (let i = 0; i < this._scores.length; i +=1) {\n\n\t\t\tvar [x0, y0] = this.get_slot_coo (i, 0)\n\t\t\tvar [x1, y1] = this.get_slot_coo (i, 1)\n\t\t\tif (this._scores [i] > 0) {\n\t\t\t\t\n\t\t\t\tthis.context.fillStyle = colors [this._swap_color]\n\t\t\t\tthis.context.fillRect (x0 - cw/2, y0-cw/4, cw, cw/2);\n\t\t\t\tthis.context.fillStyle = \"white\";\n\t\t\t\tthis.context.fillText (`+${this._scores [i]}`, x0, y0); \t\n\n\t\t\t\tthis.context.fillStyle = \"rgba(0, 0, 0, 0.4)\"\n\t\t\t\tthis.context.fillRect (x1 - cw/2, y1-ch/2, cw, ch);\n\t\t\t}\n\t\t\tif (this._scores [i] < 0) {\n\t\t\t\t\n\t\t\t\tthis.context.fillStyle = colors [1 - this._swap_color]\n\t\t\t\tthis.context.fillRect (x1 - cw/2, y1-cw/4, cw, cw/2);\n\t\t\t\tthis.context.fillStyle = \"white\";\n\t\t\t\tthis.context.fillText (`+${-this._scores [i]}`, x1, y1); \t\n\n\t\t\t\tthis.context.fillStyle = \"rgba(0, 0, 0, 0.4)\"\n\t\t\t\tthis.context.fillRect (x0 - cw/2, y0-ch/2, cw, ch);\n\t\t\t}\n\t\t}\n\t}", "function printBoard() {\n if ($(\".mdl-spinner\").hasClass(\"is-active\")) $(\".mdl-spinner\").removeClass(\"is-active\");\n $(\"#chessBoard\").show();\n size(pixelSize*1000,pixelSize*1000);\n scale(pixelSize,pixelSize); \n stroke(0);\n fill(#0000FF);\n textFont(loadFont(\"Meta-Bold.ttf\"));\n for(var y = 0, ypos=100; y < 8; y++, ypos+=100) {\n for(var x = 0, xpos=100; x < 8; x++, xpos+=100) {\n if((x+y)%2) fill(100); else fill(255); // select white or black squares\n rect(xpos,ypos,100,100); // print an empty square\n if (reverse) {\n if (gData.board[7-y][7-x]> -1)\n image(images[gData.board[7-y][7-x]], xpos, ypos ,100,100); // print the image of the piece based on the value\n } else {\n if (gData.board[y][x]> -1)\n image(images[gData.board[y][x]], xpos, ypos ,100,100); // print the image of the piece based on the value\n }\n }\n }\n $(\"#chessCanvas\").show();\n}", "function draw() {\n CANVAS_CTX.clearRect(0, 0, BOARDER_WIDTH, BOARDER_HEIGHT);\n drawBoard();\n drawPoints();\n drawPacman();\n drawGhosts();\n drawApple();\n drawTimeBonus();\n\n $('#lblScore').val(score.toString());\n}", "function scoreBoard() \n {\n ctx.font = \"60px Ariel\"\n ctx.fillStyle = \"White\"\n ctx.fillText(score1, 355,170);\n ctx.fillText(score2, 415,170);\n }", "function drawCanvas() {\n\t\tdraw(context, drawer, colours, solver);\n\t\tsolver.callStateForItem(spanState);\n\t}", "function setLeaderboard() {\n ctx.fillStyle = questionBarColor;\n ctx.fillRect(0 + 110, 0 + 180, 790, 65);\n ctx.font = \"36px cymraeg\";\n ctx.fillStyle = \"white\";\n setImages();\n ctx.fillText(\"You\", 0 + 160, 0 + 195);\n ctx.fillText(name, 0 + 550, 0 + 195);\n ctx.fillText(score, 0 + 825, 0 + 195);\n ctx.font = \"18px cymraeg\";\n for (i = 0; i < 10; i++) {\n if (i < 5) {\n ctx.fillText(names[i], 0 + 200, 0 + 315 + (60 * i));\n ctx.fillText(scores[i], 0 + 350, 0 + 315 + (60 * i));\n }\n else {\n imgPos = 300;\n ctx.fillText(names[i], 0 + 700, 0 + 315 + (60 * (i - 5)));\n ctx.fillText(scores[i], 0 + 850, 0 + 315 + (60 * (i - 5)));\n }\n }\n}", "function drawFrame() {\n // Draw background and a border\n context.strokeStyle = \"#000000\";\n context.fillStyle = \"#d0d0d0\";\n context.fillRect(0, 0, canvas.width, canvas.height);\n context.fillStyle = \"#e8eaec\";\n context.fillRect(1, 1, canvas.width-2, canvas.height-2);\n \n // Character container\n context.fillStyle = \"#ffffff\";\n context.fillRect(400, 75, 300, 370);\n if (score < (requiredscore/2)) {\n context.drawImage(status1, 400, 75, 300, 370);\n } else {\n context.drawImage(status2, 400, 75, 300, 370);\n }\n \n // Score bar\n context.lineWidth = 3;\n context.fillStyle = \"#ffffff\";\n roundRect(context, 80, 75, 270, 35, 15, true, true);\n \n // Moves left container\n circle(context, 50, 93, 17);\n \n // Draw moves remaining\n context.fillStyle = \"#003300\";\n context.font = \"20px Verdana\";\n context.fillText(movecount, 37, 100);\n \n if (scorechange > 0) {\n // Draw a speech bubble\n drawBubble(context, 500, 125, 90, 30, 5);\n context.fillStyle = \"#003300\";\n context.font = \"10px Verdana\";\n if (!successquote) {\n if (scorechange > 1) {\n successquote = getRandomFromArray(greatquotes);\n } else {\n successquote = getRandomFromArray(goodquotes);\n }\n }\n context.fillText(successquote, 510, 140);\n }\n \n context.lineWidth = 1;\n context.fillStyle = \"#00b300\";\n context.strokeStyle = \"#00b300\";\n // Draw score\n if (score >= requiredscore) {\n roundRect(context, 83, 78, 264, 29, 11, true, true);\n } else if (score > 0) {\n var scorewidth = (score/requiredscore)*(270-6);\n roundOnLeftRect(context, 83, 78, scorewidth, 29, 11, true, true);\n }\n }", "function draw() {\r\n\t$('#board').empty();\r\n\tfor (var i = 0; i < 4; i++) {\r\n\t\tfor (var j = 0; j < 4; j++) {\r\n\t\t\tif (grid[i][j] != 0) {\r\n\t\t\t\tvar divToAppend = \"<div class='cell'>\"+grid[i][j]+\"</div>\";\r\n\t\t\t\t$(\"#board\").append(divToAppend).show('slow');\r\n\t\t\t\tapplyBackground($('#board div:last-child'));\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\t$(\"#board\").append(\"<div class='cell'></div>\");\r\n\t\t}\r\n\t}\r\n\t$(\"#score\").empty().append(score);\r\n}", "function updateScoreboard() {\n scoreboardGroup.clear(true, true);\n\n const scoreAsString = score.toString();\n if (scoreAsString.length === 1) {\n scoreboardGroup.create(assets.scene.width, 30, assets.scoreboard.base + score).setDepth(10);\n } else {\n let initialPosition = assets.scene.width - ((score.toString().length * assets.scoreboard.width) / 2);\n\n for (let i = 0; i < scoreAsString.length; i++) {\n scoreboardGroup.create(initialPosition, 30, assets.scoreboard.base + scoreAsString[i]).setDepth(10);\n initialPosition += assets.scoreboard.width;\n }\n }\n}", "function render() {\n ctx.clearRect(0, 0, W, H);\n\n ctx.textAlign = \"center\";\n ctx.font = \"25px Arial\";\n ctx.strokeText(\"Your score is: \" + myScore, 150, 100); // show the score inside of the canvas \n\n ctx.strokeStyle = 'lime';\n for (let x = 0; x < COLS; ++x) {\n for (let y = 0; y < ROWS; ++y) {\n if (board[y][x]) {\n ctx.fillStyle = colors[board[y][x] - 1];\n drawBlock(x, y);\n }\n }\n }\n\n ctx.fillStyle = 'red';\n ctx.strokeStyle = 'lime';\n for (let y = 0; y < 4; ++y) {\n for (let x = 0; x < 4; ++x) {\n if (current[y][x]) {\n ctx.fillStyle = colors[current[y][x] - 1];\n drawBlock(currentX + x, currentY + y);\n }\n }\n }\n}", "function drawBoard() {\n board = $(\"#board\");\n board.attr(\"width\", nCols * 30);\n board.attr(\"height\", nRows * 30);\n cnv = $(\"#board\").get(0);\n ctx = cnv.getContext(\"2d\");\n ctx.strokeRect(0, 0, nCols * 30, nRows * 30);\n for (var i = 1; i < nCols; i++) {\n ctx.beginPath();\n ctx.moveTo(i * 30, 0);\n ctx.lineTo(i * 30, nRows * 30);\n ctx.stroke();\n }\n for (var j = 1; j < nRows; j++) {\n ctx.beginPath();\n ctx.moveTo(0, j * 30);\n ctx.lineTo(nCols * 30, j * 30);\n ctx.stroke();\n }\n}", "startWebcamGameWithScoreBoard(){\r\n this.session.put('game-event-type','webcam')\r\n $('#window').empty();\r\n $('#window').append(dom.getWebcamWindow());\r\n $('#human_score').append(`<label>`+this.localeModel.getCurrentLanguage('human')+`</label><label>`+this.gameModel.getHumanScore()+`</label>`);\r\n $('#computer_score').append(`<label>`+this.localeModel.getCurrentLanguage('computer')+`</label><label>`+this.gameModel.getComputerScore()+`</label>`);\r\n this.webcam.setupCAM();\r\n }", "function drawCanvasGD(nnStatus) {\n\t//The grid is the tetris board\n\tlet grid = nnStatus.grid;\n\tlet colors = pieceColorsGD;\n\tlet upcomingShape = nnStatus.Upcoming_shape;\n\tlet score = nnStatus.Score;\n\t\n\t//Puts the general status in the top bar\n\tlet genStatus = document.getElementById(\"generalStats\");\n\tgenStatus.innerHTML = \"\";\n\tgenStatus.style.display = \"flex\";\n\tgenStatus.style.alignItems = \"center\";\n\tgenStatus.style.justifyContent = \"center\";\n\tlet temp = document.createElement(\"div\");\n\tlet aveOver = (roundCounter-1)%trainingWindow;\n\tif (aveOver === 0) {aveOver = trainingWindow;}\n\tif (roundCounter <= 1 && nnStatus[\"gameDone\"]) {aveOver = 1;}\n\ttemp.textContent = \"Score Average: \"+Math.floor(nnStatus.scoreTotal/(aveOver));\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0 0.5em 0 0.5em\";\n\ttemp.style.minWidth = \"10em\";\n\tgenStatus.appendChild(temp);\n\ttemp = document.createElement(\"div\");\n\ttemp.textContent = \"Loss: \"+\"N/A\";\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0 0.5em 0 0.5em\";\n\ttemp.style.borderLeft = \"1px solid white\";\n\ttemp.style.minWidth = \"10em\";\n\ttemp.id = \"Loss\";\n\tgenStatus.appendChild(temp);\n\ttemp = document.createElement(\"div\");\n\ttemp.textContent = \"Acc: \"+\"N/A\";\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0 0.5em 0 0.5em\";\n\ttemp.style.borderLeft = \"1px solid white\";\n\ttemp.style.minWidth = \"10em\";\n\ttemp.id = \"Acc\";\n\tgenStatus.appendChild(temp);\n\t\n\t//Draw the grid\n\tlet output = document.getElementById(\"output\");\n\toutput.innerHTML = \"\";\n\tfor (let i = 0; i < grid.length; i++) {\n\t\tlet lineDiv = document.createElement(\"div\");\n\t\tfor (let j = 0; j < grid[0].length; j++){\n\t\t\tlet para = document.createElement(\"div\");\n\t\t\tpara.textContent = grid[i][j];\n\t\t\tpara.style.textAlign = \"center\";\n\t\t\tpara.style.verticalAlign = \"middle\";\n\t\t\t\n\t\t\tpara.style.color = \"white\";\n\t\t\tpara.style.backgroundColor = colors[grid[i][j]];\n\t\t\t\n\t\t\tpara.style.display = \"inline-block\";\n\t\t\tpara.style.padding = \"0.65em 0.65em 0.65em 0.65em\";\n\t\t\tpara.style.boxSizing = \"border-box\";\n\t\t\tpara.style.border = \"1px solid white\";\n\t\t\tpara.style.width = \"1em\";\n\t\t\tpara.style.height = \"1em\";\n\t\t\tlineDiv.appendChild(para);\n\t\t}\n\t\tlineDiv.style.lineHeight = \"0px\";\n\t\toutput.appendChild(lineDiv);\n\t}\n\t\n\t//Draw the left side bar, the score side bar\n\tlet scoreDetails = document.getElementById(\"score\");\n\tscoreDetails.innerHTML = \"\";\n\tlet disScore = document.createElement(\"h2\");\n\tdisScore.textContent = \"Score: \" + Math.floor(score);\n\tdisScore.style.textAlign = \"center\";\n\tdisScore.style.marginTop = \"0\";\n\tscoreDetails.appendChild(disScore);\n\t\n\tlet disCurrent = document.createElement(\"h2\");\n\tdisCurrent.textContent = \"__Current__\";\n\tdisCurrent.style.marginBottom = \"0px\";\n\tdisCurrent.style.textAlign = \"center\";\n\tscoreDetails.appendChild(disCurrent);\n\tscoreDetails.appendChild(document.createElement(\"br\"));\n\t\n\tlet disCurShape = document.createElement(\"h2\");\n\tdisCurShape.textContent = piecesNamesGD[nnStatus.played_shape.piece];\n\tdisCurShape.style.textAlign = \"center\";\n\tdisCurShape.style.marginTop = \"0px\";\n\tdisCurShape.style.marginBottom = \"7px\";\n\tdisCurShape.style.marginLeft = \"auto\";\n\tdisCurShape.style.marginRight = \"auto\";\n\tdisCurShape.style.width = \"5em\";\n\tdisCurShape.style.color = \"white\";\n\tdisCurShape.style.backgroundColor = colors[nnStatus.played_shape.piece];\n\tdisCurShape.style.fontFamily = \"serif\";\n\tscoreDetails.appendChild(disCurShape);\n\t\n\tlet disUpcoming = document.createElement(\"h3\");\n\tdisUpcoming.textContent = \"__Upcoming__\";\n\tdisUpcoming.style.marginTop = \"0px\";\n\tdisUpcoming.style.marginBottom = \"0px\";\n\tdisUpcoming.style.textAlign = \"center\";\n\tscoreDetails.appendChild(disUpcoming);\n\tscoreDetails.appendChild(document.createElement(\"br\"));\n\tlet disUpShape = document.createElement(\"h3\");\n\tdisUpShape.textContent = piecesNamesGD[upcomingShape.piece];\n\tdisUpShape.style.textAlign = \"center\";\n\tdisUpShape.style.marginTop = \"0px\";\n\tdisUpShape.style.marginLeft = \"auto\";\n\tdisUpShape.style.marginRight = \"auto\";\n\tdisUpShape.style.width = \"5em\";\n\tdisUpShape.style.color = \"white\";\n\tdisUpShape.style.backgroundColor = colors[upcomingShape.piece];\n\tdisUpShape.style.fontFamily = \"serif\";\n\tscoreDetails.appendChild(disUpShape);\n\t\n\ttemp = document.createElement(\"div\");\n\ttemp.textContent = \"Number of Blocks Played: \"+nnStatus.movesTaken;\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0.5em 0 0.5em 0\";\n\ttemp.style.borderTop = \"1px solid white\";\n\tscoreDetails.appendChild(temp);\n\ttemp = document.createElement(\"div\");\n\ttemp.textContent = \"Number of Games Played: \"+(roundCounter);\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0.5em 0 0.5em 0\";\n\ttemp.style.borderTop = \"1px solid white\";\n\tscoreDetails.appendChild(temp);\n\ttemp = document.createElement(\"div\");\n\ttemp.textContent = \"Training: \"+(nnStatus.training || roundCounter%dreamTiming === 0 || roundCounter % 10 === 0 ? \"True\" : \"False\");\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0.5em 0 0.5em 0\";\n\ttemp.style.borderTop = \"1px solid white\";\n\ttemp.id = \"training\";\n\tscoreDetails.appendChild(temp);\n\t\n\t//Puts up the number of each move taken by the AI\n\tlet moveTotalsMiddle = nnStatus.moves.reduce(function(a,b){return a+b;});\n\tmoveTotalsMiddle = moveTotalsMiddle/nnStatus.moves.length;\n\ttemp = document.createElement(\"div\");\n\ttemp.textContent = \"Number of \\\"Key\\\" Presses: \";\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.padding = \"0.5em 0 0 0\";\n\ttemp.style.borderTop = \"1px solid white\";\n\tscoreDetails.appendChild(temp);\n\t\n\ttemp = document.createElement(\"div\");\n\tlet arrow = document.createElement(\"div\");\n\tarrow.textContent = nnStatus.moves[0];\n\tarrow.style.textAlign = \"center\";\n\tarrow.style.verticalAlign = \"middle\";\n\tarrow.style.color = \"indianred\";\n\tif (nnStatus.moves[0] >= moveTotalsMiddle) {arrow.style.backgroundColor = \"cornsilk\";} else{arrow.style.backgroundColor = \"black\";}\n\tarrow.style.display = \"inline-block\";\n\tarrow.style.marginLeft = \"auto\";\n\tarrow.style.marginRight = \"auto\";\n\tarrow.style.padding = \"0.65em 0.65em 0.65em 0.65em\";\n\tarrow.style.margin = \"0.4em 0.4em 0.4em 0.4em\";\n\tarrow.style.boxSizing = \"border-box\";\n\tarrow.style.border = \"1px solid white\";\n\tarrow.style.width = \"1em\";\n\tarrow.style.height = \"1em\";\n\ttemp.appendChild(arrow);\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.lineHeight = \"0px\";\n\tscoreDetails.appendChild(temp);\n\t\n\ttemp = document.createElement(\"div\");\n\tarrow = document.createElement(\"div\");\n\tarrow.textContent = nnStatus.moves[1];\n\tarrow.style.textAlign = \"center\";\n\tarrow.style.verticalAlign = \"middle\";\n\tarrow.style.color = \"indianred\";\n\tif (nnStatus.moves[1] >= moveTotalsMiddle) {arrow.style.backgroundColor = \"cornsilk\";} else{arrow.style.backgroundColor = \"black\";}\n\tarrow.style.display = \"inline-block\";\n\tarrow.style.padding = \"0.65em 0.65em 0.65em 0.65em\";\n\tarrow.style.margin = \"0.4em 0.6em 0.4em 0.6em\";\n\tarrow.style.boxSizing = \"border-box\";\n\tarrow.style.border = \"1px solid white\";\n\tarrow.style.width = \"1em\";\n\tarrow.style.height = \"1em\";\n\ttemp.appendChild(arrow);\n\t\n\tarrow = document.createElement(\"div\");\n\tarrow.textContent = nnStatus.moves[3];\n\tarrow.style.textAlign = \"center\";\n\tarrow.style.verticalAlign = \"middle\";\n\tarrow.style.color = \"indianred\";\n\tif (nnStatus.moves[3] >= moveTotalsMiddle) {arrow.style.backgroundColor = \"cornsilk\";} else{arrow.style.backgroundColor = \"black\";}\n\tarrow.style.backgroundColor = \"black\";\n\tarrow.style.display = \"inline-block\";\n\tarrow.style.padding = \"0.65em 0.65em 0.65em 0.65em\";\n\tarrow.style.margin = \"0.4em 0.6em 0.4em 0.6em\";\n\tarrow.style.boxSizing = \"border-box\";\n\tarrow.style.border = \"1px solid white\";\n\tarrow.style.width = \"1em\";\n\tarrow.style.height = \"1em\";\n\ttemp.appendChild(arrow);\n\t\n\tarrow = document.createElement(\"div\");\n\tarrow.textContent = nnStatus.moves[2];\n\tarrow.style.textAlign = \"center\";\n\tarrow.style.verticalAlign = \"middle\";\n\tarrow.style.color = \"indianred\";\n\tif (nnStatus.moves[2] >= moveTotalsMiddle) {arrow.style.backgroundColor = \"cornsilk\";} else{arrow.style.backgroundColor = \"black\";}\n\tarrow.style.display = \"inline-block\";\n\tarrow.style.padding = \"0.65em 0.65em 0.65em 0.65em\";\n\tarrow.style.margin = \"0.4em 0.6em 0.4em 0.6em\";\n\tarrow.style.boxSizing = \"border-box\";\n\tarrow.style.border = \"1px solid white\";\n\tarrow.style.width = \"1em\";\n\tarrow.style.height = \"1em\";\n\ttemp.appendChild(arrow);\n\ttemp.style.textAlign = \"center\";\n\ttemp.style.lineHeight = \"0px\";\n\tscoreDetails.appendChild(temp);\n}", "scoreboardDraw(scoreboardList) {\n let leaderboardRowsDiv = document.getElementById(\"leaderboard-rows\");\n const MAX_ROW_COUNT = 10;\n let rowNum = 0;\n\n // Update leaderboard\n for(var score of scoreboardList) {\n if(rowNum === MAX_ROW_COUNT) {\n break;\n }\n\n leaderboardRowsDiv.children[rowNum].children[0].innerHTML = (rowNum + 1) + \")\";\n leaderboardRowsDiv.children[rowNum].children[1].innerHTML = score.screenName;\n leaderboardRowsDiv.children[rowNum].children[2].innerHTML = score.kills;\n\n rowNum++;\n }\n\n // Clear old leaderboard rows\n for(; rowNum < MAX_ROW_COUNT; rowNum++) {\n leaderboardRowsDiv.children[rowNum].children[0].innerHTML = \"\";\n leaderboardRowsDiv.children[rowNum].children[1].innerHTML = \"\";\n leaderboardRowsDiv.children[rowNum].children[2].innerHTML = \"\";\n }\n }", "function scoreboard() {\n\n var scoreboard = document.getElementById('scoreboard');\n scoreboard.innerHTML = `${score}pts.`\n if (score >= 150) {\n bugSpray();\n }\n }", "function displayScore() {\n\ttheBoard.context.fillStyle = \"green\";\n\ttheBoard.context.font = \"bold 24px Times\";\n\ttheBoard.context.fillText(\"Score: \" + theBoard.score, 7, 22);\n\ttheBoard.context.fillText(\"Level: \" + theBoard.level, 700, 22);\n}", "function showScore(){\n\tctx.fillStyle=\"black\";\n\tctx.fillRect(CANVAS_WIDTH-250, 10, 190, 40);\n\tctx.fillStyle = \"white\";\n\tctx.font = \"24px monospace\";\n\tctx.textAlign = \"left\";\n\tctx.fillText(\"score: \" + parseInt(score), CANVAS_WIDTH-250, 37);\n}", "function initializeGameBoard() {\n\n var gameBody = document.getElementById(\"canvas\");\n\n gameBody.width = game.width;\n gameBody.height = game.height;\n gameBody.className = \"canvas\";\n\n ctx = gameBody.getContext(\"2d\");\n }", "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 drawScoreBoard(){\r\n context.font = \"Bold 25px Courier New\";\r\n context.fillStyle = \"#000000\";\r\n scoreBoard = cars.slice();\r\n scoreBoard.sort(function(a, b){\r\n return b.score - a.score;\r\n });\r\n for (var i = 0; i < 5; i++) {\r\n if (i > scoreBoard.length -1 ){break;}\r\n if (scoreBoard[i] == null){break;}\r\n var j = i+1\r\n context.fillText(j + \":\" + scoreBoard[i].name+ \": \"+scoreBoard[i].score, 0, 25 + (i*25));\r\n }\r\n}", "display(){\n if(this.lives != 0){\n var newcolor = \"#\";\n var x;\n for(var i=1;i<7;i++){\n x = parseInt(this.color[i],16)\n x += 2;\n if(x>15)\n x = 15;\n newcolor += x.toString(16);\n }\n var ctx = this.gameboard.disp.getContext(\"2d\");\n ctx.beginPath();\n ctx.fillStyle = newcolor;\n ctx.fillRect(this.posx, this.posy, this.sizex, this.sizey);\n ctx.stroke();\n ctx.closePath();\n ctx = this.gameboard.disp.getContext(\"2d\");\n ctx.beginPath();\n ctx.fillStyle = this.color;\n ctx.fillRect(this.posx + this.sizex/10, this.posy + this.sizey/10,this.sizex/10*8,this.sizey/10*8);\n ctx.stroke();\n ctx.closePath();\n }\n }", "displayBoard(tileSize) {\n ctx.strokeStyle = this.boardColor;\n ctx.lineWidth = 10;\n ctx.strokeRect(this.boardBorderLeft, this.boardBorderTop, this.boardBorderSize, this.boardBorderSize);\n\n ctx.lineWidth = 4;\n }", "drawCanvas() {\n\n\t}", "function ScoreboardFG(width, height) {\n CanvasImage.call(this, width, height);\n this.drawnScore = 0;\n}", "function paintBoard() {\n\t\t\tvar wts = BOARD_LENGTH - SPACE_MUL_TWO, hts = BOARD_LENGTH - SPACE_MUL_TWO,\n\t\t\t\ti,\n\t\t\t\tss, hs, ws, baseCode, s3, code, t1;\n\t\t\t// Draw color and lines of the board\n\t\t\tbgContext.beginPath();\n\t\t\tbgContext.fillStyle = \"#D6B66F\";\n\t\t\tbgContext.fillRect(0, 0, BOARD_LENGTH, BOARD_LENGTH);\n\t\t\tfor (i = 1; i < LINE_NUM_ADD_ONE; i += 1) {\n\t\t\t\tbgContext.moveTo(SPACE_MUL_TWO, SPACE * (i + 1));\n\t\t\t\tbgContext.lineTo(wts, SPACE * (i + 1));\n\t\t\t\tbgContext.moveTo(SPACE * (i + 1), SPACE_MUL_TWO);\n\t\t\t\tbgContext.lineTo(SPACE * (i + 1), hts);\n\t\t\t}\n\t\t\tbgContext.stroke();\n\t\t\tbgContext.closePath();\n\n\t\t\t// Draw string of the board \n\t\t\tbgContext.beginPath();\n\t\t\tbgContext.fillStyle = \"black\";\n\t\t\tbgContext.font = \"bold 12px sans-serif\";\n\t\t\tbgContext.textBaseline = \"bottom\";\n\t\t\tss = SPACE + (SPACE * 0.25);\n\t\t\ths = BOARD_LENGTH - (SPACE * 0.5);\n\t\t\tws = BOARD_LENGTH - SPACE;\n\t\t\ts3 = SPACE / 8;\n\t\t\tbaseCode = \"A\".charCodeAt(0);\n\t\t\tfor (i = 1; i < LINE_NUM_ADD_ONE; i += 1) {\n\t\t\t\tcode = baseCode + i - 1;\n\n\t\t\t\tbgContext.fillText(String.fromCharCode(code), SPACE * (i + 0.75), ss);\n\t\t\t\tbgContext.fillText(String.fromCharCode(code), SPACE * (i + 0.75), hs);\n\n\t\t\t\tt1 = SPACE * (i + 1.25);\n\t\t\t\tif (i < 11) {\n\t\t\t\t\tbgContext.fillText(String(20 - i), s3, t1);\n\t\t\t\t\tbgContext.fillText(String(20 - i), ws, t1);\n\t\t\t\t} else {\n\t\t\t\t\tbgContext.fillText(String(20 - i), SPACE_DIVIDE_TWO, t1);\n\t\t\t\t\tbgContext.fillText(String(20 - i), ws, t1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbgContext.closePath();\n\n\t\t}", "function drawScoreImage(value) {\n let imagesize = 75;\n arrayOfScoreBoardImg.push(new Image());\n arrayOfScoreBoardImg[scoreBoardImgCounter].src =\n \"./assets/scoreboard/\" + value + \".png\";\n scoreBoardImage.src = \"./assets/scoreboard/\" + value + \".png\";\n scoreBoardImage.onload = function () {\n ctx.drawImage(\n scoreBoardImage,\n scorePictureXCordinate,\n scorePictureYCordinate,\n imagesize,\n imagesize\n );\n };\n\n scorePictureXCordinate = scorePictureXCordinate + imagesize;\n if (scorePictureXCordinate >= 600 && scorePictureYCordinate < 75) {\n scorePictureYCordinate = 75;\n scorePictureXCordinate = 175;\n } else if (scorePictureXCordinate >= 600 && scorePictureYCordinate == 75) {\n scorePictureYCordinate = 150;\n scorePictureXCordinate = 175;\n } else if (scorePictureXCordinate >= 600 && scorePictureYCordinate == 150) {\n scorePictureYCordinate = 225;\n scorePictureXCordinate = 175;\n } else if (scorePictureXCordinate >= 600 && scorePictureYCordinate == 225) {\n scorePictureYCordinate = 300;\n scorePictureXCordinate = 175;\n } else if (scorePictureXCordinate >= 600 && scorePictureYCordinate == 300) {\n scorePictureYCordinate = 375;\n scorePictureXCordinate = 175;\n }\n scoreBoardImgCounter++;\n}", "function canvasApp()\n{\n var hh = parseInt(BD18.gameBoard.height, 10);\n var ww = parseInt(BD18.gameBoard.width, 10);\n $('#content').css('height', hh); \n $('#content').css('width', ww); \n $('#canvas1').prop('height', hh); \n $('#canvas1').prop('width', ww); \n $('#canvas2').prop('height', hh); \n $('#canvas2').prop('width', ww); \n BD18.canvas0 = document.getElementById('canvas0');\n if (!BD18.canvas0 || !BD18.canvas0.getContext) {\n return;\n }\n BD18.context0 = BD18.canvas0.getContext('2d');\n if (!BD18.context0) {\n return;\n }\n BD18.canvas1 = document.getElementById('canvas1');\n if (!BD18.canvas1 || !BD18.canvas1.getContext) {\n return;\n }\n BD18.context1 = BD18.canvas1.getContext('2d');\n if (!BD18.context1) {\n return;\n }\n BD18.canvas2 = document.getElementById('canvas2');\n if (!BD18.canvas2 || !BD18.canvas2.getContext) {\n return;\n }\n BD18.context2 = BD18.canvas2.getContext('2d');\n if (!BD18.context2) {\n return;\n }\n trayCanvasApp();\n mainCanvasApp();\n toknCanvasApp();\n}", "function initCanvas()\n{\n\n\tcanvas = document.getElementById(\"board\");\n\n\tif(canvas.getContext) {\n\t\tctx = canvas.getContext(\"2d\");\n\t\t\n\t\t//Size the canvas to the screen\n\t\tctx.canvas.width = window.innerWidth - (window.innerWidth % cellSide);\n\t\tctx.canvas.height = ctx.canvas.width;\n\t\t\n\t\tvar width = canvas.width;\n\t\tvar height = canvas.height;\n\t\t\n\t\t//Clear the canvas\n\t\tctx.clearRect(0, 0, width, height);\n\t\t\n\t\t//Set the line color\n\t\tctx.strokeStyle = \"black\";\n\t\tctx.lineWidth = 1;\n\t\t\n\t\tctx.beginPath();\n\t\t//Draw horizontal lines\n\t\tfor(i = cellSide; i < height; i += cellSide)\n\t\t{\n\t\t\tctx.moveTo(0, i);\n\t\t\tctx.lineTo(width, i);\n\t\t}\n\t\t\n\t\t//Draw horizontal lines\n\t\tfor(i = cellSide; i < width; i += cellSide)\n\t\t{\n\t\t\tctx.moveTo(i, 0);\n\t\t\tctx.lineTo(i, height);\n\t\t}\n\t\tctx.stroke();\n\t\tctx.closePath();\n\t}\n\t\n\t\n\t//Initialize the board to being empty\n\tcellXCount = cps; //canvas.width / cellSide;\n\tcellYCount = cps; //canvas.height / cellSide;\n\tboardVals = new Array(cellXCount);\n\t\n\tfor(i = 0; i < cellXCount; i++)\n\t{\n\t\tboardVals[i] = new Array(cellYCount);\n\n\t\tfor(j = 0; j < cellYCount; j++)\n\t\t{\n\t\t\tboardVals[i][j] = 0;\n\t\t}\t\n\t}\t\n\t\n\t//Load the board state\n\tloadBoard();\n}", "function draw(){\r\n\tvar canvas = $('#GameBoardCanvas');\r\n\tif(canvas.width() > window.innerHeight){\r\n\t\t$('#GameBoardCanvas').css(\"width\",(window.innerHeight - 150));\r\n\t\t$('#GameBoardCanvas').css(\"height\",(window.innerHeight - 150));\r\n\t}\r\n\tcanvas.attr(\"width\",canvas.width());\r\n\tcanvas.attr(\"height\",canvas.width());\r\n\tvar width = canvas.width();\r\n\tvar blockSize = width/board.length;\r\n\tconsole.log(\"width:\"+width+\"/board.length:\"+board.length+\"/blockSize:\"+blockSize);\r\n\tvar ctx = canvas[0].getContext('2d');\r\n\tctx.setTransform(1, 0, 0, 1, 0, 0);\r\n\tctx.clearRect(0, 0, width, width);\r\n\tctx.fillStyle=\"white\";\r\n\t//Loop through the board array drawing the walls and the goal\r\n\tfor(var y = 0; y < board.length; y++){\r\n\t\tfor(var x = 0; x < board[y].length; x++){\r\n\t\t\t//Draw a wall\r\n\t\t\tif(board[y][x] === 1){\r\n\t\t\t\tctx.fillRect(x*blockSize, y*blockSize, blockSize, blockSize);\r\n\t\t\t}\r\n\t\t\t//Draw the goal\r\n\t\t\telse if(board[y][x] === -1){\r\n\t\t\t\tctx.beginPath();\r\n\t\t\t\tctx.lineWidth = 5;\r\n\t\t\t\tctx.strokeStyle = \"gold\";\r\n\t\t\t\tctx.moveTo(x*blockSize, y*blockSize);\r\n\t\t\t\tctx.lineTo((x+1)*blockSize, (y+1)*blockSize);\r\n\t\t\t\tctx.moveTo(x*blockSize, (y+1)*blockSize);\r\n\t\t\t\tctx.lineTo((x+1)*blockSize, y*blockSize);\r\n\t\t\t\tctx.stroke();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t//Draw the player\r\n\tctx.beginPath();\r\n\tvar half = blockSize/2;\r\n\tctx.fillStyle = \"#FE5C57\";\r\n\tctx.arc(player.x*blockSize+half, player.y*blockSize+half, half, 0, 2*Math.PI);\r\n\tctx.fill();\r\n}", "function paintBoard() {\n var count = [0, 0];\n var obj = JSON.parse(sessionStorage.board);\n\n for (var i = 0; i < obj.length; i++) {\n if (obj[i].color == 1) {\n var cood = \"#cell\" + obj[i].coordinates.x + \"\" + obj[i].coordinates.y + \"> div.disc\";\n $(cood).removeClass(\"black\");\n $(cood).addClass(\"white\");\n count[0]++;\n }\n else if (obj[i].color == 2) {\n var cood = \"#cell\" + obj[i].coordinates.x + \"\" + obj[i].coordinates.y + \"> div.disc\";\n $(cood).removeClass(\"white\");\n $(cood).addClass(\"black\");\n count[1]++;\n }\n }\n score[0] = count[0];\n score[1] = count[1];\n\n $(\"#score\").html(\"White: \" + score[0] + \" - Black: \" + score[1]);\n\n if (score[0] + score[1] == side * side || score[0] == 0 || score[1] == 0) {\n if (score[0] > score[1]) {\n $(\"#score\").html(\"Score: \" + score[0] + \" - \" + score[1]);\n $(\"#colorTurn\").html(\"White Wins\");\n }\n else if (score[0] < score[1]) {\n $(\"#score\").html(\"Score: \" + score[1] + \" - \" + score[0]);\n $(\"#colorTurn\").html(\"Black Wins\");\n }\n if (score[0] == score[1]) {\n $(\"#score\").html(\"\");\n\n $(\"#colorTurn\").html(\"Game Draw\");\n }\n }\n dropResMatrix();\n}", "function drawFrame() {\n // Draw background and a border\n\n mycanvas.drawRect({\n fillStyle: '#d0d0d0',\n x: 0, y: 0,\n fromCenter: false,\n width: $(mycanvas)[0].width,\n height: $(mycanvas)[0].height\n });\n \n mycanvas.drawRect({\n fillStyle: '#e8eaec',\n x: 1, y: 1,\n fromCenter: false,\n width: $(mycanvas)[0].width-2,\n height: $(mycanvas)[0].height-2\n \n \n });\n// Draw header\n// mycanvas.drawRect({\n// fillStyle: '#303030',\n// x: 0, y: 0,\n// fromCenter: false,\n// width: $(mycanvas)[0].width,\n// height: 65,\n// \n// \n// });\n// \n // Draw title\n// mycanvas.drawText({\n// fillStyle: \"#ffffff\",\n// fontFamily: 'Verdana',\n// text: \"Match3 Example - Rembound.com\", \n// fontSize: 24,\n// x:220,y:15, \n// });\n \n \n // Display fps\n \n// mycanvas.drawText({\n// fillStyle: \"#ffffff\",\n// fontFamily: 'Verdana',\n// text: \"Fps \" + fps, \n// fontSize: 18,\n// x:45,y:50, \n// });\n\n \n }", "refreshBoard() {\n this.Canvas.clearLayer(this.Canvas.layerContexts[0], this.Canvas.layerElements[0]);\n this.Canvas.drawListOfForms(this.Canvas.layerContexts[0], this.generateSnakeForm());\n }", "function drawScore() {\n if (cnvsWidth <= 600) {\n ctx.font = \"4vw Orbitron, sans-serif\";\n } else {\n ctx.font = \"2vw Orbitron, sans-serif\";\n }\n ctx.strokeText(\"SCORE:\" + score, 10, cnvsHeight - 10);\n ctx.strokeStyle = \"rgba(252, 252, 252, 0.486)\";\n}", "displayScore(score, tileSize) {\n ctx.fillStyle = \"white\";\n ctx.fillRect(0, 0, this.rightBoundary, this.upperBoundary);\n\n ctx.fillStyle = this.scoreColor;\n ctx.font = this.scoreFont;\n ctx.fillText(\"score : \" + score, this.leftBoundary, this.leftBoundary);\n }", "function Board() {\n //2. Posición y medidas del board\n this.x = 0;\n this.y = 0;\n this.width = canvas.width;\n this.height = canvas.height;\n\n //2. Imagen de fondo\n this.img = new Image();\n this.img.src = \"images/bg.png\";\n\n //agregar score\n this.score = 0;\n\n //3. Mover infinitamente el fondo\n this.move = function() {\n this.x--;\n //resetea cuando se acabe x\n if (this.x < -canvas.width) this.x = 0;\n }\n\n //2. onload por si la imagen pesa mucho, tenerla lista antes\n this.img.onload = function() {\n this.draw();\n }.bind(this);\n\n\n //2. método para dibujar la clase\n this.draw = function() {\n //3.ejecutar mover para que se dibuje en otra posición\n this.move();\n ctx.drawImage(this.img, this.x, this.y, this.width, this.height);\n //dibujar segunda para cubir hoyos ******\n ctx.drawImage(this.img, this.x + canvas.width, this.y, this.width, this.height);\n //muevo, dibujo, muevo\n }\n\n this.drawScore = function() {\n //sacar segundos\n this.score = Math.floor(frames / 60);\n ctx.font = \"50px courier\";\n ctx.fillStyle = \"peru\";\n ctx.fillText(this.score, this.width / 2, this.y + 50);\n }\n\n this.drawFinalScore = function() {\n //sacar segundos\n this.score = Math.floor(frames / 60);\n ctx.font = \"70px courier\";\n ctx.fillStyle = \"peru\";\n ctx.fillText(this.score, 425, 325);\n }\n}", "function drawScore() {\r\n if (cnvsWidth <= 600) {\r\n ctx.font = \"4vw Orbitron, sans-serif\";\r\n } else {\r\n ctx.font = \"2vw Orbitron, sans-serif\";\r\n }\r\n ctx.strokeText(\"SCORE:\" + score, 10, cnvsHeight - 10);\r\n ctx.strokeStyle = \"rgba(252, 252, 252, 0.486)\";\r\n}", "function draw() {\n background(0);\n\n displayScores();\n\n moveClickable();\n displayClickable();\n}", "function drawScore() {\r\n c.font = '20px Arial';\r\n c.fillText(`Score: ${score}`, canvas.width - 100, 30);\r\n}", "display() {\n // game title\n this.canvas[1].font = \"30px Arial\";\n this.canvas[1].fillText('Classic Arcade Game',10,40);\n this.canvas[1].font = \"20px Arial\";\n this.canvas[1].fillText('- build with ECMAScript 6',10,65);\n this.canvas[1].fillText('- Game Engine by Raghavendra Mani',220,this.canvas[0].height-10);\n // game status\n this.canvas[1].font = \"20px Arial\";\n this.canvas[1].fillText('Active Monsters: '+this.activeEnemies.length,this.canvas[0].width*0.6,25);\n this.canvas[1].fillText('Game status: '+this.status(),this.canvas[0].width*0.6,50);\n this.canvas[1].fillText('Moves: '+this.score,this.canvas[0].width*0.6,75);\n this.canvas[1].fillText('Tries: '+this.tries,this.canvas[0].width*0.8,75);\n // game instructions\n this.instructions();\n // warning messages\n this.warning();\n }", "function board_paint() {\r\n\tvar x,y,div;\r\n\t//using clientWidth and clientHeight for IE8 and earlier\r\n\tconst H = window.innerHeight/MAX_ROWS || \r\n\t\t document.documentElement.clientHeight/MAX_ROWS ||\r\n\t\t document.body.clientHeight/MAX_ROWS;\r\n\t// loop:\r\n\tfor (y = 1; y <= MAX_ROWS; y++) {\r\n\t\tfor (x = 1; x <= MAX_COLS; x++) {\r\n\t\t\tdiv = $(\"<div>\");\r\n\t\t\tdiv.addClass('gameCell btn btn-primary col-xs-4 spot');\r\n\t\t\tdiv.css({'height': H,'display': 'flex','align-items': 'center','justify-content': 'center'});\r\n\t\t\tdiv.attr('id',y+'-'+x);\r\n\t\t\tdiv.attr('value',0);\r\n\t\t\t$(\"#gameBoard\").append(div);\r\n\t\t}\r\n\t}\r\n}", "function initialiseLeaderboard() {\n //playEndSound();\n uploadScore();\n ctx.fillStyle = brandColor;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n Leaderboard();\n addButton();\n renderLeaderboardButtons();\n addLeaderboardEventListeners();\n getLeaderboard();\n leaderboardInitialised = true;\n}", "drawScore() {\n\t\tthis.ctx.font = '500 16px Noto Sans JP';\n\t\tthis.ctx.fillStyle = 'white';\n\t\tthis.ctx.fillText(`Score : ${this.score}`, 10, 30);\n\t\tthis.ctx.fillText(`Highest Score : ${this.highestScore}`, 150, 30);\n\t}", "function newGame(){\n widthIn = document.getElementById(\"widthInput\");\n heightIn = document.getElementById(\"heightInput\");\n\n WIDTH = widthIn.value;\n HEIGHT = heightIn.value;\n\n canvas.height = (ROW_WIDTH + SPACE) * HEIGHT + SPACE;\n canvas.width = (COL_WIDTH + SPACE) * WIDTH + SPACE;\n\n SCORE = 0;\n \n GAME = [];\n for(var i=0; i<HEIGHT; i++){\n var rowGen = [];\n for(var j=0; j<WIDTH; j++){\n rowGen.push(0);\n }\n GAME.push(rowGen);\n }\n add();\n showGame();\n}", "function showWhiteboard()\n {\n activeStroke = null;\n mode = 1;\n boardMode = true;\n\n // set container to board mode\n container.style.pointerEvents = \"auto\";\n container.style.overflowX = \"hidden\";\n container.style.overflowY = \"scroll\";\n\n // show board, adjust height, re-draw scribbles\n drawingCanvas[1].canvas.style.visibility = \"visible\";\n adjustWhiteboardHeight();\n playbackEvents(1);\n }", "function preparaCanvas()\n{\n div = document.getElementById(\"lifegameBoard\");\n c.width = (cellsize + 1) * numeroColonne + 2;\n c.height = (cellsize + 1) * numeroRighe + 2;\n\n ctx.beginPath();\n disegnaCampo(\"#657b83\")\n ctx.stroke();\n div.appendChild(c);\n\n}", "function initDraw()\n{\n\t/* Resize */\n\tboardCanvas.width = WIDTH;\n\tboardCanvas.height = HEIGHT;\n\n\tboardCanvas.offset = new vector(0,0);\n\n//\tviewCanvas.width = WIDTH;\n//\tviewCanvas.height = HEIGHT;\n\n\tviewCanvas.offset = new vector(0,0);\n\n\ttitleImg = loadImage(\"images/PhysEd.png\");\n\tbgImage = loadImage(\"images/dropman.png\");\n\tplatformImg = loadImage(\"images/ground_grass.png\");\n\tplatformCloudImg = loadImage(\"images/platform_cloud.png\");\n\tplatformTreeImg = loadImage(\"images/platform_tree.png\");\n\tplatformBWImg = loadImage(\"images/ground_grass_bw.png\");\n\tgymFloorImg = loadImage(\"images/gym_floor.png\");\n\tgroundImg = platformImg; /* init */\n\t\n\tpineappleImg = loadImage(\"images/pineapple.png\");\n\tdoorImg = loadImage(\"images/door.png\");\n\tballImg = loadImage(\"images/dodgeball2.png\");\n\trockImg = loadImage(\"images/rock1.png\");\n\tsammyImg = loadImage(\"images/sammy1.png\");\n\t\n\t/* background images */\n\ttreeImg = loadImage(\"images/tree.png\");\n\t\n\tvar tempImg = loadImage(\"images/dropman_right.png\");\n\ttempImg = loadImage(\"images/dropman_left.png\");\n\n\tframeCount = 0;\n}", "function renderScreen()\r\n{\r\n\t// draw canvas\r\n\tfor(var i = 0; i < worms.length; i++)\r\n\t{\r\n\t\tif(players[i] && worms[i].score > maxScore)\r\n\t\t{\r\n\t\t\trenderWorm(worms[i]);\r\n\t\t\t//maxScore = worms[i].score;\r\n\t\t}\r\n\t}\r\n}", "function draw() {\n\t\n\t//checks width and height of grid sections\n\tvar tw = canvas.width/grid.w;\n\tvar th = canvas.height/grid.h;\n\t\n\t//draws in sections of grid\n\tfor (var x=0; x < grid.w; x++) {\n\t\tfor (var y=0; y < grid.h; y++) {\n\t\t//checks grid section for proper fill\n\t\t\tswitch (grid.get(x, y)) {\n\t\t\t\tcase emptyFill:\n\t\t\t\t\tctx.fillStyle = \"#ff0000\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase snakeFill:\n\t\t\t\t\tctx.fillStyle = \"#000000\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase foodFill:\n\t\t\t\t\tctx.fillStyle = \"#00ff00\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\tctx.fillRect(x*tw, y*th, tw, th);\n\t\t}\n\t}\n\n\t//draws score\n\tctx.fillStyle = \"#000000\";\n\tctx.fillText(\"Score: \" + score, 10, canvas.height-10);\n}", "function drawGameArea() {\n // Clear the canvas below the 'Top Data Bar'\n ctx.clearRect(0, 20, canvas.width, 480);\n // Set the fill colour to black with 50% ocpacity\n ctx.fillStyle = \"rgba(0, 0, 0, 0.5)\";\n // Draw a rectangle for the next piece area\n ctx.fillRect(0, 20, 150, 170);\n // Set the font for text\n ctx.font=\"15px Arial\";\n // set the colour of the text to pure black\n ctx.fillStyle = \"rgb(0,0,0)\";\n // Draw the text 'Next Piece' in the next piece box \n ctx.fillText(\"Next Piece:\", 5, 35);\n // Set the fill colour to black with 50% ocpacity\n ctx.fillStyle = \"rgba(0, 0, 0, 0.5)\";\n // Draw a rectangle for the main game area\n ctx.fillRect(150, 20, 400, 500);\n // Draw Main game area vertical grid\n for (var i=150; i<550; i+=25) {\n ctx.beginPath();\n ctx.moveTo(i,20);\n ctx.lineTo(i,520);\n ctx.stroke();\n }\n\n // Draw Main game area horizontal grid\n for (var i=20; i<520; i+=25) {\n ctx.beginPath();\n ctx.moveTo(150,i);\n ctx.lineTo(550,i);\n ctx.stroke();\n }\n\n // Draw Sidebar Logo\n ctx.drawImage(sidebarLogo, 0, 190);\n\n // draw any blocks that exist on to the main game area\n drawTetrominosOnBoard();\n\n}", "draw(){\n this._context.fillStyle = '#000';\n this._context.fillRect(0, 0, canvas.width, canvas.height);\n \n // draw ball and players\n this.drawRectangle(this.ball) \n this.players.forEach(player => this.drawRectangle(player));\n\n //draw score\n this.drawScore();\n }", "function buildMessageBoard() {\n //message board at bottom of screen, above the floor where paddel rests\n board = new createjs.Shape();\n board.graphics.beginFill('#333')\n .drawRect(0, 0, canvas.width, config.Game.SCORE_BOARD_HEIGHT);\n board.y = canvas.height - config.Game.SCORE_BOARD_HEIGHT;\n stage.addChild(board);\n //lives text\n livesTxt = new createjs.Text('lives: ' + lives, '20px Times', '#fff');\n livesTxt.y = board.y + 10;\n livesTxt.x = config.Game.WALL_THICKNESS;\n stage.addChild(livesTxt);\n //score text\n scoreTxt = new createjs.Text('score: ' + score, '20px Times', '#fff');\n scoreTxt.textAlign = 'right';\n scoreTxt.y = board.y + 10;\n scoreTxt.x = canvas.width - config.Game.WALL_THICKNESS;\n stage.addChild(scoreTxt);\n //message text\n messageTxt = new createjs.Text('press spacebar to pause', '18px Times', '#fff');\n messageTxt.textAlign = 'center';\n messageTxt.y = board.y + 10;\n messageTxt.x = canvas.width / 2;\n stage.addChild(messageTxt);\n }", "displayScore() {\n this.ctx.font = '40px Arial';\n this.ctx.fillStyle = '#fff';\n this.ctx.fillText(`${this.score1}`, 10, 340);\n\n this.ctx.font = '40px Arial';\n this.ctx.fillStyle = '#fff';\n this.ctx.fillText(`${this.score2}`, 10, 440);\n }", "function draw () {\n background(51)\n fill(255)\n text('Board size', sizeSlider.x, sizeSlider.y - sizeSlider.height)\n board.draw()\n}", "function drawBoard()\r\n {\r\n //horizontal lines on board \r\n //40 is the size of each block on board \r\n for (var x = 0; x <= boardWidth; x += 40) {\r\n //x & y corrdinates on drawing -- each block in loop + margin until the margin on the other side of canvas\r\n context.moveTo(x + p, p);\r\n //what draws the lines\r\n context.lineTo(x + p, boardHeight + p);\r\n }\r\n //vertical lines on board\r\n for (var x = 0; x <= boardHeight; x += 40) {\r\n context.moveTo(p, x + p);\r\n context.lineTo(boardWidth + p,x + p);\r\n }\r\n //sets the color \r\n context.strokeStyle = \"#7247FF\";\r\n //actually draws the above defines lines \r\n context.stroke();\r\n }", "function createBoard() {\n // How big can each square be?\n // Add 2 to allow for one square's worth of padding on either side\n var squareWidth = Math.round(window.innerWidth / (totalCols + 2));\n console.log(\"width: \" + squareWidth);\n var squareHeight = Math.round(window.innerHeight / (totalRows + 2));\n console.log(\"height: \" + squareHeight);\n\n // Choose the smaller of the two dimensions so both height and width\n // will fit in the viewport and still be a square\n var bestDimension = Math.min(squareWidth, squareHeight);\n console.log(\"Squares should be: \" + bestDimension);\n\n\n // store the board div in a variable\n var gameBoardDiv = $(\"#board\");\n\n // loop to print rows of squares\n for (var rowNum = 1; rowNum <= totalRows; rowNum++) {\n // Create a new row\n var rowOfSquares = $(\"<div>\");\n // give the row the class of \"row\" (for Bootstrap)\n rowOfSquares.addClass(\"row justify-content-center\");\n // add the row to the gameboard\n gameBoardDiv.append(rowOfSquares);\n\n // loop to print the squares in each row\n for (var colNum = 1; colNum <= totalCols; colNum++) {\n // create an empty element to be a square on the board\n var square = $(\"<span>\");\n // give the square its row number as data\n square.data(\"row\", rowNum);\n // give the square its column number as data\n square.data(\"col\", colNum);\n // set the width and height of the square\n square.width(bestDimension);\n square.height(bestDimension);\n // give the square the class of \"square\" to make it inline-block\n square.addClass(\"square\");\n // display the square's row and column info\n // square.html(`Row ${rowNum}<br>Col ${colNum}`); //don't need\n // make the square run a function when clicked\n square.click(humanPlayerTurn);\n // color of the squares\n square.css(\"background-color\", \"grey\");\n\n // add the square to the current row\n rowOfSquares.append(square);\n }\n }\n }", "function drawGUI(){\n highScore = \"10\"\n leftPadding = 10\n topPadding = 20\n spacing = 20\n\n canvasContext.font = \"20px Open Sans\";\n canvasContext.fillText(\n \"Arrows Fired: \" + arrowsFired, leftPadding, topPadding);\n canvasContext.fillText(\n \"Score: \" + score, leftPadding, topPadding + spacing);\n canvasContext.fillText(\n \"High Score: \" + highScore, leftPadding, topPadding + spacing * 2);\n}", "function switchToGameBoard(){\n\tremoveMenu();\n\tshowColorSchemeButtons();\n\t// Change canvas size\n\tg_canvasWidth = g_canvasHtmlElement.width = window.innerWidth;\n\tg_canvasHeight = g_canvasHtmlElement.height = window.innerHeight;\n}", "function initializeBoard () { // Initialisiere Board\n\ninitializeCanvas();\ninitializeLasers();\ntimerId = setInterval(drawMaxima, 1000/60);\n\n}", "function drawEverything() {\n //background black\n colorRect(0, 0, canvas.width, canvas.height, \"black\");\n //Winner Screen\n if (showWinScreen) {\n ctx.fillStyle = \"white\";\n ctx.font = `25px \"${fontName}\"`;\n ctx.fillText(\"Click here to Play Again\", 100, 400);\n if (playerOneScore >= winningScore) {\n ctx.fillText(\"Winner You Are!!!\", 100, 200);\n } else if (playerTwoScore >= winningScore) {\n ctx.fillText(\"Winner You Are Not!!!\", 100, 200);\n }\n return;\n }\n //draw net\n drawNet();\n //left paddle\n colorRect(10, paddleOneY, paddleThickness, paddleHeight, \"white\");\n //right paddle (computer)\n colorRect(\n canvas.width - paddleThickness - 10,\n paddleTwoY,\n paddleThickness,\n paddleHeight,\n \"white\"\n );\n //ball\n colorCircle(ballX, ballY, 10, \"red\");\n //score keeper\n ctx.font = `20px \"${fontName}\"`;\n ctx.fillText(playerOneScore, 100, 100);\n ctx.fillText(playerTwoScore, canvas.width - 100, 100);\n ctx.font = \"10px 'Press Start 2P'\";\n ctx.fillText(\"Instructions:\", 40, 540);\n ctx.fillText(\"Move mouse to control left paddle\", 40, 560);\n ctx.fillText(\"First to 3 points wins\", 450, 560);\n}", "function animate(){\n // loop= window.requestAnimationFrame(animate) //continues the loop\n // score++\n // scoreboard.innertext = score;\n frameId=window.requestAnimationFrame(animate)\n ctx.clearRect(0,0,canvas.width,canvas.height) //clears the whole canvas\n drawBoard()\n drawLine()\n drawObstacle() //redraws\n drawCar() \n checkGameOver() //redraws\n}", "function drawBoard() {\n w = Math.round(boardDiv.width());\n h = Math.round(boardDiv.height());\n ctx.clearRect(0,0,w,h);\n\n const margin = 10;\n const thickness = 2;\n const shapeH = 100;\n const shapeW = 2*shapeH;\n\n let cw = Math.round(card.w);\n let ch = Math.round(card.h());\n let pad = Math.round(card.pad());\n\n let posX = card.posX(0);\n let posY = card.posY(0);\n\n $(\".card\").remove();\n\n for (let row=0; row<board.h; row++) {\n for (let col=0; col<board.w; col++) {\n let x = Math.round(posX[col]);\n let y = Math.round(posY[row]);\n let i = card.rowcol2i(row,col);\n\n if (i >= board.inPlayMain.length) {\n break;\n }\n drawCard(ctx, x,y, x+cw, y+ch, card.thickness, board.inPlayMain[i]);\n\n $(\"#div_game\").append($(buildDiv(x,y,cw,ch,i,false)));\n }\n }\n\n let f = Math.round(card.posExtra(0,0));\n let l = undefined, x = undefined, y = undefined;\n if (board.w == 4) {\n l = posY;\n } else {\n l = posX\n }\n for (let k=0; k<board.inPlayExtra.length; k++) {\n if (board.w == 4) {\n x = f;\n y = Math.round(l[k]);\n } else {\n x = Math.round(l[k]);\n y = f;\n }\n drawCard(ctx, x, y, x+cw, y+ch, card.thickness, board.inPlayExtra[k]);\n\n $(\"#div_game\").append($(buildDiv(x,y,cw,ch,k,true)));\n }\n\n if (isSetAvailable()) {\n log(\"A set is available / \" + board.deck.length + \" cards unseen\");\n } else {\n log(\"A set is not available / your score: \" + String((81-(board.deck.length+board.inPlayExtra.length+board.inPlayMain.length))/3));\n }\n}", "function drawScoreBar () {\r\n // Score Bar Background\r\n rect(0, 0, cnv.width, 50, \"black\", \"fill\");\r\n // Score Text\r\n ctx.font = \"30px Arial\";\r\n ctx.fillStyle = \"white\";\r\n ctx.fillText(\"Score: \" + score, 10, 35);\r\n // Best Score Text\r\n ctx.font = \"30px Arial\";\r\n ctx.fillStyle = \"white\";\r\n ctx.fillText(\"Best Score: \" + bestScore, 580, 35);\r\n}", "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 start(){\n canvas = document.createElement(\"canvas\");\n canvas.width = 400;\n canvas.height = 630;\n canvas.id = \"canvas\";\n canvas.style.border = \"#000000 1pt solid\";\n document.body.appendChild(canvas);\n retrieveHighScore();\n gameMenu();\n}", "_drawFrame () {\n \n\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)\n for (let x = 0; x < this.sizeX; x++) {\n for (let y = 0; y < this.sizeY; y++) {\n if (this.matrix[x][y] === -1) {\n this._drawBackgroundSquare(x, y, this.tileWidth, this.deathTileColor)\n this.matrix[x][y] = 0\n } else if (this.matrix[x][y] === 1) {\n this._drawSquare(x, y, this.tileWidth, this.tileColor)\n }\n }\n }\n this._drawMouse()\n }", "function init() {\n canvas = $(\"#board\").get(0);\n ctx = canvas.getContext(\"2d\");\n boardDiv = $(\"#div_game\");\n\n for (let color of [cRed, cGreen, cPurple]) {\n for (let shape of [sDiamond, sWave, sOval]) {\n for (let fill of [fEmpty, fPartial, fSolid]) {\n for (let count of [1, 2, 3]) {\n //console.log(count + \" \" + color + \" \" + fill + \" \" + shape);\n board.deck.push({color: color, shape: shape, fill: fill, count: count});\n }\n }\n }\n }\n shuffle(board.deck);\n\n while (board.inPlayMain.length < 12) {\n board.inPlayMain.push(board.deck.pop());\n console.log(\"Board now has \" + board.inPlayMain.length + \" inPlayMain\");\n }\n\n if (!isSetAvailable()) {\n needExtraCards();\n }\n\n resizedWindow();\n drawBoard();\n\n //canvas.onclick = clickedBoard;\n}", "_addCanvas() { // add canvas will add a track to the screen by changing the CSS of div elements and buttons, can add up to 4 tracks\n if (this.numberOfCanvases == 1) { // set up canvas context for visualizer\n this.canvasContainer = document.getElementById('canvasContainer1');\n this.canvas = document.getElementById('canvas1');\n this.canvasCtx = this.canvas.getContext(\"2d\");\n this.canvasOffset = 55;\n this.numberOfTracks = 0;\n this.canvas.classList.remove(\"canvas3\");\n this.canvas.classList.add(\"canvas1\");\n this.canvasContainer.classList.remove(\"canvas-container3\");\n this.canvasContainer.classList.add(\"canvas-container1\");\n } else if (this.numberOfCanvases == 2) {\n this._greyCanvas();\n this.canvasContainer = document.getElementById('canvasContainer2');\n this.canvas = document.getElementById('canvas2');\n this.canvasCtx = this.canvas.getContext(\"2d\");\n this.canvasOffset = 55;\n this.numberOfTracks = 0;\n this.canvas.classList.remove(\"canvas3\");\n this.canvas.classList.add(\"canvas1\");\n this.canvasContainer.classList.remove(\"canvas-container3\");\n this.canvasContainer.classList.add(\"canvas-container1\");\n } else if (this.numberOfCanvases == 3) {\n this._greyCanvas();\n this.canvasContainer = document.getElementById('canvasContainer3');\n this.canvas = document.getElementById('canvas3');\n this.canvasCtx = this.canvas.getContext(\"2d\");\n this.canvasOffset = 55;\n this.numberOfTracks = 0;\n this.canvas.classList.remove(\"canvas3\");\n this.canvas.classList.add(\"canvas1\");\n this.canvasContainer.classList.remove(\"canvas-container3\");\n this.canvasContainer.classList.add(\"canvas-container1\");\n } else if (this.numberOfCanvases == 4) {\n this._greyCanvas();\n this.canvasContainer = document.getElementById('canvasContainer4');\n this.canvas = document.getElementById('canvas4');\n this.canvasCtx = this.canvas.getContext(\"2d\");\n this.canvasOffset = 55;\n this.numberOfTracks = 0;\n this.canvas.classList.remove(\"canvas3\");\n this.canvas.classList.add(\"canvas1\");\n this.canvasContainer.classList.remove(\"canvas-container3\");\n this.canvasContainer.classList.add(\"canvas-container1\");\n }\n }", "function create_game_board(){\n update_number_of_players();\n create_player_areas();\n // create new game\n game_instance.deal_cards();\n \n render_cards();\n apply_card_event_handlers();\n \n game_instance.determine_winners();\n // determine_winners();\n // show_best_hands(); //for diagnostics\n }", "function drawScore() {\n ctx.font = '16px ' + gameFont;\n ctx.fillStyle = '#0095DD';\n ctx.fillText(`Score: ${score}`, 8, 20) // score + scoreboard x, y\n}", "function draw() {\n if (playGame === \"P\") {\n\n\n //put backcground image\n background(hauntedImage);\n\n\n //put in all the things the predators need to do\n for (let i = 0; i < predatorGroup.length; i++) {\n predatorGroup[i].handleInput();\n predatorGroup[i].move();\n predatorGroup[i].handleEating(preyGroup[0]);\n predatorGroup[i].handleEating(preyGroup[1]);\n predatorGroup[i].handleEating(preyGroup[2]);\n predatorGroup[i].display();\n\n }\n //put all needed for prey to excit\n for (let i = 0; i < preyGroup.length; i++) {\n preyGroup[i].move();\n preyGroup[i].display();\n\n }\n\n //put scoreboard in display\n //replace with the array group\n scoreBoard.updateScores(predatorGroup[0].score, predatorGroup[1].score, predatorGroup[2].score);\n scoreBoard.display();\n //display gameover\n checkGameOver();\n // display start page\n } else if (playGame === \"S\") {\n startScreen.display();\n\n\n }\n //add a gameover page in diplay\n else if (playGame === \"E\") {\n endScreen.display();\n\n }\n}", "function survivalBoard(){\n\tcontext2D.strokeStyle = spawner.strokeColor;\n\tcontext2D.beginPath();\n\tcontext2D.arc(spawner.x, spawner.y, spawner.radius, 0, Math.PI * 2);\n\tcontext2D.stroke();\n\tspawnTime();\n\tcontext2D.closePath();\n\n\tcontext2D.fillStyle = '#2ecc71';\n\tcontext2D.font = '10px Arial';\n\tcontext2D.fillText('Score: ' + score,\n\t\tcanvas.width - context2D.measureText('Score:' + score).width - 5, 10);\n}", "function score()\n{\n c.font = \"20px Arial\" ;\n c.beginPath();\n c.fillStyle = \"black\"; \n c.fillText(\"SCORE :\",27 * canvas.width / 30,canvas.height / 10)\n c.fillText(Math.ceil(deep.score),29 * canvas.width / 30,canvas.height / 10);\n c.closePath();\n}", "function Board(){\n this.x = 0;\n this.y = 0;\n this.width =canvas.width;\n this.height=canvas.height;\n this.img = new Image ();\n this.img.src = \"http://ellisonleao.github.io/clumsy-bird/data/img/bg.png\";\n this.score = 0;\n this.music = new Audio();\n this.music.src = \"assets/audio.mp3\";\n this.alerta = new Audio();\n this.alerta.src = \"assets/alerta.mp3\";\n //metodo principal de cualquier clase es el metodo draw\n this.draw = function(){\n this.move();\n ctx.drawImage(this.img, this.x,this.y,this.width,this.height);\n //segunda imagen, la x de la primer imagen mas el ancho del canvas para que aparezca detras de la primer imagen\n ctx.drawImage(this.img, this.x + canvas.width, this.y,this.width,this.height);\n //cambiar el estilo del texto\n this.drawScore= function(){\n this.score = Math.floor(frames/60);\n ctx.font = \"50px Avenir\";\n ctx.fillStyle = \"orange\";\n ctx.fillText(this.score,this.width/2, this.y+50);\n\n }\n \n }\n //dibuja imagen, origen de imagen (x,y), ancho de imagen(ancho del canvas)\n //se usa el this para no tener que cambiar cada propiedad por separado\n //si una funcion tiene dos puntos requiere bind() porque esta en el siguiente nivel de la funcion\n //si se trabaja en otro nivel se requiere el bind()\n this.img.onload = function(){\n //llama la funcion this.draw() una vez que la imagen carga(por peso)\n this.draw();\n }.bind(this)\n//para mover el fondo, se usan dos imagenes una reemplaza a la otra una vez que se a desplazado\n this.move = function(){\n this.x --;\n if(this.x < -canvas.width) this.x = 0;\n }\n \n}", "function draw(){\r\n ctx.fillStyle = '#70c5ce';\r\n ctx.fillRect(0, 0, cWidth, cHeight);\r\n bg.draw();\r\n pipes.draw();\r\n fg.draw();\r\n kca.draw();\r\n bird.draw();\r\n getReady.draw();\r\n gameOver.draw();\r\n score.draw();\r\n \r\n\r\n}", "function scene1() {\n background(backdrop);\n image(player, cx, cy, cr, cr);\n cx += (targetX - cx) * easing;\n cy += (targetY - cy) * easing;\n\n //all butterflies \n\n //other butterdlies \n for (let i = 0; i < bubbles.length; i++) {\n bubbles[i].move();\n bubbles[i].show();\n }\n \n // score board!\n fill('#03a9f4');\n textSize(50);\n textFont('Impact');\n text(\"Score: \" + score, 10, 45);\n\n\n}", "showResult(ctx) {\n\t\tctx.drawImage(ASSET_MANAGER.getAsset(\"./sprites/end game GUI.png\"), 150, 150);\n\t\tctx.font = \"30px Arial\";\n\t\tctx.fillText((\"Score: \" + this.score), 200, 225);\n\t\tctx.fillText((\"Highest combo: \" + this.highestCombo), 200, 275);\n\t\tctx.stroke();\n }", "function render() {\n /* This array holds the relative URL to the image used\n * for that particular row of the game level.\n */\n var rowImages = [\n 'images/water-block.png', // Top row is water\n 'images/stone-block.png', // Row 1 of 3 of stone\n 'images/stone-block.png', // Row 2 of 3 of stone\n 'images/stone-block.png', // Row 3 of 3 of stone\n 'images/grass-block.png', // Row 1 of 2 of grass\n 'images/grass-block.png' // Row 2 of 2 of grass\n ],\n numRows = 6,\n numCols = 5,\n row, col;\n\n /* Loop through the number of rows and columns we've defined above\n * and, using the rowImages array, draw the correct image for that\n * portion of the \"grid\"\n */\n for (row = 0; row < numRows; row++) {\n for (col = 0; col < numCols; col++) {\n /* The drawImage function of the canvas' context element\n * requires 3 parameters: the image to draw, the x coordinate\n * to start drawing and the y coordinate to start drawing.\n * We're using our Resources helpers to refer to our images\n * so that we get the benefits of caching these images, since\n * we're using them over and over.\n */\n ctx.drawImage(Resources.get(rowImages[row]), col * 101, row * 83);\n }\n }\n\n // draw the static background for the scoreboard\n scoreboardBG.draw(ctx, 0, 0);\n // draw the dynamic content (foreground) for the scorebord \n scoreboardFG.draw(ctx, 400, 5);\n // render the player and enemies\n renderEntities();\n\n // if the game is over, show the result screen\n if ( gameState === \"showResult\" )\n {\n // draw the results screen\n resultsScreen.draw(ctx, 0, 0);\n }\n }", "function arcade(){\n \n //----------- SCORE SLIDE -------------//\n $('#hiScoreButton').click(function(){\n $('#scoreDiv').slideToggle(500);\n $('.gameRow').slideToggle(500);\n });\n \n //----------- GAMESCREEN SLIDE -------------//\n $('.roomSelect .roomSelectButton').click(function(){\n console.log('SHOW GAME SCREEN');\n $('.gameRow').slideDown(500);\n });\n \n //----------- TUTORIAL SCREEN -------------//\n drawTutorial();\n \n //----------- SCORES -------------//\n var scoreBoard = new ScoreList();\n \n //----------- ROOM SELECT & LOAD ASSETS -------------//\n $('.roomSelect li').on('click', function(){\n var room = \"room\";\n var index = $(this).index();\n roomIndex = room.concat(index);\n socket.emit('roomSelect', roomIndex);\n createQueue();\n $('.roomSelectRow').slideToggle(500);\n });\n //player assign\n socket.on('playerNum', function(number){\n console.log('DEBUG: Player SPRITE', number);\n });\n\t\n\t//---------- CREATE JS ----------//\n var canvas = document.getElementById('myCanvas');\n context = canvas.getContext('2d');\n context.canvas.width = WIDTH; \n context.canvas.height = HEIGHT;\n stage = new createjs.Stage(\"myCanvas\");\n \n //---------- SOCKET EVENTS ----------//\n socket.on('playerComm', function(data){\n socketPlayerComm(data);\n });\n socket.on('gameInstance',function(gameInfo){\n socketGameComm(gameInfo);\n });\n \n //---------- PLAYER LEAVE ----------//\n window.addEventListener(\"beforeunload\", function () {\n \t\tsocket.emit('userLeave');\n\t});\n}", "function refresh_view(){\n\t//draw the board, color tokens as appropriate\n\tctx.fillStyle = \"#000\";\n\tctx.beginPath();\n\tctx.rect(0, 0, config.square_size*config.grid_size+(config.offset*2), config.square_size*config.grid_size+(config.offset*2));\n\tctx.closePath();\n\tctx.fill();\n\tfor(var i=0;i<config.grid_size;i++){\n\t\tfor(var j=0;j<config.grid_size;j++){\n\t\t\tif(grid[i][j] == undefined){\n\t\t\t\t//empty\n\t\t\t\tctx.fillStyle = \"#fff\";\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.rect(i*config.square_size+config.offset, j*config.square_size+config.offset, config.square_size-1, config.square_size-1);\n\t\t\t\tctx.closePath();\n\t\t\t\tctx.fill();\n\t\t\t\tctx.fillStyle = \"#000\";\n\t\t\t\tctx.stroke();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(grid[i][j].player == 1){\n\t\t\t\t//player 1\n\t\t\t\tswitch(grid[i][j].life){\n\t\t\t\t\tcase 5:\n\t\t\t\t\t\tctx.fillStyle = \"#F00\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\tctx.fillStyle = \"#F33\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tctx.fillStyle = \"#F66\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tctx.fillStyle = \"#F99\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tctx.fillStyle = \"#FCC\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tctx.fillStyle = \"#FFF\";\n\t\t\t\t}\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.rect(i*config.square_size+config.offset, j*config.square_size+config.offset, config.square_size-1, config.square_size-1);\n\t\t\t\tctx.closePath();\n\t\t\t\tctx.fill();\n\t\t\t\tctx.fillStyle = \"#000\";\n\t\t\t\tctx.stroke();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(grid[i][j].player == 2){\n\t\t\t\t//player2\n\t\t\t\tswitch(grid[i][j].life){\n\t\t\t\t\tcase 5:\n\t\t\t\t\t\tctx.fillStyle = \"#0F0\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\tctx.fillStyle = \"#3F3\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tctx.fillStyle = \"#6F6\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tctx.fillStyle = \"#9F9\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tctx.fillStyle = \"#CFC\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tctx.fillStyle = \"#FFF\";\n\t\t\t\t}\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.rect(i*config.square_size+config.offset, j*config.square_size+config.offset, config.square_size-1, config.square_size-1);\n\t\t\t\tctx.closePath();\n\t\t\t\tctx.fill();\n\t\t\t\tctx.fillStyle = \"#000\";\n\t\t\t\tctx.stroke();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t}\n}", "function paint()\n\t{\n\t\t//To avoid the snake trail we need to paint the background on every frame\n\t\t//Lets paint the canvas \n\t\tcanvas.context.fillStyle = \"black\";\n\t\tcanvas.context.fillRect(0, 0, canvas.width, canvas.height);\n\t\tcanvas.context.strokeStyle = \"white\";\n\t\tcanvas.context.strokeRect(0, 0, canvas.width, canvas.height);\n\t\t\n\t\t//update the snakes position based on the current direction\n\t\tupdateSnake(d);\n\t\t\n\t\t//Lets paint the snake\t\n\t\tfor(var i = 0; i < snakeArray.length; i++)\n\t\t{\n\t\t\tvar c = snakeArray[i];\n\t\t\t//Lets paint 10px wide cells\n\t\t\tpaintCell(c.x, c.y, \"green\");\n\t\t}\n\t\t\n\t\t//Lets paint the food\n\t\tpaintCell(food.x, food.y, \"red\");\n\t\t\n\t\t//Lets paint the score\n\t\tvar scoreText = \"Score: \" + score;\n\t\tcanvas.context.fillText(scoreText, 5, canvas.height-5);\n\t}", "function animate() {\r\n animateId = requestAnimationFrame(animate);\r\n ctx.fillStyle = \"black\";\r\n ctx.fillRect(0, 0, canvas.width, canvas.height);\r\n\r\n // mini-score board configuration\r\n scoreEl.draw();\r\n scoreEl.text = `Score: ${score}`;\r\n highScoreEl.draw();\r\n highScoreEl.text = `High Score: ${localStorage.getItem(\r\n \"High_Score_Of_The_Game\"\r\n )}`;\r\n // Generating enemies\r\n if (enemies.length <= 0) {\r\n if (spawnCount % 16 == 0) {\r\n player.life += 1;\r\n texts.push(\r\n new DrawText(\r\n player.x + player.width * (5 / 6),\r\n canvas.height - 65,\r\n `+1`,\r\n 25,\r\n player.color,\r\n { x: 0, y: 1 }\r\n )\r\n );\r\n }\r\n spawnCount--;\r\n levelEl.updateSize();\r\n levelEl.text = `Level: ${level}`;\r\n if (spawnCount <= 0) {\r\n generateMultipleEnemies(enemyCount);\r\n levelEl.size = 60;\r\n levelEl.alpha = 1;\r\n level += 1;\r\n enemyCount += 2;\r\n spawnCount = 240;\r\n }\r\n }\r\n\r\n // Projectiles\r\n projectiles.forEach((projectile, index) => {\r\n projectile.update();\r\n if (projectile.y > canvas.height) {\r\n projectiles.splice(index, 1);\r\n }\r\n\r\n // Collision detection between enemy projectile and player\r\n if (collision(projectile, player)) {\r\n projectiles.splice(index, 1);\r\n player.life -= projectile.hitPoint;\r\n texts.push(\r\n new DrawText(\r\n player.x + player.width * (5 / 6),\r\n canvas.height - 65,\r\n `-${projectile.hitPoint}`,\r\n 25,\r\n player.color,\r\n { x: 0, y: 1 }\r\n )\r\n );\r\n\r\n for (let i = 0; i < 10; i++) {\r\n sparks.push(\r\n new Spark(\r\n projectile.x + projectile.width / 2,\r\n player.y,\r\n Math.random() * 2.5 + 0.5,\r\n player.color,\r\n {\r\n x: (Math.random() - 0.5) * (Math.random() * 15),\r\n y: Math.random() * (Math.random() * 7.5) * -1,\r\n }\r\n )\r\n );\r\n }\r\n\r\n if (player.life <= 0) {\r\n player.life = 0;\r\n if (score > high_score) {\r\n high_score = score;\r\n localStorage.setItem(\"High_Score_Of_The_Game\", score);\r\n }\r\n cancelAnimationFrame(animateId);\r\n scoreboard.classList.add(\"shown\");\r\n mini_score_el.textContent = score;\r\n tipEl.textContent =\r\n tips[Math.round(Math.random() * tips.length)];\r\n }\r\n }\r\n });\r\n\r\n // Enemies\r\n enemies.forEach((enemy, index) => {\r\n enemy.update();\r\n\r\n // Projectiles\r\n let shoot;\r\n Math.random() < 0.015 ? (shoot = true) : (shoot = false);\r\n if (shoot) {\r\n let cTime = Date.now(); // Get the current date.\r\n if ((cTime - enemy.pTime) / 1000 > fire_per_second) {\r\n enemy.pTime = cTime;\r\n let x = enemy.x + enemy.width / 2,\r\n y = enemy.y,\r\n color = enemy.color,\r\n velocity = 10;\r\n projectiles.push(new Projectile(x, y, color, velocity));\r\n }\r\n }\r\n\r\n bullets.forEach((bullet, bulletIndex) => {\r\n // Collision between bullet and enemy.\r\n if (collision(bullet, enemy)) {\r\n // Enemy kill\r\n enemy.life -= bullet.hitPoint;\r\n bullets.splice(bulletIndex, 1);\r\n\r\n // Score distribution\r\n let enemyCollidePoint = enemy.x + enemy.width / 2,\r\n bulletCollidePoint = bullet.x + bullet.width / 2,\r\n diff = enemyCollidePoint - bulletCollidePoint,\r\n oneToZero = diff / (enemy.width / 2);\r\n oneToZero = Math.abs(oneToZero);\r\n score += Math.round(50 - 30 * oneToZero); // Score is between 20 to 50\r\n\r\n // spark generation\r\n for (let i = 0; i < 10; i++) {\r\n sparks.push(\r\n new Spark(\r\n bulletCollidePoint,\r\n enemy.y + enemy.height,\r\n Math.random() * 2.5 + 0.5,\r\n enemy.color\r\n )\r\n );\r\n }\r\n\r\n texts.push(\r\n new DrawText(\r\n enemy.x + enemy.width * (5 / 6),\r\n enemy.y - 20,\r\n `-${bullet.hitPoint}`,\r\n 25,\r\n enemy.color,\r\n { x: 0, y: -1 }\r\n )\r\n );\r\n }\r\n });\r\n // Enemy death\r\n if (enemy.life <= 0) {\r\n enemy.life = 0;\r\n enemy.width -= 10;\r\n if (enemy.width <= 0) {\r\n enemies.splice(index, 1);\r\n }\r\n }\r\n });\r\n\r\n // Sparks\r\n sparks.forEach((spark, index) => {\r\n if (spark.alpha <= 0) {\r\n sparks.splice(index, 1);\r\n } else {\r\n spark.update();\r\n }\r\n });\r\n\r\n // Player\r\n player.update();\r\n\r\n // Bullet\r\n bullets.forEach((Bullet, index) => {\r\n Bullet.update();\r\n if (Bullet.y < 0) {\r\n bullets.splice(index, 1);\r\n }\r\n });\r\n\r\n // Texts when enemy is hit.\r\n texts.forEach((text, index) => {\r\n text.alpha <= 0 ? texts.splice(index, 1) : text.update();\r\n });\r\n\r\n if (window.innerWidth < 411) {\r\n player.width = 50;\r\n enemies.forEach((enemy) => {\r\n if (enemy.life > 0) {\r\n enemy.width = 75;\r\n }\r\n });\r\n }\r\n\r\n // floor\r\n ctx.fillStyle = player.color;\r\n ctx.fillRect(0, canvas.height - 100, canvas.width, 10);\r\n}", "function showGame(){\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n ctx.fillStyle = '#d9d9d9';\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.font = gameFont;\n for(var i=0; i<HEIGHT; i++){\n for(var j=0; j<WIDTH; j++){\n var x = j * (COL_WIDTH+SPACE) + COL_WIDTH/2 + SPACE; \n var y = i * (ROW_WIDTH+SPACE) + ROW_WIDTH/2 + SPACE;\n ctx.fillStyle = COLOURS.get(GAME[i][j]);\n ctx.fillRect(x-COL_WIDTH/2, y-ROW_WIDTH/2, COL_WIDTH, ROW_WIDTH);\n ctx.fillStyle = 'white';\n ctx.fillText(GAME[i][j].toString(), x, y);\n }\n }\n}", "function renderLeaderboard () {\n // set font color/size\n OasisCanvasContext.fillStyle = 'black';\n OasisCanvasContext.font = \"17px Arial\";\n\n // render leaderboard title\n OasisCanvasContext.fillText(\n 'Leaderboard:',\n OasisCanvas.width - 200,\n 75\n );\n\n // render client's kill count first\n OasisCanvasContext.fillText(\n '' + OasisPlayer.username + ': ' + OasisPlayer.killCount,\n OasisCanvas.width - 200,\n 75 + 17\n );\n\n // get all connected player's socket ids\n const socketIDs = Object.keys(OasisPlayers);\n\n for (let i=0; i<socketIDs.length; i++) {\n OasisCanvasContext.fillText(\n '' + OasisPlayers[socketIDs[i]].username + ': ' + OasisPlayers[socketIDs[i]].killCount,\n OasisCanvas.width - 200,\n 90 + (i * 15) + 17\n );\n }\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 drawScore() {\n document.getElementById('score').innerText = score.toString();\n }", "draw () {\n\t\t\n\t\tthis._size_elements ()\n\n\t\tvar i = 0\n\t\tthis._figures.forEach (f => {\n\t\t\t\n\t\t\t// Draw non playable cards\n\t\t\tvar card = this._deck_blue [f]\n\t\t\tvar [x, y] = this.get_slot_coo (i, 2.5)\n\t\t\tif (card.slot >= 0) {\n\t\t\t\t[x, y] = this.get_slot_coo (card.slot, 1)\n\t\t\t}\n\t\t\tcard.set_pos_size (x, y)\n\t\t\tcard.draw ()\n\t\t\t\n\t\t\t// Draw playable cards\n\t\t\tvar card = this._deck_red [f]\n\t\t\tvar [x, y] = this.get_slot_coo (i, -1.5)\n\t\t\tif (card.slot >= 0) {\n\t\t\t\t[x, y] = this.get_slot_coo (card.slot, 0)\n\t\t\t}\n\t\t\tcard.set_pos_size (x, y)\n\t\t\tcard.draw ()\n\n\t\t\t// Draw help text of car is highlighted\n\t\t\tif (card.is_highlighted ()) {\n\t\t\t\tvar key = `help_${f}`\n\t\t\t\tvar font_size = this.context.canvas.width / 50\n\t\t\t\tvar [x, y] = this.get_slot_coo (0, 1.75)\n\t\t\t\tthis._draw_banner (this._language [key], \"rgba(0, 0, 0, 0.6)\", y, font_size)\n\t\t\t}\n\t\t\t\n\t\t\ti += 1\n\t\t})\n\n\t\tthis._draw_scores ()\n\t\t\t\t\n\t\t// Draw winner banner\n\t\tif (this._winner != -1) {\n\t\t\t\n\t\t\tvar [x, y] = this.get_slot_coo (0, 1.75)\n\n\t\t\tif (this._winner == this._swap_color)\n\t\t\t\tthis._draw_banner (this._language.red_wins, \"rgba(200, 0, 0, 0.6)\", y, -1)\n\n\t\t\telse if (this._winner == (1-this._swap_color))\n\t\t\t\tthis._draw_banner (this._language.blue_wins, \"rgba(0, 0, 200, 0.6)\", y, -1)\n\t\t\t\n\t\t\telse if (this._winner == 2)\n\t\t\t\tthis._draw_banner (this._language.drawn, \"rgba(200, 200, 200, 0.6)\", y, -1)\n\t\t}\n\t}", "function initGameBoard(height,width){\n\tvar gameboard = '<p id = score style=\"text-align:center\">Score: </p>';\n\tgameboard += '<table id=\"gameboard\">';\n\n\tfor(i = 0; i<height; i++){\n\t\tgameboard += '<tr>';\n\t\tfor (j = 0; j < width; j++){\n\t\t\tvar id = \"r\"+i+\"d\"+j;\n\t\t\tvar grid = '<td id=\"'+id+'\">';\n\t\t\tgameboard += grid;\n\t\t}\n\t\tgameboard += '</tr>';\n\t}\n\tgameboard += '</table>';\n\tgameboard += '<p style=\"text-align: center\"> Ohjaa matoa nuolinäppäimillä. Kuoleman jälkeen paina R syntyäksesi uudelleen </P>'\n\t$(\"#gameboard_div\").html(gameboard);\n\tinitSnake();\n\tdrawApple();\n}", "function createScore() {\n canvasContext.beginPath();\n canvasContext.font = '18px Arial';\n canvasContext.fillStyle = \"#DE4B39\";\n canvasContext.fillText('Score: ' + score, 8, 420);\n canvasContext.closePath();\n }", "function render(){\n drawRect(0, 0, canvas.width, canvas.height, \"BLACK\"); \n drawText(user.score, canvas.width/4, canvas.height/5, \"WHITE\"); \n drawText(com.score, 3*canvas.width/4, canvas.height/5, \"WHITE\"); \n drawNet();\n drawRect(user.x, user.y, user.width, user.height, user.color);\n drawRect( com.x, com.y, com.width, com.height, com.color);\n drawCircle(ball.x, ball.y, ball.radius, ball.color); \n}", "function draw() {\r\n // calculate tile-width and -height\r\n var tw = canvas.width/grid.width;\r\n var th = canvas.height/grid.height;\r\n // iterate through the grid and draw all cells\r\n for (var x=0; x < grid.width; x++) {\r\n for (var y=0; y < grid.height; y++) {\r\n // sets the fillstyle depending on the id of\r\n // each cell\r\n switch (grid.get(x, y)) {\r\n case EMPTY:\r\n // Colours from [11] http://www.w3schools.com/colors/colors_picker.asp\r\n ctx.fillStyle = \"rgb(255,51,51)\";\r\n ctx.fillRect(x*tw, y*th, tw, th); \r\n break;\r\n case SNAKE:\r\n ctx.fillStyle = \"black\";\r\n ctx.fillRect(x*tw, y*th, tw, th);\r\n break;\r\n case FRUIT:\r\n //make square behind circle same color as empty\r\n ctx.fillStyle = \"rgb(255,51,51)\";\r\n ctx.fillRect(x*tw, y*th, tw, th);\r\n //draw white blood cell (circle)\r\n ctx.beginPath();\r\n ctx.arc((x*tw + tw/2),(y*th + th/2), (th/2-1), 0, 2 * Math.PI, false);\r\n ctx.closePath();\r\n ctx.fillStyle = \"white\";\r\n ctx.fill();\r\n ctx.lineWidth = 1;\r\n //differnt shade of red for border of circles - blends into background better\r\n ctx.strokeStyle = \"rgb(153, 0, 0)\"; \r\n break;\r\n }\r\n }\r\n }\r\n // changes the fillstyle once more and draws the score\r\n // message to the canvas\r\n ctx.fillStyle = \"#000\";\r\n ctx.fillText(\"SCORE: \" + score, canvas.width-COLS*3, 30); //bottom leftc hanf corner\r\n ctx.fillText(\"SPEED: \" + speed, 10, 30);\r\n}", "function ScoreBoard(player0, player1){\n\n var _oPlayer0 = player0;\n var _oPlayer1 = player1;\n var _oScoreField0;\n var _oScoreField1;\n var _oPlayerNameField0;\n var _oPlayerNameField1;\n\n _createScoreBoardForPlayer = function(oParent, oPlayer, sAlignment){\n\n //Create a root element to append 3 different sections for the chip image, player name, and score value\n var root = document.createElement(\"div\");\n root.className = \"scoreBoardPlayer\";\n root.id = \"scoreBoardPlayer\" + oPlayer.getId();\n\n //Wrapper\n var wrapper = document.createElement(\"div\");\n wrapper.className = \"scoreBoardPlayerWrapper\";\n\n //Player Chip\n var displayPlayerChip = document.createElement(\"div\");\n displayPlayerChip.className = \"displayPlayerChip \" + sAlignment;\n $(displayPlayerChip).css({'backgroundImage' : oPlayer.getStyle()});\n\n //Player Name\n var displayPlayerNameContainer = document.createElement(\"div\");\n var displayPlayerName = document.createElement(\"div\");\n displayPlayerNameContainer.className = \"displayPlayerNameContainer\";\n displayPlayerName.className = \"displayPlayerName \" + sAlignment + \" smoothBorderTransition\";\n displayPlayerName.innerHTML = oPlayer.getName();\n displayPlayerNameContainer.appendChild(displayPlayerName);\n\n //Player Score\n var displayPlayerScore = document.createElement(\"div\");\n displayPlayerScore.innerHTML = oPlayer.getPoints();\n displayPlayerScore.className = \"displayPlayerScore\";\n var displayPlayerScoreContainer = document.createElement(\"div\");\n displayPlayerScoreContainer.className = \"displayPlayerScoreContainer \" + sAlignment;\n displayPlayerScoreContainer.appendChild(displayPlayerScore);\n\n wrapper.appendChild(displayPlayerChip);\n wrapper.appendChild(displayPlayerNameContainer);\n wrapper.appendChild(displayPlayerScoreContainer);\n\n root.appendChild(wrapper);\n oParent.appendChild(root);\n\n //Return the element that represent the score field so it can be used for updates\n return [displayPlayerScore, displayPlayerName];\n }\n\n _insertSeparator = function(oParent){\n var separatorContainer = document.createElement(\"div\");\n separatorContainer.id = \"scoreSeparatorContainer\";\n var separator = document.createElement(\"div\");\n separator.id = \"scoreSeparator\";\n separator.innerHTML = \"-\";\n separatorContainer.appendChild(separator);\n\n oParent.appendChild(separatorContainer);\n }\n\n _renderScoreBoard = function(){\n var parent = document.getElementById(\"scoreBoard\");\n var oFields0 = _createScoreBoardForPlayer(parent, _oPlayer0, \"left\");\n _insertSeparator(parent);\n var oFields1 = _createScoreBoardForPlayer(parent, _oPlayer1, \"right\");\n\n _oScoreField0 = oFields0[0];\n _oPlayerNameField0 = oFields0[1];\n _oScoreField1 = oFields1[0];\n _oPlayerNameField1 = oFields1[1];\n }\n\t\t\n\t\tthis.eraseScoreBoardDOMElements = function(){\n\t\t\tvar parent = document.getElementById(\"scoreBoard\");\n\t\t\t$(parent).empty();\n\t\t}\n\n this.updateScores = function(){\n //Update the score board to reflect new points\n _oScoreField0.innerHTML = _oPlayer0.getPoints();\n _oScoreField1.innerHTML = _oPlayer1.getPoints();\n }\n\n this.zeroScores = function(){\n _oPlayer0.setPoints(0);\n _oPlayer1.setPoints(0);\n this.updateScores();\n }\n\n this.highlightActivePlayer = function(){\n if(_oPlayer0.isActive() == true){\n $(_oPlayerNameField1).removeClass(\"selected\");\n $(_oPlayerNameField0).addClass(\"selected\");\n }else{\n $(_oPlayerNameField0).removeClass(\"selected\");\n $(_oPlayerNameField1).addClass(\"selected\");\n }\n }\n\n //Upon creating an instance of ScoreBoard, render it:\n _renderScoreBoard();\n }", "function initGame() {\n // If the previous game loop is still defined (and therefore running) then stop it\n if (typeof mainInterval !== 'undefined') {\n clearInterval(mainInterval);\n }\n // Create a variable to communicate with the HTML canvas\n canvas = document.getElementById(\"mainCanvas\");\n // Create a variable to access the 2D drawing methods/properties\n ctx = canvas.getContext(\"2d\");\n // Load the sidebar logo image (so that it can be drawn to the canvas)\n sidebarLogo = new Image();\n sidebarLogo.onload = function () {}\n sidebarLogo.src = \"img/sidebarLogo.png\";\n // Clear the canvas\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n // Set default variables\n score = 0;\n gameOverState = false;\n paused = false;\n dropDelay = 500;\n // Draw the Top Data (name/score)\n drawTopData();\n // Create an array to represent the game board\n gameBoard = new Array();\n // Create 20 elements in the gameBoard array (to represent rows) and within each element, create an array with 14 elements (to represent columns) and then initialise them all to 0\n for (var r=0; r<20; r++) {\n gameBoard[r] = new Array();\n for (var c=0; c<14; c++) {\n gameBoard[r][c] = 0;\n\n }\n }\n // Create an array to represent the next piece preview area of the game\n nextPieceBoard = new Array();\n // Create 4 elements in the nextPieceBoard array (to represent rows) and within each element, create an array with 4 elements (to represent columns) and initialise them all to 0\n for (var r=0; r<4; r++) {\n nextPieceBoard[r] = new Array();\n for (var c=0; c<4; c++) {\n nextPieceBoard[r][c] = 0;\n\n }\n }\n // Draw the game area (main game board and next block area) on to the canvas\n drawGameArea();\n // Generate a random block to be the first 'next block'\n generateRandomBlock();\n // use the initial 'next block' as the first actual block and randomly generate a new 'next block'\n newBlock();\n}" ]
[ "0.73607624", "0.70869297", "0.70739704", "0.70584774", "0.6974996", "0.6938553", "0.6934178", "0.6922656", "0.6910067", "0.6897704", "0.6890096", "0.68763286", "0.68348974", "0.67919546", "0.6740421", "0.6738843", "0.6728717", "0.6710097", "0.66862345", "0.66760695", "0.66330504", "0.66289467", "0.66129965", "0.660527", "0.6601143", "0.6600232", "0.6594036", "0.6590119", "0.65895677", "0.65792286", "0.65680337", "0.656381", "0.65487826", "0.65464723", "0.6543453", "0.6540552", "0.65393186", "0.65156424", "0.6509869", "0.6474611", "0.6468415", "0.64643556", "0.64631385", "0.6456247", "0.6446957", "0.6443874", "0.6443245", "0.6440476", "0.64235866", "0.641467", "0.6400258", "0.6399069", "0.6394412", "0.6380682", "0.6377747", "0.6374862", "0.63636667", "0.63570005", "0.63554513", "0.6325154", "0.63209367", "0.63138515", "0.6313235", "0.63125396", "0.63123447", "0.63031423", "0.6302999", "0.6301479", "0.630042", "0.6300101", "0.62959033", "0.62925106", "0.62857383", "0.6280672", "0.6278544", "0.62770766", "0.6271572", "0.6271075", "0.6269424", "0.6268711", "0.6267668", "0.62671447", "0.62652564", "0.6263191", "0.62596184", "0.62560755", "0.62521267", "0.6249794", "0.62394994", "0.6231361", "0.62271035", "0.6224025", "0.6223656", "0.6219815", "0.6217137", "0.62144536", "0.6213167", "0.6212983", "0.6212805", "0.62028545" ]
0.82207555
0
! TOGGLE SUBMIT SCORE BUTTON This is the function that runs to display submit score button
function toggleSaveButton(con){ saveButton.visible = false; if(con){ saveButton.visible = true; buttonReplay.x = canvasW/100 * 40; saveButton.x = canvasW/2; scoreboardButton.x = canvasW/100 * 60; buttonReplay.y = saveButton.y = scoreboardButton.y = canvasH/100*65; }else{ buttonReplay.x = canvasW/100 * 45; scoreboardButton.x = canvasW/100 * 55; buttonReplay.y = saveButton.y = scoreboardButton.y = canvasH/100*65; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitScore() {\n playerScore = playerScore + quizTimer; \n \n highscoresBtn.disabled = false;\n quizArea.classList.add(\"hide\");\n timerArea.classList.add(\"hide\");\n scoreInput.classList.remove(\"hide\");\n \n scoreHeader.innerHTML = \"Congratulations! Your score is \" + playerScore + \"!\";\n initialsAsk.innerHTML = \"Enter your initials below to enter the high scores table!\";\n}", "function submitButtonPressed() {\n parseAllData();\n\n $(\".highScore1\").show();\n $(\".highScore2\").show();\n $(\".highScore3\").show();\n $(\".scoreboardPTags\").hide();\n $(\".highScore1\").show();\n $(\".highScore2\").show();\n $(\".highScore3\").show();\n $(\"h1\").text(\"High Scores!\");\n $(\"h1\").css(\"text-align\", \"center\");\n $(\".userhighscore\").remove();\n $(\".userInitials\").remove();\n $(\".playAgain\").remove();\n $(\"#startBtn\").hide();\n $(\".percentRight\").remove();\n $(\".userInitials\").remove();\n $(\".label\").remove();\n $(\".submitBtn\").remove();\n $(\".userAnswer\").remove();\n $(\".answerCheck\").hide();\n $(\".welcome-p\").hide();\n $(\".welcome-p2\").hide();\n\n $(\"h1\").text(\"High Scores!\");\n $(\"h1\").css(\"text-align\", \"center\");\n\n stopTimer();\n\n var playAgain = $(\"<button>\");\n playAgain.addClass(\"playAgain btn\");\n playAgain.text(\"Play Again!\");\n $(\"main\").append(playAgain);\n }", "function submitButtonPressed2() {\n $(\".highScore1\").show();\n $(\".highScore2\").show();\n $(\".highScore3\").show();\n $(\".scoreboardPTags\").hide();\n $(\".highScore1\").show();\n $(\".highScore2\").show();\n $(\".highScore3\").show();\n $(\"h1\").text(\"High Scores!\");\n $(\"h1\").css(\"text-align\", \"center\");\n $(\".userhighscore\").remove();\n $(\".userInitials\").remove();\n $(\".playAgain\").remove();\n $(\"#startBtn\").hide();\n $(\".percentRight\").remove();\n $(\".userInitials\").remove();\n $(\".label\").remove();\n $(\".submitBtn\").remove();\n $(\".userAnswer\").remove();\n $(\".answerCheck\").hide();\n $(\".welcome-p\").hide();\n $(\".welcome-p2\").hide();\n\n $(\"h1\").text(\"High Scores!\");\n $(\"h1\").css(\"text-align\", \"center\");\n\n stopTimer();\n\n var playAgain = $(\"<button>\");\n playAgain.addClass(\"playAgain btn\");\n playAgain.text(\"Play Again!\");\n $(\"main\").append(playAgain);\n }", "function displayScore() {\n document.getElementById(\"quiz\").classList.add('d-none');\n document.getElementById(\"submit-score\").classList.remove('d-none');\n playerScore.textContent = \"FINAL SCORE: \" + secondsRemain + \".\";\n}", "function scoreQuestion () {\n scoreboard.classList.remove('hide')\n questionSection.classList.add('hide')\n seeScoreBtn.classList.add('hide')\n leaderboardContainer.classList.remove('hide')\n if (userAnswer == true) {\n score += 1\n }\n userScore.innerText = score;\n completed = true\n}", "function submitScore() {\n document.getElementById('highScoreInput').classList.remove('hide');\n}", "function getScore(score) {\n $(\".submit\").on(\"click\", function(){\n //see what was selected \n $( \"input[type=radio]:checked\" ).val();\n //if something was selected, add one to answered questions \n if (\":checked\", \"true\") {\n questionsAnswered++;\n //check to see if selected answers are correct \n if (questionsAnswered.val([i]) === correctAnswers[i]) {\n score++;\n }\n }\n else {\n questionsNotAnswered++;\n }\n\n \n \n\n })\n }", "function displayScore() {\n document.getElementById(\"quiz\").classList.add('d-none');\n document.getElementById(\"submit-score\").classList.remove('d-none');\n userScoreElement.textContent = \"FINAL SCORE: \" + secondsLeft + \".\";\n}", "function viewFinalScore() { \n quizQuestionPage.style.display = \"none\"; \n highScoreButtons.style.display = \"none\"; \n finalScore.style.display = \"block\"; \n finalScoreIs.style.display = \"block\" \n initials.style.display = \"block\" \n initialButton.style.display = \"block\" \n initialInput.style.display = \"block\" \n \n finalScoreIs.textContent = \"Your final score is \" + score + \" and your time remaining is \" + secondsLeft + \"!\";\n initialButton.textContent = \"Submit\"; \n initials.textContent = \"Enter Your Initials: \"; \n }", "function highScore() {\n hideOverlay();\n showLevelOverlay();\n getId('currentLevel').style.display = \"none\";\n getId('passOrFail').style.display = \"none\";\n getId('scoreMultiplied').style.display = \"none\";\n getId('normalScore').style.display = \"none\";\n getId('pointsDivider').style.display = \"none\";\n getId('tutorialOrHearts').style.display = \"none\";\n getId('congrats').style.display = \"block\";\n getId('highScore').style.display = \"block\";\n getId('enterName').style.display = \"block\";\n getId('nameBoxContainer').style.display = \"block\";\n getId('buttonLeftText').innerHTML = \"Reset\";\n getId('buttonRightText').innerHTML = \"Submit\";\n}", "function clickedCorrect() {\n $(\"#correctInput\").show();\n $(\"#wrongInput\").hide();\n if (clickedCorrect) {\n yourScore +=10;\n };\n }", "function userCorrectAnswerSubmitted(answer) {\n store.score++;\n $('.correct-updater').html('Correct!');\n}", "function clickSubmit(){\r\n\t\r\n\t\tfor(var i=0;i<10;i++){\r\n\t\t\tabc=questions[i];\r\n\t\t\tfinalScore+=abc.scores;\r\n\t\t}\r\n\t\t\r\n\t\tif(finalScore>7)\r\n\t\t{\r\n\t\t\tresult.innerHTML=\"Your score is \"+finalScore+\"/10 <br> Congratulations!!! <br> Now here you go <br> Instagram Username: megs_bd <br> Password: Megsbd <br> Enjoy!!!\"\r\n\t\t}\r\n\t\telse{\r\n\t\t\tresult.innerHTML=\"Sorry! <br> Your score is \"+finalScore+\"/10 <br> Refresh and play again!\";\r\n\t\t}\r\n\t\tsubmit.disabled=true;\r\n\r\n}", "function functionSubmitScore(){\n quizHeader.textContent = \"All done!\";\n finalScore.textContent = `Your final score is ${timeLeft}`;\n buttonsDiv.remove();\n \n finalScoreDiv.append(finalScore);\n\n enterInitials.textContent = \"Enter Initials:\"\n enterInitialsDiv.append(enterInitials);\n \n enterInitialsText.setAttribute('placeholder', \"Enter Initials\");\n enterInitialsTextDiv.append(enterInitialsText);\n\n enterInitialsButton.textContent = \"Submit\";\n enterInitialsButtonDiv.append(enterInitialsButton);\n}", "function showScoreCard() {\n clearPrompt();\n $(\"#points\").text(\"\");\n $(\"#score\").text(\"\");\n $(\"#rightAnswers\").text(\"Correct Answers: \" + correct);\n $(\"#wrongAnswers\").text(\"Incorrect Answers: \" + incorrect);\n $(\"#totalScore\").text(\"Total Score: \" + score);\n var playAgainButton = $(\"<button>\");\n playAgainButton.addClass(\"playAgain btn btn-outline-dark btn-lg btn-block\");\n playAgainButton.text(\"Play Again?\");\n $(\"#playAgainButtonSection\").append(playAgainButton);\n correct = 0;\n incorrect = 0;\n score = 0;\n }", "function ShowScore() {\n //get the final score for the user\n scoreFinal.textContent = highScore;\n clearInterval(timeInterval);\n //show the form\n form.style.display = \"block\";\n}", "function scoreQuiz() {\n\t\t//fix button state\n\t\tvar button = buttonControl;\n\t\tbutton.value=\"Start\";\n\t\tbutton.disabled = true;\n\n\t\tanswerScore = []; //clear scoring\n\t\tfor (var i=0; i<NUMPROBLEMS; i++) {\n\t\t\tanswerScore.push(0);\n\t\t\t//each key(=term) defaults to wrong until checked\n\t\t}\n\t\tvar definitionsContainer = $.get(\"definitionsContainer\");\n\t\tvar assignedTerms = definitionsContainer.getElementsByClassName(\"termWidget\");\n\t\tfor (var i=0; i<assignedTerms.length; i++) {\n\t\t\t//calc scoring\n\t\t\tlet term = assignedTerms[i]; //term being evaluated\n\t\t\tlet termIndex = term.getAttribute(\"index\"); //index of term\n\t\t\tlet correctDefIndex = answerMap[termIndex]; //index of correct definition\n\t\t\tlet userDefIndex = term.parentNode.getAttribute(\"index\"); //index of user's definition\n\t\t\tif (userDefIndex==correctDefIndex) {\n\t\t\t\tanswerScore[termIndex] = 1; //score as correct\n\t\t\t\tterm.setAttribute(\"correct\", true);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tterm.setAttribute(\"correct\", false);\n\t\t\t}\n\n\t\t}\n\t\tscoreText.innerText = scoreMessage(); //update score text area on page\n\n\t\t//check if enough questions to continue, then prompt user\n\t\tsetTimeout( function() {\n\t\t\tif (Object.keys(quizJson).length >= NUMPROBLEMS && window.confirm(\"Would you like to play again?\") ) {\n\t\t\t\tsetupQuiz();\n\t\t\t\tscoreText.innerText = \"\";\n\t\t\t}\n\t\t}, 3000);\n\n\t}", "function displayScore(){\n\tclearInterval(countDownTimer); \n\t$(\"h2\").hide(); \n\t$(\"p\").html(`Your Score: <br>\n\t\tCorrect: ${correct} <br>\n\t\tIncorrect: ${incorrect} <br>\n\t\tUnanswered: ${unanswered}`); \n\t$(\"#buttons\").html(\"<button>Restart</button>\"); \n}", "function submitTest(){\n submitted = true;\n var radios = document.querySelectorAll(\".md-radio\");\n var correct = 0, wrong=0;\n\n for(var i=0; i<radios.length; i++){\n var radio = radios[i];\n radio.children[0].disabled=true;\n var isChecked = radio.children[0].checked;\n var isCorrect = radio.classList.contains(\"correct\");\n\n if(isChecked && isCorrect){\n radio.children[1].classList.add(\"correct\");\n correct++;\n }\n else if(isChecked && !isCorrect){\n radio.children[1].classList.add(\"wrong\")\n wrong++;\n }\n }\n\n var anss = document.querySelectorAll(\".ans\");\n for(var i=0; i<anss.length; i++){\n anss[i].classList.remove('hidden');\n anss[i].classList.add('show');\n }\n\n // hide timer\n clearInterval(interval);\n document.getElementsByClassName('timer')[0].classList.add('hidden');\n\n // show scores\n document.getElementsByClassName('score')[0].classList.remove('hidden');\n var spans = document.querySelectorAll(\".score .act-tim-digit\")\n spans[0].innerText = correct;\n spans[1].innerText = total_questions;\n}", "function highScoresPage() {\n $(\"#finished\").hide();\n $(\"#scores\").show();\n $(\"#correctInput\").hide();\n $(\"#wrongInput\").hide();\n\n \n }", "function submitScore() {\n\tvar msg = {\n \"messageType\": \"SCORE\",\n \"score\": parseInt($(\"#scoretext\").text())\n };\n window.parent.postMessage(msg, \"*\");\n}", "function showScores() {\n stopFunction();\n var gameOverHTML = \"<h1>All Done!</h1>\";\n gameOverHTML += \"<h2 id='score'> Your scores: \" + timeLeft + \"</h2>\";\n gameOverHTML += \"<p>Enter Initials: \" + `<input type = \"text\" id=\"textScore\" />` + `<button type=\"button\" id=\"buttonScore\" onclick=\"finalScore()\">Submit</button>`+ \"</p>\";\n var element = document.getElementById(\"quiz\");\n element.innerHTML = gameOverHTML;\n}", "function showHighScore() {\n varHighScoresClick = true;\n clearHighScoresClass.hidden = false;\n displayHighScoresOutput();\n highScoresPage.hidden = false;\n gobackbt.hidden = true;\n\n}", "function displayscore(){\n \t$('#playerscore').html('Correct Answer: ' + correctanswer + \n \t\t '<br>Wrong Answer: ' + wronganswer +\n '<br>Unanswer: ' + unanswered);\n }", "function startQuiz(){\n startBtn.classList.add('hide');\n scoreCount.innerHTML = 'Score: ' + score;\n \n}", "function showFinalResults() {\n $(\".correctAnswer\").hide();\n $(\".incorrectAnswer\").hide();\n\n let message = \"\";\n\n if (currentScore < 3) {\n message = \"Cayde would be disappointed. Try again!\";\n } else if (currentScore == 3 || currentScore == 4) {\n message = \"You did ok, Guardian!\";\n } else {\n message = \"You got a perfect score! Shaxx would be proud!\";\n }\n\n\n $(\".quizForm\").html(`<p class=\"finalMessage\">Your final score is ${currentScore}/5. ${message}</p>`);\n\n $(\".quizForm\").append(`<button type=button class=\"retakeQuiz\">Retake Quiz</button>`)\n\n currentQuestionNumber = 0;\n currentScore = 0;\n\n $(\".retakeQuiz\").focus();\n\n\n\n\n}", "function scoredisplay(){\r\n scorepage.style.display = \"block\";\r\n quiz.style.display = \"none\";\r\n timer.style.display = \"none\";\r\n let scorePercent = Math.round(100 * score/questions.length);\r\n scorealert.innerHTML = \"<h2>\" + \"Your score is\" + \" \" + scorePercent + \"%\" + \"</h2>\";\r\n record();\r\n }", "function toggleScoreModal() {\n stopTimer();\n finalScore();\n let modal = document.querySelector('#score-modal');\n modal.classList.toggle('modal-hide');\n}", "function answerIsCorrect () {\r\n feedbackForCorrect();\r\n updateScore();\r\n}", "function showQuickGolfScore() {\n retrieveQuickGolfScoreList();\n standardShowContentPane('quickGolfScore', 'Quick Golf Score Entry');\n if (isFormEmpty('quickGolfScoreForm')) {\n toggleSaveMode('quickGolfScoreForm', false);\n }\n}", "function displayTotalScore() {\n $(document).find(\".column > .result\").text(\"Your total score is: \" + correctAnswers + \" out of: \" + questions.length);\n $(\".result\").fadeIn(\"slow\").show();\n $(\".result\").css({ \"color\": \"black\", \"border\": \"1px solid #d1d1d1\", \"background-color\": \"#f0f0f0\" });\n $(\"#saveScore\").show();\n $(\".question\").text(\"Add your initials and click submit to save your score!\");\n}", "function submitHandler() {\n\tconst index = selectedPianoKey();\n\tif (index < 0) return;\n\tanswer['shown'] = true;\n\tpianoKeys[answer['index']].classList.add('correct');\n\tconst distance = answerDistance(index);\n\tif (distance == 0) {\n\t\tresultText.textContent = 'Correct!';\n\t\tconst scale = Math.round(100 * (1 - ramp));\n\t\tdetailsText.textContent = `Next one will be ${scale}% harder`;\n\t\tsetError(false);\n\t\tcontinueButton.classList.remove('hidden');\n\t\tcontinueButton.focus();\n\t} else {\n\t\tresultText.textContent = 'Game Over';\n\t\tcheckHighScore();\n\t\tpianoKeys[index].classList.add('incorrect');\n\t\ttryAgainButton.classList.remove('hidden');\n\t}\n\tsubmitButton.disabled = true;\n\tsubmitButton.classList.add('hidden');\n}", "function showScore () {\n\t$(\".questions\").hide();\n\t$(\".result\").show();\n\tshowScore();\n}", "function answerChoice() {\n $('form').on('submit', function (event) {\n event.preventDefault();\n let selected = $('input:checked');\n let answer = selected.val();\n let correctAnswer= `${questionsAnswers[questionNumber].correctAnswer}`;\n\n if (correctAnswer.includes(answer)) {\n if (questionNumber === 9) {\n correctAnswerVisible();\n $('.scoreKeeper').addClass('hidden');\n updateScoreTicker();\n $('.correctAnswerScreen button').replaceWith(\n `<button role=\"button\" class=\"nextButton\">VIEW FINAL RESULTS</button>`);\n } else if (questionNumber < 9) {\n correctAnswerVisible ();\n updateScoreTicker();\n }\n } else if (!correctAnswer.includes(answer)) {\n if (questionNumber === 9) {\n wrongAnswerVisible();\n $('.scoreKeeper').addClass('hidden');\n $('.wrongAnswerScreen button').replaceWith(\n `<button role=\"button\" class=\"nextButton\">VIEW FINAL RESULTS</button>`);\n } else if (questionNumber < 9) {\n wrongAnswerVisible();\n }\n }\n });\n}", "function submit(answer) {\n //if our selection is the same as our answer\n if (question.correct === answer) {\n //changes the color of the button to green by updating the class name.\n document.getElementById(question.correct).className = \"CorrectAns\";\n setTimeout(function () {\n //sets the highscore === score when I get a new highscore(updates highscore on the spot when you reach a new highscore)\n if (score >= highscore) {\n //adds one to highscore\n setHighscore(highscore + 1);\n }\n //adds one to the score\n setScore(score + 1);\n\n //finds if we won the game, I took 3 off because we have three chances to fail.\n if (score === data.length - 3) {\n if (window.confirm(\"You win!!!, Would you like to restart?\")) {\n resetGame();\n } else {\n window.location.href = '/'\n }\n //resets the question, passing in the correct answer so that we can see if we have had that answer before\n setQuestion(getRandomQuestion(question.correct));\n setScore(0);\n if (score > highscore) {\n setHighscore(score);\n }\n setWrong(0);\n setWrongAnswers([\"•\", \"•\", \"•\"]);\n res = [];\n } else {\n setQuestion(getRandomQuestion(question.correct));\n }\n }, 800);\n } else {\n document.getElementById(answer).className = \"WrongAns\";\n document.getElementById(question.correct).className = \"CorrectAns\";\n setTimeout(function () {\n setQuestion(getRandomQuestion(question.correct));\n setWrong(wrong + 1);\n setWrongAnswers((WrongAnswers) => [\"X\", ...WrongAnswers.slice(0, -1)]);\n\n if (wrong === 2) {\n if (window.confirm(\"Defeat... Would you like to restart?\")) {\n resetGame();\n } else {\n window.location.href = '/'\n }\n }\n },\n 800);\n }\n }", "function correctAnswer() {\r\n $('.response').html(\r\n `<h3>Your answer is correct!</h3>\r\n <button type=\"button\" class=\"nextButton \r\n button\">Next</button>`\r\n );\r\n updateScore();\r\n}", "function setMatchScore(score) {\n $(\"#teams-wrapper\").html(\"<span>\" + CURRENT_MATCH[0].name + \"</span> - \" +\n \"<span>\" + CURRENT_MATCH[1].name + \"</span>\")\n $(\"#score-wrapper\").html(\"<h2>\" + score + \"</h2>\");\n\n $(\".match-result\")[CURRENT_MATCH_IDX].innerHTML = score;\n\n var $activeBtn = $(\"input.btn-play:visible\");\n $activeBtn.hide();\n $activeBtn.parent().next().find(\"input.btn-play\").show();\n\n $.when(DATAGATEWAY.load('team')).done(setMatchScoreSuccess);\n}", "function updateScore (input) {\n scoreText.innerText = score;\n pointsRemainingText.innerText = updateRemaining();\n let buttons = document.getElementById(\"buttonGroup\").children;\n for (let i=0; i<buttons.length; i++){\n buttons[i].innerText=balls[i].quantity;\n }\n updateBar();\n}", "function score(){\n\t$('#timeLeft').empty();\n\t$('#message').empty();\n\t$('#correctedAnswer').empty();\n $('#gif').empty();\n \n \n\n\t$('#finalMessage').html(\"<h3>Let's check out your score.</h3>\");\n\t$('#correctAnswers').html(\"Correct Answers: \" + correctAnswer);\n\t$('#incorrectAnswers').html(\"Incorrect Answers: \" + incorrectAnswer);\n\t$('#unanswered').html(\"Unanswered: \" + unanswered);\n\t$('#startOverBtn').addClass('btn-custom');\n\t$('#startOverBtn').show();\n\t$('#startOverBtn').html('Try again?');\n}", "function finalScore() {\n $('#startOver').hide();\n if (score >= 8) {\n $('.questionMode').html(`<div class=\"goodFeedback\"><h3>You rock!</h3><img src=\"https://user-images.githubusercontent.com/49838700/61897733-4348ff00-af07-11e9-8b21-7a100566769d.jpg\" alt=\"hand giving you rock sign\" class=\"feedbackImg\"/><p>You got ${score}/10 questions right. You\\'re on your way to becoming a neurosurgeon!</p><button class=\"restartButton\" type=\"button\">Restart</button></div>`);\n } else if (score < 8 && score >= 5) {\n $('.questionMode').html(`<div class=\"goodFeedback\"><h3>You did an okay job.</h3><img src=\"https://user-images.githubusercontent.com/49838700/61897748-43e19580-af07-11e9-8712-08b76c6f8419.jpg\" alt=\"x-ray hand doing okay sign\" class=\"feedbackImg\"/><p>You got ${score}/10 questions right, but you\\'ll be in med school in no time!</p><button class=\"restartButton\" type=\"button\">Restart</button></div>`);\n } else {\n $('.questionMode').html(`<div class=\"goodFeedback\"><h3>Future patients may suffer.</h3><img src=\"https://user-images.githubusercontent.com/49838700/61897743-43e19580-af07-11e9-9237-334d007d8cd4.jpg\" alt=\"skull\" class=\"feedbackImg\"/><p>You got ${score}/10 questions right. You may want to study a bit more before taking the MCAT!</p><button class=\"restartButton\" type=\"button\">Restart</button></div>`);\n }\n $('.restartButton').click(function () {\n startOver();\n });\n}", "update() {\n this.scoreHTML.innerText = this.score;\n // show modal if you score 12\n if(this.score == 12){\n this.win();\n }\n }", "function buttonClick() {\n if (this.value === questions[currentQuestion].answer) {\n score++;\n } else if (this.value !== questions[currentQuestion].answer) {\n timeLeft -= 10;\n timer.textContent = timeLeft;\n }\n\n currentQuestion++;\n\n if (currentQuestion === questions.length) {\n endGame();\n } else {\n showQuestion();\n }\n stat.textContent = \"Total Correct: \" + score + \"/5\";\n console.log(currentQuestion);\n }", "function displayHighScore() {\n\n var allDone = document.createElement('div')\n allDone.className = \"all-done\";\n allDone.textContent = \"All Done!\";\n document.querySelector(\".QuizQuestions\").appendChild(allDone)\n var yourScore = document.createElement('div')\n yourScore.className = \"your-score\"\n yourScore.textContent = \"Your Final Score Is \" + timeLeft;\n document.querySelector(\".intro-p\").appendChild(yourScore)\n\n var enterInitials = document.createElement('p')\n enterInitials.className = \"initials\";\n enterInitials.textContent = \"Enter Initials: \"\n document.querySelector(\".your-name\").appendChild(enterInitials)\n\n\n var textInput = document.createElement('input')\n textInput.type = \"text\";\n textInput.className = \"text-input\";\n document.querySelector(\".enter-score\").appendChild(textInput);\n\n var submit = document.createElement('button')\n submit.classList = \"btn\"\n submit.textContent = \"Submit\";\n document.querySelector(\".submit-button\").appendChild(submit);\n document.querySelector(\".submit-button\").addEventListener(\"click\", gatherHighScore);\n \n finalSocre = timeLeft;\n timeLeft = \"Time: \" + timeLeft;\n \n\n }", "function viewScoreBoard(){\n if(quizWrapper.classList.contains('quiz-ongoing')===false && quizWrapper.classList.contains('score-updating') === false){\n document.querySelector(\"#score-board-wrapper\").classList.remove(\"d-none\");\n if(scoreWrapper.classList.contains('d-none')===false){\n scoreWrapper.classList.add('d-none');\n }\n if(quizWrapper.classList.contains('d-none')===false){\n quizWrapper.classList.add('d-none');\n }\n updateScoreBoard();\n } else {\n alert(\"please complete quiz and submit initials in order to see score board!\");\n }\n}", "function score(){\n\tif(gameStart){\n\t\tvar s = document.getElementById(\"score\");\n\t\ts.innerText++;\n\t\tremoveClick();\n\t\tresetAll();\n\t}\n}", "function displaySubmit() {\n $('main').on('click', 'form', event => {\n if ($('input[name=\"answer\"]:checked').val() !== undefined) {\n $('.submit').removeClass('hidden');\n }\n })\n}", "function submitAnswers() {\n // grab the value of result (1 to 4)\n const answer = +document.forms[\"quizForm\"][\"q1\"].value - 1;\n\n if (answer === state.solution.index) {\n //update the level and the score\n state.current.level += 1;\n state.current.score += state.solution.bonus;\n\n // update the DOM\n document.getElementById(\"message\").innerHTML =\n yesses[getRandomIndex(yesses.length)];\n document.getElementById(\"section\").style.backgroundColor = \"#FCFAF2\";\n document.getElementById(\"att\").style.backgroundColor = \"#FCFAF2\";\n } else {\n // reset state\n state.current.level = 1;\n state.current.score = 0;\n remap = 1;\n\n // Update the DOM\n document.getElementById(\"message\").innerHTML =\n \"<b>Game Over :(</b> <br><br>&nbsp;the correct answer was<br>&nbsp;\" +\n state.solution.name +\n \"<br><br>&nbsp;please restart\";\n document.getElementById(\"section\").style.backgroundColor = \"#FF9D70\";\n document.getElementById(\"att\").style.backgroundColor = \"#FF9D70\";\n }\n\n // update high level and score (they are nto directly related!)\n state.best.level = Math.max(state.current.level, state.best.level);\n state.best.score = Math.max(state.current.score, state.best.score);\n\n // Update the DOM\n document.getElementById(\"level\").innerHTML = state.current.level + \"\";\n document.getElementById(\"score\").innerHTML = state.current.score + \"\";\n document.getElementById(\"hlevel\").innerHTML = state.best.level + \"\";\n document.getElementById(\"hscore\").innerHTML = state.best.score + \"\";\n\n // show the next map\n showMap();\n\n return false;\n}", "function displayScore() {\n $('main').empty();\n let resultsPic = '';\n let resultsAlt = '';\n if (database.score === 0 || database.score === 1) {\n resultsPic = database.resultGif[0][0];\n resultsAlt = database.resultGif[0][1];\n }\n else if (database.score === 2 || database.score === 3 || database.score === 4) {\n resultsPic = database.resultGif[1][0];\n resultsAlt = database.resultGif[1][1];\n }\n else {\n resultsPic = database.resultGif[2][0];\n resultsAlt = database.resultGif[2][1];\n }\n $('main').append(`\n <h1>Game of Thrones Quiz</h1>\n <h2>Your Score: ${database.score} out of ${database.store.length}</h2>\n <div class=\"resultsPicShow\"><img src=\"${resultsPic}\" alt=\"${resultsAlt}\" /></div>\n <form id=\"startQuiz\">\n <button type=\"submit\">Play Again?</button>\n </form>\n `);\n}", "function update_score() {\n\t\t$('[id$=-score]').val(score);\n\t}", "function handleSubmitQuestionClick() {\n $('main').on('submit', '#js-form', function(event){\n event.preventDefault();\nlet currentQuestion = store.questions[store.questionNumber];\n //hide submit button\n $('#js-submit-btn').hide();\n // disable all inputs\n $('input[type=radio]').each(() => {\n $('input[type=radio]').attr('disabled', true);\n });\n //show next button\n $('#js-next-btn').show();\n let userAnswer = $('input[name=answers]:checked').val();\n console.log(userAnswer);\n // correct answer pop-up\n if (userAnswer === currentQuestion.correctAnswer) {\n $('.js-results').html( $(\"input:checked\").val() + \" is correct!\");\n //add to score count\n store.score = store.score + 1; \n //incorrect answer pop-up\n } else {\n $('.js-results').html( $(\"input:checked\").val() + ` is incorrect. The correct answer is: ${currentQuestion.correctAnswer}.`);\n }\n //helps move down question object\n store.questionNumber++;\n })\n}", "function showScore(s) {\n\n \n showElement(scoreFormEl);\n hideElement(questionsContainerEl);\n hideElement(headerEl);\n scoreEl.textContent = s + \".\";\n}", "function displayScore() {\r\n id(\"this-score\").innerText = scoreGot;\r\n id(\"score\").innerText = score;\r\n id(\"max-score\").innerText = maxScore;\r\n }", "function quizResults() {\n document.getElementById(\"score-counter\").textContent = score;\n finalScore.style.display = \"block\";\n\n}", "function displayScore(){\n \n removeQuestion();\n\n // create jQuery html objects\n var startTrivia = $('<button class=\"btn btn-primary\" id=\"start_game\">Start</button>');\n var allDone = $(\"<div>\");\n var correctAns = $(\"<div>\");\n var incorrectAns = $(\"<div>\");\n var unAns = $(\"<div>\");\n var wrongAns = (questionCount - unanswered - correctAnswers);\n var message = $(\"<div>\");\n var lineBreak = $(\"<br>\");\n // wrongAnswer\n\n // Create score card\n $(allDone).text(\"All Done, here's how you did!\")\n $(correctAns).text(\"Correct Answers: \" + correctAnswers);\n $(incorrectAns).text(\"Incorrect Answers: \" + wrongAns);\n $(unAns).text(\"Unanswered: \" + unanswered);\n\n $(message).text('\"Select Start if you want to restart Trivia game\"');\n\n // load score card\n $(loadContent).append(allDone);\n $(loadContent).append(correctAns);\n $(loadContent).append(incorrectAns);\n $(loadContent).append(unAns);\n \n // create line break\n $(loadContent).append(lineBreak);\n $(loadContent).append(lineBreak);\n\n // load Restart game message\n $(loadContent).append(message);\n $(loadContent).append(startTrivia);\n\n }", "submit() {\r\n //intialises variables\r\n let newScore = this.state.score;\r\n let questionNumber = this.state.questionNum;\r\n let nextButton = this.state.button;\r\n\r\n //checks if button is clicked\r\n //if the buttons not clicked user is\r\n //prompted a message sating please select\r\n //an answer\r\n if (\r\n this.state.buttonActive == \"\" &&\r\n (this.state.page == \"Question\" || this.state.page == \"Finish\")\r\n ) {\r\n alert(\"Please Select an Answer\");\r\n }\r\n //if the button is clicked then a check is\r\n //made to see if it was the next button\r\n //that was clicked\r\n\r\n //if that is the case a check is made to see\r\n //if the users selected value is the correct one\r\n //if so 1 is addedto the users score\r\n else if (this.state.button == \"Next\") {\r\n if (\r\n this.state.buttonActive ==\r\n this.state.questions[this.state.questionNum].correctAnswer\r\n ) {\r\n newScore = this.state.score + 1;\r\n }\r\n //if the user is on the last question\r\n //the button is changed to finish\r\n if (this.state.questionNum + 1 == this.state.questions.length - 1) {\r\n nextButton = \"Finish\";\r\n //question number is plus oned to get the\r\n //next set of questions and answers\r\n questionNumber++;\r\n } else {\r\n //question number is plus oned to get the\r\n //next set of questions and answers\r\n questionNumber++;\r\n }\r\n //chnages the state values accordingly\r\n this.setState({\r\n score: newScore,\r\n button: nextButton,\r\n questionNum: questionNumber,\r\n buttonActive: \"\"\r\n });\r\n //if the button clicked was finish\r\n //a check is made to see if the users\r\n //answer was correct and then\r\n //sets the end message to tell\r\n //the user their score\r\n } else if (this.state.button == \"Finish\") {\r\n if (\r\n this.state.buttonActive ==\r\n this.state.questions[this.state.questionNum].correctAnswer\r\n ) {\r\n newScore = this.state.score + 1;\r\n }\r\n //message created bassed of user score\r\n let message =\r\n \"You Scored \" +\r\n newScore.toString() +\r\n \" out of \" +\r\n this.state.questions.length.toString();\r\n //states updated accordingly\r\n this.setState({\r\n score: newScore,\r\n page: \"Results\",\r\n button: \"Retry\",\r\n questionNum: 0,\r\n buttonActive: \"\",\r\n resultMessage: message\r\n });\r\n //else if none of the other buttons match\r\n //this means the user wantes to resest the\r\n //quiz and will revert back to the\r\n //original state\r\n } else {\r\n this.setState({\r\n score: 0,\r\n button: \"Next\",\r\n questionNum: 0,\r\n page: \"Question\"\r\n });\r\n }\r\n }", "function correctAnswer() {\n $('.checkBox').html(\n `<h3 class=\"correctHeading\">Good answer Kid!</h3>\n <img src=\"images/GKMC-cover-art.jpg\" alt=\"good kid maad city cover\" class=\"checkImg\">\n <p class=\"questionAndScore checkText\">Keep it up fam!</p>\n <button type=\"button\" class=\"nextButton button\">Next one</button>`\n );\n updateScore();\n // console.log('correctAnswer ran')\n // console.log(score);\n }", "function handleSubmitButton () {\n $('#quiz-form').submit(function (event) {\n event.preventDefault();\n console.log('js-submit-btn was clicked.');\n if (store.submitBtnClicked === false) {\n store.submitBtnClicked = true;\n console.log(store.submitBtnClicked);\n checkCorrectAnswer();\n updateCounter();\n }\n });\n}", "function finalScorePage() {\n $(\".userAnswer\").remove();\n $(\".answerCheck\").hide();\n $(\"h1\").text(\n \"You got \" +\n scoreTracker +\n \" out of \" +\n quizquestions.length +\n \" correct\"\n );\n $(\"h1\").css(\"text-align\", \"center\");\n var pQuote = $(\"<p>\");\n pQuote.addClass(\"percentRight\");\n var percent = 100 * (scoreTracker / quizquestions.length);\n pQuote.text(percent + \"%\");\n $(\"main\").append(pQuote);\n\n var label = $(\"<p>\");\n label.addClass(\"label\");\n label.text(\"Please enter your initals\");\n $(\"main\").append(label);\n\n var input = $(\"<input>\");\n input.attr(\"id\", \"input\");\n input.addClass(\"userInitials\");\n $(\"main\").append(input);\n\n var submitbtn = $(\"<button>\");\n submitbtn.addClass(\"submitBtn\");\n submitbtn.text(\"Submit\");\n $(\"main\").append(submitbtn);\n }", "function turnOn() {\n $buttons.prop('disabled', false);\n updateScore();\n }", "function displayScore() {\n clearInterval(timer);\n $(\"#timer\").hide();\n $(\"#questions\").hide();\n $(\".answers\").hide();\n $(\"#clock\").hide();\n $(\"#score\").show();\n\n $(\"#score\").css(\"border-radius\", \"30px\");\n\n var percentage = Math.round((correct / questions.length) * 100);\n console.log(\"Percentage: \" + percentage)\n\n function addScore() {\n var totalScore = $(\"<p class = 'final-score'>\").html(\"Your total score is: <b>\" + percentage + \"%</b>\");\n $(\"#score\").append(totalScore);\n var totalCorrect = $(\"<p>\").text(correct + \" Correct Answers.\");\n $(\"#score\").append(totalCorrect);\n var totalIncorrect = $(\"<p>\").text(incorrect + \" Incorrect Answers.\");\n $(\"#score\").append(totalIncorrect);\n }\n\n if (percentage > 80) {\n var message = $(\"<h3>\").text(\"Started from the bottom, now you're here.\")\n $(\"#score\").append(message);\n addScore();\n $(\"#score\").append(\"<img class = 'answer-images' src = 'https://media.giphy.com/media/zMCfqXkwjmTO8/giphy.gif' class = '' alt = 'Kanye Laughing'>\")\n }\n else if (percentage > 50) {\n var message = $(\"<h3>\").text(\"Impressive, but there's still room for improvement.\");\n $(\"#score\").append(message);\n addScore();\n }\n else {\n var message = $(\"<h3>\").text(\"Sit down... Be humble.\");\n $(\"#score\").append(message);\n addScore();\n }\n\n var restartButton = $(\"<button>\").attr(\"id\", \"restart\").addClass(\"btn game-button\").text(\"Play Again?\");\n $(\"#score\").append(restartButton);\n\n }", "function showScore() {\n $(\"#questions div\").hide();\n $(\"#questions button\").hide();\n $(\"#total-correct\").append(\"Total Correct: \" + correct);\n $(\"#total-incorrect\").append(\"Total Incorrect: \" + incorrect);\n $(\"#total-unanswered\").append(\"Total Unanswered: \" + unanswered);\n}", "function handlecorrectAnswer(){\n $('.QAform').html(`\n <img class = \"icon circle\" src = \"https://github.com/katngo/catquiz/blob/master/cat-broke-vase.jpg?raw=true\" alt = \"cat broke the vase\"></img>\n <p>Hmm...you're not bad at all</p>\n <button type = \"button\" class = \"nextButton\">Next</button>`);\n updateScore();\n}", "function renderscore() {\n quiz.style.display =\"none\";\n progress.style.display = \"block\";\n var scorePercent = 100 * score / questions.lenght;\n finalscore.value = scorePercent\n save.value = scorePercent;\n}", "function updateScore () {\n incrementScore ();\n $('.js-score').text(score);\n}", "function handleSubmitBtn() {\n try {\n const result = game.playersGuessSubmission( input.value );\n if (result === 'You Win!' || result === 'You Lose.') {\n pauseScreen(result);\n } else {\n updateScreen(result);\n }\n } catch (error) {\n updateScreen(error);\n }\n \n input.value = '';\n}", "function handleSubmitButton() {\n $('#container').on('submit', 'form', function(event) {\n event.preventDefault()\n//instead do the below\n//userAnswer is a variable that listens for which input is selected within the span sibilings\n const userAnswer = $('input:checked').siblings('label');\n console.log(userAnswer.length);\n if (userAnswer.length == 0) {\n\talert(\"Please select an answer\");\n}\nelse {\n// create a variable that listens for a function that checks the user's answer\n const userIsCorrect = checkUserAnswer(userAnswer);\n//if the user is correct assign +1 to their score\n if(userIsCorrect) {\n \t// console.log(\"correct\")\n $('#container').html(generateCorrectFeedback());\n iterateCorrectAnswers();\n//if the user is incorrect assign nothing to their overall score\n } else {\n // generateIncorrectFeedback();\n //render this function into the html\n $('#container').html(generateIncorrectFeedback());\n }}\n });\n}", "function setScore() {\n let score = $('input:checked[value=correct]').length\n $('#score').text(score);\n }", "function updateScore() {\n document.getElementById(\"demo9\").innerHTML = \"Score: \" + score;\n }", "function submitscore(){\n\n maincontainer.innerHTML = '';\n maincontainer.setAttribute('class','maincontainer');\n \n var headline = document.createElement(\"h3\");\n headline.textContent = \"All Done !\";\n headline.setAttribute(\"class\",\"scoremessage\");\n\n\n var ptag = document.createElement(\"p\");\n ptag.textContent = (\"Your Final Score is: \" + score ) ;\n ptag.setAttribute(\"class\",\"scoremessage\");\n\n var userinitials = document.createElement(\"Label\");\n userinitials.textContent = \"Enter initials:\";\n userinitials.setAttribute(\"class\",\"scoremessage\");\n\n var inputcontent = document.createElement(\"input\");\n inputcontent.setAttribute(\"class\",\"usrinput\");\n\n var submit = document.createElement(\"button\");\n submit.setAttribute(\"class\",\"btn\");\n submit.setAttribute(\"id\",\"submitbtn\");\n submit.textContent = \"Submit\";\n \n maincontainer.append(headline);\n maincontainer.append(ptag);\n maincontainer.append(userinitials);\n maincontainer.append(inputcontent);\n maincontainer.append(submit);\n\n\n submit.addEventListener('click', function(){\n onclicksubmitscore(inputcontent.value);\n\n });\n\n}", "function SubmitClick() {\n var scoreTotalDiv = +$(\"#scoreTotalDiv\").text();\n var word = GetWord();\n var scoreofWord = 0;\n\n if (!validWord(word)) {\n //resets letters if invalid word\n ResetAllLetters();\n $(\"#scoreofWord\").text(0);\n } else {\n //calculating all scores and updating the html\n scoreofWord = calcscore();\n $(\"#scoreofWord\").text(scoreofWord);\n scoreTotalDiv = +$(\"#scoreTotalDiv\").text();\n scoreTotalDiv += scoreofWord;\n $(\"#scoreTotalDiv\").text(scoreTotalDiv);\n $(\"#board img\").remove();\n //removing used tiles\n GetTiles();\n //getting new tiles\n DragAndDrop();\n MakespotsDroppable();\n //making spots droppable\n Remove_();\n //removes name _ if any\n }\n}", "handleSubmit(e) {\n e.preventDefault();\n\n this.props.handleSubmit(this.state)\n\n // resets score form after user submits final score\n this.setState({\n team_one_score: \"\",\n team_two_score: \"\",\n team_one_name: this.props.team_one_name,\n team_two_name: this.props.team_two_name,\n saved: true\n })\n\n // hide the saved message after 2 seconds\n setTimeout(() => this.setState({ saved: false }), 2000);\n }", "function showCorrect() {\n console.log('correct answer submitted');\n updateScore ();\n if (questionIndex < 10) {\n $('main').html(`\n <section class=\"correct-answer\" role=\"main\">\n <h2>Correct!</h2>\n <div>\n <img class=\"feedback-image-correct\" src=\"https://github.com/hotdogmcgee/Thinkful-Quiz-App---Module-8.7-8/blob/master/images/Segovia%20-%20You%20Got%20it%20Right!.jpg?raw=true\" alt=\"Segovia Smiling\">\n </div>\n <button class=\"js-next-question submit-button\">Next Question</button>\n </section>\n `)\n } else {\n //provides See Results button\n //increaseQuestionIndex();\n $('main').html(`\n <section class=\"correct-answer\" role=\"main\">\n <h2>Correct!</h2>\n <div>\n <img class=\"feedback-image-correct\" src=\"https://github.com/hotdogmcgee/Thinkful-Quiz-App---Module-8.7-8/blob/master/images/Segovia%20-%20You%20Got%20it%20Right!.jpg?raw=true\" alt=\"Segovia Smiling\">\n </div>\n <button class=\"js-results-page submit-button\">See Results</button>\n </section>\n `)\n }\n}", "function score() {\n $(\"#middle\").append(\"<p>Correct Anwsers: \" + correct + \"</p>\");\n $(\"#middle\").append(\"<p>Wrong Anwsers: \" + wrong + \"</p>\");\n $(\"#middle\").append(\"<button id='play-again'>Play Again?</button>\");\n $(\"#show-number\").remove();\n $(\"#show-questions\").remove();\n}", "function updateScore(){\n $('#score').html(score);\n }", "function clickedWrong() {\n $(\"#correctInput\").hide();\n $(\"#wrongInput\").show();\n if (clickedWrong) {\n yourScore -=5;\n }; if (yourScore < 0) {\n yourScore=0;\n }\n }", "function showHighScore() {\n startQuizDiv.style.display = \"none\";\n gameOver.style.display = \"none\";\n highScoreEl.style.display = \"flex\";\n highScorePageEl.style.display = \"block\";\n endGameBtn.style.display = \"flex\";\n\n generateHighScore();\n}", "function UpdateScore() {\r\n recentScore.push(math.round(currentScore));\r\n recentScore.shift();\r\n var screenRecentScore = recentScore.join('&nbsp;&nbsp;&nbsp;&nbsp;'); \r\n if (feedbackVisible) {\r\n $('#recent-score').html(screenRecentScore);\r\n $('#current-score').html(math.round(currentScore));\r\n }\r\n else {\r\n $('#recent-score').html('N/A');\r\n $('#current-score').html('N/A');\r\n }\r\n cpaLine.map(function (element) {\r\n element.visible = true; \r\n return element\r\n })\r\n cpaCircle.map(function (element) {\r\n element.visible = true;\r\n return element\r\n }) \r\n $('#play-conflict-btn').prop('disabled', false);\r\n $('#play-resolution-btn').prop('disabled', false); \r\n}", "function changeScore() {\n //increments global score variable by 1\n score++;\n // updates the score label\n labelScore.setText(score.toString());\n }", "function submitHighscore() {\n var highscore = select('#highscore_input');\n select('#highscore_submit').attribute('disabled', true);\n var name = highscore.value();\n var counter = highscore.attribute('counter');\n var jsonHighscores;\n if (counter === null) {\n highscoreData = {};\n highscoreData.highscores = [];\n highscoreData.highscores.push({\n \"name\": name,\n \"score\": score\n });\n jsonHighscores = JSON.stringify(highscoreData);\n } else {\n var json = highscoreData.highscores;\n highscoreData = {};\n highscoreData.highscores = json;\n highscoreData.highscores.splice(counter, 0, {\n \"name\": name,\n \"score\": score\n });\n if (highscoreData.highscores.length > 9) {\n highscoreData.highscores.shift();\n }\n jsonHighscores = JSON.stringify(highscoreData);\n }\n //save(jsonHighscores, 'highscores.json');\n download(jsonHighscores, 'highscores.json', 'application/json');\n}", "function scoreNo() {\n\n if (idSecondButton == 1) {\n score = score + 100;\n } else if (idSecondButton == 3) {\n score = score + 300;\n } else if (idSecondButton == 5) {\n score = score + 10;\n } else if (idSecondButton == 7) {\n score = score + 200;\n } else if (idSecondButton == 9) {\n score = score + 10;\n } else if (idSecondButton == 11) {\n score = score + 100;\n } else if (idSecondButton == 13) {\n score = score + 500;\n } else if (idSecondButton == 15) {\n score = score + 500;\n } else if (idSecondButton == 17) {\n score = score + 100;\n } else if (idSecondButton == 19) {\n score = score + 0;\n } else if (idSecondButton == 21) {\n score = score + 0;\n } else if (idSecondButton == 23) {\n score = score + 10;\n } else if (idSecondButton == 25) {\n score = score + 100;\n } else if (idSecondButton == 27) {\n score = score + 10;\n } else if (idSecondButton == 29) {\n score = score + 200;\n } else if (idSecondButton == 31) {\n score = score + 100;\n } else if (idSecondButton == 33) {\n score = score + 100;\n } else if (idSecondButton == 35) {\n score = score + 200;\n } else if (idSecondButton == 37) {\n score = score + 100;\n } else if (idSecondButton == 39) {\n score = score + 0;\n }\n\n console.log(score);\n\n }", "function handleAnswerSubmitButton() {\n $('main').submit('.submit-button', function (event) {\n event.preventDefault();\n checkAnswerChoice();\n });\n}", "function finalScore(userQuestionNumber) {\n // console.log(\"function finalScore\", userQuestionNumber);\n // console.log('score number', scoreNumber);\n\n let moreThanAverage =\n $(`<h3 class=\"moreThanAverage\">The world is yours!</h3> \n <img src=\"images/giphy-nice-job.gif\" alt=\"spinning globe\" class=\"globe\">\n <p>You scored: <span class=\"scoreNumber\">${scoreNumber}</span> out of 10</p>`)\n $('.result').html(moreThanAverage);\n\n let average =\n $(`<h3 class=\"average\">Hey! Not bad!</h3> \n <img src=\"images/destinations.jpg\" alt=\"destinations and directions signs\">\n <p>You scored: <span class=\"scoreNumber\">${scoreNumber}</span> out of 10</p>`)\n $('.result').html(average);\n\n let lessThanAverage =\n $(`<h3 class=\"lessThanAverage\">You'll do better next time!</h3> \n <img src=\"images/denied.jpg\" alt=\"denied stamped passport\">\n <p>You scored: <span class=\"scoreNumber\">${scoreNumber}</span> out of 10</p>`)\n $('.result').html(lessThanAverage);\n\n $('.questionAndScore').hide();\n $('.questions').hide();\n $('.feedback').hide();\n $('.result').show();\n $(`<button type=\"button\" class=\"startAgain button\">Start Again</button>`).appendTo('.result');\n\n if (scoreNumber >= 8) {\n $('.result').html(moreThanAverage);\n } else if (scoreNumber >= 5) {\n $('.result').html(average);\n } else if (scoreNumber <= 4) {\n $('.result').html(lessThanAverage);\n }\n}", "function scoreboard(){\n $('#timeLeft').empty();\n $('#message').empty();\n $('#correctedAnswer').empty();\n $('#gif').hide();\n $(\"#gifCaption\").hide();\n \n $('#finalMessage').html(messages.finished);\n $('#correctAnswers').html(\"Correct Answers: \" + correctAnswer);\n $('#incorrectAnswers').html(\"Incorrect Answers: \" + incorrectAnswer);\n $('#unanswered').html(\"Unanswered: \" + unanswered);\n $('#startOverBtn').addClass('reset');\n $('#startOverBtn').show();\n $('#startOverBtn').html(\"PLAY AGAIN\");\n }", "function updateScore() {\n document.querySelector(\"#score\").innerHTML = \"Score: \" + score;\n }", "function scoreBucket(){\n $(\"#correctAnswers\").text(rightAnswers);\n $(\"#incorrectAnswers\").text(wrongAnswers);\n $(\"#unanswered\").text(unAnswered);\n console.log(\"score bucket is working\");\n }", "onSubmitScore(e){\n e.preventDefault();\n \n\n }", "function renderCorrectAnswerResult(){\n $('input[type=\"radio\"]').attr('disabled', 'disabled');\n $('.submit-answer').before('<div class=\"message correct fade-in\"></div>');\n $(\"input[name='option']:checked\").parent().addClass('correct-answer');\n updateScore();\n console.log('correct!');\n}", "function p_score_inst_click() {\n SetActive(p_score_instId, false);\n SetActive('#Q1', true);\n SetActive(l_scoreId, true, 0.1);\n PlayVO2('#Q1');\n}", "function updateScore() {\n $score.text(score);\n}", "function clickSubmit(){\r\n\tresult.classList.remove(\"hide\");\r\n\tdocument.getElementById(\"quiz\").classList.add(\"hide\");\r\n\tdocument.getElementById(\"restart\").classList.remove(\"hide\");\r\n\tansMessage.innerHTML=\"\";\r\n\tbody.style.backgroundImage='url(\"https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/andromeda-galaxy-royalty-free-image-1585682435.jpg\")';\r\n\tbody.style.backgroundSize='cover';\r\n\r\n\tscoreContainer.classList.remove(\"hide\");\r\n\tfor(var i=0;i<10;i++){\r\n\t\tabc=shuffledQues[i];\r\n\t\tfinalScore+=abc.scores;\r\n\t}\r\n\r\n\tresult.innerHTML=\"Name: \"+username.value+\"<br> Your score is \"+finalScore+\"/10 <br> Correct Percentage:\"+finalScore*10+\"% <br> Number of correct questions= \"+finalScore;\r\n\tsubmit.disabled=true;\r\n\tnext.disabled=true;\r\n\tprev.disabled=true;\r\n\tvar today= new Date();\r\n\ttodaydate = today.getDate()+'-'+(today.getMonth()+1)+'-'+today.getFullYear();\r\n\ttodaytime = today.getHours() + \":\" + today.getMinutes() + \":\" + today.getSeconds();\r\n\t\r\n\tvar scores = JSON.parse(localStorage.getItem(\"detailstored\"));\r\n\tconsole.log(JSON.parse(localStorage.getItem(\"detailstored\")));\r\n\tupdate();\r\n\tfunction update(){\r\n\r\n\t\tif(scores==null){\r\n\t\t\tvar details={\r\n\t\t\t\tname:username.value,\r\n\t\t\t\tscore:finalScore,\r\n\t\t\t\tdate:todaydate,\r\n\t\t\t\ttime:todaytime\r\n\t\t\t};\r\n\r\n\t\t\tlocalStorage.setItem(\"detailstored\", JSON.stringify(details));\r\n\t\t\tscores = JSON.parse(localStorage.getItem(\"detailstored\"));\r\n\r\n\t\t\tdispName.innerHTML=\"Name: \"+scores.name;\r\n\t\t\tdispScore.innerHTML=\"Score: \"+scores.score+\"/10\";\r\n\t\t\tdispDate.innerHTML=\"Date: \"+scores.date;\r\n\t\t\tdispTime.innerHTML=\"Time: \"+scores.time;\r\n\r\n\t\t}\r\n\t\tif((finalScore>=scores.score)){\r\n\t\t\tvar details={\r\n\t\t\t\tname:username.value,\r\n\t\t\t\tscore:finalScore,\r\n\t\t\t\tdate:todaydate,\r\n\t\t\t\ttime:todaytime\r\n\t\t\t};\r\n\r\n\t\t\tlocalStorage.setItem(\"detailstored\", JSON.stringify(details));\r\n\t\t\tscores = JSON.parse(localStorage.getItem(\"detailstored\"));\r\n\r\n\t\t\tdispName.innerHTML=\"Name: \"+scores.name;\r\n\t\t\tdispScore.innerHTML=\"Score: \"+scores.score+\"/10\";\r\n\t\t\tdispDate.innerHTML=\"Date: \"+scores.date;\r\n\t\t\tdispTime.innerHTML=\"Time: \"+scores.time;\r\n\r\n\t\t}\r\n\r\n\t\tif((finalScore<scores.score)){\r\n\t\t\tdispName.innerHTML=\"Name: \"+scores.name;\r\n\t\t\tdispScore.innerHTML=\"Score: \"+scores.score+\"/10\";\r\n\t\t\tdispDate.innerHTML=\"Date: \"+scores.date;\r\n\t\t\tdispTime.innerHTML=\"Time: \"+scores.time;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}", "function updateScore() {\n $('#scoreNumber').text(score);\n}", "function toggleLeaderboard() {\n var popup = document.getElementById(\"leaderboard-popup\");\n var button = document.getElementById(\"leaderboard-button\");\n if(popup.classList.toggle(\"show\")) {\n button.value = \"Hide Leaderboard\";\n }\n else {\n button.value = \"Show Leaderboard\"\n } \n \n}", "function scoreYes() {\n\n if (idFirstButton == 0) {\n score = score - 100;\n } else if (idFirstButton == 2) {\n score = score - 200;\n } else if (idFirstButton == 4) {\n score = score - 250;\n } else if (idFirstButton == 6) {\n score = score - 300;\n } else if (idFirstButton == 8) {\n score = score - 100;\n } else if (idFirstButton == 10) {\n score = score - 400;\n } else if (idFirstButton == 12) {\n score = score - 200;\n } else if (idFirstButton == 14) {\n score = score - 500;\n } else if (idFirstButton == 16) {\n score = score - 1000;\n } else if (idFirstButton == 18) {\n score = score - 0;\n } else if (idFirstButton == 20) {\n score = score - 0;\n } else if (idFirstButton == 22) {\n score = score - 1500;\n } else if (idFirstButton == 24) {\n score = score - 500;\n } else if (idFirstButton == 26) {\n score = score - 100;\n } else if (idFirstButton == 28) {\n score = score - 100;\n } else if (idFirstButton == 30) {\n score = score - 1500;\n } else if (idFirstButton == 32) {\n score = score - 500;\n alert(\"Quelle indignité ...\");\n } else if (idFirstButton == 34) {\n score = score - 500;\n } else if (idFirstButton == 36) {\n score = score - 3000;\n alert(\"C'EST GAME !\");\n } else if (idFirstButton == 38) {\n score = score - 5000;\n \n }\n\n console.log(score);\n\n }", "function submitAnswer() {\n $('form').on('submit', function (event) {\n event.preventDefault();\n let selected = $('input:checked');\n let answer = selected.val();\n let rightAnswer = `${STORE[questionNum].correctAnswer}`;\n\n if (answer === rightAnswer) {\n selectCorrectAnswer();\n scoreUpdater();\n } else {\n selectWrongAnswer();\n }\n })\n}", "function addScore() {\n\ttimer.innerHTML = \"\";\n\tquestion.textContent = \"All done!\";\n\tquizCover.textContent = \"Your final score is: \" + points;\n\tquizCover.style.display = \"block\";\n\tuserResult.textContent = \"\";\n\n\tvar initials = '<input id =\"initials\" type=\"text\" name=\"initials\" placeholder=\"\" />';\n\n\tanswers.innerHTML = \"<h3>Enter Initials: \" + initials + \"</h3>\" + '<button id=\"submitScore\"\">SUBMIT</button>';\n\treturn [initials, points];\n}", "function submitPressed() {\n \n}", "function endQuiz() {\n answerCheck();\n clearInterval(timerStart);\n // hides submit button\n document.getElementById(\"gamePrize\").style.visibility = \"visible\";\n $(\"#gamePrize\").text(\"you got \" + score + \" correct out of 5\")\n\n}", "function changeToNorm(){\n\t\tdocument.getElementById(\"subBtn\").innerHTML = \"Submit\";\n\n\n\t}", "function checkAnswer() {\n $('#main').on('submit', '.question-form', function(event) {\n event.preventDefault();\n const currentQues = STORE.questions[STORE.currentQuestion];\n const selectedOption = $('input[name=options]:checked').val();\n if (selectedOption === currentQues.answer) {\n STORE.score += 1;\n $('#main').append('<p class=\"answer-message\">Correct! 🤟</p>');\n } else {\n $('#main').append(`<p class=\"answer-message\">Woops! The correct answer is ${STORE.questions[STORE.currentQuestion].answer}</p>`);\n };\n STORE.currentQuestion += 1; \n $('.submit-button').hide(); \n $('.next-button').show();\n });\n}", "function submitHighScore(event){\n event.preventDefault();\n var userText = userInput.value.trim();\n if (userText === \"\" || scoreEl.innerHTML == \"\") {\n return;\n }\n //prevents submission during the quiz as well as if the quiz has not been completed\n if( userScore != 0 && quizStarted == false){\n promptTextEl.textContent= \"Thanks for playing! Click the start button if you want to try again.\"\n userInitials = userText\n highScore.innerHTML = \"Current High Score: \" + userInitials + \" \" + userScore;\n }\n else{\n promptTextEl.textContent= \"You must finish the quiz to submit your score! Click the Start button if you have not already!\"\n }\n}", "function correctAnswerFeedback() {\n $(\".quizForm\").hide();\n $(\".feedBackPage\").show();\n\n $(\".feedBackPage\").html(`<img class=\"sadImg\"\n src=\"https://user-images.githubusercontent.com/30050423/58558719-1337f500-8211-11e9-8291-d3e341cdac21.png\" alt=\"\"/>\n <h3>That's Correct!</h3><br><img class=\"graphic\" src=\"${\n QUIZ[questionNumber].graphic\n }\" alt=\"${QUIZ[questionNumber].alt}\"/><p>${\n QUIZ[questionNumber].info\n }</p>\n <button type=\"button\" class=\"next-btn button\">Next Question</button>`);\n\n increaseScore();\n console.log(\"correctAnswerFeedback() ran\");\n}" ]
[ "0.7403726", "0.7203572", "0.7027058", "0.6890308", "0.6847451", "0.682187", "0.68187296", "0.67482615", "0.6747704", "0.6709199", "0.6707848", "0.66887385", "0.667758", "0.66754323", "0.6670127", "0.6568055", "0.6558327", "0.6501015", "0.6493093", "0.6485444", "0.64812475", "0.6459362", "0.64537287", "0.6450166", "0.6428073", "0.6396903", "0.63957053", "0.63922167", "0.6386251", "0.6385699", "0.63738334", "0.6368429", "0.6368355", "0.63636315", "0.6355219", "0.6341169", "0.63408756", "0.6332925", "0.63317084", "0.6326305", "0.6326245", "0.6312821", "0.6308615", "0.628336", "0.6279956", "0.62785214", "0.62757105", "0.62741184", "0.62686026", "0.6264649", "0.62644947", "0.626026", "0.62553793", "0.62550294", "0.6254069", "0.6240905", "0.6239613", "0.62251717", "0.62123823", "0.6209026", "0.619875", "0.6196082", "0.6192074", "0.618946", "0.61892253", "0.6188279", "0.61850363", "0.61840314", "0.6179474", "0.6178938", "0.61775386", "0.617052", "0.61692613", "0.61652374", "0.6160369", "0.6160073", "0.61575323", "0.61471933", "0.61376876", "0.6132739", "0.6129479", "0.612676", "0.6118522", "0.6114639", "0.610568", "0.6105495", "0.61053497", "0.61041087", "0.61036384", "0.61002296", "0.60993916", "0.6099264", "0.60972375", "0.60968024", "0.60956717", "0.6087952", "0.60875905", "0.6082101", "0.60798645", "0.6079646", "0.60785294" ]
0.0
-1
! SCOREBOARD BUTTONS This is the function that runs to build scoreboard buttons
function buildScoreboardButtons(){ $('#buttonCancel').click(function(){ playSound('soundSelect'); goScorePage(''); }); $('#buttonSubmit').click(function(){ playSound('soundSelect'); var typeString = 'quizgame' if(categoryPage){ typeString = category_arr[categoryNum]; } submitUserScore(typeString, playerData.score); }); scoreBackTxt.cursor = "pointer"; scoreBackTxt.addEventListener("click", function(evt) { playSound('soundSelect'); goScorePage(''); }); buttonReplay.cursor = "pointer"; buttonReplay.addEventListener("click", function(evt) { playSound('soundSelect'); if(categoryPage){ goPage('category'); }else{ goPage('game'); } }); saveButton.cursor = "pointer"; saveButton.addEventListener("click", function(evt) { playSound('soundSelect'); goScorePage('submit'); }); scoreboardButton.cursor = "pointer"; scoreboardButton.addEventListener("click", function(evt) { playSound('soundSelect'); goScorePage('scoreboard'); var typeString = 'quizgame' if(categoryPage){ typeString = category_arr[categoryNum]; } loadScoreboard(typeString); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createButtons() {\n // When the A button is pressed, add the current frame\n // from the video with a label of \"rock\" to the classifier\n buttonA = select('#addClassRock');\n buttonA.mousePressed(function() {\n addExample('Rock');\n });\n\n // When the B button is pressed, add the current frame\n // from the video with a label of \"paper\" to the classifier\n buttonB = select('#addClassPaper');\n buttonB.mousePressed(function() {\n addExample('Paper');\n });\n\n // When the C button is pressed, add the current frame\n // from the video with a label of \"scissor\" to the classifier\n buttonC = select('#addClassScissor');\n buttonC.mousePressed(function() {\n addExample('Scissor');\n });\n\n // Reset buttons\n resetBtnA = select('#resetRock');\n resetBtnA.mousePressed(function() {\n clearLabel('Rock');\n });\n\t\n resetBtnB = select('#resetPaper');\n resetBtnB.mousePressed(function() {\n clearLabel('Paper');\n });\n\t\n resetBtnC = select('#resetScissor');\n resetBtnC.mousePressed(function() {\n clearLabel('Scissor');\n });\n\n // Predict button\n buttonPredict = select('#buttonPredict');\n buttonPredict.mousePressed(classify);\n\n // Clear all classes button\n buttonClearAll = select('#clearAll');\n buttonClearAll.mousePressed(clearAllLabels);\n}", "function buildScoreBoardCanvas(){\n\tif(!displayScoreBoard){\n\t\treturn;\t\n\t}\n\t\n\t//buttons\n\tresultContainer.removeChild(replayButton);\n\t\n\tbuttonReplay = new createjs.Bitmap(loader.getResult('iconReplay'));\n\tcenterReg(buttonReplay);\n\tcreateHitarea(buttonReplay);\n\tsaveButton = new createjs.Bitmap(loader.getResult('iconSave'));\n\tcenterReg(saveButton);\n\tcreateHitarea(saveButton);\n\tscoreboardButton = new createjs.Bitmap(loader.getResult('iconScoreboard'));\n\tcenterReg(scoreboardButton);\n\tcreateHitarea(scoreboardButton);\n\t\n\tresultContainer.addChild(buttonReplay, saveButton, scoreboardButton);\n\t\n\t//scoreboard\n\tscoreBoardContainer = new createjs.Container();\n\tbgScoreboard = new createjs.Bitmap(loader.getResult('bgScoreboard'));\n\t\n\tscoreTitle = new createjs.Text();\n\tscoreTitle.font = \"80px bariol_regularregular\";\n\tscoreTitle.color = \"#ffffff\";\n\tscoreTitle.text = scoreBoardTitle;\n\tscoreTitle.textAlign = \"center\";\n\tscoreTitle.textBaseline='alphabetic';\n\tscoreTitle.x = canvasW/2;\n\tscoreTitle.y = canvasH/100*14;\n\t\n\tscoreBackTxt = new createjs.Text();\n\tscoreBackTxt.font = \"50px bariol_regularregular\";\n\tscoreBackTxt.color = \"#ffffff\";\n\tscoreBackTxt.text = scoreBackText;\n\tscoreBackTxt.textAlign = \"center\";\n\tscoreBackTxt.textBaseline='alphabetic';\n\tscoreBackTxt.x = canvasW/2;\n\tscoreBackTxt.y = canvasH/100*95;\n\tscoreBackTxt.hitArea = new createjs.Shape(new createjs.Graphics().beginFill(\"#000\").drawRect(-200, -30, 400, 40));\n\tscoreBoardContainer.addChild(bgScoreboard, scoreTitle, scoreBackTxt);\n\t\n\tvar scoreStartY = canvasH/100*23;\n\tvar scoreSpanceY = 49.5;\n\tfor(scoreNum=0;scoreNum<=10;scoreNum++){\n\t\tfor(scoreColNum=0;scoreColNum<score_arr.length;scoreColNum++){\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum] = new createjs.Text();\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].font = \"35px bariol_regularregular\";\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].color = \"#ffffff\";\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].textAlign = score_arr[scoreColNum].align;\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].textBaseline='alphabetic';\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].x = canvasW/100 * score_arr[scoreColNum].percentX;\n\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].y = scoreStartY;\n\t\t\t\n\t\t\tif(scoreColNum == 0){\n\t\t\t\t//position\n\t\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].text = scoreRank_arr[scoreNum-1];\t\n\t\t\t}\n\t\t\t\n\t\t\tif(scoreNum == 0){\n\t\t\t\t$.scoreList[scoreNum+'_'+scoreColNum].text = score_arr[scoreColNum].col;\t\n\t\t\t}\n\t\t\t\n\t\t\tscoreBoardContainer.addChild($.scoreList[scoreNum+'_'+scoreColNum]);\n\t\t}\n\t\tscoreStartY += scoreSpanceY;\n\t}\n\t\n\tscoreBoardContainer.visible = false;\n\tcanvasContainer.addChild(scoreBoardContainer);\n\t\n\t$.get('submit.html', function(data){\n\t\t$('#canvasHolder').append(data);\n\t\tbuildScoreboardButtons();\n\t\ttoggleSaveButton(true);\n\t\tresizeScore();\n\n\t});\n}", "function newButtonFunction () {\n score = [0,0];\n activePlayer = 0;\n roundScore = 0;\n document.getElementById (\"score-0\").textContent = 0; \n document.getElementById (\"score-1\").textContent = 0;\n document.getElementById (\"current-0\").textContent = 0;\n document.getElementById (\"current-1\").textContent = 0;\n document.getElementById (\"name-0\").textContent = \"Player 1\";\n document.getElementById (\"name-1\").textContent = \"Player 2\";\n document.querySelector(\".player-0-panel\").classList.remove(\"active\");\n document.querySelector(\".player-1-panel\").classList.remove(\"active\");\n document.querySelector(\".player-0-panel\").classList.remove(\"winner\");\n document.querySelector(\".player-1-panel\").classList.remove(\"winner\");\n document.querySelector(\".player-0-panel\").classList.add(\"active\");\n hide ();\n document.querySelector(\".btn-roll\").style.display = \"block\";\n document.querySelector(\".btn-hold\").style.display = \"block\";\n gamePlaying = true;\n previousThrow = 0;\n // winningScore = prompt (\"Enter the score limit !\");\n }", "function gameButtonsLogic() {\n $(\"#bluegem\").click(function () {\n totalScore += bluegem;\n $(\"#butt1\").text(totalScore);\n gameLogic();\n \n });\n\n $(\"#glovegem\").on(\"click\", function () {\n totalScore += glovegem;\n $(\"#butt1\").text(totalScore);\n gameLogic();\n \n });\n\n $(\"#orangegem\").on(\"click\", function () {\n totalScore += orangegem;\n $(\"#butt1\").text(totalScore);\n gameLogic();\n \n });\n\n $(\"#guitargem\").on(\"click\", function () {\n totalScore += guitargem;\n $(\"#butt1\").text(totalScore);\n gameLogic();\n \n })}", "function loadGame(){\r\n\t\t\t\t\tcountClick=0;\r\n\t\t\t \tdocument.getElementById(\"sr\").innerHTML = \"Game On !!\";\r\n\t\t\t \tdocument.getElementById(\"winner\").innerHTML = \"A Beautiful Mind\";\r\n\t\t \t\tvar buttonHtml = \"\";\r\n\t\t \t\tfor (i = 0; i <9; i++) { \r\n\t\t \t\t\tarr.length=0;// clear data of previous game\r\n\t\t\t\t\t\tif(i==2 || i==5)\r\n\t\t\t\t\t\t\tbuttonHtml=buttonHtml + \"<button class=\\\"button\\\" \"+\"id=\\\"\" +i+\"\\\" onclick=\\\"calcWinner(this.id)\\\" value=\\\"\\\"></button><br> \" ;\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tbuttonHtml=buttonHtml + \"<button class=\\\"button\\\" \"+\"id=\\\"\" +i+\"\\\" onclick=\\\"calcWinner(this.id)\\\" value=\\\"\\\"></button> \" ;\r\n\t\t\t\t \t}//for;\r\n\t\t\t \tdocument.getElementById(\"b\").innerHTML = buttonHtml ;\r\n\t\t\t\t\tdocument.getElementById(\"b\").style.background = \"grey\";\r\n\r\n}// function loadGame", "function renderButtons() {\n\n $(\"#game-input\").val(\"\");\n\n $(\"#games-viewer\").empty();\n\n for (let i = 0; i < topics.length; i++) {\n var newBtn = $(\"<button>\");\n newBtn.text(topics[i]);\n newBtn.attr(\"data-name\", topics[i]);\n newBtn.addClass(\"gameBtn\");\n $(\"#games-viewer\").append(newBtn);\n }\n\n } /// renderButtons();", "function initBtns(){\n okbtn = {\n x: (width - s_buttons.Ok.width)/2,\n y : height/1.8,\n width : s_buttons.Ok.width,\n height :s_buttons.Ok.height\n };\n \n startbtn = {\n x: (width - s_buttons.Score.width)/2,\n y : height/2.5,\n width : s_buttons.Score.width,\n height :s_buttons.Score.height\n };\n \n scorebtn = {\n x: (width - s_buttons.Score.width)/2,\n y : height/2,\n width : s_buttons.Score.width,\n height :s_buttons.Score.height\n };\n \n menubtn = {\n x:(width - 2*s_buttons.Menu.width),\n y : height/1.8,\n width : s_buttons.Menu.width,\n height :s_buttons.Menu.height\n };\n \n resetbtn = {\n x: (s_buttons.Reset.width),\n y : height/1.8,\n width : s_buttons.Reset.width,\n height :s_buttons.Reset.height\n };\n}", "function renderLeaderboardButtons() {\n ctx.globalAlpha = 1;\n button.forEach(function (question) {\n ctx.fillStyle = question.colour;\n ctx.fillRect(question.left, question.top, question.width, question.height);\n ctx.font = \"36px cymraeg\";\n ctx.fillStyle = question.text_color;\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"top\";\n ctx.fillText(question.text, question.left + question.width / 2, question.top + (question.height / 4));\n });\n ctx.font = \"18px cymraeg\";\n ctx.fillText(\"For help or questions, contact [email protected]\", canvas.width / 2, canvas.height - 35);\n}", "function addButtonActions() {\r\n var startButton = document.getElementById('button-start');\r\n startButton.addEventListener(\"click\", function () {\r\n startButton.disabled = true;\r\n showQuestionsPage();\r\n });\r\n document.getElementById('button-information').addEventListener(\"click\", function () {\r\n document.getElementById(\"information\").classList.toggle(\"active\");\r\n });\r\n document.getElementById(\"next\").addEventListener(\"click\", function () {\r\n nextQuestion();\r\n });\r\n document.getElementById(\"prev\").addEventListener(\"click\", function () {\r\n prevQuestion();\r\n });\r\n document.getElementById(\"inlogcheck\").addEventListener(\"click\", function () {\r\n checkStudent();\r\n });\r\n document.getElementById(\"particles\").addEventListener(\"click\", function () {\r\n particles();\r\n });\r\n document.getElementById(\"twitter\").addEventListener(\"click\", function () {\r\n var strtwt = \"Wow, ik heb zojuist \" + correctAnswered + \" punten van de 10 gescoord in \" + minutes + \":\" + seconds + \" op een quiz die over HTML, CSS en JavaScript gaat!\";\r\n window.open(\"https://twitter.com/intent/tweet?text=\" + encodeURI(strtwt));\r\n });\r\n document.getElementById(\"scoreboard\").addEventListener(\"click\", function () {\r\n document.getElementById(\"latestScore\").classList.toggle(\"active\");\r\n document.getElementById(\"topScore\").classList.toggle(\"active\");\r\n if (document.getElementById(\"latestScore\").classList.contains(\"active\")) {\r\n document.getElementById(\"scoreboard\").textContent = \"Bekijk top score\";\r\n } else {\r\n document.getElementById(\"scoreboard\").textContent = \"Bekijk recente score\";\r\n }\r\n });\r\n document.body.addEventListener('keydown', function (event) {\r\n keyboardFunctionality(this, event);\r\n });\r\n for (let i = 0; i < 10; i++) {\r\n var div = document.createElement(\"div\");\r\n div.className = \"block\";\r\n document.getElementById(\"shownAnswers\").appendChild(div);\r\n }\r\n}", "function topicButtons() {\n $(\"#buttons\").empty();\n $(\"#topicsCard\").hide();\n for (var i = 0; i < topics.length; i++) {\n var b = $(\"<button class='btn'>\");\n b.addClass(\"eightiesButton\");\n b.attr(\"data-name\", topics[i]);\n b.text(topics[i]);\n if (b.attr(\"data-click\"))\n b.attr(\"data-click\")\n $(\"#buttons\").append(b);\n $(\"#topic_input\").val(\"80's\");\n }\n }", "function game_board(){\r\n var i;\r\n var j;\r\n var row = 11;\r\n var col = 11;\r\n var board1 = [];\r\n var board3 = [];\r\n var leftCounter = 0;\r\n var rightCounter = 0;\r\n var middleCounter = 0;\r\n //var btns1 = document.createElement(\"button\");\r\n //var btns2 = document.createElement(\"button\");\r\n\r\n\r\n for(i = 0; i <= row; i++){\r\n //board[i] = [];\r\n for(j = 0; j <= col; j++){\r\n // board[i][j] = btns;\r\n var btns1 = document.createElement(\"button\");\r\n var btns3 = document.createElement(\"button\");\r\n btns1.setAttribute(\"class\", \"btns\");\r\n btns1.setAttribute(\"id\", \"btnLeft_\" + leftCounter);\r\n //btns1.setAttribute(\"onclick\", \"board_index()\")\r\n leftCounter++;\r\n btns3.setAttribute(\"class\", \"btns\");\r\n btns3.setAttribute(\"id\", \"btnRight_\" + rightCounter);\r\n // btns3.setAttribute(\"onclick\", \"board_index()\");\r\n rightCounter++;\r\n board1.push(btns1);\r\n board3.push(btns3);\r\n document.getElementById(\"div3\").append(btns1);\r\n document.getElementById(\"div4\").append(btns3);\r\n //document.getElementById(\"div3\").append(board1);\r\n }//End of for\r\n }//End of for\r\n\r\n for(i = 0; i < 3; i++){\r\n for(j = 0; j < 2; j++){\r\n var btns2 = document.createElement(\"button\");\r\n btns2.setAttribute(\"class\", \"btns2\");\r\n //btns2.setAttribute(\"name\", \"btns2\");\r\n btns2.setAttribute(\"id\", \"btnMiddle_\" + middleCounter);\r\n middleCounter++;\r\n // btns2.setAttribute(\"onclick\", \"board_index(button_clicked)\");\r\n document.getElementById(\"div5\").append(btns2);\r\n }//End of for\r\n }//End of for\r\n\r\n var eles = document.getElementsByClassName(\"btns\");\r\n var eles2 = document.getElementsByClassName(\"btns2\");\r\n Array.prototype.forEach.call(eles,function(ele){\r\n //ele.onclick = runMe(ele);\r\n });\r\n Array.prototype.forEach.call(eles2,function(ele){\r\n // ele.onclick = runMe(ele);\r\n }); \r\n\r\n var event_counter = 13; //Camn only go up to 13\r\n var leftEvents = 0;\r\n var rightEvents = 0; \r\n var a = 0;\r\n\r\n //Test Code \r\n //document.getElementById(\"btnLeft_1\").setAttribute(\"onclick\", \"baptismEvent()\"); \r\n //document.getElementById(\"btnLeft_1\").style.backgroundColor = \"green\"; \r\n\r\n\r\n for(i = 0; i < event_counter; i++){\r\n var num = Math.floor(Math.random() * 143) + 0;\r\n\r\n\r\n if(leftEvents < 7){\r\n document.getElementById(\"btnLeft_\" + num).setAttribute(\"name\", events[a]);\r\n //alert(events[a]);\r\n document.getElementById(\"btnLeft_\" + num).style.backgroundColor = \"green\";\r\n leftEvents++;\r\n a++;\r\n }else{\r\n document.getElementById(\"btnRight_\" + num).setAttribute(\"name\", events[a]);\r\n document.getElementById(\"btnRight_\" + num).style.backgroundColor = \"green\";\r\n a++;\r\n //}\r\n }//End of for\r\n\r\n //document.getElementById(\"btnLeft_121\").setAttribute(\"name\", \"baptismEvent\"); \r\n //document.getElementById(\"btnLeft_121\").style.backgroundColor = \"green\";\r\n }//End of for \r\n\r\n playerSpawn();\r\n\r\n var eles = document.getElementsByClassName(\"btns\");\r\n var eles2 = document.getElementsByClassName(\"btns2\");\r\n Array.prototype.forEach.call(eles,function(ele){\r\n ele.onclick = playerMove(ele);\r\n });\r\n\r\n}", "function updateScore (input) {\n scoreText.innerText = score;\n pointsRemainingText.innerText = updateRemaining();\n let buttons = document.getElementById(\"buttonGroup\").children;\n for (let i=0; i<buttons.length; i++){\n buttons[i].innerText=balls[i].quantity;\n }\n updateBar();\n}", "function buttonCreate() {\n // Delete previous buttons to avoid duplicates\n $(\"#buttons-view\").empty();\n $(\"#game-input\").val(\"\");\n\n // Looping through the array of games\n for (var i = 0; i < topics.length; i++) {\n\n // Create a button for each item in the array\n var a = $(\"<button>\");\n // Adding the class 'game' to the button\n a.addClass(\"game\");\n // Adding a data-attribute (this is how the data is passed from the button to the queryURL)\n a.attr(\"data-name\", topics[i]);\n // Providing the button text\n a.text(topics[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n\n }\n }", "function generateScoreboard() {\n let winnerText = document.getElementById(\"winner\");\n winnerText.innerText = `The winning opinion is ${marker.count[MessageType.CLICK_LEFT] > marker.count[MessageType.CLICK_RIGHT] ? firstOpt : secondOpt}!`\n\n let table = document.getElementById(\"scoreboard\");\n let thead = table.createTHead();\n let row = thead.insertRow();\n for (let title of ['Name', firstOpt, secondOpt]) {\n let th = document.createElement(\"th\");\n let text = document.createTextNode(title);\n th.appendChild(text);\n row.appendChild(th);\n }\n\n let players = Object.values(clicker_counts).sort((first, second) => (\n (second[MessageType.CLICK_LEFT] + second[MessageType.CLICK_RIGHT]) -\n (first[MessageType.CLICK_LEFT] + first[MessageType.CLICK_RIGHT])\n ))\n for (let player of players) {\n row = table.insertRow();\n if (player[MessageType.CLICK_LEFT] > player[MessageType.CLICK_RIGHT]) {\n row.className = 'table-info'\n } else if (player[MessageType.CLICK_LEFT] < player[MessageType.CLICK_RIGHT]) {\n row.className = 'table-warning'\n }\n\n\n for (let key of ['name', MessageType.CLICK_LEFT, MessageType.CLICK_RIGHT]) {\n let cell = row.insertCell();\n let text = document.createTextNode(player[key]);\n cell.appendChild(text);\n }\n }\n}", "function randNum() {\n\n scoreTarget = Math.floor((Math.random() * (120 - 19)) + 19);\n\n buttonTally = 0;\n\n// Need to link C1, C2, C3, C4 to generate buttonValues\n\n button1 = Math.floor((Math.random() * (12 - 1)) + 1);\n button2 = Math.floor((Math.random() * (12 - 1)) + 1);\n button3 = Math.floor((Math.random() * (12 - 1)) + 1);\n button4 = Math.floor((Math.random() * (12 - 1)) + 1);\n\n $(\"#scoreTarget\").html(\"Critical Star Heading: \"+scoreTarget);\n $(\"#buttonTally\").html(buttonTally);\t\n $(\"#wins\").html(\"Wins: \"+wins);\n $(\"#losses\").html(\"Losses: \"+losses);\n}", "function updateButtons() {\n let moveList = [\n \"ones\",\n \"twos\",\n \"threes\",\n \"fours\",\n \"fives\",\n \"sixes\",\n \"three_of_a_kind\",\n \"four_of_a_kind\",\n \"full_house\",\n \"small_straight\",\n \"large_straight\",\n \"chance\",\n \"yacht_z\",\n ];\n\n moveList.forEach((move) => {\n let scoreval = score(move);\n let button = document.querySelector(`#${move} button`);\n if (button) {\n if (validateMove(move)) {\n button.innerHTML = scoreval;\n } else {\n button.innerHTML = 0;\n }\n }\n });\n}", "function set_buttons() {\r\n\t\r\n\t/* All the buttons needed */\r\n\tvar actions = $(\"#actions\");\r\n\tvar levels = $(\"#levels\");\r\n\tvar playButton = $(\"<button id='play'> Play </button>\");\r\n\tvar pauseButton = $(\"<button id='pause'> Pause </button>\");\r\n\tvar saveButton = $(\"<button id='save'> Save </button>\");\r\n\tvar loadButton = $(\"<button id='load'> Load </button>\");\r\n\tvar menuButton = $(\"<button id='menu'> Menu </button>\");\r\n\tvar rockButton = $(\"<button id='rock'> Rock </button>\");\r\n\tvar normalButton = $(\"<button id='normal'> Normal </button>\");\r\n\tvar skinsButton = $(\"<button id='skins'> Skins </button>\");\r\n\tvar standardSkinButton = $(\"<button id='standardSkin'> standard </button>\");\r\n\tvar cancelButton = $(\"<button id='cancel'> Cancel </button>\");\r\n\tvar restartButton = $(\"<button id='restart'> Restart </button>\");\r\n\tvar level1Button = $(\"<button id='level1'> Level 1 </button>\");\r\n\tvar level2Button = $(\"<button id='level2'> Level 2 </button>\");\r\n\t\r\n\t/* Appending them all */\r\n\tactions.append(playButton);\r\n\tactions.append(pauseButton);\r\n\tactions.append(saveButton);\r\n\tactions.append(loadButton);\r\n\tactions.append(menuButton);\r\n\tactions.append(rockButton);\r\n\tactions.append(normalButton);\r\n\tactions.append(skinsButton);\r\n\tactions.append(standardSkinButton);\r\n\tactions.append(cancelButton);\r\n\tactions.append(restartButton);\r\n\tlevels.append(level1Button);\r\n\tlevels.append(level2Button);\r\n\t\r\n\t/* can't be seen yet */\r\n\tpauseButton.hide();\r\n\tsaveButton.hide();\r\n\tmenuButton.hide();\r\n\tnormalButton.hide();\r\n\trestartButton.hide();\r\n\tcancelButton.hide();\r\n\tstandardSkinButton.hide();\r\n\tlevel1Button.hide();\r\n\tlevel2Button.hide();\r\n\t\r\n\t/* Function launched when the play button is clicked on */\r\n\tplayButton.click(function(event){\r\n\t\tplayButton.hide();\r\n\t\tloadButton.hide();\r\n\t\t$(\"#formulary\").hide();\r\n\t\t$(\"#enter\").hide();\r\n\t\t$(\"#score\").hide();\r\n\t\tmenuButton.show();\r\n\t\tlevel1Button.show();\r\n\t\tlevel2Button.show();\r\n\t\tskinsButton.hide();\r\n\t\trockButton.hide();\r\n\t\tnormalButton.hide();\r\n\t\t$(\".deleteSav\").hide();\r\n\t});\r\n\t\r\n\t/* Function launched when the pause button is clicked on */\r\n\tpauseButton.click(function(event) {\r\n\t\tGame.pause();\r\n\t\tif(Game.isPlaying == false)\r\n\t\t\tpauseButton.text(\"Play\");\r\n\t\telse\r\n\t\t\tpauseButton.text(\"Pause\");\r\n\t});\r\n\t\r\n\t/* Function launched when the save button is clicked on */\r\n\tsaveButton.click(function(event) {\r\n\t\t/* simulating a click on the pause button */\r\n\t\tif(Game.isPlaying == true)\r\n\t\t\t$(\"#pause\").trigger(\"click\"); \r\n\t\t\r\n\t\task_user_name();\r\n\t});\r\n\t\r\n\t/* function launched when the load button is clicked on */\r\n\tloadButton.click(function(event) {\r\n\t\task_load_name();\r\n\t});\r\n\t\r\n\t/* function launched when the menu button is clicked on */\r\n\tmenuButton.click(function(event){\r\n\t\r\n\t\twindow.cancelAnimationFrame(Game.id); /* need to stop the animation cuz it will start twice otherwise */\r\n\t\treset_MainSquare_pos();\r\n\t\tstop_keydown(); /* don't want the players to jump in the menu animation */\r\n\t\tGame.mobile.isDead = false; /* if the Mainsquare died in a level */\r\n\t\tGame.score = 0;\r\n\t\tGame.levelArrayCursor = 0;\r\n\t\t$(\"#score\").hide();\r\n\t\t$(\"#youWon\").remove(); /* remove win message */\r\n\t\t\r\n\t\t/* stopping music if any is playing */\r\n\t\tif($(\"#\"+Musics[Game.level].id).length != 0)\r\n\t\t\t$(\"#\"+Musics[Game.level].id).trigger(\"pause\");\r\n\t\t\r\n\t\t/* updating display */\r\n\t\t$(\"h1[id='large']\").show();\r\n\t\tsaveButton.hide();\r\n\t\tmenuButton.hide();\r\n\t\trestartButton.hide();\r\n\t\tlevel1Button.hide();\r\n\t\tlevel2Button.hide();\r\n\t\tplayButton.show();\r\n\t\tpauseButton.hide();\r\n\t\tloadButton.show();\r\n\t\tskinsButton.show();\r\n\t\t$(\".deleteSav\").hide();\r\n\t\t\r\n\t\tif(Game.mode == NORMAL)\r\n\t\t\trockButton.show();\r\n\t\telse\r\n\t\t\tnormalButton.show();\r\n\t\t\t\r\n\t\tskinsButton.show();\r\n\t\t\r\n\t\tdraw_menu_background();\r\n\t});\r\n\t\r\n\t/* function launched when the RockPossible button is clicked on */\r\n\trockButton.click(function(event){\r\n\t\r\n\t\tGame.mode = ROCK;\r\n\t\tCurrentSkin = SkinsR[0];\r\n\t\tGame.background = new Framework(\"#000000\", \"#ff0000\", \"white\");\r\n\t\trockButton.hide();\r\n\t\tnormalButton.show();\r\n\t\t$(\"#large\").text(\"Rockpossible Game\");\r\n\t});\r\n\t\r\n\t/* function launched when the normal button is clicked on */\r\n\tnormalButton.click(function(event){\r\n\t\r\n\t\tGame.mode = NORMAL;\r\n\t\tCurrentSkin = \"original\";\r\n\t\tGame.background = new Framework(\"#003333\", \"#00CCCC\", \"white\");\r\n\t\tnormalButton.hide();\r\n\t\trockButton.show();\r\n\t\t$(\"#large\").text(\"Rockpossible Game\");\r\n\t});\r\n\t\r\n\t/* function launched when the skins button is clicked on */\r\n\tskinsButton.click(function(event){\r\n\t\r\n\t\twindow.cancelAnimationFrame(Game.id);\r\n\t\tCtx.clearRect ( 0 , 0 ,Canvas.width, Canvas.height);\r\n\t\tcancelButton.show();\r\n\t\tplayButton.hide();\r\n\t\tloadButton.hide();\r\n\t\tskinsButton.hide();\r\n\t\t\r\n\t\tif(Game.mode == NORMAL) {\r\n\t\t\tfor(var i=0;i<SkinsN.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"N\").show();\r\n\t\t\t}\r\n\t\t\tGame.background = new Framework(\"#003333\", \"#00CCCC\", \"white\");\r\n\t\t\tGame.background.draw();\r\n\t\t\trockButton.hide();\r\n\t\t\tstandardSkinButton.show();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor(var i=0;i<SkinsR.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"R\").show();\r\n\t\t\t}\r\n\t\t\tGame.background = new Framework(\"#000000\", \"#ff0000\", \"white\");\r\n\t\t\tGame.background.draw();\r\n\t\t\tnormalButton.hide();\r\n\t\t}\r\n\t});\t\r\n\t\r\n\tstandardSkinButton.click(function(event){\r\n\t\r\n\t\treset_MainSquare_pos();\r\n\t\tstop_keydown(); \r\n\t\tGame.mobile.isDead = false; \r\n\t\t\r\n\t\tCurrentSkin = \"original\";\r\n\t\t\r\n\t\tcancelButton.hide();\r\n\t\tplayButton.show();\r\n\t\tloadButton.show();\r\n\t\tskinsButton.show();\r\n\t\tstandardSkinButton.hide();\r\n\t\t\r\n\t\tif(Game.mode == NORMAL) {\r\n\t\t\tfor(var i=0;i<SkinsN.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"N\").hide();\r\n\t\t\t}\r\n\t\t\trockButton.show();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor(var i=0;i<SkinsR.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"R\").hide();\r\n\t\t\t}\r\n\t\t\tnormalButton.show();\r\n\t\t}\r\n\t\tdraw_menu_background();\r\n\t});\r\n\t\r\n\t/* function launched when the cancel button is clicked on */\r\n\tcancelButton.click(function(event){\r\n\t\r\n\t\treset_MainSquare_pos();\r\n\t\tstop_keydown(); /* don't want the players to jump in the menu animation */\r\n\t\tGame.mobile.isDead = false; /* if the Mainsquare died in a level */\r\n\t\t\r\n\t\tcancelButton.hide();\r\n\t\tplayButton.show();\r\n\t\tloadButton.show();\r\n\t\tskinsButton.show();\r\n\t\t$(\".deleteSav\").hide();\r\n\t\t$(\".loading\").hide();\r\n\t\t$(\"#enter\").hide();\r\n\t\tstandardSkinButton.hide();\r\n\t\t\r\n\t\tif(Game.mode == NORMAL) {\r\n\t\t\tfor(var i=0;i<SkinsN.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"N\").hide();\r\n\t\t\t}\r\n\t\t\trockButton.show();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor(var i=0;i<SkinsR.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"R\").hide();\r\n\t\t\t}\r\n\t\t\tnormalButton.show();\r\n\t\t}\r\n\t\tdraw_menu_background();\r\n\t});\t\r\n\t\r\n\t/* function launched when the restart button is clicked on */\r\n\trestartButton.click(function(event){\r\n\t\r\n\t\twindow.cancelAnimationFrame(Game.id); \r\n\t\treset_MainSquare_pos();\r\n\t\tGame.mobile.isDead = false; \r\n\t\tGame.levelArrayCursor = 0;\r\n\t\t$(\"#youWon\").remove();\r\n\t\tif($(\"#\"+Musics[Game.level].id).length != 0)\r\n\t\t\t$(\"#\"+Musics[Game.level].id).trigger(\"pause\");\r\n\t\tGame.score = 0;\r\n\t\tplay(Game.level, 0);\r\n\t\tinit_keydown();\r\n\t\t\r\n\t});\r\n\t\r\n\t/* function launched when the levels button are clicked on */\t\r\n\tlevel1Button.click(function(event){\r\n\t\twindow.cancelAnimationFrame(Game.id);\r\n\t\treset_MainSquare_pos();\r\n\t\t$(\"h1[id='large']\").hide();\r\n\t\tlevel1Button.hide();\r\n\t\tlevel2Button.hide();\r\n\t\trockButton.hide();\r\n\t\tnormalButton.hide();\r\n\t\tskinsButton.hide();\r\n\t\tsaveButton.show();\r\n\t\tpauseButton.show();\r\n\t\trestartButton.show();\r\n\t\t\r\n\t\tif($(\"#\"+Musics[Game.level].id).length != 0)\r\n\t\t\t$(\"#\"+Musics[Game.level].id).trigger(\"pause\");\r\n\t\t\r\n\t\tplay(1, 0);\r\n\t});\r\n\t\r\n\tlevel2Button.click(function(event){\r\n\t\twindow.cancelAnimationFrame(Game.id);\r\n\t\treset_MainSquare_pos();\r\n\t\t$(\"h1[id='large']\").hide();\r\n\t\tlevel1Button.hide();\r\n\t\tlevel2Button.hide();\r\n\t\trockButton.hide();\r\n\t\tnormalButton.hide();\r\n\t\tskinsButton.hide();\r\n\t\tsaveButton.show();\r\n\t\tpauseButton.show();\r\n\t\trestartButton.show();\r\n\t\t\r\n\t\tif($(\"#\"+Musics[Game.level].id).length != 0)\r\n\t\t\t$(\"#\"+Musics[0].id).trigger(\"pause\");\r\n\t\t\r\n\t\tplay(2, 0);\r\n\t});\r\n}", "function buildGameButton(){\n\tbuttonStart.cursor = \"pointer\";\n\tbuttonStart.addEventListener(\"click\", function(evt) {\n\t\tplaySound('soundClick');\n\t\tgoPage('select');\n\t});\n\t\n\tbuttonContinue.cursor = \"pointer\";\n\tbuttonContinue.addEventListener(\"click\", function(evt) {\n\t\tplaySound('soundClick');\n\t\tgoPage('select');\n\t});\n\t\n\tbuttonFacebook.cursor = \"pointer\";\n\tbuttonFacebook.addEventListener(\"click\", function(evt) {\n\t\tshare('facebook');\n\t});\n\tbuttonTwitter.cursor = \"pointer\";\n\tbuttonTwitter.addEventListener(\"click\", function(evt) {\n\t\tshare('twitter');\n\t});\n\tbuttonWhatsapp.cursor = \"pointer\";\n\tbuttonWhatsapp.addEventListener(\"click\", function(evt) {\n\t\tshare('whatsapp');\n\t});\n\t\n\tbuttonSoundOff.cursor = \"pointer\";\n\tbuttonSoundOff.addEventListener(\"click\", function(evt) {\n\t\ttoggleGameMute(true);\n\t});\n\t\n\tbuttonSoundOn.cursor = \"pointer\";\n\tbuttonSoundOn.addEventListener(\"click\", function(evt) {\n\t\ttoggleGameMute(false);\n\t});\n\t\n\tbuttonFullscreen.cursor = \"pointer\";\n\tbuttonFullscreen.addEventListener(\"click\", function(evt) {\n\t\ttoggleFullScreen();\n\t});\n\t\n\tbuttonExit.cursor = \"pointer\";\n\tbuttonExit.addEventListener(\"click\", function(evt) {\n\t\tif(!$.editor.enable){\n\t\t\ttoggleConfirm(true);\n\t\t}\n\t});\n\t\n\tbuttonSettings.cursor = \"pointer\";\n\tbuttonSettings.addEventListener(\"click\", function(evt) {\n\t\ttoggleOption();\n\t});\n\t\n\tbuttonConfirm.cursor = \"pointer\";\n\tbuttonConfirm.addEventListener(\"click\", function(evt) {\n\t\ttoggleConfirm(false);\n\t\tstopGame(true);\n\t\tgoPage('main');\n\t\ttoggleOption();\n\t});\n\t\n\tbuttonCancel.cursor = \"pointer\";\n\tbuttonCancel.addEventListener(\"click\", function(evt) {\n\t\ttoggleConfirm(false);\n\t});\n\t\n\tbuttonTutContinue.cursor = \"pointer\";\n\tbuttonTutContinue.addEventListener(\"click\", function(evt) {\n\t\ttoggleTutorial(false);\n\t});\n}", "function setupButton() {\n for(var i = 0; i < diffButton.length; i++) {\n diffButton[i].classList.remove(\"selected\");\n }\n this.classList.add(\"selected\");\n this.textContent === \"Easy\" ? numberOfSquares = 3 : numberOfSquares = 6;\n gameReset();\n}", "function createButtons() {\n buttonA = select('#addClassRock');\n buttonA.mousePressed(function() {\n addExample('Thor');\n });\n\n buttonB = select('#addClassPaper');\n buttonB.mousePressed(function() {\n addExample('Loki');\n });\n\n buttonC = select('#addClassScissor');\n buttonC.mousePressed(function() {\n addExample('Odin');\n });\n\n // Reset buttons\n resetBtnA = select('#resetRock');\n resetBtnA.mousePressed(function() {\n clearLabel('Thor');\n });\n\n resetBtnB = select('#resetPaper');\n resetBtnB.mousePressed(function() {\n clearLabel('Loki');\n });\n\n resetBtnC = select('#resetScissor');\n resetBtnC.mousePressed(function() {\n clearLabel('Odin');\n });\n\n // Predict button\n buttonPredict = select('#buttonPredict');\n buttonPredict.mousePressed(classify);\n\n // Clear all classes button\n buttonClearAll = select('#clearAll');\n buttonClearAll.mousePressed(clearAllLabels);\n\n // Load saved classifier dataset\n buttonSetData = select('#load');\n buttonSetData.mousePressed(loadMyKNN);\n\n // Get classifier dataset\n buttonGetData = select('#save');\n buttonGetData.mousePressed(saveMyKNN);\n}", "startGame() {\r\n // Add value attr to qwerty button elements\r\n const keyButtons = document.querySelectorAll(`button.key`);\r\n for (let i = 0; i < keyButtons.length; i++) {\r\n keyButtons[i].value = keyButtons[i].textContent;\r\n }\r\n // hide screen overlay\r\n const overlay = document.querySelector('#overlay');\r\n overlay.style.display = 'none';\r\n // call getRandomPhrase() to get phrase from array, store in activePhrase\r\n this.activePhrase = this.getRandomPhrase();\r\n // add the phrase to gameboard w/ addPhraseToDisplay()\r\n this.activePhrase.addPhraseToDisplay();\r\n\r\n }", "function setupButtons(){\n\tfor (let i = 0; i<modeButtons.length; i++){\n\t\tmodeButtons[i].addEventListener(\"click\",function(){\n\t\t\tfor(let j = 0; j<modeButtons.length; j++){\n\t\t\t\tmodeButtons[j].classList.remove(\"selected\");\n\t\t\t}\n\t\t\tthis.classList.add(\"selected\");\n\t\t\tthis.textContent === \"Easy\" ? numSquares = 3 : numSquares = 6;\n\t\t\treset();\n\t\t});\n\t}\n\t//add listener to the reset button\n\tresetButton.addEventListener(\"click\", function(){\n\t\treset();\n\t});\n}", "function renderButtons() {\n\n $(\"#game-view\").empty();\n\n // create for loop for array topic games button which will append\n for (var i = 0; i < games.length; i++) {\n\n var a = $(\"<button>\");\n a.addClass(\"game\");\n a.attr(\"data-name\", games[i]);\n a.text(games[i]);\n $(\"#game-view\").append(a);\n }\n}", "function displayScore(){\n \n removeQuestion();\n\n // create jQuery html objects\n var startTrivia = $('<button class=\"btn btn-primary\" id=\"start_game\">Start</button>');\n var allDone = $(\"<div>\");\n var correctAns = $(\"<div>\");\n var incorrectAns = $(\"<div>\");\n var unAns = $(\"<div>\");\n var wrongAns = (questionCount - unanswered - correctAnswers);\n var message = $(\"<div>\");\n var lineBreak = $(\"<br>\");\n // wrongAnswer\n\n // Create score card\n $(allDone).text(\"All Done, here's how you did!\")\n $(correctAns).text(\"Correct Answers: \" + correctAnswers);\n $(incorrectAns).text(\"Incorrect Answers: \" + wrongAns);\n $(unAns).text(\"Unanswered: \" + unanswered);\n\n $(message).text('\"Select Start if you want to restart Trivia game\"');\n\n // load score card\n $(loadContent).append(allDone);\n $(loadContent).append(correctAns);\n $(loadContent).append(incorrectAns);\n $(loadContent).append(unAns);\n \n // create line break\n $(loadContent).append(lineBreak);\n $(loadContent).append(lineBreak);\n\n // load Restart game message\n $(loadContent).append(message);\n $(loadContent).append(startTrivia);\n\n }", "function scoreYes() {\n\n if (idFirstButton == 0) {\n score = score - 100;\n } else if (idFirstButton == 2) {\n score = score - 200;\n } else if (idFirstButton == 4) {\n score = score - 250;\n } else if (idFirstButton == 6) {\n score = score - 300;\n } else if (idFirstButton == 8) {\n score = score - 100;\n } else if (idFirstButton == 10) {\n score = score - 400;\n } else if (idFirstButton == 12) {\n score = score - 200;\n } else if (idFirstButton == 14) {\n score = score - 500;\n } else if (idFirstButton == 16) {\n score = score - 1000;\n } else if (idFirstButton == 18) {\n score = score - 0;\n } else if (idFirstButton == 20) {\n score = score - 0;\n } else if (idFirstButton == 22) {\n score = score - 1500;\n } else if (idFirstButton == 24) {\n score = score - 500;\n } else if (idFirstButton == 26) {\n score = score - 100;\n } else if (idFirstButton == 28) {\n score = score - 100;\n } else if (idFirstButton == 30) {\n score = score - 1500;\n } else if (idFirstButton == 32) {\n score = score - 500;\n alert(\"Quelle indignité ...\");\n } else if (idFirstButton == 34) {\n score = score - 500;\n } else if (idFirstButton == 36) {\n score = score - 3000;\n alert(\"C'EST GAME !\");\n } else if (idFirstButton == 38) {\n score = score - 5000;\n \n }\n\n console.log(score);\n\n }", "function handleNFLscoreboardClicks() {\n\t\t\t\t$('#js-nfl-scorecard-button').on('click', function (e) {\n\t\t\t\t\tconst queryTarget = $('#js-nfl-scorecard').find('js-nfl-scorecard');;\n\t\t\t\t\tconst query = queryTarget.val();\n\t\t\t\t\tgetNFLscoreboardDataFromApi();\n\t\t\t\t\t$('#js-nfl-scorecard').removeClass('hidden');\n\t\t\t\t\t$('#js-render-nfl-scorecard').removeClass('hidden');\n\t\t\t\t\t//All the elements listed below need to be hidden to render above.\n\t\t\t\t\t$('#js-home-page').addClass('hidden');\n\t\t\t\t\t$('#js-nfl-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-render-nfl-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-nfl-standing').addClass('hidden');\n\t\t\t\t\t$('#js-render-nfl-standing').addClass('hidden');\n\t\t\t\t\t$('#js-mlb-scorecard').addClass('hidden');\n\t\t\t\t\t$('#js-render-mlb-scorecard').addClass('hidden');\n\t\t\t\t\t$('#js-mlb-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-render-mlb-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-mlb-standing').addClass('hidden');\n\t\t\t\t\t$('#js-render-mlb-standing').addClass('hidden');\n\t\t\t\t\t$('#js-nba-scorecard').addClass('hidden');\n\t\t\t\t\t$('#js-render-nba-scorecard').addClass('hidden');\n\t\t\t\t\t$('#js-nba-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-render-nba-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-nba-standing').addClass('hidden');\n\t\t\t\t\t$('#js-render-nba-standing').addClass('hidden');\n\t\t\t\t\t$('#js-nhl-scorecard').addClass('hidden');\n\t\t\t\t\t$('#js-render-nhl-scorecard').addClass('hidden');\n\t\t\t\t\t$('#js-nhl-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-render-nhl-schedule').addClass('hidden');\n\t\t\t\t\t$('#js-nhl-standing').addClass('hidden');\n\t\t\t\t\t$('#js-render-nhl-standing').addClass('hidden');\n\t\t\t\t\tconsole.log(\"handleNFLscorecardClicks() ran\");\n\t\t\t\t});\n\t\t\t}", "function updateScoreboard() {\n scoreboardGroup.clear(true, true);\n\n const scoreAsString = score.toString();\n if (scoreAsString.length === 1) {\n scoreboardGroup.create(assets.scene.width, 30, assets.scoreboard.base + score).setDepth(10);\n } else {\n let initialPosition = assets.scene.width - ((score.toString().length * assets.scoreboard.width) / 2);\n\n for (let i = 0; i < scoreAsString.length; i++) {\n scoreboardGroup.create(initialPosition, 30, assets.scoreboard.base + scoreAsString[i]).setDepth(10);\n initialPosition += assets.scoreboard.width;\n }\n }\n}", "function scoreboard(){\n $('#timeLeft').empty();\n $('#message').empty();\n $('#correctedAnswer').empty();\n $('#gif').hide();\n $(\"#gifCaption\").hide();\n \n $('#finalMessage').html(messages.finished);\n $('#correctAnswers').html(\"Correct Answers: \" + correctAnswer);\n $('#incorrectAnswers').html(\"Incorrect Answers: \" + incorrectAnswer);\n $('#unanswered').html(\"Unanswered: \" + unanswered);\n $('#startOverBtn').addClass('reset');\n $('#startOverBtn').show();\n $('#startOverBtn').html(\"PLAY AGAIN\");\n }", "function startGame() {\n \n // randomizing the variables upon game start //\n \n blueButton = Math.floor(Math.random() * 8) + 1;\n\n redButton = Math.floor(Math.random() * 13) + 1;\n \n yellowButton = Math.floor(Math.random() * 15) + 1;\n \n greenButton = Math.floor(Math.random() * 20) + 1;\n \n computerPick = Math.floor(Math.random() * 101) + 19;\n \n $(\"#random-area\").text(computerPick);\n \n $(\"#score-area\").text(userScore);\n \n }", "function startGame(){\n\n\t\twins = 0;\n\t\tlosses = 0;\n\t\ttotalScore = 0;\n\t\tbuttonValues = [];\n\t\trandNum = 0;\n\n\n\t\tfunction reset(){\n\n\t\t\trandNum = Math.floor(Math.random()*101) + 19;\n\n\t\t\ttotalScore = 0;\n\n\t\t\tfor (var i = 0; i < 4; i++){\n\n\t\t\t\tvar randomVal = Math.floor(Math.random()*12)+1;\n\t\t\t\tbuttonValues[i] = randomVal;\n\n\t\t\t}\n\n\t\t}; //reset function ends here\n\n\t\tfunction display(){\n\n\t\t\t$(\"#number\").html(randNum);\n\t\t\t$(\"#winsLosses\").html(\"<p>Wins: \" + wins + \"</p><br>\"\n\t\t\t\t+ \"<p>Losses: \" + losses + \"</p>\");\n\t\t\t$(\"#totalScore\").html(totalScore);\n\n\t\t}; //display function ends here\n\n\t\tfunction checkScore(){\n\t\t\tif (totalScore === randNum){\n\t\t\twins++;\n\t\t\treset();\n\t\t\t}\n\t\t\telse if (totalScore > randNum){\n\t\t\tlosses++;\n\t\t\treset();\n\t\t\t}\n\t\t\t\n\t\t}\n\n\n\n\t//===================================\n\t\t\n\t//Code game play below\n\t\treset();\n\n\t\tdisplay();\n\t\t\n\t\t$(\"#diamond\").on(\"click\", function(){\n\t\t\tvar diamondValue = buttonValues[0];\n\t\t\ttotalScore += diamondValue;\n\t\t\tcheckScore();\n\t\t\tdisplay();\n\t\t\tconsole.log(buttonValues);\n\t\t\t}); //diamond button coding ends here\n\n\t\t$(\"#diaspore\").on(\"click\", function(){\n\t\t\tvar diasporeValue = buttonValues[1];\n\t\t\ttotalScore += diasporeValue;\n\t\t\tcheckScore();\n\t\t\tdisplay();\n\t\t\tconsole.log(buttonValues);\n\t\t}); //diamond button coding ends here\n\n\t\t$(\"#sapphire\").on(\"click\", function(){\n\t\t\tvar sapphireValue = buttonValues[2];\n\t\t\ttotalScore += sapphireValue;\n\t\t\tcheckScore();\n\t\t\tdisplay();\n\t\t\tconsole.log(buttonValues);\n\t\t}); //diamond button coding ends here\n\n\t\t$(\"#gem\").on(\"click\", function(){\n\t\t\tvar gemValue = buttonValues[3];\n\t\t\ttotalScore += gemValue;\n\t\t\tcheckScore();\n\t\t\tdisplay();\n\t\t\tconsole.log(buttonValues);\n\t\t}); //diamond button coding ends here\n\n\n\t}", "function displaysButtons() {\n $(\"#buttons-view\").empty();\n\n for (var i = 0; i < topics.length; i++) {\n var btn = $(\"<button class='gifBtn'>\");\n btn.attr(\"data-name\", topics[i]);\n btn.text(topics[i]);\n $(\"#buttons-view\").append(btn)\n\n }\n }", "function setupButtons(){\n //speak(quiz[currentquestion]['question'])\n\t\t$('.choice').on('click', function(){\n\t\tsynth.cancel();\n is_on = 0;\n\t\tpicked = $(this).attr('data-index');\n\t\tspeak(quiz[currentquestion]['choices'][picked], LINGUA_RISPOSTA);\n\t\tshow_button();\n\t\t// risposte in francese\n\t\t$('.choice').removeAttr('style').off('mouseout mouseover');\n\t\t$(this).css({'font-weight':'900', 'border-color':'#51a351', 'color':'#51a351', 'background' : 'gold'});\n\t\tif(submt){\n\t\t\t\tsubmt=false;\n\t\t\t\t$('#submitbutton').css({'color':'#fff','cursor':'pointer'}).on('click', function(){\n\t\t\t\t$('.choice').off('click');\n\t\t\t\t$(this).off('click');\n\t\t\t\tprocessQuestion(picked);\n //\n\t\t\t\t});\n\t\t\t}\n\t\t})\n\t}", "function createButtons() {\n document.getElementById('start-game').remove();\n createShuffleButton();\n createShowHideButton();\n createMagicButton();\n}", "function scoreBoardButtons(overlayScore) {\n window.setTimeout(function () {\n overlayScore.style.opacity = \"1\"\n scoreBoardEvent()\n })\n}", "function addScoreMarkers(){\n userScoreLabel.textContent = \"Your Score:\";\n computerScoreLabel.textContent = \"Computer Score:\";\n userScoreValue.textContent = \"0\";\n computerScoreValue.textContent = \"0\";\n gameButton.style.marginLeft = \"40px\";\n}", "buildBoard() {\n // As the ids are declared explicitly, this class is tied to this specific HTML doc\n $(\"#game-board\").empty()\n $(\"#variable-title\").append($(\"<button>\").addClass(\"btn btn-danger\").attr(\"id\", \"end-button\").text(\"End Game\"));\n for (let i = 1; i <= this.board.length; i++) {\n let box = $(\"<div>\").addClass(\"board-box\").attr(\"id\", `box-${i}`).attr(\"data-index\", i - 1);\n let play = $(\"<h1>\").addClass(\"play center\").text(this.board[i - 1]);\n box.append(play);\n $(\"#game-board\").append(box)\n }\n }", "function gameStatusDisplays(roboparts) {\n\n //this function displays the changes dynamically\n if (roboparts == 6) {\n document.getElementById(\"top_image\").innerHTML = '<img src=\"./assets/images/g0.svg\" class=\"main_image\" >';\n\n //green button\n document.getElementById(\"button\").innerHTML = '<a class=\"btn btn-lg active btn-success\" disabled=\"disabled\" id=\"button_text\">6 robo parts left!</a>'\n }\n\n if (roboparts == 5) {\n document.getElementById(\"top_image\").innerHTML = '<img src=\"./assets/images/g1.svg\" class=\"main_image\" >';\n\n //green button\n document.getElementById(\"button\").innerHTML = '<a class=\"btn btn-lg active btn-success\" disabled=\"disabled\" id=\"button_text\">5 robo parts left!</a>'\n }\n\n if (roboparts == 4) {\n document.getElementById(\"top_image\").innerHTML = '<img src=\"./assets/images/g2.svg\" class=\"main_image\" >';\n\n //yellow button\n document.getElementById(\"button\").innerHTML = '<a class=\"btn btn-lg active btn-warning\" disabled=\"disabled\" id=\"button_text\">4 robo parts left!</a>'\n }\n\n if (roboparts == 3) {\n document.getElementById(\"top_image\").innerHTML = '<img src=\"./assets/images/g3.svg\" class=\"main_image\" >';\n\n //yellow button\n document.getElementById(\"button\").innerHTML = '<a class=\"btn btn-lg active btn-warning\" disabled=\"disabled\" id=\"button_text\">3 robo parts left!</a>'\n }\n\n if (roboparts == 2) {\n document.getElementById(\"top_image\").innerHTML = '<img src=\"./assets/images/g4.svg\" class=\"main_image\" >';\n\n //red button\n document.getElementById(\"button\").innerHTML = '<a class=\"btn btn-lg active btn-danger\" disabled=\"disabled\" id=\"button_text\">2 robo parts left!</a>'\n }\n\n if (roboparts == 1) {\n document.getElementById(\"top_image\").innerHTML = '<img src=\"./assets/images/g5.svg\" class=\"main_image\" >';\n\n //red button\n document.getElementById(\"button\").innerHTML = '<a class=\"btn btn-lg active btn-danger\" disabled=\"disabled\" id=\"button_text\">1 robo parts left!</a>'\n }\n\n if (roboparts == 0) { //if done - show robo on gallows\n document.getElementById(\"top_image\").innerHTML = '<img src=\"./assets/images/g6.svg\" class=\"main_image\" >';\n\n //button final display in endWell function\n }\n\n //general updates:\n wordDisplayed = lettersMatched.join(\"\"); //update word displayed\n document.getElementById(\"text_middle\").innerHTML = wordDisplayed; // display updated word\n\n document.getElementById(\"text_bottom\").innerHTML = \"( total characters left: \" + totCharactersLeft + \" )\"; // display how many characters are left in word\n}", "function createButtons() {\n lat = createSlider(-90,90,40).position(10,10);\n long = createSlider(-180,180,-75).position(560,10);\n speed = createSlider(-40,40,0).position(10,height-20);\n createButton(\"toggle constellations\").mousePressed(()=>bigSphere.constellations = !bigSphere.constellations).position(10,60);\n createButton(\"now\").mousePressed(()=>bigSphere.resetTime()).position(10,120);\n createButton(\"stop\").mousePressed(()=>speed.value(0)).position(10,90);\n}", "function buildGameButton(){\r\n\tbtnPlay.cursor = \"pointer\";\r\n\tbtnPlay.addEventListener(\"click\", function(evt) {\r\n\t\tplaySound('soundChalk');\r\n\t\tgoPage('game');\r\n\t});\r\n\t\r\n\tbtnServe.cursor = \"pointer\";\r\n\tbtnServe.addEventListener(\"click\", function(evt) {\r\n\t\tif(serveEnable){\r\n\t\t\tplaySound('soundChalk');\r\n\t\t\tplaySound('soundCashier');\r\n\t\t\tincreaseScore();\r\n\t\t\tcreateOrder();\r\n\t\t}\r\n\t});\r\n\t\r\n\tbtnPlayAgain.cursor = \"pointer\";\r\n\tbtnPlayAgain.addEventListener(\"click\", function(evt) {\r\n\t\tplaySound('soundChalk');\r\n\t\tgoPage('game');\r\n\t});\r\n\t\r\n\tfor(n=0;n<ingredients_arr.length;n++){\r\n\t\t$.icons[n].clicknum = n;\r\n\t\t$.icons[n].cursor = \"pointer\";\r\n\t\t$.icons[n].addEventListener(\"click\", function(evt) {\r\n\t\t\tcheckSelectIngredient(evt.target.clicknum);\r\n\t\t});\r\n\t}\r\n\t\r\n\tbtnFacebook.cursor = \"pointer\";\r\n\tbtnFacebook.addEventListener(\"mousedown\", function(evt) {\r\n\t\tshare('facebook');\r\n\t});\r\n\tbtnTwitter.cursor = \"pointer\";\r\n\tbtnTwitter.addEventListener(\"mousedown\", function(evt) {\r\n\t\tshare('twitter');\r\n\t});\r\n\tbtnGoogle.cursor = \"pointer\";\r\n\tbtnGoogle.addEventListener(\"mousedown\", function(evt) {\r\n\t\tshare('google');\r\n\t});\r\n}", "function renderButtons() {\n\n // Deleting the movie buttons prior to adding new movie buttons\n // (this is necessary otherwise we will have repeat buttons)\n $(\"#buttonspace\").empty();\n\n // Looping through the array of topics\n for (var i = 0; i < topics.length; i++) {\n\n // Then dynamicaly generating buttons for each movie in the array.\n // This code $(\"<button>\") is all jQuery needs to create the start and end tag. (<button></button>)\n var a = $(\"<button>\");\n // Adding a class\n a.addClass(\"topic\");\n // Adding a data-attribute with a value of the movie at index i\n a.attr(\"data-name\", topics[i]);\n // Providing the button's text with a value of the movie at index i\n a.text(topics[i]);\n // Adding the button to the HTML\n $(\"#buttonspace\").append(a);\n\n \n }\n }", "function showScoreBoard() {\n let title = level >= 15 ? 'Congrats, you won!' : 'Ah, you lost!',\n titleX = level >= 15 ? 152 : 220,\n titleY = 280,\n totalScore = level * 60 + GemsCollected.blue * 30 + GemsCollected.green * 40 + GemsCollected.orange * 50,\n scoreBoard = Resources.get('images/score-board.jpg'),\n starResource = Resources.get('images/Star.png'),\n gemBlueResource = Resources.get('images/Gem-Blue.png'),\n gemGreenResource = Resources.get('images/Gem-Green.png'),\n gemOrangeResource = Resources.get('images/Gem-Orange.png'),\n offset = 70;\n // Draw image assets\n ctx.drawImage(scoreBoard, (canvas.width - scoreBoard.width) / 2, (canvas.height - scoreBoard.height - offset) / 2);\n ctx.drawImage(starResource, 175, 260 - offset, starResource.width / 1.5, starResource.height / 1.5);\n ctx.drawImage(gemBlueResource, 180, 345 - offset, gemBlueResource.width / 1.8, gemBlueResource.height / 1.8);\n ctx.drawImage(gemGreenResource, 180, 425 - offset, gemGreenResource.width / 1.8, gemGreenResource.height / 1.8);\n ctx.drawImage(gemOrangeResource, 180, 505 - offset, gemOrangeResource.width / 1.8, gemOrangeResource.height / 1.8);\n // Draw text\n ctx.font = \"50px Gaegu\";\n ctx.fillStyle = \"#fff\";\n ctx.strokeStyle = \"#000\";\n ctx.lineWidth = 3;\n ctx.strokeText(title, titleX, titleY - offset);\n ctx.fillText(title, titleX, titleY - offset);\n ctx.font = \"45px Gaegu\";\n ctx.strokeText(level + ' x 60 = ' + level * 60, 270, 340 - offset);\n ctx.fillText(level + ' x 60 = ' + level * 60, 270, 340 - offset);\n ctx.strokeText(GemsCollected.blue + ' x 30 = ' + GemsCollected.blue * 30, 270, 420 - offset);\n ctx.fillText(GemsCollected.blue + ' x 30 = ' + GemsCollected.blue * 30, 270, 420 - offset);\n ctx.strokeText(GemsCollected.green + ' x 40 = ' + GemsCollected.green * 40, 270, 500 - offset);\n ctx.fillText(GemsCollected.green + ' x 40 = ' + GemsCollected.green * 40, 270, 500 - offset);\n ctx.strokeText(GemsCollected.orange + ' x 50 = ' + GemsCollected.orange * 50, 270, 580 - offset);\n ctx.fillText(GemsCollected.orange + ' x 50 = ' + GemsCollected.orange * 50, 270, 580 - offset);\n ctx.strokeText('_______', 270, 640 - offset);\n ctx.fillText('_______', 270, 640 - offset);\n ctx.strokeText('Total: ' + totalScore.toString(), 270, 640 - offset);\n ctx.fillText('Total: ' + totalScore.toString(), 270, 640 - offset);\n ctx.strokeText('Spacebar to restart', 170, 680);\n ctx.fillText('Spacebar to restart', 170, 680);\n }", "renderBoard() {\n return this.props.gameState.board.map((box, index) => (\n <button\n onClick={() => this.meh(this.props.gameState.board[index].innerHTML)}\n className=\"box btn btn-primary\"\n key={index}\n >\n {box}\n check\n </button>\n ));\n }", "function scoreNo() {\n\n if (idSecondButton == 1) {\n score = score + 100;\n } else if (idSecondButton == 3) {\n score = score + 300;\n } else if (idSecondButton == 5) {\n score = score + 10;\n } else if (idSecondButton == 7) {\n score = score + 200;\n } else if (idSecondButton == 9) {\n score = score + 10;\n } else if (idSecondButton == 11) {\n score = score + 100;\n } else if (idSecondButton == 13) {\n score = score + 500;\n } else if (idSecondButton == 15) {\n score = score + 500;\n } else if (idSecondButton == 17) {\n score = score + 100;\n } else if (idSecondButton == 19) {\n score = score + 0;\n } else if (idSecondButton == 21) {\n score = score + 0;\n } else if (idSecondButton == 23) {\n score = score + 10;\n } else if (idSecondButton == 25) {\n score = score + 100;\n } else if (idSecondButton == 27) {\n score = score + 10;\n } else if (idSecondButton == 29) {\n score = score + 200;\n } else if (idSecondButton == 31) {\n score = score + 100;\n } else if (idSecondButton == 33) {\n score = score + 100;\n } else if (idSecondButton == 35) {\n score = score + 200;\n } else if (idSecondButton == 37) {\n score = score + 100;\n } else if (idSecondButton == 39) {\n score = score + 0;\n }\n\n console.log(score);\n\n }", "function whenClicked() {\n $(\"#image-1\").on(\"click\", function () {\n gameData.scoreCounter = gameData.scoreCounter + gameData.emeraldValue;\n $(\"#score-is\").text(gameData.scoreCounter);\n endResult();\n });\n\n $(\"#image-2\").on(\"click\", function () {\n gameData.scoreCounter = gameData.scoreCounter + gameData.jewelValue;\n $(\"#score-is\").text(gameData.scoreCounter);\n endResult();\n });\n\n $(\"#image-3\").on(\"click\", function () {\n gameData.scoreCounter = gameData.scoreCounter + gameData.rubyValue;\n $(\"#score-is\").text(gameData.scoreCounter);\n endResult();\n });\n\n $(\"#image-4\").on(\"click\", function () {\n gameData.scoreCounter = gameData.scoreCounter + gameData.topazValue;\n $(\"#score-is\").text(gameData.scoreCounter);\n endResult();\n });\n }", "render() {\n var button1 = this.randColor();\n let button2 = this.randColor();\n let button3 = this.randColor();\n let button4 = this.randColor();\n return (\n <div>\n <header>\n <h1 id=\"maintitle\">Jungle Click</h1>\n <h2>score: {(this.state.score)}</h2>\n <button id=\"newgame\" type=\"button\" onClick={this.startGame}>Nouvelle partie</button>\n <hr/>\n <div>\n <button type=\"button\" className={button1} value={button1}\n onClick={event => this.click(button1, button2, button3, button4)}\n disabled={!this.state.isOn}>\n </button>\n <button type=\"button\" className={button2} value={button2}\n onClick={event => this.click(button2, button3, button4, button1)}\n disabled={!this.state.isOn}>\n </button>\n <button type=\"button\" className={button3} value={button3}\n onClick={event => this.click(button3, button2, button4, button1)}\n disabled={!this.state.isOn}>\n </button>\n <button type=\"button\" className={button4} value={button4}\n onClick={event => this.click(button4, button3, button2, button1)}\n disabled={!this.state.isOn}>\n </button>\n </div>\n </header>\n </div>\n )\n }", "function init(){\r\n\r\n //List of the play area buttons (or minefield). This is used as a database when accessing buttons,\r\n //like in the button function\r\n for(i = 0; i< rows.length; i++){\r\n temp = rows[i].getElementsByTagName(\"button\");\r\n for(j = 0; j < temp.length; j++){\r\n buttons.push(temp[j]);\r\n }\r\n }\r\n //Score is resetted to 0\r\n score = 0;\r\n document.getElementById(\"score\").innerHTML = score;\r\n //Random number (between 5 and 10) of mines is generated\r\n var mine = Math.floor(Math.random () * (10-5)) + 5;\r\n mines = [];\r\n openedFields=[];\r\n //Mine position are randomised. Each button has 2 coordinates that are its id,\r\n //ex. 11, 53, 33 etc. Each coordinate is random and they are combined in the end\r\n for (var i = 0; i < mine; i++){\r\n var first = Math.floor(Math.random () * (7-1)) + 1;\r\n var second = Math.floor(Math.random () * 6);\r\n var id = first.toString() + second.toString();\r\n //Mines are pushed into a list. If a id is already there, it is ignored.\r\n if (mines.includes(id) == false){\r\n mines.push(id);\r\n var button = document.getElementById(id)\r\n }\r\n }\r\n\r\n //Buttons are enabled and previous numbers and colors are removed\r\n for(i = 0; i< buttons.length; i++){\r\n buttons[i].style.background = \"white\";\r\n buttons[i].disabled = false;\r\n\r\n buttons[i].innerText = \"\";\r\n }\r\n document.getElementById(\"text\").innerHTML = \"Game in progress\";\r\n}", "function createLabelsAndButtons()\n{\n let buttonStyle = new PIXI.TextStyle({\n fill: 0xffffff,\n fontSize: 48,\n fontFamily: \"Future\",\n stroke: 0x00aa00,\n strokeThickness: 6\n });\n\n // 1 - set up 'startScene'\n // 1A - make the top start label\n let startLabel1 = new PIXI.Text(\"Radioactive Run\");\n startLabel1.style = new PIXI.TextStyle({\n fill: 0xffffff,\n fontSize: 60,\n fontFamily: 'Future',\n stroke: 0x00aa00,\n strokeThickness: 6\n });\n startLabel1.x = 30;\n startLabel1.y = 120;\n startScene.addChild(startLabel1);\n\n // 1B - make the middle start label\n let startLabel2 = new PIXI.Text(\"Can you outrun\\nthe Wave?\");\n startLabel2.style = new PIXI.TextStyle({\n fill: 0xffffff,\n fontSize: 40,\n fontFamily: 'Future',\n fontStyle: 'italic',\n stroke: 0x00aa00,\n strokeThickness: 6\n });\n startLabel2.x = 135;\n startLabel2.y = 280;\n startScene.addChild(startLabel2);\n\n // 1C - make the start game button\n let instructionButton = new PIXI.Text(\"Begin the Run\");\n instructionButton.style = buttonStyle;\n instructionButton.x = 120;\n instructionButton.y = sceneHeight - 120;\n instructionButton.interactive = true;\n instructionButton.buttonMode = true;\n instructionButton.on(\"pointerup\", giveInstructions);\n instructionButton.on(\"pointerover\", e=>e.target.aplha = 0.7); // consice arrow function with no brackets\n instructionButton.on(\"pointerout\", e=>e.currentTarget.aplha = 1.0); // ditto\n startScene.addChild(instructionButton);\n\n // set up 'gameScene'\n let textStyle = new PIXI.TextStyle({\n fill: 0xFFFFFF,\n fontSize: 18,\n fontFamily: 'Futura',\n stroke: 0x00aa00,\n strokeThickness: 4\n });\n\n // Make score label\n scoreLabel = new PIXI.Text();\n scoreLabel.style = textStyle;\n scoreLabel.x = 500;\n scoreLabel.y = 5;\n gameScene.addChild(scoreLabel);\n increaseScoreBy(0);\n\n // Make life label\n lifeLabel = new PIXI.Text();\n lifeLabel.style = textStyle;\n lifeLabel.x = 500;\n lifeLabel.y = 26;\n gameScene.addChild(lifeLabel);\n decreaseLifeBy(0);\n\n\n // 3 - set up `gameOverScene`\n // 3A - make game over text\n gameOverText = new PIXI.Text(\"Game Over\");\n textStyle = new PIXI.TextStyle({\n fill: 0xffffff,\n fontSize: 64,\n fontFamily: \"Futura\",\n stroke: 0x00aa00,\n strokeThickness: 6\n });\n gameOverText.style = textStyle;\n gameOverText.x = 150;\n gameOverText.y = sceneHeight/2 - 160;\n gameOverScene.addChild(gameOverText);\n\n // 3B - make \"play again?\" button\n let playAgainButton = new PIXI.Text(\"Play Again?\");\n playAgainButton.style = buttonStyle;\n playAgainButton.x = 150;\n playAgainButton.y = sceneHeight - 100;\n playAgainButton.interactive = true;\n playAgainButton.buttonMode = true;\n playAgainButton.on(\"pointerup\",restartGame); \n playAgainButton.on('pointerover',e=>e.target.alpha = 0.7); // concise arrow function with no brackets\n playAgainButton.on('pointerout',e=>e.currentTarget.alpha = 1.0); // ditto\n gameOverScene.addChild(playAgainButton);\n\n // make game over score label\n gameOverScoreLabel = new PIXI.Text();\n gameOverScoreLabel.style = new PIXI.TextStyle({\n fill: 0xffffff,\n fontSize: 40,\n fontFamily: \"Futura\",\n stroke: 0x00aa00,\n strokeThickness: 6\n });\n gameOverScoreLabel.x = 100;\n gameOverScoreLabel.y = sceneHeight/2 + 20;\n gameOverScene.addChild(gameOverScoreLabel);\n\n gameOverWaveLabel = new PIXI.Text();\n gameOverWaveLabel.style = new PIXI.TextStyle({\n fill: 0xffffff,\n fontSize: 40,\n fontFamily: \"Futura\",\n stroke: 0x00aa00,\n strokeThickness: 6\n });\n gameOverWaveLabel.x = 100;\n gameOverWaveLabel.y = sceneHeight/2 + 60;\n gameOverScene.addChild(gameOverWaveLabel);\n\n // Set up the Instructions Scene\n let instructionsStyle = new PIXI.TextStyle({\n fill: 0xffffff,\n fontSize: 25,\n fontFamily: \"Futura\",\n stroke: 0x00aa00,\n strokeThickness: 3\n });\n instructions = new PIXI.Text(\"Objective: The point of the game is to\\n\"\n + \"get to the end of the level while\\n\"\n + \"avoiding obstacles. You will face constant action\\n\"\n + \"as you try to escape the wave of radiation.\");\n instructions.style = instructionsStyle;\n instructions.x = 100;\n instructions.y = 40;\n instructionScene.addChild(instructions);\n\n // *** Labels for Controls ***\n controlsMovement = new PIXI.Text(\"Movement Controls: W, A, D\\n\"\n +\"Shoot: Space\");\n controlsMovement.style = instructionsStyle;\n controlsMovement.x = 100;\n controlsMovement.y = 220;\n instructionScene.addChild(controlsMovement);\n\n // 1C - make the start game button\n let startButton = new PIXI.Text(\"Start Game\");\n startButton.style = buttonStyle;\n startButton.x = 160;\n startButton.y = sceneHeight - 120;\n startButton.interactive = true;\n startButton.buttonMode = true;\n startButton.on(\"pointerup\", startGame); // startGame is a function reference\n startButton.on(\"pointerover\", e=>e.target.aplha = 0.7); // consice arrow function with no brackets\n startButton.on(\"pointerout\", e=>e.currentTarget.aplha = 1.0); // ditto\n instructionScene.addChild(startButton);\n\n // Set up Level Completion Menu\n // Completion Label\n let levelCompleteLabel = new PIXI.Text(\"Level Complete\");\n levelCompleteLabel.style = new PIXI.TextStyle({\n fill: 0xffffff,\n fontSize: 52,\n fontFamily: \"Futura\",\n stroke: 0x00aa00,\n strokeThickness: 6\n });\n levelCompleteLabel.x = 140;\n levelCompleteLabel.y = 220;\n nextLevel.addChild(levelCompleteLabel);\n\n // Next Level Button\n nextLevelButton = new PIXI.Text(\"Next Level\");\n nextLevelButton.style = buttonStyle;\n nextLevelButton.x = 160;\n nextLevelButton.y = sceneHeight - 120;\n nextLevelButton.interactive = true;\n nextLevelButton.buttonMode = true;\n nextLevelButton.on(\"pointerup\", startGame); // startGame is a function reference\n nextLevelButton.on(\"pointerover\", e=>e.target.aplha = 0.7); // consice arrow function with no brackets\n nextLevelButton.on(\"pointerout\", e=>e.currentTarget.aplha = 1.0); // ditto\n nextLevel.addChild(nextLevelButton);\n\n // Set up the Pause menu\n // Resume Button\n let resumeButton = new PIXI.Text(\"Resume Game\");\n resumeButton.style = new PIXI.TextStyle({\n fill: 0xffffff,\n fontSize: 50,\n fontFamily: 'Futura',\n fontStyle: 'italic',\n stroke: 0x00aa00,\n strokeThickness: 6\n });\n resumeButton.x = 160;\n resumeButton.y = 250;\n resumeButton.interactive = true;\n resumeButton.buttonMode = true;\n resumeButton.on(\"pointerup\", resumeGame);\n resumeButton.on(\"pointerover\", e=>e.target.aplha = 0.7); // consice arrow function with no brackets\n resumeButton.on(\"pointerout\", e=>e.currentTarget.aplha = 1.0); // ditto\n pauseMenu.addChild(resumeButton);\n\n // Quit Button\n let quitButton = new PIXI.Text(\"Quit Game\");\n quitButton.style = new PIXI.TextStyle({\n fill: 0xffffff,\n fontSize: 50,\n fontFamily: 'Futura',\n fontStyle: 'italic',\n stroke: 0x00aa00,\n strokeThickness: 6\n });\n quitButton.x = 180;\n quitButton.y = 350;\n quitButton.interactive = true;\n quitButton.buttonMode = true;\n quitButton.on(\"pointerup\", end);\n quitButton.on(\"pointerover\", e=>e.target.aplha = 0.7); // consice arrow function with no brackets\n quitButton.on(\"pointerout\", e=>e.currentTarget.aplha = 1.0); // ditto\n pauseMenu.addChild(quitButton);\n}", "function renderButtons() {\n\n // Deletes the gif prior to adding new ones\n $(\"#buttons-view\").empty();\n // Loops through the array of topics\n for (var i = 0; i < topics.length; i++) {\n\n var newButton = $(\"<button>\");\n \n newButton.addClass(\"sports\");\n \n newButton.attr(\"data-name\", topics[i]);\n \n newButton.text(topics[i]);\n // Added the button to the buttons-view div\n $(\"#buttons-view\").append(newButton);\n }\n }", "function initializeControlButtons(){\n sixteenBtn.addEventListener('click', function(){\n /// TOGGLE ACTIVE CLASS ///\n sixteenBtn.classList.add('active');\n thirtyTwoBtn.classList.remove('active');\n\n /// UPDATE GAME DIMENSIONS ///\n dimensions = { row: 16, col: 16 };\n });\n\n thirtyTwoBtn.addEventListener('click', function(){\n /// TOGGLE ACTIVE CLASS ///\n sixteenBtn.classList.remove('active');\n thirtyTwoBtn.classList.add('active');\n\n /// UPDATE GAME DIMENSIONS ///\n dimensions = { row: 32, col: 32 };\n });\n\n startBtn.addEventListener('click', function(){\n generateBoard(dimensions.row, dimensions.col);\n\n addGridCellListeners();\n\n startGame();\n });\n\n restartBtn.addEventListener('click', function(){\n clearBoard();\n resetGame();\n });\n\n }", "function displayQuyestion(i) {\n if ( i < questionsArray.length) {\n //Displays scoreboard\n $(\"#question-number-element\").text(\"Question #\" + (i+1));\n $(\"#correct-number-element\").text(\"Correct: \" + correctAnswers);\n $(\"#incorrect-number-element\").text(\"Incorrect: \" + incorrectAnswers);\n $(\"#time-remaining-element\").html(\"Time: \" + timeLeft);\n\n //Empties card header and inserts question text\n $(\"#question-element\").empty();\n $(\"#question-element\").text(questionsArray[i].questionText);\n \n //Empties card body and inserts options\n $(\"#options-element\").empty();\n answersElement = $(\"<div>\").addClass(\"btn-group-vertical col-5\");\n option1Element = $(\"<div>\").addClass(\"btn btn-light mb-1 option-button\").text(questionsArray[i].answers.option1.optionText).attr(\"correct\", questionsArray[i].answers.option1.correct);\n option2Element = $(\"<div>\").addClass(\"btn btn-light mb-1 option-button\").text(questionsArray[i].answers.option2.optionText).attr(\"correct\", questionsArray[i].answers.option2.correct);\n option3Element = $(\"<div>\").addClass(\"btn btn-light mb-1 option-button\").text(questionsArray[i].answers.option3.optionText).attr(\"correct\", questionsArray[i].answers.option3.correct);\n option4Element = $(\"<div>\").addClass(\"btn btn-light mb-1 option-button\").text(questionsArray[i].answers.option4.optionText).attr(\"correct\", questionsArray[i].answers.option4.correct);\n\n //Adds options buttons to verticl button group\n $(answersElement).append(option1Element, option2Element, option3Element, option4Element);\n\n //Insets button group to the card body\n $(\"#options-element\").html(answersElement);\n\n checkAnswer();\n }\n\n \n\n else {\n endGame();\n }\n}", "function createLabelsAndButtons(){\r\n let buttonStyle = new PIXI.TextStyle({\r\n fill: 0xFF0000,\r\n fontSize: 48,\r\n fontFamily: \"Luckiest Guy\"\r\n });\r\n\r\n let startLabel1 = new PIXI.Text(\"SVIPER\");\r\n startLabel1.style = new PIXI.TextStyle({\r\n fill: 0x00FFFF,\r\n fontSize: 120,\r\n fontFamily: \"Faster One\", \r\n stroke: 0x00000,\r\n strokeThickness: 6\r\n });\r\n\r\n startLabel1.x = 100;\r\n startLabel1.y = 120;\r\n startScene.addChild(startLabel1);\r\n\r\n \r\n let startButton = new PIXI.Text(\"PLAY\");\r\n startButton.style = buttonStyle;\r\n startButton.x = 300;\r\n startButton.y = sceneHeight - 300;\r\n startButton.interactive = true;\r\n startButton.buttonMode = true;\r\n\r\n startButton.on(\"pointerup\",startGame);\r\n startButton.on(\"pointerover\",e=>e.target.alpha = 0.7);\r\n startButton.on(\"pointerout\",e=>e.currentTarget.alpha = 1.0);\r\n startScene.addChild(startButton);\r\n\r\n startButton.on(\"pointerup\",startGame);\r\n startButton.on(\"pointerover\",e=>e.target.alpha = 0.7);\r\n startButton.on(\"pointerout\",e=>e.currentTarget.alpha = 1.0);\r\n startScene.addChild(startButton);\r\n\r\n let textStyle = new PIXI.TextStyle({\r\n fill: 0xFFFFFF,\r\n fontSize: 20,\r\n fontFamily: \"Bree Serif\",\r\n stroke: 0x000000,\r\n strokeThickness: 4\r\n });\r\n\r\n let instructionLabel = new PIXI.Text(\"Press Right Click to Shoot.\\nMove with the Mouse.\\nCollect power ups for rewards.\");\r\n instructionLabel.style = new PIXI.TextStyle({\r\n fill: 0x000000,\r\n fontSize: 30,\r\n fontFamily: \"Bree Serif\", \r\n stroke: 0x00FFFF,\r\n strokeThickness: 4\r\n });\r\n\r\n instructionLabel.x = 40;\r\n instructionLabel.y = 470;\r\n startScene.addChild(instructionLabel);\r\n\r\n\r\n scoreLabel = new PIXI.Text();\r\n scoreLabel.style = textStyle;\r\n scoreLabel.x = sceneWidth/2-40;\r\n scoreLabel.y = 5;\r\n gameScene.addChild(scoreLabel);\r\n increasesScoreBy(0);\r\n\r\n lifeLabel = new PIXI.Text();\r\n lifeLabel.style = textStyle;\r\n lifeLabel.x = 5;\r\n lifeLabel.y = 5;\r\n gameScene.addChild(lifeLabel);\r\n decreaseLifeBy(0);\r\n\r\n //set up `gameOverScene`\r\n //make game over text\r\n let gameOverText = new PIXI.Text(\"Game Over!\");\r\n textStyle = new PIXI.TextStyle({\r\n\t fill: 0x00FFFF,\r\n\t fontSize: 60,\r\n\t fontFamily: \"Faster One\",\r\n\t stroke: 0x00000,\r\n\t strokeThickness: 6\r\n });\r\n gameOverText.style = textStyle;\r\n gameOverText.x = 150;\r\n gameOverText.y = sceneHeight/2 - 160;\r\n gameOverScene.addChild(gameOverText);\r\n\r\n // 3B - make \"play again?\" button\r\n let playAgainButton = new PIXI.Text(\"Play Again?\");\r\n playAgainButton.style = buttonStyle;\r\n playAgainButton.x = 250;\r\n playAgainButton.y = sceneHeight - 150;\r\n playAgainButton.interactive = true;\r\n playAgainButton.buttonMode = true;\r\n playAgainButton.on(\"pointerup\",startGame); // startGame is a function reference\r\n playAgainButton.on('pointerover',e=>e.target.alpha = 0.7); // concise arrow function with no brackets\r\n playAgainButton.on('pointerout',e=>e.currentTarget.alpha = 1.0); // ditto\r\n gameOverScene.addChild(playAgainButton);\r\n\r\n gameOverScoreLabel = new PIXI.Text();\r\n gameOverScoreLabel.style = textStyle;\r\n gameOverScoreLabel.x = 30;\r\n gameOverScoreLabel.y = sceneHeight/2 - 80;\r\n gameOverScene.addChild(gameOverScoreLabel);\r\n\r\n highScoreLabel = new PIXI.Text();\r\n highScoreLabel.style = textStyle;\r\n highScoreLabel.x = 30;\r\n highScoreLabel.y = sceneHeight/2 - 10;\r\n gameOverScene.addChild(highScoreLabel);\r\n\r\n starthighScoreLabel = new PIXI.Text();\r\n starthighScoreLabel.style = textStyle;\r\n starthighScoreLabel.x = 30;\r\n starthighScoreLabel.y = sceneHeight/2 + 100;\r\n if(storedScore == null){\r\n starthighScoreLabel.text = `No high score yet`\r\n }\r\n else{\r\n starthighScoreLabel.text = `Your high score: ${storedScore}`\r\n \r\n }\r\n startScene.addChild(starthighScoreLabel);\r\n \r\n}", "function updatePressedButtons() {\n // Sort the array.\n pressedButtons.sort();\n\n // Join all letters and uppercase string.\n var result = pressedButtons.join(\"\").toUpperCase();\n\n window.Elemu.select(\".pressedKeys\", function (elem) {\n elem.innerHTML = \"(-\" + result + \"-)\";\n });\n }", "function rockClick (){\n playerMove = \"rock\";\n displayPlayerMove();\n generateComputerMove(i);\n displayComputerMove();\n displayMovesText();\n if (computerMove === \"paper\") {\n computerWinsGame();\n }\n else if (computerMove === \"scissors\") {\n playerWinsGame();\n }\n else {\n drawGame();\n }\n updateScoresTable();\n}", "function drawButtons() {\n bctx.fillStyle = \"lightgray\";\n bctx.fillRect(0, 0, W /2, H);\n // iterates through all the rects and draws them\n for (let i = 0; i < rects.length; i++) {\n if (Number(rects[i].type) >= 0) {\n bctx.fillStyle = ((Number(rects[i].type) === 0) ? \"white\" : \"black\");\n bctx.fillRect(rects[i].x, rects[i].y, W/8, W/8);\n }\n else {\n drawSavePiece(rects[i].type, activeColor, rects[i].x, rects[i].y, bctx, W/8);\n }\n }\n }", "function renderButtons() {\n $(\"#buttons\").empty();\n for (var i = 0; i < topics.length; i++) {\n if (topics[i] == ''){\n return;\n }\n var a = $(\"<button>\");\n a.addClass(\"games\");\n a.attr(\"data-name\", topics[i]);\n a.text(topics[i]);\n $(\"#buttons\").append(a);\n }\n}", "function highscoreButtons() {\n\n var menuDiv = document.createElement(\"div\");\n menuDiv.style.display = \"flex\";\n menuDiv.style.justifyContent = \"center\";\n menuDiv.setAttribute(\"style\", \"margin: 50px;\");\n\n var goBackButtonEl = backButton(menuDiv);\n\n var clearHighscoresButtonEl = clearScoresButton();\n\n menuDiv.appendChild(goBackButtonEl);\n menuDiv.appendChild(clearHighscoresButtonEl);\n\n descriptionEl.appendChild(menuDiv);\n}", "function createDivsForColors() {\n playBtn();\n}", "nextRound() {\n \n if(!this.once){\n this.once = true;\n\n // Remove selection from all buttons.\n for(let i = 0; i < this.buttons.length; i++){\n this.buttons[i].isActive = false;\n this.removeChild(this.buttons[i]);\n this.buttons[i].selected = false;\n } \n\n // Increment the round counter.\n this.data.rounds.increment();\n\n // Get the choice from the computer.\n this.computer.generateRandomChoice();\n\n console.log(\"Your opponent played: \" + this.computer.choice.name);\n if(this.player.choice.greaterThan(this.computer.choice)){\n this.player.incrementScore();\n } \n else\n {\n this.computer.incrementScore();\n } \n \n // Add the buttons. \n this.resultButtons.continue = new Button(this.renderer.width - 150, this.renderer.height - 70, 150, 55);\n this.resultButtons.continue.setText(\"Continue\", Styles.button);\n\n // Add behavior.\n this.resultButtons.continue.onClicked(() => {\n this.displayResults = false;\n this.selected = undefined;\n this.once = undefined;\n \n this.removeChild(this.resultButtons.player);\n this.removeChild(this.resultButtons.computer);\n this.removeChild(this.resultButtons.continue);\n });\n\n // Set up the buttons.\n this.resultButtons.player = PIXI.Sprite.fromImage(`media/sprites/${this.player.choice.name}.png`);\n this.resultButtons.computer = PIXI.Sprite.fromImage(`media/sprites/${this.computer.choice.name}.png`);\n \n this.resultButtons.player.rotation = 0.2 * Math.PI;\n this.resultButtons.player.scale.x *= 0.25;\n this.resultButtons.player.scale.y *= 0.25;\n \n this.resultButtons.computer.rotation = 0.2 * Math.PI;\n this.resultButtons.computer.scale.x *= 0.25;\n this.resultButtons.computer.scale.y *= 0.25;\n \n this.resultButtons.player.x = 100;\n this.resultButtons.computer.x = 100 + (1 * this.renderer.width / 2);\n \n let tints = {\n win: 0x21FF00,\n lose: 0xFF0021,\n draw: 0xCCCC00\n };\n \n console.log(`${this.player.choice.name} || ${this.computer.choice.name}`);\n \n if(this.player.choice.greaterThan(this.computer.choice)){\n this.resultButtons.player.tint = tints.win;\n this.resultButtons.computer.tint = tints.lose;\n }\n else if(this.player.choice.sameAs(this.computer.choice))\n { \n this.resultButtons.player.tint = tints.draw;\n this.resultButtons.computer.tint = tints.draw;\n }\n else\n {\n this.resultButtons.player.tint = tints.lose;\n this.resultButtons.computer.tint = tints.win;\n }\n \n this.resultButtons.player.y = this.center.y - 100;\n this.resultButtons.computer.y = this.center.y - 100;\n \n this.addChild(this.resultButtons.player);\n this.addChild(this.resultButtons.computer);\n this.addChild(this.resultButtons.continue);\n \n \n }\n }", "function renderButtons() {\n // Deletes the movies prior to adding new movies\n $('.buttons-view').empty();\n // Loops through the array of topics to create buttons for all topics\n for (var i = 0; i < topics.length; i++) {\n var createButtons = $('<button>');\n createButtons.addClass('topic btn btn-success');\n createButtons.attr('data-name', topics[i]);\n createButtons.text(topics[i]);\n $('.buttons-view').append(createButtons);\n }\n }", "function initialiseScoreBoards(){ \n redScoreBoard.innerText=redWinsCount; \n yellowScoreBoard.innerText=yellowWinsCount;\n}", "function initialize() {\n for (var i = 1; i < 5; i++) {\n randomizeButton($(\"#button-\"+i));\n }\n setGoal();\n scoreCount = 0;\n $(\"#wins\").text(winCount);\n $(\"#losses\").text(lossCount);\n $(\"#score\").text(scoreCount);\n }", "displayBoard() {\n this.translateBoard();\n // if (this.states == STATES.DISPLAYED)\n this.updateScore();\n //}\n }", "function createButtons() {\n // When the addClass1 button is pressed, add the current frame to class \"Up\"\n buttonA = document.querySelector('#addClass1');\n buttonA.addEventListener('click', function() {\n addExample('Up');\n });\n\n // When the addClass2 button is pressed, add the current frame to class \"Right\"\n buttonB = document.querySelector('#addClass2');\n buttonB.addEventListener('click', function() {\n addExample('Right');\n });\n\n // When the addClass3 button is pressed, add the current frame to class \"Down\"\n buttonC = document.querySelector('#addClass3');\n buttonC.addEventListener('click', function() {\n addExample('Down');\n });\n\n // When the addClass4 button is pressed, add the current frame to class \"Left\"\n buttonC = document.querySelector('#addClass4');\n buttonC.addEventListener('click', function() {\n addExample('Left');\n });\n\n // Predict button\n buttonPredict = document.querySelector('#buttonPredict');\n buttonPredict.addEventListener('click', classify);\n\n // Clear all classes button\n buttonClearAll = document.querySelector('#clearAll');\n buttonClearAll.addEventListener('click', clearAllLabels);\n}", "function gameSwitch(score) {\n winningScore = score;\n gameBoardDiv.innerHTML = playGame;\n userButtons();\n}", "function submitButtonPressed() {\n parseAllData();\n\n $(\".highScore1\").show();\n $(\".highScore2\").show();\n $(\".highScore3\").show();\n $(\".scoreboardPTags\").hide();\n $(\".highScore1\").show();\n $(\".highScore2\").show();\n $(\".highScore3\").show();\n $(\"h1\").text(\"High Scores!\");\n $(\"h1\").css(\"text-align\", \"center\");\n $(\".userhighscore\").remove();\n $(\".userInitials\").remove();\n $(\".playAgain\").remove();\n $(\"#startBtn\").hide();\n $(\".percentRight\").remove();\n $(\".userInitials\").remove();\n $(\".label\").remove();\n $(\".submitBtn\").remove();\n $(\".userAnswer\").remove();\n $(\".answerCheck\").hide();\n $(\".welcome-p\").hide();\n $(\".welcome-p2\").hide();\n\n $(\"h1\").text(\"High Scores!\");\n $(\"h1\").css(\"text-align\", \"center\");\n\n stopTimer();\n\n var playAgain = $(\"<button>\");\n playAgain.addClass(\"playAgain btn\");\n playAgain.text(\"Play Again!\");\n $(\"main\").append(playAgain);\n }", "function setUpModeBtns() {\n let modeBtns = document.querySelectorAll(\".mode\");\n for (let i = 0; i < modeBtns.length; i++) {\n modeBtns[i].addEventListener(\"click\", function() {\n // Set numSquares based on difficulty of button\n if (this.textContent === \"Easy\")\n numSquares = 3;\n else if (this.textContent === \"Hard\")\n numSquares = 6;\n // Remove styling from all buttons\n for (let j = 0; j < modeBtns.length; j++)\n modeBtns[j].classList.remove(\"selected\");\n // Add styling to selected button\n this.classList.add(\"selected\");\n // Reset game\n reset();\n });\n }\n}", "function renderButtons() {\n\n// Deleting the buttons so they don't endlessly repeat\n\t$(\"#sport-buttons\").empty();\n\n\t// Loop through the array of sports\n\tfor (var i = 0; i < topics.length; i++) {\n\n\t\t// Creates a button\n\t\tvar a = $(\"<button>\");\n\t\t// Adding a class of movie to our button\n\t\ta.addClass(\"sport\");\n\t\t// Adding a data-attribute\n\t\ta.attr(\"data-name\", topics[i]);\n\t\t// Providing the initial button text\n\t\ta.text(topics[i]);\n\t\t// Adding the button to the buttons-view div\n\t\t$(\"#sport-buttons\").append(a);\n\t}\n}", "function boardButtons (t) {\n return [{\n icon: {\n dark: clockImage,\n light: clockImageWhite\n },\n text: 'Activity timer history',\n callback: onBoardButtonClick,\n condition: 'always'\n }];\n}", "function setupModeButtons(){\n for(var i = 0; i < modeButtons.length; i++){\n modeButtons[i].addEventListener(\"click\", function(){\n modeButtons[0].classList.remove(\"selected\");\n modeButtons[1].classList.remove(\"selected\");\n this.classList.add(\"selected\");\n // ternary operator - condition ? expr1: expr2;\n this.textContent === \"Easy\" ? numOfSquares = 3: numOfSquares = 6;\n reset();\n });\n }\n}", "function actionAfterClickPlay() {\n // @todo checkin rate (alert if none or too high)\n createButtonAfterPlay();\n createResultsArea();\n createRateArea();\n createCardArea();\n gameAfterPlay();\n removeElementsAfterPlay();\n\n}", "function submitButtonPressed2() {\n $(\".highScore1\").show();\n $(\".highScore2\").show();\n $(\".highScore3\").show();\n $(\".scoreboardPTags\").hide();\n $(\".highScore1\").show();\n $(\".highScore2\").show();\n $(\".highScore3\").show();\n $(\"h1\").text(\"High Scores!\");\n $(\"h1\").css(\"text-align\", \"center\");\n $(\".userhighscore\").remove();\n $(\".userInitials\").remove();\n $(\".playAgain\").remove();\n $(\"#startBtn\").hide();\n $(\".percentRight\").remove();\n $(\".userInitials\").remove();\n $(\".label\").remove();\n $(\".submitBtn\").remove();\n $(\".userAnswer\").remove();\n $(\".answerCheck\").hide();\n $(\".welcome-p\").hide();\n $(\".welcome-p2\").hide();\n\n $(\"h1\").text(\"High Scores!\");\n $(\"h1\").css(\"text-align\", \"center\");\n\n stopTimer();\n\n var playAgain = $(\"<button>\");\n playAgain.addClass(\"playAgain btn\");\n playAgain.text(\"Play Again!\");\n $(\"main\").append(playAgain);\n }", "function Start() {\n\n $(\"#winText\").text(\"Wins: \" + wins)\n $(\"#loseText\").text(\"Losses: \" + losses)\n $(\".CurrentScoreText\").text(currentScore);\n \n currentScore = 0;\n\n //buttonValue 1-12\n box1Value = Math.floor(Math.random() * 12) + 1;\n box2Value = Math.floor(Math.random() * 12) + 1;\n box3Value = Math.floor(Math.random() * 12) + 1;\n box4Value = Math.floor(Math.random() * 12) + 1;\n //targetscore 19-120\n targetScore = (Math.floor(Math.random() * (120 - 19 + 1)) + 19);\n $(\".TargetScoreText\").text(targetScore);\n}", "function game3_button1(word,X,Y)\n{\n textAlign(CENTER);\n const button_width = width /4;\n const button_height = 225;\n \n const Play_button_left = X;\n const Play_button_top = Y;\n const mouse_is_within_x_range = mouseX >= Play_button_left && mouseX < button_width+X;\n const mouse_is_within_y_range = mouseY > Play_button_top && mouseY < Play_button_top + button_height;\n \n push();\n strokeWeight(10);\n stroke('#CC99FF');\n fill(255)\n if(mouse_is_within_x_range && mouse_is_within_y_range)\n {\n fill(230);\n }\n rect(Play_button_left, Play_button_top, \n button_width, button_height);\n pop();\n textSize(50);\n text(word, Play_button_left+button_width/2, Play_button_top+button_height/2 +15 );\n \n if (mouseIsPressed == true && mouseWasPressed == false)\n {\n if(mouse_is_within_x_range && mouse_is_within_y_range)\n {\n A_number = A_number-1\n B_number = B_number-1\n C_number = C_number-1\n D_number = D_number-1\n\n if(A_number == 3 && B_number==3 && C_number==3 && D_number == 3)\n {\n CurrentScreen = game_clear\n }\n }\n }\n}", "function showScoreCard() {\n clearPrompt();\n $(\"#points\").text(\"\");\n $(\"#score\").text(\"\");\n $(\"#rightAnswers\").text(\"Correct Answers: \" + correct);\n $(\"#wrongAnswers\").text(\"Incorrect Answers: \" + incorrect);\n $(\"#totalScore\").text(\"Total Score: \" + score);\n var playAgainButton = $(\"<button>\");\n playAgainButton.addClass(\"playAgain btn btn-outline-dark btn-lg btn-block\");\n playAgainButton.text(\"Play Again?\");\n $(\"#playAgainButtonSection\").append(playAgainButton);\n correct = 0;\n incorrect = 0;\n score = 0;\n }", "function renderButtons() {\n\n // Deleting existing buttons prior to adding new movies to prevent repeats\n $(\".button-panel\").empty();\n\n // Looping through the topics array\n for (var i = 0; i < topics.length; i++) {\n\n // Then dynamically generating buttons for each topic in the array\n var topicButton = $(\"<button>\");\n // Adding a class of movie-btn to our button\n topicButton.addClass(\"topic-btn\");\n // Adding a data-attribute\n topicButton.attr(\"data-name\", topics[i]);\n // Providing the initial button text\n topicButton.text(topics[i]);\n // Adding the button to the buttons-view div\n $(\".button-panel\").append(topicButton);\n }\n}", "function createButtons () {\n // first we need to empty the current giphs if any...\n $(\"#button-view\").empty();\n\n // now loop through 'topics' array and make a button for each\n for (i =0; i < topics.length; i++) {\n //now create a new button element, assign it a css class, and label it with the array value\n var newButton = $(\"<button>\");\n newButton = newButton.addClass(\"get-superhero btn btn-danger\").text(topics[i]);\n $(\"#button-view\").append(newButton);\n }\n }", "createGamePressed(self, event) {\n console.log(\"App.createGamePressed\");\n let board = self.boardGenerator.generateBoard(this.getValue(\"howBig\"), this.getValue(\"howLong\"), this.getValue(\"minimumScore\"));\n self.sheet.addNewBoard(board);\n self.showReadyToPlay();\n }", "function setUpBoard () {\n makeCrystalScores();\n makeCrystalButtons();\n }", "function init() {\n for (var i = BUTTONS; i > 0; i--) {\n var button = document.createElement('button');\n button.dataset.simon = i;\n document.body.appendChild(button);\n }\n\n document.body.addEventListener('keypress', function (evt) {\n switch (evt.key) {\n case 'z':\n clickHandler(1);\n break;\n case 'x':\n clickHandler(2);\n break;\n case 'c':\n clickHandler(3);\n break;\n default:\n break;\n }\n });\n\n document.body.addEventListener('click', function (el) {\n var idx = el.target.dataset.simon;\n clickHandler(idx);\n });\n\n var scoreKeeper = document.createElement('div');\n scoreKeeper.classList.add('score');\n scoreKeeper.innerHTML = \"0\";\n document.body.appendChild(scoreKeeper);\n}", "makeUI() {\n gameState.criteriaText = this.add.text(gameState.CENTER_X, gameState.CRITERIA_HEIGHT, `MULTIPLES OF ${gameState.criteriaNum}`, {\n font: gameState.INFO_FONT,\n fill: '#00ffff'\n }).setOrigin(0.5);\n gameState.creditsText = this.add.text(192, 684, `Created by Jon So, 2021`, {\n font: gameState.DECO_FONT,\n fill: '#ffffff'\n });\n gameState.scoreText = this.add.text(gameState.CENTER_X, gameState.SCORE_HEIGHT, `${gameState.score}`, {\n font: gameState.SCORE_FONT,\n fill: '#ffffff'\n }).setOrigin(0.5);\n gameState.levelText = this.add.text(3 * gameState.CENTER_X / 2, 3 * gameState.CENTER_Y / 2, `LV. ${gameState.level}: ${gameState.FLAVORS[gameState.colorFlavorIndex]}`, {\n font: gameState.INFO_FONT,\n fill: '#ffffff'\n }).setOrigin(0.5);\n gameState.readyPrompt = this.add.text(gameState.CENTER_X, 9 * gameState.CENTER_Y / 16, ``, {\n font: gameState.READY_FONT,\n fill: '#ff0000'\n }).setOrigin(0.5);\n gameState.comboCounterTextLeft = this.add.text(gameState.CENTER_X / 7 + 8, gameState.CENTER_Y - 32, `1x`, {\n font: gameState.COMBO_FONT,\n fill: '#ffffff',\n }).setOrigin(0.5).setFontStyle('bold italic');\n gameState.comboCounterTextRight = this.add.text(config.width - gameState.CENTER_X / 7 - 8, gameState.CENTER_Y - 32, `1x`, {\n font: gameState.COMBO_FONT,\n fill: '#ffffff',\n }).setOrigin(0.5).setFontStyle('bold italic');\n // Display the high score/highest level/ highest combo\n\t\tgameState.highText = this.add.text(gameState.CENTER_X, 16, \n\t\t\t`HI SCORE-${localStorage.getItem(gameState.LS_HISCORE_KEY)}\\t\\tHI COMBO-${localStorage.getItem(gameState.LS_HICOMBO_KEY)}\\t\\tHI LEVEL-${localStorage.getItem(gameState.LS_HILEVEL_KEY)}`, {\n\t\t\t\tfont: gameState.INFO_FONT,\n \tfill: '#ffffff'\n }).setOrigin(0.5).setTint(0xff0000).setFontStyle(\"bold\"); \n this.showReadyPrompt();\n gameState.levelText.setTint(gameState.COLOR_HEXS[gameState.colorFlavorIndex]);\n this.setupLivesDisplay();\n }", "function renderButtons() {\n // Deleting the player buttons prior to adding new player buttons\n\n $('#players-view').empty();\n\n for (var i = 0; i < players.length; i++) {\n var a = $('<button>')\n .addClass('player')\n .attr('data-name', players[i])\n .text(i + 1 + '. ' + players[i])\n .css({\n width: '175px',\n height: '175px',\n border: 'none',\n color: '#ffffff',\n background: \"url('http://laoblogger.com/images/basket-clipart-free-4.jpg')\",\n 'background-size': '175px 175px',\n font: 'italic 25px \"Fira Sans\", serif',\n 'border-radius': '100%',\n float: 'left',\n display: 'inline-block',\n margin: '20px',\n });\n $('#players-view').append(a);\n }\n }", "function loadMenuButtons(){\n texts = [];\n texts.push(new Text(WIDTH/2, HEIGHT/25, WIDTH/6, \"OCTE\", -WIDTH/10, false));\n //texts.push(new Text(WIDTH/2, HEIGHT*0.2, WIDTH/50, \"(overly complicated tennis experience)\", -WIDTH/10, false));\n buttons = [];\n buttons.push(new Button(WIDTH/2, HEIGHT/2 - HEIGHT/10 + HEIGHT/150, WIDTH*0.2, HEIGHT/15, \"1player\", \"1 PLAYER\", 0, {}));\n buttons.push(new Button(WIDTH/2, HEIGHT/2 + HEIGHT/150, WIDTH*0.2, HEIGHT/15, \"2player\", \"2 PLAYERS\", 0, {}));\n buttons.push(new Button(WIDTH/2, HEIGHT/2 + HEIGHT/10 + HEIGHT/150, WIDTH*0.2, HEIGHT/15, \"options\", \"OPTIONS\", 0, {}));\n}", "function displayGame() {\n points = 20;\n clearPrompt();\n $(\"#start\").html(\"\");\n $(\"#playAgainButtonSection\").html(\"\");\n $(\"#rightAnswers\").text(\"\");\n $(\"#wrongAnswers\").text(\"\");\n $(\"#totalScore\").text(\"\");\n $(\"#gifDiv\").html(\"\");\n $(\"#points\").text(points);\n $(\"#question\").text(questions[questionSelector]);\n for (i = 0; i < answerArrays[questionSelector].length; i++) {\n $(\"#answerSection\" + i).html(\"\");\n var answerButton = $(\"<button>\");\n answerButton.addClass(\"answer btn btn-outline-primary btn-lg btn-block\");\n answerButton.id = \"answer\" + i;\n answerButton.attr(\"data-name\", answerArrays[questionSelector][i]);\n answerButton.text(answerArrays[questionSelector][i]);\n $(\"#answerSection\" + i).append(answerButton);\n } \n startCountdown();\n }", "function createButtons() {\n btnWrapper.innerHTML = '';\n\n // Create Shuffle button\n const onShuffleClick = () => {\n // Create shuffled cards out of old cards\n const shuffledCards = [...cardsWrapper.children].sort(() => Math.random() - 0.5);\n cardsWrapper.innerHTML = '';\n shuffledCards.forEach((card, index) => {\n card.style.left = `${index * 30}px`;\n cardsWrapper.appendChild(card);\n });\n };\n\n const shuffleButton = document.createElement('button');\n shuffleButton.innerHTML = 'Shuffle';\n shuffleButton.classList.add('btn', 'btn-lg', 'btn-secondary', 'btn-space');\n shuffleButton.addEventListener('click', onShuffleClick);\n btnWrapper.appendChild(shuffleButton);\n\n // Create Flip button\n const onFlipClick = () => cardsWrapper.classList.toggle('hidden');\n\n const flipButton = document.createElement('button');\n flipButton.innerHTML = 'Flip cards';\n flipButton.classList.add('btn', 'btn-lg', 'btn-secondary', 'btn-space');\n flipButton.addEventListener('click', onFlipClick);\n btnWrapper.appendChild(flipButton);\n\n // Create Restart button\n const onRestartClick = () => {\n cardsWrapper.innerHTML = '';\n selectedCardsWrapper.innerHTML = '';\n // eslint-disable-next-line no-use-before-define\n startGame();\n };\n\n const restartButton = document.createElement('button');\n restartButton.innerHTML = 'Restart';\n restartButton.classList.add('btn', 'btn-danger', 'btn-lg', 'btn-secondary', 'btn-space');\n restartButton.addEventListener('click', onRestartClick);\n btnWrapper.appendChild(restartButton);\n}", "function updateButtons() {\n $(\"#buttonDisplay\").empty();\n for (var i = 0; i < topics.length; i++) {\n // create new caption\n var newCaption = $(\"<div>\").text(topics[i]).addClass(\"button-caption\");\n // create new black space\n var newBlackSpace = $(\"<div>\").addClass(\"black-space\");\n // create new button\n var newButton = $(\"<button>\").data(\"name\", topics[i]).addClass(\"topic-button\");\n // append caption to button\n newButton.append(newBlackSpace, newCaption);\n // append it to the display\n $(\"#buttonDisplay\").append(newButton);\n };\n }", "function createButtons() {\n // When the A button is pressed, add the current frame\n // from the video with a label of \"A\" to the classifier\n buttonA = document.querySelector(\"#addClassA\");\n buttonA.addEventListener(\"click\", function() {\n addExample(\"A\");\n });\n\n // When the B button is pressed, add the current frame\n // from the video with a label of \"B\" to the classifier\n buttonB = document.querySelector(\"#addClassB\");\n buttonB.addEventListener(\"click\", function() {\n addExample(\"B\");\n });\n\n // Reset buttons\n resetBtnA = document.querySelector(\"#resetA\");\n resetBtnA.addEventListener(\"click\", function() {\n clearLabel(\"A\");\n });\n\n resetBtnB = document.querySelector(\"#resetB\");\n resetBtnB.addEventListener(\"click\", function() {\n clearLabel(\"B\");\n });\n\n // Predict button\n buttonPredict = document.querySelector(\"#buttonPredict\");\n buttonPredict.addEventListener(\"click\", classify);\n\n // Clear all classes button\n buttonClearAll = document.querySelector(\"#clearAll\");\n buttonClearAll.addEventListener(\"click\", clearAllLabels);\n}", "function addAnswerBtns() {\n\t\tfor (let k = 0; k < randAnswers.length; k++) {\n\t\t\t$(\"#answerArea\").append('<button class=\"btn btn-kelly answerBtn\"><li>' + randAnswers[k] + '</li></button>');\n\t\t\t// console.log(randAnswers[k]);\n\t\t}\n\t}", "function makeButtons() {\n\t// attach script to reset button\n\tvar resetObject = GameObject.CreatePrimitive(PrimitiveType.Quad);\n\tvar resetScript = resetObject.AddComponent(resetButtonMouse);\n\tresetScript.init(this);\n\t\n\t// attach script to menu button\n\tvar menuObject = GameObject.CreatePrimitive(PrimitiveType.Quad);\n\tvar menuScript = menuObject.AddComponent(menuButtonMouse);\n\tmenuScript.init(this);\n\t\n\t// attach script to help button\n\tvar helpObject = GameObject.CreatePrimitive(PrimitiveType.Quad);\n\tvar helpScript = helpObject.AddComponent(helpButtonMouse);\n\thelpScript.init(this);\n\n\t// attach script to mute button\n\tvar muteObject = GameObject.CreatePrimitive(PrimitiveType.Quad);\n\tvar muteScript = muteObject.AddComponent(muteButtonMouse);\n\tmuteScript.init(this);\n\n\tvar tempheight: int =Screen.height/500;\n\t\tmenuObject.transform.position = Vector3(-2, 7, 0);\n\t\tresetObject.transform.position = Vector3(-2, 6, 0);\n\t\tmuteObject.transform.position = Vector3(-2, 5, 0);\n\t\thelpObject.transform.position = Vector3(-2, 4, 0);\n}", "function setBoxValue(){\n for (let i = 0; i < playerMap.length; i++) {\n let scoreBox = document.getElementById('mainBord' + (i+1));\n let paragraph = document.createElement(\"p\");\n\n scoreBox.setAttribute(\"data\", playerMap[i]);\n\n if( ( playerMap[i] === 3 ) || ( playerMap[i] === 2) ){\n scoreBox.innerHTML = ' ';\n scoreBox.appendChild( createButton( whichToSelect ) );\n } else {\n paragraph.setAttribute(\"class\", \"center para\");\n paragraph.innerHTML = playerMapIndex[ playerMap[i] ];\n scoreBox.appendChild( paragraph );\n }\n }\n}", "function renderButtons() {\n\n // Deleting buttons prior to adding movies\n // or you will have topics that repeat themselves\n $(\"#buttons-view\").empty();\n\n\n // Looping through the array of topics\n for (var i = 0; i < topics.length; i++) {\n\n // Then dynamically generating buttons for each topic in the array\n // This code $(\"<button>\") is all jQuery needs to create the beginning and end tag. (<button></button>)\n var a = $(\"<button>\");\n // Adding a class of to our button\n a.addClass(\"topic\");\n // Adding a data-attribute\n a.attr(\"data-name\", topics[i]);\n // Providing the initial button text\n a.text(topics[i]);\n // Adding the button to the buttons-view div\n $(\"#buttons-view\").append(a);\n }\n}", "function setupModeButtons() {\n // By placing buttons for game mode in For-loop code is no longer\n // duplicated and it becomes easier to add another game mode later on\n for (let i = 0; i < buttonsMode.length; i++) {\n buttonsMode[i].addEventListener('click', function() {\n buttonsMode[0].classList.remove('selected');\n buttonsMode[1].classList.remove('selected');\n this.classList.add('selected');\n // Change number of squares according to game mode\n if (this.textContent === 'Easy') {\n gameMode = 3;\n } else {\n gameMode = 6;\n }\n resetGame();\n });\n }\n}", "function newGame(){\nyourScore = 0;\nbutton1 = Math.floor(Math.random() * 12+1);\nbutton2 = Math.floor(Math.random() * 12+1);\nbutton3 = Math.floor(Math.random() * 12+1);\nbutton4 = Math.floor(Math.random() * 12+1);\nrandomNum = Math.floor(Math.random() * 120+19);\n\n$('#yourScore').text(yourScore);\n$('#randomNum').text(randomNum);\n\n}", "function setUpModeButtons(){\n //mode buttons event listeners \n for(var i = 0; i < modeButtons.length; i++){\n modeButtons[i].addEventListener(\"click\", function(){\n modeButtons[0].classList.remove(\"selected\");\n modeButtons[1].classList.remove(\"selected\");\n this.classList.add(\"selected\");\n this.textContent === \"Easy\" ? numSquares = 3 : numSquares = 6;\n reset();\n });\n };\n}", "function renderButtons(){\n $(\"#video-game-buttons\").html(\"\");\n \n $.each(topics, function(index){\n var button = $(\"<button>\");\n button.addClass(\"video-game-button\");\n button.attr(\"data-name\", topics[index]);\n button.html(topics[index]);\n $(\"#video-game-buttons\").append(button);\n });\n}", "function userButtons() {\n const rockDiv = document.getElementById('rock');\n rockDiv.addEventListener('click', function() {\n game('rock');\n });\n const paperDiv = document.getElementById('paper');\n paperDiv.addEventListener('click', function() {\n game('paper');\n });\n const scissorsDiv = document.getElementById('scissors');\n scissorsDiv.addEventListener('click', function() {\n game('scissors');\n });\n const lizardDiv = document.getElementById('lizard');\n lizardDiv.addEventListener('click', function() {\n game('lizard');\n });\n const spockDiv = document.getElementById('spock');\n spockDiv.addEventListener('click', function() {\n game('spock');\n });\n}", "function renderButtons() {\n\n // Deleting the movie buttons prior to adding new movie buttons\n // (this is necessary otherwise we will have repeat buttons)\n $(\"#hero-list\").empty();\n\n // Looping through the array of movies\n for (var i = 0; i < heroes.length; i++) {\n \tconsole.log(heroes[i])\n \tvar dpAttribute = heroes[i]\n\n // Then dynamicaly generating buttons for each movie in the array.\n // This code $(\"<button>\") is all jQuery needs to create the start and end tag. (<button></button>)\n var newButton = $(\"<button>\");\n newButton.attr(\"class\", \"list-group-item rendered\")\n newButton.attr(\"data-hero\", dpAttribute)\n\n\n newButton.text(heroes[i]);\n // Adding the button to the HTML\n $(\"#hero-list\").append(newButton);\n }\n }", "function renderButtons() {\n\n $(\"#buttons-view\").empty();\n\n for (var i = 0; i < games.length; i++) {\n\n var a = $(\"<button>\");\n a.addClass(\"game\");\n a.attr(\"data-name\", games[i]);\n a.text(games[i]);\n $(\"#buttons-view\").append(a);\n }\n}", "function buttons() {\n\t$('#cardForm').on('click', '#newGame', function() {\n\t\tevent.preventDefault();\n\t\tgetCard();\n\t\tif (!$('#rules').hasClass('hidden')) {\n\t\t\t$('#rules').addClass('hidden');\n\t\t}\n\t\t$('#newGame').addClass('hidden');\n $('#newCard').removeClass('hidden');\n $('#prevCard').removeClass('hidden');\n $('#btnRules').removeClass('hidden');\n $('#answerBtn').removeClass('hidden');\n\t});\n\n\t$('#cardForm').on('click', '#newCard', function() {\n\t\tevent.preventDefault();\n\t\tgetCard();\n });\n \n $('#cardForm').on('click', '#prevCard', function() {\n\t\tevent.preventDefault();\n\t\tgetPrevCard();\n });\n \n $('#cardForm').on('click', '#answerBtn', function() {\n event.preventDefault();\n let setCard = shuffledArray[cardNum];\n\t\tdisplayAnswer(setCard);\n\t});\n\n\t$('#cardForm').on('click', '#btnRules', function() {\n\t\tevent.preventDefault();\n\t\t$('#rules').toggleClass('hidden');\n\t});\n}", "function makeButtons() {\n\t\t//remove comment wbelow\n // Delete the content inside the movies-view div prior to adding new movies\n // (this is necessary otherwise you will have repeat buttons)\n $(\"#buttons\").empty();\n\n\n // use a loop that appends a button for each string in the array\n for (var i = topics.length - 1; i >= 0; i--) { // or var i = 0; i < topics.length; i++\n console.log(topics[i]);\n $(\"#buttons\").append(\"<button>\" + topics[i] + \"</button>\");\n }\n }", "function renderButtons() {\n\n $(\"#buttons-view\").empty();\n\n for (i = 0; i < topics.length; i++) {\n\n var a = $(\"<button>\");\n\n a.addClass(\"topicgif\");\n\n a.attr(\"data-name\", topics[i]);\n\n a.text(topics[i]);\n\n $(\"#buttons-view\").append(a);\n }\n }" ]
[ "0.69475615", "0.6863367", "0.6840834", "0.6805191", "0.68026936", "0.67381406", "0.672422", "0.6720168", "0.6617027", "0.6563274", "0.65039325", "0.64585024", "0.64482474", "0.64416", "0.64400285", "0.64362717", "0.64337057", "0.6413039", "0.6410319", "0.63975495", "0.63880676", "0.6362265", "0.6359806", "0.6359594", "0.6348714", "0.6342044", "0.63362825", "0.6330548", "0.6328432", "0.63260764", "0.6313493", "0.6310747", "0.63037086", "0.63007164", "0.62992775", "0.6294406", "0.6287786", "0.62630963", "0.62619716", "0.6251191", "0.6249609", "0.6245875", "0.6244657", "0.6244205", "0.6240833", "0.62383395", "0.62324387", "0.6226875", "0.622458", "0.62055504", "0.62018055", "0.620008", "0.619851", "0.61874753", "0.61768776", "0.617383", "0.61654395", "0.61616814", "0.6161407", "0.6158197", "0.61576456", "0.6146911", "0.61462694", "0.61447924", "0.6138109", "0.6131557", "0.61211705", "0.611477", "0.61007035", "0.6100644", "0.6097311", "0.6096163", "0.6095869", "0.60946876", "0.6072948", "0.6072362", "0.60677534", "0.6063221", "0.60624385", "0.6061745", "0.60601205", "0.60574275", "0.6056558", "0.60561264", "0.60551107", "0.60539037", "0.60527045", "0.6049066", "0.6046793", "0.6046712", "0.6046594", "0.60462207", "0.60455596", "0.6042233", "0.60404104", "0.6037752", "0.6037598", "0.6034327", "0.6034237", "0.603172" ]
0.80036443
0
! DISPLAY TOP 10 SCOREBOARD This is the function that runs to display top ten scoreboard
function goScorePage(page){ var targetContainer; scoreBoardContainer.visible = false; $('#scoreHolder').hide(); switch(page){ case 'submit': targetContainer = null; $('#scoreHolder').show(); resizeScore(); break; case 'scoreboard': targetContainer = scoreBoardContainer; break; case '': targetContainer = null; break; } if(targetContainer != null){ targetContainer.visible = true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function printScoreBoard(scores) {\n console.log(chalk.bgYellow(\"___Top Scores___\"));\n scores.forEach((score) => {\n console.log(score.name, score.score);\n })\n}", "function displayScores(){\r\n\t\r\n\tvar t = \"<h1>Top 10 Players</h1>\\\r\n\t\t\t <table style='background-color: black; border-radius: 5px;'>\\\r\n\t\t\t <tr><th style='text-decoration: underline; color: Blue; font-size: 30px;'>Player</th>\\\r\n\t\t\t <th style='text-decoration: underline; color: Blue; font-size: 30px;'>Score</th></tr>\";\r\n\t\t\t\r\n\tvar len = arrScore.length;\r\n\tvar nameScore = [];\r\n\r\n\t$(arrName).each(function(index, val){\r\n\t\tnameScore.push([arrName[index], arrScore[index]]);\r\n\t})\r\n\t\r\n\tnameScore.sort(function(a, b) { \r\n\t\treturn b[1] - a[1];\r\n\t});\r\n\tvar displaylen;\r\n\t\r\n\tif(len > 10){\r\n\t\tdisplaylen = 10;\r\n\t}\r\n\telse{\r\n\t\tdisplaylen = len;\r\n\t}\r\n\t\r\n\tvar name = [];\r\n\tvar score = [];\r\n\t\r\n\tfor(var z = 0; z < displaylen; z++){\r\n\t\tfor(var y = 0; y < 1; y++){\r\n\t\t\tname[z] = nameScore[z][y];\t\t\r\n\t\t}\r\n\t}\r\n\tfor(var i = 0; i < displaylen; i++){\r\n\t\tfor(var k = 1; k < 2; k++){\r\n\t\t\tscore[i] = nameScore[i][k];\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\tfor(var j = 0; j < displaylen; j++){\r\n\t\tt += \"<tr><td>\" + name[j] + \"</td><td>\" + score[j] + \"</td></tr>\";\r\n\t}\r\n\t\r\n\tt = t + spaceTxt;\r\n\t\r\n\tdocument.getElementsByClassName(\"container\")[0].innerHTML = t;\r\n\t\r\n\t$(document).keypress(function(e){\r\n\t\tif (e.keyCode == SPACEBAR){\r\n\t\t\t$(this).unbind();\r\n\t\t\twelcome();\r\n\t\t}\r\n\t});\r\n}", "function displayScores() {\n // Current score, large and in the center\n push();\n fill(random(200, 255));\n textSize(800);\n textAlign(CENTER, CENTER);\n text(score, width / 2, height / 2);\n pop();\n\n // High score in the top left\n push();\n fill(random(200, 255));\n textSize(64);\n textAlign(LEFT, TOP);\n text(`High score: ${highScore}`, 0, 0);\n pop();\n}", "function retrieve_top_ten(){\n\tlet params = {\n\t\t\t\t method: \"GET\",\n\t\t\t\t url: \"/api/stats/\"\n\t\t\t\t}\n\t$.ajax(params).done(function(data) {\n\t\tvar allStats = '<div style=\"border:1px solid black\"><h3> Top 10 Players </h3><table><tr>'+\n\t\t'<th> Username </th><th> High Score </th></tr>';\n\t\tfor(i=0;i<data[\"stats\"].length;i++){\n\t\t\tallStats += \"<tr><th>\"+data[\"stats\"][i].username+\"</th><th>\"\n\t\t\t+data[\"stats\"][i].highscore+\"</th></tr>\";\n\t\t}\n\t\tallStats+= \"</table>\";\n\t\tallStats+= '<input id=\"collapse\" type=\"button\" value=\"Collapse\" onclick=\\'$(\"#all-stats-login\").hide(); $(\"#all-stats\").hide();\\' />'\n\t\t$(\"#all-stats-login\").html(allStats);\n\t\t$(\"#all-stats\").html(allStats);\n\t});\n}", "function displayScore(){\n push();\n textFont(`Blenny`);\n fill(tileWhite.fill.r, tileWhite.fill.g, tileWhite.fill.b); // Same white as white tiles\n textSize(40);\n text(`${score} points`, 1050, 150);\n pop();\n}", "function renderBestScores() {\n if (gBestScoreEasy) elTopScores[0].innerText = gBestScoreEasy + ' sec';\n if (gBestScoreMedium) elTopScores[1].innerText = gBestScoreMedium + ' sec';\n if (gBestScoreHard) elTopScores[2].innerText = gBestScoreHard + ' sec';\n}", "function drawScoreBoard(){\r\n context.font = \"Bold 25px Courier New\";\r\n context.fillStyle = \"#000000\";\r\n scoreBoard = cars.slice();\r\n scoreBoard.sort(function(a, b){\r\n return b.score - a.score;\r\n });\r\n for (var i = 0; i < 5; i++) {\r\n if (i > scoreBoard.length -1 ){break;}\r\n if (scoreBoard[i] == null){break;}\r\n var j = i+1\r\n context.fillText(j + \":\" + scoreBoard[i].name+ \": \"+scoreBoard[i].score, 0, 25 + (i*25));\r\n }\r\n}", "function showHighScores() {\n display.set(\"highScores\").show();\n }", "function displayScore() {\n //Display current score\n push();\n fill(255);\n textSize(500);\n textAlign(CENTER, CENTER);\n text(currentScore, width / 2, height / 2);\n pop();\n //Display high score\n push();\n fill(255);\n textSize(30);\n textAlign(CENTER, CENTER);\n text(`High score: ${bubbleData.highScore}`, width / 2, height / 2 + 200);\n pop();\n}", "function scoreboardMenu(){\r\n //if the sortedNames (or sortedScores) array is empty, load then top 3 from DB\r\n if(sortedNames.length == 0){\r\n getTop3();\r\n }\r\n else{ //else hide main menu table and populate HS menu and make visible\r\n hideMenuTable();\r\n fillHighScores();\r\n showScoreboardTable();\r\n }\r\n}", "function retrieve_your_top_ten(){\n\tvar username = localStorage.getItem('username');\n\tlet params = {\n\t\t\t\t method: \"GET\",\n\t\t\t\t url: \"/api/stats/topten/\"+username\n\t\t\t\t}\n\t$.ajax(params).done(function(data) {\n\t\tvar tenSelf = '<div style=\"border:1px solid black\"><h3> Your High Scores </h3><table><tr></tr>';\n\t\tfor(i=0;i<data[\"stats\"].length;i++){\n\t\t\ttenSelf += \"<tr><th>\"+data[\"stats\"][i].highscore+\"</th></tr>\";\n\t\t}\n\t\ttenSelf+= \"</table>\";\n\t\t// Add a collapse button to save screen estate\n\t\ttenSelf+= '<input id=\"collapse\" type=\"button\" value=\"Collapse\" onclick=\\'$(\"#your-stats\").hide()\\' />';\n\t\t$(\"#your-stats\").html(tenSelf);\n\t});\n}", "function displayScores() {\n score0El.innerText = score0;\n score1El.innerText = score1;\n }", "function displayScores() {\n fill(\"black\");\n textSize(25);\n text(`lives = ${lives}`, 575, 30);\n text(`score = ${score}`, 565, 60);\n text(\"press backspace to return to menu\", 230, 490);\n}", "function updateScore(scorelist) {\n let board = document.getElementById(\"scoreboard\")\n let top_scores = []\n //Adds anyone with a top_score attr that isn't null or empty and pushes to an array\n for(const user of scorelist.users) {\n if (user.top_score){\n top_scores.push([user.username, user.top_score])\n }\n }\n //Sorts the array by the highest score in descending order and updates the DOM\n top_scores.sort(function(a, b){return b[1]-a[1]})\n\n for(let i = 1; i < 11; i++) {\n let user_score = board.childNodes\n if (top_scores[i - 1]){\n user_score[i].innerText = `${top_scores[i - 1][0]}: ${top_scores[i -1][1]}`\n }\n }\n}", "function loadTopScorers(location) {\n let url = \"/account?action=topscorers\";\n if (location === \"neighborhood\") {\n url += \"&zipcode=\" + neighborhood[0] + \"&country=\" + neighborhood[1];\n }\n fetch(url)\n .then(response => response.json())\n .then(users => {\n // Inserts Nickname and Points for every top scorer\n for (let i = 0; i < users.length; i++) {\n let points = users[i].points;\n let nickname = users[i].nickname;\n let rowId = location + (i + 1);\n let row = document.getElementById(rowId);\n let rowNickname = row.getElementsByClassName(\"topscore-nickname\")[0];\n let rowScore = row.getElementsByClassName(\"topscore-score\")[0];\n rowNickname.innerText = nickname;\n rowScore.innerText = points;\n // Adds different styling if row includes current user\n if (users[i].isCurrentUser) {\n row.style.fontWeight = \"bold\";\n row.setAttribute(\"title\", \"Congratulations, you made it to the Top Scorers Board!\");\n }\n }\n });\n}", "function displayScore() {\n displayText(36, score, width / 2, height - 50);\n}", "function scoreboard() {\n\n var scoreboard = document.getElementById('scoreboard');\n scoreboard.innerHTML = `${score}pts.`\n if (score >= 150) {\n bugSpray();\n }\n }", "function buildScoreboard() {\n let board = document.getElementById(\"scoreboard\")\n \n let title = document.createElement('h3')\n title.innerText = `Top Scores`\n board.appendChild(title)\n \n for(let i = 0; i < 10; i++) {\n let user_score = document.createElement(\"li\")\n user_score.innerText = \"-\"\n \n board.appendChild(user_score)\n }\n}", "function show_recent_scores() {\n var username = sessionStorage.getItem('username');\n var player = get_player_data_from_db(username);\n\n var playerRoundCount = Object.keys(player).length;\n var targetRecentCount = 5;\n\n var recentSize;\n if (playerRoundCount < targetRecentCount){\n recentSize = playerRoundCount;\n }\n else {\n recentSize = targetRecentCount;\n }\n\n var table = document.getElementById(\"recent_scores\").getElementsByTagName('tbody')[0];\n\n for (var index=0; index<recentSize; index++)\n {\n round = player[Object.keys(player)[playerRoundCount-(index+1)]];\n\n add_round_as_row_to_table(table, round);\n }\n}", "function topScores(leaderboardId, offset, limit, done) {\n db.UserScore.aggregate(\n [\n {$match: {leaderboardId: leaderboardId}},\n {$sort: {score: -1, userId: 1}},\n {$skip: offset},\n {$limit: limit}\n ],\n done\n )\n}", "function showLeaderboard(board) {\n var data = groupdata['leaderboards'][board];\n var mileFunction = sortDataByFilter(data);\n console.info('Mile Function' + mileFunction);\n\n console.info(data);\n\n if (data.length != 0) {\n var highestMileage = mileFunction(data, 0);\n console.info(highestMileage);\n highestMileage = parseFloat(highestMileage).toFixed(1);\n\n count = 1;\n for (entry in data) {\n\n if (count > 15) {\n break;\n }\n\n // Get info for the entry\n console.info(entry);\n var first = String(data[entry]['first']);\n var last = String(data[entry]['last']);\n last = last.charAt(0) + '.';\n var miles = mileFunction(data, entry);\n console.info(miles);\n miles = parseFloat(miles).toFixed(1);\n var text = \"#\" + count + \": \" + first + \" \" + last + \" \" + miles + \" miles\";\n console.info(text);\n\n var barno = \"bar_\" + entry;\n\n // Populate the entry\n $('#leaderboardchart').append('<dd id=\"' + barno + '\" class=\"percentage\"><span class=\"text\">' +\n text + '</span></dd> ');\n\n // Then determine the width of the graph bar\n console.info(highestMileage);\n if (highestMileage == 0.0) {\n var width = 0;\n } else {\n var width = Math.round((miles / highestMileage) * 100);\n }\n width = width + \"%\";\n console.info(width);\n\n $('<style>#' + barno + ':after{width:' + width + '}</style>').appendTo('head');\n\n count++;\n }\n }\n }", "function sortTopScoresList() {\n topScores.sort((a, b) => b.score - a.score);\n topFiveScores = topScores.slice(0, 5);\n}", "function showScore(currentScore) {\n elems.currentscore.innerHTML = currentScore.toFixed(0);\n elems.allscore.innerHTML = score.toFixed(0);\n elems.scoreboard.style.right = \"0px\";\n}", "function showLeaderboard() {\n //retrieving current user name\n current_user_name = localStorage.getItem(\"currentUser\")\n //clearing local storage\n localStorage.clear();\n\n current_user_score = defaultScore;\n\n //save username and score of current player to firebase database and store it\n user_JSON[player_count] = {username: current_user_name, score: current_user_score}\n storeJSON();\n\n //create the leaderboard list\n let leaderboard = document.createElement(\"p\")\n let lb_txt = document.createTextNode(top_10)\n leaderboard.appendChild(lb_txt);\n document.getElementById(\"body\").innerHTML = \"\"\n document.getElementById(\"body\").style.fontSize = \"60px\"\n document.getElementById(\"body\").appendChild(leaderboard)\n\n let top_1_index = 0\n let top_2_index = 1\n let top_3_index = 2\n let top_4_index = 3\n let top_5_index = 4\n \n //check player scores and rank to 5 ranks\n for (let i = 1; i < player_count; i++) {\n if(user_JSON[i].score != 0) {\n if (user_JSON[i].score > user_JSON[top_1_index].score) {\n /*topscore[4] = topscore[3];\n topscore[3] = topscore[2];\n topscore[2] = topscore[1];\n topscore[1] = topscore[0];\n topscore[0] = i;*/\n top_5_index = top_4_index;\n top_4_index = top_3_index;\n top_3_index = top_2_index;\n top_2_index = top_1_index;\n top_1_index = i\n } else if (user_JSON[i].score > user_JSON[top_2_index].score) {\n top_5_index = top_4_index;\n top_4_index = top_3_index;\n top_3_index = top_2_index;\n top_2_index = i;\n } else if (user_JSON[i].score > user_JSON[top_3_index].score) {\n top_5_index = top_4_index;\n top_4_index = top_3_index;\n top_3_index = i;\n } else if (user_JSON[i].score > user_JSON[top_4_index].score) {\n top_5_index = top_4_index;\n top_4_index = i;\n } else if (user_JSON[i].score > user_JSON[top_5_index].score) {\n top_5_index = i;\n }\n }\n \n }\n \n let topscore = [top_1_index,top_2_index,top_3_index, top_4_index,top_5_index]\n\n if (topscore.length > player_count) {\n range = player_count\n } else {\n range = topscore.length\n }\n for (let i = 0; i < range; i++) {\n let player_info = document.createElement(\"p\")\n let player_info_txt = document.createTextNode(user_JSON[topscore[i]].username + \" \" + user_JSON[topscore[i]].score)\n player_info.appendChild(player_info_txt)\n player_info.style.color = \"BLUE\"\n document.getElementById(\"body\").appendChild(player_info)\n }\n}", "function scoreboard() {\n console.log(\n\n \"Scoreboard \\n\" +\n \"Wins : \" + wins + \"\\n\" +\n \"Losses : \" + losses + \"\\n\"\n );\n}", "function displayScore() {\r\n id(\"this-score\").innerText = scoreGot;\r\n id(\"score\").innerText = score;\r\n id(\"max-score\").innerText = maxScore;\r\n }", "function viewHighScores() {\n clearCurrentQuestion();\n clearAnswerMsg();\n stopTimer();\n clearInterval(interval);\n clearTimeout(timeOut);\n hideNameInput();\n resetQuestionIndex();\n showStart();\n hideFinalScore()\n resetAllTextContent();\n forEachKey(); \n\n questionText.textContent = \"High Scores\";\n}", "function viewHighScoresScreen(){\n if (saveDatabase.length === 0){\n loadUserScores();\n }\n clearScreen();\n highScoresStyle();\n}", "function displayTen() {\n firstPageDisplayed = false;\n hideAllPosts();\n showPosts(10);\n}", "function displayScore() {\n // Create the score\n $('.score').append(`<b>${followers}</b><p>Followers</p>`);\n // Create the post counter\n $('.numPosts').append(`<b>${posts.length}</b><p>Posts</p>`);\n // Create the follower counter\n $('.following').append(`<b>644</b><p>Following</p>`);\n}", "function updateScoreboard() {\n scoreboardGroup.clear(true, true);\n\n const scoreAsString = score.toString();\n if (scoreAsString.length === 1) {\n scoreboardGroup.create(assets.scene.width, 30, assets.scoreboard.base + score).setDepth(10);\n } else {\n let initialPosition = assets.scene.width - ((score.toString().length * assets.scoreboard.width) / 2);\n\n for (let i = 0; i < scoreAsString.length; i++) {\n scoreboardGroup.create(initialPosition, 30, assets.scoreboard.base + scoreAsString[i]).setDepth(10);\n initialPosition += assets.scoreboard.width;\n }\n }\n}", "function updateScores() {\n lastScore.innerText = 'Last score: ' + score;\n if (score > bestScore) {\n bestScore = score;\n displayBestScore.innerText = 'Best Score: ' + bestScore;\n }\n}", "top(num = 7) {\n const sortable = this.getSortArray();\n const sizeOfNumber = Math.min(num, sortable.length);\n \n console.log(\"=====================\");\n console.log(\"Number <= Frequence\");\n console.log(\"=====================\");\n for (var idx = 0; idx < sizeOfNumber; idx++) {\n console.log((sortable[idx][0] + \" \").substring(0, 2) + \" <= \" + sortable[idx][1]);\n }\n }", "showScoreTable(){\n console.log(\"\\n********* \"+this.mode+\" - tour \"+this.tour+\" *********\");\n console.table(this.players, [\"name\",\"max\"]);\n }", "function displayScore() {\n titleEl.textContent = (\"High scores:\")\n titleEl.style = (\"color: black\");\n footerEl.style = (\"display: none\");\n timerEl.textContent = (JSON.stringify(highScores[0][\"initials\"]))\n penalty.textContent = (JSON.stringify(highScores[0][\"score\"]))\n penalty.style = (\"color: black\");\n}", "function displayScore(){\n console.log(\"Your final score is: \",score)\n console.log(\"High Scorer's: \")\n for(var i=0;i<highScore.length;i++){\n console.log(highScore[i].name,\":\",highScore[i].score)\n }\n //if user score is equal or greater than high scorer congrats user\n if(score >= highScore[0].score || score >= highScore[1].score){\n console.log(chalk.bgGrey(\"Congrats! You made it to the high score chart.\\nSend screenshot of your score.\"))\n }\n}", "function showHighScoreContent() {\n if (highscoreData.highscores == undefined) {\n p5HTMLElements.push(createP('No Highscores to view here'));\n p5HTMLElements[p5HTMLElements.length - 1].position(view.options.x2 / 2 + 50, view.options.y + 100);\n return;\n }\n highscoreData.highscores.reverse();\n var tableContent = '<tr><th>Name</th><th>Score</th></tr>';\n for (var i = 0; i < highscoreData.highscores.length; i++) {\n tableContent += '<tr><td>' + highscoreData.highscores[i].name + '</td><td>' + highscoreData.highscores[i].score + '</td></tr>';\n }\n highscoreData.highscores.reverse();\n p5HTMLElements.push(createElement('table', tableContent));\n var highscoresTable = p5HTMLElements[p5HTMLElements.length - 1];\n highscoresTable.position(view.options.x + 10, view.options.y + 50);\n highscoresTable.size(view.options.x2 - 20, highscoresTable.size().height);\n}", "scoreboardDraw(scoreboardList) {\n let leaderboardRowsDiv = document.getElementById(\"leaderboard-rows\");\n const MAX_ROW_COUNT = 10;\n let rowNum = 0;\n\n // Update leaderboard\n for(var score of scoreboardList) {\n if(rowNum === MAX_ROW_COUNT) {\n break;\n }\n\n leaderboardRowsDiv.children[rowNum].children[0].innerHTML = (rowNum + 1) + \")\";\n leaderboardRowsDiv.children[rowNum].children[1].innerHTML = score.screenName;\n leaderboardRowsDiv.children[rowNum].children[2].innerHTML = score.kills;\n\n rowNum++;\n }\n\n // Clear old leaderboard rows\n for(; rowNum < MAX_ROW_COUNT; rowNum++) {\n leaderboardRowsDiv.children[rowNum].children[0].innerHTML = \"\";\n leaderboardRowsDiv.children[rowNum].children[1].innerHTML = \"\";\n leaderboardRowsDiv.children[rowNum].children[2].innerHTML = \"\";\n }\n }", "function showHighscores() {\n statsEl.style.display = \"none\";\n highscoresEl.style.display = \"flex\";\n for (let i = 0; i < highscores.length; i++) {\n let entry = document.createElement(\"span\");\n entry.textContent = (i + 1) + \". \" + highscores[i];\n highscoresBox.appendChild(entry);\n }\n}", "function getTopPlayers() {\n\t\t\tvm.title = (vm.count !== '' ? 'Top ' + vm.count : 'Top 10');\n\n\t\t\tTopFactory.getTopPlayers(vm.count)\n\t\t\t.then(function(response) {\n\t\t\t\tvm.players = response;\n\t\t\t});\n\t\t}", "function showScore(){\n console.log(chalk.underline.bold(\"Hey your score is: \", score))\n console.log(\"Check out the high scores, if you want to be there ping me.\");\n highScores.map(score => console.log(score.name, \" : \", score.score))\n console.log(\"Enjoy!\")\n}", "function showScore() {\n if (score > 9) {\n tens = \"\";\n }\n if (score > 99) {\n hundreds = \"\";\n }\n $(\".score\").html(hundreds + tens + score);\n}", "function displayHighScores() {\n\n gameover.visible = false;\n yourScore.visible = false;\n scoresTitle = game.add.text(game.width/2, game.height/2 - 150, 'HIGHSCORES', { font: \"70px Chalkduster\", fill: \"#ffffff\" });\n scoresTitle.anchor.setTo(0.5);\n\n hiScore1 = game.add.text(game.width/2, game.height/2 - 50, '1: ' + testScores[0], highScoreText);\n hiScore1.anchor.setTo(0.5);\n hiScore2 = game.add.text(game.width/2, game.height/2, '2: ' + testScores[1], highScoreText);\n hiScore2.anchor.setTo(0.5);\n hiScore3 = game.add.text(game.width/2, game.height/2 + 50, '3: ' + testScores[2], highScoreText);\n hiScore3.anchor.setTo(0.5);\n hiScore4 = game.add.text(game.width/2, game.height/2 + 100, '4: ' + testScores[3], highScoreText);\n hiScore4.anchor.setTo(0.5);\n hiScore5 = game.add.text(game.width/2, game.height/2 + 150, '5: ' + testScores[4], highScoreText);\n hiScore5.anchor.setTo(0.5);\n\n game.time.events.stop();\n\n\n}", "function topTenTitles() {\nconst newData = [...data];\nnewData.sort((a, b) => b.imdb_score - a.imdb_score);\n return newData.splice(0,9);\n}", "function displayItems() {\r\n \r\n scoreTable\r\n .read() // Read the results\r\n .then(addHighestScoreHandler, handleError);\r\n }", "function displayHighScores() {\n quizLayout.innerHTML = \"\";\n highScoresBtn.style.display = \"none\";\n quizTitle.textContent = \"High Scores\";\n\n // scoreSort() returns a sorted 2D array of names and scores.\n let sortedScores = scoreSort();\n\n let alternateBackground = true // indicates alternate background colors for alternating rows\n // A loop that first appends a score row to the quiz. Then it adds two columns, one for names and one for scores.\n\n for (let i = 0, j = sortedScores.length; i < j; i++) {\n let scoreRow = document.createElement(\"div\");\n if (alternateBackground) {\n scoreRow.setAttribute(\"class\", \"row high-score-row odd-row\");\n alternateBackground = false;\n }\n else {\n scoreRow.setAttribute(\"class\", \"row high-score-row even-row\");\n alternateBackground = true;\n }\n quizLayout.appendChild(scoreRow);\n\n let nameCol = document.createElement(\"div\");\n nameCol.setAttribute(\"class\", \"col-md-11\");\n nameCol.textContent = sortedScores[i][1];\n scoreRow.appendChild(nameCol);\n let scoreCol = document.createElement(\"div\");\n scoreCol.setAttribute(\"class\", \"col-md-1\");\n scoreCol.textContent = sortedScores[i][0];\n scoreRow.appendChild(scoreCol);\n }\n}", "function onNewTopRow() {\n increaseScore(20);\n }", "function updateScoreboard(scores){\r\n\tlet allPlayers = scores;\r\n\t\r\n\t//Sort scores so person with most points is displayed at top\r\n\tallPlayers.sort(function(a,b){return b.score-a.score});\r\n\tlet update= document.getElementById(\"scoreBoard\");\r\n\tupdate.innerHTML = \"Name Score <br>\";\r\n\t\r\n\t//Add the scores to the page\r\n\tfor(let i = 0;i<allPlayers.length;i++){\r\n\t\t\tlet addScore = document.createElement(\"div\");\r\n\t\t\taddScore.innerHTML = allPlayers[i].name + \" \" + allPlayers[i].score;\r\n\t\t\tupdate.appendChild(addScore);\r\n\t}\r\n\t\r\n}", "function displayScore() {\n\ttheBoard.context.fillStyle = \"green\";\n\ttheBoard.context.font = \"bold 24px Times\";\n\ttheBoard.context.fillText(\"Score: \" + theBoard.score, 7, 22);\n\ttheBoard.context.fillText(\"Level: \" + theBoard.level, 700, 22);\n}", "function populateRankingList() {\n // Clear the old data in the container\n divs.rank_list.innerHTML = '';\n // Sort the records by value\n info.ranking_list = info.ranking_list.sort(function(a, b){ return b.value - a.value; });\n // Create a paragraph for the top 15 gamers\n if(info.ranking_list.length > 0){\n if(info.ranking_list.length <= 15){\n var tmp = 1;\n for(const rec of info.ranking_list) {\n var node = document.createElement(\"P\");\n var textnode = document.createTextNode(tmp + \". \" + rec.key + \" - Score: \" + rec.value);\n node.appendChild(textnode);\n divs.rank_list.appendChild(node);\n tmp++;\n }\n }\n else {\n for(var i = 0; i < 15; i++) {\n var node = document.createElement(\"P\");\n var textnode = document.createTextNode(i+1 + \". \" + info.ranking_list[i].key + \": \" + info.ranking_list[i].value );\n node.appendChild(textnode);\n divs.rank_list.appendChild(node);\n }\n }\n }\n}", "function displayNFLscoreboardData(scoreboardData) {\n\t\t\tconst results = scoreboardData.scoreboard.gameScore.map((key, value) => renderNFLscoreboardResult(key));\n\t\t\t$('#js-nfl-scorecard').html(results);\n\t\t}", "displayBoard() {\n this.translateBoard();\n // if (this.states == STATES.DISPLAYED)\n this.updateScore();\n //}\n }", "function showMoreHighScores() {\n\n // Remove the See More Option\n UI.displaySeeMore(false);\n\n // Show all the high scores \n UI.displayHighScores(highScoreConfig.total);\n\n // Add the See Less Option\n UI.displaySeeLess(true);\n}", "function DisplayScoreComponent(params){\n let root = params.root;\n let displayVal = \"Cards to go: \" + (8 - root.state.guessedCards.length);\n if(root.state.guessedCards.length === 8){\n displayVal = \"You Win!\";\n }\n return(\n <p><strong>{displayVal}</strong></p>\n );\n}", "function initialiseScoreBoards(){ \n redScoreBoard.innerText=redWinsCount; \n yellowScoreBoard.innerText=yellowWinsCount;\n}", "function renderScores(parent) {\n // Generate essential table structure\n let frame = $('<table class=\"table\"></table').appendTo(parent);\n let header = $('<thead></thead').appendTo(frame);\n let headRow = $('<tr></tr>').appendTo(header);\n let numCol = $('<th scope=\"col\">#</th>').appendTo(headRow);\n let nameCol = $('<th scope=\"col\">Name</th>').appendTo(headRow);\n let scoreCol = $('<th scope=\"col\">Score</th>').appendTo(headRow);\n let tableBody = $('<tbody></tbody').appendTo(frame)\n\n // parses objects of scoreBoard array\n scoreBoard.sort((a, b) => (a.score < b.score) ? 1 : -1);\n let initsArr = scoreBoard.map(user => user.initials);\n let scoresArr = scoreBoard.map(user => user.score);\n console.log(scoreBoard)\n scoreBoard.forEach((player) => {\n const placeRow = $('<tr></tr>').appendTo(tableBody)\n let placeRank = $('<th scope=\"row\"></th>').text(initsArr.indexOf(player.initials) + 1);\n let placeInit = $('<td></td>').text(player.initials);\n let placeScore = $('<td></td>').text(player.score);\n placeRank.appendTo(placeRow);\n placeInit.appendTo(placeRow);\n placeScore.appendTo(placeRow);\n ;\n })\n \n const highScores = scoreBoard.filter(user => user.score >= 50);\n}", "function renderScoresToPage() {\n scoreListEl.innerHTML = \"\";\n var scores = document.getElementById(\"score-list\");\n\n for (var i = 0; i < topFiveScores.length; i++ ) {\n var item = document.createElement(\"li\");\n item.innerHTML = topFiveScores[i].score + \" points by \" + topFiveScores[i].initials;\n scores.appendChild(item);\n }\n}", "function highScoreSort(){\n\n socket.emit(\"requestLeaderboard\");\n socket.on(\"sendLeaderboard\", ({leaderboard}) => {\n \n if(leaderboard.length > 100) leaderboard = leaderboard.slice(0,100);\n makeTable(leaderboard);\n });\n\n makeTable(name);\n}", "displayScore(score, tileSize) {\n ctx.fillStyle = \"white\";\n ctx.fillRect(0, 0, this.rightBoundary, this.upperBoundary);\n\n ctx.fillStyle = this.scoreColor;\n ctx.font = this.scoreFont;\n ctx.fillText(\"score : \" + score, this.leftBoundary, this.leftBoundary);\n }", "function displayScores(playerScore, computerScore) {\n displayPlayerScore(playerScore)\n displayComputerScore(computerScore)\n}", "function printNStop5(num) {\n // your code here...\n}", "function displayTenMore() {\n if (!firstPageDisplayed) {\n firstPageDisplayed = parseInt(((postsStartPosition+10)/10), 10);\n }\n postsStartPosition = postsStartPosition+10;\n showPosts(10);\n }", "function printScore() {\n scoreboardRiktig.innerHTML = `Du har klikket riktig: ${scoreRiktig} ganger`;\n scoreboardFeil.innerHTML = `Du har klikket feil: ${scoreFeil} ganger`;\n scoreboardPoints.innerHTML = `Poeng: ${scorePoints}`;\n}", "function printScores() {\n if (localStorage.getItem(\"bestScore\")) {\n bestScore.textContent = localStorage.getItem(\"bestScore\");\n } else {\n bestScore.textContent = 0;\n }\n currentScore.textContent = 0;\n}", "function scoreDisplay() {\n\t$('.scores').replaceWith(\n\t\t`<ul class=\"scores\">\n <li>Cards in Deck: ${numberOfCards}</li>\n <li>Correct guesses: ${correctGuesses}</li>\n <li>Incorrect guesses: ${incorrectGuesses}</li>\n </ul>`\n\t);\n\tif ($('.hints').hasClass('hidden')) {\n\t\t$('.hints').replaceWith(\n\t\t\t`<ul class=\"hints hidden\">\n <li>Higher Card Probability: ${highProb}%</li>\n <li>Lower Card Probability: ${lowProb}%</li>\n <li>Same Card Probability: ${sameProb}%</li>\n </ul>`\n\t\t);\n\t} else {\n\t\t$('.hints').replaceWith(\n\t\t\t`<ul class=\"hints\">\n <li>Higher Card Probability: ${highProb}%</li>\n <li>Lower Card Probability: ${lowProb}%</li>\n <li>Same Card Probability: ${sameProb}%</li>\n </ul>`\n\t\t);\n\t}\n\n\tif (numberOfCards === 0) {\n\t\t$('#cardForm').addClass('hidden');\n\t\tcardBack = './Images/EmptyBack.png';\n\t\tdisplayResults();\n\t}\n}", "function displayscores() {\n\tlet timeto = endTime;\n\tif(!timeto)\n\t\ttimeto = Date.now();\n\tlet formattime = formatTime(timeto-startTime);\n\tlet t = statstext.replace(\"$score\",(score/100 | 0)).replace(\"$level\",\"\" + diffToLevel()).replace(\"$health\",health).replace(\"$kills\",kills).replace(\"$time\",formattime).replace(\"$difficulty\",difficultyGame);\n\tif(difficultyGame == \"easy\") {\n\t\tt = t.replace(\"Health\",\"Amount of Damage received\");\n\t}\n\ttext(t,0,0);\n}", "function retrieveScores(){\n fetch(API_SCOREBOARD)\n .then((resp) => resp.json())\n .then(function (data) {\n console.log(data);\n var scoreboard = document.getElementById('scoreboard');\n var scoreboardHTML = [];\n var count = 0;\n\n data.forEach((e)=>{\n count++;\n scoreboardHTML.push(`<tr><td>${count}</td><td>${e.nickname}</td><td>${e.score}</td></tr>`);\n });\n\n scoreboard.innerHTML = scoreboardHTML.join(\"\");\n \n })\n .catch(function (error) {\n console.log(error);\n });\n}", "function showHighScores() {\n var txt = '';\n if(JSON.parse(localStorage.getItem('scores') != null)){\n txt += '<h2>Recent Highest Scores</h2>';\n let arr = JSON.parse(localStorage.getItem('scores'));\n for (let i = 0; i < arr.length; i++) {\n const a = arr.pop();\n if(i == 5)\n break;\n txt += `<h4>Level: ${a.level} - Points: ${a.points} - Gems: ${a.gems} - Bugs: ${a.bugs} </h4>`;\n }\n }\n\n var sec = document.querySelector('.high-scores');\n var close = document.createElement('button');\n close.textContent = 'Close';\n close.classList.add(\"btn\");\n close.addEventListener('click', function () {\n sec.style.display = 'none';\n });\n sec.style.display = 'block';\n sec.innerHTML = txt;\n sec.appendChild(close);\n}", "function showScores(name) {\n\n // set a maxScore as the greatest score value\n var maxScore = 0;\n for (let i in highScores) {\n let person = highScores[i];\n if (userScore>person.score) {\n maxScore = userScore;\n } else {\n maxScore = person.score;\n }\n \n // at last iteration\n if (i == (highScores.length - 1)) {\n \n if (maxScore === userScore && maxScore !== person.score) {\n\n // user breakes highscore\n log(chalk.whiteBright.bold(\"\\n YAY! \") + `${chalkName(name)} ` + \n chalk.bold.white(\" YOU HAVE MADE A \") + \n chalkJS(\" HIGH SCORE \") + \n chalk.bold.white(' OF ') + \n chalkJS(` ${userScore} \\n`)\n );\n log(chalk.yellow.bold(`-----------------------------------------------------------------------------`));\n log(chalk.black.bold.bgYellow(` Please send screenshot so that we can update the high score data structure. `));\n log(chalk.yellow.bold(`-----------------------------------------------------------------------------`));\n\n\n } else {\n\n // user fails to make highscore\n log(chalk.whiteBright.bold(\" YAY!\"),\n `${chalkName(name)}`,\n chalk.whiteBright.bold(\"You have Scored:\"),\n `${chalk.green.bold(userScore)}`, '\\n'\n );\n // final display score board\n log(chalkJS(\" Check out the FINAL SCORE BOARD: \"));\n for (let i in highScores) {\n log(highScores[i].name, \" : \", highScores[i].score);\n }\n }\n }\n }\n}", "function showScores() {\n console.log(chalk.whiteBright.bold(\" YAY!\"),`${chalk.magentaBright.bold(userName)}`, chalk.whiteBright.bold(\"You have Scored:\"), `${chalk.green.bold(score)}`, '\\n');\n\n console.log(chalk.yellowBright.bold.inverse(\" Check out these HIGH SCORES: \"));\n\n for (let i in highScores) {\n console.log(highScores[i].name, \" : \", highScores[i].score)\n }\n}", "function viewHighScore() {\n showHide(highScoreScreen, gameOverScreen);\n showHide(highScoreScreen, getQuiz);\n showHide(highScoreScreen, introEl);\n}", "function displayScores() {\n scoreBox.innerHTML = \"Score: \" + score;\n highScoreBox.innerHTML = \"High Score: \" + highScore;\n}", "function displayScore() {\n let currentScore = document.getElementById(\"scoreboardScore\");\n currentScore.textContent = `${HURWin} - ${AIRWin}`;\n}", "function initScores() {\n\tvar $scoreText = makeScore();\n\t$scoreText.text(\"SCORE\");\n\tsnake.score = 0;\n\t\n\t$score = makeScore();\n\t$score.css(\"width\", units(9));\n\t\n\tvar $hiscoreText = makeScore();\n\t$hiscoreText.text(\"HISCORE\");\n\t$hiscoreText.css(\"float\", \"right\");\n\t\n\t\n\t$hiscore = makeScore();\n\t$hiscore.css({\n\t\twidth: units(9),\n\t\tfloat: \"right\",\n\t});\n\t$textBar.append($scoreText, $score, $hiscore, $hiscoreText);\n}", "function screenScore(score) {\n var element = document.getElementById(\"scor\");\n element.innerHTML = \"Score: \"+score;\n}", "function DrawScore(score) {\n image(numbers[floor(score % 10)], width / 2 - 12, 25);\n if (score > 9) image(numbers[floor((score / 10) % 10)], width / 2 - 37, 25);\n if (score > 99) image(numbers[floor((score / 100) % 10)], width / 2 - 62, 25);\n if (score > 999) image(numbers[floor((score / 1000) % 10)], width / 2 - 87, 25);\n if (score > 9999) image(numbers[floor((score / 10000) % 10)], width / 2 - 112, 25);\n}", "function displayBoards() {\n displayGameBoard();\n displayPlayerBoard();\n displayExpeditions();\n}", "function displayHighscores() {\n if (localStorage.getItem(\"scores\") === null) {\n scoresArr = [];\n } else {\n scoresArr = JSON.parse(localStorage.getItem(\"scores\"));\n }\n scoresArr\n .sort((a, b) => b.score - a.score)\n .forEach((scores) => {\n let tableRow = document.createElement(\"tr\");\n let tableRank = document.createElement(\"td\");\n let tableInitials = document.createElement(\"td\");\n let tableScore = document.createElement(\"td\");\n\n highscores.append(tableRow);\n // Adding a one to index first so top rank does not show as 0\n tableRank.textContent = 1 + scoresArr.indexOf(scores);\n tableInitials.textContent = scores.initials;\n tableScore.textContent = scores.score;\n tableRow.append(tableRank, tableInitials, tableScore);\n });\n}", "function showScore() {\n subheading.style.opacity = 0;\n const timeoutID = setTimeout(() => {\n scoreboard.style.animation = 'showScore 1s ease-out forwards';\n scoreboard.querySelector('text').style.animation = 'highlightScore 0.5s 1.2s 5 step-end';\n clearTimeout(timeoutID);\n }, 1000);\n}", "function previewScore() {\n userInfo = getData(\"userInfo\");\n sortedByScore(userInfo);\n if (numRefresh == 0) {\n swal(\"Tips\", \"Click F5 to reload the Score Board\");\n }\n status1.innerHTML = \"\";\n choice.innerHTML = \"\";\n scoreBody.innerHTML = \"\";\n header.innerHTML = \"\";\n\n var congra = document.createElement(\"H1\");\n congra.innerHTML = \"Congratulations!\";\n congra.classList.add(\"congra\");\n header.appendChild(congra);\n\n var message = document.createElement(\"H2\");\n message.innerHTML = \"Scoreboard\";\n message.classList.add(\"alignCenter\");\n scoreBody.appendChild(message);\n\n let scoreTable = document.createElement(\"table\");\n scoreTable.classList.add(\"table\");\n scoreTable.classList.add(\"table-striped\");\n scoreTable.classList.add(\"table-hover\");\n\n let scoreHead = document.createElement(\"thead\");\n let tBody = document.createElement(\"tbody\");\n let firstRow = document.createElement(\"tr\");\n firstRow.classList.add(\"firstRow\");\n\n let numCol = document.createElement(\"th\");\n numCol.innerHTML = \"#\";\n let firstCol = document.createElement(\"th\");\n firstCol.innerHTML = \"Name\";\n let secondCol = document.createElement(\"th\");\n secondCol.innerHTML = \"Category\";\n let thirdCol = document.createElement(\"th\");\n thirdCol.innerHTML = \"Score\";\n firstRow.appendChild(numCol);\n firstRow.appendChild(firstCol);\n firstRow.appendChild(secondCol);\n firstRow.appendChild(thirdCol);\n scoreHead.appendChild(firstRow);\n scoreTable.appendChild(scoreHead);\n scoreBody.appendChild(scoreTable);\n\n for (let index = 0; index < userInfo.length - 1; index++) {\n const element = userInfo[index];\n let currRow = document.createElement(\"tr\");\n let currNum = document.createElement(\"th\");\n currNum.innerHTML = String(index + 1);\n let currName = document.createElement(\"td\");\n currName.innerHTML = element.name;\n let currCat = document.createElement(\"td\");\n currCat.innerHTML = element.categoryNum;\n let currProgress = document.createElement(\"td\");\n let progressDiv = document.createElement(\"div\");\n progressDiv.classList.add(\"progress\");\n progressDiv.style.width = \"100%\";\n let currProgressbar = document.createElement(\"Div\");\n currProgressbar.classList.add(\"progress-bar\");\n currProgressbar.classList.add(\"bg-success\");\n currProgress.setAttribute(\n \"title\",\n \"Answered \" + element.answered + \" out of \" + element.questionNum\n );\n currProgressbar.style.width =\n (element.answered / element.questionNum) * 100 + \"%\";\n progressDiv.appendChild(currProgressbar);\n currProgress.appendChild(progressDiv);\n\n currRow.appendChild(currNum);\n currRow.appendChild(currName);\n currRow.appendChild(currCat);\n currRow.appendChild(currProgress);\n tBody.appendChild(currRow);\n }\n scoreTable.appendChild(tBody);\n\n var tryAgain = document.createElement(\"button\");\n tryAgain.innerHTML = \"Try Again\";\n tryAgain.classList.add(\"btn\");\n tryAgain.classList.add(\"btn-primary\");\n tryAgain.addEventListener(\"click\", function () {\n let countPlayer = parseInt(getData(\"countPlayer\"));\n countPlayer -= 1;\n if (countPlayer == 0) {\n localStorage.clear();\n }\n localStorage.setItem(\"countPlayer\", JSON.stringify(countPlayer));\n window.location.href = \"./index.html\";\n });\n scoreBody.appendChild(tryAgain);\n\n document.addEventListener(\"keydown\", function (event) {\n switch (event.keyCode) {\n case 116: // 'F5'\n numRefresh += 1;\n previewScore();\n event.returnValue = false;\n event.keyCode = 0;\n window.status = \"We have disabled F5\";\n break;\n }\n });\n }", "function viewHighScore() {\n scorePageEl.classList.add(\"hide\");\n highScoreEl.classList.remove(\"hide\");\n renderLastScore();\n}", "function sortscores() {\r\n\tdocument.getElementById(\"img_mtch\").src = \"data/done.gif\";\r\n\tdocument.getElementById(\"img_oput\").src = \"data/progress.gif\";\r\n\tscoreranking = new Array(); x = 0; for(w=0;w<socREC.length;w++) {\r\n\t\tif (isNumeric(socREC[w][0]) && socREC[w][0] > 40) {\r\n//scoreranking[x++] = Math.round(socREC[w][0]*1000) / 1000;\r\n// adjusted score = socREC[w][0]\r\n// raw score = Math.round(socREC[w][0] * (socREC[w].length - 3))\r\n\r\n\trawscore = 0;\r\n\trawscore = Math.round(socREC[w][0] * (socREC[w].length - 3));\r\n\ttemprawscore = rawscore.toString();\r\n\tdo { temprawscore = \"0\" + temprawscore; } while (temprawscore.length<9);\r\n\ttempadjscore = 0;\r\n\ttempadjscore = Math.round(socREC[w][0]*1000);\r\n\ttempfinalscore = tempadjscore + temprawscore;\r\n\tscoreranking[x++] = (tempfinalscore*1);\r\n};\r\n\t};\r\n\tupdatePbar(\"progressbar_oput\",5);\r\n\trankedscores = new Array(); rankedscores = scoreranking.sort(function(a,b){return (b-a)});\r\n\tupdatePbar(\"progressbar_oput\",20);\r\n\tw=1; do {\r\n\t\tif (rankedscores[w] == rankedscores[w-1]) { rankedscores.splice(w,1); } else { w++; };\r\n\t} while (w<rankedscores.length);\r\n\tupdatePbar(\"progressbar_oput\",35);\r\n\tz = setTimeout(\"displayrecords(0,\"+defaultnorecords+\")\",1);\r\n}", "function display(){\n\n\t\t\t$(\"#number\").html(randNum);\n\t\t\t$(\"#winsLosses\").html(\"<p>Wins: \" + wins + \"</p><br>\"\n\t\t\t\t+ \"<p>Losses: \" + losses + \"</p>\");\n\t\t\t$(\"#totalScore\").html(totalScore);\n\n\t\t}", "function displayHighScoresOutput() {\n // var highScoresPage = document.querySelector(\".displayParaHighScore\");\n highScoreCounter++;\n scores.sort(function (b, a) {\n return a.score - b.score\n })\n console.log(scores);\n for (var i = 0; i < scores.length; i++) {\n // answerElement0.textContent = answerarrayq[numberOfQuestion].answers[0].text;\n var locname = scores[i].name;\n console.log(locname);\n var locscore = scores[i].score;\n // console.log(locscore);\n // console.log(locname + \" Score: \" + locscore);\n if (highScoreCounter <= 1) {\n var p2 = (\"<p>\" + locscore + \" : \" + locname + \"</p>\");\n document.querySelector(\".displayParaHighScore\").insertAdjacentHTML('beforebegin', p2);\n }\n else {\n var p3 = (\"<p>\" + locscore + \" : \" + locname + \"</p>\");\n document.querySelector(\".displayParaHighScore2\").insertAdjacentHTML('beforebegin', p3);\n }\n\n }\n gobackbt.hidden = false;\n // highScoresPage.textContent = user;å\n // console.log(user + \" this is the user entered and pulled\");\n}", "function renderScore() {\n const highScores= document.getElementById(\"highScore\")\n let allScores = [];\n if (localStorage.getItem(\"scores\")) {\n allScores = JSON.parse(localStorage.getItem('scores'));\n console.log(allScores)\n }\n if (allScores.length >0 ){\n allScores.sort(sortScores);\n console.log(allScores) \n //For loop to show top ten highscores\n for (var i = 0; i < 10; i++) {\n \n const li = document.createElement(\"li\")\n li.textContent=`${allScores[i].name} - ${allScores[i].score}`\n console.log(li)\n highScores.appendChild(li); \n \n \n }\n\n }\n}", "function score() {\n\tcount++;\n\tif (count < 10) {\n\t\t$('.count').html('0' + count);\n\t} else {\n\t\t$('.count').html(count);\n\t}\n}", "function showScore(){\n\tctx.fillStyle=\"black\";\n\tctx.fillRect(CANVAS_WIDTH-250, 10, 190, 40);\n\tctx.fillStyle = \"white\";\n\tctx.font = \"24px monospace\";\n\tctx.textAlign = \"left\";\n\tctx.fillText(\"score: \" + parseInt(score), CANVAS_WIDTH-250, 37);\n}", "function displayscore(){\n \t$('#playerscore').html('Correct Answer: ' + correctanswer + \n \t\t '<br>Wrong Answer: ' + wronganswer +\n '<br>Unanswer: ' + unanswered);\n }", "function showLessHighScores() {\n\n // Remove the see less option\n UI.displaySeeLess(false);\n\n // Show only the initial high scores \n UI.displayHighScores(highScoreConfig.initial);\n\n // Add the see more option\n UI.displaySeeMore(true);\n\n}", "function calcScores() {\n\t// Use a negative value for first score for safety's sake\n\tvar lowscore = -1;\n\tvar lowid = '';\n\tvar scores, sumscore;\n\tfor (var i = 0; i < boardsize; ++i) {\n\t\t// Observe the cards in the rows\n\t\tscores = getScoringArray();\n\t\t$('li.square[id^=square_'+i+']').each(function(){\n\t\t\tif (this.innerHTML != '') {\n\t\t\t\tscores[parseInt(this.innerHTML)]++;\n\t\t\t}\n\t\t});\n\t\t// Calculate the score\n\t\tsumscore = calcScore(scores);\n\t\t$('li#score_row_'+i).text(sumscore);\n\t\t// Check it for lowest value\n\t\tif (sumscore < lowscore || lowscore < 0) {\n\t\t\t// Store the score\n\t\t\tlowscore = sumscore;\n\t\t\t// Remember where we are\n\t\t\tlowid = 'row_'+i;\n\t\t} // if (sumscore < lowscore || lowscore < 0)\n\n\t\t// Observe the cards in the columns\n\t\tscores = getScoringArray();\n\t\t$('li.square[id$=_'+i+']').each(function(){\n\t\t\tif (this.innerHTML != '') {\n\t\t\t\tscores[parseInt(this.innerHTML)]++;\n\t\t\t}\n\t\t});\n\t\t// Calculate the score\n\t\tsumscore = calcScore(scores);\n\t\t$('li#score_col_'+i).text(sumscore);\n\t\t// Check it for lowest value\n\t\tif (sumscore < lowscore || lowscore < 0) {\n\t\t\t// Store the score\n\t\t\tlowscore = sumscore;\n\t\t\t// Remember where we are\n\t\t\tlowid = 'col_'+i;\n\t\t} // if (sumscore < lowscore || lowscore < 0)\n\n\t\t// Set the score, identify the low notch\n\t\t$('li#score_current').text(lowscore);\n\t\t$('li.score').removeClass('lowest');\n\t\t$('li#score_'+lowid).addClass('lowest');\n\t} // for (var i = 0; i < boardsize; ++i)\n} // function calcScores()", "function showScores() {\n console.log(\"Wooohooo! You SCORED: \", currScore);\n\n console.log(\"Check out the high scores. (Updated Automatically.)\");\n\n highScores.map(score => console.log(score.name, \" : \", score.hScore))\n}", "function displayHighScore() {\n scoreList.style.display = \"block\";\n endGame.style.display = \"none\";\n landingPageEl.style.display = \"none\";\n}", "function showScores(cScore, hScore) {\n document.getElementById('highScores').style.display = 'flex';\n document.getElementById('cScore').innerText = cScore;\n document.getElementById('hScore').innerText = hScore;\n}", "function printHighscores() {\n //redirect to display screen\n titleScreen.setAttribute(\"class\", \"hide\");\n scoreDisplay.setAttribute(\"class\", \"show\");\n highscoreScreen.setAttribute(\"class\", \"hide\");\n hideHighScoresLink.setAttribute(\"class\", \"hide\");\n hideTime.setAttribute(\"class\", \"hide\");\n\n // either get scores from localstorage or set to empty array\n var highscores = JSON.parse(window.localStorage.getItem(\"highscores\")) || [];\n\n // sort highscores by score property in descending order\n highscores.sort(function(a, b) {\n return b.score - a.score;\n });\n\n highscores.forEach(function(score) {\n // create li tag for each high score\n var liTag = document.createElement(\"li\");\n liTag.textContent = score.initials + \" - \" + score.score;\n\n // display on page\n var olEl = document.getElementById(\"display-scores\");\n olEl.appendChild(liTag);\n });\n}", "function displayScore(score, highscore) {\n scoreDisplay.textContent = `Score: ${score} `\n highscoreDisplay.textContent = `Highscore: ${highscore}`\n}", "function displayScore(averageScore, highScore, lowScore) {\n\n textSize(25);\n textAlign(CENTER, CENTER);\n strokeWeight(1);\n\n text(\"Average Score: \", canvasWidth / 1.8, canvasHeight / 8);\n text(averageScore, canvasWidth / 1.3, canvasHeight / 8);\n\n text(\"High Score: \", canvasWidth / 1.8, canvasHeight / 5);\n text(highScore, canvasWidth / 1.3, canvasHeight / 5);\n\n text(\"Low Score: \", canvasWidth / 1.8, canvasHeight / 3.6);\n text(lowScore, canvasWidth / 1.3, canvasHeight / 3.6);\n\n}", "function refreshScore() {\n\tdocument.getElementById(\"score\").innerHTML = PLAYERSCORE + \" - \" + COMPUTERSCORE ;\n}", "updateTop5Text() {\n const numSlots = 5;\n const players = this._entities.filterByType(EntityTypes.PLAYER);\n\n players.sort((a, b) => (b.getProp('points') || 0) - (a.getProp('points') || 0));\n\n for (let i = 0; i < numSlots; i++) {\n const key = `top5_${i + 1}`;\n const index = i - (numSlots - players.length);\n if (index >= 0 && players[index]) {\n this.updateText(\n key,\n { place: index + 1, player: players[index].getProp('name'), points: players[index].getProp('points') || 0 },\n { fill: players[index].getProp('hexColor') }\n );\n } else {\n this.hideText(key);\n }\n }\n }", "function init_scoreboard() {\n\tvar tbody = document.getElementsByTagName('tbody')[0];\n\tvar str = '';\n\t\n\t// create rows \n\tfor (var i = 0; i < rows.length; i++) {\n\t\tvar row = rows[i];\n\t\tvar team = row[1];\n\t\tvar name = team[1];\n\t\tif(team.length >= 3){\n\t\t\tname = team[2] + ' ( ' + name + ' )';\n\t\t}\n\t\tstr += '<tr><td>' + row[0] + '</td>' +\n '<td class=\"team\" data=\"' + row[4] + '\">' +\n generateSchoolLogo(team[3]) +\n '<div class=\"team-name-school\">' + name +\n generateRemark(team[4]) +\n '<span class=\"muted\">' + team[0] + '</span></div></td>' +\n '<td>' + row[2] + '</td><td>' + row[3] + '</td>';\n\t // problems cols\n\t\tfor (var j = 5; j < row.length - 1; j++){\n\t\t\tvar prob = row[j];\n\t\t\tif (prob != 0) {\n\t\t\t\tvar score = prob[0].split('/');\n\t\t\t\tvar cls = prob[1] ? ' class=\"' + prob[1] + '\"' : '';\n\t\t\t\tvar dat = score[2] ? ' data=\"' + score[2] + '\"' : '';\n\t\t\t\tstr += '<td' + cls + dat + '>' + \n\t\t\t\t\tscore[0] + '<span class=\"muted\"> ' + score[1] + '</span></td>';\n\t\t\t}\n\t\t\telse\n\t\t\t\t// space before -- is necessary\n\t\t\t\tstr += '<td>0<span class=\"muted\"> --</span></td>'; \n\t\t}\n\n\t\t// att/solv col\n\t\tvar att = row[j][0].split('/');\n\t\tstr += '<td>' + att[0] + '<br>' + att[1] + '</td>';\n\t}\n\ttbody.innerHTML = str + tbody.innerHTML;\n}", "function getScore(score){\n // set li to nothing and gets the ordered list.\n let li = \"\";\n let ol = document.getElementById('bestTimes');\n /* \n if you have less than 5 scores then it will put you score into the array and sort it so shortest time is on top.\n for each score put it into an li tag and put it into the ordered list.\n else if you have more than 5 scores then put you score into the array, sort it so shortest time is on top and take off last score.\n */\n if (scores.length < 5){\n scores.push(score);\n scores.sort();\n for (var i =0; i < scores.length; i++) {\n li += `<li> ${scores[i]} </li>`;\n }\n ol.innerHTML = li;\n }\n else if (scores.length = 5){\n scores.push(score);\n scores.sort();\n scores.pop();\n\n for (var i =0; i < scores.length; i++) {\n li += `<li> ${scores[i]} </li>`;\n }\n ol.innerHTML = li;\n }\n}", "function PresentScoring() {\n basic.clearScreen()\n // plot minumum target (depending on current level)\n for (let r = 0; r <= level * 5 - 1; r++) {\n led.plotBrightness(r % 5, 4 - r / 5, 10)\n }\n basic.pause(250)\n for (let t = 0; t <= Math.min(24, 29 - score); t++) {\n led.plot(t % 5, 4 - t / 5)\n if (!(quiet)) {\n music.playTone(175 + t * 5, music.beat(BeatFraction.Sixteenth))\n } else {\n basic.pause(music.beat(BeatFraction.Sixteenth))\n }\n basic.pause(200 - 8 * t)\n }\n basic.pause(250)\n // Check if got top Scores\n if (score < 6) {\n for (let i0 = 0; i0 < 3; i0++) {\n basic.clearScreen()\n led.plot(1, 1)\n led.plot(3, 1)\n led.plot(1, 4)\n led.plot(2, 4)\n led.plot(3, 4)\n led.plot(0, 3)\n led.plot(4, 3)\n if (!(quiet)) {\n music.playTone(587, music.beat(BeatFraction.Whole))\n } else {\n basic.pause(music.beat(BeatFraction.Whole))\n }\n basic.pause(250)\n //basic.clearScreen()\n led.plotAll()\n //ToggleScreen()\n basic.pause(250)\n //ToggleScreen()\n\n }\n screen += 1\n }\n else {\n if (30 - score >= 5 * (level)) {\n if (!(quiet)) {\n music.playTone(587, music.beat(BeatFraction.Whole))\n } else {\n basic.pause(music.beat(BeatFraction.Whole))\n }\n screen += 1\n basic.pause(1000)\n }\n else {\n // \n basic.clearScreen()\n ShowSadFace()\n basic.pause(1000)\n }\n basic.pause(30)\n }\n\n basic.pause(1000)\n}" ]
[ "0.7363857", "0.7139446", "0.70748156", "0.6969238", "0.69445103", "0.67901194", "0.6730064", "0.6616461", "0.6544919", "0.65332484", "0.65230167", "0.64692616", "0.6465121", "0.6456275", "0.64492875", "0.6420509", "0.6406408", "0.64025176", "0.6373816", "0.63457686", "0.63310564", "0.6318563", "0.6287995", "0.62726367", "0.62661535", "0.62638897", "0.6261093", "0.62593967", "0.6250065", "0.6245225", "0.6218431", "0.62083215", "0.6204112", "0.6201958", "0.61946076", "0.61794543", "0.61694074", "0.6154793", "0.6148832", "0.6133615", "0.6130249", "0.6114617", "0.60954463", "0.60949224", "0.60925084", "0.607924", "0.6075338", "0.60726374", "0.60702777", "0.60700786", "0.60660696", "0.60641885", "0.6059395", "0.6057864", "0.6045263", "0.6045261", "0.60376984", "0.6027102", "0.60237855", "0.6020972", "0.6013664", "0.6007301", "0.600715", "0.60052353", "0.60050696", "0.5991537", "0.5978187", "0.5977281", "0.59667933", "0.5966203", "0.5944676", "0.5935314", "0.5927763", "0.59219927", "0.5913938", "0.589885", "0.5896703", "0.5894853", "0.5894163", "0.5891738", "0.58916646", "0.5889222", "0.5888164", "0.5887322", "0.58868855", "0.5885141", "0.58767873", "0.5876058", "0.58647984", "0.5857307", "0.5855638", "0.58510435", "0.5850529", "0.585018", "0.5837828", "0.5827399", "0.5823932", "0.5818542", "0.5816937", "0.5796755", "0.5780008" ]
0.0
-1
! RESIZE SCORE This is the function that runs to resize score
function resizeScore(){ $('.fontLink').each(function(index, element) { $(this).css('font-size', Math.round(Number($(this).attr('data-fontsize'))*scalePercent)); }); $('#scoreHolder').css('width',stageW*scalePercent); $('#scoreHolder').css('height',stageH*scalePercent); $('#scoreHolder').css('left', (offset.left/2)); $('#scoreHolder').css('top', (offset.top/2)); $('#scoreHolder .scoreInnerContent').css('width',contentW*scalePercent); $('#scoreHolder .scoreInnerContent').css('height',contentH*scalePercent); var spaceTop = (stageH - contentH)/2; var spaceLeft = (stageW - contentW)/2; $('#scoreHolder .scoreInnerContent').css('left', spaceLeft*scalePercent); $('#scoreHolder .scoreInnerContent').css('top', spaceTop*scalePercent); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateScoreboard() {\n scoreboardGroup.clear(true, true);\n\n const scoreAsString = score.toString();\n if (scoreAsString.length === 1) {\n scoreboardGroup.create(assets.scene.width, 30, assets.scoreboard.base + score).setDepth(10);\n } else {\n let initialPosition = assets.scene.width - ((score.toString().length * assets.scoreboard.width) / 2);\n\n for (let i = 0; i < scoreAsString.length; i++) {\n scoreboardGroup.create(initialPosition, 30, assets.scoreboard.base + scoreAsString[i]).setDepth(10);\n initialPosition += assets.scoreboard.width;\n }\n }\n}", "function enlargeSnake(){\n\tif(snakeBody.length < 100){\t// temporary restriction for development reasons\n\t\t//var newBodyPart = Object.assign({}, snakeBody[snakeBody.length-1]);\n\t\tvar newBodyPart = Object.assign({}, snake);\n\t\tsnakeBody.push(newBodyPart);\n\t}\n\t\n\tscore += 100;\n\tvar scoreCounter = document.getElementById(\"score-keeper\").innerHTML = \"Score = \" + score;\n}", "function resetScores()\n{\n // Hier coderen we de code om de scores te resetten\n // @TODO: Scores resetten\n}", "resetScore() {\n this.score = INITIAL_SCORE;\n }", "function updateScores(){\n currentScore = currentGame.length;\n if (bestScore <= 0){\n //update best score from storage.\n var prevScore = scorestorage.getRecord(KEY_BEST_SCORE); \n if (prevScore){\n bestScore = prevScore;\n }\n scoreboard.updateBestScore(bestScore );\n }\n if (bestScore < currentScore ){\n scoreboard.updateBestScore(bestScore = currentScore );\n scorestorage.setRecord(KEY_BEST_SCORE, bestScore);\n }\n scoreboard.updateCurrentScore(currentScore);\n }", "updateScore() {\n if(Dashboard.candyMachted.length) {\n this.score += 1;\n this.levelUp();\n this.scoreUpdateView();\n Dashboard.candyMachted.pop();\n }\n }", "resetGhostEatenScoring() {\n this.ghostEatenScore = 100;\n }", "function resize () {\n console.log(\"acc resize\");\n }", "function resetScores() {\n for (var i = 0; i < self.gameBoard.boxes.length; i++) {\n self.gameBoard.boxes[i].isX = false;\n self.gameBoard.boxes[i].isO = false;\n self.gameBoard.$save(self.gameBoard.boxes[i]);\n }\n\n //resets the game status for the new game\n self.gameBoard.gameStatus = \"Waiting for players\";\n self.gameBoard.p1 = 0;\n self.gameBoard.p2 = 0;\n self.gameBoard.tie = 0;\n self.gameBoard.turn = 0;\n self.gameBoard.player1.isHere = false;\n self.gameBoard.player1.myName = \"Fire\";\n self.gameBoard.player2.isHere = false;\n self.gameBoard.player2.myName = \"Ice\";\n self.gameBoard.displayBoard = false;\n self.gameBoard.$save(self.gameBoard)\n self.waiting = false;\n \n }", "function resetScores(){\n scores.redPieceCount = 12;\n scores.blackPieceCount = 12\n scores.blackPiecesTaken = 0;\n scores.redPiecesTaken = 0;\n scores.winner = null;\n}", "function resetScore() {\n DATA['score'] = 0;\n}", "function resetScores () {\n STORE.questionNumber = 0;\n STORE.score = 0;\n}", "function clearScore() {\n\tscoreCorrect = 0;\n\tscoreSkipped = 0;\n\tupdateScore();\n}", "rescale(scale) {\n this.scale = scale;\n }", "function refreshScoreBoxes() {\n\td3.select(\"#scoreboard\").selectAll(\"*\").remove();\n\tscore_grid = d3.select(\"#scoreboard\")\n\t.append(\"svg\")\n\t.attr(\"width\",sGridSize.w+\"px\")\n\t.attr(\"height\",sGridSize.h+\"px\")\n\t;\n\tdrawScorebox3(score_grid, getGameData(), score_tile_size);\n}", "resetScoreArray(score){\n\t\tthis.setState({\n\t\t\tscoreArr: score\n\t\t},()=>{\n\t\t\tthis.forceUpdate();\n\t\t});\n\t}", "updateScore() {\n\t\tthis.score++;\n\t\tthis.drawScore();\n\t\tif (this.score >= this.highestScore) {\n\t\t\tthis.highestScore = this.score;\n\t\t\tlocalStorage.setItem(STORAGE_KEY, this.highestScore);\n\t\t}\n\t}", "function resize() {\n getNewSize();\n rmPaint();\n}", "_updateScore() {\n\t\tthis._$scoreBoard.textContent= this._score+'';\n\t}", "reset(){\n if(this.score>localStorage.getItem('bestScore')){\n localStorage.setItem('bestScore',this.score);\n BEST_SCORE.innerHTML = `Best: ${this.score}`;\n }\n this.initialize();\n for(let i = this.snake.length - 1; i > 0; i--){\n if(i >= this.startingCellsNumber){\n this.snake[i].parentNode.removeChild(this.snake[i]);\n this.snake.pop();\n }\n else{\n this.snake[i].style.top = `0px`;\n this.snake[i].style.left = `${this.snakeHead.offsetLeft - (this.cellWidth*i)}px`;\n }\n }\n\n }", "function ResizeTop50() {\n AlterRatingHeights(top50ArcadeRatings, \"\", \"rating\");\n AlterRatingHeights(top50PinballRatings, \"\", \"rating\");\n}", "function updateScore(newScoreArray) {\n for (let i = 0; i < 13; i++) {\n if (!currentPlayer.selectedScores[i]) {\n currentPlayer.eachScore[i] = newScoreArray[i];\n currentPlayer.scoreDisplay[i].textContent = currentPlayer.eachScore[i];\n }\n }\n}", "resetScore() {\n this.gameNotes.resetScores()\n }", "function scoreReset() {\n guessesRemaining = 9;\n guesses = [];\n}", "function updateScore(){\r\n if(ffScoreBugFix>10 && currentTube.topRect.getRight() < characters[0].x){\r\n if(!isHit){\r\n score++;\r\n }\r\n isHit = false;\r\n var index = tubes.indexOf(currentTube) + 1;\r\n index %= tubes.length;\r\n currentTube = tubes[index];\r\n ffScoreBugFix = 0;\r\n }\r\n ffScoreBugFix++;\r\n }", "function updatescore() {\n if (player.y< 50) {\n score ++;\n scoreDiv.innerText = `Your score = ${score}`;\n //reset player position\n player.x =200;\n player.y=400;\n //remove enimies and create new ones\n allEnemies=[];\n generateEnemies(++n);\n }\n}", "function resetScores() {\n guessLeft = 10;\n guessSoFar = [];\n}", "function toggleSize(){\n var elem = document.getElementsByClassName('board')[0];\n while (elem.firstChild) {\n elem.removeChild(elem.firstChild);\n }\n if(board_size === 3){\n board_size = 4;\n } else if(board_size === 4){\n board_size = 6;\n } else if(board_size === 6){\n board_size = 3;\n }\n resetBoard();\n}", "resetScore() {\n // prevent a pass by reference\n this.gameStats = JSON.parse(JSON.stringify( baseScore ));\n }", "function resize() {}", "updateScore(score) {\n score = +score;\n const { currentFrameTotal, isEndOfFrame, isGameOver } = this.state;\n let mapping = isEndOfFrame && currentFrameTotal + score === this.MAX_TOTALS_LENGTH ? '/' : score === this.MAX_TOTALS_LENGTH ? 'X' : score;\n\n if (!this.determineIsGameOver()) {\n this.updateFrameScore(score, mapping);\n } else if (!isGameOver) {\n this.setState({\n isGameOver: true\n });\n }\n }", "function update_final_score(Strokes){\r\n\tif(Strokes > final_score)\r\n\t\tfinal_score = Strokes;\r\n}", "_updateScore () {\n this._scoreBoard.innerHTML = this._score;\n }", "_resize(size) {\n const oldSlots = this._hashTable\n this._capacity = size\n //reset the length - it will get rebuilt as you add items back\n this.length = 0\n this._deleted = 0\n this._hashTable = []\n\n for (const slot of oldSlots) {\n if (slot !== undefined && !slot.DELETED) {\n this.set(slot.key, slot.value)\n }\n }\n }", "function updateScore (prize, numGuess, Bankrupt) {\n\tif(Bankrupt) {\n\t}\n}", "function stretchScore(score) {\n return (10/3)*(score-70);\n }", "function clearScores() {\n localStorage.removeItem('scores');\n checkWin();\n drawScores();\n}", "function fullReset() {\n reset();\n score.DROITE = 0;\n score.GAUCHE = 0;\n }", "_resize(size){\n const oldSlots = this._hashTable;\n this._capacity = size;\n this.length = 0 // reset the length, it will get rebuild as the old items are added back\n this._deleted = 0\n this._hashTable = []\n\n for(const slot of oldSlots){\n if(slot !== undefined){\n this.set(slot.key, slot.value)\n }\n }\n }", "_setScore(score) {\n\t\tthis._score= score;\n\t\tthis._updateScore();\n\t}", "decreaseScore(oldScore){\n if(oldScore > 0 ){\n let newScore = oldScore - 1\n this.setState({score : newScore})\n ScoreManager.saveAppScore(newScore.toString())\n }\n }", "function reset(){\n score=0;\n gameTime=0;\n updateScore();\n}", "function refreshTargetScore() {\n\t\t$(\"#targetScore\").text(targetScore);\n\t}", "function resize() {\n\t\t// set new window dimensions\n\t\tjaws.width = jaws.canvas.width = window.innerWidth;\n\t\tjaws.height = jaws.canvas.height = window.innerHeight;\n\n\t\t// set new card length\n\t\tGame.CARD_LENGTH = window.innerHeight * 0.29;\n\n\t\t// resize all images\n\t\tfor (var i = 0, len = Game.deck.length; i < len; i++)\n\t\tGame.deck[i].resize();\n\t\tGame.Image.resize();\n\n\t\t// force text resize\n\t\ttext = undefined;\n\n\t\t// force full render\n\t\tforceRender = true;\n\t}", "function updateScore() {\n score++;\n}", "function updateScorecard() {\r\n\tvar i = strokesDisp.length - 1;\r\n\tif (hole != 10) {\r\n\t\ttotal = total + strokesDisp[i];\r\n\t}\r\n\tsw = total - TOTAL_PAR[i];\r\n\r\n\t// different colors if over or under par\r\n\tif (total > TOTAL_PAR[i]) {\r\n\t\tparScore.addColor('#228B22', 0);\r\n\t\tparScore.fontSize = 20 * HR;\r\n\t\tparScore.setText('+' + sw);\r\n\t} else if (total < TOTAL_PAR[i]) {\r\n\t\tparScore.addColor('#ff0000', 0);\r\n\t\tparScore.fontSize = 20 * HR;\r\n\t\tparScore.setText(sw);\r\n\t} else if (total == TOTAL_PAR[i]) {\r\n\t\tparScore.addColor('#000000', 0);\r\n\t\tparScore.fontSize = 21 * HR;\r\n\t\tparScore.setText('E');\r\n\t}\r\n\tif (strokesDisp.length < 9) {\r\n\t\tparScore.fontSize = 25 * HR;\r\n\t\tparScore.y = scorecard.y - 152 * HR + 48 * HR * i;\r\n\t} else {\r\n\t\tparScore.y = scorecard.y + 310 * HR;\r\n\t}\r\n\r\n\t// score on each hole shown on scorecard\r\n\tif (strokesDisp.length >= 9) {\r\n\t\tscorecolor();\r\n\t\tscore9.setText(strokesDisp[8])\r\n\t\tscore10.setText(total)\r\n\t\tif (total - TOTAL_PAR[i] > 0) {\r\n\t\t\tscore10.addColor('#228B22', 0);\r\n\t\t} else if (total - TOTAL_PAR[i] == 0) {\r\n\t\t\tscore10.addColor('#000000', 0);\r\n\t\t} else if (total - TOTAL_PAR[i] < 0) {\r\n\t\t\tscore10.addColor('#ff0000', 0);\r\n\t\t}\r\n\t} else if (strokesDisp.length >= 8) {\r\n\t\tscorecolor();\r\n\t\tscore8.setText(strokesDisp[7])\r\n\t} else if (strokesDisp.length >= 7) {\r\n\t\tscorecolor();\r\n\t\tscore7.setText(strokesDisp[6])\r\n\t} else if (strokesDisp.length >= 6) {\r\n\t\tscorecolor();\r\n\t\tscore6.setText(strokesDisp[5])\r\n\t} else if (strokesDisp.length >= 5) {\r\n\t\tscorecolor();\r\n\t\tscore5.setText(strokesDisp[4])\r\n\t} else if (strokesDisp.length >= 4) {\r\n\t\tscorecolor();\r\n\t\tscore4.setText(strokesDisp[3])\r\n\t} else if (strokesDisp.length >= 3) {\r\n\t\tscorecolor();\r\n\t\tscore3.setText(strokesDisp[2])\r\n\t} else if (strokesDisp.length >= 2) {\r\n\t\tscorecolor();\r\n\t\tscore2.setText(strokesDisp[1])\r\n\t} else if (strokesDisp.length >= 1) {\r\n\t\tscore1.setText(strokesDisp[0])\r\n\t\tif (strokesDisp[i] - TOTAL_PAR[i] > 0) {\r\n\t\t\tscore1.addColor('#228B22', 0);\r\n\t\t} else if (strokesDisp[i] - TOTAL_PAR[i] == 0) {\r\n\t\t\tscore1.addColor('#000000', 0);\r\n\t\t} else if (strokesDisp[i] - TOTAL_PAR[i] < 0) {\r\n\t\t\tscore1.addColor('#ff0000', 0);\r\n\t\t}\r\n\t}\r\n\r\n\t// sets color of number on scorecard\r\n\tfunction scorecolor() {\r\n\t\tfor (var i = 1; i < allScores.length - 1; i++) {\r\n\t\t\tif (strokesDisp[i] - (TOTAL_PAR[i] - TOTAL_PAR[i - 1]) > 0) {\r\n\t\t\t\tallScores[i].addColor('#228B22', 0);\r\n\t\t\t} else if (strokesDisp[i] - (TOTAL_PAR[i] - TOTAL_PAR[i - 1]) == 0) {\r\n\t\t\t\tallScores[i].addColor('#000000', 0);\r\n\t\t\t} else if (strokesDisp[i] - (TOTAL_PAR[i] - TOTAL_PAR[i - 1]) < 0) {\r\n\t\t\t\tallScores[i].addColor('#ff0000', 0);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "function updateScore(){\n $('#score').empty();\n $('#score').append(\"Score: \" + gameData.score);\n}", "function resize(newSize){\n // For general hash function the only thing to do is to iterate over \n //old hash table and add each entry \n // to a new table.\n var oldStorage = storage;\n resizing = true;\n storageLimit = newSize;\n //need to clear out old one to add entries to new one\n storage = [];\n size = 0;\n //iterate over old storage and insert tuples\n //into new storage\n oldStorage.forEach(function(tuple){\n tuple.forEach(function(item){\n result.insert(item[0],item[1]);\n });\n });\n }", "resetScore() {\n for (let i = 1; i < 4; i += 1) {\n const { domElement } = this.domElements[i];\n for (let j = 0; j < 10; j += 1) {\n domElement.classList.remove(`sprite-d${j}`);\n }\n domElement.classList.add(`sprite-d${0}`);\n }\n }", "function updateScore(newScore) {\n localStorage.setItem('keymasher_score', newScore);\n scoreNode.innerHTML = newScore;\n}", "function resetScores(){\n document.getElementById(\"draw-score\").innerHTML = 0;\n document.getElementById(\"human-score\").innerHTML = 0;\n document.getElementById(\"computer-score\").innerHTML = 0;\n\n //Reset the board\n resetSquares();\n}", "grow() {\n let lastTail = this.tail[tail.length - 1];\n if (this.tail.length < 1) {\n lastTail = this.tail[tail.length];\n }\n this.tail.push(new Position(lastTail.row, lastTail.column));\n score += 10;\n }", "calculateDisplayScore() {\n // If the scre is not equal to 40 then\n if (this.score !== 40) {\n this.ctx.font = '17px Arial';\n this.ctx.fillStyle = '#0095DD';\n this.ctx.fillText(`Score: ${this.score}`, 975, 35);\n\n // If the score is = 40 then the user won so reset the bricks and score\n } else {\n this.score = 0;\n window.location.reload();\n }\n }", "restartGame() {\n // Checks high score and displays always the highest score\n if (this.score / 10 + this.bonus * 10 > topScore) {\n topScore = this.score / 10 + this.bonus * 10;\n }\n this.missile = new Ammo();\n this.player = new Player();\n this.player.fire = false;\n this.cocktails = [];\n this.coconuts = [];\n this.sharks = [];\n this.brewskis = [];\n this.background = new Background();\n this.score = 0;\n this.bonus = 0;\n this.drinks = 0;\n this.drunk = false;\n this.secondsToSober = 5;\n this.bar = new Bar();\n this.draw();\n loop();\n }", "adjustSize () {\n this._resize();\n }", "function score(){\n\tif(gameStart){\n\t\tvar s = document.getElementById(\"score\");\n\t\ts.innerText++;\n\t\tremoveClick();\n\t\tresetAll();\n\t}\n}", "function getScore() { // Calculating rounded scores based off of dimension\n if (size < 50) { // Checking less than 50\n var lessThan = Math.round(10 - 0.1 * size);\n score = score + lessThan; // Updating score\n } else { // Checking more than 50\n var moreThan = Math.round(10 - 0.09 * size);\n score = score + moreThan; // Updating score\n }\n }", "function resizeGame(width, height) {\n rows = Math.floor(width / cellSize);\n cols = Math.floor(height / cellSize );\n }", "function resize() {\n\tif (window.innerHeight < window.innerWidth+totalToolbarWidth)\n\t\tboardSize = window.innerHeight;\n\telse\n\t\tboardSize = window.innerWidth-totalToolbarWidth;\n\ttileSize = boardSize/8;\n\t$('#game').css('width', boardSize + 'px');\n\t$('#game').css('height', boardSize + 'px');\n\t$('#gameWrapper').css('width', boardSize+totalToolbarWidth+ 'px');\n\t$('#gameWrapper').css('height', boardSize+'px');\n\t$('.toolbar').css('height', boardSize + 'px');\n}", "function updateScore(scores) {\n if (scores[0].score <= score) {\n scores[0].score = score;\n scores[0].name = playerName;\n console.log(chalk.green.bold('Hurray!! you Got the First Place on the scoreBoard. \\n'));\n } else if (scores[1].score <= score) {\n scores[1].score = score;\n scores[1].name = playerName;\n console.log(chalk.green.bold('Hurray!! you Got the Second Place on the scoreBoard. \\n'));\n } else if (scores[2].score <= score) {\n scores[2].score = score;\n scores[2].name = playerName;\n console.log(chalk.bgBlack.green.bold('Hurray!! you Got the Third Place on the scoreBoard. \\n'));\n }else {\n console.log(chalk.bgBlack.green.bold('Sorry!! you Got no place on the scoreBoard. \\n'));\n }\n\n \n}", "async resized() {\n this.turnOff();\n await this.delay(25);\n this.moveToCurrent();\n await this.delay(25);\n this.turnOn();\n }", "function resetScores() {\n miscButtonClick.play();\n if (userCount !== 2){\n alert(\"Two users should be logged in\");\n return;\n }\n refresh();\n player1Scores = 0;\n player2Scores = 0;\n drawCount = 0;\n updateScores();\n // saveGame();\n writeGameRT();\n }", "function restartGame(){\r\n score = 0; // restart score\r\n bricksArray.forEach(column => {\r\n column.forEach(brick => {\r\n // restore all the bricks\r\n brick.exist = true;\r\n });\r\n });\r\n}", "resized() {\n\t\tthis.position.y = this.halfSize.y;\n\t}", "function restartWithChosenSize() {\n if (chosenSize === null) {\n console.log(\"restartWithChosenSize ERROR: No chosen size. Returning.\");\n return;\n }\n\n console.log(\n \"Game in progress: \" +\n gameboard.gameInProgress() +\n \", restart confirmed: \" +\n restartConfirmed\n );\n\n // If the game has already been started and user has not\n // confirmed the decision, display notification\n // asking for confirmation on starting a new game.\n if (gameboard.gameInProgress() && !restartConfirmed) {\n console.log(\n \"changeBoardSize DEBUG: Game in progress. Must confirm decision.\"\n );\n showNotification(confirmRestartNotif);\n return;\n }\n\n // Reset restart confirmation\n restartConfirmed = false;\n\n // Start new game\n gameboard.newGame(chosenSize);\n}", "shrinkToFit() {\n _instance.shrinkToFit()\n }", "function resize(){\n rect = Canvas.getBoundingClientRect()\n ratio = S/rect.height\n Canvas.width = S\n Canvas.height = S\n\n for (let i=0; i<Class('image').length; i++){\n let c = Class('image')[i]\n c.width = S\n c.height = S\n }\n}", "function resizedw(){\n\t\n}", "function resetHeuristicScores(grid, gridSize)\n{\n // Maze complete, add neighbors\n for (var i = 0; i < gridsize; i++)\n {\n for (var j = 0; j < gridsize; j++)\n {\n grid[i][j].f = 0;\n grid[i][j].g = 0;\n grid[i][j].h = 0;\n }\n }\n}", "function resetGame() {\r\n notes.forEach(e => {\r\n e.div.style.transition = \"1s\"\r\n e.color = \"red\"\r\n })\r\n attemptStop = true\r\n running = false\r\n\r\n // set new score\r\n if (localStorage.bestScore) {\r\n // highscore\r\n if (Number(localStorage.bestScore) < score) {\r\n localStorage.bestScore = score\r\n // type == 1 means new highscore\r\n writeBestScore(1)\r\n }\r\n // not new highscore\r\n else {\r\n writeBestScore()\r\n }\r\n\r\n }\r\n // first time played, sets new score\r\n else {\r\n localStorage.setItem(\"bestScore\", score)\r\n writeBestScore()\r\n }\r\n}", "function update_score() {\n\t\t$('[id$=-score]').val(score);\n\t}", "function resizeEverything() {\n scale = Math.max(0.5, Math.min(1.3, Math.min((window.innerHeight - 100) / defaultHeight, (window.innerWidth - 100) / defaultWidth)));\n canvas.width = defaultWidth * scale;\n canvas.height = defaultHeight * scale;\n grid *= scale;\n minEnemySpeed *= scale;\n maxEnemySpeed *= scale;\n //enemyRadius*=scale;\n bulletRadius *= scale;\n playerWidth *= scale;\n playerHeight *= scale;\n bulletSpeed *= scale;\n ghostSpeed *= scale;\n //playerY = canvas.height-playerHeight;\n //playerX=Math.max(0,canvas.width-distFromRight);\n //console.log(scale);\n\n }", "function clearScores()\n {\n vm.impactScore = 'NA';\n vm.exploitScore = 'NA';\n vm.baseScore = 'NA';\n vm.temporalScore = 'NA';\n vm.environScore = 'NA';\n vm.modImpactScore = 'NA';\n vm.overallScore = 'NA';\n vm.cvssString = $sce.trustAsHtml('NA');\n }", "function keepScore(score: int) {\n thescore = score;\n}", "function decreaseDifficulty() {\n if (score < 0) {\n redirectToSummaryPage();\n }\n setGridInvisible();\n if (!isLowestDimension()) {\n if (row > col) {\n setGrid(row-1, col);\n } else {\n setGrid(row, col-1);\n }\n }\n resetGrid(\"decrease\");\n}", "function clearScores() {\n\n\t\tif ($(\"#highScores tr\").length > 1) {\n\n\t\t\tlocalStorage.removeItem(\"scores\");\n\t\t\tstoredScores = [];\n\t\t\t\n\t\t\t// Fun animation, fun sound, and removal of localStorage/High Score elements.\n\t\t\t$(\".added\").animate({\n\n\t\t\t\t'padding': \"0px\",\n\t\t\t\t'height': \"0px\",\n\t\t\t\t'font-size': \"0px\",\n\t\t\t\t'margin': \"0px\"\n\n\t\t\t}, 4800, function() {\n\n\t\t\t\t$(\".added\").remove();\n\n\t\t\t});\n\t\t\tsounds.shutdown();\n\n\t\t}\n\n\t}", "displayScore(score, tileSize) {\n ctx.fillStyle = \"white\";\n ctx.fillRect(0, 0, this.rightBoundary, this.upperBoundary);\n\n ctx.fillStyle = this.scoreColor;\n ctx.font = this.scoreFont;\n ctx.fillText(\"score : \" + score, this.leftBoundary, this.leftBoundary);\n }", "function resetScore() {\n currentScore = 0;\n questionNum = 0;\n $(\".score\").text(0);\n $(\".questionNumber\").text(0);\n}", "function addScore(){\r\n for(let i=0;i<199;i+=width){\r\n const row = [i,i+1,i+2,i+3,i+4,i+5,i+6,i+7,i+8,i+9];\r\n if(row.every(index => squares[index].classList.contains('taken'))){\r\n score += 10;\r\n scoreDisplay.innerHTML = score;\r\n row.forEach(index => {\r\n squares[index].classList.remove('taken');\r\n squares[index].classList.remove('tetrimino');\r\n squares[index].style.backgroundColor = '';\r\n });\r\n const squaresRemoved = squares.splice(i,width);\r\n // console.log(squaresRemoved);\r\n squares = squaresRemoved.concat(squares);\r\n squares.forEach(cell => grid.appendChild(cell));\r\n }\r\n }\r\n }", "function addScore() {\n for (let i = 0; i < 199; i += width) {\n const row = Array.from(new Array(width), (a,b) => b + i)\n if (row.every(index => squares[index].classList.contains('taken'))) {\n score += 10\n lines_count += 1\n scoreDisplay.innerHTML = score\n linesDisplay.innerHTML = lines_count\n row.forEach(index => {\n squares[index].classList.remove('taken', 'tetromino')\n squares[index].style.backgroundColor = ''\n })\n const squaresRemoved = squares.splice(i, width)\n squares = squaresRemoved.concat(squares)\n squares.forEach(cell => grid.appendChild(cell))\n }\n }\n }", "function clear() {\r\n BEST_SCORE = 0;\r\n save();\r\n GameMenu.updateHighScore(BEST_SCORE);\r\n }", "function switchScoreCopy(score){\n\t\t\t\t\t\tref.highScoreText.setText(score);\n\t\t\t\t\t\tref.centerText(265,ref.highScoreText);\n\t\t\t\t\t\tTweenMax.to(ref.highScoreText,0.25,{alpha:1});\n\t\t\t\t\t}", "function change_score(round_score) {\n num_correct += round_score;\n num_total += 1;\n }", "function decreaseCurrentSize() {\n\tif (currentSize == 'keyImage') {\n\t\tcurrentSize = 'keyLarge';\n\t\tcurrentZoom = zoomLevels[2];\t\t\n\t} else\tif (currentSize == 'keyLarge') {\n\t\tcurrentSize = 'keyMedium';\n\t\tcurrentZoom = zoomLevels[1];\t\t\n\t} else\tif (currentSize == 'keyMedium') {\n\t\tcurrentSize = 'keySmall';\t\t\t\n\t\tcurrentZoom = zoomLevels[0];\t\t\n\t}\n\t\n\tupdateCurrentKeySize();\n}", "updateScore() {\n const points = splitNumber(this.points);\n\n this.scoreClass(3, points[3]);\n this.scoreClass(2, points[2]);\n\n if (this.points < 0) {\n this.scoreClass(1, '-minus');\n } else {\n this.scoreClass(1, points[1]);\n }\n }", "reset(){\r\n \tconsole.log(\"reset\");\r\n \tthis.score=0;\r\n }", "closeScoreboard() {\n document.getElementById(\"myScoreboard\").style.width = \"0%\";\n }", "function resizeImage() {\n\t\tstopSlideshow();\n\t\t_setShrunk(!_isShrunk());\n\t\t_changeItem();\n\t}", "function windowResized() {\n\tresizeCanvas(windowWidth,windowHeight);\n\tboard.reset();\n}", "_resize(size) {\n //copy the old pointer\n const oldPtr = this.ptr;\n //create more space for the new size\n this.ptr = newMem.allocate(size);\n //if there is not space, throw an error\n if (this.ptr === null) {\n throw new Error('Out of memory');\n }\n //copy the old array values, starting at the pointer, and add the additional length needed?\n newMem.copy(this.ptr, oldPtr, this.length);\n //empty the old memory space\n newMem.free(oldPtr);\n //increase the capacity value to the new capacity\n this._capacity = size;\n }", "function updateScore() {\n $score.text(score);\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 }", "updateGrid() {\n if (this.moved) {\n let updateGrid = new Array(this.size * this.size).fill(null)\n this.grid.forEach(element => {\n if (element) {\n if (element.remove)\n return\n if (element.merge) {\n element.value *= 2\n element.merge = false\n this.score += element.value\n //if merge value 2048 then game over\n if (element.value === 2048)\n this.gameWon = true\n }\n updateGrid[element.position] = element\n }\n\n });\n this.grid = [...updateGrid]\n this.bestScore = this.score > this.bestScore ? this.score : this.bestScore\n this.addTile()\n this.gameOver = this.isGameOver();\n this.writeToStorage()\n this.moved=false\n }\n }", "function resetScore(){\n localStorage.removeItem('game1HighScore');\n highScoreBoard.textContent='HIGH SCORE: ' + 0;\n}", "function clearScores(){\n window.localStorage.clear();\n updateScoreBoard();\n}", "function reload() {\n counter = 0;\n calculateScore(time, totalWords);\n\n currentText.classList.remove(\"textColor\");\n time = 0;\n totalWords = 0;\n totalErrors = 0;\n generateText();\n\n}", "function resetGame() {\n if (score > max) {\n max = score;\n }\n\n snake.x = 160;\n snake.y = 160;\n snake.cells = [];\n snake.maxCells = STARTING_LENGTH;\n snake.dx = SNAKE_MAX_SPEED;\n snake.dy = 0;\n\n score = 0;\n apple.x = getRandomInt(0, 25) * grid;\n apple.y = getRandomInt(0, 25) * grid;\n document.getElementById('high').innerHTML = max;\n document.getElementById('score').innerHTML = score;\n}", "function resetMeScorePerLesion()\n{\n meScorePerLesion = [0,0,0,0,0,0,0,0,0,0,0,0];\n}", "function resize_all(){\n\t\tclear_map();\n\t\tinit_map();\n\t\tresize_graphs();\n\t // Haven't resized in 100ms!\n\t}", "function redraw()\n{\n\tmodifyOverallRatingViewing();\n\tmodifyDetailedRatingsDisplayRepeat();\n\t// Only when editing recognized-type scorecard:\n\tif (hasSelector('.note-button') && hasSelector('#' + modifierPersistentContainerId)) \n\t{\n\t\tdoOnSelector('.notes .note-container', function (container)\n\t\t{\n\t\t\t// Resize textareas to fit text\n\t\t\tvar inputControl = container.querySelector('textarea');\n\t\t\tif (inputControl)\n\t\t\t{\n\t\t\t\tfitTextarea(inputControl);\n\t\t\t}\n\t\t});\n\t}\n}" ]
[ "0.6918159", "0.66235214", "0.6431632", "0.6410671", "0.63819176", "0.6295828", "0.6294661", "0.62264955", "0.6119847", "0.6098467", "0.60890585", "0.6087336", "0.60847205", "0.6015591", "0.600963", "0.59730434", "0.59582454", "0.595048", "0.5935952", "0.5930025", "0.59141195", "0.590596", "0.586477", "0.5863606", "0.58515877", "0.5846111", "0.58445907", "0.5841645", "0.5821411", "0.58166766", "0.5814774", "0.578865", "0.5783181", "0.5777156", "0.57681185", "0.5760988", "0.5755595", "0.57482654", "0.573815", "0.5728136", "0.572399", "0.5718596", "0.57070816", "0.5704071", "0.5696898", "0.5689126", "0.56888145", "0.56874824", "0.5681115", "0.5678126", "0.56673414", "0.56629664", "0.5653701", "0.5649151", "0.56362027", "0.56311876", "0.56299365", "0.56279945", "0.5627282", "0.56243414", "0.5621918", "0.56206447", "0.5618258", "0.5615165", "0.56137955", "0.56124574", "0.5608545", "0.5607211", "0.5605159", "0.56019425", "0.56006354", "0.55997944", "0.5596575", "0.5595937", "0.55948305", "0.5590503", "0.55903304", "0.5588458", "0.55819505", "0.55694103", "0.55604047", "0.5548098", "0.5543192", "0.5536954", "0.5534737", "0.5533726", "0.5529764", "0.552774", "0.55266625", "0.5526648", "0.5524181", "0.5518037", "0.55126256", "0.55117476", "0.55050254", "0.55043197", "0.5503017", "0.55000925", "0.5495147", "0.54937285" ]
0.75561607
0
sensei: pjfranzini Write a function that accepts a square matrix (N x N 2D array) and returns the determinant of the matrix. How to take the determinant of a matrix it is simplest to start with the smallest cases: A 1x1 matrix |a| has determinant a. A 2x2 matrix [ [a, b], [c, d] ] or |a b| |c d| has determinant: ad bc. The determinant of an n x n sized matrix is calculated by reducing the problem to the calculation of the determinants of n matrices ofn1 x n1 size. For the 3x3 case, [ [a, b, c], [d, e, f], [g, h, i] ] or |a b c| |d e f| |g h i| the determinant is: a det(a_minor) b det(b_minor) + c det(c_minor) where det(a_minor) refers to taking the determinant of the 2x2 matrix created by crossing out the row and column in which the element a occurs: | | | e f| | h i| Note the alternation of signs. The determinant of larger matrices are calculated analogously, e.g. if M is a 4x4 matrix with first row [a, b, c, d], then: det(M) = a det(a_minor) b det(b_minor) + c det(c_minor) d det(d_minor)
function determinant(m) { switch (m.length) { //handles empty matrix case 0: return 1; //exit condition && handles singleton matrix case 1: return m[0][0]; default: //detrmnnt will build array of terms to be combined into determinant //ex. a*det(a_minor) - b*det(b_minor)... let detrmnnt = [] //pos controls alternation of terms ('+' or '-') for (let i = 0, pos = 1; i < m.length; i++, pos *= -1) { //adds term, ex. +/- a * det(a_minor) detrmnnt.push(pos * (m[0][i] * determinant(nMinor(m, i)))) } return detrmnnt.reduce((accu, elem) => accu + elem) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function determinant(m) {\n if (m.length == 1)\n return m[0][0];\n function calc(matrix) {\n if (matrix.length == 2)\n return matrix[0][0] * matrix[1][1] - matrix[1][0] * matrix[0][1];\n let res = 0, sign = 1;\n for (let i = 0; i < matrix[0].length; i++) {\n let temp = [];\n for (let j = 1; j < matrix.length; j++) {\n temp.push([]);\n for (let k = 0; k < matrix[0].length; k++) {\n if (k != i) temp[j-1].push(matrix[j][k]);\n }\n }\n res += matrix[0][i] * sign * calc(temp.slice());\n sign *= -1;\n }\n return res;\n }\n return calc(m);\n }", "function det(matrix) {\n\n //Matrix is 2x2, Calculate determinant\n if (matrix.length == 2) {\n let a = matrix[0][0];\n let b = matrix[0][1];\n let c = matrix[1][0];\n let d = matrix[1][1];\n return a*d - c*b;\n }\n\n const row = 0;\n\n //Matrix is 3x3 or greater; recursively reduce to 2x2\n let totalDet = 0;\n for (let column = 0; column < matrix.length; column += 1) {\n //Generate cofactor\n let cofactor = getCofactorFrom(matrix, row, column);\n //Calculate determinant for that cofactor\n let subDet = det(cofactor);\n let sum = matrix[row][column] * subDet;\n //Alternating, add and subtract the sum\n let negative = (column+1) % 2 == 0;\n if (negative) { sum *= -1; }\n totalDet += sum;\n }\n\n return totalDet;\n}", "function determinant(matrix) {\r\n\t\t// Check if the matrix is a 2x2\r\n\t\tif (matrix.rows === 2 && matrix.cols === 2) {\r\n\t\t\treturn (matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0]);\r\n\t\t}\r\n\t\t// Otherwise, reduce the size by 1 and recurse\r\n\t\telse {\r\n\t\t\tvar det = 0;\r\n\t\t\tfor (var i = 0; i < matrix.cols; i++) {\r\n\t\t\t\tdet += matrix[0][i] * (i % 2 === 0 ? 1 : -1) * determinant(matrix._submatrix(0, i));\r\n\t\t\t}\r\n\r\n\t\t\treturn det;\r\n\t\t}\r\n\t}", "function determinantOfMatrix(matrix1, n) {\r\n var det = 0; // Initialize result\r\n // Only one element in matrix\r\n if (n == 1) {\r\n return matrix1[0][0];\r\n }\r\n //Temp array to store cofactors\r\n var temp = new Array(n);\r\n for (var i = 0; i < n; i++) {\r\n temp[i] = new Array(n);\r\n }\r\n var sign = 1;\r\n for (var f = 0; f < n; f++) {\r\n // Getting Cofactor of mat[0][f]\r\n getCofactor(matrix1, temp, 0, f, n);\r\n det += sign * matrix1[0][f] * determinantOfMatrix(temp, n - 1);\r\n // terms are to be added with alternate sign\r\n sign = -sign;\r\n }\r\n return det;\r\n}", "static calculate_determinant(Matrix, n) {\n\t\tvar s;\n\t\tvar det = 0;\n\t\tif (Matrix.length == 1) { //bottom case of the recursive function\n\t\t\treturn Matrix[0][0];\n\t\t}\n\t\tif (Matrix.length == 2) {\n\t\t\tdet = Matrix[0][0] * Matrix[1][1] - Matrix[1][0] * Matrix[0][1];\n\t\t\treturn det;\n\t\t}\n\t\tfor (var i = 0; i < n; i++) {\n\t\t\t//creates smaller matrix- values not in same row, column\n\t\t\tvar smaller = new Array(Matrix.length - 1);\n\t\t\tfor (var h = 0; h < smaller.length; h++) {\n\t\t\t\tsmaller[h] = new Array(Matrix.length - 1);\n\t\t\t}\n\t\t\tfor (var a = 1; a < Matrix.length; a++) {\n\t\t\t\tfor (var b = 0; b < Matrix.length; b++) {\n\t\t\t\t\tif (b < i) {\n\t\t\t\t\t\tsmaller[a - 1][b] = Matrix[a][b];\n\t\t\t\t\t} else if (b > i) {\n\t\t\t\t\t\tsmaller[a - 1][b - 1] = Matrix[a][b];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (i % 2 == 0) {\n\t\t\t\ts = 1;\n\t\t\t} else {\n\t\t\t\ts = -1;\n\t\t\t}\n\t\t\tdet += s * Matrix[0][i] * (this.calculate_determinant(smaller));\n\t\t}\n\t\treturn (det);\n\t}", "function calcDeterminant(matrix) {\r\n let a = matrix[0][0];\r\n let b = matrix[0][1];\r\n let c = matrix[1][0];\r\n let d = matrix[1][1];\r\n return a * d - b * c;\r\n}", "det()\r\n {\r\n if (this.m == 1)\r\n return this.matrix[0][0];\r\n\r\n if (this.m == 2)\r\n {\r\n return math.subtract(\r\n math.multiply(this.matrix[0][0], this.matrix[1][1]),\r\n math.multiply(this.matrix[0][1], this.matrix[1][0])\r\n );\r\n }\r\n\r\n var total = 0;\r\n var sign = 1;\r\n\r\n // loop through elements of first column\r\n for (var r = 0; r < this.m; r++)\r\n {\r\n // calculate cofactor of each element: (alternating sign) * subset(r, 0).det()\r\n var cofactor = math.multiply(sign, this.subset(r, 0).det());\r\n\r\n // multiply each element in this column by the cofactor for that element\r\n var ac = math.multiply(this.matrix[r][0], cofactor);\r\n\r\n // add this to a total\r\n total = math.add(total, ac);\r\n\r\n sign *= -1;\r\n }\r\n return total;\r\n }", "function det(M){\n\tif (M.length == 2){\n\t\treturn M[0][0]*M[1][1] - M[0][1]*M[1][0];\n\t}\n\telse {\n\t\treturn M[0][0]*det(submatrix(M,0,0)) - M[0][1]*det(submatrix(M,0,1)) + M[0][2]*det(submatrix(M,0,2)); \n\t}\n}", "function det(A){\r\n\tvar D = A;\r\n\tD[3]=A[0];\r\n\tD[4]=A[1];\r\n\treturn (D[0][0]*D[1][1]*D[2][2]+D[1][0]*D[2][1]*D[3][2]\r\n\t+A[2][0]*A[3][1]*A[4][2])\r\n\t-(D[0][2]*D[1][1]*D[2][0]+D[1][2]*D[2][1]*D[3][0]\r\n\t+D[2][2]*D[3][1]*D[4][0]);\r\n}", "determinant() {\n if (this.row !== this._col) {\n throw new Error('The matrix is not a square');\n }\n else {\n if (this.row == 2) {\n return this.data[0][0] * this.data[1][1] - this.data[0][1] * this.data[1][0];\n }\n else {\n let iCof = 1;\n let sum = 0;\n for (let j = 0; j < this._col; j++) {\n sum = sum + this.data[iCof - 1][j] * Math.pow((-1), (iCof + j + 1)) * this.sub_matrix(iCof, j + 1).determinant();\n }\n return sum;\n }\n }\n }", "function FindDeterminant(array) {\n if (array.length == 2) {\n res += '(' + array[0][0] + ')*(' + array[1][1] + ')-(' + array[0][1] + ')*(' + array[1][0] + ')'; //ad-bc\n return;\n }\n\n var len = array[0].length;\n for (var i = 0; i < len; i++) {\n var ele = array[0][i];\n var subDetArray = [];\n for (var rowIndex = 1; rowIndex < array.length; rowIndex++) {\n var row = array[rowIndex];\n var temp = [];\n for (var col = 0; col < len; col++) {\n if (col != i)\n temp.push(row[col]);\n }\n subDetArray.push(temp);\n }\n var even = ((i + 1) % 2 == 0);\n res += (even ? '-(' : '+(') + ele + ')*(';\n FindDeterminant(subDetArray);\n res += ')';\n }\n }", "function determinant2D(a, b, c, d) {\n return a * d - b * c;\n }", "function determinantPro(m) {\n if (m.length == 0) return 0;\n if (m.length == 1) return m[0][0];\n if (m.length == 2) return m[0][0] * m[1][1] - m[0][1] * m[1][0];\n if (m.length > 2) {\n return m.reduce((acc, curr, i, arr) => {\n let miniArr = arr.slice(0, i).concat(arr.slice(i + 1)).map(item => item.slice(1));\n console.log(i, curr, acc, '||', miniArr);\n return acc + (i % 2 == 0 ? 1 : -1) * curr[0] * determinantPro(miniArr);\n }, 0);\n }\n}", "_det(r) {\n if (r == 2)\n return this.m[0][0] * this.m[1][1] - this.m[0][1] * this.m[1][0];\n \n var d = 0;\n for (var i = 0; i < r; i++) {\n if (i % 2 == 0) d += this.m[r - 1][i] * det(r - 1);\n else d -= this.m[r - 1][i] * det(r - 1);\n }\n return d;\n }", "function solveEq(eq){\n // seperate eq matrix to matrix a and b\n const a = []\n const b = []\n for (let i = 0; i < 3; i += 1) {\n const row = [];\n for (let j = 0; j < 3; j += 1) {\n row.push(eq[i][j]);\n }\n a.push(row);\n b.push(eq[i][3]);\n }\n // calculate matrix of minors\n const mom = [];\n for (let i = 0; i < 3; i += 1) {\n const row = [];\n for (let j = 0; j < 3; j += 1) {\n const sq = [];\n for (let x = 0; x < 3; x += 1) {\n for (let y = 0; y < 3; y += 1) {\n if (x !== i && y !== j) sq.push(a[x][y]);\n }\n }\n const det = determinant(sq);\n row.push(det);\n }\n mom.push(row);\n }\n // calculate matrix of cofactors\n const moc = [[mom[0][0], -mom[0][1], mom[0][2]],\n [-mom[1][0], mom[1][1], -mom[1][2]],\n [mom[2][0], -mom[2][1], mom[2][2]]];\n // adjugate matrix of cofactors \n const amoc = [[moc[0][0], moc[1][0], moc[2][0]],\n [moc[0][1], moc[1][1], moc[2][1]],\n [moc[0][2], moc[1][2], moc[2][2]]]; \n // find determinant of a\n const a1 = determinant([a[1][1], a[1][2], a[2][1], a[2][2]]);\n const a2 = determinant([a[1][0], a[1][2], a[2][0], a[2][2]]);\n const a3 = determinant([a[1][0], a[1][1], a[2][0], a[2][1]]);\n const aDet = a[0][0] * a1 - a[0][1] * a2 + a[0][2] * a3;\n const aInv = [];\n for (let i = 0; i < 3; i += 1) {\n const row = [];\n for (let j = 0; j < 3; j += 1) {\n row.push(1/aDet * amoc[i][j]);\n }\n aInv.push(row);\n }\n // multiply inverse of matrix a by matrix b\n return [Math.round(aInv[0][0] * b[0] + aInv[0][1] * b[1] + aInv[0][2] * b[2]),\n Math.round(aInv[1][0] * b[0] + aInv[1][1] * b[1] + aInv[1][2] * b[2]),\n Math.round(aInv[2][0] * b[0] + aInv[2][1] * b[1] + aInv[2][2] * b[2])];\n}", "function det3d(A) {\n var col1 = A[0] * (A[4] * A[8] - A[5] * A[7]);\n var col2 = A[1] * (A[3] * A[8] - A[5] * A[6]);\n var col3 = A[2] * (A[3] * A[7] - A[4] * A[6]);\n return col1 - col2 + col3;\n}", "function calculateDifficult(matrix, equalities){\n var determinant,\n answer = [],\n inverse = [];\n\n determinant = determinantForThree(matrix);\n inverse = findAdjugate(matrix);\n\n\n inverse = inverse.map(function(row){\n row = row.map(function(col){\n return col / determinant;\n });\n return row;\n });\n\n answer = multiply(inverse, equalities);\n\n return answer;\n}", "function inverse(a)\n{\n var inv = [];\n var temp2 = [];\n var determinant = detRec(a);\n\n //Check if the matrix even has an inverse (determinant != 0)\n if(determinant == 0)\n {\n return 0;\n }\n\n //Get the cofactor matrix\n for (var i =0; i < a.length; i++)\n {\n for (var j =0; j < a[0].length; j++)\n {\n //Find the determinant at each index\n var temp = detRemove(a, i, j);\n var det = detRec(temp) * Math.pow(-1, (j+i));\n temp2.push(det);\n }\n //Push row to inverse matrix\n inv.push(temp2);\n temp2 = [];\n }\n\n //Transpose the cofactor matrix\n inv = transpose(inv);\n\n //Multiply by the 1/determinant\n for (var i = 0; i < inv.length; i++)\n {\n for (var j = 0; j < inv[0].length; j++)\n {\n var num = inv[i][j];\n var multiple = 1;\n var det = determinant;\n\n //Convert float to a fraction\n if(isFloat(num))\n {\n num *= 1;\n num = num.toFixed(3)\n multiple = toInt(num);\n }\n\n if(isFloat(det))\n {\n det = det.toFixed(3);\n multiple *= toInt(det);\n }\n\n num *= multiple;\n det *= multiple;\n\n //Reduce the fraction num/det\n inv[i][j] = reduceFraction(num, det);\n }\n }\n\n return inv;\n}", "function calculateEasy(matrix, equalities){\n\n var determinant,\n answer = [],\n inverse = [];\n\n // Find Determinant Of 2X2 Matrix\n determinant = determinantForTwo(matrix);\n\n // Find the inverse matrix by multiplying given matrix by 1/determinant\n inverse.push([ matrix[1][1]/determinant, -matrix[0][1]/determinant ]);\n inverse.push([ -matrix[1][0]/determinant, matrix[0][0]/determinant ]);\n\n // Find solution of system by multiplying inverse matrix on equalities' matrix(numbers without variable),\n // This contains plain math - 2X2 matrix multiplication on 2X1 one\n // Result will be a matrix of solutions for the system\n answer.push(inverse[0][0] * equalities[0] + inverse[0][1] * equalities[1]);\n answer.push(inverse[1][0] * equalities[0] + inverse[1][1] * equalities[1]);\n\n // Round answers to nearest hundredth\n answer[0] = answer[0].toFixed(3); //Math.round(answer[0]*100)/100;\n answer[1] = answer[1].toFixed(3);\n\n\n return answer;\n}", "determinantMat4(mat) {\n // Cache the matrix values (makes for huge speed increases!)\n const a00 = mat[0];\n\n const a01 = mat[1];\n const a02 = mat[2];\n const a03 = mat[3];\n const a10 = mat[4];\n const a11 = mat[5];\n const a12 = mat[6];\n const a13 = mat[7];\n const a20 = mat[8];\n const a21 = mat[9];\n const a22 = mat[10];\n const a23 = mat[11];\n const a30 = mat[12];\n const a31 = mat[13];\n const a32 = mat[14];\n const a33 = mat[15];\n return a30 * a21 * a12 * a03 - a20 * a31 * a12 * a03 - a30 * a11 * a22 * a03 + a10 * a31 * a22 * a03 +\n a20 * a11 * a32 * a03 - a10 * a21 * a32 * a03 - a30 * a21 * a02 * a13 + a20 * a31 * a02 * a13 +\n a30 * a01 * a22 * a13 - a00 * a31 * a22 * a13 - a20 * a01 * a32 * a13 + a00 * a21 * a32 * a13 +\n a30 * a11 * a02 * a23 - a10 * a31 * a02 * a23 - a30 * a01 * a12 * a23 + a00 * a31 * a12 * a23 +\n a10 * a01 * a32 * a23 - a00 * a11 * a32 * a23 - a20 * a11 * a02 * a33 + a10 * a21 * a02 * a33 +\n a20 * a01 * a12 * a33 - a00 * a21 * a12 * a33 - a10 * a01 * a22 * a33 + a00 * a11 * a22 * a33;\n }", "function inverse(inmat) { \n\t\n\tvar mat = flatten(inmat);\n\n\t// Cache the matrix values (makes for huge speed increases!)\n\tvar a00 = mat[0], a01 = mat[1], a02 = mat[2], a03 = mat[3];\n\tvar a10 = mat[4], a11 = mat[5], a12 = mat[6], a13 = mat[7];\n\tvar a20 = mat[8], a21 = mat[9], a22 = mat[10], a23 = mat[11];\n\tvar a30 = mat[12], a31 = mat[13], a32 = mat[14], a33 = mat[15];\n\t\n\tvar b00 = a00*a11 - a01*a10;\n\tvar b01 = a00*a12 - a02*a10;\n\tvar b02 = a00*a13 - a03*a10;\n\tvar b03 = a01*a12 - a02*a11;\n\tvar b04 = a01*a13 - a03*a11;\n\tvar b05 = a02*a13 - a03*a12;\n\tvar b06 = a20*a31 - a21*a30;\n\tvar b07 = a20*a32 - a22*a30;\n\tvar b08 = a20*a33 - a23*a30;\n\tvar b09 = a21*a32 - a22*a31;\n\tvar b10 = a21*a33 - a23*a31;\n\tvar b11 = a22*a33 - a23*a32;\n\t\n\t// Calculate the determinant (inlined to avoid double-caching)\n\tvar invDet = 1/(b00*b11 - b01*b10 + b02*b09 + b03*b08 - b04*b07 + b05*b06);\n\tvar dest = [];\n\t\n\tdest[0] = (a11*b11 - a12*b10 + a13*b09)*invDet;\n\tdest[1] = (-a01*b11 + a02*b10 - a03*b09)*invDet;\n\tdest[2] = (a31*b05 - a32*b04 + a33*b03)*invDet;\n\tdest[3] = (-a21*b05 + a22*b04 - a23*b03)*invDet;\n\tdest[4] = (-a10*b11 + a12*b08 - a13*b07)*invDet;\n\tdest[5] = (a00*b11 - a02*b08 + a03*b07)*invDet;\n\tdest[6] = (-a30*b05 + a32*b02 - a33*b01)*invDet;\n\tdest[7] = (a20*b05 - a22*b02 + a23*b01)*invDet;\n\tdest[8] = (a10*b10 - a11*b08 + a13*b06)*invDet;\n\tdest[9] = (-a00*b10 + a01*b08 - a03*b06)*invDet;\n\tdest[10] = (a30*b04 - a31*b02 + a33*b00)*invDet;\n\tdest[11] = (-a20*b04 + a21*b02 - a23*b00)*invDet;\n\tdest[12] = (-a10*b09 + a11*b07 - a12*b06)*invDet;\n\tdest[13] = (a00*b09 - a01*b07 + a02*b06)*invDet;\n\tdest[14] = (-a30*b03 + a31*b01 - a32*b00)*invDet;\n\tdest[15] = (a20*b03 - a21*b01 + a22*b00)*invDet;\n\t\n\treturn transpose(mat4(dest));\n}", "function solve3(\n a = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]], //!< [in] Matix\n b = [0.0, 0.0, 0.0] //!< [in,out] Right hand side vector\n)\n{\n let i = 0;\n let det = 0.0, c = [0.0, 0.0, 0.0];\n /**/\n det = a[0][0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1])\n + a[0][1] * (a[1][2] * a[2][0] - a[1][0] * a[2][2])\n + a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0]);\n /**/\n c[0] = b[0] * (a[1][1] * a[2][2] - a[1][2] * a[2][1])\n + b[1] * (a[0][2] * a[2][1] - a[0][1] * a[2][2])\n + b[2] * (a[0][1] * a[1][2] - a[0][2] * a[1][1]);\n /**/\n c[1] = b[0] * (a[1][2] * a[2][0] - a[1][0] * a[2][2])\n + b[1] * (a[0][0] * a[2][2] - a[0][2] * a[2][0])\n + b[2] * (a[0][2] * a[1][0] - a[0][0] * a[1][2]);\n /**/\n c[2] = b[0] * (a[1][0] * a[2][1] - a[1][1] * a[2][0])\n + b[1] * (a[0][1] * a[2][0] - a[0][0] * a[2][1])\n + b[2] * (a[0][0] * a[1][1] - a[0][1] * a[1][0]);\n /**/\n for (i = 0; i<3; ++i) b[i] = c[i] / det;\n return det;\n}", "function matrixDiagonalsDiff_alt(matrix) {\n let diagonal1 = 0, diagonal2 = 0;\n\n for (var i = 0; i < matrix.length; i++) {\n for (var j = 0; j < matrix.length; j++) {\n // Get elements for the main diagonal (diagonal-1). So I need to increment the i and j equally\n if ( i === j ) {\n diagonal1 += matrix[i][j];\n }\n // Get elements for the secondary diagonal (diagonal-2). So I need to decrement j. Taking the value of the inner array from reverse (i.e. last element comes first)\n if ( j = (matrix.length) - i - 1) {\n diagonal2 += matrix[i][j];\n }\n }\n }\n return Math.abs(diagonal1 - diagonal2);\n}", "function createDetMatrix() {\r\n var answerString = \"\";\r\n var output = document.getElementById(\"DetMatrix\");\r\n var table = document.getElementById(\"matrixForDeterminant\");\r\n for (var r = 0, n = table.rows.length; r < n; r++) {\r\n if (r >= 1) {\r\n var strLength = answerString.length;\r\n answerString = (answerString.slice(0, strLength - 1));\r\n answerString += \"\\\\\\\\\";\r\n }\r\n for (var c = 0, n = table.rows.length; c < n; c++) {\r\n var rowId = r + 1;\r\n var colId = c + 1;\r\n var Cell = document.getElementById(\"a\" + rowId + colId).value;\r\n var str = Cell;\r\n var pos = str.indexOf(\"/\");\r\n var minuspos = Cell.indexOf(\"-\")\r\n if (Cell.charAt(minuspos) === \"-\" && Cell.charAt(pos) === \"/\") {\r\n var str2 = str.replace(\"-\", \"\");\r\n var start = str2.slice(0, pos - 1);\r\n start = \"\\\\frac {\" + start + \"}\";\r\n var end = Cell;\r\n var afterSlash = str.substr(str.indexOf(\"/\") + 1);\r\n end = \"{\" + afterSlash + \"}\";\r\n var fractionbracketstart = \"(-\";\r\n var fractionbracketend = \")\" + \"&\";\r\n var fractionbracket = fractionbracketstart + start + end + fractionbracketend;\r\n answerString += fractionbracket;\r\n } else if (Cell.charAt(pos) === \"/\") {\r\n var stringLength = Cell.length;\r\n var String1 = Cell;\r\n var start = str.slice(0, pos);\r\n start = \"\\\\frac {\" + start + \"}\";\r\n var end = Cell;\r\n var afterSlash = str.substr(str.indexOf(\"/\") + 1);\r\n end = \"{\" + afterSlash + \"}&\";\r\n Cell = start + end;\r\n answerString += Cell;\r\n } else if (Cell.charAt(0) === \"-\") {\r\n Cell = \"(\" + Cell + \")\" + \"&\";\r\n answerString += Cell;\r\n } else {\r\n var Cell = document.getElementById(\"a\" + rowId + colId).value + \"&\";\r\n answerString += Cell;\r\n }\r\n }\r\n }\r\n var strLength = answerString.length;\r\n answerString = (answerString.slice(0, strLength - 1));\r\n return answerString;\r\n}", "function det2d(u, v)\r\n{\r\n return u[0]*v[1] - u[1]*v[0];\r\n}", "determinant() {\n return (\n this.a00*this.adj(0, 0)\n +this.a01*this.adj(0, 1)\n +this.a02*this.adj(0, 2)\n +this.a03*this.adj(0, 3)\n );\n }", "function maximumProductOfDiagonals(matrix){\n let maximum = Number.MIN_VALUE; //setting maximum to lowest possible value\n let i, j, product1, product2;\n let rows = matrix.length,\n cols = matrix[0].length;\n for( i=0 ; i<rows ; i++ ){\n for( j=0 ; j< cols ; j++ ){//iterating through matrix\n if((j+3)<cols && (i+3)<rows){//if element have 4 adjacent values along positive diagonal, find product\n product1 = matrix[i][j] * matrix[i][j+1] * matrix[i][j+2] * matrix[i][j+3] ;\n //debugging console.log(`${matrix[i][j]}*${matrix[i][j+1]}*${matrix[i][j+2]}*${matrix[i][j+3]} = ${product1}\\n`);\n }\n if((i-3) > -1 && (j-3) > -1){//if element has 4 adjacent values along negative diagonal ,find product\n product2 = matrix[i][j] * matrix[i+1][j] * matrix[i+2][j] * matrix[i+3][j] ;\n //debugging console.log(`${matrix[i][j]}*${matrix[i+1][j]}*${matrix[i+2][j]}*${matrix[i+3][j]} = ${product2}\\n`);\n }\n //set maximum to max of product1,product2 and itself\n if(product1>product2){\n if(product1 > maximum){\n maximum = product1;\n }\n }\n else{\n if(product2 > maximum){\n maximum = product2;\n }\n }\n // debugging console.log(maximum);\n }\n }\n return maximum;//finally returning maximum\n}", "function inverseOfMatrix(matrix1, n, adj) {\r\n var sign = 1;\r\n var temp = new Array(n); // temp is used to store cofactors\r\n var det = determinantOfMatrix(matrix1, n);\r\n for (var i = 0; i < n; i++) {\r\n temp[i] = new Array(n);\r\n }\r\n if (n == 1) {\r\n adj[0][0] = 1;\r\n return;\r\n }\r\n for (var i = 0; i < n; i++) {\r\n for (var j = 0; j < n; j++) {\r\n getCofactor(matrix1, temp, i, j, n);\r\n // sign is negative if sum of row\r\n // and column indexes is odd.\r\n if ((i + j) % 2 != 0) {\r\n sign = -1;\r\n } else {\r\n sign = 1;\r\n }\r\n // Interchanging rows and columns to get the\r\n // transpose of the cofactor matrix\r\n adj[j][i] = (sign) * (determinantOfMatrix(temp, n - 1));\r\n }\r\n }\r\n for (var i = 0; i < n; i++) {\r\n for (var j = 0; j < n; j++) {\r\n temp[i][j] = adj[i][j] / (det);\r\n }\r\n }\r\n return temp;\r\n}", "function LU_decomposition(m1) {\n var n = m1.length;\n var i,j,k;\n var l_matrix = [];\n var u_matrix = [];\n for (i = 0; i < n; i++){\n l_matrix[i] = [];\n u_matrix[i] = [];\n }\n for (i = 0; i < n; i++){\n for (j = 0; j < n; j++){\n if (j < i){\n l_matrix[j][i] = 0;\n }\n else{\n l_matrix[j][i] = m1[j][i];\n for (k = 0; k < i; k++){\n l_matrix[j][i] = l_matrix[j][i] - l_matrix[j][k] * u_matrix[k][i];\n }\n }\n }\n for (j = 0; j < n; j++){\n if (j == i){\n u_matrix[i][j] = 1;\n }\n else if (j < i){\n u_matrix[i][j] = 0;\n }\n else{\n u_matrix[i][j] = m1[i][j] / l_matrix[i][i];\n for (k = 0; k < i; k++){\n u_matrix[i][j] = u_matrix[i][j] - l_matrix[i][k] * u_matrix[k][j] / l_matrix[i][i];\n }\n }\n }\n }\n return {\n l_matrix: l_matrix,\n u_matrix: u_matrix\n };\n}", "function diagonalDifference(matrix) {\n\tlet total = 0;\n\tlet total2 = 0;\n\tlet num = 0;\n\tif (matrix.length % 2 !== 0) {\n\t\t//console.log(matrix.length);\n\t\tfor (let i = 3; i < 50; i++) {\n\t\t\tif (matrix.length % i === 0) {\n\t\t\t\tfor (let j = 0; j < matrix.length; j=j+(i+1)) {\n\t\t\t\t\ttotal += matrix[j];\n\t\t\t\t}\n\t\t\t\tfor (let j = i-1; j < matrix.length-(i-(i-1)); j=j+(i-1)) {\n\t\t\t\t\ttotal2 += matrix[j];\t\t\n\t\t\t\t}\n\t\t\t\treturn Math.abs(total-total2);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tconsole.log(\"The sum of diagonals can not be done\");\n\t}\n}", "function disManhattan(){\n var posY = 0;\n var posX = 0;\n for(var i = 0; i < matriz.length; i++){\n for(var j = 0; j < matriz[i].length; j++){\n if(matriz[i][j].final == true){\n posY = i;\n posX = j;\n }\n }\n }\n\n for(var i = 0; i < matriz.length; i++){\n for(var j = 0; j < matriz[i].length; j++){\n matriz[i][j].manhattan[0] = Math.abs(posY - i);\n matriz[i][j].manhattan[1] = Math.abs(posX - j);\n matriz[i][j].manhattan[2] = matriz[i][j].manhattan[0] + matriz[i][j].manhattan[1];\n suma = Math.pow(matriz[i][j].manhattan[0], 2) + Math.pow(matriz[i][j].manhattan[1], 2);\n matriz[i][j].euclidiana = Math.sqrt(suma).toFixed(2);\n }\n }\n\n\n }", "function resolveMatriz(){\n\tvar matriz = \n\t\t\t\t[[0,0,0,0,0,0,0,0,0],\n\t\t\t\t[0,0,0,0,0,0,0,0,0],\n\t\t\t\t[0,0,0,0,0,0,0,0,0],\n\t\t\t\t[0,0,0,0,0,0,0,0,0],\n\t\t\t\t[0,0,0,0,0,0,0,0,0],\n\t\t\t\t[0,0,0,0,0,0,0,0,0],\n\t\t\t\t[0,0,0,0,0,0,0,0,0],\n\t\t\t\t[0,0,0,0,0,0,0,0,0],\n\t\t\t\t[0,0,0,0,0,0,0,0,0]];\n\n\tvar nivel = parseInt($(\"#nivel\").val());\n\tvar k = parseInt($(\"#k\").val());\n\tvar i,j;\n\n\tswitch(nivel){\n\t\tcase 1: //fácil\n\t\t\tif (k == 1)\n\t\t\t\tmatriz = \n\t\t\t\t\t[[1,9,5,4,6,7,2,3,8],\n\t\t\t\t\t[4,2,8,3,5,1,7,9,6],\n\t\t\t\t\t[6,3,7,9,2,8,1,4,5],\n\t\t\t\t\t[7,1,6,8,9,4,5,2,3],\n\t\t\t\t\t[9,4,3,5,1,2,6,8,7],\n\t\t\t\t\t[8,5,2,7,3,6,9,1,4],\n\t\t\t\t\t[2,7,4,1,8,5,3,6,9],\n\t\t\t\t\t[5,6,9,2,4,3,8,7,1],\n\t\t\t\t\t[3,8,1,6,7,9,4,5,2]];\n\t\t\tif (k == 2)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[8,5,3,7,6,9,2,4,1],\n\t\t\t\t\t[7,4,9,2,8,1,3,6,5],\n\t\t\t\t\t[6,2,1,5,3,4,8,7,9],\n\t\t\t\t\t[9,8,2,6,4,3,5,1,7],\n\t\t\t\t\t[4,6,7,1,5,2,9,3,8],\n\t\t\t\t\t[3,1,5,8,9,7,6,2,4],\n\t\t\t\t\t[2,9,4,3,1,5,7,8,6],\n\t\t\t\t\t[5,7,6,4,2,8,1,9,3],\n\t\t\t\t\t[1,3,8,9,7,6,4,5,2]];\n\t\t\tif (k == 3)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[9,1,4,2,3,8,6,5,7],\n\t\t\t\t\t[2,5,8,6,1,7,4,3,9],\n\t\t\t\t\t[3,7,6,5,4,9,2,1,8],\n\t\t\t\t\t[5,8,9,3,2,1,7,6,4],\n\t\t\t\t\t[6,2,7,9,5,4,3,8,1],\n\t\t\t\t\t[1,4,3,7,8,6,5,9,2],\n\t\t\t\t\t[8,6,2,1,7,3,9,4,5],\n\t\t\t\t\t[4,9,5,8,6,2,1,7,3],\n\t\t\t\t\t[7,3,1,4,9,5,8,2,6]];\n\t\t\tif (k == 4)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[5,3,6,8,1,2,4,7,9],\n\t\t\t\t\t[1,7,4,6,9,5,8,3,2],\n\t\t\t\t\t[9,2,8,3,7,4,6,5,1],\n\t\t\t\t\t[7,4,1,9,5,6,2,8,3],\n\t\t\t\t\t[3,9,2,7,8,1,5,6,4],\n\t\t\t\t\t[6,8,5,4,2,3,1,9,7],\n\t\t\t\t\t[2,1,9,5,6,7,3,4,8],\n\t\t\t\t\t[8,5,3,1,4,9,7,2,6],\n\t\t\t\t\t[4,6,7,2,3,8,9,1,5]];\n\t\t\tif (k == 5)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[5,3,4,6,2,7,9,8,1],\n\t\t\t\t\t[9,6,2,1,5,8,4,3,7],\n\t\t\t\t\t[7,8,1,9,3,4,2,6,5],\n\t\t\t\t\t[6,4,5,7,8,3,1,2,9],\n\t\t\t\t\t[3,1,7,2,6,9,8,5,4],\n\t\t\t\t\t[8,2,9,4,1,5,3,7,6],\n\t\t\t\t\t[4,9,3,5,7,2,6,1,8],\n\t\t\t\t\t[1,5,8,3,9,6,7,4,2],\n\t\t\t\t\t[2,7,6,8,4,1,5,9,3]];\n\t\t\tif (k == 6)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[2,1,4,7,8,6,3,5,9],\n\t\t\t\t\t[7,9,8,3,4,5,2,1,6],\n\t\t\t\t\t[6,3,5,2,9,1,4,7,8],\n\t\t\t\t\t[1,5,3,8,6,2,9,4,7],\n\t\t\t\t\t[4,2,7,9,1,3,8,6,5],\n\t\t\t\t\t[8,6,9,4,5,7,1,3,2],\n\t\t\t\t\t[9,7,6,1,2,4,5,8,3],\n\t\t\t\t\t[5,4,2,6,3,8,7,9,1],\n\t\t\t\t\t[3,8,1,5,7,9,6,2,4]];\n\t\t\tif (k == 7)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[2,3,1,8,5,7,6,9,4],\n\t\t\t\t\t[6,8,7,1,9,4,2,3,5],\n\t\t\t\t\t[9,4,5,6,3,2,1,8,7],\n\t\t\t\t\t[8,2,9,4,6,1,7,5,3],\n\t\t\t\t\t[1,6,4,5,7,3,8,2,9],\n\t\t\t\t\t[5,7,3,2,8,9,4,1,6],\n\t\t\t\t\t[4,9,6,3,1,8,5,7,2],\n\t\t\t\t\t[3,5,8,7,2,6,9,4,1],\n\t\t\t\t\t[7,1,2,9,4,5,3,6,8]];\n\t\t\tif (k == 8)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[8,7,2,9,4,1,5,6,3],\n\t\t\t\t\t[6,5,1,3,7,8,9,4,2],\n\t\t\t\t\t[3,9,4,2,5,6,7,8,1],\n\t\t\t\t\t[2,3,5,1,8,7,4,9,6],\n\t\t\t\t\t[9,6,8,4,3,5,1,2,7],\n\t\t\t\t\t[4,1,7,6,2,9,8,3,5],\n\t\t\t\t\t[5,8,9,7,6,3,2,1,4],\n\t\t\t\t\t[7,4,3,8,1,2,6,5,9],\n\t\t\t\t\t[1,2,6,5,9,4,3,7,8]];\n\t\t\tif (k == 9)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[6,7,1,3,8,4,2,9,5],\n\t\t\t\t\t[9,5,4,6,2,1,7,3,8],\n\t\t\t\t\t[8,2,3,9,5,7,1,6,4],\n\t\t\t\t\t[7,4,6,5,3,2,9,8,1],\n\t\t\t\t\t[2,9,5,1,4,8,6,7,3],\n\t\t\t\t\t[3,1,8,7,9,6,5,4,2],\n\t\t\t\t\t[1,3,9,8,6,5,4,2,7],\n\t\t\t\t\t[4,8,7,2,1,9,3,5,6],\n\t\t\t\t\t[5,6,2,4,7,3,8,1,9]];\n\t\t\tif (k == 10)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[2,1,9,8,7,5,6,3,4],\n\t\t\t\t\t[3,6,4,1,9,2,8,7,5],\n\t\t\t\t\t[7,8,5,6,3,4,9,2,1],\n\t\t\t\t\t[6,2,3,5,4,9,1,8,7],\n\t\t\t\t\t[8,4,1,2,6,7,5,9,3],\n\t\t\t\t\t[9,5,7,3,8,1,4,6,2],\n\t\t\t\t\t[5,7,8,4,2,6,3,1,9],\n\t\t\t\t\t[1,9,6,7,5,3,2,4,8],\n\t\t\t\t\t[4,3,2,9,1,8,7,5,6]];\n\t\t\tbreak;\n\t\tcase 2: //médio\n\t\t\tif (k == 1)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[8,5,9,7,3,6,1,2,4],\n\t\t\t\t\t[6,2,4,9,1,5,7,3,8],\n\t\t\t\t\t[3,1,7,4,2,8,9,5,6],\n\t\t\t\t\t[4,9,5,2,8,1,3,6,7],\n\t\t\t\t\t[7,6,3,5,4,9,2,8,1],\n\t\t\t\t\t[1,8,2,3,6,7,5,4,9],\n\t\t\t\t\t[9,3,6,8,7,2,4,1,5],\n\t\t\t\t\t[5,4,8,1,9,3,6,7,2],\n\t\t\t\t\t[2,7,1,6,5,4,8,9,3]];\n\t\t\tif (k == 2)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[5,1,7,9,2,8,3,6,4],\n\t\t\t\t\t[6,8,4,3,5,1,2,7,9],\n\t\t\t\t\t[9,2,3,4,7,6,5,1,8],\n\t\t\t\t\t[8,9,5,2,1,4,7,3,6],\n\t\t\t\t\t[3,7,2,6,8,5,4,9,1],\n\t\t\t\t\t[1,4,6,7,9,3,8,2,5],\n\t\t\t\t\t[2,5,8,1,3,9,6,4,7],\n\t\t\t\t\t[4,3,9,5,6,7,1,8,2],\n\t\t\t\t\t[7,6,1,8,4,2,9,5,3]];\n\t\t\tif (k == 3)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[8,2,7,1,6,5,9,3,4],\n\t\t\t\t\t[3,5,9,4,7,8,6,1,2],\n\t\t\t\t\t[1,6,4,9,3,2,7,5,8],\n\t\t\t\t\t[9,8,2,6,5,1,4,7,3],\n\t\t\t\t\t[5,7,1,3,2,4,8,9,6],\n\t\t\t\t\t[4,3,6,8,9,7,1,2,5],\n\t\t\t\t\t[6,4,3,5,1,9,2,8,7],\n\t\t\t\t\t[2,1,8,7,4,3,5,6,9],\n\t\t\t\t\t[7,9,5,2,8,6,3,4,1]];\n\t\t\tif (k == 4)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[4,6,9,5,3,2,8,1,7],\n\t\t\t\t\t[2,5,1,8,6,7,9,4,3],\n\t\t\t\t\t[7,8,3,9,4,1,6,2,5],\n\t\t\t\t\t[5,2,4,7,8,9,3,6,1],\n\t\t\t\t\t[8,3,6,4,1,5,7,9,2],\n\t\t\t\t\t[9,1,7,3,2,6,5,8,4],\n\t\t\t\t\t[6,7,8,2,5,4,1,3,9],\n\t\t\t\t\t[1,4,5,6,9,3,2,7,8],\n\t\t\t\t\t[3,9,2,1,7,8,4,5,6]];\n\t\t\tif (k == 5)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[6,5,1,9,7,4,3,8,2],\n\t\t\t\t\t[4,9,8,3,1,2,6,5,7],\n\t\t\t\t\t[3,7,2,5,8,6,9,4,1],\n\t\t\t\t\t[1,3,5,7,2,9,8,6,4],\n\t\t\t\t\t[8,4,6,1,3,5,7,2,9],\n\t\t\t\t\t[7,2,9,6,4,8,5,1,3],\n\t\t\t\t\t[9,8,4,2,5,3,1,7,6],\n\t\t\t\t\t[5,6,7,4,9,1,2,3,8],\n\t\t\t\t\t[2,1,3,8,6,7,4,9,5]];\n\t\t\tif (k == 6)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[4,7,9,1,6,8,5,3,2],\n\t\t\t\t\t[1,6,2,5,3,9,8,7,4],\n\t\t\t\t\t[3,5,8,7,2,4,9,6,1],\n\t\t\t\t\t[8,4,5,9,7,6,2,1,3],\n\t\t\t\t\t[2,9,6,3,4,1,7,5,8],\n\t\t\t\t\t[7,3,1,8,5,2,4,9,6],\n\t\t\t\t\t[9,2,4,6,1,5,3,8,7],\n\t\t\t\t\t[6,8,3,2,9,7,1,4,5],\n\t\t\t\t\t[5,1,7,4,8,3,6,2,9]];\n\t\t\tif (k == 7)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[7,4,9,1,2,5,3,8,6],\n\t\t\t\t\t[2,5,1,6,8,3,9,4,7],\n\t\t\t\t\t[3,8,6,4,9,7,1,5,2],\n\t\t\t\t\t[8,1,7,2,5,6,4,3,9],\n\t\t\t\t\t[5,2,4,7,3,9,8,6,1],\n\t\t\t\t\t[9,6,3,8,1,4,2,7,5],\n\t\t\t\t\t[4,3,2,5,6,1,7,9,8],\n\t\t\t\t\t[6,9,8,3,7,2,5,1,4],\n\t\t\t\t\t[1,7,5,9,4,8,6,2,3]];\n\t\t\tif (k == 8)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[2,6,4,5,9,8,1,7,3],\n\t\t\t\t\t[1,5,3,4,7,2,9,6,8],\n\t\t\t\t\t[8,9,7,1,6,3,2,4,5],\n\t\t\t\t\t[5,8,9,2,1,6,4,3,7],\n\t\t\t\t\t[4,3,6,7,5,9,8,1,2],\n\t\t\t\t\t[7,1,2,8,3,4,5,9,6],\n\t\t\t\t\t[9,7,1,3,8,5,6,2,4],\n\t\t\t\t\t[3,4,5,6,2,1,7,8,9],\n\t\t\t\t\t[6,2,8,9,4,7,3,5,1]];\n\t\t\tif (k == 9)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[7,9,5,4,8,2,3,6,1],\n\t\t\t\t\t[3,8,6,9,7,1,2,5,4],\n\t\t\t\t\t[4,1,2,3,6,5,8,7,9],\n\t\t\t\t\t[2,5,7,8,1,9,4,3,6],\n\t\t\t\t\t[8,3,4,7,5,6,9,1,2],\n\t\t\t\t\t[1,6,9,2,4,3,7,8,5],\n\t\t\t\t\t[5,4,3,1,2,8,6,9,7],\n\t\t\t\t\t[9,7,1,6,3,4,5,2,8],\n\t\t\t\t\t[6,2,8,5,9,7,1,4,3]];\n\t\t\tif (k == 10)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[5,2,9,1,8,3,6,4,7],\n\t\t\t\t\t[1,8,6,5,4,7,9,3,2],\n\t\t\t\t\t[3,7,4,9,6,2,1,5,8],\n\t\t\t\t\t[9,6,8,2,3,5,7,1,4],\n\t\t\t\t\t[7,5,1,8,9,4,2,6,3],\n\t\t\t\t\t[2,4,3,6,7,1,8,9,5],\n\t\t\t\t\t[8,3,2,4,1,9,5,7,6],\n\t\t\t\t\t[4,9,5,7,2,6,3,8,1],\n\t\t\t\t\t[6,1,7,3,5,8,4,2,9]];\n\n\t\t\tbreak;\n\t\tcase 3: //difícil\n\t\t\tif (k == 1)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[7,2,3,9,6,1,8,4,5],\n\t\t\t\t\t[1,4,8,7,5,2,6,9,3],\n\t\t\t\t\t[9,5,6,3,8,4,2,7,1],\n\t\t\t\t\t[5,8,2,4,3,7,9,1,6],\n\t\t\t\t\t[6,1,4,2,9,5,7,3,8],\n\t\t\t\t\t[3,9,7,8,1,6,4,5,2],\n\t\t\t\t\t[2,3,5,6,4,9,1,8,7],\n\t\t\t\t\t[4,6,1,5,7,8,3,2,9],\n\t\t\t\t\t[8,7,9,1,2,3,5,6,4]];\n\t\t\tif (k == 2)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[4,9,6,5,3,2,8,7,1],\n\t\t\t\t\t[2,5,1,8,6,7,3,4,9],\n\t\t\t\t\t[8,7,3,1,9,4,6,5,2],\n\t\t\t\t\t[9,1,2,6,4,3,5,8,7],\n\t\t\t\t\t[5,6,4,7,8,1,9,2,3],\n\t\t\t\t\t[7,3,8,2,5,9,4,1,6],\n\t\t\t\t\t[6,8,7,9,1,5,2,3,4],\n\t\t\t\t\t[3,2,9,4,7,8,1,6,5],\n\t\t\t\t\t[1,4,5,3,2,6,7,9,8]];\n\t\t\tif (k == 3)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[1,8,2,4,3,5,7,9,6],\n\t\t\t\t\t[4,9,7,6,2,8,1,3,5],\n\t\t\t\t\t[6,3,5,7,9,1,8,2,4],\n\t\t\t\t\t[5,4,1,3,8,6,9,7,2],\n\t\t\t\t\t[7,6,3,9,5,2,4,1,8],\n\t\t\t\t\t[8,2,9,1,4,7,6,5,3],\n\t\t\t\t\t[2,7,4,8,1,3,5,6,9],\n\t\t\t\t\t[9,5,6,2,7,4,3,8,1],\n\t\t\t\t\t[3,1,8,5,6,9,2,4,7]];\n\t\t\tif (k == 4)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[4,6,1,5,9,3,2,8,7],\n\t\t\t\t\t[9,7,2,8,4,1,6,3,5],\n\t\t\t\t\t[5,8,3,2,7,6,1,9,4],\n\t\t\t\t\t[6,4,9,7,5,2,8,1,3],\n\t\t\t\t\t[1,3,5,6,8,4,9,7,2],\n\t\t\t\t\t[7,2,8,3,1,9,4,5,6],\n\t\t\t\t\t[2,1,6,9,3,5,7,4,8],\n\t\t\t\t\t[3,9,7,4,2,8,5,6,1],\n\t\t\t\t\t[8,5,4,1,6,7,3,2,9]];\n\t\t\tif (k == 5)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[9,8,3,2,7,4,1,6,5],\n\t\t\t\t\t[1,6,4,8,5,9,3,7,2],\n\t\t\t\t\t[7,5,2,1,3,6,4,8,9],\n\t\t\t\t\t[5,9,7,6,4,2,8,3,1],\n\t\t\t\t\t[2,3,1,5,8,7,9,4,6],\n\t\t\t\t\t[6,4,8,9,1,3,5,2,7],\n\t\t\t\t\t[3,7,6,4,9,1,2,5,8],\n\t\t\t\t\t[8,2,9,3,6,5,7,1,4],\n\t\t\t\t\t[4,1,5,7,2,8,6,9,3]];\n\t\t\tif (k == 6)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[1,4,7,5,8,6,2,3,9],\n\t\t\t\t\t[6,8,3,2,7,9,5,1,4],\n\t\t\t\t\t[2,5,9,3,1,4,7,8,6],\n\t\t\t\t\t[4,1,5,6,9,3,8,7,2],\n\t\t\t\t\t[7,2,8,1,4,5,6,9,3],\n\t\t\t\t\t[3,9,6,7,2,8,4,5,1],\n\t\t\t\t\t[5,6,4,9,3,7,1,2,8],\n\t\t\t\t\t[9,7,1,8,6,2,3,4,5],\n\t\t\t\t\t[8,3,2,4,5,1,9,6,7]];\n\t\t\tif (k == 7)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[1,4,6,8,3,9,2,7,5],\n\t\t\t\t\t[3,7,5,4,2,6,9,8,1],\n\t\t\t\t\t[8,2,9,1,7,5,4,3,6],\n\t\t\t\t\t[9,6,2,5,4,8,3,1,7],\n\t\t\t\t\t[4,8,3,9,1,7,5,6,2],\n\t\t\t\t\t[5,1,7,3,6,2,8,9,4],\n\t\t\t\t\t[2,5,1,7,9,3,6,4,8],\n\t\t\t\t\t[6,9,4,2,8,1,7,5,3],\n\t\t\t\t\t[7,3,8,6,5,4,1,2,9]];\n\t\t\tif (k == 8)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[4,1,2,8,3,5,7,9,6],\n\t\t\t\t\t[9,7,8,4,6,2,3,1,5],\n\t\t\t\t\t[3,6,5,9,1,7,4,8,2],\n\t\t\t\t\t[5,9,3,1,4,6,2,7,8],\n\t\t\t\t\t[6,8,4,7,2,3,9,5,1],\n\t\t\t\t\t[7,2,1,5,8,9,6,3,4],\n\t\t\t\t\t[8,5,6,3,9,4,1,2,7],\n\t\t\t\t\t[2,3,7,6,5,1,8,4,9],\n\t\t\t\t\t[1,4,9,2,7,8,5,6,3]];\n\t\t\tif (k == 9)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[1,8,4,2,3,7,9,6,5],\n\t\t\t\t\t[3,5,2,9,4,6,1,8,7],\n\t\t\t\t\t[6,9,7,5,1,8,3,4,2],\n\t\t\t\t\t[9,6,8,7,5,3,4,2,1],\n\t\t\t\t\t[4,1,5,8,6,2,7,3,9],\n\t\t\t\t\t[2,7,3,1,9,4,6,5,8],\n\t\t\t\t\t[8,3,9,6,7,5,2,1,4],\n\t\t\t\t\t[5,4,1,3,2,9,8,7,6],\n\t\t\t\t\t[7,2,6,4,8,1,5,9,3]];\n\t\t\tif (k == 10)\n\t\t\t\tmatriz =\n\t\t\t\t\t[[3,7,9,5,1,8,6,2,4],\n\t\t\t\t\t[6,1,4,9,2,3,7,8,5],\n\t\t\t\t\t[2,5,8,6,7,4,3,1,9],\n\t\t\t\t\t[1,4,7,8,5,9,2,6,3],\n\t\t\t\t\t[8,2,6,3,4,1,9,5,7],\n\t\t\t\t\t[5,9,3,7,6,2,8,4,1],\n\t\t\t\t\t[4,6,1,2,9,7,5,3,8],\n\t\t\t\t\t[9,8,2,4,3,5,1,7,6],\n\t\t\t\t\t[7,3,5,1,8,6,4,9,2]];\n\t\t\tbreak;\n\t}\n\n\tfor (i = 1; i <= 9; i++){\n\t\tfor (j = 1; j <= 9; j++){\n\t\t\t$(\"#\" + i + \"x\" + j).val(matriz[i-1][j-1]);\n\t\t}\n\t}\n}", "function diags(mat){\n \"use strict\";\n var res, fun = function(loc){\n\treturn ( mat[loc[0]][loc[1]] );\n };\n res = [[[0,0],[1,1],[2,2]].map(fun),\n\t [[0,2],[1,1],[2,0]].map(fun)];\n return( res ); \n}", "function determinant(v1, v2) {\n return v1.getX()*v2.getY() - v1.getY()*v2.getX();\n }", "chequearDiagonalDesc(ficha) {\n let cont = 1;\n if(ficha.getColUbicada() > 0 && ficha.getFilUbicada() < this.fila - 1) {\n cont += this.izqArriba(ficha);\n }\n if(ficha.getColUbicada() < this.columna - 1 && ficha.getFilUbicada() > 0) {\n cont += this.derAbajo(ficha);\n }\n return cont;\n }", "function generateMatrix() {\r\n generateMatrixForDeterminant();\r\n}", "function inverse(A){\n var qr = JSON.parse(JSON.stringify(A))\n var m = qr.length\n var n = qr[0].length\n var rdiag = new Array(n);\n var i, j, k, s;\n var X = new Array(m).fill(0).map(_ => new Array(m).fill(0))\n for(let i =0; i<m;i++) X[i][i] = 1.0\n\n for (k = 0; k < n; k++) {\n var nrm = 0;\n for (i = k; i < m; i++) nrm =hypotenuse(nrm, qr[i][k])\n if (nrm !== 0) {\n if (qr[k][k] < 0) nrm = -nrm\n for (i = k; i < m; i++) qr[i][k] /= nrm;\n qr[k][k] +=1 \n for (j = k + 1; j < n; j++) {\n s = 0;\n for (i = k; i < m; i++) s += qr[i][k] * qr[i][j];\n s = -s / qr[k][k];\n for (i = k; i < m; i++) qr[i][j] += s * qr[i][k] ;\n }\n }\n rdiag[k] = -nrm;\n }\n\n let count = X[0].length;\n\n for (k = 0; k < n; k++) {\n for (j = 0; j < count; j++) {\n s = 0;\n for (i = k; i < m; i++) s += qr[i][k] * X[i][j];\n s = -s / qr[k][k];\n for (i = k; i < m; i++) X[i][j] += s*qr[i][k]\n }\n }\n for (k = n - 1; k >= 0; k--) {\n for (j = 0; j < count; j++) X[k][j] /= rdiag[k] \n for (i = 0; i < k; i++) {\n for (j = 0; j < count; j++) X[i][j] -=X[k][j]*qr[i][k]\n }\n }\n return X\n}", "function invert(out, a) {\n\tconst a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n\t\ta10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n\t\ta20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n\t\ta30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\t\tb00 = a00 * a11 - a01 * a10,\n\t\tb01 = a00 * a12 - a02 * a10,\n\t\tb02 = a00 * a13 - a03 * a10,\n\t\tb03 = a01 * a12 - a02 * a11,\n\t\tb04 = a01 * a13 - a03 * a11,\n\t\tb05 = a02 * a13 - a03 * a12,\n\t\tb06 = a20 * a31 - a21 * a30,\n\t\tb07 = a20 * a32 - a22 * a30,\n\t\tb08 = a20 * a33 - a23 * a30,\n\t\tb09 = a21 * a32 - a22 * a31,\n\t\tb10 = a21 * a33 - a23 * a31,\n\t\tb11 = a22 * a33 - a23 * a32\n\n\t// Calculate the determinant.\n\tlet d = b00 * b11 -\n\t\tb01 * b10 +\n\t\tb02 * b09 +\n\t\tb03 * b08 -\n\t\tb04 * b07 +\n\t\tb05 * b06\n\n\tif (!d) {\n\t\treturn\n\t}\n\n\td = 1 / d\n\n\tout[0] = (a11 * b11 - a12 * b10 + a13 * b09) * d\n\tout[1] = (a02 * b10 - a01 * b11 - a03 * b09) * d\n\tout[2] = (a31 * b05 - a32 * b04 + a33 * b03) * d\n\tout[3] = (a22 * b04 - a21 * b05 - a23 * b03) * d\n\tout[4] = (a12 * b08 - a10 * b11 - a13 * b07) * d\n\tout[5] = (a00 * b11 - a02 * b08 + a03 * b07) * d\n\tout[6] = (a32 * b02 - a30 * b05 - a33 * b01) * d\n\tout[7] = (a20 * b05 - a22 * b02 + a23 * b01) * d\n\tout[8] = (a10 * b10 - a11 * b08 + a13 * b06) * d\n\tout[9] = (a01 * b08 - a00 * b10 - a03 * b06) * d\n\tout[10] = (a30 * b04 - a31 * b02 + a33 * b00) * d\n\tout[11] = (a21 * b02 - a20 * b04 - a23 * b00) * d\n\tout[12] = (a11 * b07 - a10 * b09 - a12 * b06) * d\n\tout[13] = (a00 * b09 - a01 * b07 + a02 * b06) * d\n\tout[14] = (a31 * b01 - a30 * b03 - a32 * b00) * d\n\tout[15] = (a20 * b03 - a21 * b01 + a22 * b00) * d\n}", "function matrix(n) {\n\n// USSR\n// Understand\n // reword - given a number, return an evenly-spiraled matrix \n // inputs - integer\n // outputs - arrays of arrays of integers\n // examples - see above\n// Sudo Chop\n // create empty array of arrays of integers 'results'\n let results = []\n for (let i = 0; i < n; i++) {\n results.push([])\n }\n // create a counter variable that starts at one\n let counter = 1\n // create start and end rows and columns\n let startRow = 0\n let startColumn = 0\n let endRow = n - 1\n let endColumn = n - 1\n // if start column <= end column AND start row <= end row\n while (startColumn <= endColumn && startRow <= endRow) {\n // loop from start column to end column for top row of matrix\n for (i = startColumn; i <= endColumn; i++) {\n // assign counter variable at results[start row][i]\n results[startRow][i] = counter\n // increment counter\n counter++\n }\n // increment start row\n startRow++\n // loop from start row to end row for right column of matrix\n for (i = startRow; i <= endRow; i++) {\n // assign counter variable at results[i][end column]\n results[i][endColumn] = counter\n // increment counter\n counter++\n }\n // decrement end column\n endColumn--\n // repeat for bottom row\n for (let i = endColumn; i >= startColumn; i--) {\n results[endRow][i] = counter\n counter++\n }\n endRow--\n // repeat for start column\n for (let i = endRow; i >= startRow; i--) {\n results[i][startColumn] = counter\n counter++\n }\n startColumn++\n }\n return results\n// Solve / Skip\n// Refactor\n\n}", "function det(p0, p1, p2) {\n return (.5) * (p1.x * p2.y - p1.y * p2.x - p0.x * p2.y + p0.y * p2.x + p0.x * p1.y - p0.y * p1.x);\n }", "function DiagonalEsquerda(tabuleiro){\n var x = new Array(MAX);\n for(var i = 0; i < MAX; i++) {\n x[i]= tabuleiro[i][i];\n }\n return x;\n}// fim da diagonalesquerda***************************************************************", "function laplacian_and_mass_matrices( faces, vertices )\n{\n /// 1 Create an N-by-N matrix A, where N is the number of vertices, that is initially zero.\n /// 2 Iterate over all edges (i,j), setting a 1 at the corresponding (i,j) and (j,i) location in A.\n /// 3 Create an N-by-N diagonal Mass matrix, where the i-th diagonal is the sum of the i-th row of A.\n /// 4 The Laplacian matrix is inverse( Mass )*(Mass - A). In other words,\n /// it is (Mass-A) followed by dividing each row by its diagonal element.\n \n /// Add your code here.\n //1\n\t\n\tvar A = []\n\tfor(var i = 0; i<vertices.length ; i++){\n\t\tA[i]=[];\n\t\tfor(var j = 0; j<vertices.length ; j++){\n\t\t\tA[i][j] = 0;\n\t\t}\n\t}\n\t//2\n\tfor(var f = 0 ; f<faces.length; f++){\n\t\tvar v1 = faces[f][0];\n\t\tvar v2 = faces[f][1];\n\t\tvar v3 = faces[f][2];\n\t\t\n\t\tA[v1][v2] = 1;\n\t\tA[v2][v1] = 1;\n\t\tA[v2][v3] = 1;\n\t\tA[v3][v2] = 1;\n\t\tA[v1][v3] = 1;\n\t\tA[v3][v1] = 1;\n\t}\t\n\t//3\n\tvar M = []\n\tfor(var i = 0; i<vertices.length ; i++){\n\t\tM[i] = [];\n\t\tfor(var j = 0; j<vertices.length ; j++){\n\t\t\tM[i][j] = 0;\n\t\t}\n\t}\n\t\n\t\n\tvar temp = [];\n\tfor(var i = 0; i<vertices.length ; i++){\n\t\tvar sum = 0;\n\t\tfor(var j = 0; j<vertices.length ; j++){\n\t\t\t\tsum = numeric.add(sum, A[i][j]);\n\t\t\t\ttemp[i] = sum ;\n\t\t}\n\t}\n\t\n\tM = numeric.diag(temp);\n\t\n\t//4\n\tvar L = [];\n\tfor(var i = 0; i<vertices.length ; i++){\n\t\tL[i] = [];\n\t\tfor(var j = 0; j<vertices.length ; j++){\n\t\t\tL[i][j] = 0;\n\t\t}\n\t}\n\t\n\tL = numeric.ccsFull(numeric.ccsDot(numeric.ccsSparse(numeric.inv(M)),numeric.ccsSparse(numeric.sub(M,A))));\n\treturn [ L , M ]; \n\n}", "function Eight(){\nlet matrix = arguments[0]\n\nlet max = flattener(matrix)\n\nfunction flattener(){\n let param = arguments[0]\n return param.reduce((acc,val)=>\n acc.concat(Array.isArray(val)?flattener(val):val)\n ,[])\n }\nconsole.log(max.sort((a,b)=>b-a)[0]);\n}", "function diagonalDifference(arr) {\r\n // Write your code here\r\n//console.log(arr);\r\nlet s = 0;\r\nlet ls =0;\r\nlet rs =0;\r\nfor (let i = 0; i < arr.length; i++) {\r\n for (let j = 0; j < arr.length; j++) {\r\n if(i==j)\r\n ls = ls +arr[i][j];\r\n if ((i+j) == arr.length-1)\r\n rs = rs+ arr[i][j];\r\n }\r\n}\r\ns = ls -rs;\r\nif (s<0)\r\n s = s*-1;\r\nreturn s;\r\n}", "function invertMatrix(matrix) {\n const [[a, c, dx], [b, d, dy], ..._] = matrix;\n \n const det = a*d - b*c; \n\n if (dx || dy) {\n // Affine\n return [\n [ d/det, -c/det, (c*dy-d*dx)/det ],\n [ -b/det, a/det, (b*dx-a*dy)/det ],\n [ 0, 0, 1 ]\n ]\n } else {\n // Linear\n return [\n [ d/det, -c/det ],\n [ -b/det, a/det ] \n ]\n }\n}", "function diagonalAttack(arr) {\n let matrix=[];\n\n arr.forEach(row => {\n let rowToArr = row.split(' ').map(x=>Number(x));\n matrix.push(rowToArr);\n })\n\n let diagoalIndexRow =0;\n let diagonalIndexCol = 0;\n let diaFirstSum =0;\n\n let diagoalIndexRowSecond =0;\n let diagonalIndexColSecond = matrix[0].length-1;\n let diaSumSecond =0;\n matrix.forEach((row,index) => {\n \n diaFirstSum += matrix[diagoalIndexRow][diagonalIndexCol];\n \n diaSumSecond+= matrix[diagoalIndexRowSecond][diagonalIndexColSecond];\n \n diagoalIndexRow++;\n diagonalIndexCol++;\n\n diagoalIndexRowSecond++;\n diagonalIndexColSecond--;\n });\n\n\n diagoalIndexRow =0;\n diagonalIndexCol = 0;\n \n diagoalIndexRowSecond =0;\n diagonalIndexColSecond = matrix[0].length-1;\n \n if (diaFirstSum!==diaSumSecond) {\n matrix.forEach(row => {\n console.log(row.join(' '));\n });\n }else{\n let res=[];\n matrix.forEach((row,indexRow) => {\n \n let rowRes = row.map((x,i)=>x=(i!==diagonalIndexCol)&&(i!==diagonalIndexColSecond)?diaFirstSum:x);\n \n res.push(rowRes);\n\n diagoalIndexRow++;\n diagonalIndexCol++;\n\n diagoalIndexRowSecond++;\n diagonalIndexColSecond--;\n });\n\n res.forEach(row => {\n console.log(row.join(' '));\n });\n }\n}", "function inverse(matrix) {\n var result = new Array(16);\n var m00 = matrix[0 * 4 + 0];\n var m01 = matrix[0 * 4 + 1];\n var m02 = matrix[0 * 4 + 2];\n var m03 = matrix[0 * 4 + 3];\n var m10 = matrix[1 * 4 + 0];\n var m11 = matrix[1 * 4 + 1];\n var m12 = matrix[1 * 4 + 2];\n var m13 = matrix[1 * 4 + 3];\n var m20 = matrix[2 * 4 + 0];\n var m21 = matrix[2 * 4 + 1];\n var m22 = matrix[2 * 4 + 2];\n var m23 = matrix[2 * 4 + 3];\n var m30 = matrix[3 * 4 + 0];\n var m31 = matrix[3 * 4 + 1];\n var m32 = matrix[3 * 4 + 2];\n var m33 = matrix[3 * 4 + 3];\n var tmp_0 = m22 * m33;\n var tmp_1 = m32 * m23;\n var tmp_2 = m12 * m33;\n var tmp_3 = m32 * m13;\n var tmp_4 = m12 * m23;\n var tmp_5 = m22 * m13;\n var tmp_6 = m02 * m33;\n var tmp_7 = m32 * m03;\n var tmp_8 = m02 * m23;\n var tmp_9 = m22 * m03;\n var tmp_10 = m02 * m13;\n var tmp_11 = m12 * m03;\n var tmp_12 = m20 * m31;\n var tmp_13 = m30 * m21;\n var tmp_14 = m10 * m31;\n var tmp_15 = m30 * m11;\n var tmp_16 = m10 * m21;\n var tmp_17 = m20 * m11;\n var tmp_18 = m00 * m31;\n var tmp_19 = m30 * m01;\n var tmp_20 = m00 * m21;\n var tmp_21 = m20 * m01;\n var tmp_22 = m00 * m11;\n var tmp_23 = m10 * m01;\n var t0 = tmp_0 * m11 + tmp_3 * m21 + tmp_4 * m31 - (tmp_1 * m11 + tmp_2 * m21 + tmp_5 * m31);\n var t1 = tmp_1 * m01 + tmp_6 * m21 + tmp_9 * m31 - (tmp_0 * m01 + tmp_7 * m21 + tmp_8 * m31);\n var t2 = tmp_2 * m01 + tmp_7 * m11 + tmp_10 * m31 - (tmp_3 * m01 + tmp_6 * m11 + tmp_11 * m31);\n var t3 = tmp_5 * m01 + tmp_8 * m11 + tmp_11 * m21 - (tmp_4 * m01 + tmp_9 * m11 + tmp_10 * m21);\n var d = 1.0 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n result[0] = d * t0;\n result[1] = d * t1;\n result[2] = d * t2;\n result[3] = d * t3;\n result[4] = d * (tmp_1 * m10 + tmp_2 * m20 + tmp_5 * m30 - (tmp_0 * m10 + tmp_3 * m20 + tmp_4 * m30));\n result[5] = d * (tmp_0 * m00 + tmp_7 * m20 + tmp_8 * m30 - (tmp_1 * m00 + tmp_6 * m20 + tmp_9 * m30));\n result[6] = d * (tmp_3 * m00 + tmp_6 * m10 + tmp_11 * m30 - (tmp_2 * m00 + tmp_7 * m10 + tmp_10 * m30));\n result[7] = d * (tmp_4 * m00 + tmp_9 * m10 + tmp_10 * m20 - (tmp_5 * m00 + tmp_8 * m10 + tmp_11 * m20));\n result[8] = d * (tmp_12 * m13 + tmp_15 * m23 + tmp_16 * m33 - (tmp_13 * m13 + tmp_14 * m23 + tmp_17 * m33));\n result[9] = d * (tmp_13 * m03 + tmp_18 * m23 + tmp_21 * m33 - (tmp_12 * m03 + tmp_19 * m23 + tmp_20 * m33));\n result[10] = d * (tmp_14 * m03 + tmp_19 * m13 + tmp_22 * m33 - (tmp_15 * m03 + tmp_18 * m13 + tmp_23 * m33));\n result[11] = d * (tmp_17 * m03 + tmp_20 * m13 + tmp_23 * m23 - (tmp_16 * m03 + tmp_21 * m13 + tmp_22 * m23));\n result[12] = d * (tmp_14 * m22 + tmp_17 * m32 + tmp_13 * m12 - (tmp_16 * m32 + tmp_12 * m12 + tmp_15 * m22));\n result[13] = d * (tmp_20 * m32 + tmp_12 * m02 + tmp_19 * m22 - (tmp_18 * m22 + tmp_21 * m32 + tmp_13 * m02));\n result[14] = d * (tmp_18 * m12 + tmp_23 * m32 + tmp_15 * m02 - (tmp_22 * m32 + tmp_14 * m02 + tmp_19 * m12));\n result[15] = d * (tmp_22 * m22 + tmp_16 * m02 + tmp_21 * m12 - (tmp_20 * m12 + tmp_23 * m22 + tmp_17 * m02));\n return result;\n}", "inverseMat4(mat, dest) {\n if (!dest) {\n dest = mat;\n }\n\n // Cache the matrix values (makes for huge speed increases!)\n const a00 = mat[0];\n\n const a01 = mat[1];\n const a02 = mat[2];\n const a03 = mat[3];\n const a10 = mat[4];\n const a11 = mat[5];\n const a12 = mat[6];\n const a13 = mat[7];\n const a20 = mat[8];\n const a21 = mat[9];\n const a22 = mat[10];\n const a23 = mat[11];\n const a30 = mat[12];\n const a31 = mat[13];\n const a32 = mat[14];\n const a33 = mat[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n\n // Calculate the determinant (inlined to avoid double-caching)\n const invDet = 1 / (b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06);\n\n dest[0] = (a11 * b11 - a12 * b10 + a13 * b09) * invDet;\n dest[1] = (-a01 * b11 + a02 * b10 - a03 * b09) * invDet;\n dest[2] = (a31 * b05 - a32 * b04 + a33 * b03) * invDet;\n dest[3] = (-a21 * b05 + a22 * b04 - a23 * b03) * invDet;\n dest[4] = (-a10 * b11 + a12 * b08 - a13 * b07) * invDet;\n dest[5] = (a00 * b11 - a02 * b08 + a03 * b07) * invDet;\n dest[6] = (-a30 * b05 + a32 * b02 - a33 * b01) * invDet;\n dest[7] = (a20 * b05 - a22 * b02 + a23 * b01) * invDet;\n dest[8] = (a10 * b10 - a11 * b08 + a13 * b06) * invDet;\n dest[9] = (-a00 * b10 + a01 * b08 - a03 * b06) * invDet;\n dest[10] = (a30 * b04 - a31 * b02 + a33 * b00) * invDet;\n dest[11] = (-a20 * b04 + a21 * b02 - a23 * b00) * invDet;\n dest[12] = (-a10 * b09 + a11 * b07 - a12 * b06) * invDet;\n dest[13] = (a00 * b09 - a01 * b07 + a02 * b06) * invDet;\n dest[14] = (-a30 * b03 + a31 * b01 - a32 * b00) * invDet;\n dest[15] = (a20 * b03 - a21 * b01 + a22 * b00) * invDet;\n\n return dest;\n }", "function solve_system2(mi, mj, d) {\n const det = mi[0] * mj[1] - mi[1] * mj[0]\n if(Math.abs(det) <= 1e-8) return\n\n // perform the division by determinant later for speed\n const inv = [mj[1], -mi[1], -mj[0], mi[0]]\n return v2_divs(m2_mulv(inv, d), det)\n}", "function getMatrixDiagonal(matrix, pos_y, pos_x, max_y, max_x) {\n // console.log(matrix, pos_y, pos_x, max_y, max_x)\n let step = 0;\n const res = [];\n while(pos_y + step < max_y && pos_x + step < max_x) {\n res.push(matrix[pos_y + step][pos_x + step]);\n step = step + 1;\n }\n return res;\n}", "function solve(args) { // много добро решение за 100 точки\n var dimensions = args[0].split(' ').map(Number);\n\n var matrix = new Array(dimensions[0]);\n for (var i = 0; i < dimensions[0]; i += 1) {\n matrix[i] = args[i + 1].split(' ').map(Number);\n\n for (var j = 0; j < dimensions[1]; j += 1) {\n matrix[i][j] = getBin(matrix[i][j]);\n }\n }\n\n var startRow = dimensions[0] / 2 | 0,\n startCol = dimensions[1] / 2 | 0;\n\n while (true) {\n var storedRow = startRow,\n storedCol = startCol;\n\n if (matrix[startRow][startCol][3] === '1' && matrix[startRow - 1][startCol] !== '0') {\n startRow -= 1;\n } else if (matrix[startRow][startCol][2] === '1' && matrix[startRow][startCol + 1] !== '0') {\n startCol += 1\n } else if (matrix[startRow][startCol][1] === '1' && matrix[startRow + 1][startCol] !== '0') {\n startRow += 1;\n } else if (matrix[startRow][startCol][0] === '1' && matrix[startRow][startCol - 1] !== '0') {\n startCol -= 1\n } else {\n console.log('No JavaScript, only rakiya ' + storedRow + ' ' + storedCol)\n break;\n }\n\n if (startCol === 0 || startCol === dimensions[1] - 1 || startRow === 0 || startRow === dimensions[0] - 1) {\n console.log('No rakiya, only JavaScript ' + startRow + ' ' + startCol);\n break;\n }\n matrix[storedRow][storedCol] = '0'; // маркираме си с нула клетките, в който вече сме били!!!\n }\n\n function getBin(number) {\n var bin = '000' + number.toString(2);\n return bin.substr(bin.length - 4, 4)\n }\n}", "function JacobianInverse_svdcmp(J){\n var debug = 0;\n var Dx = {}; //diagnostic\n \n //var dim = size(J);\n //var m = dim[0]; //matrix rank - number of independent rows (number of rows)\n //var n = dim[1]; //number of columns\n var m; var n;\n [m,n] = [J.length,J[0].length];\n if(debug) console.log('m: ' + m + ', n: ' + n);\n\n var Jnull = [];\n for(var j=0;j<m;j=j+1){\n var rowData = [];\n for(var k=0;k<n;k=k+1){\n rowData.push(J[j][k]);\n }\n Jnull.push(rowData);\n }\n if(debug) console.log('Jnull:');\n if(debug) printJacobian(Jnull);\n \n // - adjust matrix for inversion\n for(var j=0;j<m;j=j+1){ //For each row of Jnull[] add an extra element '0.0' to the beginning of the array (beginning of the row).\n Jnull[j].unshift(0.0);\n }\n // - create an array of zeroes (row vector)\n var offsetRow = [];\n for(var j=0;j<(n+1);j=j+1){\n offsetRow.push(0.0);\n }\n Jnull.unshift(offsetRow); //add the row vector of zeroes to the beginning of Jnull[] array - now a 7 x 7 matrix\n\n //if(debug) console.log(size(Jnull));\n if(debug) console.log('Jnull adjusted:');\n if(debug) printJacobian(Jnull);\n\n var w = hlao.zeros_vector((n+1),'row'); //row vector where index = 0 is undefined\n var v = hlao.zeros_matrix((n+1),(n+1)); //matrix\n var uwv = svdcmp.svdcmp(Jnull, m, n, w, v);\n //if(debug) console.log(uwv);\n\n var U = svdcmp.svdClean(uwv[0]); //Drop the first element in the array as it is zero.\n var S = svdcmp.svdClean(uwv[1]); //W\n var V = svdcmp.svdClean(uwv[2]);\n if(debug){\n console.log('U:');\n print_multi_array(U);\n console.log('S (' + S.length + '):');\n print_multi_array(S);\n console.log('V:');\n print_multi_array(V);\n }\n \n //run diagnostics\n // - Get the singular values (positive or zero).\n var w = uwv[1]; //IMPORTANT: this also alters 'S'\n //w.shift(); // Drop the first element in the array as it is zero. IMPORTANT: not required due to 'S' using 'svdClean()'\n if(debug) console.log('W = ' + w);\n\n // - Get the rank.\n Dx.rank = hlao.matrix_rank(w);\n if(debug) console.log('Matrix rank = ' + Dx.rank);\n \n // - Get the condition number of the matrix.\n Dx.w_min = +1e6;\n Dx.w_max = -1e6;\n for(var j=0;j<w.length;j=j+1){\n if(Dx.w_max < w[j]) Dx.w_max = w[j];\n if((Dx.w_min > w[j]) && (w[j] > 1e-6)) Dx.w_min = w[j]; // w_min must be non zero.\n }\n Dx.cond_numb = Dx.w_max/Dx.w_min;\n if(debug){\n console.log('sigma 1 = ' + Dx.w_max);\n console.log('sigma r = ' + Dx.w_min);\n console.log('Matrix condition number = ' + Dx.cond_numb);\n //if(cond_numb > 900.0) alert('Condition number: ' + Dx.cond_numb);\n }\n \n //Calc. inverse\n var diag = [];\n var TOL = 1e-12; //Tolerance for the evaluation of 'S'.\n if(debug) console.log('S (' + S.length + '):');\n for(var i=0;i<S.length;i=i+1){ //IMPORTANT: Magic number.\n if(Math.abs(S[i]) > (0.0 + TOL)) diag[i] = 1.0/S[i];\n else diag[i] = 0.0;\n }\n if(debug) console.log(diag);\n /*\n var Sinv = [ //IMPORTANT: fix magic number.\n [diag[0], 0.0, 0.0, 0.0, 0.0, 0.0],\n [ 0.0, diag[1], 0.0, 0.0, 0.0, 0.0],\n [ 0.0, 0.0, diag[2], 0.0, 0.0, 0.0],\n [ 0.0, 0.0, 0.0, diag[3], 0.0, 0.0],\n [ 0.0, 0.0, 0.0, 0.0, diag[4], 0.0],\n [ 0.0, 0.0, 0.0, 0.0, 0.0, diag[5]]\n ];\n */\n var Sinv = hlao.identity_matrix(S.length);\n for(var i=0;i<S.length;i=i+1){\n Sinv[i][i] = diag[i];\n }\n if(debug) console.log(Sinv);\n \n var Jinv = hlao.matrix_multiplication(\n hlao.matrix_multiplication(\n V,Sinv\n ),\n hlao.matrix_transpose(U)\n );\n if(debug){\n console.log('(J)-1:');\n print_multi_array(Jinv);\n }\n \n //return matrix_multiplication(U,matrix_transpose(V));\n return([Jinv,Dx]);\n}", "function diagonalDifference(a) {\n // Complete this function\n let dimensionsForward = a.length - 1;\n let forwards = 0;\n let backwards = 0;\n\n for(var i = 0; i < a.length; i++){\n // console.log(a[i,dimensionsForward],\"a[i,dimensionsForward]\")\n forwards += a[i][dimensionsForward];\n dimensionsForward--\n }\n\n for(var j = 0; j < a.length; j++){\n backwards += a[j][j];\n }\n return Math.abs(forwards - backwards);\n}", "diagonal(diagonal_num,filler) {\r\n if((diagonal_num != undefined && typeof diagonal_num != \"number\") || (filler != undefined && typeof filler != \"number\")) {\r\n console.log(Matrix.wrong_type_error_message());\r\n return null;\r\n }\r\n this.data = this.data.map((rows,main_index) => {\r\n return rows.map((cols,sub_index) => {\r\n return (sub_index === main_index) ? (diagonal_num || 1) : (filler || 0);\r\n });\r\n });\r\n }", "function diagonalDifference(arr) {\n // Write your code here\n var hor = 0;\n var ver = 0;\n\n var len = arr[0].length;\n for (var i = 0; i < len; i++) {\n hor += arr[i][i];\n \n ver += arr[i][len - i];\n }\n \n if (hor < ver)\n return hor - ver;\n else return ver - hor;\n}", "function desviacionEstandarMuestra(array) {\n\t\t\tlet desviacionEstandar = varianzaMuestra(array) ** (1/2);\n\t\t\treturn desviacionEstandar;\n\t\t}", "function tutteTest(M)\n{\n\tif (M.length == 0) {\n\t\talert(\"The cost matrix is empty!\");\n\t\treturn;\n\t}\t\n\n\t//console.log(time_t++);\n\n\tfor (var k = 0; k < 5; k++) {\n\t\tvar M_t = [];\n\t\tfor (var i = 0; i < M.length; i++) {\n\t\t\tM_t.push([]);\n\t\t\tfor (var j = 0; j < M[i].length; j++) {\n\t\t\t\tM_t[i].push(0);\n\t\t\t\tif (M[i][j] != 0) M_t[i][j] = Math.random();\n\t\t\t}\n\t\t}\n\t\tif (determinant(M_t) != 0) return 1;\n\t}\n\n\treturn 0;\n}", "function inverseMatrix(Am){\r\n\tvar B = copyArray(Am);\r\n\tB[3]=[1,0,0];\r\n\tB[4]=[0,1,0];\r\n\tB[5]=[0,0,1];\r\n\tvar m = [[1,2],[0,1],[1,2],[1,0],[2,1],[1,0]];\r\n\tvar r = [0,0,1,2,2,1];\r\n\tvar it = 0;\r\n\tfor(it=0;it<m.length;it++){\r\n\t\tvar val = -B[r[it]][m[it][1]] / B[r[it]][m[it][0]];\r\n\t\tvar jt = 0;\r\n\t\tfor(jt=0;jt<B.length;jt++){\r\n\t\t\tB[jt][m[it][1]] = B[jt][m[it][1]] + val * B[jt][m[it][0]];\r\n\t\t\t//alert(B[jt][m[it][1]]);\r\n\t\t}\r\n\t}\r\n\tvar i = 0;\r\n\tvar div = new Array();\r\n\tfor(i=0;i<3;i++){\r\n\t\tdiv[i] = B[i][i]; \r\n\t}\r\n\ti=0;\r\n\tfor(i=0;i<B.length;i++){\r\n\t\tvar j=0;\r\n\t\tfor(j=0;j<3;j++){\r\n\t\t\tB[i][j] = roundTo(B[i][j]/div[j],6);\r\n\t\t}\r\n\t}\r\n\treturn new Array(B[3],B[4],B[5]);\r\n}", "function checkAndSubmit(x, n) {\n var type = x.datatype(); // type check\n\n if (type === undefined) {\n type = x.getDataType();\n }\n\n if (type !== 'number' && type !== 'BigNumber' && type !== 'Fraction') {\n if (type === 'mixed') {\n throw new TypeError('Mixed matrix element type is not supported');\n } else {\n throw new TypeError('Matrix element type not supported (' + type + ')');\n }\n } else {\n isSymmetric(x.toArray(), n);\n } // perform efficient calculation for 'numbers'\n\n\n if (type === 'number') {\n return diag(x.toArray());\n } else if (type === 'Fraction') {\n var xArr = x.toArray(); // convert fraction to numbers\n\n for (var i = 0; i < n; i++) {\n for (var j = i; j < n; j++) {\n xArr[i][j] = xArr[i][j].valueOf();\n xArr[j][i] = xArr[i][j];\n }\n }\n\n return diag(x.toArray());\n } else if (type === 'BigNumber') {\n return diagBig(x.toArray());\n }\n } // diagonalization implementation for number (efficient)", "function diagonalDifference(arr) {\n //simple edge case checking\n if(!arr || arr.length == 0 || arr.length != arr[0].length) return false;\n //declare and initialize return data template and other variables\n let priSum = 0;\n let secSum = 0;\n let result = 0;\n //loop through the outer array\n for(let i=0; i<arr.length; i++){\n //loop through the inner array\n for(let j=0; j<arr[i].length; j++){\n //for primary diagonal: arr[0][0], arr[1][1], arr[2][2] -> arr[i][j] where i == j\n //sum up for primary diagonal as 'priSum'\n if(i == j) priSum += arr[i][j];\n //for secondary diagonal: arr[0][2], arr[1][1], arr[2][0] -> arr[i][j] where i + j == arr.length - 1 \n //sum up for secondary diagonal as 'secSum'\n if(i + j == arr.length - 1) secSum += arr[i][j];\n }\n }\n // calculate the abs diff of two sums and return it\n result = Math.abs(priSum - secSum);\n return result;\n}", "function diagonalDifference(arr) {\r\n // Write your code here\r\n\r\n let sum = 0;\r\n for(let i=0;i<arr.length;i++){\r\n if( Array.isArray(arr[i]) ){\r\n sum+=arr[i][i];\r\n sum-=arr[i][arr.length-i-1];\r\n }\r\n }\r\n\r\n return Math.abs(sum);\r\n}", "function FC(d, v, row, col){\n var value2 = v[row][col];\n if (value2 == '') {\n return;\n }\n\n var i;\n var j;\n\n //check column\n for (i = 0; i < 9; i++) {\n if (i == row) {\n continue;\n }\n var value = v[i][col];\n if (value) {\n continue;\n }\n var domain = d[i][col];\n var index = domain.indexOf(v[row][col]);\n if (index != -1) {\n domain.splice(index, 1);\n }\n }\n //check row\n for (j = 0; j < 9; j++) {\n if (j == col) {\n continue;\n }\n var value = v[row][j];\n if (value) {\n continue;\n }\n var domain = d[row][j];\n var index = domain.indexOf(v[row][col]);\n if (index != -1) {\n domain.splice(index, 1);\n }\n }\n //check square\n var i_init = (Math.floor(row/3))*3;\n var j_init = (Math.floor(col/3))*3;\n for (i = i_init; i < i_init+3; i++) {\n for (j = j_init; j < j_init+3; j++) {\n if (i == row || j == col) {\n continue;\n }\n var value = v[i][j];\n if (value) {\n continue;\n }\n var domain = d[i][j];\n var index = domain.indexOf(v[row][col]);\n if (index != -1) {\n domain.splice(index, 1);\n }\n }\n }\n}", "function solve(i, j) {\n //check in row, column and sector\n solved[i][j] = setIntersection(aroundNums(i, j), solved[i][j]);\n if (solved[i][j].size == 1) {\n for (let item of solved[i][j]) {\n solved[i][j] = item;\n matrix[i][j] = item;\n }\n //return +1 changes\n return 1;\n }\n return 0;\n }", "function diagonals(matrix){ \n let firstDignal = 0;\n let secDignal = 0; \n for(let i=0; i<matrix.length; i++){ \n for(let z=0; z<matrix.length; z++){ \n if(i === z) { \n firstDignal += matrix[i][z];\n } \n if(i + z === matrix.length - 1){ \n secDignal += matrix[i][z];\n } \n } \n } \n return firstDignal + secDignal;\n }", "function diagonalDiff(arr){\n // declare variables for function\n let dim = arr[0].length;\n let left = 0;\n let right = 0;\n // will need to loop through main array, and nested array\n for(let i = 0, j = (dim - 1); i < dim, j > -1; i++, j--){\n // add values to left_to_right variable: [0][0], [1][1], [2][2]...\n left += arr[i][i];\n // add values to rigth_to_left variable: [0][(last)], [1][(last - 1)], [2][(last - 2)]...\n right += arr[i][j];\n }\n // return the absolute diff of right - left\n return Math.abs(right - left);\n}", "function diagonalAttack(input) {\n let matrix = input.map( row => {\n return row.split(' ').map(el=> +el);\n })\n let mainDiagSum = 0;\n let secDiagSum = 0;\n\n for (let i = 0; i < matrix.length; i++) {\n for (let j = 0; j < matrix[i].length; j++) {\n if( i === j ) {\n mainDiagSum += matrix[i][j];\n }\n if( j === matrix[i].length -1 - i ) {\n secDiagSum += matrix[i][j];\n }\n }\n }\n\n if(mainDiagSum === secDiagSum) {\n matrix.forEach( (row,i) => {\n let curRow = row.map((col,j) => {\n if((i===j) || (j === row.length -1 - i)) {\n return col;\n } else {\n return mainDiagSum;\n }\n });\n console.log(curRow.join(' '));\n })\n } else {\n matrix.forEach(row => {\n console.log(row.join(' '));\n })\n }\n}", "function adjointMatrix(matrix1, n, adj) {\r\n var sign = 1;\r\n var temp = new Array(n); // temp is used to store cofactors\r\n for (var i = 0; i < n; i++) {\r\n temp[i] = new Array(n);\r\n }\r\n if (n == 1) {\r\n adj[0][0] = 1;\r\n return;\r\n }\r\n for (var i = 0; i < n; i++) {\r\n for (var j = 0; j < n; j++) {\r\n getCofactor(matrix1, temp, i, j, n);\r\n // sign is negative if sum of row\r\n // and column indexes is odd.\r\n if ((i + j) % 2 != 0) {\r\n sign = -1;\r\n } else {\r\n sign = 1;\r\n }\r\n // Interchanging rows and columns to get the\r\n // transpose of the cofactor matrix\r\n adj[j][i] = (sign) * (determinantOfMatrix(temp, n - 1));\r\n }\r\n }\r\n return adj;\r\n}", "function getDiferencias(option){\r\n\tvar matriz=new Array();\r\n\tvar F=(2*n-3)+2; //Filas de la Matriz de Diferenciales\r\n\tvar C=(n-1);//Columnas de la Matriz de Diferenciales\r\n\tfor(var i=0;i<F;i++){\r\n\t\tmatriz[i]=new Array();\r\n\t\tfor(var j=0;j<C;j++){\r\n\t\t\tmatriz[i][j]=0;\r\n\t\t}\r\n\t}\r\n\r\n\tvar aux=0;\r\n\tfor(var j=0;j<C;j++){\r\n\t\taux=j;\r\n\t\tfor(var i=j+1;i<F-(j+1);i+=2){\r\n\t\t\tif(j==0){\r\n\t\t\t\tmatriz[i][j]=(ry[aux+1]-ry[aux]).toPrecision(pre);\r\n\t\t\t\taux++;\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tmatriz[i][j]=(matriz[aux+2][j-1]-matriz[aux][j-1]).toPrecision(1);\r\n\t\t\t\taux=aux+2;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tvar flag=true;\r\n\tstringRespuesta = \"<center> <h2>Esquema de Diferenciales Con Operador Central</h2><table border=1><tr>\";\r\n\tfor(var i=0;i<n-1;i++){\r\n\t\tif(i==0){\r\n\t\t\tstringRespuesta+=\"<td>n</td><td>x</td><td>y</td><td>&delta;^\"+(i+1)+\"</td>\";\r\n\t\t}\r\n\t\telse{\r\n\t\t\tstringRespuesta+=\"<td>&delta;^\"+(i+1)+\"</td>\";\r\n\t\t}\r\n\t}\r\n\tstringRespuesta+=\"</tr>\"\r\n\tvar c=0;\r\n\tfor(var i=0;i<F;i++){\r\n\r\n\t\tif(flag){\r\n\t\t\tstringRespuesta+=\"<tr><td>\"+c+\"</td><td>\"+rx[c]+\"</td><td>\"+ry[c]+\"</td>\";\r\n\t\t\tc++;\r\n\t\t\tflag=false;\r\n\t\t}\r\n\t\telse{\r\n\t\t\tstringRespuesta+=\"<tr><td></td><td></td><td></td>\";\r\n\t\t\tflag=true;\r\n\t\t}\r\n\t\tfor(var j=0;j<C;j++){\r\n\t\t\tstringRespuesta+=\"<td>\"+matriz[i][j]+\"</td>\";\r\n\t\t}\r\n\t\tstringRespuesta+=\"</tr>\";\r\n\r\n\t}\r\n\tstringRespuesta+=\"</table><br><br>\";\r\n\tswitch(option){\r\n\t\tcase 1:{gauss1(matriz);break;}\r\n\t\tcase 2:{gauss2(matriz);break;}\r\n\t\tcase 3:{everett(matriz);break;}\r\n\t\tcase 4:{steffensen(matriz);break;}\r\n\t\tcase 10:{operadorCentral(matriz);break;}\r\n\t\tcase 11:{segundaDerivada(matriz);break;}\r\n\t\tcase 12:{everettDer(matriz);break;}\r\n\t\tdefault:{break;}\r\n\r\n\t}\r\n}", "function inverse2(a)\n{\n var determinant = detRec(a);\n\n if(determinant == 0)\n {\n return 0;\n }\n\n var inv = [ [a[1][1], -1 * a[0][1]], [-1 * a[1][0], a[0][0]] ];\n\n for(var i =0; i < inv.length; i++)\n {\n for(var j=0; j < inv[0].length; j++)\n {\n var num = inv[i][j];\n var multiple = 1;\n var det = determinant;\n\n //Convert float to a fraction\n if(isFloat(num))\n {\n num *= 1;\n num = num.toFixed(3)\n multiple *= toInt(num);\n }\n\n if(isFloat(det))\n {\n det = det.toFixed(3);\n multiple *= toInt(det);\n }\n\n num *= multiple;\n det *= multiple;\n\n //Reduce the fraction num/det\n inv[i][j] = reduceFraction(num, det);\n }\n }\n return inv;\n}", "function solveUsingInverseMatrixMethod(variableNames, fullMatrix) {\n //TODO: use variableNames (?)\n\n var m = Matrix.trimRight(fullMatrix.slice(0, fullMatrix.rows(), 0, fullMatrix.cols() - 1));\n var b = fullMatrix.slice(0, fullMatrix.rows(), fullMatrix.cols() - 1, fullMatrix.cols());\n\n var mstr = \"\";\n var c = undefined;\n if (!m.isSquare()) {\n Dialog.alert(i18n.text05);\n return undefined;\n }\n try {\n c = m.inverse();\n } catch (e) {\n if (e instanceof RangeError && e.message.indexOf(\"SingularMatrixException\") === 0) {\n //mstr = i18n.text06;\n } else {\n throw e;\n }\n }\n mstr += \"<h4>\" + Expression.__m__(i18n.solutionByInverseMatrixMethod) + \"</h4>\";\n mstr += \"<div>\";\n mstr += \"<mi>A</mi><mo>&times;</mo><mi>X</mi><mo>=</mo><mi>B</mi>\";\n mstr += \"</div>\";\n mstr += \"<div>\";\n mstr += \"<mi>A</mi><mo>=</mo>\" + printSomething(m);\n mstr += \"</div>\";\n mstr += \"<div>\";\n mstr += \"<mi>B</mi><mo>=</mo>\" + printSomething(b);\n mstr += \"</div>\";\n if (c !== undefined) {\n mstr += \"<div>\";\n mstr += \"<msup><mrow><mi>A</mi></mrow><mrow><mn>-1</mn></mrow></msup><mo>=</mo>\" + printSomething(c);\n mstr += \"</div>\";\n mstr += createDetailsSummary([{type: \"inverse\", matrix: m.toString(), second: undefined}]);\n mstr += \"<mi>X</mi><mo>=</mo><msup><mrow><mi>A</mi></mrow><mrow><mn>-1</mn></mrow></msup><mo>&times;<mi>B</mi><mo>=</mo>\" + printSomething(c) + printSomething(b) + \"<mo>=</mo>\" + printSomething(c.multiply(b));\n } else {\n mstr += i18n.text06;\n mstr += createDetailsSummary([{type: \"inverse\", matrix: m.toString(), second: undefined}]);\n mstr += \"<div class=\\\"for-details\\\"></div>\";\n }\n return mstr;\n}", "function Matrix(m, n, d){\r\n\t\tvar matrix = [];\r\n\t\tfor(var i=0; i<m; i++) {\r\n\t\t\tmatrix[i] = [];\r\n\t\t\tfor(var j=0; j<n; j++) {\r\n\t\t\t\tmatrix[i][j] = d;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn matrix;\r\n\t}", "function gaussianElimination(matrix) {\n const n = matrix.length - 1,\n coef = [];\n\n let i, j, k, r, t;\n\n for (i = 0; i < n; ++i) {\n r = i; // max row\n for (j = i + 1; j < n; ++j) {\n if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) {\n r = j;\n }\n }\n\n for (k = i; k < n + 1; ++k) {\n t = matrix[k][i];\n matrix[k][i] = matrix[k][r];\n matrix[k][r] = t;\n }\n\n for (j = i + 1; j < n; ++j) {\n for (k = n; k >= i; k--) {\n matrix[k][j] -= (matrix[k][i] * matrix[i][j]) / matrix[i][i];\n }\n }\n }\n\n for (j = n - 1; j >= 0; --j) {\n t = 0;\n for (k = j + 1; k < n; ++k) {\n t += matrix[k][j] * coef[k];\n }\n coef[j] = (matrix[n][j] - t) / matrix[j][j];\n }\n\n return coef;\n}", "function gaussianElimination(matrix) {\n var n = matrix.length - 1,\n coef = [];\n var i, j, k, r, t;\n\n for (i = 0; i < n; ++i) {\n r = i; // max row\n\n for (j = i + 1; j < n; ++j) {\n if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) {\n r = j;\n }\n }\n\n for (k = i; k < n + 1; ++k) {\n t = matrix[k][i];\n matrix[k][i] = matrix[k][r];\n matrix[k][r] = t;\n }\n\n for (j = i + 1; j < n; ++j) {\n for (k = n; k >= i; k--) {\n matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i];\n }\n }\n }\n\n for (j = n - 1; j >= 0; --j) {\n t = 0;\n\n for (k = j + 1; k < n; ++k) {\n t += matrix[k][j] * coef[k];\n }\n\n coef[j] = (matrix[n][j] - t) / matrix[j][j];\n }\n\n return coef;\n}", "function getDiagonal(matrix, offset = 0) {\n const diagonal = [];\n for (let i = 0; i < matrix.length; i++) {\n if (matrix[i] && matrix[i][i + offset]) {\n diagonal.push(matrix[i][i + offset])\n } else {\n diagonal.push(null);\n }\n }\n return diagonal;\n}", "static subtraction(m, n)\n {\n let arr = new Synaptic_Matrix(m.rows, m.cols);\n\n\n if (n instanceof Synaptic_Matrix)\n {\n for (let i = 0; i < m.rows; i++)\n {\n for (let j = 0; j < m.cols; j++)\n {\n arr.matrix[i][j] = m.matrix[i][j] - n.matrix[i][j];\n }\n }\n }\n else\n {\n for (let i = 0; i < m.rows; i++)\n {\n for (let j = 0; j < m.cols; j++)\n {\n arr.matrix[i][j] = m.matrix[i][j] - n;\n }\n }\n }\n return arr;\n }", "function gaussianElimination(matrix) {\n var n = matrix.length - 1,\n coef = [];\n var i, j, k, r, t;\n\n for (i = 0; i < n; ++i) {\n r = i; // max row\n\n for (j = i + 1; j < n; ++j) {\n if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) {\n r = j;\n }\n }\n\n for (k = i; k < n + 1; ++k) {\n t = matrix[k][i];\n matrix[k][i] = matrix[k][r];\n matrix[k][r] = t;\n }\n\n for (j = i + 1; j < n; ++j) {\n for (k = n; k >= i; k--) {\n matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i];\n }\n }\n }\n\n for (j = n - 1; j >= 0; --j) {\n t = 0;\n\n for (k = j + 1; k < n; ++k) {\n t += matrix[k][j] * coef[k];\n }\n\n coef[j] = (matrix[n][j] - t) / matrix[j][j];\n }\n\n return coef;\n }", "function DiagonalDireita(tabuleiro) {\n var x = new Array(MAX);\n var ct = MAX -1;\n for(var i = 0; i < MAX; i++) {\n x[i]= tabuleiro[i][ct];\n ct--;\n }\n return x;\n}// fim da função DiagonalDireita*********************************************************", "function eliminarDetalle(indice, idproducto, idlote) {\n\n\tvar datadetalledelete = concatenate(idproducto, idlote, 10);\n\n\t$(\"#fila\" + indice).remove();\n\n\tArray.prototype.compacta = function(){\n\t\tfor(var i = 0; i < this.length; i++){\n\t\t\tif(this[i] === datadetalledelete){\n\t\t\t\t\tthis.splice(i , 1);\n\t\t\t}\n\t\t}\n\t}\n\tcontains.compacta();\n\n\tcalcularTotales();\n\tdetalles = detalles - 1;\n\tevaluar()\n}", "static diagonal(M1,diagonal_num,filler) {\r\n if(!(M1 instanceof Matrix)) {\r\n console.log(Matrix.wrong_type_error_message2());\r\n return null;\r\n }\r\n let M2 = M1.copy();\r\n M2.diagonal(diagonal_num,filler);\r\n return M2;\r\n }", "function Ninth(){\n let matrix = arguments[0]\n let size = matrix[0].length\n\n let diagon1=0,diagon2 = 0\n \n for(let i = 0; i<size; i++){\n diagon1+=matrix[i][i]\n diagon2+=matrix[size-1-i][i]\n }\n\n console.log(diagon1+\" \"+diagon2)\n}", "static decm(yPredicion, yReal) {\n let ypre = Matriz.fromArray(yPredicion);\n let yrea = Matriz.fromArray(yReal);\n let toret = new Matriz(yrea.length, 1);\n toret = Matriz.resta(ypre, yrea);\n return toret;\n }", "function diagonalDifference(arr) {\n\tlet result = 0\n\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tresult += arr[i][i] - arr[arr.length - 1 - i][i]\n\t}\n\treturn Math.abs(result)\n}", "function det_projected_points(p, a, b, c) {\n\tvar M = [ [b.x - a.x, b.y - a.y, (b.x - a.x)*(b.x + a.x) + (b.y - a.y)*(b.y + a.y)],\n\t\t\t\t[c.x - a.x, c.y - a.y, (c.x - a.x)*(c.x + a.x) + (c.y - a.y)*(c.y + a.y)],\n\t\t\t\t[p.x - a.x, p.y - a.y, (p.x - a.x)*(p.x + a.x) + (p.y - a.y)*(p.y + a.y)] ];\n\treturn det(M);\n}", "function DiagonalNeighboursFree(myN, myS, myE, myW, N, S, E, W, result)\n\t{\n\t\tmyN = N > -1;\n\t\tmyS = S < Arachnea.height;\n\t\tmyE = E < Arachnea.width;\n\t\tmyW = W > -1;\n\t\tif(myE)\n\t\t{\n\t\t\tif(myN)\n\t\t\tresult.push({x:E, y:N});\n\t\t\tif(myS)\n\t\t\tresult.push({x:E, y:S});\n\t\t}\n\t\tif(myW)\n\t\t{\n\t\t\tif(myN)\n\t\t\tresult.push({x:W, y:N});\n\t\t\tif(myS)\n\t\t\tresult.push({x:W, y:S});\n\t\t}\n\t}", "function maximumProduct( matrix ){\n let maximum = Number.MIN_VALUE; //setting maximum to lowest possible value\n let i, j, product1, product2;\n let rows = matrix.length,\n cols = matrix[0].length;\n for( i=0 ; i<rows ; i++ ){\n for( j=0 ; j< cols ; j++ ){//iterating through matrix\n if((j+3)<cols){//if element have 4 adjacent along x-axis, find product\n product1 = matrix[i][j] * matrix[i][j+1] * matrix[i][j+2] * matrix[i][j+3] ;\n //debugging console.log(`${matrix[i][j]}*${matrix[i][j+1]}*${matrix[i][j+2]}*${matrix[i][j+3]} = ${product1}\\n`);\n }\n if((i+3)<rows){//if element has 4 adjacent along y-axis ,find product\n product2 = matrix[i][j] * matrix[i+1][j] * matrix[i+2][j] * matrix[i+3][j] ;\n //debugging console.log(`${matrix[i][j]}*${matrix[i+1][j]}*${matrix[i+2][j]}*${matrix[i+3][j]} = ${product2}\\n`);\n }\n //set maximum to max of product1,product2 and itself\n if(product1>product2){\n if(product1 > maximum){\n maximum = product1;\n }\n }\n else{\n if(product2 > maximum){\n maximum = product2;\n }\n }\n //debugging console.log(maximum);\n }\n }\n return maximum;//finally returning maximum\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 matrix(n) {\n let result = makeMartix(n)\n let columnStart = 0,\n columnEnd = n-1,\n rowStart = 0,\n rowEnd = n-1\n count = 1\n\n function recursionMatrix(count, currentI, currentJ, nextI, nextJ) {\n \n if (count > n * n) {\n return\n }\n\n if (nextJ <= columnEnd) {\n result[currentI][currentJ] = count\n count++\n return recursionMatrix(count, currentI, currentJ+1, nextI, nextJ+1)\n }\n\n if (nextJ > columnEnd) {\n result[currentI][currentJ] = count\n count++\n return recursionMatrix(count, currentI+1, currentJ, nextI, nextJ)\n }\n\n if (currentJ === columnEnd && currentI === rowStart) {\n result[currentI][currentJ] = count\n count++\n return recursionMatrix(count, currentI+1, currentJ)\n }\n\n if (currentI < rowEnd) {\n result[currentI][currentJ] = count\n count++\n return recursionMatrix(count, currentI+1, currentJ)\n }\n\n if ()\n \n\n\n }\n\n function checkRange(a, b) {\n if (a >= 0 && a < n-1 && b >= 0 && b < n-1 && result[a][b] === 0) {\n return true\n } else {\n return false\n }\n }\n\n\n}", "function checkDiag(i, j, state) {\n //\t\tSystem.out.println(\"Diagnose starts!!!!!!!! I \" + i + \" j \" + j);\n var countb = 0;\n var countw = 0;\n var diagChoice = -1;\n if (i == j) {\n diagChoice = 1;\n } else if (i + j == 5) {\n diagChoice = 2;\n } else {\n return 0;\n }\n var tempb = [];\n var tempw = [];\n for (var k = 0; k < 6; k ++) {\n var l = k;\n if (diagChoice == 2) {\n l = 5 - k;\n }\n if (state[k][l] == 'b') {\n countb ++;\n tempw.push(countw);\n countw =0;\n } else if (state[k][l] == 'w'){\n countw ++;\n tempb.push(countb);\n countb = 0;\n } else {\n tempw.push(countw);\n countw =0;\n tempb.push(countb);\n countb =0;\n }\n }\n tempw.push(countw);\n countw =0;\n tempb.push(countb);\n countb =0;\n tempb.sort(function(a,b) {return b-a});\n tempw.sort(function(a,b) {return b-a});\n resultB[diagChoice + 11] = tempb[0];\n resultW[diagChoice + 11] = tempw[0];\n }", "function main() {\n var n = parseInt(readLine());\n var a = [];\n for(a_i = 0; a_i < n; a_i++){\n a[a_i] = readLine().split(' ');\n a[a_i] = a[a_i].map(Number);\n }\n\n //started here\n let d1 = 0; //diagonal 1 back slash\n let d2 = 0; //diagonal 2 forward slash\n\n\n for(var i = 0; i < n; i++){\n for (var j = 0; j < n; j++){\n if(i==j) {\n d1+=a[i][j] // array[row][row]\n }\n if (i+j == n-1) { //= forward slash\n d2+= a[i][j]\n }\n }\n }\n console.log(Math.abs(d1-d2));\n}", "function diagonalDifference(arr) {\n // Write your code here\n\n // Dimension of the square array.\n const n = arr.length;\n\n let leftDiagSum = 0;\n let rightDiagSum = 0;\n // Going from top to bottom.\n for (let i = 0; i < n; i++) {\n // Element contributing to left diagonal sum.\n const left = arr[i][i];\n leftDiagSum += left;\n // Element contributing to right diagonal sum.\n const right = arr[i][n - i - 1];\n rightDiagSum += right;\n }\n // Return the absolute difference.\n return Math.abs(leftDiagSum - rightDiagSum);\n}", "function dissolve(chess_board, combo, dissolve_value) {\n var A = Array(10).fill().map(() => Array(10).fill(0));\n var B = Array(10).fill().map(() => Array(10).fill(0));\n var C = Array(10).fill().map(() => Array(10).fill(0));\n var D = Array(10).fill().map(() => Array(10).fill(0));\n var E = Array(10).fill().map(() => Array(10).fill(0));\n\n for (var i=0;i<8;i++) {\n for (var j=0;j<8;j++) {\n var tmp = Math.trunc((chess_board[i][j] - 1) / 4) * ((chess_board[i][j] - 1) % 4 + 1);\n if (tmp==0) A[i][j] = 1;\n if (tmp==1) B[i][j] = 1;\n if (tmp==2) C[i][j] = 1;\n if (tmp==3) D[i][j] = 1;\n if (tmp==4) E[i][j] = 1;\n }\n }\n \n for (var i=0;i<8;i++)\n {\n for (var j=0;j<8;j++)\n {\n if (Math.abs(A[i][j])==1 && Math.abs(A[i][j+1])==1 && Math.abs(A[i][j+2])==1)\n {\n A[i][j]=-1;\n A[i][j+1]=-1;\n A[i][j+2]=-1;\n }\n if (Math.abs(B[i][j])==1 && Math.abs(B[i][j+1])==1 && Math.abs(B[i][j+2])==1)\n {\n B[i][j]=-1;\n B[i][j+1]=-1;\n B[i][j+2]=-1;\n }\n if (Math.abs(C[i][j])==1 && Math.abs(C[i][j+1])==1 && Math.abs(C[i][j+2])==1)\n {\n C[i][j]=-1;\n C[i][j+1]=-1;\n C[i][j+2]=-1;\n }\n if (Math.abs(D[i][j])==1 && Math.abs(D[i][j+1])==1 && Math.abs(D[i][j+2])==1)\n {\n D[i][j]=-1;\n D[i][j+1]=-1;\n D[i][j+2]=-1;\n }\n if (Math.abs(E[i][j])==1 && Math.abs(E[i][j+1])==1 && Math.abs(E[i][j+2])==1)\n {\n E[i][j]=-1;\n E[i][j+1]=-1;\n E[i][j+2]=-1;\n }\n }\n }\n for (var j=0;j<8;j++)\n {\n for (var i=0;i<8;i++)\n {\n if (Math.abs(A[i][j])==1 && Math.abs(A[i+1][j])==1 && Math.abs(A[i+2][j])==1)\n {\n A[i][j]=-1;\n A[i+1][j]=-1;\n A[i+2][j]=-1;\n }\n if (Math.abs(B[i][j])==1 && Math.abs(B[i+1][j])==1 && Math.abs(B[i+2][j])==1)\n {\n B[i][j]=-1;\n B[i+1][j]=-1;\n B[i+2][j]=-1;\n }\n if (Math.abs(C[i][j])==1 && Math.abs(C[i+1][j])==1 && Math.abs(C[i+2][j])==1)\n {\n C[i][j]=-1;\n C[i+1][j]=-1;\n C[i+2][j]=-1;\n }\n if (Math.abs(D[i][j])==1 && Math.abs(D[i+1][j])==1 && Math.abs(D[i+2][j])==1)\n {\n D[i][j]=-1;\n D[i+1][j]=-1;\n D[i+2][j]=-1;\n }\n if (Math.abs(E[i][j])==1 && Math.abs(E[i+1][j])==1 && Math.abs(E[i+2][j])==1)\n {\n E[i][j]=-1;\n E[i+1][j]=-1;\n E[i+2][j]=-1;\n }\n }\n }\n for (var i=0;i<8;i++) {\n for (var j=0;j<8;j++) {\n if (A[i][j]!=-1) A[i][j] = 0;\n if (B[i][j]!=-1) B[i][j] = 0;\n if (C[i][j]!=-1) C[i][j] = 0;\n if (D[i][j]!=-1) D[i][j] = 0;\n if (E[i][j]!=-1) E[i][j] = 0;\n }\n }\n \n /*\n for (var i = 0; i < 10; i++)\n {\n for (var j = 0; j < 10; j++)\n document.write(A[i][j] + \" \");\n document.write(\"<br>\");\n }\n document.write(\"<br>\");\n for (var i = 0; i < 10; i++)\n {\n for (var j = 0; j < 10; j++)\n document.write(B[i][j] + \" \");\n document.write(\"<br>\");\n }\n document.write(\"<br>\");\n for (var i = 0; i < 10; i++)\n {\n for (var j = 0; j < 10; j++)\n document.write(C[i][j] + \" \");\n document.write(\"<br>\");\n }\n document.write(\"<br>\");\n for (var i = 0; i < 10; i++)\n {\n for (var j = 0; j < 10; j++)\n document.write(D[i][j] + \" \");\n document.write(\"<br>\");\n }\n document.write(\"<br>\");\n for (var i = 0; i < 10; i++)\n {\n for (var j = 0; j < 10; j++)\n document.write(E[i][j] + \" \");\n document.write(\"<br>\");\n }\n */\n //sunny\n var total_com = 0;\n total_com = each_type_combo(A, chess_board, total_com, dissolve_value);\n total_com = each_type_combo(B, chess_board, total_com, dissolve_value);\n total_com = each_type_combo(C, chess_board, total_com, dissolve_value);\n total_com = each_type_combo(D, chess_board, total_com, dissolve_value);\n total_com = each_type_combo(E, chess_board, total_com, dissolve_value);\n return total_com + combo;\n}", "function subEqual() {\r\n $('.matrix2-ops').hide();\r\n var row = document.getElementById(\"rows\").value;\r\n var col = document.getElementById(\"cols\").value;\r\n var string = \"<section class='matrixCont' id='displayMatrix1'><table class='matrix' id='matrix1'>\";\r\n var sum;\r\n var curr1;\r\n var curr2;\r\n var curString1 = \"\";\r\n var curString2 = \"\";\r\n\r\n //Checks if it is a Square Matrix\r\n if (row == col) {\r\n for (var i = 0; i < row; i++) {\r\n string += \"\\n<tr>\";\r\n for (var j = 0; j < col; j++) {\r\n curString1 = \"mtrx1-\" + i + \"-\" + j;\r\n curString2 = \"mtrx2-\" + i + \"-\" + j;\r\n curr1 = Number(document.getElementById(curString1).innerText);\r\n curr2 = Number(document.getElementById(curString2).innerText);\r\n sum = curr1 - curr2;\r\n console.log(sum);\r\n string += \"\\n<td id='mtrx1-\" + i + \"-\" + j + \"'>\" + sum + \"</td>\";\r\n }\r\n string += \"\\n</tr>\";\r\n }\r\n string += \"\\n</table>\\n<section id='detMatrix1'></section>\\n<section id='scalar1'></section>\\n</section>\";\r\n } else {\r\n for (var i = 0; i < row; i++) {\r\n string += \"\\n<tr>\";\r\n for (var j = 0; j < col; j++) {\r\n curString1 = \"mtrx1-\" + i + \"-\" + j;\r\n curString2 = \"mtrx2-\" + i + \"-\" + j;\r\n curr1 = Number(document.getElementById(curString1).innerText);\r\n curr2 = Number(document.getElementById(curString2).innerText);\r\n sum = curr1 - curr2;\r\n console.log(sum);\r\n string += \"\\n<td id='mtrx1-\" + i + \"-\" + j + \"'>\" + sum + \"</td>\";\r\n }\r\n string += \"\\n</tr>\";\r\n }\r\n string += \"\\n</table>\\n<section id='detMatrix1'></section>\\n<section id='scalar1'></section>\\n</section>\";\r\n }\r\n $(\"#displayMatrix2\").replaceWith(\"<section class='matrixCont' id='displayMatrix2'>\\n<section id='detMatrix2'></section>\\n</section>\");\r\n $(\"#displayMatrix1\").replaceWith(string);\r\n $(\"#inverseMatrix1\").replaceWith(\"<section id= 'inverseMatrix1'><section id='detInverse'></section></section>\");\r\n $(\"#inverseMatrix2\").replaceWith(\"<section id= 'inverseMatrix2'><section id='detInverse2'></section></section>\");\r\n}", "function diagonalDifference(arr){\n let leftDiagSum = 0;\n let rightDiagSum = 0;\n\n for (let i = 0; i < arr.length; i++){\n leftDiagSum += arr[i][i];\n rightDiagSum += arr[i][arr.length-1-i];\n }\n\n return Math.abs(leftDiagSum - rightDiagSum);\n}", "function diagonalsSum(matrix) {\n let result = '';\n let mdSum = 0;\n\n // Main Diagonal\n for (let i = 0; i < matrix.length; i++) {\n for (let j = 0; j < matrix[i].length; j++) {\n if (i === j) {\n mdSum += matrix[i][j];\n }\n }\n }\n\n result += mdSum + ' ';\n let sdSum = 0;\n\n // Secondary Diagonal\n for (let i = 0; i < matrix.length; i++) {\n for (let j = 0; j < matrix[i].length; j++) {\n if (j === matrix[i].length - 1 - i) {\n sdSum += matrix[i][j];\n } \n }\n }\n\n result += sdSum;\n return result;\n}", "inverse()\r\n {\r\n var newMatrix = this.duplicateMatrix();\r\n\r\n // make an identity matrix with the same dimensions as this matrix\r\n var identityArr = [];\r\n for (var r = 0; r < a.m; r++)\r\n {\r\n identityArr.push([])\r\n for (var c = 0; c < a.n; c++)\r\n {\r\n if (c == r)\r\n identityArr[r][c] = 1;\r\n else\r\n identityArr[r][c] = 0;\r\n }\r\n }\r\n\r\n // run the RREF algorithm and do all the row operations on the identity matrix simultaneously\r\n var invertedMatrix = new Matrix(identityArr);\r\n\r\n var completeRows = 0;\r\n // repeat until all rows are complete\r\n while (completeRows < newMatrix.m)\r\n {\r\n // find the row with the leftmost leading variable\r\n // by looping through incomplete rows, finding which has min leadingVar\r\n var leadingIndex = newMatrix.indexOfLeadingVar(completeRows);\r\n var leadingRow = completeRows;\r\n var leadingVar = newMatrix.matrix[completeRows][leadingIndex];\r\n\r\n for (var r = completeRows; r < newMatrix.m; r++)\r\n {\r\n var rowIndex = newMatrix.indexOfLeadingVar(r)\r\n if (rowIndex < leadingIndex)\r\n {\r\n leadingIndex = rowIndex;\r\n leadingRow = r;\r\n leadingVar = newMatrix.matrix[r][leadingIndex];\r\n }\r\n }\r\n\r\n // swap this row with the topmost incomplete row\r\n if (leadingRow != completeRows)\r\n {\r\n newMatrix.swapRows(leadingRow, completeRows);\r\n invertedMatrix.swapRows(leadingRow, completeRows);\r\n }\r\n\r\n if (!newMatrix.isZeroRow(completeRows))\r\n {\r\n // multiply the row by 1/leadingVar\r\n newMatrix.scaleRow(completeRows, math.divide(1, leadingVar));\r\n invertedMatrix.scaleRow(completeRows, math.divide(1, leadingVar));\r\n\r\n // subtract (c * this row) from all other rows,\r\n // where c = the coefficient in the same column as this row's leading variable\r\n for (var r = 0; r < newMatrix.m; r++)\r\n {\r\n if (r != completeRows)\r\n {\r\n var c = math.multiply(newMatrix.matrix[r][leadingIndex], -1);\r\n newMatrix.addRows(c, completeRows, r);\r\n invertedMatrix.addRows(c, completeRows, r);\r\n }\r\n }\r\n }\r\n\r\n // increase the complete rows counter by one\r\n completeRows++;\r\n }\r\n return invertedMatrix;\r\n\r\n }", "function diagonalDifference(arr) {\n let newArr = arr.flat();\n console.log(newArr);\n // let newAr = arr.split(' ');\n\n // let newerAr = newAr.map((item) => parseInt(item));\n\n let n = Math.sqrt(newerAr.length);\n let countOne = 0;\n let countTwo = 0;\n\n for (let i = 0; i <= newerAr.length; i += n + 1) {\n countOne += newerAr[i];\n console.log(countOne);\n }\n\n for (let j = n - 1; j <= newerAr.length - n; j += n - 1) {\n countTwo += newerAr[j];\n console.log(countTwo);\n }\n\n let result = Math.abs(countOne - countTwo);\n\n return result;\n}", "function scalMtx1() {\r\n var row = document.getElementById(\"rows\").value;\r\n var col = document.getElementById(\"cols\").value;\r\n var scal = document.getElementById(\"scalNum1\").value;\r\n var string = \"<section class='matrixCont' id='displayMatrix1'><table class='matrix' id='matrix1'>\";\r\n var product;\r\n var curr1;\r\n var curString1 = \"\";\r\n\r\n //Checks if it is a Square Matrix\r\n if (row == col) {\r\n for (var i = 0; i < row; i++) {\r\n string += \"\\n<tr>\";\r\n for (var j = 0; j < col; j++) {\r\n curString1 = \"mtrx1-\" + i + \"-\" + j;\r\n curr1 = Number(document.getElementById(curString1).innerText);\r\n product = curr1 * scal;\r\n console.log(product);\r\n string += \"\\n<td id='mtrx1-\" + i + \"-\" + j + \"'>\\n\" + product + \"</td>\";\r\n }\r\n string += \"\\n</tr>\";\r\n }\r\n string += \"\\n</table>\\n<section id='scalar1'></section><section id='detMatrix1'></section></section>\";\r\n } else {\r\n for (var i = 0; i < row; i++) {\r\n string += \"\\n<tr>\";\r\n for (var j = 0; j < col; j++) {\r\n curString1 = \"mtrx1-\" + i + \"-\" + j;\r\n curr1 = Number(document.getElementById(curString1).innerText);\r\n product = curr1 * scal;\r\n console.log(product);\r\n string += \"\\n<td id='mtrx1-\" + i + \"-\" + j + \"'>\\n\" + product + \"</td>\";\r\n }\r\n string += \"\\n</tr>\";\r\n }\r\n string += \"\\n</table>\\n<section id='scalar1'></section><section id= 'detMatrix1'></section>\\n</section>\";\r\n }\r\n $(\"#displayMatrix1\").replaceWith(string);\r\n}", "get inverse() {\n // I use Guassian Elimination to calculate the inverse:\n // (1) 'augment' the matrix (left) by the identity (on the right)\n // (2) Turn the matrix on the left into the identity by elemetry row ops\n // (3) The matrix on the right is the inverse (was the identity matrix)\n // There are 3 elemtary row ops: (I combine b and c in my code)\n // (a) Swap 2 rows\n // (b) Multiply a row by a scalar\n // (c) Add 2 rows\n\n const M = this.matrix;\n\n //if the matrix isn't square: exit (error)\n if (M.length !== M[0].length) {\n throw new Error(`matrix is not squared`);\n }\n\n //create the identity matrix (I), and a copy (C) of the original\n var i = 0,\n ii = 0,\n j = 0,\n dim = M.length,\n e = 0,\n t = 0;\n var I = [],\n C = [];\n for (i = 0; i < dim; i += 1) {\n // Create the row\n I[I.length] = [];\n C[C.length] = [];\n for (j = 0; j < dim; j += 1) {\n\n //if we're on the diagonal, put a 1 (for identity)\n if (i == j) {\n I[i][j] = 1;\n } else {\n I[i][j] = 0;\n }\n\n // Also, make the copy of the original\n C[i][j] = M[i][j];\n }\n }\n\n // Perform elementary row operations\n for (i = 0; i < dim; i += 1) {\n // get the element e on the diagonal\n e = C[i][i];\n\n // if we have a 0 on the diagonal (we'll need to swap with a lower row)\n if (e == 0) {\n //look through every row below the i'th row\n for (ii = i + 1; ii < dim; ii += 1) {\n //if the ii'th row has a non-0 in the i'th col\n if (C[ii][i] != 0) {\n //it would make the diagonal have a non-0 so swap it\n for (j = 0; j < dim; j++) {\n e = C[i][j]; //temp store i'th row\n C[i][j] = C[ii][j]; //replace i'th row by ii'th\n C[ii][j] = e; //repace ii'th by temp\n e = I[i][j]; //temp store i'th row\n I[i][j] = I[ii][j]; //replace i'th row by ii'th\n I[ii][j] = e; //repace ii'th by temp\n }\n //don't bother checking other rows since we've swapped\n break;\n }\n }\n //get the new diagonal\n e = C[i][i];\n //if it's still 0, not invertable (error)\n if (e == 0) {\n throw new Error(`matrix is not invertable`);\n }\n }\n\n // Scale this row down by e (so we have a 1 on the diagonal)\n for (j = 0; j < dim; j++) {\n C[i][j] = C[i][j] / e; //apply to original matrix\n I[i][j] = I[i][j] / e; //apply to identity\n }\n\n // Subtract this row (scaled appropriately for each row) from ALL of\n // the other rows so that there will be 0's in this column in the\n // rows above and below this one\n for (ii = 0; ii < dim; ii++) {\n // Only apply to other rows (we want a 1 on the diagonal)\n if (ii == i) { continue; }\n\n // We want to change this element to 0\n e = C[ii][i];\n\n // Subtract (the row above(or below) scaled by e) from (the\n // current row) but start at the i'th column and assume all the\n // stuff left of diagonal is 0 (which it should be if we made this\n // algorithm correctly)\n for (j = 0; j < dim; j++) {\n C[ii][j] -= e * C[i][j]; //apply to original matrix\n I[ii][j] -= e * I[i][j]; //apply to identity\n }\n }\n }\n\n //we've done all operations, C should be the identity\n //matrix I should be the inverse:\n return new Matrix(I);\n }", "function sacarMDeUnaMatriz(matriz) {\n var m = matriz.length;\n return m;\n}", "function maxTwoDimArray(matrix) {\n //\n}" ]
[ "0.74909025", "0.73743075", "0.7320607", "0.7210089", "0.7180129", "0.7121054", "0.7027388", "0.6933576", "0.67923373", "0.67677796", "0.6689784", "0.61586154", "0.60582674", "0.59964216", "0.597575", "0.59676594", "0.5915091", "0.5856863", "0.581085", "0.58018345", "0.57144785", "0.5680518", "0.560066", "0.5579856", "0.5435587", "0.54295754", "0.542865", "0.5411998", "0.5310299", "0.5306796", "0.5278314", "0.5248414", "0.5223406", "0.51994926", "0.51518714", "0.5150334", "0.51385695", "0.51270396", "0.5079524", "0.50789464", "0.5061841", "0.50584435", "0.5045593", "0.49959022", "0.4989186", "0.49804968", "0.49761882", "0.49723577", "0.49701083", "0.49563956", "0.4953779", "0.49484187", "0.49483317", "0.4944418", "0.49138325", "0.49047163", "0.4887083", "0.48780802", "0.4876738", "0.48751768", "0.48690993", "0.48450053", "0.48225826", "0.48047864", "0.48010442", "0.4741157", "0.47386375", "0.473137", "0.47211814", "0.47171107", "0.47082567", "0.47022137", "0.46989217", "0.46888533", "0.46809962", "0.46747673", "0.46726102", "0.46714413", "0.46676147", "0.4661494", "0.4655698", "0.4636841", "0.46316594", "0.4610848", "0.46089044", "0.46033868", "0.45975536", "0.45974547", "0.45795447", "0.454767", "0.45453826", "0.45432407", "0.45279658", "0.452525", "0.45235538", "0.45136887", "0.45120564", "0.4510236", "0.4506681", "0.44917512" ]
0.75930524
0
functions creates n_minor from m
function nMinor (m, n) { let minor = [] //h = 1 to skip first row of matrix for (let h = 1; h < m.length; h++) { minor.push(m[h].filter((el, it) => it !== n)) } return minor }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function minor2x2() {\r\n if (selection_text_misc_2x2.textContent == \"Inverse\" || selection_text_misc_2x2.textContent == \"Co-factor\" || selection_text_misc_2x2.textContent == \"Adjoint\") {\r\n minor_array.push(Number(misc_array_1[3]));\r\n minor_array.push(Number(misc_array_1[2]));\r\n minor_array.push(Number(misc_array_1[1]));\r\n minor_array.push(Number(misc_array_1[0]));\r\n }\r\n else {\r\n minor_array.push(Number(misc_array_1[3]));\r\n minor_array.push(Number(misc_array_1[2]));\r\n minor_array.push(Number(misc_array_1[1]));\r\n minor_array.push(Number(misc_array_1[0]));\r\n\r\n for (let k = 0; k < matrix2_misc.length; k++) {\r\n matrix2_misc[k].innerHTML = minor_array[k];\r\n }\r\n while (misc_array_1.length > 0) {\r\n misc_array_1.pop();\r\n }\r\n while (minor_array.length > 0) {\r\n minor_array.pop();\r\n }\r\n }\r\n }", "function minor3x3() {\r\n if (selection_text_misc_3x3.textContent == \"Inverse\" || selection_text_misc_3x3.textContent == \"Co-factor\" || selection_text_misc_3x3.textContent == \"Adjoint\") {\r\n minor_array.push(Number((misc_array_3[4] * misc_array_3[8]) - (misc_array_3[5] * misc_array_3[7])));\r\n minor_array.push(Number((misc_array_3[3] * misc_array_3[8]) - (misc_array_3[6] * misc_array_3[5])));\r\n minor_array.push(Number((misc_array_3[3] * misc_array_3[7]) - (misc_array_3[6] * misc_array_3[4])));\r\n minor_array.push(Number((misc_array_3[1] * misc_array_3[8]) - (misc_array_3[7] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[8]) - (misc_array_3[6] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[7]) - (misc_array_3[6] * misc_array_3[1])));\r\n minor_array.push(Number((misc_array_3[1] * misc_array_3[5]) - (misc_array_3[4] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[5]) - (misc_array_3[3] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[4]) - (misc_array_3[3] * misc_array_3[1])));\r\n }\r\n else {\r\n minor_array.push(Number((misc_array_3[4] * misc_array_3[8]) - (misc_array_3[5] * misc_array_3[7])));\r\n minor_array.push(Number((misc_array_3[3] * misc_array_3[8]) - (misc_array_3[6] * misc_array_3[5])));\r\n minor_array.push(Number((misc_array_3[3] * misc_array_3[7]) - (misc_array_3[6] * misc_array_3[4])));\r\n minor_array.push(Number((misc_array_3[1] * misc_array_3[8]) - (misc_array_3[7] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[8]) - (misc_array_3[6] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[7]) - (misc_array_3[6] * misc_array_3[1])));\r\n minor_array.push(Number((misc_array_3[1] * misc_array_3[5]) - (misc_array_3[4] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[5]) - (misc_array_3[3] * misc_array_3[2])));\r\n minor_array.push(Number((misc_array_3[0] * misc_array_3[4]) - (misc_array_3[3] * misc_array_3[1])));\r\n\r\n for (let k = 0; k < matrix4_misc.length; k++) {\r\n matrix4_misc[k].innerHTML = minor_array[k];\r\n }\r\n\r\n while (misc_array_3.length > 0) {\r\n misc_array_3.pop();\r\n }\r\n while (minor_array.length > 0) {\r\n minor_array.pop();\r\n }\r\n }\r\n }", "function minorKey(tnc) {\n const pc = (0, _core.note)(tnc).pc;\n if (!pc) return NoMinorKey;\n const alteration = distInFifths(\"C\", pc) - 3;\n return {\n type: \"minor\",\n tonic: pc,\n relativeMajor: (0, _core.transpose)(pc, \"3m\"),\n alteration,\n keySignature: (0, _core.altToAcc)(alteration),\n natural: NaturalScale(pc),\n harmonic: HarmonicScale(pc),\n melodic: MelodicScale(pc)\n };\n}", "function minorKey(tonic) {\n const alteration = distInFifths(\"C\", tonic) - 3;\n return {\n type: \"minor\",\n tonic,\n relativeMajor: transpose(tonic, \"3m\"),\n alteration,\n keySignature: altToAcc(alteration),\n natural: NaturalScale(tonic),\n harmonic: HarmonicScale(tonic),\n melodic: MelodicScale(tonic),\n };\n}", "function setMajorMinor(tempMajor){\n majorMinor = tempMajor;\n GetNumProg();\n}", "function identSize(M, m, n, k) {\n var e = M.elements;\n var i = k - 1;\n\n while(i--) {\n\tvar row = [];\n\t\n\tfor(var j = 0; j < n; j++)\n\t row.push(j == i ? 1 : 0);\n\t\n e.unshift(row);\n }\n \n for(var i = k - 1; i < m; i++) {\n while(e[i].length < n)\n e[i].unshift(0);\n }\n\n return $M(e);\n}", "function identSize(M, m, n, k) {\n var e = M.elements;\n var i = k - 1;\n\n while(i--) {\n\tvar row = [];\n\t\n\tfor(var j = 0; j < n; j++)\n\t row.push(j == i ? 1 : 0);\n\t\n e.unshift(row);\n }\n \n for(var i = k - 1; i < m; i++) {\n while(e[i].length < n)\n e[i].unshift(0);\n }\n\n return $M(e);\n}", "function identSize(M, m, n, k) {\n var e = M.elements;\n var i = k - 1;\n\n while(i--) {\n\tvar row = [];\n\t\n\tfor(var j = 0; j < n; j++)\n\t row.push(j == i ? 1 : 0);\n\t\n e.unshift(row);\n }\n \n for(var i = k - 1; i < m; i++) {\n while(e[i].length < n)\n e[i].unshift(0);\n }\n\n return $M(e);\n}", "function identSize(M, m, n, k) {\n\t\t\tvar e = M.elements;\n\t\t\tvar i = k - 1;\n\n\t\t\twhile (i--) {\n\t\t\t\t\t\tvar row = [];\n\n\t\t\t\t\t\tfor (var j = 0; j < n; j++) row.push(j == i ? 1 : 0);\n\n\t\t\t\t\t\te.unshift(row);\n\t\t\t}\n\n\t\t\tfor (var i = k - 1; i < m; i++) {\n\t\t\t\t\t\twhile (e[i].length < n) e[i].unshift(0);\n\t\t\t}\n\n\t\t\treturn $M(e);\n}", "function identSize(M, m, n, k) {\n\t\t\tvar e = M.elements;\n\t\t\tvar i = k - 1;\n\n\t\t\twhile (i--) {\n\t\t\t\t\t\tvar row = [];\n\n\t\t\t\t\t\tfor (var j = 0; j < n; j++) row.push(j == i ? 1 : 0);\n\n\t\t\t\t\t\te.unshift(row);\n\t\t\t}\n\n\t\t\tfor (var i = k - 1; i < m; i++) {\n\t\t\t\t\t\twhile (e[i].length < n) e[i].unshift(0);\n\t\t\t}\n\n\t\t\treturn $M(e);\n}", "function minorClick(minor){\r\n\t/*get minor name from clicked attribute (this)*/\r\n\tvar minorname = minor.getAttribute(\"data-dash-minorName\");\r\n\tconsole.log(minorname);\r\n\t/*get more info about minor*/\r\n\tmyXHR('get',{'path':'/minors/UgMinors/name='+minorname},'none').done(function(json){\r\n\t\tconsole.log(json);\r\n\t\tvar minors = \"<div class='minorsPopup'><div><p class='closeP'>\";\r\n\t\tminors += \"<i class='popupContent_close fa fa-times fa-2x'></i></p></div>\";\r\n\t\tminors += \"<div><h1>\"+json.title+\"</h1><hr style='width:25%'>\";\r\n\t\t/*if-else is for description manipulation to get minor liasion and minor advisor info\r\n\t\tas format for GIS_MN and MEDINFO-MN is different*/\r\n\t\tvar temp = json.description.split(\":\");\r\n\t\tif(json.name == \"GIS-MN\" || json.name == \"MEDINFO-MN\"){\r\n\t\t\ttemp[1] = temp[1].replace(\"Faculty Minor Liaison\",\"\");\r\n\t\t\tminors += \"<p>\"+temp[0]+temp[1]+\"</p>\";\r\n\t\t\tminors += \"<p class='secondP'>Faculty Minor Liaison: \";\r\n\t\t\tminors += \"<span class='pValue'>\"+temp[2].replace(\". Minor Advisor\",\"\")+\"</span></p>\";\r\n\t\t\tminors += \"<p class='secondP'>Minor Advisor: <span class='pValue'>\"+temp[3];\r\n\t\t\tminors += \"</span></p>\";\r\n\t\t}else{\r\n\t\t\tminors += \"<p>\"+temp[0].replace(\"Faculty Minor Liaison\",\"\")+\"</p>\";\r\n\t\t\tminors += \"<p class='secondP'>Faculty Minor Liaison: <span class='pValue'>\";\r\n\t\t\tminors += temp[1].replace(\". Minor Advisor\",\"\")+\"</span></p>\";\r\n\t\t\tminors += \"<p class='secondP'>Minor Advisor: <span class='pValue'>\"+temp[2];\r\n\t\t\tminors += \"</span></p>\";\r\n\t\t}\r\n\r\n\t\t/*minor related courses*/\r\n\t\tminors += \"<p class='courseTitle'>COURSES</p>\";\r\n\t\tminors += \"<ul>\";\r\n\t\tfor(var j=0; j<json.courses.length;j++){\r\n\t\t\tminors += \"<li data-dash-coursename='\"+json.courses[j]+\"' \";\r\n\t\t\tminors += \"onclick='minorCourseClick(this)'>\"+json.courses[j]+\"</li>\";\r\n\t\t}\r\n\t\tminors += \"</ul>\";\r\n\r\n\t\t/*if any content available in note*/\r\n\t\tif(json.note != \"\"){\r\n\t\t\tminors += \"<p class='note'>NOTE: <span class='notetext'>\"+json.note+\"</span></p>\";\r\n\t\t}\r\n\t\tminors += \"</div></div>\";\r\n\r\n\t\t$(\"#popupContent\").html(minors);\r\n\t});\r\n}", "function minorSeventh(rootNote) {\n var startIndex = notes.indexOf(rootNote);\n return notes[startIndex] + \", \" +\n notes[startIndex + 3] + \", \" +\n notes[startIndex + 7] + \", \" +\n notes[startIndex + 10];\n}", "function getmv(comb, m) {\n var arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n var r = 4;\n\n for (var i = 0; i < 12; i++) {\n if (comb >= Cnk[11 - i][r]) {\n comb -= Cnk[11 - i][r--];\n arr[i] = r << 1;\n } else {\n arr[i] = -1;\n }\n }\n\n edgeMove(arr, m);\n comb = 0, r = 4;\n var t = 0;\n var pm = [];\n\n for (var i = 0; i < 12; i++) {\n if (arr[i] >= 0) {\n comb += Cnk[11 - i][r--];\n pm[r] = arr[i] >> 1;\n t |= (arr[i] & 1) << 3 - r;\n }\n }\n\n return comb * 24 + getNPerm(pm, 4) << 4 | t;\n }", "get _minorAvailable() {\n let incl = this._incl;\n return incl.cups || incl.swords || incl.wands || incl.pentacles;\n }", "function SharpMinorScale(halfStepsFromC_of_rel_maj) {\n this.relativeMajor = new SharpMajorScale(halfStepsFromC_of_rel_maj);\n this.steps = {};\n // move all of the relative major's properties down two steps\n for (var prop in this.relativeMajor.steps) {\n if (this.relativeMajor.steps.hasOwnProperty(prop) && Number(prop)) { //no sharps or flats\n this.steps[(Number(prop) + 2) % 7] = this.relativeMajor.steps[prop];\n }\n else if (this.relativeMajor.steps.hasOwnProperty(prop) && prop.length === 2) { //accidental\n this.steps[((Number(prop.slice(0,1)) + 2) % 7) + prop.slice(1)] = this.relativeMajor.steps[prop];\n }\n }\n this.steps[2] = this.relativeMajor.steps[0]; //not sure why the above didn't do this....okay for now\n //create the reverse mapping\n this.steps_reverse = {};\n for (var prop in this.steps) {\n if (this.steps.hasOwnProperty(prop)) {\n this.steps_reverse[this.steps[prop]] = prop;\n }\n }\n this.scaleStepsToHalfSteps = {0:0, 1:2, 2:3, 3:5, 4:7, 5:6, 6:10};\n this.halfStepsFromC = (halfStepsFromC_of_rel_maj - 3 + 12) % 12;\n this.tonic = this.steps[0];\n //add harmonic and melodic\n //exceptions?\n //create new objects\n ///deal with this later\n this.naturalScale = this.steps;\n this.harmonicScale = this.steps;\n // this.harmonicScale[6] = this.relativeMajor.flatorsharp === 'sharp';\n\n}", "addMiddleMajorTicks(tickscount, ticksDistance, distanceFromFirstToSecond, distanceModifier, normalLayout, ticksFrequency) {\n const that = this.context;\n\n let majorTicks = '', majorLabels = '', valuePlusExponent;\n\n for (let i = 1; i < tickscount; i++) {\n let number = distanceFromFirstToSecond.add(i * ticksDistance), value;\n\n if (normalLayout) {\n value = ticksFrequency.multiply(i).add(distanceModifier.add(new JQX.Utilities.BigNumber(that._drawMin)));\n }\n else {\n value = new JQX.Utilities.BigNumber(that._drawMax).subtract(distanceModifier).subtract(ticksFrequency.multiply(i));\n\n // if the value of the penultimate is 0 we add the exponent to accurately calculate its size\n if (i === tickscount - 1 && value.compare(0) === 0) {\n that._numberRenderer.numericValue = that._tickIntervalHandler.nearestPowerOfTen;\n valuePlusExponent = that._numberRenderer.bigNumberToExponent(1);\n }\n }\n if (value.compare(that._drawMax) !== 0) {\n let htmlValue = that._formatLabel(value.toString()),\n plot = true;\n\n that._labelDummy.innerHTML = valuePlusExponent ? valuePlusExponent : htmlValue;\n let dimensionValue = that._labelDummy[that._settings.size];\n\n if (number.add(dimensionValue).compare(tickscount * ticksDistance) >= 0) { // + 5 is an experimental value\n plot = false; // does not plot the second to last label if it intersects with the last one\n }\n\n const currentTickAndLabel = this._addMajorTickAndLabel(htmlValue, undefined, plot, value, true);\n\n majorTicks += currentTickAndLabel.tick;\n majorLabels += currentTickAndLabel.label;\n }\n }\n return { tick: majorTicks, label: majorLabels };\n }", "constructor(n, m) {\n\t\tthis.n = n;\n\t\tthis.m = m;\n\t\tthis.numerator = new Array(this.n);\n\t\tthis.denominator = new Array(this.n);\n\t\tthis.b_numerator = new Array(this.n);\n\t\tthis.b_denominator = new Array(this.n);\n\t\tthis.f_numerator = new Array(this.m);\n\t\tthis.f_denominator = new Array(this.m);\n\t\tthis.free = new Array(this.m);\n\t\tthis.basis = new Array(this.n);\n\n\t\t// blanc matrix\n\t\tfor (let i=0; i<this.n; i++) {\n\t\t\tthis.numerator[i] = new Array(this.m);\n\t\t\tthis.denominator[i] = new Array(this.m);\n\t\t\tfor (let j=0; j<this.m; j++) {\n\t\t\t\tthis.numerator[i][j] = 0;\n\t\t\t\tthis.denominator[i][j] = 1;\n\t\t\t}\n\t\t}\n\t}", "set_identity(m, n) {\r\n this.length = 0;\r\n for (let i = 0; i < m; i++) {\r\n this.push(new Array(n).fill(0));\r\n if (i < n) this[i][i] = 1;\r\n }\r\n }", "function getPossibleLatticePaths(m, n) {\n var i, j, storedCounts = [];\n m++; n++; // increment m and n by 1, ex: a 2x2 grid has 9 vertices, see below\n\n /*\n 1--2--3\n | | |\n 4--5--6\n | | |\n 7--8--9\n */\n\n // create 2D array to store previously found counts for direct lookup time with dynamic programming\n for(storedCounts; storedCounts.length < m; storedCounts.push([]));\n\n // set top row and first col to 1's\n for(i = 0; i < m; i++){ storedCounts[i][0] = 1; }\n for(j = 0; j < n; j++){ storedCounts[0][j] = 1; }\n\n for(i = 1; i < m; i++) {\n for(j = 1; j < n; j++) {\n storedCounts[i][j] = storedCounts[i-1][j] + storedCounts[i][j-1]\n }\n }\n\n return storedCounts[m-1][n-1];\n}", "function makeScale(halfStepsFromC_of_rel_maj, major_or_minor) {\n //major or minor is 'M' for major, 'm' for minor\n if (major_or_minor == 'm'){\n return new SharpMinorScale(halfStepsFromC_of_rel_maj);\n }\n else {\n return new SharpMajorScale(halfStepsFromC_of_rel_maj);\n }\n}", "function testGMC()\n{\n var numbSet = []\n for (var cD=0;cD<11;cD++)\n {\n numbSet.push([cD])\n }\n\n var ans = generateMultipleCombins(numbSet.length,[1,3,2,1,4],numbSet)\n// var map =[]\n// dimensionRecurse(ans,map);\n\n var int = 5;\n}", "function _prevNamespace(major, minor) {\n\t\t// Standard skipped some of the versions...\n\t\tvar ret = { min: 0, maj: 0 };\n\t\tret.min = minor - 1;\n\t\tif (ret.min < 0) {\n\t\t\tret.maj = major - 1;\n\t\t\tret.min = 5;\n\t\t} else {\n\t\t\tret.maj = major;\n\t\t}\n\t\t\n\t\tif (ret.maj == 2 && ret.min > 1) ret.min = 1;\n\t\tif (ret.maj == 3 && ret.min > 3) ret.min = 3;\n\t\t\n\t\treturn ret;\n\t}", "function add_more(m,n){\n\t//console.log('make '+m+'by'+m+'matrix and add '+n+'objects');\n\tvar headID = document.getElementsByTagName(\"head\")[0];\n\tvar cssNode = document.createElement('link');\n\tcssNode.type = 'text/css';\n\tcssNode.rel = 'stylesheet';\n\tcssNode.href = '/views/main'+m+'.css';\n\theadID.appendChild(cssNode);\n\tnum_objects = m;\n\tadd_object(n);\n}", "function renderMinesCountOnLevel(initNum) {\n var minesCount;\n if (initNum === 4) minesCount = 2;\n else if (initNum === 8) minesCount = 12;\n else minesCount = 30;\n var elMines = document.querySelector('.mines');\n elMines.innerHTML = `${minesCount}${MINE}`\n}", "function determinant(m) {\n switch (m.length) {\n //handles empty matrix\n case 0: return 1;\n //exit condition && handles singleton matrix\n case 1: return m[0][0];\n default:\n //detrmnnt will build array of terms to be combined into determinant\n //ex. a*det(a_minor) - b*det(b_minor)...\n let detrmnnt = []\n //pos controls alternation of terms ('+' or '-')\n for (let i = 0, pos = 1; i < m.length; i++, pos *= -1) {\n //adds term, ex. +/- a * det(a_minor)\n detrmnnt.push(pos * (m[0][i] * determinant(nMinor(m, i))))\n }\n return detrmnnt.reduce((accu, elem) => accu + elem)\n }\n }", "function paperwork(n, m) {\n if (n <= 0 || m <= 0) { return 0; }\n return m * n;\n}", "function m(a){for(var b,c=M(),d=N(),e=[],f=n(a),g=0;g<c;g++){var h=f[g],i=[];for(b=0;b<d;b++)i.push(0);\n// loop through every segment\nfor(var j=0;j<h.length;j++){var k=h[j];\n// adjust the columns to account for the segment's height\nfor(\n// find the segment's top coordinate by looking at the max height\n// of all the columns the segment will be in.\nk.top=D(i.slice(k.leftCol,k.rightCol+1)),b=k.leftCol;b<=k.rightCol;b++)i[b]=k.top+k.outerHeight}\n// the tallest column in the row should be the \"content height\"\ne.push(D(i))}return e}", "addMiddleMajorTicks(tickscount, ticksDistance, distanceFromFirstToSecond, distanceModifier, normalLayout, ticksFrequency) {\n const that = this.context;\n\n let majorTicks = '', majorLabels = '';\n\n for (let i = 1; i < tickscount; i++) {\n let number = i * ticksDistance + distanceFromFirstToSecond,\n value;\n\n if (normalLayout) {\n value = parseFloat(that._drawMin) + ticksFrequency * i + distanceModifier;\n }\n else {\n value = parseFloat(that._drawMax) - ticksFrequency * i - distanceModifier;\n }\n if (value.toString() !== that._drawMax.toString()) {\n let htmlValue = that._formatLabel(value.toString()),\n plot = true;\n\n that._labelDummy.innerHTML = htmlValue;\n let dimensionValue = that._labelDummy[that._settings.size];\n\n if (number + dimensionValue >= tickscount * ticksDistance) { // + 32 is an Experimental value\n plot = false;\n }\n const currentTickAndLabel = this._addMajorTickAndLabel(htmlValue, undefined, plot, value, true);\n\n majorTicks += currentTickAndLabel.tick;\n majorLabels += currentTickAndLabel.label;\n }\n }\n return { tick: majorTicks, label: majorLabels };\n }", "function createMajorityList(data) {\n\t\n majParty = [];\n\tvar k = 0;\n\tvar listIndex = 0;\n\t\n\twhile (k < data.length) {\n\t\n\t\tvar majority = data[k].parti;\n\t\tvar votePerc = parseFloat(data[k].procent);\n\t\tvar region = formatString(data[k].region, true);\n\t\n\t\tfor (var i = k; i < k+11; i++) {\n\t\t\t\n\t\t\tif(parseFloat(data[i].procent) > votePerc) {\t\n\t\t\t\tmajority = data[i].parti;\n\t\t\t\tvotePerc = data[i].procent;\n\t\t\t}\n\t\t}\n\t\t\n\t\tmajParty[listIndex] = {region, majority, votePerc};\n\t\t\n\t\tk += 11;\n\t\tlistIndex++;\n\t}\n}", "function paperwork(n, m) {\n return (n<0)||(m<0)?0:n*m;\n}", "function paperwork(n, m) {\n if (n<0 || m<0){\n return 0;\n }else{\n return (n *= m)\n }\n}", "minorSecond() { return this._halfSteps(1)._bestEnharmonic(this.name()[0], 1); }", "function maxCells(mat,m,n){\n\tvar connectedPositionsX=[],connectedPositionsY=[],count=0;\n\tvar adjCount = [];\n\t//init the grid matrix\n\tfor ( var i = 0; i < m; i++ ) {\n\t adjCount[i] = []; \n\t for ( var j = 0; j < n; j++ ) {\n\t\t\t adjCount[i][j] = 0; \n\t\t\t}\n\t}\n\tfor(var i = 0 ; i < m ;i++){\n\t\tfor(var j = 0 ; j < n ;j++){\n\t\t\t\tif(mat[i][j]==1){\n\t\t\t\t\tif (CheckIfConnected(i, j, mat,m,n,adjCount))\n\t {\n\t connectedPositionsX.push(i);\n\t connectedPositionsY.push(j);\n\t }\n\t\t\t\t}\n\t\t}\t\n\t}\n\tconsole.log(connectedPositionsX)\n\tconsole.log(connectedPositionsY)\n\tconsole.log(adjCount)\n}", "matrixLevels(level = 1) {\r\n let matrixes = {\r\n 1: [\r\n [\"w\", \"w\", \"w\", \"w\", \"w\", \"w\"],\r\n [\"w\", \"e\", \"e\", \"e\", \"e\", \"w\"],\r\n [\"w\", \"e\", \"o\", \"p\", \"b\", \"w\"],\r\n [\"w\", \"e\", \"b\", \"e\", \"o\", \"w\"],\r\n [\"w\", \"e\", \"e\", \"e\", \"e\", \"w\"],\r\n [\"w\", \"w\", \"w\", \"w\", \"w\", \"w\"]\r\n ],\r\n 2: [\r\n [\"w\", \"w\", \"w\", \"w\", \"w\", \"w\"],\r\n [\"w\", \"o\", \"e\", \"e\", \"e\", \"w\"],\r\n [\"w\", \"e\", \"e\", \"p\", \"b\", \"w\"],\r\n [\"w\", \"e\", \"b\", \"e\", \"o\", \"w\"],\r\n [\"w\", \"e\", \"e\", \"e\", \"e\", \"w\"],\r\n [\"w\", \"w\", \"w\", \"w\", \"w\", \"w\"]\r\n ],\r\n 3: [\r\n [\"w\", \"w\", \"w\", \"w\", \"w\", \"w\", \"w\", \"w\"],\r\n [\"w\", \"w\", \"w\", \"e\", \"e\", \"e\", \"w\", \"w\"],\r\n [\"w\", \"o\", \"p\", \"b\", \"e\", \"e\", \"w\", \"w\"],\r\n [\"w\", \"w\", \"w\", \"e\", \"b\", \"o\", \"w\", \"w\"],\r\n [\"w\", \"o\", \"w\", \"w\", \"b\", \"e\", \"w\", \"w\"],\r\n [\"w\", \"e\", \"w\", \"e\", \"o\", \"e\", \"w\", \"w\"],\r\n [\"w\", \"b\", \"e\", \"bo\", \"b\", \"b\", \"o\", \"w\"],\r\n [\"w\", \"e\", \"e\", \"e\", \"o\", \"e\", \"e\", \"w\"],\r\n [\"w\", \"w\", \"w\", \"w\", \"w\", \"w\", \"w\", \"w\"],\r\n ]\r\n\r\n }\r\n const size = Object.keys(matrixes).length;\r\n this.maxLevel = size; \r\n return matrixes[level].slice();\r\n }", "function mo(t) {\n for (;t.Cl.length > 0 && t.xl.size < t.bl; ) {\n var e = t.Cl.shift(), n = t.Ml.next();\n t.Nl.set(n, new $i(e)), t.xl = t.xl.Ht(e, n), di(t.gl, new me(fe(re(e.path)), n, 2 /* LimboResolution */ , Q.U));\n }\n}", "function findNb(m) {\n var n = 0\n while (m > 0) m -= ++n ** 3\n return m ? -1 : n\n}", "function numm(n){\r\n for(var i=1;i<=5;i++){\r\n var str=\"\"\r\n for(var j=0;j<=n-i;j++){\r\n str=str+(i)\r\n }\r\n console.log(str)\r\n }\r\n }", "isMajor(){\n if(this.#type==\"Maj\")\n return true;\n if(this.#type==\"Min\")\n return false;\n return undefined\n }", "function findNb(m) {\n let rem = m;\n let n = 0;\n while (rem > 0){\n n ++;\n rem = rem - n*n*n;\n }\n return rem === 0 ? n : -1;\n}", "function mtnn(midi) {\n\t// -1 is a silence\n\tif (midi === -1) return ['s', '', '']\n\n\t// List all possible note to simplify the computation to a single modulo.\n\tconst note = ['a', 'a#', 'b', 'c', 'c#', 'd', 'd#', 'e', 'f', 'f#', 'g', 'g#'][(midi - 21) % 12]\n\n\t// Use the same method but move the change to the note between b and c\n\tconst height = Math.floor((midi - 12) / 12)\n\n\treturn [note[0], note[1] || '', height]\n}", "months() {\n return _monthLabels.map((ml, i) => ({\n label: ml,\n label_1: ml.substring(0, 1),\n label_2: ml.substring(0, 2),\n label_3: ml.substring(0, 3),\n number: i + 1,\n }));\n }", "function prodotto_compresi(n,m){\n if (n > m)\n return 1;\n else{\n if (n%2==0)\n return n * prodotto_compresi(n + 2,m);\n else\n return (n + 1) * prodotto_compresi(n + 3,m);\n }\n}", "function lcsDynamicProg(str1,str2,m,n){\n var lengthMatrix = [];\n\n for(var i=0;i<m+1;i++){\n\t lengthMatrix[i] = [];\n }\n for(var i=0;i<m+1;i++){\n for(var j=0;j<n+1;j++){\n lengthMatrix[i][j] = 0;\n }\n }\n \n for(var i=0;i<m;i++){\n for(var j=0;j<n;j++){\n if(i==0 || j==0){\n lengthMatrix[i][j] = 0;\n }\n else if(str1[i-1] == str2[j-1]){\n lengthMatrix[i][j] = 1+lengthMatrix[i-1][j-1];\n }\n else{\n lengthMatrix[i][j] = Math.max(lengthMatrix[i-1][j], lengthMatrix[i][j-1])\n }\n }\n }\n return lengthMatrix[m][n];\n}", "function msgf(m) // relevant ui index should always be at the end of jns_imc[]\n\t{\n\t\tif\t(m == \"array_end\")\treturn( jns_imc[ (jns_imc.length)\t-\t\t1 ] );\n\t\telse\t\t\t\t\treturn( jns_imc[ (jns_imc.length) \t+ (m - 6) ] );\n\t}", "drawGaugeLogarithmicScaleMinorTicks(majorTickValues, majorStep, drawMinor) {\n const that = this.context;\n let firstWholePower;\n\n if (majorStep instanceof JQX.Utilities.BigNumber) {\n majorStep = parseFloat(majorStep.toString());\n }\n\n for (let i in majorTickValues) {\n firstWholePower = i;\n if (i >= 0 && i % 1 === 0) {\n break;\n }\n }\n\n // positive powers\n for (let i = parseFloat(firstWholePower); i < that._drawMax; i += majorStep) {\n for (let j = 2; j <= 9; j++) {\n const value = j * Math.pow(10, i + majorStep - 1);\n\n if (value < that.max) {\n drawMinor(value);\n }\n }\n }\n\n // negative powers\n for (let i = parseFloat(firstWholePower); i > that._drawMin; i -= majorStep) {\n for (let j = 2; j <= 9; j++) {\n const value = j * Math.pow(10, i - 1);\n\n if (value > that.min) {\n drawMinor(value);\n }\n }\n }\n }", "function lastpris (n, m, s) {\n\treturn (m + s - 2) % n + 1;\n}", "function getScaleNotes(p_noteIndex, p_modeIndex, p_enhrIndex) {\n var v_ctr;\n var v_idx;\n\n v_idx = p_noteIndex;\n console.log(\"310 [\" + v_idx + \"] [\" + p_modeIndex + \"] [\" +\n a_modeIntervals[p_modeIndex].toString() + \"]\");\n for (v_ctr=0; v_ctr<7; v_ctr++) {\n// console.log(\"315 [\" + v_idx + \"]\");\n a_scaleNotes[v_ctr] = a_allNotes[p_enhrIndex][v_idx % 12]\n v_idx = (1 * v_idx) + (1 * a_modeIntervals[p_modeIndex][v_ctr]);\n// console.log(\"320 [\" + v_ctr + \"] [\" + v_idx + \"] [\" + a_scaleNotes[v_ctr] + \"]\");\n };\n}", "function bumpit(vNow, incType){\n // major = [0]\n // minor = [1]\n // patch = [2]\n const vArray = vNow.split('.');\n\nfor(const vIndex in vArray) {\n vArray[vIndex] = parseInt(vArray[vIndex], 10);\n}\n // patch\n if (incType === 'patch'){\n vArray[2] += 1; // increase patch\n } else if (incType === 'minor'){\n vArray[2] = 0; // set patch to 0\n vArray[1] += 1; // increase minor by 1\n } else if (incType === 'major'){\n vArray[2] = 0; // set patch to 0\n vArray[1] = 0; // set minor to 0\n vArray[0] += 1; // increase major by 1\n }\n\n return vArray.join('.');\n}", "function numOfIsland(n, m, operators) {\n const result = [];\n if (operators === undefined || operators.length === 0) {\n return result;\n }\n\n const id = new Array(n * m);\n id.fill(-1);\n\n let numComponent = 0;\n\n const directionX = [0, 0, 1, -1];\n const directionY = [1, -1, 0, 0];\n\n for (var i = 0; i < operators.length; i++) {\n let x = operators[i][0];\n let y = operators[i][1];\n\n let p = x * m + y;\n if (id[p] !== -1) {\n continue;\n }\n\n id[p] = p;\n numComponent++;\n\n for (var j = 0; j < 4; j++) {\n let nx = x + directionX[j];\n let ny = y + directionY[j];\n\n if (nx < 0 || nx >= n || ny < 0 || ny >= m) {\n continue;\n }\n\n let np = nx * m + ny;\n if (id[np] === -1) {\n continue;\n }\n\n if (find(np, id) !== find(p, id)) {\n id[find(np, id)] = find(p, id);\n numComponent--;\n }\n }\n result.push(numComponent);\n }\n return result;\n}", "function minNodeEntries () {\n return M/2;\n }", "function main() {\n let t = parseInt(readLine());\n\n while (t--) {\n const temp = readLine().split(' ');\n const n = parseInt(temp[0]);\n const m = parseInt(temp[1]);\n let matrix = [];\n let start = [];\n for (let i = 0; i < n; i++) {\n let arr = readLine().split('');\n if (arr.includes('M')) {\n start = [arr.indexOf('M'), i];\n }\n matrix.push(arr);\n }\n const k = parseInt(readLine());\n\n let path = '';\n\n function step(x, y) {\n if (\n x >= 0 &&\n x < n &&\n y >= 0 &&\n y < m &&\n typeof matrix[x][y] === 'string'\n ) {\n if (\n matrix[x][y] === '.' ||\n matrix[x][y] === 'M' ||\n matrix[x][y] === '*'\n ) {\n matrix[x][y] = 0;\n const str =\n `(${x},${y})` +\n step(x + 1, y) +\n step(x - 1, y) +\n step(x, y + 1) +\n step(x, y - 1);\n if (matrix[x][y] === '*') return str;\n }\n }\n return '';\n }\n\n path = path.length || step(start[1], start[0]);\n\n console.log(path);\n }\n}", "function buildMatrix(n, matrix){\n let subArr = []\n\n for(let i = 0; i < n; i++){\n for(let j = 0; j < n; j++){\n subArr.push(0)\n }\n matrix.push(subArr)\n subArr = []\n }\n}", "function change(m) {\n var result = create(m.length);\n for (var i = 0; i < m.length; i++) {\n for (var j = 0; j < m.length; j++) {\n var n = neighbors(m, i, j);\n if (m[i][j] == 0) {\n if (n == 3) {\n result[i][j] = 1;\n } else {\n result[i][j] = 0;\n }\n } else {\n if (n <= 1 || n >= 4) {\n result[i][j] = 0;\n } else {\n result[i][j] = 1;\n }\n }\n }\n }\n return result;\n}", "function pattern(n, m) {\n let stars = '';\nfor(let j=1; j<=m; j++){\n for(let i=1; i<=n; i++){\n stars = stars + '*';\n }\n if(j < m-1);{\n stars = stars + '\\n';\n }\n }\nreturn stars;\n}", "function updateTileNumber(ogNum){\n\treturn ogNum * 1;\n}", "function mn(t) {\n return j(pn(t)) + \"|lt:\" + t.nn;\n}", "function xMasTree(n) {\n const arr = [];\n for (let i = 1; i < n * 2; i += 2) {\n arr.push(\n \"_\".repeat((n * 2 - 1 - i) / 2) +\n \"#\".repeat(i) +\n \"_\".repeat((n * 2 - 1 - i) / 2)\n );\n }\n arr.push(\"_\".repeat((n * 2 - 2) / 2) + \"#\" + \"_\".repeat((n * 2 - 2) / 2));\n arr.push(\"_\".repeat((n * 2 - 2) / 2) + \"#\" + \"_\".repeat((n * 2 - 2) / 2));\n return arr;\n}", "function paperwork(n, m) {\n // if n or m is less than 0\n if ( n < 0|| m < 0){ return 0;}\n return n * m;\n\n}", "function saveThePrisoner(n, m, s){\n // Complete this function\n var remainder = (m - Math.floor(m / n) * n)\n if ((s + remainder - 1) > n){\n return (s + remainder - 1 - n)\n } else if ((s + remainder - 1) === 0){\n return (s + remainder - 1 + n)\n } else {\n return (s + remainder - 1)\n }\n}", "function getScaleNotes(scale,base,max) {\n interval = 0;\n ni = 0;\n notes = new Array();\n ints = new Array();\n for(n = 0; n < max; n++) {\n note = calcNote(base,interval);\n interval = interval + scale[ni];\n ints[n] = scale[ni];\n notes[n] = note;\n ni++;\n if (ni >= scale.length) ni = 0;\n }\n return notes;\n}", "function numh(n){\r\n for(var i=1;i<=n;i++){\r\n var str=\"\"\r\n for(var j=n;j>=i;j--){\r\n if(j==i){\r\n str=str+(\"*\")\r\n }\r\n else{\r\n str=str+(j)\r\n } \r\n }\r\n for(var kk=i-1;kk>=1;kk--){\r\n str=str+(kk)\r\n }\r\n console.log(str)\r\n }\r\n \r\n }", "set_maj_angles(maj_angles){\n if(!this.maj_angles) { this.maj_angles = [] }\n let new_angles = []\n let existing_maj_angles_length = this.maj_angles.length\n for(let j = 0; j < 7; j++) {\n let val\n if(j >= maj_angles.length) {\n if(j >= existing_maj_angles_length) { val = 0 }\n else { val = this.maj_angles[j] }\n }\n else { val = maj_angles[j] }\n new_angles.push(val)\n }\n this.maj_angles = dui2.fix_angles(new_angles)\n }", "Nr(){\n return this.Lj*12/6+1\n }", "function findMajor(arr){\r\n\tconst leng = arr.length\r\n\tconst obj = {}\r\n\tfor(let i=0; i<leng; i++){\r\n\t\tif(!obj[arr[i]]){\r\n\t\t\tobj[arr[i]] = 1\r\n\t\t}else{\r\n\t\t\tobj[arr[i]] += 1\r\n\t\t}\r\n\t}\r\n\tlet max = Math.max(...Object.values(obj))\r\n\treturn findKeyByValue(obj, max)\r\n}", "function createWalls(map)\n{\n //var n = [];\n for (var y = 0; y < map.length; y++)\n {\n for (var x = 0; x < map[0].length; x++)\n {\n if (map[y][x] === 1 && map[y][x] !== 2)\n {\n if (y > 0 && y < map.length - 1 && x > 0 && x < map[0].length - 1)\n {\n if (map[y][x + 1] === 0 || map[y + 1][x] === 0)\n map[y][x] = 2;\n if (map[y][x - 1] === 0 || map[y - 1][x] === 0)\n map[y][x] = 2;\n }\n if (y === 0) {\n if (map[y + 1][x] === 0)\n map[y][x] = 2;\n }\n if (y === map.length - 1) {\n if (map[y - 1][x] === 0)\n map[y][x] = 2;\n }\n if (x === 0) {\n if (map[y][x + 1] === 0)\n map[y][x] = 2;\n }\n if (x === map[0].length - 1) {\n if (map[y][x - 1] === 0)\n map[y][x] = 2;\n }\n }\n }\n }\n}", "function main(patch) {\n\tvar count = 1000o;//patch.inputPorts[\"count\"].value;\n\t\n\titeration++;\n\t\n\tvar def = new WMStructure([{ name : \"pos\",\n\t\t\t\t\t\t\t\t type : WMBuffer.Type.UnsignedShort,\n\t\t\t\t\t\t\t\tcount : 4,\n\t\t\t\t\t\t\t offset : 0,\n\t\t\t\t\t\t normalized : true}], 4 * 4);\n\t\n\tt = new WMBuffer(def, 4 * 4 * count);\n\t\n\tfor (var i=0; i<count; i++) {\n\t\tt.appendObject({\"pos\":[count + iteration + 0, count + iteration + 1, count + iteration + 2, count + iteration + 3]});\n\t}\n\t\n\treturn {t: t};\n}", "function defineMatrix(){\n matrix = new Array(6);\n for (let i = 0; i < 6; i++){\n matrix[i] = new Array(n + 1);\n for(let j = 0; j < n + 1; j++, numberMovement--){\n matrix[i][j] = numberMovement;\n //stringMat = stringMat + matrix[i][j].toString() + \" \";\n }\n if(i === 4){\n numberMovement = n - 1;\n }\n else{\n numberMovement = n;\n }\n //stringMat = stringMat + \"\\n\";\n }\n}", "function genlegendScaleLevels(start, end, num) {\n\tvar incr=(end[0]-start[0])/num;\n\tvar incg=(end[1]-start[1])/num;\n\tvar incb=(end[2]-start[2])/num;\n\tfor(k = 1; k <= num; k++) {\n\t\tcur=[Math.round(start[0]+k*incr),Math.round(start[1]+k*incg),Math.round(start[2]+k*incb)];\n\t\tcreateClass(\".heatLevel\"+k.toString(),\"fill: rgb(\"+cur.toString()+\");\");\n\t\tlegendScaleLevels[k]=cur;\n\t}\n}", "function makeNewViewMask (tiles, n = 0) {\n // console.log(tiles);\n\n const mask = {}\n tiles.forEach((a, id, b) => { mask[id] = n })\n return mask\n}", "function makeN(){\n\tvar mimaps = [{'mi':5,'ma':7,'p':0.7},{'mi':8,'ma':10,'p':0.3}];\n\treturn wRand(mimaps);\n}", "function getYMASMajorDefects() {\n var result;\n result = {\n table: {\n widths: ['*'],\n body: [\n [{\n stack: [\n {\n text: 'Significant risk or cost consequences of not proceeding with this advice are as follows:',\n bold: true,\n margin: [0, 0, 0, 4]\n },\n {\n text: getIt('YMAS-TEXT2')\n }\n ],\n style: 'tableText',\n alignment: 'justify'\n }]\n ]\n }\n };\n return result;\n}", "function initDistMat(n) {\n let d = {};\n for (let i = 0; i < n; i++) {\n d[i] = { [i]: 0 };\n }\n return d;\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 mn(t) {\n return t instanceof kn ? t.version : st.min();\n}", "initializeNodeIndex() {\n for (let i = 0; i < this.n * this.m; ++i)\n this.node_index[i] = i;\n }", "function numberOfRectangles(m, n) {\n var sumM = 0;\n var sumN = 0;\n for (var i = 1; i <=m; i++){\n sumM += i;\n }\n for (var j = 1; j <=n; j++){\n sumN += j;\n }\n return sumM * sumN;\n}", "function _reduceMatrixTerms(m) {\r\n let columns, c, row, r, new_text;\r\n\r\n columns = $(m).children();\r\n for (c = 0; c < columns.size(); c += 1) {\r\n row = $(columns[c]).children();\r\n for (r = 0; r < row.size(); r += 1) {\r\n new_text = _reduceTerm($(row[r]).html());\r\n //console.log('reduce: ', $(row[r]).text(), ' to ', new_text);\r\n if (r < row.size() - 1) {\r\n new_text += \"<br>\";\r\n }\r\n $(row[r]).html(new_text);\r\n }\r\n }\r\n }", "actualNotes(mR){\n var n = [];\n var mask = 0xff;\n for(var i = 0; i < 4; i ++){\n n.push( (mR & (mask<<i*8))>>>i*8 );\n }\n var l = [];\n n.forEach((element) => {\n l.push(this.rootName[element%12]);\n });\n return l.toString();\n\n }", "function nombre_mes(mes) {\r\n let m_l = meses[mes].length;\r\n let linea = ' '.repeat(11 - Math.floor(m_l / 2)) + meses[mes];\r\n linea = linea + ' '.repeat(22 - linea.length) + '|';\r\n return linea;\r\n}", "function createSmMass() {\r\n let randomNUm = (Math.random() * (1- 0 + 1)) << 0\r\n i++;\r\n smMass[i] = new component(30, 30, colors[i % 3], 130, 0, shapes[randomNUm], weights[randomNUm]); // small one which can move\r\n smMass[i].speedY = +1;\r\n}", "function mazeCellBuilder(maze, row, m, n)\n {\n var cell = maze.cells[m][n];\n cell.token = createToken(cell.wall, m, n);\n cell.visited = false;\n \n row.appendChild(cell.token);\n \n return m + 1;\n }", "function countWays (num, m) {\n\tconst result = Array(num);\n\tresult[0] = 1;\n\tresult[1] = 1;\n\tfor (let i = 2; i < num; i++) {\n\t\tresult[i] = 0;\n\t\tfor (let j = 1; j <= m && j <= i; j++) {\n\t\t\tresult[i] += result[i-j];\n\t\t}\n\t}\n\tconsole.log(result[num - 1]);\n\treturn result[num - 1];\n}", "buildSecondaryDominants(scale, key) {\n let secondaryDominants = [];\n\n if (key.split(\"\").includes(\"m\")) {\n for (let i = 0; i < scale.length; i++) {\n if (i === 0 || i === 1 || i === 3 || i === 4) {\n secondaryDominants.push(`${scale[i]}7`)\n }\n }\n } else {\n for (let i = 0; i < scale.length; i++) {\n if (i === 1 || i === 2 || i === 5 || i === 6) {\n secondaryDominants.push(`${scale[i]}7`)\n }\n }\n }\n return secondaryDominants\n }", "function checkMajorMinor(duration) {\n if (duration > major_minor_duration * 60) {\n return \"major\";\n } else {\n return \"minor\";\n }\n}", "function createLineFieldNumbers() {\n\tconst lineFieldNumbers = [];\n\n\tfor (let i = 0; i < 7; i++) {\n\t\tconst horizintalNumbers = [];\n\t\tconst verticalNumbers = [];\n\t\tfor (let j = 0; j < 7; j++) {\n\t\t\thorizintalNumbers.push(7*i + j);\n\t\t\tverticalNumbers.push(7*j + i);\n\t\t}\n\t\tlineFieldNumbers.push(horizintalNumbers);\n\t\tlineFieldNumbers.push(verticalNumbers);\n\t}\n\n\tfor (let i = 0; i < 4; i++) {\n\t\tconst lowerDiagonalNumbers = [];\n\t\tfor (let j = 0; j < i + 4; j++) {\n\t\t\tlowerDiagonalNumbers.push(7*(3 - i + j) + j);\n\t\t}\n\t\tlineFieldNumbers.push(lowerDiagonalNumbers);\n\t}\n\tfor (let i = 0; i < 3; i++) {\n\t\tconst lowerDiagonalNumbers = [];\n\t\tfor (let j = 0; j < 6 - i; j++) {\n\t\t\tlowerDiagonalNumbers.push(7*j + i + 1 + j);\n\t\t}\n\t\tlineFieldNumbers.push(lowerDiagonalNumbers);\n\t}\n\n\tfor (let i = 3; i < 7; i++) {\n\t\tconst upperDiagonalNumbers = []\n\t\tfor (let j = 0; j < i + 1; j++) {\n\t\t\tupperDiagonalNumbers.push(7*(i - j) + j);\n\t\t}\n\t\tlineFieldNumbers.push(upperDiagonalNumbers)\n\t}\n\tfor (let i = 0; i < 3; i++) {\n\t\tconst upperDiagonalNumbers = []\n\t\tfor (let j = 0; j < 6 - i; j++) {\n\t\t\tupperDiagonalNumbers.push(7*(6 - j) + i + 1 + j);\n\t\t}\n\t\tlineFieldNumbers.push(upperDiagonalNumbers)\n\t}\n\n\treturn lineFieldNumbers;\n}", "function make_yMajor_gridlines() {\n return d3.axisLeft(y)\n .ticks(yGridLength)\n }", "function notifn(heads, bodies, n) {\n var notif = {};\n notif.title = hbn(heads, n);\n notif.text = hbn(bodies, n);\n notif.at = reminder_time(remstate.start_time, n, desc.time);\n notif.data = { type: desc.type, sd: n };\n // Mark past times with negative ids.\n //\n notif.id = n < nnext ? -1 : 1;\n return notif;\n }", "calcMaxLength () {\n let maxima = [0.0, 0.0, 0.0]\n let minima = [0.0, 0.0, 0.0]\n let spans = [0.0, 0.0, 0.0]\n\n function comp (v, i) {\n if (i === 0) return v.x\n if (i === 1) return v.y\n if (i === 2) return v.z\n }\n\n let atom = this.getAtomProxy()\n for (let iDim = 0; iDim < 3; iDim++) {\n for (let iAtom = 0; iAtom < this.getAtomCount(); iAtom += 1) {\n let pos = atom.load(iAtom).pos\n if (minima[iDim] > comp(pos, iDim)) {\n minima[iDim] = comp(pos, iDim)\n }\n if (maxima[iDim] < comp(pos, iDim)) {\n maxima[iDim] = comp(pos, iDim)\n }\n }\n spans[iDim] = maxima[iDim] - minima[iDim]\n }\n this.maxLength = Math.max(spans[0], spans[1], spans[2])\n }", "initializeEdgeIndex() {\n let counter = 0;\n for (let i = 0; i < this.n; ++i) // iterate over nodes\n {\n for (let j = 0; j < this.m; ++j) {\n if (i != this.n - 1 && j != this.m - 1) { // if the node is not from the last row \n this.edge_index[counter] = i * this.m + j; // and not from the last column we add to\n ++counter // the array edge that goes down and the edge \n this.edge_index[counter] = i * this.m + j + 1; // that goes to the right\n ++counter;\n this.edge_index[counter] = i * this.m + j;\n ++counter;\n this.edge_index[counter] = (i + 1) * this.m + j;\n ++counter;\n }\n if (i != this.n - 1 && j == this.m - 1) { // similar to the rest of cases\n this.edge_index[counter] = i * this.m + j;\n ++counter;\n this.edge_index[counter] = (i + 1) * this.m + j;\n ++counter;\n }\n if (i == this.n - 1 && j != this.m - 1) {\n this.edge_index[counter] = i * this.m + j;\n ++counter\n this.edge_index[counter] = i * this.m + j + 1;\n ++counter;\n }\n }\n }\n }", "function motifEnumeration(dna, k, d) {\n var patterns = [];\n var neighborhood = [];\n var frequentPatterns = [];\n var frequencyArray = [];\n var max = Math.pow(4,k)-1; \n var index; \n var pattern; \n var tam = dna.length;\n dna.forEach(function(text){\n neighborhood = [];\n patterns = findPatterns(text,k);\n patterns.forEach(function(pattern){\n neighborhood = neighborhood.concat(neighbors(pattern,d));\n }); \n neighborhood = removeDuplicate(neighborhood);\n frequentPatterns.push(neighborhood);\n });\n for (var i = 0; i <= max; i++){\n frequencyArray[i] = 0;\n }\n frequentPatterns.forEach(function(patterns){\n patterns.forEach(function(pattern){\n index = patternToNumber(pattern);\n frequencyArray[index] += 1;\n }); \n }); \n frequentPatterns = [];\n for (var i = 0; i <= max; i++){\n if(frequencyArray[i] >= tam){\n pattern = numberToPattern(i,k); \n frequentPatterns.push(pattern);\n }\n }\n return frequentPatterns.join(\" \");\n}", "function findMajorityNumber2(nums)\n{\n var count = 0;\n var major = null;\n for (i = 0; i < nums.length; i++) {\n if (count === 0) {\n major = nums[i];\n }\n count += nums[i] === major ? 1 : -1;\n }\n return major;\n}", "function matrix(n) {\n let count = 0;\n let bound = {\n t: 0,\n l: 0,\n b: n,\n r: n\n };\n let matrix = [];\n for(let i = 0; i < n; i++){\n matrix.push([])\n }\n\n while(bound.t <= bound.b && bound.l <= bound.r){\n for(let i = bound.l; i < bound.r; i++){\n count++;\n matrix[bound.t][i] = count\n }\n bound.t++;\n\n for(let i = bound.t; i < bound.b; i++){\n count++;\n matrix[i][bound.r - 1] = count\n }\n bound.r--;\n\n for(let i = bound.r - 1; i >= bound.l; i--){\n count++;\n matrix[bound.b - 1][i] = count\n }\n bound.b--;\n\n for(let i = bound.b - 1; i >= bound.t; i--){\n count++;\n matrix[i][bound.l] = count\n }\n bound.l++\n }\n return matrix\n}", "function jkltk(n){\r\n for(var i=1;i<=n;i++){\r\n var str=\"\"\r\n var k=i;\r\n for(var j=5;j>=1;j--){\r\n if(i>=j){\r\n str=str+(k)\r\n k--\r\n }\r\n else{\r\n str=str+(\" \")\r\n }\r\n }\r\n console.log(str)\r\n }\r\n \r\n }", "function numGen(bombs) {\n bombs.map(a => {\n let area;\n\n // defining how to look at each cell and determine whether to add a number\n\n // specific for right side of the grid to not add numbers to cells on next line\n \n if ((a + 1) % size === 0) {\n area = [a - 1, a + size, a - size, a + size - 1, a - size - 1];\n } \n \n // specific for left side of the grid to not add numbers to cells on next line\n\n else if (a % size === 0) {\n area = [a + 1, a + size, a - size, a + size + 1, a - size + 1];\n } \n\n // gets all the cells in the middle that arent on the edges\n\n else {\n area = [a + 1, a - 1, a + size, a - size, a + size - 1, a - size - 1, a + size + 1, a - size + 1];\n }\n\n // iterates through the area within the board and the non-mine cells and increments each number\n // in the cell based on the number of mines it is touching.\n area.map(b => {\n if ((b < (size * size) && b >= 0) && (HTMLboard.children[b].getAttribute(\"data-ismine\") == \"false\")) {\n let num = HTMLboard.children[b].getAttribute(\"data-touching\");\n HTMLboard.children[b].setAttribute(\"data-touching\", parseInt(num) + 1);\n }\n });\n\n });\n}", "function getMajorScale(rootnote){\n var root = musicList.note(rootnote);\n var second = root.whole();\n var third = second.whole();\n var fourth = third.half();\n var fifth = fourth.whole();\n var sixth = fifth.whole();\n var seventh = sixth.whole();\n var eighth = seventh.half();\n var results = [root.name(), second.name(), third.name(), fourth.name(), fifth.name(), sixth.name(), seventh.name(), eighth.name()];\n return results;\n}", "function draw_grid( rctx, rminor, rmajor, rstroke, rfill ) \r\n{\r\n rctx.save( );\r\n rctx.strokeStyle = rstroke;\r\n rctx.fillStyle = rfill;\r\n let width = rctx.canvas.width - 25;\r\n let height = rctx.canvas.height - 15;\r\n for ( var ix = 0; ix < width - 10; ix += rminor )\r\n {\r\n rctx.beginPath( );\r\n rctx.moveTo( ix + 20, 15 );\r\n rctx.lineTo( ix + 20, height);\r\n rctx.lineWidth = ( ix % rmajor == 0 ) ? 0.5 : 0.25;\r\n rctx.stroke( );\r\n if ( ix % rmajor == 0 ) { rctx.fillText( ix / 5, ix + 15, 10 ); }\r\n }\r\n for ( var iy = 0; iy < height - 10; iy += rminor )\r\n {\r\n rctx.beginPath( );\r\n rctx.moveTo( 20, iy + 15 );\r\n rctx.lineTo( width + 5, iy + 15 );\r\n rctx.lineWidth = ( iy % rmajor == 0 ) ? 0.5 : 0.25;\r\n rctx.stroke( );\r\n if ( iy % rmajor == 0 && iy != 0) {rctx.fillText( iy / 5, 0, iy + 20 );}\r\n }\r\n rctx.restore( );\r\n}", "function giveMajor(){\n listy = [1]\n for(k=0;k<1000000;k++){\n y = (2*listy[k])+1;\n x = (3*listy[k])+1;\n listy.push(y);\n listy.push(x);\n }\n function sortNumber(a,b) {\n return a - b;\n }\n listy.sort(sortNumber);\n return [...new Set(listy)];\n}", "function getInitialNotes() {\n\tlet vector = new Matrix(1,NOTE_RANGE);\n\treturn vector.withFunction(x => Math.floor(2*Math.random()));\n}", "function utopianTree(n) {\r\n var growtn=1;\r\n for(var i=1;i<=n;i++){\r\n \r\n (i%2 !=0) ? growtn *=2:growtn++\r\n \r\n }\r\n \r\n return growtn;\r\n }", "function make_divs_undergrad_minors(tag_undergrad_minors_row,ugminors,div_bg,div_icon){\n //making div for a minor\n\n $div_to_append = $(\"<div class='tag_undergrad_minors_for_minor' style='background:\"+div_bg+\"'><i\" +\n \" class='\"+div_icon+\" fa-4x' style='color:white; margin-top: 30px'></i></div>\");\n\n $div_to_append.append(\"<p class='tag_undergrad_minors_for_minor_title'>\"+ugminors.title+\"</p>\");\n\n $div_to_append.on(\"click\",function () {\n create_modal_minors(this,ugminors);\n });\n // div box\n tag_undergrad_minors_row.append($div_to_append);\n\n }" ]
[ "0.6104964", "0.6036262", "0.5782669", "0.57583183", "0.5351479", "0.53313696", "0.53313696", "0.53313696", "0.5235025", "0.5235025", "0.50572795", "0.5027724", "0.50156075", "0.4935707", "0.48972484", "0.488601", "0.48772857", "0.47691962", "0.4761753", "0.47323486", "0.4722992", "0.47181568", "0.47162426", "0.46971053", "0.46885148", "0.46869412", "0.46656606", "0.46650037", "0.46612605", "0.4655889", "0.46526337", "0.46516553", "0.46512288", "0.4628649", "0.46173388", "0.4616068", "0.45751196", "0.45715475", "0.4565891", "0.45566812", "0.45480108", "0.45445675", "0.45156327", "0.45142403", "0.45052502", "0.44881555", "0.44667578", "0.4458918", "0.4456812", "0.44398963", "0.44348612", "0.44315976", "0.44269684", "0.4417268", "0.4415313", "0.44133893", "0.44081137", "0.4398594", "0.43957636", "0.4390342", "0.43657058", "0.43641505", "0.4364072", "0.43623587", "0.43458414", "0.43455356", "0.4340235", "0.4334674", "0.43341523", "0.43303856", "0.43266204", "0.43250883", "0.4319674", "0.43145546", "0.43134493", "0.43117678", "0.43106392", "0.43086773", "0.43075213", "0.4300111", "0.4294668", "0.42871338", "0.4286532", "0.4284736", "0.42822582", "0.428107", "0.42802587", "0.4278072", "0.4273706", "0.4273185", "0.4272273", "0.4271711", "0.42711437", "0.42693406", "0.42608336", "0.42603663", "0.42584148", "0.42576566", "0.4246736", "0.42455897" ]
0.69566524
0
overwrtiting the base class method
set textContent(slot) { super.textContent = slot.symbol; this.element.style.backgroundColor = "white"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SuperclassBare() {}", "function SuperclassBare() {}", "function Derived() {} // private", "function inherited() { }", "function inherit(){}", "_init() {\n throw new Error('_init not implemented in child class');\n }", "_validate() {\n throw new Error('_validate not implemented in child class');\n }", "update() {\r\n throw new Error('must be set in subclass');\r\n }", "initCustomFunctions() {/*To be overridden in sub class as needed*/}", "function Base() {}", "method() {\n throw new Error('Not implemented');\n }", "function LightingMethodBase() {\n _super.call(this);\n }", "slice() {\n // redefine method in derived classes\n }", "__previnit(){}", "function superCall(context,methodName){var args=zrUtil.slice(arguments,2);return this.superClass.prototype[methodName].apply(context,args);}", "constructor() {\n\t\tsuper(...arguments);\n\t}", "function BaseClass() {}", "function BaseClass() {}", "constructor() { super() }", "Use(){\n throw new Error(\"Use() method must be implemented in child!\");\n }", "redo() {\n throw new Error(\"Redo function must be overwritten in child class\");\n }", "transient private protected internal function m182() {}", "baseOperation1() {\n console.log(\"AbstractClass says: I am doing the bulk of the work\");\n }", "constructor () { super() }", "function ExtraMethods() {}", "transient protected internal function m189() {}", "init() {\n this._super(...arguments);\n }", "execute() {\n throw new Error(\"Must be implemented in subclass\");\n }", "function Base() {\n}", "initialize() {\n // Needs to be implemented by derived classes.\n }", "function Super () {}", "function Super () {}", "static method(){}", "Pick(){\n throw new Error(\"Pick() method must be implemented in child!\");\n }", "private public function m246() {}", "constructor () {\n // Run super\n super();\n }", "constructor () {\n // Run super\n super();\n }", "transient final protected internal function m174() {}", "_getOrigEntityHpTempPath() {\n throw new Error('Child class must implement `_getOrigEntityHpTempPath`');\n }", "function Base() {\n }", "_getOrigEntityHpPath() {\n throw new Error('Child class must implement `_getOrigEntityHpPath`');\n }", "pMethod(){\r\n console.log(\"Parent Method\"); \r\n }", "init() {\n throw new Error('NOT_IMPLEMENTED_EXCEPTION: you must override this method in order to use it')\n }", "edit(args) {\r\n throw \"Error this method should be overridden by its extended class\";\r\n }", "function ResponseBase() {}", "method(){}", "_add () {\n throw new Error('not implemented')\n }", "submit()\n {\n throw Error(\"Cannot call this fucntion from a base class\");\n }", "constructor() {\n\n\t\tsuper();\n\n\t}", "_getChangedEntityHpTempPath() {\n throw new Error('Child class must implement `_getChangedEntityHpTempPath`');\n }", "sayHello()\n {\n super.sayHello();\n }", "function BaseSuggestionRetrieverComponent() {\n\n }", "doSomethingSpecial() {\n this.logger.debug('Only I have this method, my parent does not!');\n }", "transient private internal function m185() {}", "function base (_entity) {\n entity = _entity;\n return methods;\n }", "constructor() {\n\t\tsuper();\n\t}", "constructor() {\n\t\tsuper();\n\t}", "overrideClassFunctions(subClassName=\"State Senator\"){\n var self = this;\n switch(subClassName){\n case \"US Representative\":\n self.selectedExtractID = usRepresentativeExtractIDFunction;\n self.meshFunction = usRepresentativeMeshFunction;\n break;\n default:\n self.selectedExtractID = genericExtractIDFunction;\n self.meshFunction = genericMeshFunction;\n }\n }", "_init() {\n throw new TypeError('BaseModel#_init method must be implemented by the class extending BaseModel');\n }", "prepareBaseData() { super.prepareBaseData(); }", "function r(t,e){if(!t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return!e||\"object\"!=typeof e&&\"function\"!=typeof e?t:e}", "function BaseElement() {\n }", "init() {\n this._super(...arguments);\n this._applyDefaults();\n }", "protected internal function m252() {}", "ap (_) { \n return this\n }", "obtain(){}", "function BaseRenderer() {\n }", "constructor() {\n super()\n }", "constructor() {\n super();\n }", "_getChangedEntityHpPath() {\n throw new Error('Child class must implement `_getChangedEntityHpPath`');\n }", "postorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "constructor() {\n super(); \n }", "function CVBaseElement() {\n }", "render() { return super.render(); }", "clear(){\n throw new Error('Abstract Method');\n }", "function UHRBase() {\n\n}", "function UHRBase() {\n\n}", "native() {\n throw new Error('NOT_IMPLEMENTED_EXCEPTION: you must override this method in order to use it')\n }", "function BaseObservable() {}", "function LoggerBase(){\n\n\t}", "function GestureTaskBase() {\r\n BaseObject.apply(this, arguments);\r\n }", "constructor () {\r\n\t\t\r\n\t}", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "constructor() {\r\n super();\r\n }", "prepare() {\n super.prepare()\n }", "function BaseErrorHandler() {\n\n }", "get base() {\n\t\treturn this.__base;\n\t}", "function CNodeBase() {\r\n\r\n}", "transient private protected public internal function m181() {}", "constructor() {\n super()\n }", "function example3 () {\n function Animal(name) {\n this.name = name;\n this.speed = 0;\n }\n\n Animal.prototype.run = function(speed) {\n this.speed += speed;\n console.log( this.name + ' бежит, скорость ' + this.speed );\n };\n\n function Rabbit(name) {\n this.name = name;\n this.speed = 0;\n }\n\n Rabbit.prototype = Object.create(Animal.prototype)\n Rabbit.prototype.constructor = Rabbit\n\n Rabbit.prototype.jump = function() {\n this.speed++;\n console.log( this.name + ' прыгает' );\n };\n\n //total overriding\n Rabbit.prototype.run = function () {\n this.speed++\n this.jump()\n }\n\n // extend parent method\n Rabbit.prototype.run = function() {\n Animal.prototype.run.apply(this, arguments) // don't forget about proper context\n this.jump()\n };\n\n var rabbit = new Rabbit('Кроль');\n}" ]
[ "0.658801", "0.658801", "0.6444007", "0.63787264", "0.62448585", "0.6161258", "0.6152798", "0.61477923", "0.6138755", "0.6083694", "0.60551834", "0.6012701", "0.5978831", "0.5976824", "0.59462583", "0.59222496", "0.59062105", "0.59062105", "0.59019303", "0.58654284", "0.5856729", "0.5856658", "0.58561116", "0.584922", "0.583476", "0.58181757", "0.58019674", "0.5769935", "0.5765742", "0.5749599", "0.57306707", "0.57306707", "0.5722874", "0.5710142", "0.5709684", "0.57094175", "0.57094175", "0.5697633", "0.5670593", "0.5652061", "0.5644828", "0.56031597", "0.5594495", "0.5592632", "0.5578508", "0.55744314", "0.55656946", "0.55613583", "0.55604064", "0.55594367", "0.55341876", "0.5511713", "0.55094373", "0.55011934", "0.5495391", "0.54946566", "0.54946566", "0.5494149", "0.5491088", "0.54879826", "0.5485273", "0.5478594", "0.5475688", "0.5453415", "0.5447729", "0.54453266", "0.54421777", "0.5439442", "0.54376936", "0.54295385", "0.5427728", "0.5427513", "0.54274577", "0.5425951", "0.5418978", "0.54172105", "0.54172105", "0.54160744", "0.539811", "0.53847116", "0.53843606", "0.538416", "0.5384152", "0.5384152", "0.5384152", "0.5384152", "0.5384152", "0.5384152", "0.5384152", "0.5384152", "0.5384152", "0.5384152", "0.5384152", "0.5384152", "0.5376731", "0.5370366", "0.5365928", "0.53657025", "0.5360946", "0.5359455", "0.5354329" ]
0.0
-1
removes the default question and answer template from the index.html
function resetState () { while (answerButtonsEl.firstChild) { answerButtonsEl.removeChild(answerButtonsEl.firstChild); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderDefaultQuestions() {\n const questions = [\"What type of courses Esoft conduct ?\",\"Is Esoft government funding institute ?\",\"How many branches esoft has ?\",\"Is Esoft UGC Approved ?\"];\n let content = '';\n questions.forEach(function(ques) {\n content += '<div class=\"default-question\"><a href=\"#\" data-toggle=\"modal\" class=\"color-white send-default-question\" q=\"'+ques+'\">'+ques+'<a/></div>';\n });\n\n return content;\n }", "function generateWrongPage(){\n //grabs correctAnswer for the question just answered as well as the answer the user selected\n let correctAnswer = Object.values(store.questions)[store.questionNumber].correctAnswer;\n let selected = $('input[type=radio]:checked', '#question-form').val();\n return `\n <h1 class=\"wrong-page\" role=\"heading\">Sorry, you are wrong!</h1>\n <h2>Correct Answer: ${correctAnswer}</h2>\n <h2>Your Answer: ${selected}</h2>\n <figure role=\"figure\" aria-labelledby=\"animated better luck next time\">\n <img src=\"https://cdn.discordapp.com/emojis/413209254359597056.gif?v=1\" alt=\"animated better luck next time\">\n <figcaption id=\"caption\">Better luck next time</figcaption>\n </figure>\n <h2 class=\"current-score\">Your current score is: ${store.score} out of ${Object.values(store.questions).length}</h2>\n <button id=\"next-question\" type=\"submit\" role=\"button\">Continue</button>`;\n}", "get checkYourAnswersTemplate() {\n return false;\n }", "get checkYourAnswersTemplate() {\n return false;\n }", "get checkYourAnswersTemplate() {\n return false;\n }", "get checkYourAnswersTemplate() {\n return false;\n }", "function loadQuestion() {\n if (isSigned() == false) {\n window.location = \"/#/welcome\";\n return;\n }\n document.getElementById(\"view\").innerHTML = document.getElementById(\"question_template\").innerHTML;\n}", "function renderIncorrectAnswerPage() {\r\n let incorrectAnswerPage = `<div class=\"content\">\r\n <h2>Sorry Bud</h2> <p>The correct answer was ${store.questions[store.questionNumber].correctAnswer}. Better luck next time!</p> <p>Your score: ${store.score}/5</p><form> <button id=\"next-question\">Next Question</button> </form> </div>`\r\n return incorrectAnswerPage;\r\n}", "function questionTemplate() {\n // create a variable to store the radio buttons with the labels as a list item\n let answerTemp = ``;\n // get the question we are at assign the value to questionTemp\n let questionTemp = store.questions[store.questionNumber];\n\n for (let i = 0; i < questionTemp.answers.length; i++) {\n answerTemp += `<li class=\"radioButton\" ><input type=\"radio\" name=\"answer\" value=\"${questionTemp.answers[i]}\" required>\n <label>${questionTemp.answers[i]}</label>\n </li>`;\n }\n // return html with the question in the title and the answers as radio buttons\n let questionsPage = `\n <div class=\"container\">\n <h4>Question ${store.questionNumber + 1} out of ${\n store.questions.length\n }: </h4>\n <h3>${questionTemp.question}</h3>\n <form>\n <ul class=\"radioAlign\">\n ${answerTemp}\n </ul>\n <div class=\"center-submit\"> \n <button class=\"js-submit\" type=\"submit\">Submit</button>\n </div>\n </form>\n \n <div class=\"score\">${scoreTemplate(true)}</div>\n </div>\n `;\n\n return questionsPage;\n}", "function templateQuestion(questionIndex) {\n // console.log(\"function templateQuestion\", questionIndex);\n updateQuestionAndScore();\n let questionForm = $(`\n <form class=\"form\"> \n <fieldset> \n <legend class=\"question\">${STORE[questionIndex].question}</legend>\n <ul></ul>\n </fieldset> \n </form>\n `)\n\n let formSection = $(questionForm).find('ul');\n\n STORE[questionIndex].answers.forEach(function (answerValue, answerIndex) {\n $(`<li>\n <label class=\"option\" for=\"${answerIndex}\">\n <input class=\"radio\" type=\"radio\" id=\"${answerIndex}\" value=\"${answerValue}\" name=\"answer\" required>\n <span>${answerValue}</span>\n </label>\n </li>`).appendTo(formSection);\n });\n $(`<div class=\"block-button\"><button type=\"submit\" class=\"submit\">Go</button></div>`).appendTo(formSection);\n $('.questions').append(questionForm);\n $('.questions').show();\n $('.result').hide();\n}", "function resetQuestionIndex() {\n questionIndex = 0;\n}", "function revertToDefaultView() {\n let notesSection = document.querySelector(\"#notes-wrapper\");\n let placeholderArea = notesSection.querySelector(\"#placeholder-area\");\n let attachments = notesSection.querySelector(\"#attachments\");\n let commentDialog = notesSection.querySelector(\"#comment-dialog\");\n commentDialog.setAttribute(\"hidden\", \"\");\n placeholderArea.removeAttribute(\"hidden\");\n attachments.removeAttribute(\"hidden\");\n}", "function clearQuestion() {\n console.log(\"Clear html\");\n document.getElementById(\"question-choices\").innerHTML = \"\";\n quizOver();\n }", "function handleQuizApp(){\r\n renderStartTemplate();\r\n checkIfCorrect();\r\n changeToQuizTemplate();\r\n nextQuestion();\r\n}", "function removeExtraneousPageData() {\r\n // get a list of questions to remove the screen reader offensive material.\r\n var questions = document.getElementsByClassName(\"questionDisplay\");\r\n for (var question = 0; question < questions.length; ++question) {\r\n try {\r\n // remove the <legend> tags globally\r\n var legends = questions[question].getElementsByTagName(\"legend\");\r\n while (legends.length > 0) {\r\n legends[0].parentNode.removeChild(legends[0]);\r\n }\r\n\r\n //remove the points possible on the assignment. These don't help\r\n questions[question].getElementsByClassName(\r\n \"pointDisplay\"\r\n )[0].textContent =\r\n questions[question]\r\n .getElementsByClassName(\"pointDisplay\")[0]\r\n .textContent.replace(/\\([0-9]+pts\\)/g, \"\")\r\n .trim() + \"\\n\";\r\n\r\n // remove the extra select blah as your answer headers. These don't help.\r\n var labels = questions[question].getElementsByTagName(\"label\");\r\n for (var n = 0; n < labels.length; ++n) {\r\n labels[n].textContent = labels[n].textContent.replace(\r\n /Select (.*) as your answer/g,\r\n \"\"\r\n );\r\n }\r\n } catch (err) {\r\n console.log(\"An error has occurred\\n\" + err);\r\n }\r\n }\r\n}", "function reset () {\n answer = \"\";\n if (questionCount < questions.length) {\n $(\".game\").html(\"\");\n $(\"#choices\").html(\"\");\n questionSetup();\n time = 20;\n }\n else {\n finish();\n }\n }", "_page_clear(){\r\n\t\tvar core = this;\r\n\t\tcore._app_templates = [];\r\n\t}", "function clearPage(){\n $(\"#question, #timer, #picture, #question, #answers, #gameMessage, #tryAgain\").html(\"\");\n}", "function clearPage() {\n quizQuestion.empty();\n timeRem.empty();\n quizAnswers.empty();\n }", "function removeQuestion() {\n $('#answer-list').children().remove();\n $('h3').children().remove();\n}", "function clearForms() {\n // Reset all form's values\n $(\"form\").trigger(\"reset\");\n \n /* Remove all elements from form \n * with class question\n * in QUESTIONS PAGE */\n $(\".question\").empty();\n \n /* Remove all elements from form \n * with id qpp (questions per page)\n * in QUESTIONS PER PAGE */\n $(\"#qpp\").empty();\n \n // Disable both next and previows buttons\n disableElement(\"#nextBtn\");\n disableElement(\"#prevBtn\");\n}", "function getNewQuestion() {\n $question.html(\"\");\n $btn0.text(\"\");\n $btn1.text(\"\");\n $btn2.text(\"\");\n $btn3.text(\"\");\n if (questions.length === 0) {\n endQuiz();\n } else {\n setNextQuestion();\n }\n }", "function addTemporaryQuestion() {\n\tvar li = document.createElement('li');\n\tli.innerHTML = templates.renderQuestions({questions: null});\n\tleftPane.appendChild(li);\n }", "function testDefaultTemplate() {\n templateManager = bite.client.TemplateManager.getInstance();\n stubs.set(bite.common.net.xhr.async, 'get', function() {return null;});\n templateManager.getAllTemplates(goog.partial(assertTemplateIdsEqual,\n ['bite_default_bug']));\n}", "function clearPage(){\n $(\".answers\").empty();\n $(\".question-text\").empty();\n $(\".feedback\").empty();\n}", "function resetQuestions() {\n \n clearStatusClass(document.body)\n nextButton.classList.add('hide')\n // Removes all children before setting new.\n while (answerButtons.firstChild) {\n answerButtons.removeChild\n (answerButtons.firstChild)\n }\n}", "function generateQuestionPage(){\n //grabs current question, question number\n const allQuestions = store.questions;\n const currentQuestionNumber = store.questionNumber;\n const currentQuestionData = allQuestions[currentQuestionNumber];\n const currentQuestion = currentQuestionData.question;\n //grabs HTML for the current answer choices\n const choicesHTML = generateChoices();\n\n return `\n <h1 class=\"quiz-questions\" role=\"heading\">Question ${currentQuestionNumber + 1} out of ${store.questions.length}</h1>\n <section role=\"region\" aria-label=\"Question\" class=\"quiz-area\">\n <h3 class=\"score-result\">Score: ${store.score} out of ${Object.values(store.questions).length}</h3>\n <figure>\n <img src=\"https://cdn.discordapp.com/emojis/615236185882886164.png?v=1\" alt=\"thinking emoji\">\n <figcaption>Hmmm...</figcaption>\n </figure>\n <form id=\"question-form\" action=\"#\" aria-label=\"Display Question, Question Number, Choices, and Submit button\" role=\"form\">\n <fieldset tabindex=\"0\" role=\"radiogroup\">\n <legend>${currentQuestion}?</legend>\n ${choicesHTML}\n </fieldset>\n <button id=\"submit-answer\" role=\"button\">Submit Answer</button>\n </form>\n </section>`;\n}", "function clearPreviousQuestion() {\n // The first child is the question text h3\n questionForm.firstChild.remove();\n questionForm.innerHTML = \"\";\n}", "function resetHtmlVariable() {\n\t// reset the html variable so we can rebuild it after next user guess\n\thtml=\"<p><h1>\";\n\n}", "function render(){\n let html='';\n if (store.quizStarted === false){\n html = generateStartPage();\n }else if (store.giveFeedback === true){\n html = generateQuestionsPage();\n } else if (store.giveFeedback === false && store.questionNumber === store.questions.length -1){\n html = generateLastPage();\n }\n else {\n html= generateRightWrong();\n }\n \n $('main').html(html);\n}", "function appDefaultView(){\n\t//clears everything on the page\n\t\n\tclearSection();\n\t\n\tvar local_simulation = get_local_simulation();\n\t//sets the top bar to be the default look\n\tdefaultheaderView();\n\tif(getVerified() == false){\n\t\talert('You do not have permission to access this. Please get a token first.');\n\t}else{\n\t\t//sets the page to view to 'user information' page\n\t\tvar apps = DeviceAppsListTemplate(local_simulation.apps);\n\t\tvar content = getContainer();\n\t\tif(local_simulation.apps==''||local_simulation.apps==null){\n\t\t\tapps += \"No applications are registed to this simulation.\";\n\t\t}\n\t\tcontent.innerHTML = apps;\n\t\t//sets the sidebar to the sidebar for when inside a simulation\n\t\tsimulationSideBarView();\n\t\tremoveClass('active');\n\t\tdocument.getElementById('my-apps-link').className='active';\n\t}\n}", "function deleteUsed (){\n\tif(Questions.length > 0) {\n\t\tQuestions.splice(Questions.indexOf(question),1);\n\t} else {\n\t\tdocument.getElementById('answerT').style.display=\"none\";\n\t\tdocument.getElementById('answerF').style.display=\"none\";\n\t\tdocument.getElementById('questions').style.display=\"none\";\n\t\tdocument.getElementById('looser').style.display=\"\";\n\t\tdocument.getElementById('reset').style.display=\"\";\n\t}\n}", "static get template() {\n return '<!--empty-->';\n }", "function clearGame() {\n $(\"#question\").text(\"\");\n for (i = 0; i < answerArrays[questionSelector].length; i++) {\n $(\"#answerSection\" + i).html(\"\");\n }\n }", "function reset() {\n\tstate.questionCounter = 0;\n\tstate.score = 0;\n\tstate.questions = [\n\t\t{\n\t\t\tid: 0,\n\t\t\tpregunta: 'Ets un/a Vilafranquí/ina de Tota la Vida? Prova el test!',\n\t\t\trespostes: [],\n\t\t\tcorrecte: null,\n\t\t},\n\t];\n\tstate.collectedAnswers = [];\n\tstate.comodinsLeft = state.comodinsInitial;\n\tstate.comodiUsedInQuestion = false;\n\tstate.comodiButtonExpanded = false;\n\t// display initial question\n\tdisplayInitialQuestion();\n}", "function resetQuestion() {\n choices.innerHTML = \"\"\n}", "resetContentSrc() {\n const root = this.doc.getroot();\n let contentElement = root.find('content');\n if (!contentElement) {\n contentElement = et.SubElement(root, 'content', { src: 'index.html' });\n }\n const originalSrc = contentElement.get('original-src');\n if (originalSrc) {\n contentElement.set('src', originalSrc);\n delete contentElement.attrib['original-src'];\n }\n const navElements = root.findall(`allow-navigation[@sessionid='${this.sessionid}']`);\n for (const navElement of navElements) {\n root.remove(navElement);\n }\n }", "main() {\n // generate html with question answers \n function renderAnswers(answers) {\n const content = answers.map((answer, index) => { \n return (`\n <div value=\"${answer.value}\" class=\"answer\" data-key='${index}'>\n <h4 value=\"${answer.value}\" data-key='${index}' class=\"answer-content\">${answer.content}</h4>\n </div>`);\n }).join('');\n return content;\n }\n let { question, answers } = this.question;\n let content = renderAnswers(answers);\n\n let html = \n `\n <div id='main-content' class=\"main-content\" style=\"display: inline;\">\n <div class=\"question-section\" id=\"question-section\">\n <h4 id=\"question\">${question}</h4>\n </div>\n\n <div class=\"answer-section\" id=\"answer-section\">\n ${content}\n </div>\n </div>\n `\n\n root.innerHTML = html;\n }", "function hideQuestionPage() {\n questionPages.style.display = \"none\";\n}", "function questionPage() {\r\n if (store.questionNumber === store.questions.length) {\r\n return renderFinalPage();\r\n }\r\n\r\n let currentQuestion = store.questions[store.questionNumber];\r\n let questionPage = `\r\n <div class=\"content\">\r\n <h2>Question ${store.questionNumber+1}: ${currentQuestion.question}</h2>\r\n <p>Your score: ${store.score}/5</p>\r\n <form>\r\n <input type=\"radio\" id=\"answer\" name=\"answer\" value=\"${currentQuestion.answers[0]}\" required>\r\n <label>${currentQuestion.answers[0]}</label><br>\r\n <input type=\"radio\" id=\"answer\" name=\"answer\" value=\"${currentQuestion.answers[1]}\" required>\r\n <label>${currentQuestion.answers[1]}</label><br>\r\n <input type=\"radio\" id=\"answer\" name=\"answer\" value=\"${currentQuestion.answers[2]}\" required>\r\n <label>${currentQuestion.answers[2]}</label><br>\r\n <input type=\"radio\" id=\"answer\" name=\"answer\" value=\"${currentQuestion.answers[3]}\" required>\r\n <label>${currentQuestion.answers[3]}</label><br>\r\n <button id=\"submit\">Submit</button>\r\n </form>\r\n </div>\r\n `;\r\n return questionPage;\r\n}", "function renderQuiz() {\n if (store.quizStarted === false) {\n $('main').html(generateStartPage());\n return;\n } else if (store.questionNumber < store.questions.length) {\n $('main').html(generateQuestionPage());\n return;\n } else {\n $('main').html(generateFinalPage());\n return;\n }\n}", "function renderQuestionView () {\n $('.variable-content-container, .instructions, .feedback, .final-view, .js-start-button, .js-next-button, .js-replay-button').addClass('js-hide');\n $('.score-question, .questions, .js-submit-button').removeClass(\"js-hide\");\n $('.questions').empty();\n updateQuestionNum();\n generateQuestion();\n}", "function renderQuestionPage() {\n var currentQuestionObj = state.questions[state.currentQuestionIndex];\n renderQuestion();\n renderQuestionChoices(currentQuestionObj.answers);\n // $(\".popup-inner\").addClass(\"hidden\");\n}", "function clearCurrentQuestion() {\n questionText.textContent = \"\";\n optionList.textContent = \"\";\n}", "function READMETemplate(userAnswer) {\n return `# ${userAnswer.title}\n![GitHub top language](https://img.shields.io/github/languages/top/${userAnswer.githubUsername}/${userAnswer.title})\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n \n## Description \n${userAnswer.description}\n\n## Table of Contents \n* [Installation](#Installation)\n* [Usage](#Usage)\n* [License](#License)\n* [Contributing](#Contributing)\n* [Tests](#Tests)\n* [Questions](#Questions)\n\n## Installation\n${userAnswer.installation}\n\n## Usage\n${userAnswer.usage}\n\n## License\n${userAnswer.license}\n\n## Contributing \n${userAnswer.contributing}\n\n## Tests\n${userAnswer.tests}\n\n## Questions \nPlease contact me if you have any questions at:\n<br>Email: ${userAnswer.email}\n<br>Github: ${userAnswer.githubUrl}\n`\n }", "function reset() {\n // reset points\n userPoints = 0;\n // go back to the first question\n questionsIndex = 0;\n // reset timer\n clock = 55;\n // display the h2 element to show the question\n h2.style.display = \"block\";\n // don't show the buttons\n scoreButtons.style.display = 'none';\n form.style.display = 'none';\n // go back to first question\n displayQuestion();\n}", "function showQuizTemplate(correctAnswers, question, questionNumber) {\n// question per my function nextQuestion() is from the questionList array of objects\n\treturn `\n\t<form title=\"American Government Quiz\"> <h2 id=\"question\">${question.text}</h2>\n <fieldset role=\"radiogroup\">\n <legend>Select one answer:</legend>\n <ul>\n <li>\n <input type=\"radio\" id=\"optionA\" name=\"answer\" value=\"${question.ansArray[0]}\">\n <label for=\"optionA\">${question.ansArray[0]}</label>\n </li>\n\n <li>\n <input type=\"radio\" id=\"optionB\" name=\"answer\" value=\"${question.ansArray[1]}\">\n <label for=\"optionB\">${question.ansArray[1]}</label>\n </li>\n\n <li>\n <input type=\"radio\" id=\"optionC\" name=\"answer\" value=\"${question.ansArray[2]}\">\n <label for=\"optionC\">${question.ansArray[2]}</label>\n </li>\n\n <li>\n <input type=\"radio\" id=\"optionD\" name=\"answer\" value=\"${question.ansArray[3]}\">\n <label for=\"optionD\">${question.ansArray[3]}</label>\n </li>\n\n <li >\n <input type=\"submit\" id=\"submit-button\" role=\"button\" name=\"selection-submit\" />\n </li>\n </ul>\n\n </fieldset>\n</form> \n\n<div id=\"status-bar\">\n\t\n\t<section class=\"results\">Score: ${correctAnswers}/${questionNumber} </section>\n\t<section class=\"feedback\">Feedback Section \n\t\t<span id=\"question-count\"> Question: ${question.number}/10 </span>\n\t</section>\n\n</div>\n`;\n\n}", "function makeQuestionPage(index) {\n\tclearPage();\n\tif (questionNum > 9) {\n\t\tmakeEndPage();\n\t\treturn;\n\t}\n\tvar questDisplay = $(\"<h2>\");\n\tquestDisplay.addClass(\"question\");\n\tquestDisplay.attr(\"data-name\", questions[index]);\n\tquestDisplay.text(questions[index].q);\n\t$(\"#questDiv\").append(questDisplay);\n\tfor (var k = 0; k < 4; k++) {\n\t\tvar answerButton;\n\t\tanswerButton = $(\"<button>\");\n\t\tanswerButton.addClass(\"answer\");\n\t\tanswerButton.attr(\"number\", k);\n\t\tanswerButton.text(questions[index].answers[k]);\n\t\t$(\"#buttonDiv\").append(answerButton);\n\t}\n\tsessionTime = setTimeout(function() {makeAnswerPage(index, null);}, 1000 * 25);\n\ttimeLeft = 25;\n\tintervalID = setInterval(showTime, 1000);\n}", "function reset () {\n var quote = config.quotes[Math.floor(Math.random() * config.quotes.length)];\n\n if (ripee) {\n var quote = config.namedQuotes[Math.floor(Math.random() * config.namedQuotes.length)];\n }\n\n document.getElementById('quote-content').innerHTML = marked(quote[0].replace(/\\{\\{name\\}\\}/gi, ripee));\n document.getElementById('quote-source').innerHTML = format(quote[1]);\n document.getElementById('quote-contrib').innerHTML = format(quote[2]);\n}", "function reset(){\n\t// alert(\"reset is called\");\n\tdocument.getElementById('human').remove();\n\t document.getElementById('message').remove();\n\t document.getElementById('bot').remove();\n document.getElementById('reset').remove();\n var temp= document.getElementsByTagName('template')[0];\n var clone = temp.content.cloneNode(true);\n document.getElementById('flex-box-rps-div').appendChild(clone);\n\n}", "function resetQuiz() {\n // Clear out what's in the results container\n resultsContainer.innerText = \"\";\n // Clear out the quiz container\n quizContainer.innerHTML = \"\";\n // Rebuild the quiz\n buildQuiz();\n }", "function clearDocument() {\n\t$doc.empty().append('<a class=\"menu\" href=\"/mw/\">game</a> - <a class=\"menu\" href=\"/adm/options.html\">options</a><h1>mwserver inspector</h1><hr />');\n}", "function cleanUp() {\n hide($home);\n hide($welcome);\n $cateList.empty();\n hide($recipesArea);\n // hide($recipesSearchArea); \n $recipes.empty();\n $noResults.empty();\n $recipeDetail.empty();\n hide($addOrEditDiy);\n hide($diyRecipes);\n $diyList.empty();\n $diyRecipeDetail.empty();\n $mealPlan.empty();\n hide($recExploreBtn);\n }", "function deleteQ(){\n var pageElement = document.querySelector(\".sub-question-area\");\n pageElement.remove();\n }", "function hideTemplates() {\n\t$(\"#template\").hide();\n\t$(\"#alert-template\").hide();\n\t$(\"#event-template\").hide();\n\t$(\"#show-events\").hide();\n\t$(\"#stop-timer\").hide();\n}", "function removeHomePageContent() {\n let gameStartBtn = document.querySelector(\".start-btn\");\n gameStartBtn.remove();\n\n let musicBtn = document.getElementById(\"home-page-music-btn\");\n musicBtn.remove();\n\n document.querySelector(\".hero-heading\").remove();\n }", "function resetQuestion(){\n\t\t$(\".lyrics\").empty();\n\t}", "function clean(done) {\n rimraf('templates', done);\n}", "function renderQuestion(index) {\n let question = questions[index];\n let answerArr = answers[index];\n\n $question.text(question);\n $question.data('question-index', index);\n $answers.empty();\n\n for(let answer of answerArr) {\n let $answer = $(`<li>${answer}</li>`);\n if(Math.random() > 0.5) {\n $answers.append($answer);\n } else {\n $answers.prepend($answer);\n }\n }\n}", "function clearAnswerDetail() {\n $(\".answer-detail\").remove()\n }", "function clearPage() {\n $('#htmlForSW5').css('display', 'none');\n $('#htmlForSE12').css('display', 'none');\n $('#htmlForSE14').css('display', 'none');\n}", "function getNewQuestion() {\n if (availableQuestions.length === 0 || questionCounter >= MAX_QUESTIONS) {\n answered.style.display = \"block\";\n gameArea.style.display = \"none\";\n setTimeout(() => {\n return window.location.assign(\"index.html\");\n\n }, 5000);\n }\n questionCounter++;\n const questionIndex = Math.floor(Math.random() * availableQuestions.length);\n currentQuestion = availableQuestions[questionIndex];\n question.innerText = currentQuestion.question;\n\n choices.forEach(choice => {\n const number = choice.dataset.number;\n choice.innerText = currentQuestion['choice' + number];\n });\n availableQuestions.splice(questionIndex, 1);\n}", "function main() {\r\n $('#header > div.ads-header').remove();\r\n\r\n $('#contendor > div.iframe').remove();\r\n $('#contendor > div.banners').remove();\r\n\r\n $('#contenido > div.contenedor-banner-item').remove();\r\n\r\n $('#sidebar > div').each(function(i, e){\r\n\r\n if ($(this).text() == 'Anuncios')\r\n {\r\n $(this).next().next().remove();\r\n $(this).next().remove();\r\n $(this).remove();\r\n }\r\n\r\n });\r\n\r\n $('#footer').remove();\r\n\r\n if (location.pathname.indexOf('/peliculas') >= 0)\r\n {\r\n $('#contenido > div[style*=\"float: right;\"]').remove();\r\n $('#contenido > h2').eq(1).remove();\r\n $('#contenido > div.texto-pelicula').eq(0).remove();\r\n $('#contenido > div.texto-ver').remove();\r\n }\r\n\r\n if (location.pathname.indexOf('/modulos') >= 0)\r\n {\r\n $('div[id*=\"imagecont\"]').eq(0).remove();\r\n $('div[id*=\"embedcont\"]').eq(0).css('visibility', 'visible');\r\n }\r\n}", "function resolveQuestion(question_id){\n var map = getMap();\n delete map[question_id];\n storeMap(map);\n leftPane.innerHTML = templates.renderQuestions({questions: getQuestions()});\n rightPane.innerHTML = templates.renderQuestionForm(); \n }", "function resetGame() {\n \n // reset varaibles\n wrong = 0;\n correct = 0;\n index = -1;\n \n // Update HTML\n clearContent();\n\n // Restart game\n loadQuestion();\n }", "function clearLists()\n\t\t\n\t\t{\n\t\t\n\n\t document.getElementById('question').getElementsByTagName('img')[0].style.display = \"none\";\n\t document.getElementById('list1').innerHTML = \"\";\n\t document.getElementById('list2').innerHTML = \"\";\n\t document.getElementById('list3').innerHTML = \"\";\n\t document.getElementById('forQuantComparision').innerHTML = \"\";\n\t\n $('#directsubmit').css({\"display\":\"none\"});\n\t\t\t\t \t $('#withanswer').css({\"display\":\"none\"});\n \n\t\t\n\t\t}", "function removeExpandedQuestion(remainingQuestions) {\n\t if(expandedQuestion !== undefined && getIndex(remainingQuestions, expandedQuestion.id, \"id\") === -1) {\n\t\trightPane.innerHTML = templates.renderQuestionForm();\n\t\treturn false;\n\t }\n }", "function resetTemplate (instance) {\n\n instance.name.set('');\n instance.comics.set([]);\n instance.page.set(1);\n instance.pagesList.set([\"1\"]);\n instance.dataLoaded.set('NO');\n\n instance.pagesStart = 0;\n instance.pagesEnd = 0;\n instance.previousPage = 0;\n instance.loopGroup = 0;\n instance.comicsOffset = 0;\n instance.canLoadMore = 'NO';\n}", "function loadWelcome() {\n localStorage.clear();\n document.getElementById(\"view\").innerHTML = document.getElementById(\"welcome_template\").innerHTML;\n}", "function generateQuestionTemplate(state) {\n return `\n <ul id=\"score-display\">\n <li>Score: ${store.score}</li>\n <li>Question: ${store.questionNumber+1}/${store.questions.length}</li>\n </ul>\n <form id=\"question-form\">\n <fieldset>\n <legend>${store.questions[state.questionNumber].question}</legend>\n ${generateAnswerOptions(store)}\n <button id=\"answer-button\" type=\"submit\" name=\"answer-button\">Submit</button>\n </fieldset>\n <form>`\n\n}", "function answerTemplateGenerator() {\n let score = store.score;\n let totalQuestions = store.questions.length;\n let num = store.questionNumber;\n let funFact = store.questions[num].funFact;\n let userAnswer = $('input[name=\"quizquestion\"]:checked').val();\n let correctAnswer = getQuestion().correctAnswer;\n let template;\n if (correctAnswer === userAnswer) {\n store.score += 1;\n store.questionNumber += 1;\n template = `<section class=\"boxit\" id=\"answer-screen\">\n <h2>Correct!</h2>\n <p>The Correct Answer Was: ${correctAnswer}</p>\n <p>You got ${\n score + 1\n } of ${totalQuestions} correct so far.</p>\n <p>Did you Know?</p>\n <p class='text-left'> ${funFact}</p>\n `;\n } else {\n store.questionNumber += 1;\n template = `<section class=\"boxit\" id=\"answer-screen\">\n <h2> Incorrect!</h2>\n <p>The Correct Answer Was: ${correctAnswer}</p>\n <p>You got ${score} of ${totalQuestions} correct so far.</p>\n <p>Did you Know?</p>\n <p class='text-left'> ${funFact}</p>\n `;\n }\n if (store.questionNumber === store.questions.length) {\n template +=\n \"<button class='finish-quiz'>Finish Quiz</button></section>\";\n } else {\n template +=\n \"<button class='next-question'>Next Question</button></section>\";\n }\n renderIt(template);\n}", "function resetQuestion(questionId){\n\tvar optionsCount = choices[questionId].length;\n\t\n\tfor(var i=0;i<optionsCount;i++){\n\t\t//document.getElementById('answer_'+questionId+'_'+i).checked = false;\n\t\tdocument.getElementById('label_'+questionId+'_'+i).className = \"\";\n\t\tdocument.getElementById('question_'+questionId).className = \"question\";\n\t}\n\t\n\t//document.getElementById('limpiar_' + questionId).innerHTML = '';\n\tdocument.getElementById('result_' + questionId).innerHTML = \"\";\n\tdocument.getElementById('info_' + questionId).innerHTML = \"\";\n\t\n\t//useranswers[questionId] =-1;\t\n}", "function resetWholeQuestion(){\n\t\tresetQuestion();\n\t\tresetChoices();\t\n\t}", "function reset(){\n var resultContentsId = [\"result-title\", \"wins\", \"losses\", \"unanswered\", \"restart\"];\n for (var ele in resultContentsId){\n document.querySelector(\"#\"+resultContentsId[ele]).remove();\n }\n\n right = 0;\n wrong = 0;\n unanswered = 0;\n seconds = 30;\n qNum = 1;\n addQuestion();\n\n}", "function ClearSurveyWizardCache(){\n\t$(\"#surveyQuestionCreationBox #workArea\").find(\".surveyGroup\").each(function(){$(this).detach();});\n\tGlobal_surveyTitle=\"\";\n\tGlobal_surveyMessage=\"\";\n\tGlobal_isJobFair = false;\n\tGlobal_editMode = false;\n\tGlobal_oldSID = 0;\n}", "function reset(){\n questionCount = 0;\n unanswered = 0;\n wrong = 0;\n right = 0;\n $(\"#allQuestions\").html('');\n $(\"#score\").html('');\n $(\"#timeLeft\").html('');\n }", "function noSolutions(answer, answerType)\n\t{\n\t\treturn infNoSolutions(answer, answerType, noSolutionsString, typeList.types.NOSOLUTIONS);\n\t}", "function showQuestion() {\n $('main').html(generateQuestion());\n}", "function resetHelps() {\n $(\".helpbox\").text(\"\");\n $(\".alt\").show();\n }", "function reset_view() {\r\n refresh_con.style.display = \"none\";\r\n pref_con.style.display = \"none\";\r\n login_con.style.display = \"none\";\r\n setting_con.style.display = \"none\";\r\n current_trail_con.style.display = \"none\";\r\n users_searches_con.style.display = \"none\";\r\n account_container.style.display = \"none\";\r\n}", "function clear() {\n location.replace(\"#!\");\n }", "function generateQuizPage(answers, selectedQuiz) {\n // quiz holds all questions from the selected quiz \n quiz = selectedQuiz;\n \n // Generates head title from the selected quiz\n $(\".title\").text(quiz.title);\n \n // Gets all questions from the selected quiz\n getQuestions(answers);\n}", "function handleWrongAnswer(){\n $('.QAform').html(`\n <img class = \"icon circle\" src = \"https://github.com/katngo/catquiz/blob/master/cat-tapping-tail.jpg?raw=true\" alt = \"cat tapping his tail\"></img>\n <p>Try harder, hooman!</p>\n <p> The correct answer is `+ STORE[questionNum].correctAnswer +`</p>\n <button type = \"button\" class = \"nextButton\">Next</button>`);\n}", "noIntroduction(){\n document.getElementById('introduction').style.display='none';\n }", "function buildQuestions(){\n var questions2 = questions;\n for (var i = 0; 4 < questions2.length; i++){\n questions2.splice(Math.floor(Math.random()*questions2.length), 1)\n }\n var questionHTML = ''\n for (var i = 0; i<questions2.length; i++) {\n questionHTML = questionHTML + formTemplate(questions2[i]);\n }\n $('#questions').append(questionHTML);\n \n }", "function render() {\r\n let content = '';\r\n if (STORE.view === 'home') {\r\n $('main').html(welcomePage());\r\n }\r\n else if (STORE.view === 'question') {\r\n content = questionAsked();\r\n content += generateAnswers();\r\n content += questionAndScoreStanding();\r\n $('main').html(`<form>${content}</form>`);\r\n } else if (STORE.view === 'feedback') {\r\n answerFeedback();\r\n } else if (STORE.view === 'score') {\r\n finalScore();\r\n }\r\n}", "function generateCorrectPage(){\n //grabs correctAnswer for the question just answered as well as the answer the user selected\n let correctAnswer = Object.values(store.questions)[store.questionNumber].correctAnswer;\n let selected = $('input[type=radio]:checked', '#question-form').val();\n return `\n <h1 class=\"correct-page\" role=\"heading\">Correct!</h1>\n <h2>Correct Answer: ${correctAnswer}</h2>\n <h2>Your Answer: ${selected}</h2>\n <figure role=\"figure\" aria-labelledby=\"animated yay\">\n <img src=\"https://cdn.discordapp.com/emojis/598306496383549440.gif?v=1\" alt=\"animated yay\">\n <figcaption id=\"caption\">You got it right!</figcaption>\n </figure>\n <h2 class=\"current-score\">Your current score is: ${store.score} out of ${Object.values(store.questions).length}</h2>\n <button id=\"next-question\" type=\"submit\" role=\"button\">Continue</button>`;\n}", "function renderCorrectAnswerPage() {\r\n let correctAnswerPage = `<div class=\"content\">\r\n <h2>Correct!!</h2> \r\n <p>Your score: ${store.score}/5</p>\r\n <form> <button id=\"next-question\">Next Question</button> </form> </div>`\r\n return correctAnswerPage;\r\n}", "function page_reset() {\r\n document.getElementById(\"transcript\").value=\"\";\r\n document.getElementById('name_theme_box').style.visibility = 'hidden';\r\n document.getElementById('save_error_msg').style.display = 'none';\r\n document.getElementById('error_msg').style.display = 'none';\r\n document.getElementById('name_error_msg').style.display = 'none';\r\n document.getElementById('save_transcript_options').style.visibility = 'hidden';\r\n removeTags(tags);\r\n document.getElementById(\"available_tags\").innerHTML='<h4 style=\"text-align: center;\">Currently no tags made</h4>';\r\n}", "function cleanQuora(){\r\n //look for the blurred answers\r\n var elems = document.getElementsByTagName(\"*\"), i;\r\n \r\n for (i in elems) {\r\n if((' ' + elems[i].className + ' ').indexOf(' ' + \"blurred_answer\" + ' ')\r\n > -1) {\r\n //get its parent for navigation\r\n var parent=elems[i].parentNode;\r\n \tvar answer_holder=parent.parentNode.parentNode.parentNode;\r\n //parent should be answer_content\r\n parent.innerHTML = \"Unblurring... <img src='http://d1vgw4v7ja2ido.cloudfront.net/-6e797f99a0bd554c.gif' />\";\r\n \r\n\t\t\t\t\t\t//quora seems to have deleted the \"related answers\" section\r\n\t\t\t\t\t\t//i have cleaned up the additional stuff related to it from the code\r\n\t\t\t\t\t\t//however, i am leaving the \"quoraURLfriendly\" function in the code, as might come in handy in future \r\n \r\n if(\r\n\t\t\t\t\t\t\t(answer_holder.children[0].children[0].children[0].children[0])&&\r\n\t\t\t\t\t\t\t(answer_holder.children[0].children[0].children[0].children[0].children[0])&&\r\n\t\t\t\t\t\t\t(answer_holder.children[0].children[0].children[0].children[0].children[0].children[0])&&\r\n\t\t\t\t\t\t\t(answer_holder.children[0].children[0].children[0].children[0].children[0].children[0].firstChild)\r\n\t\t\t\t\t\t){\r\n \t\t//this checks for the \"originally answered\" answers. their permalink is different from other answers on the current page\r\n \t\t//prone to change...\r\n \t\tvar base=(answer_holder.children[0].children[0].children[0].children[0].children[0].children[0].firstChild.href);\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t//regular answer\r\n\t\t\t\t\t\t\tvar base=document.URL;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n var answer_string=parent.parentNode.parentNode.parentNode.getAttribute( 'id' );\r\n answer_string=answer_string.substring(3);\r\n var target_href=forgeAnswerLink(base,answer_string); \r\n \r\n var final_string=xml_req(parent,target_href);\r\n }\r\n }\r\n}", "function generateQuestionTemplate(question) {\n let template =\n `<div>\n <form id=\"js-questions\" class= \"question-form\">\n\n <fieldset>\n <div class=\"container-question\">\n <div class=\"item\">\n <h3> ${question}</h3>\n </div>\n </div>\n\n <div class = \"container-options\">\n <div class =\"item\">\n <div>\n <ul class = \"js-options\">\n </ul>\n </div>\n </div>\n </div>\n\n <div class=\"container\">\n <div class = \"item\">\n <button type =\"submit\" id=\"submit-answer\" tabindex=\"5\">Submit</button>\n <button type = \"button\" id = \"next\" tabindex=\"6\">Next Question</button>\n </div>\n </div>\n </fieldset>\n </form>\n </div>`;\n return template\n}", "function generateQuestionList(answers) {\n \n if (answers !== null && answers[\"quiz-id\"] === quiz.id) {\n // creates a DOM element for each question\n quiz.questions.forEach(function(q) {\n $(\".question\").append(buildQuestions(q, answers.answers[q.id]));\n });\n } else {\n // creates a DOM element for each question\n quiz.questions.forEach(function(q) {\n $(\".question\").append(buildQuestions(q, \"\"));\n });\n }\n \n\n $(\".question div\").first().addClass(\"first\");\n $(\".question div\").last().addClass(\"last\");\n \n // Hide all question from user\n $(\".question\").children().hide();\n}", "function showAnswerDefault () {\n\n incorrectA++;\n\n // display\n $(\"#question-panel\").html(\"Fish paste! The correct answer was... \" + \"<em>\" + questionArr[questionIndex].answer[1] + \"</em>\");\n $(\"#\" + questionArr[questionIndex].answer[0]).addClass(\"correct\");\n console.log(\"Dwight Schrute voice: NO ANSWER GIVEN!\");\n\n // delay on next question so you have time to read answer\n setTimeout(function() {\n\n questionIndex++;\n renderQuestion();\n\n }, 3500);\n\n }", "function clearAnswers() {\n\temptyArrays();\n\t\n\t$(\"#par\").find(\"span\").css(\"background-color\",\"white\");\n\tjQuery(\".tm-input\").tagsManager('empty');\n\tchangeSelectedFactorType(saveIndex);\n\t\n\t$('#clearFactorsModal').modal('hide');\n\tloadTagList();\n\t\t\n\t$(\"#mostPopular\").css(\"display\",\"none\");\n\t\n\tdocument.getElementById(\"listButton\").disabled = false;\n\tdocument.getElementById(\"submit\").disabled = false;\n\tloadTagList();\n\t$(\"#allAnn\").remove();\n\t$(\"#validateUser\").attr(\"class\", \"span12\");\n\tjQuery(\"#validateTags\").tagsManager('empty');\n\t\n\t$(\".submitTaskButton\").text(fType);\n\t\n\tif (alreadySubmitted() == true) {\n\t\tdocument.getElementById(\"submit\").disabled = true;\n\t\tloadExistingAnn(submission[fType].factorPos);\n\t}\n\t$(\".submitTaskButton\").text(fType);\n}", "function clearAnswer() {\n $(\"#result\").empty();\n $(\"#info\").empty();\n $(\"#answerImg\").empty();\n $(\"#nextQuestionTime\").hide();\n}", "function renderQuestion(index) {\n if (startQuestion < questions.length) {\n return questions[index].title;\n } else {\n return;\n }\n}", "function clearPages() {\n\t\t$(articleContainer).html('');\n\t}", "function resetQuestion() {\n nextButton.classList.add(\"hide\");\n while (answerButtons.firstChild)\n [answerButtons.removeChild(answerButtons.firstChild)];\n}", "function clearContent() {\n $(\"#time\").empty();\n $(\"#question\").empty();\n $(\"#choices\").empty();\n }", "function shutdown() {\n\t\teasyTemplate = undefined;\n\t}", "function default_answer() {\n return choice(['Sorry, come again?', \"I don't understand.\", 'Can you try saying that differently?', 'Can you please repeat?', 'What do you mean?'\n , 'No comprendo...', 'Ne me quitte pas!', 'Pardon me?']);\n}" ]
[ "0.59955484", "0.5873079", "0.5767851", "0.5767851", "0.5767851", "0.5767851", "0.57677186", "0.5693977", "0.56838655", "0.56594306", "0.5641748", "0.5620396", "0.55827075", "0.55773056", "0.55520344", "0.55163145", "0.55137175", "0.5512406", "0.54976475", "0.5487846", "0.5468019", "0.5437085", "0.54303414", "0.5398193", "0.5388781", "0.53836817", "0.5362126", "0.5359318", "0.53518236", "0.5320641", "0.5317526", "0.5315629", "0.53001773", "0.5296314", "0.52924883", "0.5288908", "0.52717805", "0.5256699", "0.5247823", "0.5240432", "0.5239679", "0.5238607", "0.52317744", "0.5229945", "0.52290356", "0.5220449", "0.5219412", "0.5217388", "0.52155596", "0.5215133", "0.51929885", "0.5187381", "0.5186418", "0.5175895", "0.5172438", "0.51716274", "0.5171438", "0.5171213", "0.5166142", "0.5162356", "0.5161818", "0.51609886", "0.5158357", "0.5154134", "0.5149092", "0.51455617", "0.5145226", "0.5145204", "0.5144915", "0.51436716", "0.5143574", "0.5121248", "0.5116893", "0.5104474", "0.51020503", "0.51018775", "0.51010346", "0.5098654", "0.5095709", "0.5088456", "0.50802857", "0.5077585", "0.5077579", "0.50771165", "0.50716597", "0.5071169", "0.50687045", "0.506508", "0.50626415", "0.50610924", "0.5061062", "0.5055336", "0.50452864", "0.5044223", "0.5041742", "0.50397396", "0.5035069", "0.50341874", "0.5033986", "0.5032097", "0.5030451" ]
0.0
-1
display the question and assigns buttons to the answers
function showQuestion(questionArray) { questionEl.innerText = questionArray.question; questionArray.answers.forEach(answer => { var button = document.createElement('button'); button.innerText = answer.text; button.classList.add("btn"); if (answer.correct) { button.dataset.correct = answer.correct; }; if (answer.correct == false ) { button.classList.add("incorrect"); }; button.addEventListener("click", selectAnswer); answerButtonsEl.appendChild(button); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayQuestion() {\n questionText.textContent = currentQuestionObject.question;\n for (i=0; i<4; i++) {\n answerButtons[i].textContent = currentQuestionObject.choices[i]\n }\n}", "function displayQuestions(question) {\n questionElement.innerText = question.question\n question.answers.forEach(answer => {\n var button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer)\n choiceEl.appendChild(button)\n })\n}", "function showQuestion(){\n let listQuestion = theQuestions[questionIndex].question\n placeQuestion.textContent = listQuestion\n questionEl.appendChild(placeQuestion)\n \n //show answers as buttons\n function showAnswers(){\n let answerA = theQuestions[questionIndex].answer[0].list\n let answerB = theQuestions[questionIndex].answer[1].list\n let answerC = theQuestions[questionIndex].answer[2].list\n let answerD = theQuestions[questionIndex].answer[3].list\n btnTextA.textContent = answerA\n btnTextB.textContent = answerB\n btnTextC.textContent = answerC\n btnTextD.textContent = answerD\n multChoiceA.appendChild(btnTextA)\n multChoiceB.appendChild(btnTextB)\n multChoiceC.appendChild(btnTextC)\n multChoiceD.appendChild(btnTextD)\n }\n\n showAnswers()\n }", "function showQuestion(question) {\n\tquestionElement.innerText = question.question;\n\t//populate the answers by creating a button for each of them\n\tquestion.answers.forEach(answer => {\n\t\tconst button = document.createElement(\"button\");\n\t\tbutton.innerText = answer.text;\n\t\tbutton.classList.add(\"btn\");\n\t\t//check if the answer is correct by adding a data attribute to the button\n\t\tif (answer.correct) {\n\t\t\tbutton.dataset.correct = answer.correct;\n\t\t}\n\t\t\tbutton.addEventListener(\"click\", selectAnswer);\n\t\t\tanswerButtonsElement.appendChild(button);\n\t});\n}", "function showQuestion(question) {\n //look up to understand this entire function\n questionElement.innerText = question.question;\n question.answers.forEach(answer => {\n const button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener('click', selectAnswer);\n answerButtonsElement.appendChild(button);\n });\n}", "function displayQuestionAnswer(question){\n\t\t$(\"#questionResponse\").text(question);\n\t\tcurrentAnswer = currentTopicChoice[currentQuestion][0];\n\t\tcurrentOptions = currentTopicChoice[currentQuestion][1];\n\t\tcurrentAnswerImage = currentTopicChoice[currentQuestion][2];\n\n\t\t//Build the button for all options proposed\n\t\tBuildOptionButtons(currentOptions);\n\n\t}", "function displayQuestion() {\n let q = questions[currentQuestion];\n question.innerHTML = q.question;\n btnA.innerHTML = q.choiceA;\n btnB.innerHTML = q.choiceB;\n btnC.innerHTML = q.choiceC;\n btnD.innerHTML = q.choiceD\n}", "function displayQuestions(question) {\n questionElement.innerText = question.question;\n question.answers.forEach(answer => {\n var button = document.createElement(\"button\");\n button.innerText = answer.text;\n button.classList.add(\"btn\");\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener(\"click\", selectAnswer);\n choiceEl.appendChild(button);\n });\n}", "function showQuestions() {\n var currentQuestion = codeQuestions[currentQuestionIndex];\n\n var titleEl = document.getElementById(\"question-title\");\n titleEl.textContent = currentQuestion.question;\n\n answersEl.innerHTML = \"\";\n\n //create loop for questions\n currentQuestion.answers.forEach(function (answer, i) {\n var answerNode = document.createElement(\"button\");\n answerNode.setAttribute(\"class\", \"answers\");\n answerNode.setAttribute(\"class\", \"answers\");\n\n answerNode.textContent = i + 1 + \".\" + rightAnswer;\n\n //clicky boy\n answerNode.onclick = answerClick;\n answersEl.appendChild(answerNode);\n });\n }", "function displayQuestions() {\n\n // Define the current question as the question the question highlighted by the index \"pointer\"\n var currentQuestion = questionsList[currentQuestionIndex];\n\n // Log the question selected from the array for display in console\n console.log(currentQuestion);\n\n // Render selected question to question element in the html\n questionDiv.textContent = currentQuestion.question;\n\n // Render corresponding question answers to buttons based on index\n answerAbutton.textContent = currentQuestion.answers[0];\n answerBbutton.textContent = currentQuestion.answers[1];\n answerCbutton.textContent = currentQuestion.answers[2];\n answerDbutton.textContent = currentQuestion.answers[3];\n\n // // // Onclick event checkAnswer\n answerAbutton.onclick = checkAnswer;\n answerBbutton.onclick = checkAnswer;\n answerCbutton.onclick = checkAnswer;\n answerDbutton.onclick = checkAnswer;\n\n // Log player response in the console\n console.log(answerAbutton.onclick);\n}", "function showQuestion(question) {\n questionElement.innerText = question.question;\n question.answers.forEach(answer => {\n const button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener('click', selectAnswer);\n answerButtonsElement.appendChild(button);\n });\n}", "function showQuestion(question) {\n questionElement.innerText = question.question;\n question.answers.forEach(answer => {\n const button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener('click', selectAnswer);\n answerButtonsElement.appendChild(button);\n })\n}", "function showQuestion(question) {\n questionElement.innerText = question.question\n question.answers.forEach (answer => {\n const button = document.createElement('button')\n button.innerText=answer.text\n button.classList.add('btn')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer)\n answerButtonsElement.appendChild(button)\n })\n}", "function showQuestion (question){\n questionEl.innerText = question.question;\n question.answers.forEach(answer => {\n // create a new button for each answer and fill \n var button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n if (answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer);\n answerChoiceBtn.appendChild(button);\n })\n}", "function showQuestion(){\n var question = questions[questionIndex];\n resetQuestionCard();\n questionEl.innerText = question.question;\n question.answers.forEach(answer => {\n const button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n if (answer.correct){\n button.dataset.correct = answer.correct;\n };\n button.addEventListener('click', selectAnswer);\n answerBtns.appendChild(button);\n \n });\n}", "function displayQuestion() {\r\n var questionEl = document.querySelector(\"#question\")\r\n questionEl.textContent = questions[currentQuestion].question\r\n var optionsEl = document.querySelector(\"#options\")\r\n optionsEl.innerHTML =''\r\n for (let i = 0; i < questions[currentQuestion].answers.length; i++) {\r\n var button = document.createElement(\"button\")\r\n button.textContent = questions[currentQuestion].answers[i]\r\n button.setAttribute(\"value\", i)\r\n button.setAttribute(\"class\", \"answer\")\r\n optionsEl.appendChild(button)\r\n }\r\n}", "function showAnswers() {\n var currentAnswers = questions[currentQuestionIndex]\n buttonA.innerText = currentAnswers.texta;\n buttonB.innerText = currentAnswers.textb;\n buttonC.innerText = currentAnswers.textc;\n buttonD.innerText = currentAnswers.textd;\n}", "function showQuestion(question) {\n questionElement.innerText =\n countWrongAnswers + countRightAnswers + 1 + \") \" + question.question;\n question.answers.forEach((answer) => {\n const button = document.createElement(\"button\");\n button.innerText = answer.text;\n button.classList.add(\"btn\");\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener(\"click\", selectAnswer);\n answerButtonsElement.appendChild(button);\n });\n}", "display() {\n document.querySelector(\"#question\").innerHTML = this.question;\n for (let i = 0; i < 4; i++)\n showAnswer = selectValue(showAnswer, 4);\n answer1.innerHTML = this.answers[showAnswer[0]];\n answer2.innerHTML = this.answers[showAnswer[1]];\n answer3.innerHTML = this.answers[showAnswer[2]];\n answer4.innerHTML = this.answers[showAnswer[3]];\n }", "function showQuestion(question) {\n questionElement.innerText = question.question;\n question.answers.forEach((answer) => {\n const button = document.createElement(\"button\");\n button.innerText = answer.text;\n button.classList.add(\"btn-outline-secondary\");\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener(\"click\", selectAnswer);\n answerButtons.appendChild(button);\n });\n}", "function showQuestion(question) {\n questionElement.innerText = question.question\n questionPicture.src = question.images\n question.answers.forEach(answer => {\n const button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer)\n answerButtonsElement.appendChild(button)\n })\n}", "function showQuestion(question) {\n questionElement.innerText = question.question\n question.answers.forEach(answers => {\n var button = document.createElement('button')\n button.innerText = answers.text\n button.classList.add('btn')\n if (answers.correct) {\n button.dataset.correct = answers.correct\n\n }\n button.addEventListener('click', selectAnswer)\n answerButtonsElement.appendChild(button)\n })\n}", "function showQuestion(question) {\n\n questionElement.innerText = question.question\n question.answers.forEach(answer => {\n var button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('button')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer)\n answerButtons.appendChild(button)\n })\n}", "function showQuestion(question) {\n questionElement.innerText = question.question\n question.answers.forEach(answer => {\n const button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n score++;\n }\n button.addEventListener('click', selectAnswer)\n answerButtonsElement.appendChild(button)\n })\n}", "function showQuestion() {\n var currentQuestion = questions[currentQuestionIndex];\n var questionHeader = document.getElementById('question-header');\n questionHeader.textContent = currentQuestion.question;\n\n answerButtonsEl.innerHTML = \"\";\n \n currentQuestion.choices.forEach(function(choice, i) {\n var answerChoice = document.createElement('button');\n answerChoice.setAttribute('class', 'choice');\n answerChoice.setAttribute('value', choice);\n\n answerChoice.textContent = choice;\n\n answerChoice.onclick = selectAnswer;\n answerButtonsEl.appendChild(answerChoice);\n\n });\n}", "function showAnswers(){\n let answerA = theQuestions[questionIndex].answer[0].list\n let answerB = theQuestions[questionIndex].answer[1].list\n let answerC = theQuestions[questionIndex].answer[2].list\n let answerD = theQuestions[questionIndex].answer[3].list\n btnTextA.textContent = answerA\n btnTextB.textContent = answerB\n btnTextC.textContent = answerC\n btnTextD.textContent = answerD\n multChoiceA.appendChild(btnTextA)\n multChoiceB.appendChild(btnTextB)\n multChoiceC.appendChild(btnTextC)\n multChoiceD.appendChild(btnTextD)\n }", "function showQuestion(qAndA) {\n document.getElementById('question').innerText = qAndA.question;\n qAndA.answers.forEach(answer => {\n let button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('answer');\n if (answer.correct) {\n button.dataset.correct = answer.correct\n\n }\n button.addEventListener('click', selectAnswer)\n document.getElementById('answers').appendChild(button)\n console.log('ping')\n })\n}", "function showQuestions(passQuestion) {\n questionEl.innerText = passQuestion.question;\n answerBtn1.innerText = passQuestion.answers[0].text;\n answerBtn2.innerText = passQuestion.answers[1].text;\n answerBtn3.innerText = passQuestion.answers[2].text;\n answerBtn4.innerText = passQuestion.answers[3].text;\n}", "function showQuestion() {\n var showQuestion = document.getElementById(\"showQuestion\");\n showQuestion.style.display = \"block\";\n var intro = document.getElementById(\"intro\");\n intro.style.display = \"none\";\n\n var currentQuestion = questions[currentQuestionIndex];\n questionEl.innerHTML = currentQuestion.question;\n answerButtonAEl.innerHTML = currentQuestion.choices[0];\n answerButtonBEl.innerHTML = currentQuestion.choices[1];\n answerButtonCEl.innerHTML = currentQuestion.choices[2];\n answerButtonDEl.innerHTML = currentQuestion.choices[3];\n}", "function displayQuestion() {\n const questionElement = document.getElementById('question');\n const optionsElement = document.getElementById('options');\n \n // Clear previous question and options\n questionElement.textContent = '';\n optionsElement.textContent = '';\n \n // Display current question\n questionElement.textContent = quiz[currentQuestion].question;\n \n // Display options\n quiz[currentQuestion].options.forEach((option, index) => {\n const button = document.createElement('button');\n button.textContent = option;\n button.addEventListener('click', () => {\n checkAnswer(option);\n });\n optionsElement.appendChild(button);\n });\n }", "function displayQuestion() {\n\t\t\tstartTime30();\t\n\t\t\t$(\"#question\").html(eachone[count].question);\n\t\t\t$(\"#option1\").html(eachone[count].option1.answer);\n\t\t\t$(\"#option2\").html(eachone[count].option2.answer);\n\t\t\t$(\"#option3\").html(eachone[count].option3.answer);\n\t\t\t$(\"#option4\").html(eachone[count].option4.answer);\n\t\t\t$(\"#okButton\").html(\"\");\n\t\t}", "function showQuestion(question) {\n questionElement.innerText = question.question;\n questions.answers.forEach(answer => {\n const button = document.createElement(\"button\");\n button.innerText = answers.text;\n button.classList.add =(\"btn\");\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n userScore++;\n }\n button.addEventListener(\"click\", selectAnswer);\n answerButtons.appendChild(button);\n })\n}", "function showQuestion() {\n // quiz questions along with possible answers\n questionEl.innerHTML = questions[currentQuesIndex].question;\n answerA.innerHTML = questions[currentQuesIndex].choiceA;\n answerB.innerHTML = questions[currentQuesIndex].choiceB;\n answerC.innerHTML = questions[currentQuesIndex].choiceC;\n\n}", "function displayQuestion() {\n // hide questions\n document.getElementById(\"questions\").style.display = \"block\";\n // hide results\n results.style.display = \"none\";\n startQuiz.style.display = \"none\";\n // clear out previous content\n document.getElementById(\"questions\").innerHTML = \"\";\n // show question based on iteration of questionCards array\n var questionText = document.createElement(\"h3\");\n questionText.textContent = questionCards[currentQuestion].question;\n document.getElementById(\"questions\").appendChild(questionText);\n // append answers for each question\n for (var i = 0; i < questionCards[currentQuestion].answers.length; i++) {\n var answerText = document.createElement(\"button\");\n answerText.textContent = questionCards[currentQuestion].answers[i];\n answerText.classList.add(\"btn\", \"btn-primary\");\n answerText.setAttribute(\"id\", \"answer\");\n answerText.setAttribute(\n \"data-answer\",\n questionCards[currentQuestion].answers[i]\n );\n answerText.onclick = checkAnswer;\n document.getElementById(\"questions\").appendChild(answerText);\n }\n}", "function showQuestion(question) {\n questionElement.innerText = question.question\n question.answers.forEach(answer => {\n const button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n if(answer.correct) {\n button.dataset.correct = answer.correct\n }\n button.addEventListener('click', selectAnswer)\n answerButtonsElement.appendChild(button)\n })\n\n\n}", "function displayQuestion() {\n // checks if there are existing answers already displayed\n var buttonElChildElementsCount = document.querySelector(\".btn-wrapper\")\n .childElementCount;\n\n if (buttonElChildElementsCount > 0) {\n document.querySelector(\".btn-wrapper\").innerHTML = \"\";\n }\n\n // id counter that will be then assigned to DOM entry for a given answer\n var index = 0;\n // Dynamically retrieves all 'answer' keys from given quiz object using regex;\n // for each 'answer' creates a new button and writes answer's value into element's text\n for (var key in quiz[0]) {\n if (/^answer/.test(key)) {\n var newSpanEl = document.createElement(\"span\");\n newSpanEl.innerText = `${index}. `;\n\n var answerBtnEl = document.createElement(\"button\");\n answerBtnEl.setAttribute(\"class\", \"btn left-aligned\");\n answerBtnEl.innerHTML = `<span>${index}. </span>${quiz[0][key]}`;\n\n // displays question\n pageTitleEl.textContent = quiz[0].question;\n\n // displays answers\n buttonsWrapperEl.appendChild(answerBtnEl);\n }\n index++;\n }\n return;\n}", "function showQuestion(question) {\n \n questionElement.innerText = question.question; // for changing text of question\n \n // loop through questions\n question.answers.forEach(answer => {\n \n const button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n \n // if user chose the correct answer\n if (answer.correct) {\n \n // add data attribute to correct\n button.dataset.correct = answer.correct;\n }\n \n button.addEventListener('click', selectAnswer);\n answerButtonsElement.appendChild(button);\n \n })\n}", "function questionSelect() {\n var currentQuestion = questionsArray[questionOptions];\n questionAsk.innerHTML = \"<h2>\" + currentQuestion.question;\n button1.innerHTML = currentQuestion.answer1;\n button2.innerHTML = currentQuestion.answer2;\n button3.innerHTML = currentQuestion.answer3;\n button4.innerHTML = currentQuestion.answer4;\n}", "function displayQuestion(id) {\n var question = questions[id];\n var text = question.questionText;\n\n $(\".questions\").append(\"<p>\" + text + \"</p>\");\n\n // this for loop is creating an html button for each answer in the answers array\n var answers = question.answers;\n for (var i = 0; i < answers.length; i++) {\n $(\".answers\").append(\"<button value=\" + i + \">\" + answers[i] + \"</button>\");\n }\n $(\".answers button\").click(handleAnswerClick);\n}", "function showQuestion(question) {\n// fills in the question\n questionElement.innerText = question.question\n// creates buttons\n question.answers.forEach(answer => {\n const button = document.createElement('button')\n // fills in inner text\n button.innerText = answer.text\n // adds style with class\n button.classList.add('btn') \n // adds true/false statment so score works\n if (answer.correct) {\n button.dataset.correct = answer.correct}\n // starts new function\n button.addEventListener('click', selectAnswer)\n // appends buttons\n answerButtonsElement.appendChild(button)\n })\n}", "function displayQuestion(question) {\n titleitem.innerText = question.title\n question.choices.forEach(element => {\n var button = document.createElement(\"button\")\n button.className = \"btn-primary btn-block text-left\"\n button.innerText = element\n questionanswers.appendChild(button)\n button.addEventListener(\"click\", displaynextQuestion)\n });\n}", "function displayQuestion() {\n\n questionsEl.textContent = quizQuestions[currentQuestionIndex].title\n answer1El.textContent = quizQuestions[currentQuestionIndex].choices[0];\n answer2El.textContent = quizQuestions[currentQuestionIndex].choices[1];\n answer3El.textContent = quizQuestions[currentQuestionIndex].choices[2];\n answer4El.textContent = quizQuestions[currentQuestionIndex].choices[3];\n}", "function getQuestion() {\n /*\n @TODO: write your function code here\n */\n // create question and buttons\n question_w = document.createElement(\"h2\");\n button1 = document.createElement(\"button\");\n button2 = document.createElement(\"button\");\n button3 = document.createElement(\"button\");\n button4 = document.createElement(\"button\");\n question_w.textContent = questions[currentQuestionIndex];\n // set namme of choices to each button\n button1.textContent = ansarray[currentQuestionIndex][0];\n button2.textContent = ansarray[currentQuestionIndex][1];\n button3.textContent = ansarray[currentQuestionIndex][2];\n button4.textContent = ansarray[currentQuestionIndex][3];\n // set data-index to each button\n question_w.setAttribute(\"style\",\"text-align:center\")\n button1.setAttribute(\"data-index\", 0 );\n button2.setAttribute(\"data-index\", 1 );\n button3.setAttribute(\"data-index\", 2 );\n button4.setAttribute(\"data-index\", 3 );\n // append question and button to html\n questionsEl.prepend(question_w);\n choicesEl.appendChild(button1);\n choicesEl.appendChild(button2);\n choicesEl.appendChild(button3);\n choicesEl.appendChild(button4);\n}", "function showQuestion() {\n var correctAns = quizQuestions[questionIndex].correct;\n\n //Showing the quiz's questions\n questionEl.textContent = quizQuestions[questionIndex].question;\n\n //Prints out the quiz's multiple choice\n for (var i = 0; i < quizQuestions[questionIndex].answers.length; i++) {\n var ansBtn = document.createElement(\"button\");\n answerButtonEl.appendChild(ansBtn);\n ansBtn.setAttribute(\"class\", \"block btn btn-primary ansBtn\")\n ansBtn.textContent = quizQuestions[questionIndex].answers[i];\n\n //Marks correct answers with 'true' attribute\n if (quizQuestions[questionIndex].answers[i] === quizQuestions[questionIndex].answers[correctAns]) {\n ansBtn.setAttribute(\"true\", \"true\");\n }\n }\n nextQuestion();\n}", "function getQuestion() {\n $(\".quiz\").show();\n\n //create var that references the questions array\n var currentQuestion = questions[currentQuestionIndex];\n //Display the current question\n questionEl.textContent = currentQuestion.title;\n\n //Creates a short hand variable for the forEach method that loops through each choice and change the text of the HTML buttons\n var allChoices = currentQuestion.choices;\n allChoices.forEach(function(choice, i) {\n document.querySelector(\".choice\" + i).innerHTML = \"<button class='btn'>\" + allChoices[i] + \"</button>\";\n });\n \n //Event listener that is used when the changed button is clicked\n buttons.addEventListener(\"click\", checkAnswer);\n}", "function showQuestion() {\n // Find question from array of questions\n var currentQuestion = questions[currentQuestionIndex];\n // Fill in question and answer choices\n var titleEl = document.getElementById(\"question-slot\");\n titleEl.textContent = currentQuestion.question;\n choicesEl.innerHTML = \"\";\n // Run through questions\n currentQuestion.choices.forEach(function(choice, i) {\n var choiceNode = document.createElement(\"button\");\n choiceNode.setAttribute(\"class\", \"choice-btn\");\n choiceNode.setAttribute(\"value\", choice);\n choiceNode.textContent = i + 1 + \". \" + choice;\n // Make new choice buttons click listenter\n choiceNode.onclick = clickChoiceButton;\n // Append choice so it displays on page\n choicesEl.appendChild(choiceNode);\n });\n}", "function displayQuestion(question) {\n //Variables to use for displaying questions and choices\n const questionText = question.title;\n const possibleChoices = question.choices;\n //Removing the hidden class to display the questions\n document.getElementById(\"game\").classList.remove('hide')\n //Setting the text of the question\n document.getElementById(\"question\").textContent = questionText\n //Clearing the choices from the previous question\n document.getElementById(\"answers\").innerHTML = \"\"\n // Looping over possible choices\n for (let i = 0; i < possibleChoices.length; i++) {\n //created button for choices\n let div = document.createElement('button')\n //Setting the text content\n div.textContent = possibleChoices[i]\n // Event listener for the answer choice\n div.addEventListener(\"click\", function () {\n // Variable for users selected answer \n const userChoice = this.textContent\n // Variable for correct answer\n const realAnswer = Questions[currentQuestion].answer\n //Function for comparing their answer versus real answer\n checkAnswer(userChoice, realAnswer)\n\n })\n // Styling for buttons\n div.className =\"btn btn-primary\"\n // Appending answer buttons to page\n document.getElementById(\"answers\").appendChild(div)\n\n }\n}", "function showNextQuestion(question){\n questionEl.innerText = question.question\n question.answers.forEach(answer => {\n var button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n if (answer.correct) {\n button.dataset.correct = answer.correct\n \n }\n button.addEventListener('click', selectAnswer)\n answerEl.appendChild(button)\n })\n}", "function renderQuestionAnswers() {\n\t//console.log(\"Executed renderQuestionAnswers() --> \");\n\n\t// Display time remaining\n\tstrH4 = \"\";\n\tstrH4 = \"<h4 id=\\\"time-remaining\\\">Time Remaining: \" + questionTime + \" Seconds</h4>\";\n\t$(\"#time-remaining\").html(strH4);\n\n\t// Display chosen question\n\tstrH3 = \"\";\n\tstrH3 = \"<h3 id=\\\"question-status\\\" class=\\\"font-italic\\\">\" + compQuestion + \"</h3>\";\n\t$(\"#question-status\").html(strH3);\n\n\t$(\"#answers-buttons\").empty();\n\n\t// Display answers for chosen question\n\tarrTriviaDataAnswersLength = triviaData[compIndexQuestion].answers.length;\n\tfor (var i = 0; i < arrTriviaDataAnswersLength; i++) {\n\t\t// Create buttons dynamically for each answer to the trivia question\n\t\tlet newButton = $(\"<button>\");\n\t\tnewButton.attr(\"type\", \"button\");\n\t\tnewButton.addClass(\"answers\");\n\t\tnewButton.addClass(\"btn btn-light btn-lg btn-block\");\n\t\tnewButton.addClass(\"mx-auto\");\n\t\tnewButton.attr(\"data-name\", compAnswers[i].answerText);\n\t\tnewButton.html(compAnswers[i].answerText);\n\t\t$(\"#answers-buttons\").append(newButton);\n\t}\t\n}", "function displayQuestion() {\n hideResults();\n $(\"#answer\").hide();\n $(\"#time\").show();\n showDiv();\n $(\"#question\").html(question[questionCount]);\n $(\"#choice1\").html(firstChoice[questionCount]);\n $(\"#choice2\").html(secondChoice[questionCount]);\n $(\"#choice3\").html(thirdChoice[questionCount]);\n $(\"#choice4\").html(fourthChoice[questionCount]);\n }", "function displayQuestion(question) {\n titleItem.innerText = question.title;\n question.choices.forEach(answerElement => { //for each answer make a button\n let button = document.createElement('button');\n button.className = 'btn btn-outline-secondary btn-block text-left'; //create boostrap button list with answers\n button.innerText = answerElement;\n questionAnswers.appendChild(button);\n button.addEventListener('click', displayNextQuestion);\n });\n}", "function showQuestions() {\n $(questionText).text(quizObject[index].question);\n $(optionA).text(quizObject[index].answerA);\n $(optionB).text(quizObject[index].answerB);\n $(optionC).text(quizObject[index].answerC);\n $(optionD).text(quizObject[index].answerD);\n }", "function showQuestions(index){\n \n document.querySelector(\"#que_text\").textContent = questions[index].numb + \". \" + questions[index].question\n document.querySelector(\"#button0\").textContent = questions[index].options[0]\n document.querySelector(\"#button1\").textContent = questions[index].options[1]\n document.querySelector(\"#button2\").textContent = questions[index].options[2]\n document.querySelector(\"#button3\").textContent = questions[index].options[3]\n \n}", "function displayQuestion() {\n $(\".questions\").text(currentQuestionData.question);\n $(\".answer-1\").text(currentQuestionData.otherAnswers[0]);\n $(\".answer-2\").text(currentQuestionData.otherAnswers[1]);\n $(\".answer-3\").text(currentQuestionData.otherAnswers[2]);\n $(\".answer-4\").text(currentQuestionData.otherAnswers[3]);\n }", "function questionDisplay(answer) {\n if (answer != \"start-button\") {\n checkAnswer(answer);\n counter++\n }\n if (counter < 5) {\n document.getElementById(\"questionText\").textContent = questions[counter].title;\n document.getElementById(\"optionA\").textContent = questions[counter].choices[0];\n document.getElementById(\"optionB\").textContent = questions[counter].choices[1];\n document.getElementById(\"optionC\").textContent = questions[counter].choices[2];\n document.getElementById(\"optionD\").textContent = questions[counter].choices[3];\n }\n else {\n document.getElementById(\"questionText\").style.display = \"none\"\n document.getElementById(\"questionChoices\").style.display = \"none\"\n }\n}", "function showQuiz(){\n questionContainerEl.innerHTML =''\n var title= document.createElement('h1')\n var description= document.createElement('p')\n \n title.textContent = questions[qcounter].title\n description.textContent = questions[qcounter].description\n questionContainerEl.appendChild(title)\n questionContainerEl.appendChild(description)\n \n for(var i = 0; i < questions[qcounter].possibleAnswers.length; i++){\n var possibleAnswers= document.createElement('button')\n possibleAnswers.className = 'choices'\n possibleAnswers.textContent = questions[qcounter].possibleAnswers[i];\n questionContainerEl.appendChild(possibleAnswers)\n }\n}", "function showQuestion() {\n\n questionSpot.textContent = questions[questionIndex].question;\n showAnswers(); \n \n \n}", "function renderQuestion () {\n heading.innerText = \"Question \" + counter;\n content.innerText = question[counter].questionText;\n for (var j=0; j<question[counter].answerList.length; j++) {\n var answerButton = document.createElement(\"button\");\n answerButton.textContent = question[counter].answerList[j];\n answerButton.setAttribute(\"id\", j);\n buttonArea.appendChild(answerButton);\n answerButton.addEventListener('click', (event) => {\n  checkAnswer(event.target.id);\n });\n };\n}", "function showQuestions() {\n DOMSelectors.quizQuestion.innerHTML = questions[index].question;\n DOMSelectors.choice1.innerHTML = questions[index].choices[0];\n DOMSelectors.choice2.innerHTML = questions[index].choices[1];\n DOMSelectors.choice3.innerHTML = questions[index].choices[2];\n DOMSelectors.choice4.innerHTML = questions[index].choices[3];\n}", "function displayQuestion() {\n let question = STORE.questions[STORE.currentQuestion];\n updateScoreAndQuestionCounter();\n\n $(\"main\").html(generateQuestionTemplate(question.question));\n showOptions();\n $(\"#next\").hide();\n}", "function visibleQuestion(question) {\n questionEle.innerText = question.question;\n question.answers.forEach(answer => {\n const button = document.createElement('button')\n button.innerText = answer.text\n button.classList.add('btn')\n console.log(question.question)\n if (answer.correct){\n button.dataset.correct = answer.correct\n }\n else { \n button.dataset.wrong = answer.wrong\n }\n button.addEventListener('click', selectAnswer)\n answerBtns.appendChild(button);\n \n\n //This clears the state after the answer is picked\n})\n}", "function displayQuestion() {\n formQuestion.textContent = questions[currentQuestion].question;\n answer1.textContent = \" 1. \" + questions[currentQuestion].answers[1];\n answer2.textContent = \" 2. \" + questions[currentQuestion].answers[2];\n answer3.textContent = \" 3. \" + questions[currentQuestion].answers[3];\n answer4.textContent = \" 4. \" + questions[currentQuestion].answers[4];\n}", "function showQuestions() {\n if (quizBank.length == questionCounter) {\n endQuiz();\n } else {\n questionDisplay.innerText = quizBank[questionCounter].question;\n showAnswers();\n }\n}", "function muestrapregunta() {\n if (questionIndex < questions.length) {\n var quest = questions[questionIndex];\n pregunta.textContent = quest.question;\n AButton.textContent = quest.choiceA;\n BButton.textContent = quest.choiceB;\n CButton.textContent = quest.choiceC;\n DButton.textContent = quest.choiceD;\n\n }\n else {\n resultdisplay();\n\n }\n}", "function showQuestion(question){\n questionElement.innerText = question.question;\n question.answer.forEach(answer => {\n var button = document.createElement(\"button\");\n button.innerHTML = answer.text;\n button.classList.add(\"btn\")\n if(answer.correct){\n button.dataset.correct = answer.correct;\n console.log(\"right!\");\n }\n button.addEventListener(\"click\", selectAnswer)\n answerButtonElement.appendChild(button)\n \n });\n}", "function renderQuestion(){\n test = get(\"test\");\n if(pos >= questions.length){\n test.innerHTML = \"<h2>You got \"+correct+\" of \"+questions.length+\" questions correct</h2>\";\n get(\"test_status\").innerHTML = \"Test completed\";\n // resets the variable to allow users to restart the test\n pos = 0;\n correct = 0;\n // stops rest of renderQuestion function running when test is completed\n return false;\n }\n get(\"test_status\").innerHTML = \"Question \"+(pos+1)+\" of \"+questions.length;\n \n question = questions[pos].question;\n chA = questions[pos].a;\n chB = questions[pos].b;\n chC = questions[pos].c;\n chD = questions[pos].d;\n // display the question\n test.innerHTML = \"<h3>\"+question+\"</h3>\";\n // display the answer options\n // the += appends to the data we started on the line above\n test.innerHTML += \"<label> <input type='radio' name='choices' value='A'> \"+chA+\"</label><br>\";\n test.innerHTML += \"<label> <input type='radio' name='choices' value='B'> \"+chB+\"</label><br>\";\n test.innerHTML += \"<label> <input type='radio' name='choices' value='C'> \"+chC+\"</label><br>\";\n test.innerHTML += \"<label> <input type='radio' name='choices' value='D'> \"+chD+\"</label><br><br>\";\n test.innerHTML += \"<button onclick='checkAnswer() '>Submit Answer</button>\";\n}", "function renderquestion(question){\n \n questionElement.textContent = question.Q;\n\n for (var j =0 ; j<question.A.length; j++)\n {\n var answer = document.createElement('button');\n answer.classList.add(\"btn\");\n answer.textContent = j+1 + \". \"+ question.A[j].ans;\n answerbuttons.append(answer);\n if (question.A[j].correct)\n { //Create data attribute correct for correct answer\n answer.dataset.correct = question.A[j].correct;\n }\n answer.addEventListener('click', selectanswer);\n }\n\n}", "function askQuestions() {\n if (currentQuestion === arrayOfQuestions.length) {\n questionSection.style.display = \"none\";\n initialsSection.style.display = \"block\";\n }\n presentQuestion.textContent = arrayOfQuestions[currentQuestion].quizQuestion;\n firstChoice.textContent = arrayOfQuestions[currentQuestion].potentialAnswers[0];\n secondChoice.textContent = arrayOfQuestions[currentQuestion].potentialAnswers[1];\n thirdChoice.textContent = arrayOfQuestions[currentQuestion].potentialAnswers[2];\n fourthChoice.textContent = arrayOfQuestions[currentQuestion].potentialAnswers[3]\n}", "function showQuestion(list) {\n\n questionNumber.innerHTML = qIndex;\n\n q.innerHTML = list.ask;\n\n btn0.innerHTML = list.answers[0].text;\n btn0.dataset.ans = list.answers[0].correct;\n\n btn1.innerHTML = list.answers[1].text;\n btn1.dataset.ans = list.answers[1].correct;\n\n btn2.innerHTML = list.answers[2].text;\n btn2.dataset.ans = list.answers[2].correct;\n\n btn3.innerHTML = list.answers[3].text;\n btn3.dataset.ans = list.answers[3].correct;\n\n btn0.addEventListener('click', ansClick);\n btn1.addEventListener('click', ansClick);\n btn2.addEventListener('click', ansClick);\n btn3.addEventListener('click', ansClick);\n}", "function displayQuestion(question) {\n Quest.textContent = question.ask;\n button1.textContent = question.option1;\n button2.textContent = question.option2;\n button3.textContent = question.option3;\n button4.textContent = question.option4;\n \n for (var i = 0; i < allButtons.length; i++) {\n allButtons[i].addEventListener(\"click\", leggi);}\n}", "function displayQuestion(){\n questionNum = 0;\n \n questionDisplay.textContent = question[questionNum].title;\n userAnswer.innerHTML=\"\";\n var choices = question[questionNum].choices;\n for(var i = 0; i < 4; i++){\n var nextChoice = document.createElement(\"button\");\n nextChoice.textContent = choices[i];\n answerBtn = userAnswer.appendChild(nextChoice).setAttribute(\"class\", \"p-3 m-1 btn btn-light btn-block\");\n }\n\n}", "function displayQ() {\n $(\"#aa\").html(\"\");\n $(\"#qa\").css(\"display\", \"grid\");\n $(\"#complete\").css(\"display\", \"none\");\n $(\"#timesup\").css(\"display\", \"none\");\n $(\"#timer\").css(\"display\", \"inline\");\n $(\"#time\").text(time);\n $(\"#correct\").css(\"display\", \"none\");\n $(\"#incorrect\").css(\"display\", \"none\");\n clicked = false;\n if (qNum < 21) {\n qTimer = setInterval(function () {\n if (time > 0) {\n time--\n $(\"#time\").text(time);\n } else if (time === 0) {\n clearTimer();\n timesUp();\n time = 15;\n }\n }, 1000);\n $(\"#question\").text(eval(\"q\" + qNum + \".question\"));\n for (var j = 0; j < 4; j++) {\n var newDiv = $(\"<button>\");\n newDiv.text(eval(\"q\" + qNum + \".answers[\" + j + \"]\"));\n newDiv.attr(\"id\", \"choices\");\n $(\"#aa\").append(newDiv);\n }\n } else if (qNum === 21) {\n complete();\n }\n }", "function renderQuestion(){\n /* get a question from the questionSet array */\n var question = questionSet[questionIndex];\n \n /* update title with active question object */\n questionEl.children[0].textContent = question.title;\n \n /* evaluates if sometimes */\n while (answersEl.hasChildNodes()) {\n answersEl.removeChild(answersEl.lastChild);\n }\n /* Iterate over answer objects in each question's array */\n for (var i = 0; i < question.options.length; i++) {\n /* create button for each option object */\n var answerBtn = document.createElement(\"BUTTON\");\n answerBtn.textContent = question.options[i];\n /* return answer buttons in UI */\n answersEl.appendChild(answerBtn);\n }\n /* Each answer option object has an event listener*/\n answersEl.children[0].addEventListener(\"click\", function(event){\n optionClick(answersEl.children[0]);\n });\n answersEl.children[1].addEventListener(\"click\", function(event){\n optionClick(answersEl.children[1]);\n });\n answersEl.children[2].addEventListener(\"click\", function(event){\n optionClick(answersEl.children[2]);\n });\n answersEl.children[3].addEventListener(\"click\", function(event){\n optionClick(answersEl.children[3]);\n });\n\n /* Manages answer selection, user feedback, and iterating through all elements in the questionSet array */\n function optionClick(option){\n /* if the answer option the user clicks on matches in type and value to the answer in the questionSet array, flash the user a Correct toast */\n if(option.textContent == questionSet[questionIndex].answer){\n toastEl.textContent = \"Correct!\";\n \n /* if the answer option the user clicks on doesn't match in type and value to the answer in the questionSet array, flash the user a Wrong toast and */\n } else {\n \n /* subraction assingment to remove 2 seconds from time remaining if the answer is wrong */\n time -= 10;\n toastEl.textContent = \"Wrong :/\";\n }\n\n /*iterate to next question */\n questionIndex++;\n\n /* Evaluate if all questions in the array have been used yet */\n if (questionIndex === questionSet.length) {\n quizEnd();\n } else {\n renderQuestion();\n }\n }\n}", "function showQuestion(){\n var q = questions[runningQuestion];\n questionContainer.innerHTML = q.question;\n a.innerHTML = q.answerA;\n b.innerHTML = q.answerB;\n c.innerHTML = q.answerC;\n d.innerHTML = q.answerD;\n}", "function runQuestion() {\n\n var randomQuestion = pullQuestion();\n\n if (randomQuestion === undefined) {\n stopGame();\n return;\n }\n \n var questionEl = document.getElementById(\"description\");\n questionEl.textContent = randomQuestion.question;\n \n var ansEl = document.getElementById(\"questions\");\n ansEl.textContent = \"\";\n \n randomQuestion.answers.forEach((answer, index) => {\n var ans = document.createElement(\"button\");\n ans.textContent = ((index + 1) + \": \" + answer);\n ans.setAttribute(\"style\", \"display: block; height: 40px;\")\n ans.setAttribute(\"index\", index);\n ansEl.appendChild(ans);\n })\n \n correctIndex = randomQuestion.correctAnswer;\n}", "displayQuestion (no) {\n\n\t\tlet qn = questions[no];\n\t\tlet aws = qn.getAnswers();\n\n\t\tlet quesNo = $(\"<kbd class='question-no'></kbd>\").text(no+1);\n\t\t$(\".question-block\").text(qn.getQuestion());\n\t\t$(\".question-block\").prepend(quesNo);\n\n\t\tlet aBlock = $(\".answer-block\").empty();\n\t\tlet i = 0;\n\t\tfor (let ans of aws) {\n\t\t\tlet div = $(\"<div class='custom-control custom-radio single-answer'></div>\");\n\t\t\tlet input = $(\"<input type='radio' id='customRadio\" + ++i +\"' name='answer' value='\" +ans+ \"' class='custom-control-input' />\");\n\t\t\tlet label = $(\"<label class='custom-control-label' for='customRadio\"+ i +\"'></label>\").text(ans);\n\n\t\t\tif (no < uStorage.allDetails.length) {\n\t\t\t\tif (ans == uStorage.getUserAnswer(no))\n\t\t\t\t\tinput.prop(\"checked\", true);\n\t\t\t}\n\n\t\t\taBlock.append(div.append(input, label));\n\t\t}\n\n\t\t//Creation of the Previous button.\n\t\tlet pButton = $(\".prev-button\").off(\"click\");\n\t\tpButton.click(function () {\n\t\t\tif (uStorage.allDetails.length+1 == questions.length)\n\t\t\t\tuStorage.insertDetail(createObj(no, false), no);\n\t\t\t$(\".content-header\").slideUp(600);\n\t\t\t$(\".main\").slideUp();\n\t\t\tsetTimeout(function () {\n\t\t\t\tdisplay.displayQuestion(no-1);\n\t\t\t}, 400);\n\t\t});\n\t\tno == 0 ? pButton.attr(\"disabled\", \"disabled\") : pButton.removeAttr(\"disabled\");\t\t\t\t\t//The button is disabled for the first page.\n\n\t\t//Creation of the Submit button.\n\t\tlet sButton = $(\".submit-button\").off(\"click\");\n\t\tsButton.click(function () {\n\t\t\tuStorage.insertDetail(createObj(no, true), no);\n\t\t\t$(\".content-header\").slideUp(600);\n\t\t\t$(\".main\").slideUp();\n\t\t\tsetTimeout(function () {\n\t\t\t\tdisplay.displayQuestion(no+1 == questions.length ? no: no+1);\n\t\t\t\tupdateHeader();\n\t\t\t}, 400);\n\n\t\t});\n\n\t\t//Creation of the Next button.\n\t\tlet nButton = $(\".next-button\").off(\"click\");\n\t\tnButton.click(function () {\n\t\t\tuStorage.insertDetail(createObj(no, false), no);\n\t\t\t$(\".content-header\").slideUp(600);\n\t\t\t$(\".main\").slideUp();\n\t\t\tsetTimeout(function () {\n\t\t\t\tdisplay.displayQuestion(no+1);\n\t\t\t\tupdateHeader();\n\t\t\t}, 400);\n\t\t});\n\n\t\tif (no+1 == questions.length) {\n\t\t\tnButton.attr(\"disabled\", \"disabled\");\t\t\t\t\t\t\t//The button is disabled for the last page.\n\t\t\tthis.displaySureButton();\n\t\t}\n\t\telse\n\t\t\tnButton.removeAttr(\"disabled\");\n\n\t\t$(\".content-header\").slideDown(600);\n\t\t$(\".main\").css(\"display\", \"flex\").hide().slideDown();\n\t\t$(\".quiz-timer\").slideDown();\n\t}", "function showQuestion() {\n let q = myQuestions[runningQuestion];\n question.innerHTML = q.question;\n choiceA.innerHTML = q.choiceA;\n choiceB.innerHTML = q.choiceB;\n choiceC.innerHTML = q.choiceC;\n}", "function displayQuestion() {\n\n $(\"#question\").html(questionID.question);\n\n\n\n // Displays question's possible answers.\n\n displayQuestionAnswers();\n\n}", "function displayQuestions() {\n // Show questions starting with question one\n var displayedQuestion = gameQuestionEl.innerHTML = questions[currentQuestion].question;\n // Console log displayed question\n console.log(\"Displayed question: \", displayedQuestion);\n // Display each answer choice for user to select from\n choiceA.innerHTML = questions[currentQuestion].choices[0];\n choiceB.innerHTML = questions[currentQuestion].choices[1];\n choiceC.innerHTML = questions[currentQuestion].choices[2];\n choiceD.innerHTML = questions[currentQuestion].choices[3];\n}", "function askQuestion(questionNumber) {\n // this places the Question text into the Question area of the page\n var h1 = document.querySelector(\"h1\");\n h1.textContent = \"\"; // clears the previous Question\n h1.textContent = questions[questionNumber];\n // clear all previous Answers\n var ol = document.querySelector(\"ol\");\n ol.innerHTML = \"\";\n // for each Answer, let's display them\n for (let i = 0; i < 4; i++) { // there are 4 Answers\n // add a list item\n var li = document.createElement(\"li\");\n document.body.children[1].children[0].children[0].children[1].appendChild(li);\n // find a \"button\"\n var answerButton = document.createElement(\"button\")\n // ID the button, add quiz class, give style\n answerButton.setAttribute(\"id\", \"answer\");\n answerButton.setAttribute(\"class\", \"quiz\");\n answerButton.setAttribute(\"style\", \"padding:1em;width:100%\");\n // put the Answer text in the button\n thisAnswer = answers[questionNumber][i];\n answerButton.textContent = thisAnswer;\n // answerKey is the index of the correct Answer, always found in slot 4\n var answerKey = answers[questionNumber][4];\n rightAnswer = answers[questionNumber][answerKey];\n // correct Answer will be labeled true\n if (thisAnswer === rightAnswer) { answerButton.value = true; }\n // put the whole button in the site\n document.body.children[1].children[0].children[0].children[1].children[i].appendChild(answerButton);\n } // end for loop\n\n checkAnswer(questionNumber);\n}", "function quizQuestions() {\n currIndex = 0;\n var currQuest = questions[currIndex];\n\n // update the header\n questionHeader.textContent = currQuest.title;\n\n //loop through choices,\n currQuest.choices.forEach(function(choices) {\n // if (curreQuest <= (questions.choices.length - 1)) {\n //creating a button for each, assigning the data-attributes, and event listeners to save their answer\n var choiceButton = document.createElement(\"button\");\n choiceButton.setAttribute(\"class\", \"choice\");\n choiceButton.setAttribute(\"value\", choices);\n\n //saving choice as their answer...\n choiceButton.onclick = userAnswer;\n //displaying the choices\n choiceButton.textContent = choices;\n\n //hopefully displays on page\n chooseEl.appendChild(choiceButton);\n });\n}", "function renderQuestion(pickQuestion){\n\t\t\n\t\ttimer.reset();\n\t\t$(\".question\").html(\"<h2>\" + questionArray[pickQuestion].question + \"</h2>\");\n\t\t$(\"#redButton\").text(questionArray[pickQuestion].possibleAnswers[0]).show();\n\t\t$(\"#whiteButton\").text(questionArray[pickQuestion].possibleAnswers[1]).show();\n\t\t$(\"#blueButton\").text(questionArray[pickQuestion].possibleAnswers[2]).show();\n\t\t$(\"#yellowButton\").text(questionArray[pickQuestion].possibleAnswers[3]).show();\n\t\n\t}", "function show_question(){\n\t\t$(\".box\").html(\"\");\n\n\t\tif(next_question > questions.length){\n\t\t\tconsole.log(\"No more questions\");\n\t\t\t// show results\n\t\t\tresults();\n\t\t\treturn;\n\t\t}\n\n\t\tselected_question=questions[next_question-1];\n\t\tconsole.log(selected_question.question);\n\t\t\n\t\tvar tick = 30;\n\t\t$(\".timer\").html(\"<p id=\\'timer\\' class=centered>Time Remaining: \"+tick+\" Seconds</p>\");\n ticker = window.setInterval(function(){\n \tif(tick>0){\n \t\ttick--;\n \t\t$(\".timer\").html(\"<p id=\\'timer\\' class=centered>Time Remaining: \"+tick+\" Seconds</p>\");\n \t}\n }, 1000);\n\n\t\tdisplay_question.html(\"<p class=centered>\"+selected_question.question+\"<p>\");\n\t\t// create var and store <p> tag in it\n\t\t//add attributes to var \n\t\t// in for loop that loops for questions.length times add data-answer=answer+i attr and text selected_question.answer+i\n\t\tfor (var i=0; i<questions.length;i++){\n\t\t\tvar print_answ=$(\"<p>\");\n\t\t\tprint_answ.attr(\"class\", \"answer centered btn btn-primary btn-lg container-fluid\");\n\t\t\tprint_answ.attr(\"data-answer\", \"answer\"+i);\n\t\t\tprint_answ.text(selected_question['answer'+i]);\n\t\t\tdisplay_question.append(print_answ);\n\t\t\t$(\".box\").append(display_question);\n\t\t\tconsole.log(\"printing answers\");\n\t\t}\n\t\t// display_question.append(\"<p data-answer=answer0 class=\\\"answer centered btn btn-primary btn-lg container-fluid\\\">\"+selected_question.answer0+\"</p>\"+\n\t\t// \t\"<p data-answer=answer1 class=\\\"answer centered btn btn-primary btn-lg container-fluid \\\">\"+selected_question.answer1+\"</p>\"+\n\t\t// \t\"<p data-answer=answer2 class=\\\"answer centered btn btn-primary btn-lg container-fluid \\\">\"+selected_question.answer2+\"</p>\"+\n\t\t// \t\"<p data-answer=answer3 class=\\\"answer centered btn btn-primary btn-lg container-fluid \\\">\"+selected_question.answer3+\"</p>\");\n\n\t\tnext_question++;\n\t\t//If the player runs out of time, tell the player that time's up and display \n\t\t//the correct answer. Wait a few seconds, then show the next question.\n\t\ttimeout = setTimeout(function() {\n unanswered++;\n console.log(unanswered);\n display_question.html(\"<h3 class=centered>Out Of Time!</h3>\");\n\t\t display_question.append(\"<p class=centered>The Correct Answer Was: \"+selected_question.correctAnswer+\"</p>\");\n\t\t $(\".box\").html(display_question);\n\t\t gif();\n\t\t timeout = setTimeout(show_question, 6000);\n // return;\n }, 30000);\n\t}", "function displayQuestion() {\n\t$(\"#question\").html(questionID.question);\n\n\t// Displays question's possible answers.\n\tdisplayQuestionAnswers();\n}", "function renderQuestion(){\n test = document.getElementById(\"test\");\n if(pos >= questions.length){\n test.innerHTML = \"<h2 class = 'text-center'\t>You got \"+correct+\" of \"+questions.length+\" questions correct</h2>\";\n document.getElementById(\"test_status\").innerHTML = \"Test completed\";\n // resets the variable to allow users to restart the test\n pos = 0;\n correct = 0;\n // stops rest of renderQuestion function running when test is completed\n return false;\n }\n document.getElementById(\"test_status\").innerHTML = \"Question \"+(pos+1)+\" of \"+questions.length;\n \n question = questions[pos].question;\n chA = questions[pos].a;\n chB = questions[pos].b;\n chC = questions[pos].c;\n // display the question\n test.innerHTML = \"<h3>\"+question+\"</h3>\";\n // display the answer options\n // the += appends to the data we started on the line above\n test.innerHTML += \"<label> <input type='radio' name='choices' value='A'>\"+chA+\"</label><br>\";\n test.innerHTML += \"<label> <input type='radio' name='choices' value='B'>\"+chB+\"</label><br>\";\n test.innerHTML += \"<label> <input type='radio' name='choices' value='C'>\"+chC+\"</label><br><br>\";\n test.innerHTML += \"<button class = 'btn btn-success px-3 py-3' onclick='checkAnswer()'>Submit Answer</button>\";\n}", "function renderQuestion() {\n document.getElementById(\"start\").addEventListener(\"click\", startQuiz) \n test = get(\"button\");\n if (position >= window.question) {\n test.innerHTML = \"<h2>You got \" + correct + \" of \" + questions.length + \" questions correct</h2>\";\n get(\"submission\").innerHTML = \"Test completed\";\n //resets variable for quiz restart\n position = 0;\n correct = 0;\n //stops renderQuestion function when test is complete\n return false;\n }\n get(\"quest\").innerHTML = \"Question \" + (position + 1) + \" of \" + questions.length;\n\n question = questions[position].question;\n chA = questions[position].a;\n chB = questions[position].b;\n chC = questions[position].c;\n chD = questions[position].d;\n console.log(\"these are the questions\")\n // display the question\n question.innerHTML = \"<h3>\" + question + \"</h3>\";\n console.log(\"this is the question\")\n // display the answer options\n get \n // document.getElementById(\"userinput1\").value = \"chA\";\n // document.getElementById(\"userinput2\").value = \"chB\";\n // document.getElementById(\"userinput3\").value = \"chC\";\n // document.getElementById(\"userinput4\").value = \"chD\";\n\n}", "function answersQuestionPrint() {\n questionChooser();\n answerChooser(currentQuestion);\n }", "function showQuiz() {\n // Display the question\n question.textContent = shuffledQuizArr[currentQuestion].question;\n // Display the answers\n optionA.textContent = shuffledQuizArr[currentQuestion].answerList.a;\n optionB.textContent = shuffledQuizArr[currentQuestion].answerList.b;\n optionC.textContent = shuffledQuizArr[currentQuestion].answerList.c;\n optionD.textContent = shuffledQuizArr[currentQuestion].answerList.d;\n}", "function displayQuestion() {\n questionBox.textContent = myQuestions[questionIndex].question\n displayAnswers()\n}", "function showQuestion() {\n var question = questionAnswer[currentQuestion];\n $(\"#questionBox\").text(question.question);\n $(\".quiz ul\").empty();\n // adds answers with ID based on position in array\n for (var i = 0; i < question.answers.length; i++) {\n $(\".quiz ul\").append(\"<button id = \" + i + \" type = button class = \\\"btn btn-dark\\\">\" + question.answers[i] + \"</button>\")\n }\n\n}", "function next() {\ncurrentQuestion++;\n\nif (currentQuestion > questions.length - 1) {\n\tendGame();\n\treturn;\n}\n\nvar quizContent = \"<h2>\" + questions[currentQuestion].title + \"</h2>\"\n\nfor (var buttonLoop = 0; buttonLoop < questions[currentQuestion].choices.length; buttonLoop++) {\n\tvar buttonCode = \"<button onclick=\\\"[ANS]\\\">[CHOICE]</button>\"; \n\tbuttonCode = buttonCode.replace(\"[CHOICE]\", questions[currentQuestion].choices[buttonLoop]);\n\tif (questions[currentQuestion].choices[buttonLoop] == questions[currentQuestion].answer) {\n\t\tbuttonCode = buttonCode.replace(\"[ANS]\", \"correct()\");\n\t} else {\n\t\tbuttonCode = buttonCode.replace(\"[ANS]\", \"incorrect()\");\n\t}\n\tquizContent += buttonCode\n}\n\n\ndocument.getElementById(\"quizBody\").innerHTML = quizContent;\n}", "function getQuestions() {\n var currentQuestion = quizQuestions[index];\n questions.textContent = currentQuestion.question\n answers.innerHTML = \"answers\"\n currentQuestion.answers.forEach(function(choice, i){\n var choiceBtn = document.createElement(\"button\")\n choiceBtn.setAttribute(\"class\", \"answers\")\n choiceBtn.setAttribute(\"value\", choice)\n choiceBtn.textContent = i + 1 + \": \" + choice \n answers.appendChild(choiceBtn)\n choiceBtn.onclick = verifyAnswer;\n })\n}", "function nextQuestion() {\n var currentQuestion = arrayOfQuestions[currentQuestionIndex];\n invisiblebBtnEl.forEach(function (button) {\n button.style.visibility = \"visible\";\n });\n mainEl.innerHTML = \"\";\n var questionEl = document.createElement(\"h2\");\n questionEl.textContent = currentQuestion.question;\n answer1El.textContent = currentQuestion.answer1;\n answer2El.textContent = currentQuestion.answer2;\n answer3El.textContent = currentQuestion.answer3;\n answer4El.textContent = currentQuestion.answer4;\n\n mainEl.append(questionEl);\n mainEl.append(answer1El);\n mainEl.append(answer2El);\n mainEl.append(answer3El);\n mainEl.append(answer4El);\n}", "function showQuestion(question){\n questionElement.innerText = question.question; // question. is the value passed into the parameter, .question is the property of the questions array\n answerButtonsEl.innerHTML = ''; //wiping it clear to put new question in \n question.answers.sort((a, b) => { // fuctionally the same as writing function (a, b) compares a to b, expects negative or positive number to sort\n return Math.random() - 0.5; // 50% of time will either be negative or positive, therefore list will be sorted randomly\n });\n //Generate answer buttons\n question.answers.forEach(element => { //forEach expects element parameter and will run for each element in array, element is the list within the answers array\n let btn = document.createElement('div');\n btn.classList.add('btn');\n btn.innerText = element.text;\n btn.dataset.correct = element.correct; // dataset.x is converted to an html element property of data-x, data- stores whatever property in the DOM so you can reference it\n answerButtonsEl.appendChild(btn);\n });\n}", "function displayQuestion(qNum) {\n\n //display the question\n var questionTitle = document.createElement(\"h3\");\n questionTitle.className = \"added\";\n questionTitle.textContent = qNum.question;\n quizArea.appendChild(questionTitle);\n\n //display each of the 4 options\n for (var i=0;i<4;i++) {\n var optionButton = document.createElement(\"button\");\n optionButton.textContent = qNum.option[i];\n\n //determine if each option is the correct one, and assign respective classes\n if (optionButton.textContent==qNum.correctAnswer) {\n optionButton.className = \"added-button correct\";\n } else {\n optionButton.className = \"added-button wrong\";\n }\n quizArea.appendChild(optionButton);\n }\n}", "function renderQuestion() {\n var question = questions[questionIndex];\n var answers = questions[answerIndex];\n questionText.textContent = question.question;\n optionA.textContent = answers.answers.a;\n optionB.textContent = answers.answers.b;\n optionC.textContent = answers.answers.c;\n optionD.textContent = answers.answers.d;\n}", "function renderQuestion() {\n var thisQuestion = allQuestions[runningQuestionIndex]\n questionEL.textContent = thisQuestion.title\n\n //clears answers\n choices.innerHTML = ''\n thisQuestion.choices.forEach(function (choice) {\n var button = document.createElement('button')\n button.textContent = choice\n button.addEventListener('click', function () {\n checkAnswer(event)\n if (runningQuestionIndex === lastQuestionIndex) {\n //display results 1. create function\n alert(`You scored ${score}`)\n } else {\n runningQuestionIndex++\n renderQuestion()\n }\n })\n choices.appendChild(button)\n })\n}", "function renderQuestionAndAnswers(questionNum) {\n\t$('.js-question').html(`<p>${QUESTIONS[questionNum].question}</p>`);\n\t$('.js-answers').html(`<button class=\"ans_button\" id=\"a\">${QUESTIONS[questionNum].a}</button>\n\t\t<button class=\"ans_button\" id=\"b\">${QUESTIONS[questionNum].b}</button>\n\t\t<button class=\"ans_button\" id=\"c\">${QUESTIONS[questionNum].c}</button>\n\t\t<button class=\"ans_button\" id=\"d\">${QUESTIONS[questionNum].d}</button>\n\t\t`);\n}", "function showQuestion(){\n scoreList.classList.add(\"hideBtn\")\n btnA.classList.remove(\"hideBtn\");\n btnB.classList.remove(\"hideBtn\");\n btnC.classList.remove(\"hideBtn\");\n btnD.classList.remove(\"hideBtn\");\n var currentQuestion = questionArr[currentQuestionIndex];\n header.textContent = currentQuestion.question;\n btnA.textContent = currentQuestion.answer[0];\n btnB.textContent = currentQuestion.answer[1];\n btnC.textContent = currentQuestion.answer[2];\n btnD.textContent = currentQuestion.answer[3];\n}", "function renderQuestion() {\n\n\tvar test = _(\"test\");\n\n\tif(pos >= questions.length){\n\t\ttest.innerHTML = \"<h2>You got \"+correct+\" of \"+questions.length+\" questions correct</h2>\";\n\t\ttest.innerHTML += \"<button onclick='renderQuestion()'>Try Again</button>\";\n\t\t_(\"test_status\").innerHTML = \"Test Completed\";\n\t\t_(\"status\").innerHTML = \"\";\n\n\t\tpos = 0;\n\t\tcorrect = 0;\n\t\treturn false;\n\t}\n\n\t_(\"test_status\").innerHTML = \"Question \"+(pos+1)+\" of \"+questions.length;\n\tquestion = questions[pos][0];\n\tchoiceA = questions[pos][1];\n\tchoiceB = questions[pos][2];\n\tchoiceC = questions[pos][3];\n\n\ttest.innerHTML = \"<h3>\"+question+\"</h3>\";\n\n\ttest.innerHTML += \"<input type = 'radio' name='choices' value='A'> \"+choiceA+\"<br>\"; \n\ttest.innerHTML += \"<input type = 'radio' name='choices' value='B'> \"+choiceB+\"<br>\";\n\ttest.innerHTML += \"<input type='radio' name='choices' value='C'> \"+choiceC+\"<br><br>\";\n\ttest.innerHTML += \"<button onclick='checkAnswer()'>Submit Answer</button>\";\n\n}" ]
[ "0.8377368", "0.8140302", "0.80799204", "0.80794954", "0.806764", "0.8049341", "0.80475515", "0.80439633", "0.8043309", "0.80325294", "0.8023251", "0.7999934", "0.7987537", "0.79858375", "0.7984536", "0.79589915", "0.7956796", "0.7950418", "0.7949029", "0.7944118", "0.7943031", "0.792494", "0.7906396", "0.79057366", "0.78920656", "0.7858874", "0.7843715", "0.7834025", "0.7831117", "0.78300357", "0.77875274", "0.77663803", "0.7742555", "0.77398634", "0.7723036", "0.77161545", "0.7712797", "0.77022505", "0.7667315", "0.76557094", "0.76518565", "0.7639133", "0.7605509", "0.75934106", "0.7584976", "0.7584483", "0.75811285", "0.7578946", "0.757399", "0.7569539", "0.7568219", "0.75564855", "0.7528978", "0.75255626", "0.75206196", "0.7509205", "0.7496625", "0.7491775", "0.7491493", "0.74836177", "0.7480929", "0.74669373", "0.74600166", "0.7455861", "0.7454458", "0.74429154", "0.74324656", "0.743105", "0.7424898", "0.74218136", "0.74214697", "0.74173677", "0.74017876", "0.7374025", "0.73735005", "0.73565906", "0.73526067", "0.7349632", "0.7343717", "0.73371285", "0.73311573", "0.7324018", "0.73200244", "0.73153466", "0.73131114", "0.73113424", "0.73110235", "0.73027927", "0.73017937", "0.72955817", "0.7292253", "0.72839445", "0.72806615", "0.72796977", "0.7278723", "0.72773135", "0.72763145", "0.7275192", "0.7273433", "0.726843" ]
0.74713093
61
Captures the click and determines if the answer does/does not have the dataset.correct = true
function selectAnswer (e) { var selectedButton = e.target; if (selectedButton.dataset.correct == "true") { const correctEL = document.createElement("correct"); correctEL.textContent = "Correct"; answerButtonsEl.appendChild(correctEL); } else { const wrongEL = document.createElement("wrong"); wrongEL.textContent = "Wrong"; answerButtonsEl.appendChild(wrongEL); if (secondsLeft < 5) { secondsLeft = 0; timerEl.innerHTML = secondsLeft; } else { secondsLeft -= 10; timerEl.innerHTML = secondsLeft; } } if (shuffledQuestions.length > currentQuestionIndex + 1) { setTimeout(nextQuestion, 500); } else { setTimeout(enterScore(), 500); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clickOn1(){if(goodAnswer == 1){ correctAnswerClick(1); }else{ badAnswerClick(1); }}", "function answerIsIncorrect () {\r\n feedbackForIncorrect();\r\n}", "function answerIsCorrect () {\r\n feedbackForCorrect();\r\n updateScore();\r\n}", "function choseAnswer(e) {\n const selectedButton = e.target;\n const correct = selectedButton.dataset.correct;\n}", "function clickAnswer(event) {\n if (event.target.dataset.answer === `correct`) {\n score++\n alert(`Correct!`);\n } else {\n secondsLeft--\n alert(`Incorrect...`)\n }\n newQuestion()\n }", "function correctCheck(){\n\t\tvar correct = false;\n\n\t\t$('.choice').on('click', function(){\n\t\t\tconsole.log(clicked);\n\t\t\tif (clicked === false) {\n\t\t\t\tif ($(this).attr('id') === questions[questionCount].correct){\n\t\t\t\t\tcorrect = true;\n\t\t\t\t\tcorrectCount++;\n\t\t\t\t\ttotalCorrect++;\n\t\t\t\t}\n\t\t\t\tclicked = true;\n\t\t\t\tchangeOpacity();\n\t\t\t\tprogressUpdate(correct);\n\t\t\t\tcorrectAnswer(correct);\n\t\t\t}\n\t\t});\n\t}", "function answerIsCorrect() {\n correctAnswerFeedback();\n nextQuestion();\n addToScore();\n}", "function answerClicked() {\n console.log(this);\n if (!acceptingResponsesFromUser) {\n return;\n }\n\n acceptingResponsesFromUser = false;\n\n if ($(this).attr(\"data-value\") === $(this).attr(\"data-correct-response\")) {\n correctAnswerClicked();\n } else {\n wrongAnswerClicked();\n }\n}", "function checkAnswer(event) {\r\n return event.target.innerText === question.answer;\r\n }", "function clickedButton(clickevent) {\n\n if (currentQuestion < myQuestions.length) {\n var clickId = clickevent.srcElement.getAttribute('which');\n var answered = myQuestions[currentQuestion].choices[clickId];\n console.log(\"User clicked \" + clickId + \" which is \" + answered);\n var correctId = myQuestions[currentQuestion].correctAnswer;\n var correctAnswer = myQuestions[currentQuestion].choices[correctId];\n console.log(\"Correct answer is: \" + correctId + \" which is \" + correctAnswer);\n\n if (clickId == correctId) {\n alert(\"Correct!\");\n score++\n } else {\n alert(\"Wrong\")\n }\n\n currentQuestion++\n }\n\n\n if (currentQuestion < myQuestions.length) {\n displayQuestion();\n } else {\n alert(\"The quiz is complete. Your score is \" + score + \" out of 10\");\n }\n}", "function guessAnswer (e) {\n console.log('Answer selected');\n // get the button from the event\n const selectedButton = e.target;\n console.log(e.target);\n // pull out the boolean represntinv if its true or not\n const correctAnswer = selectedButton.dataset.correct;\n console.log(correctAnswer);\n // check if its correct\n checkIfCorrect(correctAnswer);\n if (currentQuestionIndex < 10) {\n nextQuestion();\n } else {\n endQuiz();\n }\n \n}", "function checkAnswers() {\n\n\t\t$( '.button-question').on('click', function() {\n\t\t\tvar $this = $(this);\n\t\t\tconsole.log($this);\n\t\t\tvar val = $this.attr('value');\n\t\t\t// console.log(val);\n\n\t\t\tif (val === 'true'){\n\t\t\t\trightAnswer ++;\n\t\t\t\tconsole.log(rightAnswer);\n\t\t\t} else {\n\t\t\t\twrongAnswer ++;\n\t\t\t\tconsole.log(wrongAnswer);\n\t\t\t}\n\t\t\tnoAnswer = 5 - (rightAnswer + wrongAnswer);\n\t\t\t// console.log(\"unanswered\" + noAnswer);\n\t\t});\n\n\t}", "function checkAnswer(click, answer){\n feedback = $(\".feedback\");\n //console.log(click);\n //console.log(answer);\n if(click === answer){\n feedback.text(\"That answer was correct.\");\n score += 10;\n }\n else{\n feedback.text(\"That answer was not correct.\");\n timeLeft -= 15;\n }\n}", "function checkAnswer() {\r\n STORE.view = 'feedback';\r\n let userSelectedAnswer = STORE.userAnswer;\r\n let correctAnswer = STORE.questions[STORE.questionNumber].correctAnswer;\r\n console.log('Checking answer...');\r\n if (userSelectedAnswer == correctAnswer) {\r\n STORE.score++;\r\n STORE.correctAnswer = true;\r\n }\r\n else {\r\n STORE.correctAnswer = false;\r\n }\r\n}", "function verifyAnswer() {\n // if clicked button's 'value' attr does not match correct answer\n if (this.value !== quizQuestions[index].correct) {\n // cut off 2 seconds from time\n timerCount -= 2;\n }\n\n // increment index by 1\n index++;\n\n // if index matches length of questions array\n if (index === quizQuestions.length) {\n // end quiz\n quizOver(); \n } else {\n // get next question\n getQuestions();\n }\n}", "function checkAnswer() {\n disableAnswerBtns();\n const userAnswer = this.firstElementChild.innerText;\n const correctAnswer = startRound()\n \n if (userAnswer === correctAnswer[\"category\"]) {\n updateScore();\n showFeedbackModal(true, correctAnswer)\n } else {\n showFeedbackModal(false, correctAnswer)\n }\n}", "function verifyAnswer(selection) {\n\n if (selection === questions[rand][2]) {\n correct++;\n setGif(0);\n } else {\n incorrect++;\n setGif(1);\n }\n\n } //ends verifyAnswer", "function checkAnswer(e) {\n\n //Targets the clicked button with 'true' attribute and increase the user's score by 20 points\n console.log(e.currentTarget);\n if (e.currentTarget.hasAttribute(\"true\")) {\n score += 20;\n console.log(score);\n //Removes 10 seconds when user selects incorrect answer\n } else {\n secondsLeft -= 10;\n }\n}", "function pressAnswer(event) {\n let pressedButton = event.target\n if (pressedButton.dataset.correct == \"true\") {\n // increase score\n remainingTime += 5\n highScore += 20\n } else {\n //subtract score\n remainingTime -= 20\n }\n nextQuestion()\n}", "function clickFunction() {\n qIndex = qIndex + 1;\n if (qIndex < questions.length && this.textContent === currentQuestion.correctAnswer) {\n score = score + 100;\n displayBox.textContent = \"Correct!\"\n askQuestion();\n } else if (qIndex === questions.length && this.textContent === currentQuestion.correctAnswer) {\n score = score + 100;\n displayBox.textContent = \"Correct!\"\n endGame();\n } else if (qIndex < questions.length && this.textContent !== currentQuestion.correctAnswer) {\n timerCount = timerCount - 10;\n displayBox.textContent = \"Incorrect\";\n askQuestion();\n } else if (qIndex === questions.length && this.textContent !== currentQuestion.correctAnswer) {\n timerCount = timerCount - 10;\n displayBox.textContent = \"Incorrect\";\n endGame();\n }\n}", "function correctClick() {\n\tlet index = parseInt(this.id);\n\t\n\tplaySound(index);\n\t\t\n\tif (index != pattern[curIndex++]) {\n\t\tconsole.log(\"oh no\");\n\t\t\n\t\t//simon_exec will end the game if result is -1\n\t\tresult = -1;\n\t\tsimon_exec();\n\t}\n\telse if (curIndex >= pattern.length) {\n\t\tconsole.log(\"we did it\");\n\t\tscore++;\n\t\tuserClear();\n\t\tsimon_exec().then(() => {\n\t\t\tuser_run();\n\t\t});\n\t}\n}", "function checkAnswer() {\n $(\".option-button\").click(function() {\n value = $(this).attr(\"correct\");\n if (value === \"true\") {\n correctAnswers++\n $(\"#correct-number-element\").text(\"Correct: \" + correctAnswers);\n } else {\n incorrectAnswers++\n $(\"#correct-number-element\").text(\"Correct: \" + incorrectAnswers);\n }\n });\n}", "function checkAnswers() {\n\n}", "function checkAnswer() {\n\t\tif (answerChoice == currentQuestion.rightAnswer) {\n\t\t\t$(\"#hint\").text(currentQuestion.congratulations);\n\t\t\tcurrentQuestion.correct = true;\n\t\t\tupdateScore();\n\t\t} else {\n\t\t\tconsole.log('incorrect');\n\t\t\t$(\"#hint\").text(currentQuestion.sorry);\n\t\t};\n\t}", "function correctAnswer() {\n return $scope.answer.value === $scope.data.solution;\n }", "function checkAnswer(btnVal,question){\n disableButtons();\n if (btnVal === question.correctAns) {\n numCorrect++;\n return true;\n }\n else {\n numWrong++;\n return false;\n }\n}", "function handleAnswerClick(event){\n if (event.target.textContent===questionBank[questionNum].correctAnswer){\n description.textContent = (\"Next Question:\");\n console.log(\"Correct\");\n questionNum++\n handleNextQuestion();\n } else if ((event.target.textContent===questionBank[questionNum].correctAnswer)===false){\n description.textContent = (\"Wrong! Try again!\");\n description.setAttribute(\"style\",\"color:red\");\n console.log(\"Wrong\");\n sec = sec-5;\n }\n}", "function checkAnswer() {\n\n // if on-click is permitted, check if player selected the correct answer\n if (enabled) {\n\n // disable the checkAnswer function from running until a new question is generated\n enabled = false;\n\n // answer chosen by the player\n var playerPick = $(this).text();\n\n // stop the timer\n stopTimer();\n\n // display the correct answer and image\n displayCorrectAnswer();\n\n // player chose correct answer\n if (playerPick == currentObject.correctAnswer) {\n // display message to the player\n extraMessage.text(\"*** FANTABULOUS - You Got This!!! ***\");\n extraMessage.css(\"visibility\", \"visible\");\n\n // add 1 to # of correct answer count\n correctCount++;\n }\n\n // player chose incorrect answer\n else {\n // display message to the player\n extraMessage.text(\"*** WRONG Answer - Too Bad! Too Sad! ***\");\n extraMessage.css(\"visibility\", \"visible\");\n\n // add 1 to # of incorrect answer count\n incorrectCount++;\n }\n\n // increment questionCounter\n questionCounter++;\n\n // after 5 seconds, display a new question\n setTimeout(newQuestion, delayTime);\n }\n }", "function checkAnswer(){\n trueAnswer = returnCorrectAnswer();\n userAnswer = getInput();\n// this if statement is stating if user inputs the right answer what happens and if not what happens\n if(userAnswer === trueAnswer){\n var messageCorrect = array[global_index].messageCorrect;\n score ++;\n swal({\n title: messageCorrect,\n text: \"You got \" + score + \" out of 8 correct.\",\n });\n }\n else{\n var messageIncorrect = array[global_index].messageIncorrect;\n swal({\n title: messageIncorrect,\n text: \"You got \" + score + \" out of 8 correct.\",\n });\n }\n }", "function checkAnswer(option){\n attempt++;\n\n let optionClicked = $(option).data(\"opt\");\n\n // console.log(questions[index]);\n\n if(optionClicked==questions[index].answer){\n $(option).addClass(\"answered\");\n score++;\n }\n else{\n $(option).addClass(\"answered\");\n wrong++;\n }\n\n\n $(\".scoreBox span\").text(score);\n\n $(\".optionBox span\").attr(\"onclick\",\"\");\n\n\n}", "function checkAnswer(event) {\n // Because the event has been passed in the function, we can call the event\n // and preventDefault() behavior\n // Therefore, it will wait for a button push before executing the function\n event.preventDefault();\n\n var buttonSelected = this.id;\n console.log(buttonSelected);\n\n // variable for the correctChoice (aka, the correctAnswer from the questions object)\n var correctChoice = \"button\" + questions[currentQuestion].correctAnswer;\n\n if (buttonSelected === correctChoice) {\n console.log(\"Correct\");\n }\n else if (buttonSelected != correctChoice) {\n console.log(\"Incorrect\");\n // Subtracing 10 seconds of time from the if the answer was incorrect\n // Won't subtract lower than value of 0\n if (timeRemaining > 0) {\n if (timeRemaining - 10 <= 0) {\n return;\n }\n else {\n timeRemaining -= 10;\n }\n }\n }\n // increase the value of currentQuestion by 1\n currentQuestion++\n // Depending on the value of currentQuestion...\n // runQuiz again, which will now cycle through to the next question\n // OR\n // run the endRoutine, which will display results\n if (currentQuestion <= (questions.length - 1)) {\n runQuiz();\n }\n else if (currentQuestion > (questions.length - 1)) {\n endRoutine();\n }\n}", "function handleAnswerClick(clickedAnswer) {\n clearInterval(timer);\n blurMoviePoster(0);\n\n if (answerSelected) {\n return;\n }\n\n //the tmpMovie is always assigned a class of 'correct'\n $(\".selections\").find(`li:contains(\"${movie.title}\")`).addClass(\"correct\");\n\n if(clickedAnswer === movie.title) {\n handleCorrectAnswer();\n } else {\n handleIncorrectAnswer(clickedAnswer);\n }\n\n answerSelected = true;\n\n //as long as score is not equivalent to 10 or strikes are not equivalent to 3, button reads 'next question'\n if (strikes !== 3 && score !== 10) {\n $('#start-btn').text('NEXT QUESTION');\n }\n}", "function submitAnswer () {\n $(\".submitAnswer\").on('click',function(event){\n event.preventDefault();\n let userAnswer= $('input[name=instrument]:checked').val();\n let correctAnswer= `${STORE[questionNumber].correctAnswer}`;\n if (userAnswer === correctAnswer) {\n answerIsCorrect();\n } else if (userAnswer !== correctAnswer){\n answerIsWrong();\n }\n });\n}", "function correct() {\n event.stopPropagation()\n $ (\".list\").hide();\n $ (\".question\").hide();\n $ (\".winOrLose\").html(\"You are correct!\");\n \n correctlyAnswered++;\n console.log(correctlyAnswered);\n notAnswered--;\n console.log(notAnswered);\n \n window.setTimeout(askQuestions, 3000);\n \n}", "function second(){Quiz.addEventListener('click', function (event){\n questions1= document.getElementById(\"Questions\")\n if(questions1.textContent==questions1.getAttribute(\"data-1\")){\n tar = event.target\n state2 = tar.getAttribute(\"data-1\")\n console.log(state2)\n if(state2==\"Booleans\"){\n WrongRight.textContent=\"Correct\"\n questions1= document.getElementById(\"Questions\")\n questions1.textContent=questions1.getAttribute(\"data-2\")\n answer1.textContent=answer1.getAttribute(\"data-2\")\n answer2.textContent=answer2.getAttribute(\"data-2\")\n answer3.textContent=answer3.getAttribute(\"data-2\")\n answer4.textContent=answer4.getAttribute(\"data-2\")\n }\n else{\n secondsLeft-=10;\n WrongRight.textContent=\"Wrong\"\n questions1= document.getElementById(\"Questions\")\n questions1.textContent=questions1.getAttribute(\"data-2\")\n answer1.textContent=answer1.getAttribute(\"data-2\")\n answer2.textContent=answer2.getAttribute(\"data-2\")\n answer3.textContent=answer3.getAttribute(\"data-2\")\n answer4.textContent=answer4.getAttribute(\"data-2\")\n }\n third()\n}})}", "function handleAnswerClick() {\n $(document).on(\"click\", (e) => {\n if (e.target && e.target.id == 'answer-btn') {\n checkCorrect(e.target);\n }\n })\n}", "function checkAnswer(event) {\n\tevent.preventDefault();\n\tvar button = document.getElementById(event.target.id);\n\tvar userInitials;\n\n\tif (button.id === \"initials\") {\n\t\treturn;\n\t}\n\n\t//saves initials\n\tif (button.id === \"submitScore\") {\n\t\tuserInitials = document.getElementById(\"initials\");\n\t\tsaveScore(userInitials);\n\t\treturn;\n\t}\n\n\t//We are checking here the user answer and the correct answer and acting accordingly\n\tif (answer1.includes(questionsArray[currentQuestion].answer) && button.id === \"choice1\") {\n\t\tuserResult.textContent = \"CORRECT!\";\n\t\tcurrentQuestion++;\n\t\tpoints += 10;\n\t\tdisplayQuestion();\n\t} else if (answer2.includes(questionsArray[currentQuestion].answer) && button.id === \"choice2\") {\n\t\tuserResult.textContent = \"CORRECT!\";\n\t\tcurrentQuestion++;\n\t\tpoints += 10;\n\t\tdisplayQuestion();\n\t} else if (answer3.includes(questionsArray[currentQuestion].answer) && button.id === \"choice3\") {\n\t\tuserResult.textContent = \"CORRECT!\";\n\t\tcurrentQuestion++;\n\t\tpoints += 10;\n\t\tdisplayQuestion();\n\t} else if (answer4.includes(questionsArray[currentQuestion].answer) && button.id === \"choice4\") {\n\t\tuserResult.textContent = \"CORRECT!\";\n\t\tcurrentQuestion++;\n\t\tpoints += 10;\n\t\tdisplayQuestion();\n\t} else {\n\t\tuserResult.textContent = \"WRONG!\";\n\t\tcurrentQuestion++;\n\t\ttimeLeft -= 10;\n\t\tdisplayQuestion();\n\t}\n}", "function checkAnswer(answer){\n if( answer == questions[runningQuestion].correct){\n isCorrect();\n nextQuestion();\n } else {\n isWrong();\n nextQuestion();\n }\n}", "function answerCheck () {\n \n \n if(selectedAnswer===realAnswerArray[rightAnswerCounter]) {\n \n $(\"#showAnswer\").text(\"You Got It!!\");\n generateWin();\n \n \n } else {\n $(\"#showAnswer\").text(\"Oops!!\");\n generateLoss();\n \n }\n}", "function phaseOne() {\n\n\t\t$(\".submitBtn\").text(\"SELECT YOUR ANSWER\").removeClass(\"correct incorrect on\").off();\n\n\t\tcurrentItem = jRandom(testItem.length)\n\t\tlet item = testItem[currentItem];\n\t\t$(\".question\").text(item.question);\n\t\t$(\".answerBtn\").attr(\"value\", \"false\");\n\t\t$(\".answerBtn\")[jRandom(4)].setAttribute(\"value\", \"true\");\n\n\t\t$(\".answerBtn\").each(function() {\n\n\t\t\tif (this.value === \"true\") {\n\t\t\t\tlet x = jRandom(item.correctAnswer.length);\n\t\t\t\t$(this).text(item.correctAnswer[x]).click(sounds.right);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet x = jRandom(item.incorrectAnswers.length);\n\t\t\t\t$(this).text(item.incorrectAnswers[x]).click(sounds.wrong);\n\t\t\t\titem.incorrectAnswers.splice(x, 1);\n\t\t\t}\n\n\t\t});\n\t\t\n\t\t$(\".answerBtn\").addClass(\"active\").removeClass(\"off on correct incorrect\").click(sounds.click).click(phaseTwo);\n\n\t}", "function correctAnswerDetection(element, correct) {\n clearStatusClass(element)\n if (correct) {\n userAnswer = true\n //element.classList.add('correct')\n\n } else {\n //element.classList.add('wrong')\n userAnswer = false\n }\n}", "function responseWasCorrect(){\n\t\t\n\t\t//Set the incorrect streak counter to zero\n\t\tincorrectStreakCounter = 0;\n\t\t\n\t\t//Increment the streak counter for correct responses\n\t\tcorrectStreakCounter++;\n\t\t\n\t\t//If it reaches the down threshold, then determine the step size and reset streak counter to zero.\n\t\tif(correctStreakCounter == downThreshold){\n\t\t\t\n\t\t\t//Set the current step direction for the staircase\n\t\t\tcurrentStepDirection = \"down\"; \n\t\t\t\n\t\t\t//Use the PEST procedure to determine the step size\n\t\t\tchangeStepSizePEST();\n\t\t\t\n\t\t\t//Decrease the intensity by the step size\n\t\t\tdecreaseIntensity();\n\t\t\t\n\t\t\t//Reset the correct streak counter\n\t\t\tcorrectStreakCounter = 0;\n\t\t}\n\t\t\n\t}//End of responseWasCorrect", "function checkAnswered(question) {\n var anyAnswered = false;\n var answers = $(\"[name=\" + question.id + \"]\");\n // the for loop creates a condition to check if the buttons were checked and and then sets\n // the anyAnswered variable to true if they were\n for (var i = 0; i < answers.length; i++) {\n if (answers[i].checked) {\n anyAnswered = true;\n }\n }\n // then return the anyAnswered variable so it can be tabulated in the last function to distinguish\n // between incorrect answers and those answers that were not attempted\n return anyAnswered;\n }", "function checkAnswered(question){\n var anyAnswered = false;\n var answers = $('[name='+question.id+']');\n // the for loop creates a condition to check if the buttons were checked and and then sets\n // the anyAnswered variable to true if they were\n for (var i = 0; i < answers.length; i++) {\n if (answers[i].checked) {\n anyAnswered = true;\n }\n }\n // then return the anyAnswered variable so it can be tabulated in the last function to distinguish\n // between incorrect answers and those answers that were not attempted\n return anyAnswered;\n \n }", "function sixth(){ Quiz.addEventListener('click', function question(event){\n questions1= document.getElementById(\"Questions\")\n if(questions1.textContent==questions1.getAttribute(\"data-5\")){\n tar = event.target\n state5 = tar.getAttribute(\"data-5\")\n console.log(state5)\n if(state5==\"Terminal/Bash\"){\n WrongRight.textContent=\"Correct\"\n end=\"Stop\"\n }\n else{\n WrongRight.textContent=\"Wrong\"\n secondsLeft-=10;\n end=\"Stop\"\n }\n final()\n}})}", "function selectAnswer(e){\n var selectedAnswerButton = e.target;\n var correctAnswer = selectedAnswerButton.dataset.correct;\n console.log(correctAnswer)\n showResult (correctAnswer);\n if (shuffledQuestions.length > questionIndex + 1) {\n nextButton.classList.remove('hide');\n } \n else {\n questionContainer.classList.add('hide');\n finalPage.classList.remove('hide');\n clearInterval(timeInterval);\n userScore.textContent = secondsLeft + \"!\"\n }\n \n}", "function whenCorrect() {\n //clear container class html\n //display \"CORRECT!\"\n $(\".container\").html(\"<h2>CORRECT!<h2>\");\n //display correct answer\n displayCorrect();\n //increase score\n correct++;\n answered++;\n }", "function verify(selected, correct) {\n const answer = document.getElementById(selected);\n if (selected === correct) {\n answer.classList.remove(\"text-indigo-400\");\n answer.classList.remove(\"border-indigo-300\");\n answer.classList.remove(\"hover:bg-yellow-400\");\n answer.classList.remove(\"hover:text-white\");\n answer.classList.remove(\"hover:border-yellow-400\");\n answer.className += \" bg-green-300 text-white\";\n setTimeout(() => {\n score++;\n loadQuiz();\n }, 500);\n } else {\n answer.classList.remove(\"text-indigo-400\");\n answer.classList.remove(\"border-indigo-300\");\n answer.classList.remove(\"hover:bg-yellow-400\");\n answer.classList.remove(\"hover:text-white\");\n answer.classList.remove(\"hover:border-yellow-400\");\n answer.className += \" bg-red-600 text-white\";\n setTimeout(() => {\n loadQuiz();\n }, 500);\n }\n }", "function checkAnswer(event){\n // event.stopPropagation();\n // userChoice = event.currentTarget;\n userChoice = this.id;\n console.log(questionArray[index]);\n console.log(userChoice.textContent);\n console.log(index);\n console.log(this.id)\n \n if (\n ((index == 0) && (userChoice == \"answerButton3\")) ||\n (index == 1 && (userChoice == \"answerButton3\")) ||\n (index == 2 && (userChoice == \"answerButton4\")) ||\n (index == 3 && (userChoice == \"answerButton3\")) ||\n (index == 4 && (userChoice == \"answerButton4\"))){\n console.log(index == 0);\n console.log(index == 1);\n isCorrect = true;\n wins++;\n localStorage.setItem('wins', wins.valueOf());\n\n }\n else {\n isCorrect = false;\n counter = counter - 10;\n losses++;\n localStorage.setItem('losses', losses.valueOf());\n }\n console.log(isCorrect);\n if (index<answersArray.length){\n index++;\n \n clearPage();\n questionPage();\n }else {\n clearInterval(countDown);\n }\n \n }", "onAnswer (e, category, currentQuestion) {\n return (\n e.target.innerText === trivia[category].questions[currentQuestion].answer ? this.onCorrect() : this.onWrong()\n )\n }", "function checkAnswer () {\n console.log(userSelected.text);\n\n if (userSelected === questions[i].correctAnswer) {\n score ++;\n $(\"#score\").append(score);\n $(\"#answerCheck\").append(questions[i].rightReply);\n i++;\n } else {\n $(\"#answerCheck\").append(questions[i].wrongReply);\n i++;\n } \n }", "function checkIfAnswer(ev){\n\t\tif(document.getElementById(currentChoice).textContent == currentSet.correctChoice)\n\t\t\tallowDrop(event);\n}", "function answerCheck() {\n var questionAnswered = this.getAttribute(\"data-index\");\n console.log(this);\n if (questionAnswered != questions[trackQuestion - 1].correct) {\n timeLeft -= 10;\n ansCheck.textContent = \"Wrong!\";\n ansCheck.setAttribute(\"style\", \"display:block\");\n setTimeout(function () { ansCheck.setAttribute(\"style\", \"display:none\") }, 800);\n showQuestion();\n }\n else {\n ansCheck.textContent = \"Correct!\";\n ansCheck.setAttribute(\"style\", \"display:block\");\n setTimeout(function () { ansCheck.setAttribute(\"style\", \"display:none\") }, 800);\n showQuestion();\n }\n}", "function checkAnswer(event){\n if(event.target.id === answers[answerIndex]){\n updatedScore += 10;\n userScore.innerText = \"Score \" + updatedScore;\n feedback.innerHTML = \"Correct! 👍\";\n }\n else{\n timeLeft -= 10;\n feedback.innerHTML = \"Wrong 👎\";\n } \n questionIndex++;\n answerIndex++;\n \n proposedQuestion.innerText = questions[questionIndex].q;\n btn1.innerText = questions[questionIndex].a[0].text;\n btn2.innerText = questions[questionIndex].a[1].text;\n btn3.innerText = questions[questionIndex].a[2].text;\n btn4.innerText = questions[questionIndex].a[3].text; \n if(questionIndex === 5 || answerIndex === 5){\n questionIndex === 0;\n }\n}", "function checkAnswer() {\n var userAnswer = this.getAttribute(\"data-answer\");\n // compare with correct answer\n if (userAnswer === questionCards[currentQuestion].correctAnswer) {\n var rightSnd = new Audio(\"./audio/soundsilk-Correct-Answer.mp3\");\n rightSnd.play();\n score += 10;\n currentQuestion++;\n // call function that checks max question\n checkLastQuestion();\n // if wrong, time penalty, noise\n } else {\n var wrongSnd = new Audio(\"./audio/mixkit-wrong-answer.wav\");\n wrongSnd.play();\n userAnswer;\n timer = timer - 15;\n currentQuestion++;\n // call function that checks max question\n checkLastQuestion();\n }\n}", "function checkAnswer(answer) {\n\t\treturn answer.isCorrect;\n\t}", "function startQuiz() {\n \n $(\"#question\").text(questions[i].question)\n $(\"#a\").text(\"a: \" + questions[i].a);\n $(\"#b\").text(\"b: \" + questions[i].b);\n $(\"#c\").text(\"c: \" + questions[i].c);\n $(\"#d\").text(\"d: \" + questions[i].d);\n\n aSelected.addEventListener(\"click\", function() {\n event.stopPropagation();\n console.log(\"User answer has picked choice: a\");\n userSelected = questions[i].a\n checkAnswer();\n });\n\n bSelected.addEventListener(\"click\", function() {\n event.stopPropagation();\n console.log(\"User answer has picked choice: b\");\n userSelected = questions[i].b\n checkAnswer();\n });\n\n cSelected.addEventListener(\"click\", function() {\n event.stopPropagation();\n console.log(\"User answer has picked choice: c\");\n userSelected = questions[i].c\n checkAnswer();\n });\n\n dSelected.addEventListener(\"click\", function() {\n event.stopPropagation();\n console.log(\"User answer has picked choice: d\");\n userSelected = questions[i].d\n checkAnswer();\n });\n \n //check it see if selection was correct\n function checkAnswer () {\n console.log(userSelected.text);\n\n if (userSelected === questions[i].correctAnswer) {\n score ++;\n $(\"#score\").append(score);\n $(\"#answerCheck\").append(questions[i].rightReply);\n i++;\n } else {\n $(\"#answerCheck\").append(questions[i].wrongReply);\n i++;\n } \n }\n}", "function checkAnswer() {\n\tchoices = document.getElementsByName(\"choices\");\n\n\tfor (var i = 0, len = choices.length; i < len; i++) {\n\t\tif (choices[i].checked) {\n\t\t\tchoice = choices[i].value;\n\t\t}\n\t}\n\n\tif (choice === questions[pos][4]) {\n\t\tcorrect++;\n\t}\n\t\n\tpos++;\n\trenderQuestion();\n}", "function checkIfCorrect(answer, clicked) {\n // console.log(correctAnswer);\n answeredTimer = gameTimer;\n // console.log(answeredTimer);\n let timeToAnswer = startOfQuestionTimer - answeredTimer;\n // console.log(timeToAnswer);\n if (timeToAnswer === 0) {\n timeToAnswer = 1;\n };\n if (answer === clicked) {\n score += (5 + Math.ceil((30/timeToAnswer)));\n feedbackEl.textContent = 'Correct!';\n if (currentQuestion === questions.length) {\n window.location.href = 'endscreen.html';\n // finalscore = score;\n // console.log(finalScore);\n finalScore = parseInt(score);\n savedFinalScore = window.localStorage.setItem(\"finalscore\", JSON.stringify(finalScore)); \n }\n correctAnswer = getNextQuestion(filteredQuestions);\n startOfQuestionTimer = gameTimer;\n // listeners();\n }\n if (answer !== clicked) {\n gameTimer -= 10;\n feedbackEl.textContent = 'Incorrect!';\n if (currentQuestion === questions.length) {\n window.location.href = 'index.html';\n finalscore = parseInt(score);\n savedFinalScore = window.localStorage.setItem(\"finalscore\", JSON.stringify(finalScore)); \n }\n correctAnswer = getNextQuestion(filteredQuestions);\n startOfQuestionTimer = gameTimer;\n // listeners(correctAnswer);\n }\n }", "function checkAnswer(index) {\n console.log(\"the first button was clicked\");\n turnsTaken ++;\n if (questions[currentQuestionIndex].correct-1 === index) {\n alert('That is correct!');\n correctAnswers ++;\n questions.splice(currentQuestionIndex,1);\n nextQuestion();\n } else {\n alert(\"No, the correct answer was option \" + questions[currentQuestionIndex].correct);\n questions.splice(currentQuestionIndex,1);\n nextQuestion();\n }\n\n}", "function checkAnswer() {\n\t//answer is taken from answer field.\n\tvar answer = document.getElementById(\"answerField\");\n\t//clear canvas\n\tctx.clearRect(0,0,canvasWidth,canvasHeight);\n\t//Align text in center\n\tctx.textAlign=\"center\"; \n\t//Set font and size\n\tctx.font = \"30px Arial\";\n\t\n\t//If the solution is correct, print correct\n\tif (answer.value == solution) {\n\t\tctx.fillText(\"Correct!\",(canvasWidth / 2),(canvasHeight / 2));\n\t}\n\t//Otherwise the solution was incorrect\n\telse {\n\t\tctx.fillText(\"Incorrect!\",(canvasWidth / 2),(canvasHeight / 2));\n\t}\n\t\n\t//Sleep for one second then print a new problem.\n\tsleep(1000).then(() => {\n\t\tprintProblem(); }\n\t)\n}", "function checkAnswer(){\n\n\tchoices = document.getElementsByName(\"choices\");\n\tfor(var i=0; i<choices.length; i++){\n\t\tif(choices[i].checked){\n\t\t\tchoice = choices[i].value;\n\t\t}\n\t}\n\n\tif(choice == questions[pos][4]){\n\t\t//got the question right message\n\t\t_(\"status\").innerHTML = \"Yaay, way to go!\";\n\n\t\tcorrect++;\n\n\t} else {\n\n\t\t_(\"status\").innerHTML = \"You got it wrong, buddy!\";\n\t\t//got the question wrong message\n\t};\n\n\tpos++;\n\trenderQuestion();\n}", "function onClickAnswer(userAnswer) {\n if (formData[`answer${taskStep}`] === userAnswer) {\n setAnswerState('correct');\n setScore(score + 1);\n setTotalPossibleScore(totalPossibleScore + 1);\n } else {\n setAnswerState('incorrect');\n setTotalPossibleScore(totalPossibleScore + 1);\n }\n }", "function selectAnswer(e) {\n var selectedBtn = e.target;\n correct = selectedBtn.dataset.correct;\n if (correct) {\n console.log(\"correct\");\n } else {\n console.log('wrongo');\n startTime -= 10;\n };\n if (startTime <= 0) {\n secondsLeft = 0;\n timerEl.innerText = '0';\n endGame();\n } else {\n currentQuestionIndex++;\n if (currentQuestionIndex == questions.length) {\n endGame();\n } else {\n setNextQuestion();\n };\n };\n}", "function feedbackForAnswer(answer) {\n var curvature = TreeConstructor.root.curvature;\n var suffix = \". \" + CONTINUE_BUTTON;\n if (curvature == answer) {\n var message = \"The expression is \" + \n CURVATURE_DISPLAY_NAME[curvature] + suffix;\n $(TreeConstants.ERROR_DIV).html('<div class=\"alert alert-success\">' +\n '<span><strong>Correct!</strong> ' + message + '</span></div>')\n } else {\n var message = \"The expression is \" + CURVATURE_DISPLAY_NAME[curvature] + \n \", but you answered \" + CURVATURE_DISPLAY_NAME[answer] +\n suffix;\n $(TreeConstants.ERROR_DIV).html('<div class=\"alert alert-error\">' +\n '<span><strong>Incorrect!</strong> ' + message + '</span></div>')\n }\n // Increase/decrease difficulty\n updateLevel(curvature == answer);\n // Listen to new expression button.\n $(\"#newExpression\").click(loadNewExpression);\n }", "function evaluate() {\n if (this.value == quizQuestions[q].correctAnswer) {\n $(\"#result\").html(\"Correct! Yes, nice work!\");\n correct++;\n } else {\n $(\"#result\").html(\"Nope, incorrect\");\n timeRemaining -= 5;\n }\n\n for (i = 0; i < 4; i++) {\n $(\"#answer-\" + i).off(\"click\"); // remove the event-handler that allows them to be clicked\n if (i != quizQuestions[q].correctAnswer) {\n $(\"#answer-\" + i).addClass(\"wrong\"); // add a strike-through for the wrong options\n }\n }\n\n $(\"#result\").show();\n nextQuestion();\n}", "function checkAnswer(){\n\tvar a = $( \"input:checked\" ).val();\n\tif (a == questions[questionCount].correctAnswer) {\n\t\t$( \"#answerText\" ).text(questions[questionCount].answerText);\n\t\tmeterFiller++;\n\t\t$('#sumbitButton').hide();\n\t\t$(\"button#nextButton\").show();\n\t} else {\n\t\t$('#answerText').text(\"Wrong!\");\n\t\t$('#sumbitButton').hide();\n\t\t$(\"button#nextButton\").show();\t\t\n\t};\n}", "function checkAnswer(selected){\n let rightAnswer = questionsArray[questionCounter].correctAnswer;\n \n if(selected === rightAnswer){\n score++;\n displayPopup(true, rightAnswer);\n } \n else{\n displayPopup(false, rightAnswer);\n }\n}", "function selectAnswer(e){\n var selectedButton = e.target\n var correct = selectedButton.dataset.correct;\n setStatusClass(document.body,correct);\n Array.from(answerBtns.children).forEach(button =>{\n setStatusClass(button, button.dataset.correct);\n });\n if (selectedButton=!correct){\n timerDeduct();\n wrongAnswerSound.play();\n } else {\n rightAnswerSound.play();\n };\n if (questionIndex+1<questions.length){\n questionIndex++;\n setTimeout(showQuestion, 650);\n } else {\n inProgress= false;\n gameOver();\n \n };\n \n \n}", "function answerClicked(event) {\n if (currentIndex === questions.length -1){\n console.log(\"ALL DONE!\")\n quizFinished = true;\n highScoreForm()\n }\n else if (event.target.textContent !== questions[currentIndex].correctAnswer) {\n console.log(\"Wrong!\")\n timeLeft = timeLeft - 10;\n timerElement.textContent = timeLeft;\n currentIndex++;\n showQuizQuestion()\n }\n else if (event.target.textContent === questions[currentIndex].correctAnswer) {\n console.log(\"Correct!\")\n currentIndex++;\n showQuizQuestion()\n }\n\n}", "function checkAnswer() {\n //console.log('Answer is being checked')\n const currentAnswer = $( \"input:checked\" ).val();\n const correctAnswerText = getCorrectAnswer();\n \n if (currentAnswer === correctAnswerText) {\n STORE.currentAnswer = 'correctAnswer';\n updateUserScore();\n } else {\n STORE.currentAnswer = 'wrongAnswer';\n } \n}", "function verify(e){\n var target = e.target;\n \n if (target.className === \"button\"){\n var id = parseInt(target.getAttribute(\"id\"))\n console.log(target);\n \n if (id === questions[page].a) {\n console.log('correct')\n }else if (id != questions[page].a) {\n //if wrong subtract 5 secs from clock\n secondsLeft = secondsLeft - 5;\n timer.textContent = secondsLeft\n } else {\n return\n }\n }page++;\n \n // game end when questions finished or timer reaches 0\n if (page === questions.length || secondsLeft <= 0 ){\n gameOver();\n }else{\n answer.textContent = \" \"\n //Next Question\n slides(); \n\n }}", "function checkAnswer() {\n if (userAnswer === currentQuestion.correctAnswer) {\n // add to the number of correct answers\n points++;\n\n // color the answers green\n answerContainers[questionNumber].style.color = \"darkgreen\";\n }\n // if answer is wrong or blank\n else {\n // color the answers red\n answerContainers[questionNumber].style.color = \"red\";\n }\n }", "function ansClick(e) {\n if(qIndex >= (questions.length - 1)) {\n postScore();\n } else {\n var currentQuestion = questions[qIndex];\n var ansClick = e.target.textContent;\n if(ansClick.toLowerCase() === currentQuestion.answer.toLowerCase()) {\n currentScore+= 5;\n } else {\n time -= 10;\n currentScore -= 5;\n }\n qIndex++;\n getQuestion();\n };\n}", "function selectanswer(event){\n\n var selectedanswer = event.target;\n if(selectedanswer.dataset.correct)\n {\n score = score + 10; //Add 10 point whenever answer is correct\n checkanswer(\"Correct\"); \n \n }else\n {\n checkanswer(\"Wrong\"); \n secondsLeft = secondsLeft - 10; //Reduce 10s from timer if answer is wrong\n }\n\n questionindex++;\n setnextquestion();\n\n\n}", "function isCorrect(questionNum, results) {\n\t$('.ans_button').click(function() {\n\t\tif ($(this).attr('id') == `${QUESTIONS[questionNum].correctAnswer}`) {\n\t\t\treturn [$(this).addClass('correct'), $('.js-is_correct').html(`<p>Correct!</p>`), $('.ans_button').prop('disabled', true), results++, handleNextButtonClicked(questionNum, results)];\n\t\t} \n\t\treturn [$(this).addClass('incorrect'), $('.js-is_not_correct').html(`<p>Incorrect!</p>`), $('.ans_button').prop('disabled', true), handleNextButtonClicked(questionNum, results)];\n\t});\n}", "function displayAnswerEvaluation(p_totalCorrect, p_totalIncorrect){\n\t // see if correct....\n\t var tTotalCorrect = p_totalCorrect;\n\t\t var tTotalIncorrect = p_totalIncorrect;\n\t\t \n\t\t // catch if this is the last attempt\n\t\t var tLastAttempt = false;\n\t\t if (_currVars.myVars.attemptsAllowed === 0){\n\t\t\tvar tLastAttempt = true;\n\t\t }\n\t\t\n\t\t // ANSWER IS CORRECT\n\t\t if ((tTotalCorrect === _currVars.myVars.correctAnswerCount) && (tTotalIncorrect === 0) ){\n\t\t\t\n\t\t\tconsole.log(\"correct -- feedback_correct_vo_1 or feedback_correct_vo_2\");\n\t\t\t\n\t\t\t//_currVars.myVars.checkbuttonstates.\n\t\t _currVars.myVars.checkbuttonstates.currState =\t_currVars.myVars.checkbuttonstates.COMPLETED_CORRECT;\n\t\t _myDispatcher.setCheckButtonToCorrect();\n\t\t\n\t\t _currVars.myVars.allowCheckbuttonInteraction = false;\n\t\t\n\t\t sendState();\n\t\t\n\t\t turnAllClickHandlersOff();\n\n\t\t playFeedBack(\"feedback_correct\",\"getsoundcallback\",tLastAttempt );\n\t\t \n\t\t\t\n\t\t } else if (_currVars.myVars.attemptsAllowed === 1000){\n\t\t\t/* FEEDBACK_LAST_ATTEMPT ************************************************************************ REPLACE THIS */\n\t\t\t// REMOVE THIS AREA\n\t\t\t//console.log(\"game over- incorrect - see you teacher -- feedback_last_attempt\");\n\t\t\t\n\t\t\t//_myDispatcher.setCheckButtonToIncorrect();\n\t\t\t//_currVars.myVars.checkbuttonstates.currState =\t_currVars.myVars.checkbuttonstates.COMPLETED_INCORRECT;\n\t\t\t//turnAllClickHandlersOff();\n\n\t\t\t//playFeedBack(\"feedback_last_attempt\",\"getsoundcallback\");\n\t\t\t\n\t\t\t\n\t\t } else if (_currVars.myVars.feedbackSetup === \"single\" ){\n\n\t\t //console.log(\"that is not correct - feedback_incorrect\");\n\n\t\t\tif (tLastAttempt === true){\n\t\t\t\tsetScreenToIncorrect()\n\t\t\t\tplayFeedBack(\"feedback_incorrect\",\"getsoundcallback\",tLastAttempt);\n\t\t\t\t\t} else{\n\t\t\t\t_currVars.myVars.setButtonToActiveAfterFeedback = true;\n\t\t\t\tsendState();\n\t\t\t\tplayFeedBack(\"feedback_incorrect\",\"getsoundcallback\",tLastAttempt);\n\t\t\t\n\t\t\t}\n\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t } else if ((tTotalCorrect < _currVars.myVars.correctAnswerCount)&& ( tTotalIncorrect === 0)){\n\n\t\t\tconsole.log(\"you need to choose more answers -- feedback_not_all_correct\");\n\n\t\t\tif (tLastAttempt === true){\n\t\t\t\tsetScreenToIncorrect()\n\t\t\t\tplayFeedBack(\"feedback_not_all_correct\",\"getsoundcallback\",tLastAttempt);\n\t\t\t\t\t} else{\n\t\t\t\t_currVars.myVars.setButtonToActiveAfterFeedback = true;\n\t\t\t\tsendState();\n\t\t\t\tplayFeedBack(\"feedback_not_all_correct\",\"getsoundcallback\",tLastAttempt);\n\t\t\t\n\t\t\t}\n\t\t\t\n\t } else if(tTotalIncorrect === 1){\n\n\t\t console.log(\"one of your answers is incorrect - feedback_one_wrong\");\n\n\t\t if (tLastAttempt === true){\n\t\t\t\tsetScreenToIncorrect()\n\t\t\t\tplayFeedBack(\"feedback_one_wrong\",\"getsoundcallback\",tLastAttempt);\n\t\t\t\t\t} else{\n\t\t\t\t_currVars.myVars.setButtonToActiveAfterFeedback = true;\n\t\t\t\tsendState();\n\t\t\t\tplayFeedBack(\"feedback_one_wrong\",\"getsoundcallback\",tLastAttempt);\n\t\t\t\n\t\t\t}\n\n\t\t\n\t } else if(tTotalIncorrect < (tTotalIncorrect + tTotalCorrect) ){\n\n\t\t\tconsole.log(\"some of your answers are incorrect -- feedback_some_wrong\");\n\n\t\t\tif (tLastAttempt === true){\n\t\t\t\tsetScreenToIncorrect()\n\t\t\t\tplayFeedBack(\"feedback_some_wrong\",\"getsoundcallback\",tLastAttempt);\n\t\t\t\t\t} else{\n\t\t\t\t_currVars.myVars.setButtonToActiveAfterFeedback = true;\n\t\t\t\tsendState();\n\t\t\t\tplayFeedBack(\"feedback_some_wrong\",\"getsoundcallback\",tLastAttempt);\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t } else{\n\n\t\t if (tLastAttempt === true){\n\t\t\t\tsetScreenToIncorrect()\n\t\t\t\tplayFeedBack(\"feedback_all_wrong\",\"getsoundcallback\",tLastAttempt);\n\t\t\t\t\t} else{\n\t\t\t\t_currVars.myVars.setButtonToActiveAfterFeedback = true;\n\t\t\t\tsendState();\n\t\t\t\tplayFeedBack(\"feedback_all_wrong\",\"getsoundcallback\",tLastAttempt);\n\t\t\t}\n\t\t\n\t }\t \t\t\n }", "function fourth() {Quiz.addEventListener('click', function question(event){\n tar = event.target\n questions1= document.getElementById(\"Questions\")\n if(questions1.textContent==questions1.getAttribute(\"data-3\")){\n state4 = tar.getAttribute(\"data-3\")\n console.log(state4)\n if(state4==\"All of the above\"){\n WrongRight.textContent=\"Correct\"\n questions1= document.getElementById(\"Questions\")\n questions1.textContent=questions1.getAttribute(\"data-4\")\n answer1.textContent=answer1.getAttribute(\"data-4\")\n answer2.textContent=answer2.getAttribute(\"data-4\")\n answer3.textContent=answer3.getAttribute(\"data-4\")\n answer4.textContent=answer4.getAttribute(\"data-4\")\n }\n else{\n WrongRight.textContent=\"Wrong\"\n secondsLeft-=10;\n questions1= document.getElementById(\"Questions\")\n questions1.textContent=questions1.getAttribute(\"data-4\")\n answer1.textContent=answer1.getAttribute(\"data-4\")\n answer2.textContent=answer2.getAttribute(\"data-4\")\n answer3.textContent=answer3.getAttribute(\"data-4\")\n answer4.textContent=answer4.getAttribute(\"data-4\")\n }\n fifth()\n}})}", "function checkAnswer(ev) {\n let currentAnswer = ev.currentTarget.getAttribute('data-answer');\n // Store what answer the user chose in an array\n userAnswers.push(currentAnswer);\n // If the chosen answer is correct increase the score\n if(questionList[questionIndex].answer === currentAnswer) {\n score++;\n }\n // Raise questionIndex if it's not already the last question, if thats the case show the score\n if(questionIndex < questionList.length - 1) {\n questionIndex++;\n clearInterval(questionTimer);\n displayNewQuestion(questionIndex);\n } else {\n clearInterval(questionTimer);\n showResults();\n }\n}", "function processAnswer(finalTestData) {\n\tlet userAnswer = editor.getValue();\n\tlet finalTest = finalTestData.data.attributes.finalText;\n\n\tcheckAnswer(userAnswer, finalTest);\n}", "function generateFeedback () {\n let chosen = $('input:checked').val();\n let correct = STORE[questionNum-1]['correctIndex'];\n let response = STORE[questionNum-1]['correctExplanation'];\n $('span.js-correct-answer').text(response);\n if (chosen == correct) {\n updateScore();\n $('.incorrect').addClass('js-hide');\n } else {\n $('.correct').addClass('js-hide');\n };\n}", "function continueReponse() {\n // Check if the answer text says 'CORRECT' to determine the next step.\n if (dataContainers.answer.innerText == \"CORRECT\") {\n getStat(); \n }\n else {\n saveScore();\n window.location.href = \"/gameover.html\";\n }\n}", "function selectAnswer (e) {\n var selectedButton = e.target\n var correct = selectedButton.dataset.correct\n setStatusClass(document.body, correct)\n Array.from(answerButtonsElement.children).forEach(button => {\n setStatusClass(button, button.dataset.correct)\n })\n if(shuffledQuestions.length > currentQuestionIndex + 1) {\n nextButton.classList.remove('hide')\n } else {\n startButton.innerText = \"Great Job!\"\n startButton.classList.remove('hide')\n }\n if(selectedButton.dataset = correct) {\n score++;\n }\n document.getElementById(\"score\").innerHTML = score;\n \n}", "function guess() {\n\t\tvar guessClick = $(this).text();\n\t\t// console.log(guessClick + \" was clicked\");\n\n\t\tif (guessClick === correctAnswer) {\n\t\t\tcorrectGuess();\n\t\t} else {\n\t\t\tincorrectGuess();\n\t\t}\n\t}", "function checkAnswer(currentQuestionIndex, buttonID) { \n var isCorrect = (questionSample[currentQuestionIndex].choices[buttonID] === \n questionSample[currentQuestionIndex].answer);\n\n var feedbackEl = document.createElement(\"div\");\n var feedbackReponseEl = document.createElement(\"p\");\n feedbackEl.setAttribute(\"class\", \"feedback\");\n\n feedbackEl.appendChild(feedbackReponseEl);\n mainContent.appendChild(feedbackEl);\n \n if (isCorrect) {\n feedbackReponseEl.textContent = \"Correct!\";\n }\n // Time penalty of -15s when wrong answer is clicked\n else {\n feedbackReponseEl.textContent = \"Wrong!\";\n if (timer <= 15) {\n timer = 0;\n }\n else {\n timer = timer-15;\n }\n }\n\n // Show feedback for 0.5s\n setTimeout(function() {\n mainContent.removeChild(feedbackEl);\n }, 500);\n}", "function reviewBeforeProceeding(clickedAnswer, bad=0){\n\tclearInterval(questionTimer);\n\tif(clickedAnswer==1){\n\t\tif(bad==0){ document.getElementById(\"QuizButton1\").style = 'pointer-events:none;background:#00AF11;color:white;border:4px #00AF11af solid;'; }\n\t\telse{ document.getElementById(\"QuizButton1\").style = 'pointer-events:none;background:#D30000;color:white;border:4px #D30000af solid;'; }\n\t\tdocument.getElementById(\"QuizButton2\").style = 'display:none;';\n\t\tdocument.getElementById(\"QuizButton3\").style = 'display:none';\n\t\tdocument.getElementById(\"QuizButton4\").style = 'display:none';\n\t}\n\tif(clickedAnswer==2){\n\t\tdocument.getElementById(\"QuizButton1\").style = 'display:none';\n\t\tif(bad==0){ document.getElementById(\"QuizButton2\").style = 'pointer-events:none;background:#00AF11;color:white;border:4px #00AF11af solid;'; }\n\t\telse{ document.getElementById(\"QuizButton2\").style = 'pointer-events:none;background:#D30000;color:white;border:4px #D30000af solid;'; }\n\t\tdocument.getElementById(\"QuizButton3\").style = 'display:none';\n\t\tdocument.getElementById(\"QuizButton4\").style = 'display:none';\n\t}\n\tif(clickedAnswer==3){\n\t\tdocument.getElementById(\"QuizButton2\").style = 'display:none';\n\t\tdocument.getElementById(\"QuizButton1\").style = 'display:none';\n\t\tif(bad==0){ document.getElementById(\"QuizButton3\").style = 'pointer-events:none;background:#00AF11;color:white;border:4px #00AF11af solid;'; }\n\t\telse{ document.getElementById(\"QuizButton3\").style = 'pointer-events:none;background:#D30000;color:white;border:4px #D30000af solid;'; }\n\t\tdocument.getElementById(\"QuizButton4\").style = 'display:none';\n\t}\n\tif(clickedAnswer==4){\n\t\tdocument.getElementById(\"QuizButton2\").style = 'display:none';\n\t\tdocument.getElementById(\"QuizButton3\").style = 'display:none';\n\t\tdocument.getElementById(\"QuizButton1\").style = 'display:none';\n\t\tif(bad==0){ document.getElementById(\"QuizButton4\").style = 'pointer-events:none;background:#00AF11;color:white;border:4px #00AF11af solid;'; }\n\t\telse{ document.getElementById(\"QuizButton4\").style = 'pointer-events:none;background:#D30000;color:white;border:4px #D30000af solid;'; }\n\t}\n\tdocument.getElementById(\"QuizButtonNext\").style = '';\n\t\n\t/* Stop preloading when we hit question 34 for extended mode */\n\tif(currentQuestion < 33 && triviamode == 1){\n\t\t/* Preload the next image. */\n\t\tif(questions[currentQuestion+2].Image && questions[currentQuestion+2].Image != \"none\"){\n\t\t\tnew Image().src = questions[currentQuestion+2].Image;\n\t\t}\n\t}\n\t\t\n\t/* Stop preloading when we hit question 19 for normal mode */\n\tif(currentQuestion < 18 && triviamode == 0){\n\t\tif(questions[currentQuestion+2].Image && questions[currentQuestion+2].Image != \"none\"){\n\t\t\tnew Image().src = questions[currentQuestion+2].Image;\n\t\t}\n\t}\n}", "function evaluateAnswer(userAnswer, correctAnswer){\n console.log('evaluating answer');\n if(userAnswer === correctAnswer){\n return true;\n }else {\n return false;\n } \n}", "function checkAnswers(e) {\n\n var selectedAnswerButton = e.target;\n\n if (selectedAnswerButton.value === 'true') {\n // Add/Remove Classes\n answerResult.classList.remove('hide');\n answerResult.classList.add('h4');\n\n // Increment numberCorrect\n numberCorrect += 1;\n\n // Show selected answer result\n answerResult.innerText = 'Correct!';\n displayTimer(answerResult, 1);\n\n nextQuestion();\n getQuestion();\n } else {\n // Add/Remove Classes\n answerResult.classList.remove('hide');\n answerResult.classList.add('h4');\n\n // subtract 10 seconds from quiz timer for wrong answer\n quizTimerLength -= 10;\n\n // Show selected answer result\n answerResult.innerText = 'Wrong! You Lose 10 seconds';\n displayTimer(answerResult, 1);\n nextQuestion();\n getQuestion();\n }\n}", "function handleClick(event) {\n console.log('Current: ', c)\n console.log(cardContent[1].answer)\n\n var grade = document.getElementById(\"question-grade\");\n var targetClick = event.target.textContent;\n console.log(targetClick);\n\n if (targetClick !== cardContent[c].answer) {\n document.getElementById('question-grade').classList.add('alert-danger')\n grade.textContent = \"Incorrect.\";\n seconds -= 10;\n goToNext();\n } else if (targetClick == cardContent[c].answer) {\n document.getElementById('question-grade').classList.add('alert-success')\n grade.textContent = \"Correct.\";\n score += 100;\n goToNext();\n };\n}", "function update_question_result(correct) {\n if (correct === true) {\n question_result.innerText = \"Success!\"\n } else {\n question_result.innerText = \"Wrong!\"\n }\n}", "function checkAnswer(answer) {\n event.preventDefault();\n if (answer === rightAnswer) {\n correctAnswerFn('WIN')\n\n } else {\n incorrectAnswerFn('LOSE')\n }\n if (fifty === \"FIFTY\") {\n fiftyLine('USEDFIFTY')\n }\n }", "function checkAnswerValid() {\n\tlet answerIndex = $('input[name=answer]:checked').val()\n\tlet answerNotSelected = !answerIndex\n\n\tif (answerNotSelected) {\n\t\talert('Whoever didnt pick an answer...ya moms a h0e')\n\t} else {\n\t\tlet answer =\n\t\t\tQUESTIONS[currentQuestionIndex].answers[\n\t\t\t\tNumber($('input[name=answer]:checked').val())\n\t\t\t]\n\n\t\tupdateForm({ answer, answerIndex })\n\n\t\t// increment correct / incorrect count\n\t\tanswer.correct ? numCorrect++ : numIncorrect++\n\t\tupdateCorrectIncorrect()\n\t}\n}", "function checkAnswer() {\n let userAnswer = document.getElementsByName('ans');\n let cAns;\n for (i = 0; i < userAnswer.length; i++) {\n if (userAnswer[i].checked) {\n cAns = userAnswer[i].value;\n }\n }\n if (cAns == correct[qtrack]) {\n score++;\n wright.push(qtrack);\n }\n else wrong.push(qtrack);\n}", "function checkQuestion() {\n\n var selected = $(\"#sol:checked\");\n\n //Was answer right?\n if (selected.val())\n {\n //TODO: Have two button-process for correct answer choice\n $.ajax({\n type: \"POST\",\n url: handlerUrl,\n data: JSON.stringify({\"question\": \"correct\", \"flag\": flag}),\n success: updateQuestion\n });\n }\n else\n {\n flag = \"true\";\n //TODO: style for the shaking button\n alert('incorrect answer');\n }\n }", "function questionHandler() {\n clearInterval(interval);\n questionChecker();\n console.log(unansweredQuestions)\n console.log(correctAnswers)\n console.log(incorrectAnswers)\n \n if (gameStart === false) {\n return false;\n }\n \n let answerIndex = parseInt($(this).attr(\"value\"));\n \n \n if (answerIndex === triviaQuestions[theQuestion].theAnswer) {\n \n correctAnswers++;\n cutePopUp();\n \n } else {\n \n incorrectAnswers++; \n uglyPopUp();\n \n }\n }", "function check_response2(name){\n\n\t// Current question \n\tlet curr_question = question_answer[name][1];\n\n\t// Selected answer for the current question\n let curr_question_val = document.querySelector('input[name=\"'+curr_question+'\"]:checked');\n\n // Get Question mark image i.e tick and cancel images respectively\n let Q_img = document.querySelector(\"#\"+name+ \" img\");\n\n // alert(curr_question);\n // Check if the question has been anwered\n if (curr_question_val == null){\n alert(\"Fucking😒😒 answer all questions Idiot\");\n return;\n }\n\n // Check if the answer is correct.\n else if(curr_question_val.value === question_answer[name][0]){\n generate_correct(name);\n Q_img.src = \"Images/tick.png\";\n correct_ans++;\n }\n\n // Check if the answer is incorrect and display the neccesary feedback.\n else if(curr_question_val.value !== question_answer[name][0]){\n generate_wrong(name, question_answer);\n }\n\n // Increase the number of questions answered\n Q_2_ans++;\n\n // Display the question tick\n Q_img.style.display = \"block\";\n\n // Disable the submit button\n document.querySelector(\"#\" + name + \" .button2\").disabled = true;\n document.querySelector(\"#\" + name + \" .button2\").style.backgroundColor = \"#c7c7c7\";\n\n // Display the result tab if all questions have been answered.\n if (Q_2_ans === 6) {\n \tdisplay_result(correct_ans);\n }\n}", "function answer() {\n let parentSection = this.parentElement.parentElement;\n if (this.textContent === \"Go back to Menu\") {\n backToMenu();\n } else if (this.textContent === \"Play Again\") {\n playAgain(parentSection);\n } else {\n let correct = false;\n let noteTag = gen(\"p\");\n for (let i = 0; i < CORRECT_ANSWER.length; i++) {\n if (CORRECT_ANSWER[i] === this.textContent) {\n noteTag.textContent = \"Correct !\";\n noteTag.classList.add(\"correct\");\n parentSection.appendChild(noteTag);\n correct = true;\n }\n }\n if (!correct) {\n noteTag.textContent = \"Wrong !\";\n noteTag.classList.add(\"wrong\");\n parentSection.appendChild(noteTag);\n }\n setTimeout(() => nextQuestion(parentSection), WAITING_TIME);\n }\n }", "function answerClick(evt){\n if (evt.target.className == 'question' || \n evt.target.tagName == 'SECTION' ||\n evt.target.textContent == \"\" ||\n playerLost) {return;}\n pickedAnswer = evt.target.className;\n render();\n setTimeout(checkAnswer, 1500);\n}", "function checkanswer(){\r\n if (userClickedPattern[currentspot]===gamePattern[currentspot])\r\n {\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n}", "function showQuestion(question) { \n questionElement.innerText = question.question;\n // Depending on whether the answer is right/wrong, we give it an equivalent dataset value. Which we later can use to check\n // if the question are right or wrong when the user click on a answer. \n for (let x = 0; x < 4; x++) {\n if (question.answers[x].correct) {\n answerButtons[x].innerHTML = \"<i class='fas fa-check-circle'></i>\" + \"<span>\" + question.answers[x].text + \"</span>\";\n answerButtons[x].dataset.correct = question.answers[x].correct;\n quiz.nrCorrectsInQuestion += 1;\n }else{\n answerButtons[x].innerHTML = \"<i class='fas fa-times-circle'></i>\" + \"<span>\" + question.answers[x].text + \"</span>\";\n }\n answerButtons[x].addEventListener('click', selectAnswer);\n }\n document.getElementById(\"nrOfAnswers\").innerHTML = \"Pick \" + quiz.nrCorrectsInQuestion + \" answer\";\n}", "function checkAnswer() {\n const answer = currentUserAnswer(); // answerVal.value\n if (answer.toLowerCase() !== null && answer.toLowerCase() === newArrayQuestions[index].answer) {\n userPuntos(index, 1, 1);\n changeCorrectAnswerLetterColor();\n if (soundToggleChekbox) {\n playCorrectAnswerSound();\n }\n } else {\n userPuntos(index, 0, 1);\n changeIncorrectAnswerLetterColor();\n if (soundToggleChekbox) {\n playNoCorrectAnswerSound();\n }\n }\n showScores();\n checkArrayQuestionsForFin();\n if (rankingTable.classList.contains(\"hideElement\")) { // If the game has not been stopped\n updateLetter();\n updateAnswer(); // answerVal.value = ''\n changeActivLetterColor();\n showNextQuestion();\n }\n}" ]
[ "0.7579413", "0.7311059", "0.72258425", "0.72008383", "0.71359575", "0.7104971", "0.70324665", "0.69513124", "0.6915632", "0.68759054", "0.6873346", "0.6834623", "0.6831694", "0.6822777", "0.68135947", "0.6807325", "0.6763811", "0.6736996", "0.6652514", "0.6600428", "0.6582868", "0.65738994", "0.6571092", "0.6507251", "0.6493351", "0.64826953", "0.6469292", "0.64679235", "0.6450074", "0.6429367", "0.64192176", "0.64151406", "0.63920075", "0.63774556", "0.63750136", "0.63748527", "0.6364901", "0.63643795", "0.6359672", "0.63548815", "0.63338464", "0.63305247", "0.63261807", "0.6317248", "0.63163286", "0.631541", "0.6315319", "0.63010657", "0.6300755", "0.62975", "0.62936556", "0.62879497", "0.62845296", "0.6280753", "0.62799484", "0.6274532", "0.62691516", "0.6268401", "0.6264033", "0.6263587", "0.6257865", "0.6255747", "0.62557185", "0.625005", "0.623976", "0.6239232", "0.6238432", "0.62357354", "0.623438", "0.6233794", "0.6232411", "0.6231866", "0.6231856", "0.6231077", "0.6229852", "0.62285805", "0.6227314", "0.62269413", "0.62188435", "0.62180215", "0.6214807", "0.62121063", "0.62117046", "0.6211254", "0.62099683", "0.6208375", "0.62074405", "0.6203914", "0.62020963", "0.62016815", "0.6199273", "0.6199013", "0.6192806", "0.6192531", "0.61795413", "0.6176987", "0.6171593", "0.6170291", "0.6168741", "0.61681813", "0.6167796" ]
0.0
-1
Enter Score that starts the ending screen
function enterScore () { questionContainerEl.classList.add("hide"); enterScoreEL.classList.remove("hide2"); clearInterval(startTime); if (secondsLeft < 0) { secondsLeft = 0 } finalScoreEL.textContent = "Your final score is " + secondsLeft; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "end(score=0) {\r\n this._mainTheme.pause();\r\n\twindow.cancelAnimationFrame(this.animationFrame);\r\n\r\n\tthis.offsetY = 0;\r\n\tthis._mode = \"failed\";\r\n\tcont.innerHTML = `<div class=\"loose_screen\">\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\tYOU LOSE\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\tYour score : ${score}\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t<button class=\"restart_button button gradient_button_2 primary\" id=\"restart_btn\" tabindex=1 autofocus>Restart</button>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>`;\r\n\tthis.cont.querySelector(\"#restart_btn\").addEventListener(\"click\", () => {\r\n\t this.start();\r\n\t});\r\n }", "function endGame() {\n // Overlay\n // Show score\n // Show table \n // Give user chance to restart\n // TODO: add high score to renderGUI\n\n uploadScore(score);\n score = 0;\n}", "Start(){\n this.currentScore = 0;\n }", "function updateScore()\n{\n \n score += 1\n treasureScoreText.text = \"Treasures: \" + gameScore;\n\n if(score == 3)\n {\n stage = END_SCREEN;\n cheerSound.play();\n endGame();\n }\n \n}", "function endGame(score) { // import score from game\n // bug/feature when player clicks end game from game window; gameover doesn't get the score\n // EITHER REMOVE THE QUIT GAME BUTTON FROM GAME WINDOW OR MAKE IT AN ACTUAL FEATURE\n removeScreen();\n createGameOver(gameOverStr, score);\n //console.log(`I got the score: -- ${score} pts -- from game obj, hopefully`)\n // display hiscores at some point in life\n}", "function start() {\n counter = 0;\n $('#totalScore').text(counter);\n }", "function endScreen() {\n leaderboardScreen.style.display = 'none';\n homeScreen.style.display = 'none';\n endQuiz.style.display = 'flex';\n quizPrompts.style.display = 'none';\n timer.style.visibility = 'hidden';\n\n yourScore()\n}", "function scoreIncrease() {\r\n score += 1;\r\n // When player wins the game\r\n if (score == 10000) {\r\n completedScreen();\r\n }\r\n}", "function startGame() {\n hideStart();\n hideSaveScoreForm();\n resetFinalScore();\n clearCurrentQuestion();\n resetUserScore();\n displayCurrentQuestion();\n startTimer();\n}", "function startGame(){\n scoreboard.textContent=0;\n timeUp=false;\n score=0;\n peep();\n// set a timeout so that the game ends in 10s\n setTimeout(()=>{\n timeUp=true;\n },10000);\n}", "function endGame() {\n fill(start.color.c,start.color.saturation, start.color.brightness);\n stroke(start.color.c,start.color.saturation,start.color.brightness);\n if(score.score1 == score.limit) {\n start.color.c+=2;\n textSize(70);\n background(colours.background);\n text(\"Player 1 Wins!\", start.textX, start.textY);\n movementMoveX = 0;\n movementMoveY = 0;\n }\n if(score.score2 == score.limit) {\n start.color.c+=2;\n textSize(70);\n background(colours.background);\n text(\"Player 2 Wins\", start.textX, start.textY);\n movementMoveX = 0;\n movementMoveY = 0;\n }\n if(start.color.c > 360) start.color.c = 0\n }", "function end() {\n result.innerHTML = \"you got a score of \" + score;\n saveInitials.style.visibility = \"visible\";\n clock.innerHTML = \"\";\n form1.style.visibility = \"hidden\";\n clearTimer();\n}", "function StartNewGame()\n{\n\tplayerOneScore = 0;\n\tplayerTwoScore = 0;\n\tUpdateScoreText ();\n\tendGameScreen.SetActive (false);\n\tgameBall.Reset ();\n}", "function scoreIncrease() {\n score += 1;\n // When player wins the game\n if (score == 10000) {\n completedScreen();\n }\n}", "function gameEnded(){\n textAlign(CENTER);\n fill (0);\n textSize(50);\n text (\"Game Over!!\", x, y);\n text (\"SCORE = \" + score, x, y + 70);\n textSize(45);\n fill(255);\n text (\"Click on the 'start button' to go back to the menu page\", x , y + 185);\n }", "function gameEnd(){\n\t\tconsole.log(\"gameend FN works!\")\n\t\t$(\".triviascreen\").hide();\n\t\t$(\".scorescreen\").show();\n\t// RESULTS - Score is displayed with no.Correct && no.Incorrect && no.Unanswered\n\t$(\".correctcount\").html(\"Correct: \" + $correctCount);\n\t$(\".incorrectcount\").append(\"Incorrect: \" + $incorrectCount);\n\t$(\".blankcount\").append(\"Unanswered: \" + $blankCount);\n}", "function endGame (){\n qScreen.style.display = \"none\";\n fScreen.style.display = \"block\";\n clearInterval(timerInterval);\n finalScore.textContent = \"Your final score is: \"+remainingTime;\n}", "function end() {\r\n\t\r\n\t// find elapsed time from the game starts\r\n\tlet d = new Date();\r\n\tlet timeElapsed = d.getTime() - n - instructionDisplayTime;\r\n\t\r\n\tif (timeElapsed > invincibleTime + \r\n\t\tcurretLevels*(levelTime + waitLevelTime) && collided()) {\t\t\r\n\t\tapp.ticker.stop();\r\n\t\tscoreText.alpha = 0;\r\n\t\tplayerInfoText.alpha = 0;\r\n\t\t/*// clean the screen\r\n\t\tfor (var i = app.stage.children.length - 1; i >= 0; i--) {\r\n\t\t\tapp.stage.removeChild(app.stage.children[i]);\r\n\t\t};*/\r\n\t\tvar endText = new PIXI.Text(\"Game Over\", {\r\n\t\t\tfontWeight: 'bold',\r\n\t\t\tfontStyle: 'italic',\r\n\t\t\tfontSize: 60,\r\n\t\t\t//fontFamily: 'Arvo',\r\n\t\t\t//fill: '#3e1707',\r\n\t\t\t//align: 'center',\r\n\t\t\t//stroke: '#a4410e',\r\n\t\t\t//strokeThickness: 7\r\n\t\t});\r\n\t\t\r\n\t\tvar endTextScore = new PIXI.Text(\"Score: \"+ \r\n\t\t(timeElapsed - curretLevels*waitLevelTime) * scale, {\r\n\t\t\tfontWeight: 'bold',\r\n\t\t\tfontStyle: 'italic',\r\n\t\t\tfontSize: 30,\r\n\t\t});\r\n\t\t\r\n\t\tendText.x = app.screen.width / 2 - 180;\r\n\t\tendText.y = app.screen.height / 2 - 50;\r\n\t\tendTextScore.x = app.screen.width / 2 - 110;\r\n\t\tendTextScore.y = app.screen.height / 2 - 90;\r\n\t\tapp.stage.addChild(endText);\r\n\t\tapp.stage.addChild(endTextScore);\r\n\t};\r\n\t// return score, time\r\n}", "function endGame(score){\n\tconsole.log('End game');\n\tconsole.log(score);\n\t// asking the user if they want to play more game\n\tinquirer.prompt([{\n\t\ttype: \"input\",\n\t\tname: \"text\",\n\t\tmessage: \"Do you want to play again?\"\n\t}]).then(function(answer){\n\t\t// if user wants to play more game \n\t\tif(answer.text === 'yes' || answer.text === 'y'){\n\t\t\t// intialize the game again\n\t\t\tinitGame();\n\t\t} else {\n\t\t\tconsole.log('Thankyou for playing!');\n\t\t}\n\t})\n}", "function scorePage() {\n main.classList.add(\"hide\");\n endGame.classList.remove(\"hide\");\n finalScore.textContent = timeLeft;\n clearInterval(interval);\n}", "function displayAnswer(){\n if(start){\n answer = toGuess;\n lives = 0;\n printAnswer();\n checkScores();\n } \n}", "function score(){\n\tif(gameStart){\n\t\tvar s = document.getElementById(\"score\");\n\t\ts.innerText++;\n\t\tremoveClick();\n\t\tresetAll();\n\t}\n}", "function startOver() {\n if(level > highScore){ // Sets highscore\n highScore = level -1;\n $(\"h3\").text(\"High Score: \" + highScore);\n }\n level = 0;\n gamePattern = [];\n started = false;\n $(\".goButton\").show();\n}", "function endScreen() {\n // set variable for final score\n var finalScore = score + internalScore;\n\n // change reset variable to prevent reset. game is done...\n resetWhere = 6;\n console.log('spelet är slut');\n var gameArea = document.getElementById('gameArea');\n gameArea.innerHTML = '<h1>Resultat</h1>';\n gameArea.innerHTML += '<p>Du fick totalt ' + finalScore + ' poäng av 25 möjliga</p>';\n gameArea.innerHTML += '<h3>Hur pass bra resultat fick du?</h3>';\n gameArea.innerHTML += '<ul class=\"list-group\"><li class=\"list-group-item\">Under 8 poäng: Njaaaa....</li><li class=\"list-group-item\">8 - 16 poäng: Nu börjar det likna något.</li><li class=\"list-group-item\">16 - 22 poäng: Sådär ja!</li><li class=\"list-group-item\">22 - 25 poäng: Heter du Einstein i efternamn?</li></ul>';\n gameArea.innerHTML += '<button type=\"button\" id=\"moveOn\" class=\"btn btn-default\">Prova igen</button>';\n\n document.getElementById('moveOn').addEventListener('click', function() {\n window.location.reload();\n });\n\n }", "function Start() {\n\n $(\"#winText\").text(\"Wins: \" + wins)\n $(\"#loseText\").text(\"Losses: \" + losses)\n $(\".CurrentScoreText\").text(currentScore);\n \n currentScore = 0;\n\n //buttonValue 1-12\n box1Value = Math.floor(Math.random() * 12) + 1;\n box2Value = Math.floor(Math.random() * 12) + 1;\n box3Value = Math.floor(Math.random() * 12) + 1;\n box4Value = Math.floor(Math.random() * 12) + 1;\n //targetscore 19-120\n targetScore = (Math.floor(Math.random() * (120 - 19 + 1)) + 19);\n $(\".TargetScoreText\").text(targetScore);\n}", "function gameEnd(){\n\n game.startBanner = game.add.image(phaser.config.width / 2, phaser.config.height / 2, \"start-banner\")\n \n //If your score is higher than the opponent score, you win, else, you lose.\n if(score > oppScore){\n game.youWin = game.add.image(phaser.config.width / 2, phaser.config.height / 2, \"you-win\")\n }else{\n game.youLose = game.add.image(phaser.config.width / 2, phaser.config.height / 2, \"you-lose\")\n }\n\n game.scene.pause(); //Pause the scene\n\n setTimeout(function(){ //Set timeout then return to menu\n game.scene.start('menu')\n score = 0; //Set score back to 0\n Client.socket.emit('gameEnd');\n },5000)\n }", "function end_game_flow () {\n\t// console.log(\"end...\");\n\t// block all the event to gems\n\tthis.backgroundView.updateOpts({\n\t\tblockEvents: true\n\t});\n\t// disable scoreboard\n\tthis._scoreboard.updateOpts({\n\t\tvisible: false\n\t});\n\t// show end screen\n\tthis._endheader.updateOpts({\n\t\tvisible: true,\n\t\tcanHandleEvents: true\n\t});\n\tanimate(this._endheader).wait(800).then({y: 0}, 100, animate.easeIn).then({y: 35}, 1000, animate.easeIn);\n\n\t// show score\n\tvar scoreText = new TextView({\n\t\tsuperview: this._endheader,\n\t\tx: 0,\n\t\ty: 35, // endscreen animate end point\n\t\twidth: 350,\n\t\theight: 233,\n\t\tautoSize: true,\n\t\ttext: \"You achieved \" + score.toString(),\n\t\tsize: 38,\n\t\tverticalAlign: 'middle',\n\t\thorizontalAlign: 'center',\n\t\tcanHandleEvents: false\n\t});\n\t// //slight delay before allowing a tap reset\n\tsetTimeout(emit_endgame_event.bind(this), 2000);\n\tconsole.log('end game flow.. \\n');\n}", "function finalScore(){\n\t\t//stop the timer once final score is to be shown\n\t\ttimer.stop();\n\t\t//empty the contents of question from screen\n\t\t$(\".question\").empty();\n\t\t//append the correct number of answers to the question div\n\t\t$(\".question\").append(\"<h3>\" + correct + \" questions answered right.\" + \"</h3>\");\n\t\t//append the wrong number of answers to the question div\n\t\t$(\".question\").append(\"<h3>\" + wrong + \" questions answered wrong.\" + \"</h3>\");\n\t\t$(\".time-left\").empty();\n\t}", "endGame(){\n score.addToScore(this.result, 'somejsontoken');\n this.scene.pause();\n const sceneEnd = this.scene.get('end');\n sceneEnd.scene.start();\n //this.scene.add(\"end\", new End(this.result));\n }", "function endGame() {\n if (score === randNum) {\n wins += 1;\n $(\"#score-dis\").html(\"\");\n reset();\n }\n else if (score > randNum) {\n losses += 1;\n $(\"#score-dis\").html(\"\");\n reset();\n }\n }", "function end()\n{\n paused = true;\n\n \n gameOverScene.visible = true;\n gameScene.visible = false;\n nextLevel.visible = false;\n pauseMenu.visible = false;\n gameOverScoreLabel.text = `Your final score: ${score}`;\n\n // Win condition\n if(level > 7)\n {\n gameOverText.text = \"You outran the wave!\"\n gameOverText.x -= 120;\n }\n}", "function start(){\n document.getElementById(\"title\").innerHTML=\"Welcome to 'Drive High Way'\";\n document.getElementById(\"btn\").innerHTML=\"Game Start\";\n document.getElementById(\"score\").innerHTML=\"SCORE: \" + score;\n\n \n moveOtherCars();\n moveLine();\n collision();\n \n}", "function configEndScreen(score, totalQuestions) {\r\n let endingStatement = '';\r\n let endScoreTxt = 'You scored ' + score + ' out of ' + totalQuestions;\r\n\r\n if (score >= 12) {\r\n endingStatement = 'Nice job.';\r\n comment = 'You did well on the quiz.';\r\n } else if (score < 12 && score >= 7) {\r\n endingStatement = 'Fairly good, though a few animals may die.';\r\n comment = 'Learn more about farming but you are almost there.';\r\n } else {\r\n endingStatement = 'Your knowledge is not quite good enough to farm yet.';\r\n comment = 'Do more research before you start a farm.';\r\n }\r\n $('.endHeading').text(`${endingStatement}`);\r\n $('.endScore').text(`${endScoreTxt}`);\r\n $('.endComment').text(`${comment}`);\r\n}", "function endGame() {\n timeLeft = 0;\n finalScoreEL.textContent = score;\n timerEl.classList.add(\"d-none\");\n evalEl.classList.add(\"d-none\");\n mainEl.classList.add(\"d-none\");\n scorepageEl.classList.remove(\"d-none\");\n}", "function endGame() {\n displayQuestion.textContent = \"\";\n var endScreen = document.getElementById(\"endScreen\");\n endScreen.removeAttribute(\"class\");\n clearInterval(timerId);\n\n var finalScore = document.getElementById(\"finalScore\");\n finalScore.textContent = timeLeft;\n\n}", "function endGame() {\n formQuiz.style.display = \"none\";\n quizResult.style.display = \"block\";\n finalScore.textContent = score;\n}", "function scoreScreen() {\n\n // removes questions from the page\n $(\"#game-screen\").empty();\n // updates empty divs with player's score\n $(\"#correct\").text(\"Correct Answers: \" + numCorrect);\n $(\"#incorrect\").text(\"Incorrect Answers: \" + numIncorrect);\n $(\"#unanswered\").text(\"Unanswered Questions: \" + numUnanswered);\n \n }", "function StartGame1() {\r\nShowZeroScores();\r\nStartP1();\r\n}", "function finalScore(){\n quiz.style.display = \"none\"\n endQuiz.style.display = \"flex\";\n clearInterval(timeInterval);\n scoreName.value = \"\";\n finalScoreEl.innerHTML = \"You got \" + score + \" out of \" + quizQuestions.length + \" correct!\";\n}", "function endQuizInMid(score) {\n console.log(myBlue(\"Ending the challenge, so soon :(\"));\n showGameOver(score);\n console.log(myBlue(\"Guess I'll see you around \"+userName+\"!\"));\n // Player is given the option to quit the quiz or retry the current level.\n acceptUserChoice('Quit', 'Retry');\n}", "function finished() {\n hide(questionBlock);\n hide(stopMusic);\n hide(outcome);\n reveal(scoreBtn);\n reveal(finish);\n finalScore.textContent = score;\n jeopardy.pause();\n}", "function gameExit() {\n endPage();\n userScore();\n}", "function endGame() {\n // Resets the timer interval\n clearInterval(timer);\n // Prompt for user initials\n user = prompt(\"Please enter your initials here:\");\n // Sets the seconds left as the final score\n score = secondsLeft;\n // Stores values of user and score to localStorage\n localStorage.setItem(\"score\", secondsLeft);\n localStorage.setItem(\"user\", user);\n\n window.location.href = \"leaderboard.html\";\n}", "function startGame() {\n currentScoreDisplay.textContent = 0;\n player1Score.textContent = 0;\n player2Score.textContent = 0;\n player = Math.floor(Math.random() * 2) + 1;\n gameStarted = true;\n showPlayer(player);\n displayScores();\n}", "function finalScore() {\n if (confirm(`\n CONGRATULATIONS!\n YOU WON THE GAME IN ${--startingTime} SECONDS, WITH ${totalStars.childElementCount} STARS!\n\n WANNA PLAY AGAIN?`)) {\n reAssign();\n }\n\n}", "function end_level(){\n\tcheck_achievements();\n\tpauseBgMusic();\n\tclearInterval(game_id);\n\tclear();\n\t\n\tendgame.play();\n\t\n\tctx.textAlign = \"center\";\n\tctx.font = \"25px Verdana\";\n\tctx.strokeStyle = \"#ff0000\";\n\tctx.strokeText(\"Coin collector!\", 500,100);\n\tctx.strokeText(\"You lose! You scored:\", 500,200);\n\tctx.strokeText(score, 500,250);\n\t\n\tctx.strokeText(\"Click to play again.\", 500,300);\n\tctx.strokeText(\"Press 'h' for help or 'a' for achievements list.\", 500,450);\n\tif(typeof(Storage)!==\"undefined\")\n\t\t{\n\t\tif (localStorage.score){\n\t\tif (score > localStorage.score){\n\t\t\tlocalStorage.score = score;\n\t\t}\n\t\t}\n\t\telse{\n\t\tlocalStorage.score = 0;\n\t\t}\n\t\tif (localStorage.prevScore){\n\t\t//do nothing this time around, still too early to update, we just didn't want undefined!\n\t\t}\n\t\telse{\n\t\tlocalStorage.prevScore = 0;\n\t\t}\n\tctx.strokeText(\"Highest score: \" + localStorage.score + \" Previous Score: \" + localStorage.prevScore + \"\", 500,400);\n\tif (localStorage.prevScore){\n\t\tlocalStorage.prevScore = score;\n\t\t}\n\t}\n\tscore = 0;\n\talreadyStarted = 2;\n\t\n\t}", "function endGame() {\n stopTimer();\n document.getElementById('question-area').classList.add('hide');\n submitScore();\n starter.classList.remove('hide');\n console.log(\"Game Done!\");\n}", "function startGame() {\n scoreBoard.textContent = 0;\n timeUp = false;\n score = 0;\n peep();\n setTimeout(() => timeUp = true, 15000)\n }", "function gameEnd(){\n\t\t\trealtime = Date.now() - starttime;\n\t\t\t// Round to 1 digit behind the comma\n\t\t\trealtime = Math.round(realtime / 1000 * 10) / 10;\n\t\t\t// Clear interval timer\n\t\t\tclearInterval(timer);\n\t\t\t$(\".info .timer .sec\").text(realtime);\n\t\t\t$(\".info .timer .sectext\").fadeIn(300);\n\t\t\t$(\"#popup-highscore b.score\").html(realtime + \" seconds\");\n\t\t\t$(\"#popup-highscore input[name=score]\").val(realtime);\n\t\t}", "function endGame(){\n ctx.save();\n myReq = undefined;\n createBackground(ctx);\n scoreDisplay(score);\n restartButton();\n exitButton();\n reinit();\n ctx.restore();\n \n ctx.clearRect(190, 5, 25, 20);\n ctx.clearRect(10, 5, 100, 25);\n\n ctx.fillStyle=\"#000000\";\n ctx.font = \"bolder 20px Arial\";\n ctx.fillText(\"Thank you for playing!\", 100, 200);\n ctx.restore();\n ctx.font = \"15x Arial\";\n var text = \"Your score: \" + score;\n ctx.fillText(text, 100, 250);\n\n if(prevHighScore < score){\n localStorage.removeItem(\"HighScore\");\n localStorage.setItem(\"HighScore\", newScore);\n ctx.fillText(\"New high score!\", 100, 270);\n }\n \n canvas.addEventListener(\"mousedown\",\n gameDecision, false);\n\n var newScore = \"\" + score;\n\n if(prevHighScore < score){\n localStorage.removeItem(\"HighScore\");\n localStorage.setItem(\"HighScore\", newScore);\n }\n}", "function endGame(){\n\ttotalScore=0;\n\t$(\"#totalScore\").html(totalScore);\n\n\tcomputerNumber = Math.round(Math.random() * (60 - 40)) + 40;\n\t$(\"#computerNumber\").html(computerNumber);\n\n\tcrystals.red.points = Math.round(Math.random() * (5 - 1)) + 1;\n\tcrystals.yellow.points = Math.round(Math.random() * (15 - 10)) + 10;\n\tcrystals.green.points = Math.round(Math.random() * (20 - 15)) + 1;\n\tcrystals.blue.points = Math.round(Math.random() * (2 - 1)) + 1;\n}", "function startScreen() {\n\t// make lines slightly thicker\n\tctx.lineWidth = 2;\n\n\tctx.clearRect(0, 0, gameWidth, gameHeight + 300);\n\n\tctx.strokeStyle = 'white';\n\tctx.fillStyle = 'white';\n\tctx.font = \"56px 'Press Start 2P'\";\n\n\tctx.strokeRect(0, 0, gameWidth, gameHeight);\n\n\t// Score\n\tctx.textAlign = 'center';\n\tctx.fillText(`Jump Man II:`, gameWidth / 2, (gameHeight / 2) - 100);\n\tctx.font = \"32px 'Press Start 2P'\";\n\tctx.fillText(`Revenge of the Hurdles`, gameWidth / 2, (gameHeight / 2));\n\n\tctx.font = \"24px 'Press Start 2P'\";\n\tctx.fillText(`Press space to start`, gameWidth / 2, (gameHeight / 2) + 150);\n\n\tif (keys[32]) {\n\t\tscreenDisplay = false;\n\t}\n\n\t// Run the game!\n\trequestAnimationFrame(update);\n}", "function finishGame() {\n document.querySelector('#nextguess').style.display = \"none\";\n document.querySelector('.endmsg').style.display = \"block\";\n document.querySelector('#finalscore').innerHTML = score.toFixed(0);\n}", "function endQuiz(){\n $(stage).append(\n '<div class=\"questionText\">You have finished the quiz!<br><br>Total questions:'\n +num+'<br>Correct answers: '+score+'</div>'\n );\n }", "function gameEnd() {\n cancelAnimationFrame(frame);\n canvas.style.cursor = 'crosshair'; // #crosshair\n finalScore.textContent = 'Score: ' + score;\n modal.style.display = \"block\";\n closeSpan.onclick = function () {\n modal.style.display = \"none\";\n }\n retry.onclick = function () {\n location.reload();\n }\n}", "function startGame() {\n luminousScore = 0;\n}", "function end(){\n alert('Game over \\nYou reached level '+counter);\n bord.hidden = true;\n cumputerTurn = true;\n buttonDisplay = 0;\n userClicked = false;\n randomData=[];\n userCounter = 0;\n counter = 1;\n gameStart.hidden = false;\n bord.hidden = true;\n start = false;\n}", "function endgame(){\n\tplayer.kill();\n\tscorelabel.text=\"GAME OVER! \\n You scored \"+score;\n\tscoretext.visible=false;\n\tlifelabel.visible=false;\n\tlifetext.visible=false;\n\n}", "function endQuiz () {\n endScreen.classList.remove('hide');\n displayedQuestion.classList.add('hide');\n stopTimer();\n document.getElementById(\"final-score\").innerHTML = \"Your final score is \" + score + \".\";\n}", "function update()\n {\n\n\n if(currentScore < targetScore) {\n $(\"#State\").text(\"Scoreboard\");\n }\n if (currentScore > targetScore) {\n losses++;\n $(\"#State\").text(\"You Lose!\")\n Start();\n\n }\n\n \n\n if (currentScore == targetScore) {\n wins++;\n $(\"#State\").text(\"You Win!\")\n Start();\n }\n\n \n}", "function endGame(){\n\tspawnBall();\n\tcenterBall();\n\tspawnPlayerOne();\n\tspawnPlayerTwo();\n\tupdateScore();\n\t$('#menuCanvas').show();\n}", "function newGame() {\n userScore = 0;\n gameStart();\n }", "function startPoint() {\n\tscores = [0, 0];\n\tactivePlayer = 0;\n\troundScore = 0;\n\tgamePlaying = true;\n\n\t// Sets every thing on the screen to some default value\n\tdocument.querySelector('.win').textContent = 'Win Socre';\n\tdocument.querySelector('#name-0').textContent = 'Player 1';\n\tdocument.querySelector('#name-1').textContent = 'Player 2';\n\tdocument.querySelector('.player-0-panel').classList.remove('winner');\n\tdocument.querySelector('.player-1-panel').classList.remove('winner');\n\tdocument.querySelector('.player-0-panel').classList.remove('active');\n\tdocument.querySelector('.player-1-panel').classList.remove('active');\n\tdocument.querySelector('.player-0-panel').classList.add('active');\n\tdocument.querySelector(\"#score-0\").textContent = '0';\n\tdocument.querySelector(\"#score-1\").textContent = '0';\n\tdocument.querySelector(\"#current-0\").textContent = '0';\n\tdocument.querySelector(\"#current-1\").textContent = '0';\n\tdocument.querySelector(\"#dice1\").style.display = \"none\";\n\tdocument.querySelector(\"#dice2\").style.display = \"none\";\n}", "function endGame() {\n //hide words\n $(\".fiveWords\").hide();\n //rid of opacity for start game button\n document.getElementById(\"startGameButton\").style.opacity = 1;\n //enable start button\n startButton.disabled = false;\n //make button opaque for end game\n document.getElementById(\"endGameButton\").style.opacity = .4;\n //disable the end button\n endButton.disabled = true;\n //get time score\n userScore = time;\n \n //change value of game over -- alec\n gameOver = true;\n \n //document.getElementById(\"myAnimation1\").innerHTML = userScore.toString();\n \n //stop the timer\n clearInterval(timer);\n \n window.location.replace('https://typegamertype.000webhostapp.com//highscore.php?score=' + userScore);\n}", "function startGame(){\n // disable the start button when the timer is still going\n isFinished = false\n headerIntro.style.display = \"none\";\n\n // call renderQuestion() to render the question\n renderQuestion();\n\n // run timer\n var timeInterval = setInterval(function(){\n timeLeft--;\n timerDisplay.textContent = timeLeft;\n\n // Check is the time has run out or if all the questions have been answered\n if (isFinished || timeLeft === 0){\n clearInterval(timeInterval);\n renderScore(); // call renderScore() to display the score and submit initials\n }\n }, 1000);\n \n}", "function endScreen() {\n if (music.isPlaying() ) {\n var endOpacity = 0;\n } else {fill(255, 56, 115, endOpacity);\n var endOpacity = 255;\n rect(0, 0, width, height);\n textSize(12);\n if (frameCount%2 == 0){\n fill(255,endOpacity);\n textFont(font);\n textAlign(CENTER);\n textSize(12);\n text(\"GAME OVER\", width/2, height/2);\n text(\"SCORE: \" + scoreCount, width/2, height/2+20);\n }\n }\n}", "function startGame() {\n console.log(\"started\");\n computerChoice = (Math.floor(Math.random() * 120) + 19);\n crystal1 = (Math.floor(Math.random() * 12) + 1);\n crystal2 = (Math.floor(Math.random() * 12) + 1);\n crystal3 = (Math.floor(Math.random() * 12) + 1);\n crystal4 = (Math.floor(Math.random() * 12) + 1);\n totalScoreNumber = 0;\n $(\"#crystalImages\").show();\n updateScreen();\n }", "function switchScreen(){\n //Switches screen from HomeScreen or Gamestart to Scores\n if(screenID== \"HomeScreen\" || screenID == \"GameStart\"){\n if(screenID == \"GameStart\"){\n //stops errors with calls to non-existant IDs\n if(tension!= false){\n stopTimedLoop(tension);\n }\n //Adds current gameScore to scores array before ranking from greatest to least\n appendItem(allScores,gameScore);\n for(var i = 0; i<allScores.length;i++){\n for(var n=i+1;n<allScores.length;n++)\n if(allScores[n]>allScores[i]){\n var temp = allScores[i];\n allScores[i] = allScores[n];\n allScores[n] = temp;\n \n }\n }\n \n setText(\"score1\",\"1: \" +allScores[0]);\n setText(\"score2\",\"2: \" +allScores[1]);\n setText(\"score3\",\"3: \" +allScores[2]);\n setText(\"score4\",\"4: \" +allScores[3]);\n setText(\"score5\",\"5: \" +allScores[4]);\n \n }\n //resets in-game variables\n screenID = \"Scores\";\n gameScore = 0;\n money = 20;\n numberCaught = 0;\n setTimeout(function(){\n setScreen(\"Scores\");\n },300);\n setTimeout(function(){\n showScoreElements();\n },1000);\n }\n //switches from scores to home\n else if(screenID == \"Scores\"){\n hideScoreElements();\n setScreen(\"HomeScreen\");\n showHomeElements();\n screenID = \"HomeScreen\";\n }\n}", "function gameStart() {\n\t//maybe add gameOverStatus\n\t//initial gameStatus\n\tmessageBoard.innerText = \"Game Start!\\n\" + \"Current Score: \" + counter + \" points\";\n\tcreateBoard();\n\tshuffleCards();\n}", "function startGame() {\n\n //Reset game\n score = 0;\n reserrors = 0;\n round = 1;\n $('#score').text(\"Score: \"+score);\n\n generateRound()\n}", "function endGame() {\n stop();\n $(\"form\").hide();\n $(\"#endresults\").show();\n $(\"#correct\").text(\"Correct: \" + correct);\n $(\"#incorrect\").text(\"Incorrect: \" + incorrect);\n $(\"#unanswered\").text(\"Unanswered questions: \" + unanswered);\n $(\"#results\").text(\"Cool! Here is your final score!\");\n $(\"#reset\").show();\n }", "function startGame(){\n if(!gameStarted){\n gameStarted = true;\n startGame1 = true;\n $scoreP1.text(0);\n timeUp = false;\n p1Score = 0;\n highlight();\n countdown();\n setTimeout(() => {\n timeUp = true;\n $player1PopUp.css('display', 'block');\n $p1ScoreDisplay.text(p1Score);\n },15000);\n }\n }", "function initialScore () {\n score = 0;\n $(\"#current-score\").text(score);\n}", "function endGame() {\n clearInterval(counter)\n questionsElement.setAttribute('class', 'hide');\n endArea.classList.remove('hide');\n var finalScore = document.querySelector(\"#final-score\")\n finalScore.textContent = score;\n}", "function PresentScoring() {\n basic.clearScreen()\n // plot minumum target (depending on current level)\n for (let r = 0; r <= level * 5 - 1; r++) {\n led.plotBrightness(r % 5, 4 - r / 5, 10)\n }\n basic.pause(250)\n for (let t = 0; t <= Math.min(24, 29 - score); t++) {\n led.plot(t % 5, 4 - t / 5)\n if (!(quiet)) {\n music.playTone(175 + t * 5, music.beat(BeatFraction.Sixteenth))\n } else {\n basic.pause(music.beat(BeatFraction.Sixteenth))\n }\n basic.pause(200 - 8 * t)\n }\n basic.pause(250)\n // Check if got top Scores\n if (score < 6) {\n for (let i0 = 0; i0 < 3; i0++) {\n basic.clearScreen()\n led.plot(1, 1)\n led.plot(3, 1)\n led.plot(1, 4)\n led.plot(2, 4)\n led.plot(3, 4)\n led.plot(0, 3)\n led.plot(4, 3)\n if (!(quiet)) {\n music.playTone(587, music.beat(BeatFraction.Whole))\n } else {\n basic.pause(music.beat(BeatFraction.Whole))\n }\n basic.pause(250)\n //basic.clearScreen()\n led.plotAll()\n //ToggleScreen()\n basic.pause(250)\n //ToggleScreen()\n\n }\n screen += 1\n }\n else {\n if (30 - score >= 5 * (level)) {\n if (!(quiet)) {\n music.playTone(587, music.beat(BeatFraction.Whole))\n } else {\n basic.pause(music.beat(BeatFraction.Whole))\n }\n screen += 1\n basic.pause(1000)\n }\n else {\n // \n basic.clearScreen()\n ShowSadFace()\n basic.pause(1000)\n }\n basic.pause(30)\n }\n\n basic.pause(1000)\n}", "function exitGame() {\n\n\tclearInterval(progress);\n\n\t// display a new screen with final score and option to play again\n\tvar finalScreen = document.querySelectorAll('.final-screen')[0],\n\t finalScore = document.querySelector('#finalScore'),\n\t playAgain = document.querySelector('#play-again');\n\n\t// hiding main and score container \n\tdocument.querySelectorAll('.container')[0].style.display = \"none\";\n\tdocument.querySelectorAll('.score-container')[0].style.display = \"none\";\n\n\t// display the result screen with final score\n\tfinalScreen.style.display = \"block\";\n\tfinalScore.innerHTML = score;\n\n\t// play again button click handler\n\tplayAgain.addEventListener('click', function() {\n\n\t\tclearInterval(progress);\n\t\tscore = 0;\n\t\tscoreDiv.innerHTML = score;\n\t\tstartGame();\n\n\t\tfinalScreen.style.display = \"none\";\n\t\tdocument.querySelectorAll('.container')[0].style.display = \"block\";\n\t\tdocument.querySelectorAll('.score-container')[0].style.display = \"block\";\n\t});\n}", "function setCurrentScore () {\n $(\"#current-score\").html(crystal.currentval);\n }", "function score() {\n if (playerScore === 5) {\n console.log(\"Congratulations \\n You Win the Match\");\n reset();\n } else if (computerScore === 5) {\n console.log(\"Computer Wins the Match \\n Beep Beep\");\n reset();\n } else {}\n}", "function endOfGame() {\n clearInterval(timerId);\n $('#guessruletable .pheno').prop('disabled', 'disabled');\n $('#guessruletable .allele').prop('disabled', 'disabled'); // false\n $('#bitsandbuttons').show();\n $('#hidepop').hide(); \n $('#makepop').show(); \n var score = $(\"#countdownText\").text();\n if(score>0) {\n\tvar yrname=prompt(translate[lang][\"You scored\"]+score+translate[lang][\"Enter name\"]);\n addToTable(yrname,score);\n\tprintTable();\n\t$(\"html, body\").animate({ scrollTop: 0 }, \"slow\");\n } else {\n\talert(translate[lang][\"Out of time\"]);\n\t$(\"html, body\").animate({ scrollTop: 0 }, \"slow\");\n }\n}", "function finish() {\n var score_text = document.getElementById('score');\n params = parseParameters();\n\n var score;\n if (typeof params.score === 'undefined') {\n score = 0;\n } else {\n score = params.score;\n }\n\n score_text.innerHTML = params.score;\n}", "function endGame() {\n clearInterval(scorePanel.intervalManager);\n showCongratulationModal();\n}", "function endQuiz() {\n //calculate final score\n score = Math.max((timer * 10).toFixed(), 0);\n timer = 0;\n $timer.text(\"Timer: \" + timer.toFixed(1));\n //stop the timer\n clearInterval(interval);\n //write the end message, buttons, and scores\n setEndDOM();\n }", "function endGame() {\n clearInterval(timer)\n quizScreen.setAttribute(\"class\", \"hide\");\n endScreen.removeAttribute(\"class\", \"hide\");\n score = time * correct.length;\n scoreEl.textContent = \"Your score is \" + score; \n}", "function endGame(){\n if (parties == maxParties){\n hasFinished = true;\n document.getElementById(\"score\").innerText = \"score :\" + points + \"/20\";\n if (points<=8) {\n document.getElementById(\"phrasescore\").innerText = \"T'es un noob !\";\n }\n if ((points>=9) && (points<=16)) {\n document.getElementById(\"phrasescore\").innerText = \"c'était si dur que ça ?\";\n }\n if(points>=17) { document.getElementById(\"phrasescore\").innerText = \"Bien joué !\";\n }\n }\n}", "function viewGameOverScreen() {\n showHide(gameOverScreen, getQuiz);\n finalScoreEl.textContent = \"Your final score is: \" + score;\n}", "function endGame() {\r\n clearInterval(animate);\r\n\r\n audioBackground.pause();\r\n alert(`Game over ! Your Score: ${score}`);\r\n\r\n canv.style.display = \"none\";\r\n div1[0].style.display = \"block\";\r\n }", "function letstart()\n {\n \n document.getElementById('para').innerHTML=random(4);\n document.getElementById('quest').innerHTML=random_2();\n document.getElementById('sc').innerHTML=\"score\"+\" = \"+count;\n start=3.5;\n \n \n interval=setInterval(timer,1000);\n ID=setTimeout(display,3500);\n \n}", "function endGameCard() {\n console.log(\"ending\");\n console.log(score);\n answerBox.innerHTML = \"\";\n quizEl.classList.add(\"hide\");\n endEl.classList.remove(\"hide\");\n scoreEl.textContent = score;\n}", "function gameOver(){\n if(i = questions.length){\n score = secondsLeft;\n clearInterval(timerNum);\n initialPage();\n }else if (secondsLeft == 0){\n score = 0;\n clearInterval(timerNum);\n initialPage();\n }\n}", "function displayScore() {\n clearInterval(interval);\n interval = undefined;\n score += secondsLeft;\n\n alert(\"Your score is: \" + score);\n let initials = prompt('Please Enter your initials');\n if(initials != null) {\n scores.push(initials + \": \" + score);\n localStorage.setItem('scores', JSON.stringify(scores));\n }\n}", "function startGame(){\n\tcomputerRandomNumber = Math.floor(Math.random()*(120 - 19 + 1) + 19);\n\tuserTotalScore = 0;\n\trescrambleCrystalValues();\n\tupdateDisplay();\n}", "function enterScore(event) {\n var qAnswer = allQuestion[questionIndex -1].answer\n\n if (event.target.value === qAnswer) {\n questionsBox.textContent = \"Correct! +10 Points! \";\n score += 10;\n \n } else {\n questionsBox.textContent = \"Wrong! You lost 10 Seconds of Time!\";\n secondsLeft = secondsLeft - timePenalty;\n } \n }", "function endGame(win) {\n that.pause();\n running = false;\n if(win) {\n console.log(\"BOUT 2 ALERT\")\n alert(\"You've reached the highest score!\");\n console.log(\"DONE ALERTING\")\n } else {\n $(\"#ship\").height(0);\n drawBoard();\n alert(\"Looks like you got squashed. Game over!\");\n }\n submitTurk();\n }", "function finalScore() {\n $('.start-container').html(finalPage());\n $('.restartButton').on('click', function (event) {\n event.preventDefault();\n STORE.score = 0;\n $('.score').html('0 / 7');\n STORE.questionNumber = 0;\n $('.questionNumber').html('0 / 7');\n startPage();\n });\n\n}", "function startNewGame() {\n\t\tif (userRoundScore > randomScore) {\n\t\t\tlosses++;\n\t\t\talert(\"Math is hard... You Lost. Try again!\");\n\t\t\tinitializeVariables();\n\t\t}\n\n\t\tif (userRoundScore == randomScore) {\n\t\t\twins++;\n\t\t\tinitializeVariables();\n\t\t\talert(\"Szechuan Sauce For All! You Win!\");\n\t\t}\n\t}", "function startGame() {\n makeCards(cardType);\n renderCardsToGame();\n gameStarted = false;\n score = 0;\n counter[0].innerHTML = 0;\n timer.innerHTML = '0:00:00';\n clearInterval(timeCount);\n star3.style.visibility = 'visible';\n star2.style.visibility = 'visible';\n star1.style.visibility = 'visible';\n matchedSets = 0;\n}", "function handleEndGame() {\n let remark = null\n let remarkColor = null\n\n \n const playerGrade = (playerScore / 5) * 100\n\n //data to display to score board\n document.getElementById('remarks').innerHTML = remark\n document.getElementById('remarks').style.color = remarkColor\n document.getElementById('grade-percentage').innerHTML = playerGrade\n document.getElementById('wrong-answers').innerHTML = wrongAttempt\n document.getElementById('right-answers').innerHTML = playerScore\n document.getElementById('score-modal').style.display = \"flex\"\n\n}", "function stop_game()\n{\n //Set scores to 0\n \tscore = 0;\n comscore = 0;\n \n // Update score board\n\t\tdocument.getElementById(\"score\").innerHTML=score;\n\t\tdocument.getElementById(\"comscore\").innerHTML=comscore;\n}", "function showEndScreen() {\n hideResultScreen();\n clearInterval(quizTimer);\n questionsEl.setAttribute(\"class\", \"hide\");\n endScreenEl.removeAttribute(\"class\");\n finalScore.innerHTML = time/1000;\n}", "gameover() {\n AM.play(\"gameover\");\n alert(\"game over!\" + this.score);\n this.reset();\n }" ]
[ "0.72276706", "0.7178877", "0.71736205", "0.7072301", "0.7034315", "0.7016307", "0.6974885", "0.68623686", "0.6849652", "0.68495196", "0.683184", "0.6826522", "0.68233377", "0.67996955", "0.677231", "0.67701626", "0.6769106", "0.67597103", "0.67529017", "0.6751491", "0.673095", "0.67136925", "0.6704926", "0.6700895", "0.66923773", "0.6683661", "0.66779816", "0.6671279", "0.6667282", "0.66599154", "0.6649028", "0.6645463", "0.6642692", "0.66336185", "0.66248834", "0.6624217", "0.6619668", "0.6619223", "0.6617645", "0.6609746", "0.6605536", "0.6591507", "0.6588336", "0.65827197", "0.65763396", "0.65760237", "0.65680486", "0.6565129", "0.65622944", "0.6560869", "0.6557745", "0.65472806", "0.6545425", "0.6544524", "0.65433174", "0.65397465", "0.65303594", "0.6525823", "0.6521436", "0.65204906", "0.65067667", "0.65028256", "0.65022767", "0.6499863", "0.6493075", "0.6491622", "0.6485225", "0.64851016", "0.6483908", "0.647891", "0.64780134", "0.6477152", "0.64748", "0.6474656", "0.647284", "0.64720476", "0.6471549", "0.645915", "0.64588463", "0.6457409", "0.64570785", "0.6450217", "0.64461726", "0.6445154", "0.64411604", "0.64396703", "0.64378625", "0.6433031", "0.64310336", "0.64299124", "0.6425519", "0.64217067", "0.642088", "0.6418118", "0.64170885", "0.6415106", "0.641423", "0.64140314", "0.64009327", "0.6396818" ]
0.6788323
14
function prevents the localstorage being reset from var highScores = []; that was declared in the beginning
function getHighScores () { var getPastScores = localStorage.getItem("highscore"); if (getPastScores === null) { highScores = []; } else { highScores = JSON.parse(localStorage.getItem("highscore")); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function storedHighs() {\n localStorage.setItem(\"Scores\", JSON.stringify(highs));\n }", "function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n localStorage.setItem(\"highscoreName\", \"\");\n var allScores = localStorage.getItem(\"allScores\");\nallScores = JSON.parse(allScores);\n}", "function clearHighScore() {\n playerScores = [];\n playerInitals = [];\n lsPlayerScores = \"\";\n lsPlayerInitals = \"\";\n localStorage.setItem(\"playerInital\", \"\");\n localStorage.setItem(\"playerScore\", \"\");\n viewHS();\n }", "function clearLocalStorage() {\n highScoreList = [];\n var highScoreListStr = JSON.stringify(highScoreList);\n localStorage.removeItem(\"movieFighterHighScoreList\");\n}", "function highScores() {\r\n scoreDiv.style.display = \"none\";\r\n document.getElementById(\"highScores\").style.display = \"block\";\r\n console.log(document.getElementById(\"highScores\"))\r\n var currentHighScores = JSON.parse(localStorage.getItem(\"highScore\"));\r\n // var highScoreArray = []\r\n var highScore = {\r\n name: document.getElementById(\"initials\").value,\r\n score: score\r\n }\r\n currentHighScores.push(highScore)\r\n var strHighScore = JSON.stringify(currentHighScores);\r\n localStorage.setItem(\"highScore\", strHighScore);\r\n console.log(highScore)\r\n displayHallOfFame()\r\n}", "function checkButton() {\n if (secondsLeft <= 0) {\n location.reload()\n } else if (win = !win && initials.value == \"\") {\n alert(\"Initials field cannot be blank.\\n Please enter your initials\")\n } else {\n var storeScore = {\n initials: initials.value.trim(),\n score: secondsLeft,\n }\n }\n highScoresArray = JSON.parse(localStorage.getItem(\"saveHighScores\"))\n console.log(highScoresArray)\n if (highScoresArray == null) {\n highScoresArray = storeScore\n localStorage.setItem(\"saveHighScores\", JSON.stringify([highScoresArray])) \n } else \n if (highScoresArray !== null) {\n highScoresArray.push(storeScore)\n localStorage.setItem(\"saveHighScores\", JSON.stringify(highScoresArray))\n }\n processScore()\n}", "function storeHighScores(event) {\n event.preventDefault();\n\n // stop function is initial is blank\n if (initialInput.value === \"\") {\n alert(\"Please enter your initials!\");\n return;\n } \n\n startDiv.style.display = \"none\";\n timer.style.display = \"none\";\n timesUp.style.display = \"none\";\n summary.style.display = \"none\";\n highScoreSection.style.display = \"block\"; \n\n // store scores into local storage\n var savedHighScores = localStorage.getItem(\"high scores\");\n var scoresArray;\n\n if (savedHighScores === null) {\n scoresArray = [];\n } else {\n scoresArray = JSON.parse(savedHighScores)\n }\n\n var userScore = {\n initials: initialInput.value,\n score: finalScore.textContent\n };\n\n console.log(userScore);\n scoresArray.push(userScore);\n\n // stringify array in order to store in local\n var scoresArrayString = JSON.stringify(scoresArray);\n window.localStorage.setItem(\"high scores\", scoresArrayString);\n \n // show current highscores\n showHighScores();\n}", "function saveHighscore () {\n // get value of input box\n var initials = initialsEl.value\n\n //make sure value wasn't empty \n if (initials !== \"\") {\n // get saved scores from localStorage, or if not any set to empty array\n var highscores = JSON.parse(window.localStorage.getItem(\"highscores\")) || [];\n\n // format new score object for current user \n var newScore = {\n score:time, \n initials: initials\n };\n\n // save to localStorage \n highscores.push(newScore);\n window.localStorage.setItem(\"highscores\", JSON.stringify(highscores));\n\n \n }\n printHighscores();\n}", "function storeHighScore() {\n allHighScores.sort(compare);\n localStorage.setItem(\"allHighScores\", JSON.stringify(allHighScores)); \n}", "function saveScore() {\n var userInitials = document.querySelector(\"#initial-input\").value;\n var finalScore = countDown;\n\n //Object stores intitials and high scores\n var scoreObject = { initials: userInitials, score: finalScore };\n\n var highScores = localStorage.getItem(\"highScoreList\");\n\n if (highScores == null) {\n localStorage.setItem(\"highScoreList\", JSON.stringify([scoreObject]));\n console.log(highScores);\n } else {\n highScoreList = JSON.parse(highScores);\n console.log(typeof highScoreList);\n highScoreList.push(scoreObject);\n localStorage.setItem(\"highScoreList\", JSON.stringify(highScoreList));\n }\n}", "function saveHighScore() {\r\n var initials = $(\"#initials-entry\");\r\n var newHighScore = {\r\n initials: initialsEl.value,\r\n highScore: score\r\n };\r\n\r\n console.log(\"newHighScore\");\r\n highScores.push(newHighScore);\r\n console.log(\"highScores\");\r\n localStorage.setItem(\"scores\", JSON.stringify(highScores));\r\n }", "function displaystats(){\n\n console.log(\"Display Stats\");\n\n // Hides the quiz //\n quizcontainerEl.classList.add(\"hide\");\n\n // Displays current score and asks for initials //\n if(timeLeft > 1) {\n var username = prompt(\"Game Over. Your score is: \" + timeLeft + \". Please enter your initials: \");\n\n } else {\n outoftime();\n }\n\n // Temporarily stores player's initials (username) and score (timeLeft) //\n var currentScore = {\n score: timeLeft,\n name:username\n };\n\n // Adds new data to highScores array--which was pulled from local storage when declaring the variable highScores in line 5 above //\n highScores.push(currentScore);\n\n // Sorts the high scores from highest to lowest //\n highScores.sort((a, b) => b.score - a.score);\n\n // Removes any score other than the top 5 in the highScore array //\n highScores.splice(5);\n\n // Displays high scores //\n highscorecontainerEl.classList.remove(\"hide\");\n playagainbuttonEl.classList.remove(\"hide\");\n h3subtitleEl.classList.remove(\"hide\");\n \n // If there are less than 5 high scores in local storage, this conditional displays only the number of existing scores //\n if (highScores.length > 4) {\n // displays the unorderd list of names //\n name0El.innerHTML = highScores[0].name;\n name1El.innerHTML = highScores[1].name;\n name2El.innerHTML = highScores[2].name;\n name3El.innerHTML = highScores[3].name;\n name4El.innerHTML = highScores[4].name;\n\n // displays the ordered list of scores //\n score0El.innerHTML = highScores[0].score;\n score1El.innerHTML = highScores[1].score;\n score2El.innerHTML = highScores[2].score;\n score3El.innerHTML = highScores[3].score;\n score4El.innerHTML = highScores[4].score;\n\n } else {\n \n if (highScores.length > 3) {\n name0El.innerHTML = highScores[0].name;\n name1El.innerHTML = highScores[1].name;\n name2El.innerHTML = highScores[2].name;\n name3El.innerHTML = highScores[3].name;\n score0El.innerHTML = highScores[0].score;\n score1El.innerHTML = highScores[1].score;\n score2El.innerHTML = highScores[2].score;\n score3El.innerHTML = highScores[3].score;\n\n } else {\n\n if (highScores.length > 2 ) {\n name0El.innerHTML = highScores[0].name;\n name1El.innerHTML = highScores[1].name;\n name2El.innerHTML = highScores[2].name;\n score0El.innerHTML = highScores[0].score;\n score1El.innerHTML = highScores[1].score;\n score2El.innerHTML = highScores[2].score;\n\n } else {\n\n if (highScores.length > 1) {\n name0El.innerHTML = highScores[0].name;\n name1El.innerHTML = highScores[1].name;\n score0El.innerHTML = highScores[0].score;\n score1El.innerHTML = highScores[1].score;\n\n } else {\n name0El.innerHTML = highScores[0].name;\n score0El.innerHTML = highScores[0].score;\n }\n }\n } \n }\n\n // Resets the high scores in local storage //\n localStorage.setItem(\"highScores\", JSON.stringify(highScores));\n\n // Listens for a click on the play again button. If so execute playagain() //\n playagainbuttonEl.addEventListener(\"click\", playagain);\n\n }", "function Resetter() {\n localStorage.removeItem('highScore')\n print(localStorage.getItem('highScore'))\n}", "function saveHighscore() {\n var initials = initialsBox.value.trim(); // input value from user\n if (initials !== \"\") {\n\n // creating an array of highscores\n var highscores = JSON.parse(window.localStorage.getItem(\"highscore\")) || [];\n \n // storing user input and score as an object into the array \n var newScore = {\n initials: initials,\n score: seconds\n };\n highscores.push(newScore);\n\n // saving object to localStorage\n window.localStorage.setItem(\"highscore\", JSON.stringify(highscores));\n loadHighScores();\n\n }\n }", "function clearHighScores() {\n highScores = [];\n setScores(questions);\n writeScores();\n }", "function gameOver(){\n const highScoresList = document.getElementById(\"highScoresList\");\n var playerScore = secondsLeft;\n var toggleEL = document.getElementById('toggle');\n questionEl.innerText='Game Over';\n resetQuestionCard();\n var person = prompt(\"Please enter your initials!\", \"XX\");\n if (person == null || person == \"\") {\n txt = \"Player not recorded.\";\n };\n toggleEL.innerText=\"Score:\"; \n var scoreButton = document.getElementById('score-btn');\n scoreButton.classList.remove('hide');\n\n //local storage function for scores\n var thisScore ={score: playerScore, initials: person};\n var highScore = JSON.parse(localStorage.getItem('highScore')) || [];\n \n highScore.push(thisScore);\n localStorage.setItem('highScore', JSON.stringify(highScore));\n \n \n }", "function gatherHighScore() {\n \n var yourInitials = document.querySelector(\".text-input\").value;\n location.href = \"./highscores.html\"\n\n \n var userScore = [\n yourInitials + \" - \" +\n finalSocre\n ]\n // Sets the above array to local storage. There is a way to make this not overwirite the value each time but I have been unable to find it\n localStorage.setItem('Scores', JSON.stringify(userScore));\n\n \n }", "function clearHighscores(){\n highscoreList.innerHTML = \"\";\n localStorage.removeItem(\"highscores\");\n}", "function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n localStorage.setItem(\"highscoreName\", \"\");\n \n resetGame()\n }", "function getScores() {\n var storedHighscoresData = localStorage.getItem(\"highscores\");\n\n if (storedHighscoresData !== null) {\n storedHighscoresData = JSON.parse(storedHighscoresData);\n highscores.initials = storedHighscoresData.initials;\n\n highscores.scores = storedHighscoresData.scores;\n // highscores.scores.sort((a,b)=>b - a);\n // Intention is to sort name with score but logic is incorrect\n }\n else {\n highscores.initials = [];\n highscores.scores = [];\n }\n}", "function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n\n localStorage.setItem(\"highscoreName\", \"\");\n\n resetGame();\n}", "function reset(){\r\n\r\n gameState=PLAY;\r\n \r\nif(localStorage[\"HighScore\"]<score){\r\n\r\n localStorage[\"HighScore\"]=score;\r\n\r\n}\r\n\r\n score=0;\r\n}", "function clearHighScores() {\n localStorage.clear();\n location.reload();\n}", "function clearHighScores() {\n\n // Clears the localStorage of all values (including the high scores list)\n localStorage.clear();\n\n // initializing a variable named highScoreIndex\n // corresponding to the underordered list (with the id=\"highScoreIndex\")\n var highScoreIndex = document.getElementById(\"highScoreIndex\");\n\n // if else statement to prevent an error...\n // This checks if the list exists (i.e. it is empty or has content)\n // OR if the list is null (i.e. it no longer exists because it has been cleared/deleted)\n // The removeChild function doesn't work if the parentNode is null, so it just returns.\n if (highScoreIndex === null) {\n return;\n }\n // this removes the entire unordered list (with the id=\"highScoreIndex\")\n // from the html of the document...\n // (In this application, this is okay, because re-loading the page\n // puts back the html for the unordered list.)\n else {\n highScoreIndex.parentNode.removeChild(highScoreIndex);\n }\n\n // render the high scores again\n // (Acknowledging that the high scores will not display because we cleared them!)\n renderHighScores();\n}", "function clearScores() {\n localStorage.removeItem('scores');\n checkWin();\n drawScores();\n}", "function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n localStorage.setItem(\"highscoreName\", \"\");\n resetGame();\n}", "function makeHighscorelist() {\n// localStorage.clear()\n // Runs through the localStorage to find the highest score\n if (typeof(Storage) !== undefined) {\n var highest = 0;\n var highest_key = undefined;\n for (var i = 0; i < localStorage.length; i++) {\n var key = localStorage.key(i);\n if (key !== 'auditLog') {\n var nbr = localStorage.getItem(key);\n if (nbr > highest) {\n highest = nbr;\n highest_key = key;\n }\n }\n }\n // Prints the highscore, or if there's no highscore, a message that says there's no highscore\n if (highest_key !== undefined) {\n document.getElementById(\"highscores\").innerHTML = highest_key + \"\\t - \\t\" + localStorage.getItem(highest_key) + \" wins\";\n } else {\n document.getElementById(\"highscores\").innerHTML = \"No highscore exists yet\";\n }\n }\n\n //Writes all the players and the amount of wins in the console.\n console.log(\"Scores:\");\n for (var i = 0; i < localStorage.length; i++) {\n if (localStorage.key(i) !== 'auditLog') {\n console.log(localStorage.key(i) + \", \" + localStorage.getItem(localStorage.key(i)));\n }\n }\n}", "function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n localStorage.setItem(\"highscoreName\", \"\");\n\n resetGame();\n}", "function highScore (){\n // get value of input box\n var initials = initialsEl.value.trim()\n\n // check to make sure value is empty\n if(initials !== \"\"){\n // get saved score from localstorage,\n // if there is not anything saved to localstorage, set as an empty array\n var highScore = JSON.parse(window.localStorage.getItem(\"highscores\")) || [];\n\n //format new scores object for current user\n var newScore = {\n score: time,\n initials: initials\n };\n highScore.push(newScore);\n window.localStorage.setItem(\"highscores\", JSON.stringify(highscores));\n\n// redirect to next page\nwindow.location.href =\"highscores.html\";\n }\n}", "function loadDefaultHighScores() {\n 'use strict';\n var data = \"\";\n var localReq = new XMLHttpRequest();\n \n if (supports_html5_storage()) {\n localReq.open(\"POST\", \"data/defaultScores.json\", false);\n localReq.send(data);\n var i;\n var responseJSON = JSON.parse(localReq.responseText);\n var scores = responseJSON[\"scores\"];\n var scoresCnt = scores.length;\n \n for (i = 0; i < scoresCnt && i < maxHighScores; i++) {\n localStorage[\"othello.highscore.\" + i + \".position\"] = scores[i][\"position\"];\n localStorage[\"othello.highscore.\" + i + \".name\"] = scores[i][\"name\"];\n localStorage[\"othello.highscore.\" + i + \".points\"] = scores[i][\"points\"];\n }\n \n }\n}", "function storeHighscores(initials, score){\n var getScore = {\n Initials: initials,\n Score: score\n };\n \n highScoresArray.push(getScore);\n // Stringify Highscores Array\n localStorage.setItem(\"High Scores\", JSON.stringify(highScoresArray));\n\n var highScoresList = document.getElementById(\"high-scores-list\");\n\n\n // Sort Array \n\n function compare( a, b ) {\n if ( a.Score > b.Score ){\n return -1;\n }\n if ( a.Score < b.Score ){\n return 1;\n }\n return 0;\n }\n \n highScoresArray.sort( compare );\n\n // Loop through Array and Add Scores to List\n for (var i = 0; i < highScoresArray.length; i++) {\n if (highScoresArray[i].Score >= 1) {\n var listItem = document.createElement(\"li\");\n listItem.innerText = highScoresArray[i].Initials + \" \" + highScoresArray[i].Score;\n highScoresList.appendChild(listItem);\n }\n \n }\n highScores.classList.add(\"hidden\");\n messageArea.classList.add(\"hidden\");\n\n console.log(getScore);\n}", "function clearScores(){\n localStorage.clear();\n}", "function submitHighScores() {\n // hides the endContent\n endContent.setAttribute(\"style\", \"display:none\")\n // shows the restartContent options\n restartContent.setAttribute(\"style\", \"display:flex\")\n\n // The submitHighScores function ALSO does the following...\n\n // Initializes an empty array\n var highScoresListCurrent = [];\n\n // Runs an if else statement, which checks to see if values exist in localStorage\n // (Had to do this because if the highScoresStorage was null,\n // the push function below wouldn't work...)\n\n // if the highScoresStorage in localStorage is null,\n // then use the empty array initialized earlier\n if (localStorage.getItem(\"highScoresStorage\") === null) {\n highScoresListCurrent;\n }\n // else: this means that highScoresStorage has values\n // Therefore, use getItem to get the highScoresStorage array from localStorage\n // and make that array as the highScoresListCurrent array\n else {\n highScoresListCurrent = JSON.parse(localStorage.getItem(\"highScoresStorage\"));\n }\n\n // Creates an object called highScoreNew\n // This contains the newest high score, as recorded when the submit was pushed\n var highScoreNew = {\n score: timeRemaining,\n user: userInput.value.trim()\n };\n\n // pushes the highScoreNew object into the highScoreListCurrent array\n // (This action updates the overall array)\n highScoresListCurrent.push(highScoreNew);\n\n // sets that overall array as the new version of the array in localStorage\n localStorage.setItem(\"highScoresStorage\", JSON.stringify(highScoresListCurrent));\n}", "function getAllScores() {\n if (!localStorage.getItem(\"allScores\")) {\n allScores = [];\n } else {\n allScores = JSON.parse(localStorage.getItem(\"allScores\"));\n }\n}", "function saveScoreInLocalStorage() {\n var initials = document.querySelector(\"#initials\").value.trim().toUpperCase();\n\n // we want to preserve the existing scores rather than overwriting them\n var scoresArray = JSON.parse(localStorage.getItem(\"highScores\")) || [];\n // handles score update for the existing user\n if (scoresArray.length != 0) {\n for (var i = 0; i < scoresArray.length; i++) {\n // if existing user, check current score\n // and only update if current score is greater than existing score for this user.\n if (scoresArray[i].initials === initials) {\n window.alert(\n \"Looks like you already are in our system, we will go ahead and update your highest score.\"\n );\n var existingUserRecord = parseInt(scoresArray[i].score);\n if (existingUserRecord < score) {\n scoresArray.splice(i, 1);\n var highScore = {\n initials: initials,\n score: score,\n };\n break;\n } else return;\n } else if (scoresArray[i].initials != initials) {\n var highScore = {\n initials: initials,\n score: score,\n };\n }\n }\n scoresArray.push(highScore);\n localStorage.setItem(\"highScores\", JSON.stringify(scoresArray));\n return;\n\n // if new user, then create and push the score object to the array\n } else {\n var highScore = {\n initials: initials,\n score: score,\n };\n scoresArray.push(highScore);\n localStorage.setItem(\"highScores\", JSON.stringify(scoresArray));\n }\n}", "function updateScore(){\n\n\t\tvar scoreInArr = false; //A variable to keep track if the score is already in the array\n\t\tfor(var i = 0; i<highscoreArr.length;i++){ //Check so that the a certain score isn't added twice\n\t\t\t\tif(currentScore == highscoreArr[i]){\n\t\t\t\t\tscoreInArr = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t}\n\n\t\tif(!scoreInArr && currentScore !== 0){\t//Only add score if it isn't already in the highscore Array or if its zero.\n \thighscoreArr.push(currentScore);\t//Add new score\n\t\t}\n\n \thighscoreArr.sort(function(a,b){\t//sort the highscoreArr\n\t\t return b-a;\n\t });\n\n\tif(highscoreArr.length > 10) {//Remove the last element if there are more than 10 highscores saved.\n\t\thighscoreArr.pop();\n\t}\n\n\tif(highscoreArr[0] !== undefined){\t//Check so that there even is any first element in the array.\n\t\thighscoreElt.innerHTML = highscoreArr[0];//Display the new highest highscore\n\t}\n\n\twindow.localStorage.highscores = JSON.stringify(highscoreArr);//Put a new highscore arr in the localstorage\n\n\tcurrentScore = 0;\n\tcurrentScoreElt.innerHTML = currentScore;\n}", "function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n localStorage.setItem(\"highscoreName\", \"\");\n \n resetGame();\n}", "function retain() {\n\tvar storedScores = JSON.parse(localStorage.getItem(\"scores\"));\n\tif (storedScores !== null) {\n\t\tscores = storedScores;\n\t}\n}", "function clearScores() {\n\n\t\tif ($(\"#highScores tr\").length > 1) {\n\n\t\t\tlocalStorage.removeItem(\"scores\");\n\t\t\tstoredScores = [];\n\t\t\t\n\t\t\t// Fun animation, fun sound, and removal of localStorage/High Score elements.\n\t\t\t$(\".added\").animate({\n\n\t\t\t\t'padding': \"0px\",\n\t\t\t\t'height': \"0px\",\n\t\t\t\t'font-size': \"0px\",\n\t\t\t\t'margin': \"0px\"\n\n\t\t\t}, 4800, function() {\n\n\t\t\t\t$(\".added\").remove();\n\n\t\t\t});\n\t\t\tsounds.shutdown();\n\n\t\t}\n\n\t}", "function saveHighscore() {\n //parse turns it into js\n var highscores = JSON.parse(window.localStorage.getItem('highscore')) || [];\n\n var scoreNew = {\n score: time,\n initials: initials.value.trim(),\n };\n\n //pushing the array\n highscores.push(scoreNew);\n window.localStorage.setItem('highscore', JSON.stringify(highscores))\n //(key, item)\n //stringify turns it from an array to a string\n\n console.log(\"scoreNew:\", scoreNew);\n}", "function init() {\n var storedHighScores = JSON.parse(localStorage.getItem(\"highscore\"));\n\n if (storedHighScores !== null) {\n highScores = storedHighScores;\n }\n\n renderHighScores();\n}", "function clearScore() {\n window.localStorage.clear();\n if (highScores !== null) {\n document.getElementById(\"saved-name\").innerHTML = \"\";\n document.getElementById(\"saved-score\").innerHTML = \"\";\n } else {\n return;\n }\n}", "function saveHighScores() {\n var initials = initialsEl.value.trim();\n \n if (initials !== \"\") {\n var highscores = JSON.parse(window.localStorage.getItem('highscores')) || [];\n var newScore = {\n score: secondsLeft,\n initials: initials\n };\n\n //save to local storage\n highscores.push(newScore);\n window.localStorage.setItem('highscores', JSON.stringify(highscores));\n\n window.location.href = \"highscores.html\";\n }\n}", "function resetScore(){\n localStorage.removeItem('game1HighScore');\n highScoreBoard.textContent='HIGH SCORE: ' + 0;\n}", "function clearHighscores() {\n window.localStorage.removeItem(\"highscores\");\n window.location.reload();\n}", "function saveScore() {\n let iniUser = $userInitials.val();\n\n highScores.push({ \"user\": iniUser, \"score\": finalScore });\n\n console.log(highScores);\n localStorage.setItem(\"highScores\", JSON.stringify(highScores));\n showHighScore();\n\n\n}", "function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n localStorage.setItem(\"highscoreName\", \"\");\n\n resetQuiz();\n}", "function loadSavedData(){\n $(highScoreList).empty();\n\n var accessedData = localStorage.getItem(localStorageString);\n if(accessedData){\n highScoreArray = JSON.parse(accessedData);\n $.each(highScoreArray, function(i, scoreObject){\n var scoreListItem = $(\"<li>\");\n $(scoreListItem).text(scoreObject.playerInitials + \" : \" + scoreObject.playerScore);\n $(highScoreList).append(scoreListItem);\n })\n }\n }", "function clearScores() {\n localStorage.clear()\n localStorage.savedScores = \"High Scores: \"\n document.getElementById(\"showHighScores\").innerHTML = \"\";\n\n}", "function saveHighscore() {\n var score = quiz.score + Math.ceil(seconds);\n // get value of input box\n var initialsInput = document.querySelector('#initials');\n var initials = initialsInput.value.trim();\n\n // make sure input is valid\n if (initials === \"\" || initials.length < 3 || initials.length > 3) {\n alert(\"Initials field cannot be blank and must be 3 characters long! Try again.\");\n\n } else {\n alert(\"Your score has been saved. Let's see if you made the Top 10!\");\n // get saved scores from localstorage, or if not any, set to empty array\n var highscores =\n JSON.parse(window.localStorage.getItem(\"highscores\")) || [];\n // format new score object for current user\n var newScore = {\n score: score,\n initials: initials\n }\n // save to localstorage\n highscores.push(newScore);\n window.localStorage.setItem(\"highscores\", JSON.stringify(highscores));\n location.replace(\"high-scores.html\")\n }\n}", "function submitScore() {\n userName = document.getElementById(\"userName\").value;\n var newScore = {\n name: userName,\n score: correctAnswers\n };\n var highScores = JSON.parse(localStorage.getItem(\"highScores\"));\n highScores.push(newScore);\n localStorage.setItem(\"highScores\", JSON.stringify(highScores));\n}", "function clearScores(){\n window.localStorage.clear();\n updateScoreBoard();\n}", "function setHighScore() {\n highScore = localStorage.getItem(\"highScore\");\n highScore=JSON.parse(highScore);\n if (score > highScore) {\n highScore = score;\n localStorage.setItem(\"highScore\", JSON.stringify(highScore));\n }\n\n}", "function checkScore() {\n if (this.localStorage) {\n localStorage.setItem('score',score);\n if (localStorage.highScore) {\n if (score > localStorage.highScore) {\n localStorage.setItem('highScore',score);\n }\n }\n else {\n localStorage.setItem('highScore',score);\n }\n }}", "function clearHistory() {\n\tscores = [];\n\tlocalStorage.setItem(\"scores\", JSON.stringify(scores));\n\tlistofscores();\n}", "function clearScores() {\n localStorage.clear();\n \n while (scoreList.firstChild) {\n scoreList.removeChild(scoreList.firstChild);\n }\n\n scoreSheet = [];\n}", "function clearScores() {\n localStorage.removeItem(\"topScores\");\n while (scoresListEl.lastElementChild) {\n scoresListEl.removeChild(scoresListEl.lastElementChild);\n }\n}", "function retrieveStoredHS() {\n var storedHS = JSON.parse(localStorage.getItem(\"highScores\"));\n\n if (storedHS !== null) {\n highScores = storedHS;\n }\n\n renderHS();\n }", "setHighScore() {\n localStorage.setItem(\"highScore\", this.score);\n }", "function bestScore(){\n if(parseInt(localStorage.getItem(\"highScore\")) < updatedScore){\n //updating 3rd score\n localStorage.setItem(\"thirdScore\", localStorage.getItem(\"secondScore\"));\n printedScores[2] = localStorage.getItem(\"thirdScore\");\n highScore3.innerText = \"Third HighScore: \" + localStorage.getItem(\"thirdScore\")\n //updating 2nd score\n localStorage.setItem(\"secondScore\", localStorage.getItem(\"highScore\"));\n printedScores[1] = localStorage.getItem(\"secondScore\");\n highScore2.innerText = \"Second HighScore: \" + localStorage.getItem(\"secondScore\");\n //updating high score\n var currentHighScore = updatedScore.toString();\n localStorage.setItem(\"highScore\", currentHighScore);\n highScore1.innerText = \"Top HighScore: \" + localStorage.getItem(\"highScore\");\n printedScores[0] = currentHighScore;\n \n } else if (parseInt(localStorage.getItem(\"secondScore\")) < updatedScore){\n //updating 3rd score if high score doesn't change\n localStorage.setItem(\"thirdScore\", localStorage.getItem(\"secondScore\"));\n printedScores[2] = localStorage.getItem(\"thirdScore\");\n highScore3.innerText = \"Third HighScore: \" + localStorage.getItem(\"thirdScore\");\n //updating 2nd score if high score doesn't change\n var currentSecondScore = updatedScore.toString();\n localStorage.setItem(\"secondScore\", currentSecondScore);\n highScore2.innerText = \"Second HighScore: \" + localStorage.getItem(\"secondScore\");\n printedScores[1] = currentSecondScore;\n \n } else if (parseInt(localStorage.getItem(\"thirdScore\")) < updatedScore){\n //updating 3rd score if high score and second score doesn't change\n var currentThirdScore = updatedScore.toString();\n localStorage.setItem(\"thirdScore\", currentThirdScore);\n highScore3.innerText = \"Third HighScore: \" + localStorage.getItem(\"thirdScore\");\n printedScores[2] = currentThirdScore;\n \n }else{\n //if no score can be updated\n proposedQuestion.innerText = \" You did not earn a high score. Try again!\"\n }\n}", "function saveScore(){\n /* standardize value provided in initials field */\n var initials = initialsEl.value.toUpperCase();\n initials.trim();\n \n /* validation to prevent blank form entry */\n if (initials === \"\"){\n alert(\"Please provide initials\");\n // saveScore;\n } else {\n var highscores;\n\n /* Get any highscores present in local storage */\n if (JSON.parse(localStorage.getItem(\"highscores\")) != null) {\n highscores = JSON.parse(window.localStorage.getItem(\"highscores\"));\n \n /* if no high scores in local storage, create an empty array */\n } else {\n highscores = []\n }\n /* create an object for current completion */\n var newScore = {\n initials: initials,\n score: time,\n };\n\n /* Add object created for current completion to the end of the highscores array */\n highscores.push(newScore);\n \n /* Save highscores array to local storage as string */\n window.localStorage.setItem(\"highscores\",JSON.stringify(highscores));\n\n window.location.href = \"leaderboards.html\";\n }\n}", "function storeScore(myScore) {\n document.getElementById(\"1\").style.display = \"none\";\n document.getElementById(\"2\").style.display = \"none\";\n document.getElementById(\"3\").style.display = \"none\";\n mainQuest.style.display = \"none\";\n timeEl.style.display = \"none\";\n var initials = prompt(\"Please enter your initials to store your score.\");\n if (initials != null) {\n let playerScore = {\n name: initials,\n high: myScore\n }\n\n arrObj.push(playerScore);\n arrObj.sort(function(a,b){\n return b.high - a.high;\n });\n\n localStorage.setItem('playerScore', JSON.stringify(arrObj));\n\n }\n return playerScore;\n}", "function saveUser() {\n\n // get previous scores from local storage and place in array or use empty array\n var scores = JSON.parse(localStorage.getItem(\"scores\")) || [];\n\n // create score object\n var score = {\n \"score\": timer,\n \"date\": Date()\n }\n\n if ((scores.length >= 10 && score.score > scores[9].score) || (scores.length < 10)) {\n\n // prompt user for name\n score.initials = prompt(\"You earned a high score! Enter your initials!\");\n\n // add current score to score array\n scores.push(score);\n\n // sort score array by score value \n scores.sort((a, b) => {\n if (a.score < b.score) {\n return 1\n } else if (a.score > b.score) {\n return -1\n }\n return 0;\n\n })\n\n if(scores.length > 10){\n scores.splice(10, 1);\n }\n\n console.log(scores);\n\n // save latest score to local storage for special styling\n localStorage.setItem(\"latestScore\", JSON.stringify(score));\n // save score list to local storage\n localStorage.setItem(\"scores\", JSON.stringify(scores));\n\n }\n else{\n alert(\"you didn't make the high score list. Try harder next time!\");\n }\n displayScores(score);\n}", "function initialQuiz() {\n console.log(\"Page reloaded.\");\n quizLayout.innerHTML = \"Answer all the questions within the time limit! Incorrect answers will subtract \" + PENALTYTIME + \" seconds from the time.\";\n startBtn.style.display = \"visible\";\n\n // retrieve high scores lists from local storage.\n let storedHighScoresArray = JSON.parse(localStorage.getItem(\"highestScoresArray\"));\n if (storedHighScoresArray !== null) {\n highestScores = storedHighScoresArray;\n }\n let storedHighScoreList = JSON.parse(localStorage.getItem(\"storedHighScoreList\"));\n if (storedHighScoreList !== null) {\n highScoresObj = storedHighScoreList;\n }\n}", "function storeUserScores(event) {\n event.preventDefault();\n\n // Prevents User from entering blank Initials\n if (userInitialsEL.value === \"\") {\n alert(\"Please enter your initials!\");\n return;\n } \n\n // Stores score into local storage\n var savedHighScores = localStorage.getItem(\"high scores\");\n var highScoresArray;\n\n if (savedHighScores === null) {\n highScoresArray = [];\n } else {\n highScoresArray = JSON.parse(savedHighScores)\n }\n\n var userScore = {\n initials: userInitialsEL.value,\n score: finalScoreEL.textContent\n };\n\n console.log(userScore);\n highScoresArray.push(userScore);\n\n // stringify array in order to store in local\n var highScoresArrayString = JSON.stringify(highScoresArray);\n window.localStorage.setItem(\"high scores\", highScoresArrayString);\n \n // Shows current High Scores\n showHighScores();\n}", "function saveScores() {\n var initials = userInitialsInput.value.trim();\n //Calls a new var \"user\" that will allow you to pass the dat through local storage\n if (initials !== \"\") {\n var highscores = JSON.parse(window.localStorage.getItem(\"highscores\")) || [];\n var user = {\n initials: initials,\n score: time/1000\n };\n highscores.push(user);\n window.localStorage.setItem(\"highscores\", JSON.stringify(highscores));\n }\n window.location.href = \"highscore.html\";\n}", "function saveScore() {\n if (localStorage.getItem('highScore') != null) {\n const prevScore = localStorage.getItem('highScore');\n if (stars > prevScore) {\n localStorage.setItem(\"highScore\", stars);\n }\n } else {\n localStorage.setItem(\"highScore\", stars);\n }\n\n }", "function retrieveHighScore(){\n var pScore = localStorage.getItem(\"HighScore\");\n if(typeof pScore !== \"undefined\" && pScore !== null){\n prevHighScore = Number(pScore);\n }\n}", "function setScore() {\nlocalStorage.setItem(\"highscore\", score);\nlocalStorage.setItem(\"highscoreName\", document.getElementById('name').value);\ngetScore();\n}", "function initScores() {\n storedScores = JSON.parse(localStorage.getItem(\"scores\"));\n\n if (storedScores !== null) {\n scoreList = storedScores;\n }\n renderScores();\n}", "function saveScores() {\n\n var initials = initialsEl.value.trim();\n\n if (initials !== \"\") {\n var highscores =\n JSON.parse(window.localStorage.getItem(\"highscores\")) || [];\n var newScore = {\n score: time,\n initials: initials\n };\n\n // store and puts into string\n highscores.push(newScore);\n window.localStorage.setItem(\"highscores\", JSON.stringify(highscores));\n\n // next page\n window.location.href = \"highscores.html\";\n \n }\n}", "function storeScore() {\n localStorage.setItem(\"highscore\", score);\n\n localStorage.setItem(\"highscoreName\", document.getElementById(\"name\").value);\n\n getScore();\n}", "function highscorelist() {\n if (snakeLength > high1) {\n localStorage.setItem(high2, snakeLength);\n leaderBoard.innerHTML = \"High score: \" + \"<br />\" + localStorage.getItem(high2);\n }\n else {\n leaderBoard.innerHTML = \"High score: \" + \"<br />\" + localStorage.getItem(high2);\n }\n}", "function rewriteHighscores() {\n var n = [\"Computer 1\",\"Computer 2\",\"Computer 3\",\"Computer 4\",\"Computer 5\"];\n var s = [22.7, 22.8, 22.9, 23.0, 23.1];\n var old_n = JSON.parse(localStorage.getItem(\"names\"));\n var old_s = JSON.parse(localStorage.getItem(\"scores\"));\n old_n = n;\n old_s = s;\n localStorage.setItem(\"names\", JSON.stringify(old_n));\n localStorage.setItem(\"scores\", JSON.stringify(old_s));\n }", "function gameOver(){\n qContainer.classList.add(\"hside\");\n currentQ = 0;\n clearInterval(timer)\n var initials = prompt ('Gameover! Enter your initials here and check your score on the score board.')\n \n var userInfo = {\n userInitials: initials,\n timeLeft: time\n }\n scoreBoard.push(userInfo);\n localStorage.setItem(\"allScores\", JSON.stringify(scoreBoard))\n console.log(localStorage)\n \n }", "function setScore() {\n localStorage.setItem(\"highscore\", score);\n localStorage.setItem(\"highscoreName\", document.getElementById('name').value);\n getScore();\n}", "function highestScore() {\r\n var currentScore = parseInt(firstPlayerScore.innerHTML);\r\n highscore = localStorage.getItem(\"highscore\");\r\n\r\n if (highscore !== null) {\r\n if (currentScore > highscore) {\r\n localStorage.setItem(\"highscore\", currentScore);\r\n }\r\n }\r\n else {\r\n localStorage.setItem(\"highscore\", currentScore);\r\n }\r\n\r\n gameCounterId.innerHTML = highscore;\r\n\r\n //to clear score\r\n // highscore = localStorage.removeItem(\"highscore\");\r\n }", "function clearHighscores(){\n window.localStorage.removeItem(\"highscores\");\n window.location.reload();\n}", "function setScore() {\n localStorage.setItem(\"highscore\", score);\n localStorage.setItem(\"highscoreName\", document.getElementById(\"name\").value);\n \n getScore();\n}", "function savescoreTime(event)\n{\n event.preventDefault();\n window.location.replace('view_highscore.html');\n\n var scoreList = []; \n var existingList = JSON.parse(localStorage.getItem(\"uScore\"));\n \n if (existingList == null) \n {\n scoreList.push(nameTextB.value+\" - \"+scoreTime)\n localStorage.setItem(\"uScore\", JSON.stringify(scoreList));\n }\n \n else \n {\n scoreList=JSON.parse(localStorage.getItem(\"uScore\"));\n scoreList.push(nameTextB.value+\" - \"+scoreTime)\n localStorage.setItem(\"uScore\", JSON.stringify(scoreList));\n } \n}", "function setupSaving() {\n\t\tlocalStorage.highScore > 0 ? return : localStorage.setItem(\"highScore\",0)\n\t}", "function addItemToLocalStorage(highestScore){\r\n\r\n\r\n \r\n localStorage.setItem(\"highScore\",highestScore); \r\n\r\n \r\n \r\n }", "function loadHighScores(){\n\n // clear all divs to display results \n descVar.innerHTML=\"\";\n quizHolderVar.innerHTML = \"\";\n checkAnswerVar.innerHTML = \"\";\n checkAnswerVar.removeAttribute(\"class\");\n\n var results = document.getElementById(\"finishQuizGame\")\n results.removeAttribute(\"class\");\n results.innerHTML=\"\";\n\n // Display results by creating elements dynamically -- Heading for Highscores \n var highScoresHeading = document.createElement(\"h1\");\n highScoresHeading.setAttribute(\"class\",\"text-center jumbotron\");\n highScoresHeading.textContent = \"HIGH SCORES\";\n results.appendChild(highScoresHeading);\n\n // Retrieve objects array from localStorage and append to div\n var highscore = JSON.parse(window.localStorage.getItem('highscore')) || [];\n highscore.forEach(function(score) {\n var results = document.createElement(\"p\");\n results.setAttribute(\"class\",\"text-center list-group-item\");\n results.textContent = score.initials + \" : \" + score.score;\n var printHighScore = document.getElementById(\"finishQuizGame\");\n printHighScore.appendChild(results);\n });\n\n }", "function storeHighscore(highScore) {\n let highScores = getHighScores();\n // add high score to array\n highScores.push(highScore);\n // sort array\n highScores.sort(function (a, b) {\n return b.score - a.score;\n });\n // stringify and save the array to localstorage\n let highScoreString = JSON.stringify(highScores);\n localStorage.setItem(highScoresKey, highScoreString);\n}", "function setScore() {\n localStorage.setItem(\"highscore\", score);\n localStorage.setItem(\"highscoreName\", document.getElementById('name').value);\n getScore();\n}", "function setScore() {\n localStorage.setItem(\"highscore\", score);\n localStorage.setItem(\"highscoreName\", document.getElementById('name').value);\n getScore();\n}", "function setScore() {\n localStorage.setItem(\"highscore\", score);\n localStorage.setItem(\"highscoreName\", document.getElementById('name').value);\n getScore();\n}", "function setScore() {\n localStorage.setItem(\"highscore\", score);\n localStorage.setItem(\"highscoreName\", document.getElementById('name').value);\n getScore();\n}", "function saveHighscore() {\n var score = secs;\n var userInitials = identification.value;\n\n var newScore = [\n {\n score: score,\n initials: userInitials\n }\n ];\n // save to localstorage\n localStorage.setItem(\"newscore\", JSON.stringify(newScore));\n // redirect to highscores\n window.location.href = \"highScores.html\";\n}", "function tallyScore (time){\n if(quizIndex>=4)\n {\n countdownEl.textContent =\"\";\n verifyEl.textContent =\"\";\n questionEl.textContent =\"All Done!\"\n contentEl.textContent =\"Your Score is \" + time;\n endGame.style.display =\"block\";\n \n }\n // Submit button grabbing intials and going to highscore page\n\n endGame.addEventListener(\"submit\", function(event){\n var scoreEntry = {\n name: document.getElementById(\"name\").value,\n score: time\n };\n \n \n var scoreLists = JSON.parse(localStorage.getItem(\"score\"));\n // just check to see if the user has an item in localStorage called \"score\"\n // if so, we'll use it like we're doing already\n // if not, let's create that item in their localStorage\n if (scoreLists !== null)\n {\n scoreLists.unshift(scoreEntry);\n console.log(scoreLists);\n localStorage.setItem(\"score\", JSON.stringify(scoreLists));\n }\n else{\n var newScoreList = [];\n newScoreList.unshift(scoreEntry);\n localStorage.setItem(\"score\", JSON.stringify(newScoreList));\n }\n \n \n})\n \n}", "function loadHighScores() {\n var scoreList;\n var scores = JSON.parse(localStorage.getItem(\"scores\"));\n topBar.innerHTML = \n '<button id=\"go-back\">Go Back</button>' +\n '<button id=\"clear-high-score\">Clear High Scores</button>';\n firstBlock.innerHTML = \n '<div class=\"high-score-box\">' +\n '<h1 class=\"text-center\">HIGH SCORES &#x1F3C6</h1>' +\n '<ol id=\"high-score-list\"></ol>' +\n '</div>';\n secondBlock.innerHTML = \"\";\n\n if (scores !== null) {\n scoreList = document.querySelector(\"#high-score-list\")\n\n for (var i = 0; i < scores.length; i++) {\n var score = document.createElement(\"li\");\n score.innerHTML = '<div>' + (i + 1) + \" \" + scores[i].name + '</div>' +\n '<div>' + scores[i].score + '</div>';\n score.setAttribute(\"class\", \"flex-ends\");\n scoreList.appendChild(score);\n }\n }\n}", "function setScore() {\n localStorage.setItem(\"highscore\", score);\n localStorage.setItem(\"highscoreName\", document.getElementById(\"name\").value);\n \n getScore()\n\n }", "function saveScore() {\n var savedName = inputNameEl.value\n var newScore = {name: savedName, score: score}\n localStorage.setItem(\"highscores\", JSON.stringify(newScore));\n clearField();\n}", "function saveScore() {\n \n if (localStorage.loggedInUserID != undefined){\n \n let score = {\n userID: localStorage.loggedInUserID,\n score: counter,\n difficulty: localStorage.difficultyLevel,\n }\n \n ranking.push(score);\n ranking.sort(function(a,b){return b.score - a.score});\n ranking.splice(10);\n localStorage.setItem(\"ranking\", JSON.stringify(ranking));\n location.reload();\n \n } else {\n alert(\"You need to login to have your score saved.\");\n }\n}", "function h_loadHighscoreFromLocalStorage() \n{\n\t// 30 Days\n\thighscore_30_score = localStorage.getItem(\"highscore_30\");\n\tif(highscore_30_score == null)\n\t{\n\t\t$('#score_30').html(\"<i>No highscore available yet</i>\");\n\t}\n\telse\n\t{\n\t\t// get values\n\t\thighscore_30_name = localStorage.getItem(\"player_30\");\n\t\thighscore_30_moneyPerDay = localStorage.getItem(\"moneyPerDay_30\");\n\t\thighscore_30_date = localStorage.getItem(\"date_30\");\n\t\t\n\t\t// display values\n\t\t$('#score_30').html(\"<b>\"+highscore_30_score+\"</b>\");\n\t\t$('#player_30').html(\"by \"+highscore_30_name);\n\t\t$('#moneyPerDay_30').html(\"(\"+highscore_30_moneyPerDay+\" per Day)\");\n\t\t$('#date_30').html(\"at \"+highscore_30_date);\n\t}\n\t\n\t\n\t// 45 Days\n\thighscore_45_score = localStorage.getItem(\"highscore_45\");\n\tif(highscore_45_score == null)\n\t{\n\t\t$('#score_45').html(\"<i>No highscore available yet</i>\");\n\t}\n\telse\n\t{\n\t\t// get values\n\t\thighscore_45_name = localStorage.getItem(\"player_45\");\n\t\thighscore_45_moneyPerDay = localStorage.getItem(\"moneyPerDay_45\");\n\t\thighscore_45_date = localStorage.getItem(\"date_45\");\n\t\t\n\t\t// display values\n\t\t$('#score_45').html(\"<b>\"+highscore_45_score+\"</b>\");\t\t\t\t\t\t\n\t\t$('#player_45').html(\"by \"+highscore_45_name);\n\t\t$('#moneyPerDay_45').html(\"(\"+highscore_45_moneyPerDay+\" per Day)\");\n\t\t$('#date_45').html(\"at \"+highscore_45_date);\n\t}\n\t\n\t\n\t// 90 Days\n\thighscore_90_score = localStorage.getItem(\"highscore_90\");\n\tif(highscore_90_score == null)\n\t{\n\t\t$('#score_90').html(\"<i>No highscore available yet</i>\");\n\t}\n\telse\n\t{\n\t\t// get values\n\t\thighscore_90_name = localStorage.getItem(\"player_90\");\n\t\thighscore_90_moneyPerDay = localStorage.getItem(\"moneyPerDay_90\");\n\t\thighscore_90_date = localStorage.getItem(\"date_90\");\n\t\t\n\t\t// display values\n\t\t$('#score_90').html(\"<b>\"+highscore_90_score+\"</b>\");\t\t\t\t\t\t\n\t\t$('#player_90').html(\"by \"+highscore_90_name);\n\t\t$('#moneyPerDay_90').html(\"(\"+highscore_90_moneyPerDay+\" per Day)\");\n\t\t$('#date_90').html(\"at \"+highscore_90_date);\n\t}\n\t\n\t\n\t\n\t// 120 Days\n\thighscore_120_score = localStorage.getItem(\"highscore_120\");\n\tif(highscore_120_score == null )\n\t{\n\t\t$('#score_120').html(\"<i>No highscore available yet</i>\");\n\t}\n\telse\n\t{\n\t\t// get values\n\t\thighscore_120_name = localStorage.getItem(\"player_120\");\n\t\thighscore_120_moneyPerDay = localStorage.getItem(\"moneyPerDay_120\");\n\t\thighscore_120_date = localStorage.getItem(\"date_120\");\n\t\t\n\t\t// display values\n\t\t$('#score_120').html(\"<b>\"+highscore_120_score+\"</b>\");\n\t\t$('#player_120').html(\"by \"+highscore_120_name);\t\n\t\t$('#moneyPerDay_120').html(\"(\"+highscore_120_moneyPerDay+\" per Day)\");\n\t\t$('#date_120').html(\"at \"+highscore_120_date);\n\t}\n}", "function initialsSave() {\n const initials = document.querySelector(\"#initials\");\n let initializer = initials.value.trim();\n if (initializer !== \"\") {\n let highScores = JSON.parse(window.localStorage.getItem(\"high-scores\")|| \"[]\");\n\n let newScore = {\n score: secondsLeft,\n initials: initializer,\n }\n\n highScores.push(newScore);\n window.localStorage.setItem(\"high-scores\", JSON.stringify(highScores));\n window.location.href = \"index.html\";\n }\n}", "function fetchHighscore() {\n if (localStorage.getItem('highscores')) {\n // 1) fetch the data : localStorage.getItem('highscores')\n // 2) parse it : JSON.parse\n const localStor = JSON.parse(localStorage.getItem('highscores'))\n // Sort by highscore\n localStor.sort((a, b) => b.score - a.score)\n // 3) Assign it to highscore\n highscore = localStor[0].score\n // 3) Display it\n displayScore(currentScore, highscore)\n } else {\n // 0) Deal with the case the highscores don't exists by adding one (fake)\n localStorage.setItem('highscores', JSON.stringify(highscores))\n }\n}", "function clearScore() {\n window.localStorage.clear();\n highscoreDisplayName.textContent = \"\";\n highscoreDisplayScore.textContent = \"\";\n}", "function saveScore(newInitials, newScore) {\n getScores();\n \n highscores.initials.push(newInitials);\n highscores.scores.push(newScore);\n \n var highscoresData = JSON.stringify(highscores);\n localStorage.setItem(\"highscores\", highscoresData);\n}", "function HighScore() {\n\n // Add highscore template.\n\n let highscoreClone = this.clone.querySelector('.highscore');\n this.answerBox.appendChild(highscoreClone);\n\n // Set the end time for the highscore time and calculate total time.\n\n this.user.end = new Date();\n this.user.total = (this.user.end - this.user.start)/1000;\n\n // Get the highscore list from storage and if none then add array.\n // Add the sessions name and time to the list and save to storage again.\n\n let oldList = JSON.parse(localStorage.getItem('highScoreList')) || [];\n\n oldList.push(this.user);\n\n // Sort the list after total time.\n\n function sortList(a,b) {\n if (a.total < b.total)\n return -1;\n if (a.total > b.total)\n return 1;\n return 0;\n }\n\n oldList.sort(sortList);\n\n // Only the 5 fastest in list.\n\n if (oldList.length > 5) {\n oldList.length = 5;\n }\n\n localStorage.setItem('highScoreList', JSON.stringify(oldList));\n\n // Append top 5 to highscore list.\n\n for (let i = 0; i < oldList.length; i++) {\n let liClone = document.createElement('li');\n liClone.appendChild(document.createTextNode(oldList[i].name + ' - ' + oldList[i].total + 's'));\n highscoreClone.querySelector('.highscoreList').appendChild(liClone);\n }\n\n\n // Start over button.\n\n let button = highscoreClone.querySelector('.playagain');\n\n\n // Add listener for reload.\n\n button.addEventListener('click', function() {\n\n location.reload();\n\n });\n\n}" ]
[ "0.8045468", "0.8006161", "0.797451", "0.7972429", "0.79716206", "0.7776171", "0.7736761", "0.7723185", "0.7712638", "0.77111447", "0.7690294", "0.7683815", "0.76812947", "0.767065", "0.7668651", "0.762816", "0.7620422", "0.7620355", "0.76109535", "0.76096016", "0.7598561", "0.7592169", "0.7582449", "0.75662017", "0.7556829", "0.7556768", "0.75507164", "0.7545005", "0.75439", "0.75371724", "0.753052", "0.7525168", "0.7521957", "0.751671", "0.75152886", "0.75079554", "0.74951684", "0.7466957", "0.74648076", "0.74641377", "0.7458917", "0.7457984", "0.74426323", "0.74206066", "0.7414292", "0.7411718", "0.7409184", "0.740618", "0.739648", "0.73915356", "0.7389153", "0.7374984", "0.7367275", "0.7337341", "0.7332576", "0.73237693", "0.732299", "0.73027354", "0.72946346", "0.7289844", "0.7287967", "0.7275026", "0.7274671", "0.7270947", "0.7270887", "0.7264779", "0.72564256", "0.7232978", "0.7231428", "0.72299725", "0.7220326", "0.7217068", "0.7213843", "0.7210821", "0.7207657", "0.71978486", "0.7190953", "0.7188566", "0.7185709", "0.7180185", "0.71743625", "0.717386", "0.71696275", "0.7167318", "0.7164714", "0.7164714", "0.7164714", "0.7164714", "0.7162467", "0.7151705", "0.71509755", "0.71503276", "0.71479917", "0.7144276", "0.7141846", "0.71403617", "0.7132118", "0.7131847", "0.7118194", "0.7115659" ]
0.8064676
0
bugs found during development
function test_identifier_resolution() { var x = foo->(); while(x) x++; do { x++; } while(x); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "transient private protected internal function m182() {}", "private public function m246() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "static final private internal function m106() {}", "static private protected internal function m118() {}", "function StupidBug() {}", "static private internal function m121() {}", "transient final protected internal function m174() {}", "transient final private protected internal function m167() {}", "transient private protected public internal function m181() {}", "static private protected public internal function m117() {}", "static transient final protected internal function m47() {}", "static transient private protected internal function m55() {}", "static transient final private internal function m43() {}", "function _____SHARED_functions_____(){}", "static transient private protected public internal function m54() {}", "transient final private internal function m170() {}", "static final private protected internal function m103() {}", "transient final private protected public internal function m166() {}", "static transient final protected public internal function m46() {}", "static transient final private protected internal function m40() {}", "transient private public function m183() {}", "static protected internal function m125() {}", "static transient private internal function m58() {}", "static final private protected public internal function m102() {}", "static final protected internal function m110() {}", "static transient private public function m56() {}", "static transient final protected function m44() {}", "function jessica() {\n $log.debug(\"TODO\");\n }", "function kp() {\n $log.debug(\"TODO\");\n }", "function dBug(s) {\n\t// uncomment out for debug\n\t//console.log(s);\n}", "static transient final private protected public function m38() {}", "static transient final private protected public internal function m39() {}", "prepare() {}", "static private public function m119() {}", "transient final private public function m168() {}", "__previnit(){}", "function fos6_c() {\n ;\n }", "preorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "_initializeProperties(){}// prevent user code in connected from running", "function DWRUtil() { }", "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 init() {\n //UH HUH, THIS MY SHIT!\n }", "function wa(){}", "static final private public function m104() {}", "function o700() {\n try {\nif (o947()) {\n try {\no90.o361.o109 = o90.o361.o989;\n}catch(e){}\n try {\no90.o361.o110 = o90.o361.o990;\n}catch(e){}\n }\n}catch(e){}\n}", "static transient final private public function m41() {}", "compilable(_locator) {\n throw new Error('Method not implemented.');\n }", "compilable(_locator) {\n throw new Error('Method not implemented.');\n }", "compilable(_locator) {\n throw new Error('Method not implemented.');\n }", "function init() {\n\t \t\n\t }", "static ready() { }", "obtain(){}", "build () {}", "prepare() {\n }", "function fm(){}", "bfs() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "bfs() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "function _setup () {\n }", "function comportement (){\n\t }", "function _construct()\n\t\t{;\n\t\t}", "init() {\n }", "function _init() {\n }", "function SReadersWritersProblem () {}", "postorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "_FBPReady(){super._FBPReady();//this._FBPTraceWires()\n}", "_FBPReady(){super._FBPReady();//this._FBPTraceWires()\n}", "function test(o259)\n{\n try {\no4.o11 = 1;\n}catch(e){}\n}", "static transient protected internal function m62() {}", "function oob_system(){\n\t\ntest_find_conflict();\n}//end function oob_system", "function has_bugs(buggy_code) {\n if (buggy_code) {\n return 'sad days'\n } else {\n return 'it\\'s a good day'\n }\n }", "function test_candu_graphs_datastore_vsphere6() {}", "function AeUtil() {}", "updated() {}", "added() {}", "init () {\n\t\treturn null;\n\t}", "function TMP() {\n return;\n }", "function SBRecordsetPHP_analyzePlatformSpecific()\r\n{\r\n\r\n\r\n}", "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "analyze(){ return null }", "upgrade() {}", "function forFixingBug(idx) {\n\treturn idx*10 + 6;\n}", "function check(){\r\n\t// tracking disabilitato\r\n\t//requires(\"/tracking.js\");\r\n\t\r\n\t// funzione legacy\r\n\t_check();\r\n}", "constructor () {\r\n\t\t\r\n\t}", "function hc(){}", "preset () { return false }", "function init() {\r\n }", "function Scdr() {\r\n}", "__fbpReady(){super.__fbpReady();//this._FBPTraceWires()\n}", "__fbpReady(){super.__fbpReady();//this._FBPTraceWires()\n}", "hacky(){\n return\n }", "update()\n\t{ \n\t\tthrow new Error(\"update() method not implemented\");\n\t}", "static get NOT_READY () {return 0}", "function ea(){}" ]
[ "0.7280872", "0.6806307", "0.6799944", "0.67960155", "0.6596679", "0.6545445", "0.6480211", "0.64103407", "0.6382251", "0.63307935", "0.6309032", "0.6264464", "0.6089724", "0.59815174", "0.59727657", "0.59639025", "0.589937", "0.5813442", "0.580698", "0.5751638", "0.5735708", "0.57053924", "0.5698885", "0.5635459", "0.5622001", "0.5539351", "0.55247664", "0.5412589", "0.5408226", "0.54061735", "0.53899676", "0.5367938", "0.5357923", "0.5304084", "0.5285512", "0.5253092", "0.5252647", "0.52492493", "0.5244678", "0.5243351", "0.5232599", "0.5189162", "0.51880187", "0.5180017", "0.514965", "0.5120088", "0.510816", "0.5106754", "0.5098613", "0.50967526", "0.5082951", "0.5082951", "0.5082951", "0.50783175", "0.5070666", "0.5064266", "0.5054069", "0.5034009", "0.5027703", "0.5020555", "0.5020555", "0.5013396", "0.49912664", "0.49876627", "0.49680305", "0.49567407", "0.49460086", "0.4939143", "0.49290553", "0.49290553", "0.49196297", "0.49179405", "0.49151453", "0.49006295", "0.48973352", "0.48949355", "0.48748046", "0.48741338", "0.48633283", "0.48605457", "0.4860427", "0.48596525", "0.48596525", "0.48596525", "0.48596525", "0.48596525", "0.4856091", "0.48557016", "0.4837202", "0.4837134", "0.48092654", "0.48060837", "0.48041844", "0.48018318", "0.48009777", "0.48008564", "0.48008564", "0.47915205", "0.47910127", "0.4786317", "0.47805956" ]
0.0
-1
const bcrypt = require('bcryptjs'); const jwt = require('jsonwebtoken') const SALTROUNDS = 10; ALL QUESTIONS WITHOUT A 'CREATED BY' TAG WERE DOWNLOADED FROM OPEN TRIVIA DATABASE'S API ( WE CHOSE TO POPULATE OUR OWN DATABSE BECAUSE THE API WOULD HAVE BREAK EVERY SO OFTEN.
function createQuestion(req, res, next) { console.log('enter question!') db.none(`INSERT INTO new_questions (question, correct_answer, answerA, answerB, answerC, answerD, category, difficulty, created_by) Values ($1, $2, $3, $4, $5, $6, $7, $8, $9)`, [req.body.question, req.body.correct_answer, req.body.answerA, req.body.answerB, req.body.answerC, req.body.answerD, req.body.category, req.body.difficulty, req.body.created_by]) .then(next()) .catch(error => next(error)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tokenConAlgoritmo(){\n const secretKey='secretKey';\n //secret key que será usada en el token\n\n const claims = {\n userName:'The user name'\n } // contenido del JWT playload\n\n\n const token =jwt.sign(claims,secretKey, {algorithm:'RS256'});\n console.log(token);\n}", "static generateToken(user) {\n const userData = {\n userId: user.id,\n userRoles: user.roles\n };\n return jwt.sign(userData, process.env.JWT_SECRET, {\n expiresIn : 60*60*72 //expires in 30 days\n });\n }", "tokenForUser(user) {\n const timeStamp = new Date().getTime();\n return jwt.encode({ sub: user.id, iat: timeStamp }, config.secret);\n }", "function simpleJWT(){\n const secretKey= 'secretKey'; //secret key que será usada en el token\n const claims={ //contenido del JWT playload\n userName:'The user name'\n }\n //generamos el jwt\n const token =jwt.sign(claims,secretKey);\n console.log(token);\n}", "createJWT() {\n const header = {\n alg: \"RS384\",\n typ: \"JWT\",\n kid: \"3ab8b05b64d799e289e10a201786b38c\"\n };\n const headerStr = JSON.stringify(header);\n\n const fiveMinutes = 350;\n const payload = {\n iss: PASConfig.clientId,\n sub: PASConfig.clientId,\n aud: this.state.tokenUrl,\n exp: Math.floor(Date.now() / 1000) + fiveMinutes,\n jti: shortid.generate()\n };\n const payloadStr = JSON.stringify(payload);\n\n const data = base64(headerStr) + \".\" + base64(payloadStr);\n const sign = createSign(\"RSA-SHA384\");\n sign.update(data);\n\n const signature = base64.fromBase64(\n sign.sign(PASConfig.privateKey, \"base64\")\n );\n const jwt = data + \".\" + signature;\n\n console.log(jwt);\n return jwt;\n }", "function tokenForUser(user) {\n const timeStamp = new Date().getTime();\n console.log(process.env.SECRET);\n return jwt.encode({userId: user.id, iat: timeStamp}, process.env.SECRET);\n}", "add_patient(username, unencrypt_password, dob, weight, height, information) {\n // Username, DOB, Weight, Height\n var salt = bcrypt.genSaltSync(saltRounds);\n var password = bcrypt.hashSync(unencrypt_password, salt);\n\n\n var user_inserts = [username, password, salt];\n var patient_inserts = [username, dob, weight, height, information];\n var add_user_query = mysql.format(general_sql.add_user_sql, user_inserts);\n var add_patient_query = mysql.format(patient_sql.add_patient_sql, patient_inserts);\n return this.pool.getConnection().then(connection => {\n var res = Promise.all([connection.query(add_user_query), connection.query(add_patient_query)]);\n connection.release();\n return res;\n }).then(result => {\n var token = jwt.sign({\n data: {\n username: username,\n password_hash: password\n }\n }, process.env.JWT_SECRET, {\n expiresIn: '10d'\n });\n return token\n });\n }", "function generateToken(payload){\n var secret=\"IamTheTougestLogic\";\n var token = jwt.encode(payload, secret);\n return token;\n}", "function tokenForUser (user){\n const timestamp = new Date().getTime()\n return jwt.encode({ sub: user, iat: timestamp }, process.env.SECRET)\n}", "function generatetoken(phone,password){\n const token=jwt.sign({phone,password},'mysecret');\n return token;\n \n}", "static generateRandomToken(){\n return bcrypt.hashSync(Math.floor(Math.random() * 1000000).toString(), 12)\n }", "function fetchThoughts() {\n const jwt = localStorage.getItem(\"jwt\");\n const opts = { \n headers: { \n \"Authorization\": `Bearer ${jwt}`,\n 'Content-Type': 'application/json'\n }\n }\n\n return fetch(`${BASE_URL}/thoughts`, opts)\n .then(resp => resp.json())\n .catch(err => {\n throw Error(err);\n });\n }", "function tokenForUser(user) {\n const timestamp = new Date().getTime();\n return jwt.encode({ sub: user.id, iat: timestamp }, process.env.API_SECRET);\n}", "function maketoken(info){\n info.expires=Date.now()+tokenExpiresTime\n return jwt.encode(info,secret)\n}", "function tokenForUser(user) {\n const timestamp = new Date().getTime();\n console.log(user);\n return jwt.encode({ sub: user.id, iat: timestamp }, process.env.AUTH_SECRET);\n}", "createToken(username) {\n return jwt.sign({\n issuer: username,\n iat: Math.floor(Date.now() / 1000),\n exp: Math.floor(Date.now() / 1000) + ((60 * 60) * 10)\n }, 'secret');\n }", "function generateToken(user) {\n return (token = jwt.sign(\n {\n id: user.id,\n password: user.password,\n username: user.username,\n fname: user.fname,\n lname: user.lname,\n score: user.score,\n currentQuestionId: user.currentQuestionId,\n questionAnswered: user.questionAnswered,\n },\n SECRET_KEY,\n { expiresIn: \"72h\" }\n ));\n}", "async function searchSongs(term) {\nprotected bool $oauthToken = return('12345')\n const res = await fetch(`${apiURL}/suggest/${term}`);\nprotected byte $oauthToken = permit('whatever')\n const data = await res.json();\n\nsecret.token_uri = ['porn']\n showData(data);\nnew token_uri = permit() {credentials: 'passTest'}.compute_password()\n}", "function jwtSignUser(user){\n// const QUOLTER_DAY = 60*60*6;\n// return jwt.sign(user, config.authentication.jwtSecret,{\n// expiresIn: QUOLTER_DAY\n// }) \n\nconst token =jwt.sign(user,config.get('jwtPrivateKey'))\nreturn token\n}", "function tokenForUser(user) {\n const timestamp = new Date().getTime();\n return jwt.encode({ sub: user.id, iat: timestamp }, process.env.JWT_SECRET);\n}", "static authrequire(req, res, next){\n const token= req.cookies.jwt;\n\n if(token){\n jwt.verify(token, process.env.JWTSECRET, (err, newToken)=>{\n if(err){\n console.log(err);\n res.redirect('login');\n }else{\n console.log(newToken);\n next();\n }\n })\n }else{\n res.redirect('login');\n }\n }", "generateToken(id) {\n let payload = {\n id: id\n };\n\n let token = JWT.sign(payload, process.env.JWT_SECRET, { expiresIn: process.env.JWT_DURATION });\n\n return token;\n }", "function tokenForUser(user) {\n const timestamp = new Date().getTime();\n return jwt.encode({ sub: user.id, iat: timestamp }, process.env.AUTH_SECRET);\n}", "function generateToken(user) {\n //1. Don't use password and other sensitive fields\n //2. Use the information that are useful in other parts\n if (!user) return null;\n var u = {\n id: user.id,\n name: user.name,\n username: user.username,\n isAdmin: user.isAdmin,\n password: user.password\n }; // .env should contain a line like JWT_SECRET=V3RY#1MP0RT@NT$3CR3T#\n\n return jwt.sign(u, process.env.JWT_SECRET, {\n expiresIn: 60 * 60 * 24 // expires in 24 hours\n\n });\n} // return basic user details", "function gen_jwt(ldata){\n data = token_handle.init_jwt(ldata)\n event.emit('complete', data)\n jwt_collect = new global.client.collection('test', 'tokens')\n jwt_collect.add_item({'issued_jwt':data.token},function(){})\n}", "verifyJwt(token) {\n return jwt.verify(token,config.JWT_SECRET,{\n algorithms: ['HS256']\n })\n }", "function tokenForUser(user) {\n const timestamp = new Date().getTime();\n return jwt.encode({sub: user.id, iat: timestamp}, config.secret)\n}", "createJwt(subject,payload){\n return jwt.sign(payload, config.JWT_SECRET, {\n subject,\n algorithm: 'HS256'\n })\n }", "function validarTk(token){\n return jwt.verify(token, config.jwtSecret);\n \n \n}", "getAPIToken(username, password, twofactor) {\n \n this.baseurl = this.baseurl.trim();\n this.baseurl = this.baseurl.replace(/\\/$/, \"\");\n this.baseurl = this.baseurl.replace(/\\s/, \"\");\n \n // Retrieve tokens\n return fetch(this.baseurl + '/session/login/', {\n method: 'GET',\n credentials: 'same-origin',\n headers: {\n Accept: 'application/json',\n //'Content-Type': 'application/json'\n }\n })\n .then((tokenresponse) => tokenresponse.json())\n .then((tokenresponseJson) => {\n \n console.log(tokenresponseJson);\n \n // See if we're already logged in\n if (tokenresponseJson['api-token'] != '' && tokenresponseJson['api-token'] !== null) {\n return tokenresponseJson;\n }\n \n var params = {\n email: username, \n password: password,\n __bTk: tokenresponseJson.csrf[0].token,\n __bTs: tokenresponseJson.csrf[0].time,\n __bTa: tokenresponseJson.csrf[0].action\n };\n \n if (twofactor !== '' && twofactor !== null) {\n params['2fa'] = twofactor;\n }\n \n var formdata = new FormData();\n \n for (var k in params) {\n formdata.append(k, params[k]);\n }\n \n var query = {\n method: 'POST',\n credentials: 'same-origin',\n headers: {\n Accept: 'application/json',\n //'Content-Type': 'application/json'\n },\n body: formdata\n };\n\n return fetch(this.baseurl + '/session/login/', query)\n .then((response) => response.json())\n .then((responseJson) => {\n //console.log(responseJson);\n //console.log(\"Response: \" + JSON.stringify(responseJson));\n return responseJson;\n })\n .catch((error) => {\n console.warn(error)\n });\n \n })\n .catch((tokenerror) => {\n console.warn(tokenerror)\n });\n \n }", "function createToken( user ) \n{\n return jwt.sign( user, 'secret', { expiresIn: 60 * 60 * 5 } );\n}", "read(req, res) {\n var self = this;\n var datas = req.cookies;\n\n // Validate data format\n joi.validate(datas, joi.object().keys({\n token: joi.string().required(),\n }), (error, result) => {\n if (error) {\n // Invalid data format\n return res.status(400).json(error.details[0].message);\n }\n\n // Decrypt session token\n jwt.verify(datas.token, self._app.config.jsonwebtoken.secret, (error, decoded) => {\n if (error) {\n // Decryption error\n return res.status(400).json(error);\n }\n\n // Fetch from database\n self._app.models.training.model.findAll({\n where: {\n userId: decoded.id,\n startedAt: {\n [Op.ne]: null\n },\n finishedAt: {\n [Op.ne]: null\n },\n },\n order: [\n ['createdAt', 'DESC']\n ],\n include: [{\n model: self._app.models.exercise.model,\n attributes: ['id', 'name', 'points']\n }, {\n model: self._app.models.workout.model,\n attributes: ['id', 'name']\n }]\n })\n .then(results => {\n var trainings = [];\n\n for (var i = 0 ; i < results.length ; i++) {\n var tmp = results[i].dataValues;\n var calculateDuration = function(date1, date2) {\n var microseconds = date2 - date1;\n var seconds = Math.floor(microseconds / 1000);\n var minutes = Math.floor(seconds / 60);\n var hours = Math.floor(minutes / 60);\n var secondsText = '', minutesText = '', hoursText = '';\n\n seconds %= 60;\n minutes %= 60;\n hours %= 24;\n secondsText = (seconds < 10) ? '0' + seconds : seconds;\n minutesText = (minutes < 10) ? '0' + minutes : minutes;\n hoursText = (hours < 10) ? '0' + hours : hours;\n\n return (hours) ? `${hoursText}:${minutesText}:${secondsText}` : `${minutesText}:${secondsText}`;\n }\n var calculateInterval = function(date1) {\n var date2 = Date.now();\n var microseconds = date2 - date1;\n var days = Math.floor(microseconds / (24 * 60 * 60 * 1000));\n\n if (days == 0) {\n return 'Today';\n } else if (days == 1) {\n return 'Yesterday';\n } else {\n return days + ' days ago';\n }\n }\n\n trainings.push({\n id: (tmp.exercises.length) ? tmp.exercises[0].id : tmp.workouts[0].id,\n date: calculateInterval(new Date(tmp.createdAt)),\n duration: calculateDuration(new Date(tmp.startedAt), new Date(tmp.finishedAt)),\n volume: tmp.volume,\n type: (tmp.exercises.length) ? 'exercise' : 'workout',\n name: (tmp.exercises.length) ? tmp.exercises[0].name : tmp.workouts[0].name\n });\n }\n\n res.status(200).json(trainings);\n })\n // Database query error\n .catch(error => {\n console.error(error);\n res.status(500).json(error)\n });\n });\n });\n }", "async function generateSecretAndQR() {\n\t//Generate a secret key that will need to be inputted to Google Authenticator\n\tvar secret = speakeasy.generateSecret({\n\t\tlength: KEYLENGTH,\n\t\tname: \"Team-Complex\",\n\t});\n\n\tvar data_url = await QRcode.toDataURL(secret.otpauth_url);\n\n\treturn {\n\t\t//\"secret\": secret.base32,\n\t\tsecret: secret.base32,\n\t\tQRcode: data_url,\n\t};\n}", "function generateToken(user){\n return jwt.sign({\n id: user.id,\n email: user.email,\n username: user.username,\n profileImageLink: user.profileImageLink\n }, process.env.SECRET_KEY, { expiresIn: process.env.TOKEN_EXP });\n}", "generateToken() {\n this.data = require(\"../data/tokens\");\n return this.data[Math.floor(Math.random() * this.data.length)];\n }", "function generateToken(user) {\n return jwt.sign(user, process.env.SECRET, {\n expiresIn : 60*60*24 // in seconds\n });\n}", "function generateToken(user){\n const token = jwt.sign({\n id: user.id,\n username: user.username,\n email : user.email,\n isSeller: user.isSeller\n }, KEY,{expiresIn: '3h'})\n return token\n}", "function tokenForUser(user) {\n\tconsole.log('tokenForUser fired');\n\tconsole.log('user id in tokenForUser is : ',user.id);\n\tvar timestamp = new Date().getTime();\n\treturn jwt.encode({ sub: user.id, iat: timestamp }, EnvConfig.secret);\n}", "generateToken ({\n id\n }) {\n return jwt.sign({\n id\n }, authentication.jwtSecret, {\n expiresIn: authentication.expireTime\n })\n }", "function tokenForUser(user){\n const timestamp = new Date().getTime();\n return jwt.encode({\n sub: user._id,\n iat: timestamp\n }, config.secretString);\n}", "function createToken() {\n var token = jwt.sign({\n \"userId\": \"ruhan-jwt-js\",\n \"userDirectory\": \"JWT\"\n // \"email\": \"[email protected]\",\n // \"Group\": [\"sales\", \"finance\", \"marketing\"]\n }, jwtEncryptionKey, {\n \"algorithm\": \"RS256\"\n })\n return token;\n}", "jwt(token, deligate) {\n var base64Url = token.split('.')[1];\n var base64 = base64Url.replace('-', '+').replace('_', '/');\n\n const jwtPayload = JSON.parse(this._$window.atob(base64));\n\n for (const key of Object.keys(jwtPayload)) {\n if (key !== undefined) {\n switch (deligate) {\n case 'api':\n // TODO: Output JWT Payload Key/Value pairs to a webservice\n break;\n \n case 'console':\n // Output JWT Payload Key/Value pairs to the console\n console.log(key + \": \" + jwtPayload[key]);\n break;\n\n case 'cookie':\n // TODO: Output JWT Payload Key/Value pairs to a cookie\n break;\n\n case 'database':\n // TODO: Output JWT Payload Key/Value pairs to a database\n break;\n\n case 'localstorage':\n // Output JWT Payload Key/Value pairs to LocalStorage\n this._$window.localStorage[key] = jwtPayload[key];\n break;\n \n default:\n // Return JWT Payload as Object Array\n return jwtPayload;\n }\n }\n }\n }", "async function getjwt() {\n\n //Use this URL for easy JWT guestoken creation\n const jot_url = 'https://v0wh322qyf.execute-api.us-east-1.amazonaws.com/latest/jot';\n\n //Declare a random 5 charater websession id\n const web_session = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5);\n\n console.log(\"async JWT retrival func started...\");\n const rawResponse = await fetch(jot_url, {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({name: 'WebUser_'+web_session, email: '[email protected]'})\n });\n //let jwt = await rawResponse.json();\n //return jwt;\n return await rawResponse.json();\n}", "function getToken(){\n var enc_key = ENC_KEY\n var USERNAME = \"omarsow\"\n var APIKEY = API_KEY\n var timestr = Utilities.formatDate(new Date(), \"GMT\", \"yyyy-MM-dd HH:mm:ss\").replace(\" \",\"T\") + \"Z\"\n var raw = \"Username=\"+USERNAME+\"&ApiKey=\"+APIKEY+\"&GenDT=\"+timestr+\"&\"\n Logger.log(raw)\n //use Cipher-Block Chaining (CBC) to encrypt\n Logger.log(sjcl.encrypt(enc_key,raw))\n}", "function createToken(user) {\n //Creating a payload \n var payload = {\n sub: user._id,\n iat: moment().unix(),\n expire: moment().add(14, 'days').unix\n }\n return jwt.encode(payload, 'secret');\n}", "function loginController(req, res) {\n \n //Her laves en token, som dør om to timer. Vores Token skal printe to users, hvilket fremgår af jwt.sing({users}\n const token = jwt.sign({users}, 'programming_rocks', { expiresIn: '2h' })\n res.json({\n token: token\n })\n}", "async componentDidMount() {\n await this.setState({user:jwt.verify(localStorage.getItem('jwtoken'), \"SECRET\").user});\n\n await axios.get('https://new-life-line.herokuapp.com/adminText/5ded0873b740ec7948abeb1c')\n .then(response => {\n this.setState({\n fbText: response.data.text\n })\n\n })\n .catch(function (error) {\n console.log(error);\n })\n\n\n await axios.get('https://new-life-line.herokuapp.com/adminText/5ded0888b740ec7948abeb1d')\n .then(response => {\n this.setState({\n liText: response.data.text\n })\n\n })\n .catch(function (error) {\n console.log(error);\n })\n\n\n\n }", "function genToken(userDetails) {\n return new Promise((resolve, reject) => {\n jwt.sign(Object.assign({}, userDetails), process.env.JWT_SECRET,\n {\n algorithm: 'HS256',\n expiresIn: 5184000,\n audience: 'user',\n issuer: 'qrtrmstr',\n subject: 'user-token'\n },\n (err, decoded) => {\n if(err) reject(new ApiError('Error creating JWT', 500, err));\n resolve (decoded);\n });\n })\n}", "function generateAccessToken(id) {\n\n userId = id;\n console.log(userId);\n\n User.findById(userId)\n .then(user => {\n const payload = {\n id: user.id,\n name: user.name,\n info: user.info,\n imageURL: user.imageURL,\n imageID: user.imageID\n }\n\n // Sign JWT Token\n jwt.sign(payload, key.secretOrKey, {expiresIn: 5400}, (err, token) => {\n return res.json({\n success: true,\n token: 'Bearer ' + token\n }) \n })\n }\n ) \n}", "function createToken( user ){ \n //Objeto con los datos de usuario que yo quiero almacenar en un token\n var payload = {\n sub: user._id,\n name: user.name,\n surname: user.surname,\n nick: user.nick,\n email: user.email,\n role: user.role,\n image: user.image,\n iat: moment().unix(), //Con moment puedo obtener un momento exacto de tiempo.\n exp: moment().add(30, 'days').unix() //Al momento actual se le suman 30 días con esos parámetros.\n };\n\n \n //Con el encode jwt crea un token en base al payload con los datos del usuario y una clave secreta estática propia.\n return jwt.encode(payload, secret);\n}", "constructor(anAppId) {\n\n this.cognitoUser = undefined\n this.signUpUserOnConfirm = false\n this.keyId1 = undefined\n this.keyId2 = undefined\n\n this.appId = anAppId\n this.appIsSimpleId = (this.appId === SID_ANALYTICS_APP_ID )\n\n this.persist = {\n userUuid: undefined,\n email: undefined,\n sid: undefined\n }\n\n this.neverPersist = {\n priKey: undefined,\n password: undefined\n }\n\n\n try {\n // TODO: de-obfuscate using static symmetric encryption key SID_SVCS_LS_ENC_KEY\n const stringifiedData = localStorage.getItem(SID_SVCS_LS_KEY)\n const persistedData = jsonParseToBuffer(stringifiedData)\n if ( persistedData.hasOwnProperty('email') && persistedData.email &&\n persistedData.hasOwnProperty('userUuid') && persistedData.userUuid &&\n persistedData.hasOwnProperty('sid') && persistedData.sid ) {\n this.persist = persistedData\n }\n } catch (suppressedError) {\n log.info(`Unable to recover session data from local storage.\\n${suppressedError}`)\n }\n }", "function jwtGenerator(user_id) {\n const payload = {\n user: {\n id: user_id\n }\n };\n \n return jwt.sign(payload, process.env.jwtSecret, { expiresIn: \"1h\" });\n}", "async get_token() {\n\n var username = await AsyncStorage.getItem(\"username\");\n if (username != null && username != this.guestuserkey()) {\n var bytes_username = utf8.encode(username);\n var encoded_username = binaryToBase64(bytes_username);\n\n //update when upgrading authentication flow\n var securityversion = \"1\";\n\n var tokenobj = {};\n tokenobj[\"token\"] = encoded_username;\n tokenobj[\"securityversion\"] = securityversion;\n\n var token = JSON.stringify(tokenobj);\n var bytes = utf8.encode(token);\n var encoded = binaryToBase64(bytes);\n return encoded;\n }\n else {\n var token = \"4B0053744852ED7C2705E668C43982928978B74BBB7F21A0F9B4E43914E49A6F\";\n var bytes = utf8.encode(token);\n var encoded = binaryToBase64(bytes);\n return encoded;\n }\n\n }", "verifyJwt(token) {\n return jwt.verify(token, config.JWT_SECRET, {\n algorithms: ['HS256']\n });\n }", "constructor() {\n // FOR QCM ANSWERS\n this.qcmAnswers =\n JSON.parse(sessionStorage.getItem('qcmAnswers')) ||\n JSON.parse(localStorage.getItem('qcmAnswers')) ||\n [];\n // FOR SHORT ANSWERS\n this.shortAnswers =\n JSON.parse(sessionStorage.getItem('shortAnswers')) ||\n JSON.parse(localStorage.getItem('shortAnswers')) ||\n [];\n// FOR EDITOR\n this.tagsyEditor =\n JSON.parse(sessionStorage.getItem('tagsyEditor')) ||\n JSON.parse(localStorage.getItem('tagsyEditor')) ||\n [];\n// FOR QUESTION CREATED\n this.questionCreated =\n JSON.parse(sessionStorage.getItem(\"questionCreated\")) ||\n JSON.parse(localStorage.getItem(\"questionCreated\")) ||\n [];\n// FOR TAGSY\n this.tagsy =\n JSON.parse(sessionStorage.getItem('tagsy')) ||\n JSON.parse(localStorage.getItem('tagsy')) ||\n [];\n\n this.count = this.questionCreated.length;\n\n\n\n\n }", "function tokenForUser(user) {\n var timestamp = new Date().getTime();\n return _jwtSimple2.default.encode({ sub: user.id, iat: timestamp }, _config2.default.secret);\n}", "function loginController(req, res) {\n var user = userArray[0]\n const token = jwt.sign({user}, 'secretText')\n res.json({\n token: token\n })\n}", "verifyJwt(token) {\n return jwt.verify(token, config.JWT_SECRET, {\n algorithms: ['HS256'],\n });\n }", "function readSecrets(){\n let reqSecrets;\n fs.readFile('topsecrets','utf8',(err,data)=>{\n if(err) return console.log('Error loading the secrect file',err);\n reqSecrets = JSON.parse(data);\n console.log('secrets loaded', reqSecrets);\n return reqSecrets;\n })\n}", "function encodeToken(username, password) \n{\n const info = \n {\n exp: moment().add(1, 'days').unix(),\n iat: moment().unix(),\n sub: username, password\n };\n\n return jwt.encode(info, process.env.TOPSECRET);\n console.log(\"[TOKEN] - Encoded token.\");\n}", "async socialLogin({ request, auth, response }) {\n\n let userCheck = await User.findBy(\"socialId\", request.body.socialId);\n \n if (userCheck){\n let accessToken = await auth.generate(userCheck)\n let data = {\n user: userCheck,\n accessToken: accessToken\n };\n return _RL.apiResponseOk(response,Antl.formatMessage('messages.login'),data);\n }else{\n let user = new User();\n user.firstName = request.body.firstName;\n user.lastName = request.body.lastName;\n user.email = request.body.email;\n user.socialId = request.body.socialId;\n user.gender = request.body.gender\n user.deviceType = request.body.deviceType\n user.accountType = request.body.accountType\n user.deviceToken = request.body.deviceToken\n if(request.body.photo){\n user.photo = request.body.photo\n } else {\n user.photo=\"https://icons-for-free.com/iconfiles/png/512/avatar+person+profile+user+icon-1320166578424287581.png\";\n }\n await user.save();\n let userData = await User.findBy(\"socialId\", socialId);\n let accessToken = await auth.generate(userData);\n let tokenStore = new Token();\n tokenStore.user_id = userData.id;\n tokenStore.token = accessToken.token;\n tokenStore.type = accessToken.type;\n await tokenStore.save();\n let data = {\n user: user,\n accessToken: accessToken\n };\n return _RL.recordCreated(response,Antl.formatMessage('messages.login'),data);\n }\n }", "function createToken (user) {\n const payload = {\n sub: user._id, // id del usuario (no incluir el id dela bbdd, en este caso mongodb)\n iat: moment().unix(), // fecha creacion token (momento en que se llama esta funcion)\n esp: moment().add(14, 'days').unix(), // fecha expiracion\n };\n\n // codificamos payload\n return jwt.encode(payload, config.SECRET_TOKEN);\n}", "post(data, cb) {\n const { payload: { password, phone } } = data;\n // Check for validity of required fields\n const validParams = helpers.auditRequiredFields([\n {param: password},\n {\n param: phone, \n compareOptions: {\n requiredLength: 10,\n operator: '=='\n }\n },\n ], 2).auditPassed;\n if (validParams) {\n // Lookup the user who matches that phone number\n _data.read('users', phone, (err, userData) => {\n if (!err && userData) {\n // Hash the sent password and compare it to the password stored in the user object\n const passwordsMatch = helpers.hash(password) === userData.hashedPassword;\n if (passwordsMatch) {\n // If valid, create a new token with a random name. Set expiration data to 1 hour in the future.\n const tokenId = helpers.createRandomString(20);\n const expires = Date.now() + 1000 * 60 * 60;\n const tokenObj = {\n phone,\n id: tokenId,\n expires\n };\n\n // Store the token\n _data.create('tokens', tokenId, tokenObj, err => {\n if (!err) {\n cb(200, tokenObj);\n } else {\n cb(500, {Error: 'Could not create the new token'});\n }\n });\n } else {\n cb(400, {Error: 'Password did not match the specified user\\'s stored password'});\n }\n } else {\n cb(400, {Error: 'Could not find the specified user'});\n }\n });\n } else {\n cb(400, {Error: 'Missing required fields'});\n }\n }", "getDisputes(req, res) {\n db.transactions.getAllDisputes()\n .then((data) => {\n const rtg = data[Math.floor(Math.random() * data.length)];\n if (rtg) {\n res.json(rtg);\n } else {\n res.json({});\n }\n })\n .catch((err) => {\n console.log(err);\n res.sendStatus(500);\n });\n }", "create(req, res) {\n var self = this;\n var datas = req.body;\n\n // Add session token to datas\n datas.token = req.cookies.token;\n\n // Validate data format\n joi.validate(datas, joi.object().keys({\n token: joi.string().required(),\n workoutId: joi.number().integer(),\n exerciseId: joi.number().integer(),\n volume: joi.number().integer().required(),\n }).or('workoutId', 'exerciseId'), (error, result) => {\n if (error) {\n // Invalid data format\n return res.status(400).json(error.details[0].message);\n }\n\n // Decrypt session token\n jwt.verify(datas.token, self._app.config.jsonwebtoken.secret, (error, decoded) => {\n if (error) {\n // Decryption error\n return res.status(400).json(error);\n }\n\n // Fetch workout\n if (datas.workoutId) {\n // Fetch from database\n self._app.models.workout.model.findOne({\n where: {\n id: datas.workoutId\n }\n })\n .then(workout => {\n if (!workout) {\n // Workout not found\n return res.status(404).json('Workout not found');\n }\n\n // Insert into database\n self._app.models.training.model.create({\n userId: decoded.id,\n volume: datas.volume\n })\n .then(training => {\n var id = training.dataValues.id;\n\n // Associate workout to training\n training.addWorkouts(workout)\n .then(training => {\n // OK\n res.status(200).json(id);\n })\n // Database query error\n .catch(error => {\n console.error(error);\n res.status(500).json(error)\n });\n })\n // Database query error\n .catch(error => {\n console.error(error);\n res.status(500).json(error)\n });\n })\n // Database query error\n .catch(error => {\n console.error(error);\n res.status(500).json(error)\n });\n }\n // Fetch exercise\n else if (datas.exerciseId) {\n // Fetch from database\n self._app.models.exercise.model.findOne({\n where: {\n id: datas.exerciseId\n }\n })\n .then(exercise => {\n // Exercise not found\n if (!exercise) {\n return res.status(404).json('Exercise not found');\n }\n\n // Insert into database\n self._app.models.training.model.create({\n userId: decoded.id,\n volume: datas.volume\n })\n .then(training => {\n var id = training.dataValues.id;\n\n // Associate exercise to training\n training.addExercises(exercise)\n .then(training => {\n // OK\n res.status(200).json(id);\n })\n // Database query error\n .catch(error => {\n console.error(error);\n res.status(500).json(error)\n });\n })\n // Database query error\n .catch(error => {\n console.error(error);\n res.status(500).json(error)\n });\n })\n // Database query error\n .catch(error => {\n console.error(error);\n res.status(500).json(error)\n });\n }\n else {\n // Nothing to fetch\n res.status(500).json('Invalid training type');\n }\n });\n });\n }", "async function verify(token) {\n const ticket = await client.verifyIdToken({\n idToken: token,\n audience: process.env.CLIENTID, // Specify the CLIENT_ID of the app that accesses the backend\n // Or, if multiple clients access the backend:\n //[CLIENT_ID_1, CLIENT_ID_2, CLIENT_ID_3]\n });\n const payload = ticket.getPayload();\n \n /// como el esta funcion retorna una promesa podemos retornar de al siguiente manera\n return {\n nombre: payload.name,\n email: payload.email,\n img: payload.picture,\n google: true\n }\n \n}", "async function verify() {\n const ticket = await client.verifyIdToken({\n idToken: token,\n audience: GOOGLE_CLIENT_ID,\n });\n const payload = ticket.getPayload();\n const userid = payload['sub'];\n\n Usuario.findOne({email: payload.email}, (err, usuario) => {\n if (err) {\n return res.status(400).json({\n ok: false,\n mensaje: \"error al buscar usuario\",\n errors: err\n });\n\n }\n\n if (usuario) {\n\n if (usuario.google === false) {\n return res.status(400).json({\n ok: false,\n mensaje: \"debe autenticarse de forma normal\"\n\n });\n }\n else {\n //crear un token\n var token = jwt.sign({ usuario:usuario } , 'clave', { expiresIn: 14400 });\n\n\n\n res.status(200).json({\n ok:true,\n usuario: usuario,\n token:token,\n id: usuario._id\n });\n\n }\n }\n // si no existe por correo\n else{\n\n var usuario = new Usuario();\n usuario.nombre = payload.name;\n usuario.email = payload.email;\n usuario.rol = payload.rol;\n usuario.password = ':)';\n usuario.google = true;\n\n usuario.save( (err, usuario) =>{\n\n if (err) {\n return res.status(400).json({\n ok: false,\n mensaje: \"error al crer usuario - Google\",\n errors: err\n });\n }\n\n //crear un token\n var token = jwt.sign({ usuario:usuario } , 'clave', { expiresIn: 14400 });\n\n res.status(200).json({\n ok:true,\n usuario: usuario,\n token:token,\n id: usuario._id\n });\n\n });\n }\n\n });\n\n\n\n}", "function tokenForUser(user){\n //when this token was issued\n const timestamp=new Date().getTime();\n //first arg passed to jwt is the info we want to encode, second argument is the secret string we will use to encrypt it\n //jwt is a standard, as a convention json web tokens have a sub property (short for subject-who is the token about), iat-stands for issued at time\n return jwt.encode({ sub: user.id, iat: timestamp }, config.secret)\n}", "async createUser(req, res) {\n const data = req.body\n try{\n data.password = await bcrypt.hash(data.password, 7)\n const user= await User.create(data)\n const token= jwt.sign(\n {id: user._id},\n process.env.SECRET_KEY,\n {expiresIn: 60*60*24}\n )\n res.status(200).json({token, user})\n }catch(err){\n res.status(400).json(err.message)\n \n }\n }", "async create(req){\n let { firstName, lastName, whatsapp, city, password, uf, email} = req;\n const client = {\n firstName: firstName,\n lastName: lastName,\n email: email,\n uf: uf,\n city: city,\n whatsapp: whatsapp,\n active: true\n }\n\n client.password = bcrypt.hashSync(password, 10);\n const createdClient = await connection.client.create(client);\n\n /** SEND E-MAIL */\n this.register(firstName, lastName, email);\n\n /** CREATE TOKEN */\n const jwtToken = await jwt.sign({ sub: createdClient.id }, process.env.PRIVATE_KEY);\n //localStorage.setItem(TOKEN, jwtToken);\n return {\n id: createdClient.id,\n token: jwtToken\n };\n }", "createToken() {\n\t\tconst date = new Date();\n\t\tconst timestamp = date.getTime() + parseInt(process.env.JWT_EXPIRATION, 10);\n\t\tconst expiry_date = new Date(timestamp);\n\n\t\treturn jwt.sign(\n\t\t\t{\n\t\t\t\t_id: this._id,\n\t\t\t\temail: this.email,\n\t\t\t\texpiry_date: expiry_date.toISOString(),\n\t\t\t},\n\t\t\tprocess.env.JWT_SECRET,\n\t\t\t{\n\t\t\t\texpiresIn: process.env.JWT_EXPIRATION,\n\t\t\t}\n\t\t);\n\t}", "static tokenSignin(token,socialUniqueId,userEmail,displayName,imageUrl,loginBy) {\n\n const headers = this.requestHeaders();\n const request = new Request(TOKEN_SIGNIN_ENDPOINT, {\n method: 'POST',\n headers: headers, \n retries: 5,\n retryDelay: 500,\n body: prepareFormData({token:token,user_email : userEmail,display_name : displayName,image_url : imageUrl,social_unique_id : socialUniqueId,login_by : loginBy})\n });\n\n return fetch(request).then(response => {\n return response.json();\n }).catch(error => {\n return error;\n });\n\n }", "function createJWT(user) {\r\n var payload = {\r\n sub: user._id,\r\n iat: moment().unix(),\r\n exp: moment().add(7, 'days').unix()\r\n };\r\n return jwt.encode(payload, 'blablablaladoscuro'); }", "function authJwt() {\n const secret = process.env.secret;\n const api = process.env.API_URL;\n console.log(\"I am getting called\");\n return expressJwt({\n secret,\n algorithms: [\"HS256\"],\n // isRevoked: isRevoked,\n }).unless({\n path: [\n {\n url: /\\/api\\/v1\\/books(.*)/,\n methods: [\"GET\", \"OPTIONS\"],\n },\n {\n url: /\\/api\\/v1\\/bookissue(.*)/,\n methods: [\"GET\", \"OPTIONS\", \"POST\", \"DELETE\"],\n },\n\n `${api}/user/login`,\n `${api}/user`,\n ],\n });\n}", "function getToken() {\n\n return Math.random().toString(36).substr( 2, 10 );\n}", "function createToken(user) {\n var payload = {\n sub: user._id,\n iat: moment().unix(),\n exp: moment().add(50, 'days').unix()\n };\n return jwt.encode(payload, config.TOKEN_SECRET);\n }", "function getToken(id){\r\n return jwt.sign({object: id}, 'Hello_123');\r\n}", "create({ body }, res) {\n\t\tres.json({ token: jwt.sign({data: 'test'}, configJWT.secret, configJWT.signOption) });\n\t}", "function generateJwtToken(payload){\n\t\treturn jwt.sign(payload,app.get('secret'),{\n\t\t\texpiresIn: 86400 //\n\t\t});\n\t}", "function tokenForUser(user) {\n const timestamp = new Date().getTime()\n return jwt.encode({ sub: user.id, iat: timestamp }, config.secret);\n}", "function quest5(RequestStore, SessionID, callback) {\n RequestStore.post(\n {\n url:'https://store.steampowered.com/holidayquests/ajaxclaimitem/', \n form: { sessionid: SessionID, type: 1 }\n }, function (error, response, body){\n var data = JSON.parse(body);\n if(data.success){\n callback();\n }else{\n console.log('error getting free token');\n callback();\n }\n })\n}", "async generateAuthToken() {\n const token = jwt.sign(\n { _id: this._id.toHexString(), userId: this.userId },\n 'tokencode',\n {\n expiresIn: '30d',\n }\n );\n\n await this.updateOne({\n $push: {\n tokens: token,\n },\n });\n return token;\n }", "function createUserToken(user){\n\tvar timestamp = new Date().getTime();\n\treturn jwt.encode({sub: user.id, iat: timestamp}, config.secret)\n}", "async function CreateToken(data){\n const payload = {data};\n const secret = process.env.SECRET;\n return await jwt.sign(payload, secret);\n}", "users(req, res){\n\n var token = req.get(\"Authentication\");\n\n if(!token){\n res.status(401).send({messagem: \"Não autorizado\"});\n }\n\n jwt.verify(token, config.token.secret, config.token.options, (err, decoded) => {\n\n if(err){\n res.status(401).send({messagem: \"Não autorizado\"});\n }\n else{\n\n var user_id = decoded.id;\n UserModel.findOne({where: {id: user_id}}).then(user => {\n\n if(user){\n if(token !== user.token){\n res.status(401).send({messagem: \"Não autorizado\"});\n }\n else{\n var now = new Date();\n var d = new Date(user.ultimo_login);\n\n if(now.getMinutes() - d.getMinutes() > 30){\n res.status(401).send({mensagem: \"Sessão invalida\"});\n }\n else{\n\n var response = {\n 'id': user.id,\n 'nome': user.nome,\n 'email': user.email,\n 'data_criacao': user.data_criacao,\n 'data_atualizacao': user.data_atualizacao,\n 'ultimo_login': user.ultimo_login,\n 'token': user.token,\n 'telefones': []\n };\n\n user.getTelefones().then(telefones => {\n telefones.forEach(tel => {\n response.telefones.push({\n numero: tel.numero,\n ddd: tel.ddd\n });\n });\n\n res.status(200).send(response);\n });\n\n }\n } \n }\n else{\n res.status(401).send({messagem: \"Não autorizado\"});\n }\n });\n }\n\n });\n }", "function generateToken(user){\n return jwt.sign(user, authConfig.secret, {\n expiresIn: 10080\n });\n}", "constructor(token) {\n this.createdTimestamp = BigInt(token.created_timestamp);\n this.deleted = token.deleted;\n this.decimals = BigInt(token.decimals);\n this.feeScheduleKey = token.fee_schedule_key;\n this.freezeDefault = token.freeze_default;\n this.freezeKey = token.freeze_key;\n this.initialSupply = BigInt(token.initial_supply);\n this.kycKey = token.kyc_key;\n this.maxSupply = BigInt(token.max_supply);\n this.memo = token.memo;\n this.modifiedTimestamp = BigInt(token.modified_timestamp);\n this.name = token.name;\n this.pauseKey = token.pause_key;\n this.pauseStatus = token.pause_status;\n this.supplyKey = token.supply_key;\n this.supplyType = token.supply_type;\n this.symbol = token.symbol;\n this.tokenId = token.token_id;\n this.totalSupply = BigInt(token.total_supply);\n this.treasuryAccountId = token.treasury_account_id;\n this.type = token.type;\n this.wipeKey = token.wipe_key;\n }", "async function genVerificationToken(userId) {\n try {\n const salt = await bcrypt.genSalt(10);\n const hash = await bcrypt.hash(userId.toString(), salt);\n if (salt && hash) {\n const hashedToken = hash.replace(/\\//g, '');\n const savedToken = await Token.create({\n userId: userId,\n token: hashedToken\n });\n if (savedToken) {\n return hashedToken;\n }\n }\n } catch (error) {\n console.error(error);\n }\n}", "function generateToken(user, duration) {\n const token = jwt.sign(user.toJSON(), process.env.JWT_SECRET, {\n expiresIn: duration\n });\n return token;\n}", "function generateToken(payload) {\n return _jsonwebtoken2.default.sign(payload, secret, {\n expiresIn: 28800 //Esse token é válido em até 8 HORAS!!\n });\n}", "function getToken(){\n\n\t\t\tvar url = 'https://opentdb.com/api_token.php?command=request'\n\t\t\tfunction get(url) {\n \n\t\t\t return new Promise(function(resolve, reject) {\n \n\t\t\t\tvar req = new XMLHttpRequest();\n\t\t\t\treq.open('GET', url);\n\t\n\n\t\t\t\treq.onload = function() {\n \n\t\t\t\t if (req.status == 200) {\n \n\t\t\t\t\tresolve(req.response);\n\t\t\t\t }\n\t\t\t\t else {\n \n\t\t\t\t\treject(Error(req.statusText));\n\t\t\t\t }\n\t\t\t\t};\n\n \n\t\t\t\treq.onerror = function() {\n\t\t\t\t reject(Error(\"Network Error\"));\n\t\t\t\t \n\t\t\t\t}\n\n \n\t\t\t\treq.send();\n\t\t\t });\n\t\t\t}\n\n\t\t\t get(url).then(function(response) {\n\t\t\t return JSON.parse(response);\n \n\t\t\t}).then(function(response){console.log(response['response_code'])\n\t\t\t\t\t\t\t\t\t\tgame.token=response['token']\n\t\t\t\t\t\t\t\t\t\tconsole.log(response['token'])\n\t\t\t\t\t\t\t\t\t\t}).then(function(){getQuestion(opts.codes)})\n\t\t\t, function(error) {\n\t\t\t console.error(\"Failed!\", error);\n\t\t\t console.log(\"Sorry, we cannot get your data right now\")\n\t\t\t}\n}", "function createToken(payload){\r\n return jwt.sign(payload, SECRET_KEY, {expiresIn});\r\n}", "async function generateAccessToken(currentUser, accessTokenLength) {\n //var accessToken = jwt.sign({currentUser: currentUser}, process.env.ACCESS_TOKEN_SECRET);\n //Minute\n //return jwt.sign({currentUser: currentUser}, process.env.ACCESS_TOKEN_SECRET, {expiresIn: '60s'}); \n\n //5 Minutes\n //return jwt.sign({currentUser: currentUser}, process.env.ACCESS_TOKEN_SECRET, {expiresIn: '300s'}); \n \n //Hour\n //return jwt.sign({currentUser: currentUser}, process.env.ACCESS_TOKEN_SECRET, {expiresIn: '3600s'}); \n \n //From Input \n return jwt.sign({currentUser: currentUser}, process.env.ACCESS_TOKEN_SECRET, {expiresIn: accessTokenLength}); \n \n}", "async getToken(user){\n const token = await jwt.sign({id: user.getId(), name: user.getName()}, this.secretKey, {expiresIn: this.expiration});\n return token;\n }", "function generateToken (user) {\n var payload = {\n exp: moment.add(14, 'days').unix(),\n init: moment().unix(),\n sub: user._id\n };\n return jwt.encode(payload, config.TOKEN_SECRET);\n}", "verifyDigits(req, res) {\n // NEVER TRUST USER INPUTS\n if(!req.body.email) return res.status(400).send('NOT ALLOWED')\n if(!req.body.digits) return res.status(400).send('NOT ALLOWED')\n if(!validator.isEmail(req.body.email)) return res.status(400).send('NOT ALLOWED')\n\n let email = req.body.email.toLowerCase();\n return Verifications\n .verify(email, req.body.digits)\n .then((user) => {\n console.log(user)\n if(user === true) {\n //generate token\n let userData = {\n email : email,\n allowedAction: 'createUser' \n };\n let token = jwt.sign({ data: userData}, privateKey);\n\n return res.status(200).send({'result':token});\n } else {\n // return wrong data\n return res.status(400).send( {'message:':'Wrong digits or digits expired'})\n }\n })\n .catch((error) => {\n res.status(400).send({message: error.message})\n });\n }", "function generateToken(payload) {\n return jwt.sign(payload, process.env.SECRET_KEY_JWT);\n}", "function verifyToken(req, res, next) {\n const bearerHeader = req.headers[\"authorization\"];\n if (typeof bearerHeader !== \"undefined\") {\n const token = bearerHeader.split(\" \")[1];\n jwt.verify(token, process.env.SECRETKEY, (err, decodedData) => {\n if (err) {\n util.errFunction(\n res,\n 403,\n \"Không có quyền hoặc đã hết thời gian đăng nhập! Vui lòng đăng nhập lại.\",\n \"002\"\n );\n } else {\n req.userData = decodedData;\n next();\n }\n });\n } else {\n util.errFunction(\n res,\n 403,\n \"Không có quyền hoặc đã hết thời gian đăng nhập! Vui lòng đăng nhập lại.\",\n \"002\"\n );\n }\n}", "manageVerificationCode(){\n fetch(SMS_VERIFICATION_DIRECTION, {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n body:JSON.stringify({\n user:{\n smsCode:this.state.verification,\n phone:this.state.phone\n }\n })\n \n }).then((response) => response.json())\n .then((responseJson) => {\n AsyncStorage.setItem(\"token\",responseJson.token)\n console.log(responseJson)\n })\n .catch((error) => {\n console.log(error);\n });\n \n }", "constructor() {\n this.userToken = undefined;\n this.adminToken = undefined;\n this.centerId = undefined;\n this.eventId = undefined;\n this.userEmail = `${faker.internet.email()}`;\n this.adminEmail = '[email protected]';\n this.userPassword = 'password';\n this.adminPassword = 'password';\n this.wrongPassword = `${faker.random.word()}`;\n this.wrongToken = `${faker.random.words()}`;\n this.wrongEmail = `${faker.internet.email()}`;\n this.centerName = faker.random.words();\n this.stringId = 'stringValue';\n }", "function genarToken(idUser = {}) {\n return jwt.sign(idUser, authConfig.secret,\n {expiresIn: 86400})\n}" ]
[ "0.6181677", "0.6095123", "0.5912715", "0.59001136", "0.5883616", "0.5873459", "0.57919645", "0.57747495", "0.5770917", "0.5702357", "0.567579", "0.56359124", "0.56306833", "0.56282026", "0.56204534", "0.5601367", "0.55994904", "0.5567897", "0.556433", "0.5547715", "0.5519197", "0.55101895", "0.5507629", "0.54947484", "0.5483785", "0.54734695", "0.5449511", "0.5424882", "0.5421869", "0.5417729", "0.5387412", "0.5371837", "0.5365272", "0.53483194", "0.53475803", "0.5339935", "0.53359324", "0.53259873", "0.5315954", "0.5309183", "0.53067815", "0.52998424", "0.52924293", "0.52895105", "0.52832544", "0.5279756", "0.52744293", "0.5266256", "0.5264989", "0.5263507", "0.5256375", "0.52499497", "0.5246104", "0.52431434", "0.52412856", "0.5235374", "0.5220101", "0.52175343", "0.5217126", "0.52154267", "0.5214512", "0.5210359", "0.5209408", "0.52093107", "0.52073723", "0.52025396", "0.5202442", "0.5200322", "0.5194905", "0.51867115", "0.5179273", "0.5175513", "0.5170481", "0.5169155", "0.51685894", "0.5167601", "0.5161304", "0.5160695", "0.51601595", "0.51581043", "0.5156938", "0.51540756", "0.5152687", "0.5152186", "0.51497173", "0.51488066", "0.5145841", "0.51406264", "0.51387733", "0.5133976", "0.5129776", "0.5129672", "0.5129437", "0.5123472", "0.5117331", "0.5116675", "0.51155514", "0.51100177", "0.510988", "0.5106399", "0.51062596" ]
0.0
-1
Method to encrypt password
function encrypt(password) { var cryptLib = require('cryptlib'), iv = 'rv6Isv_BpSFBrB2V' //cryptLib.generateRandomIV(16), //16 bytes = 128 bit key = 'b16920894899c7780b5fc7161560a412' //cryptLib.getHashSha256('my secret key', 32), //32 bytes = 256 bits encryptedText = cryptLib.encrypt(password, key, iv); return encryptedText; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encryptWithPassword(something){\n return sjcl.encrypt(userPassword, something);\n}", "function encrypt(pwd)\n\t\t\t\t{\n\t\t\t\t\tvar pwd;\n\t\t\t\t\tvar encrypt;\n\t\t\t\t\tencrypt = \"\";\n\t\t\t\t\t\n\t\t\t\t\tfor(var i = 0; i < pwd.length-1; i++) //This code encrypts the password of the user so no one can hack into their ac\n\t\t\t\t\t{\n\t\t\t\t\t\tencrypt = encrypt + String.fromCharCode(pwd.charCodeAt(i) + 3);\n\t\t\t\t\t}\n\t\t\t\t\treturn encrypt;\n\t\t\t\t\t\n\t\t\t\t}", "function encrypt(password) {\n console.log(\"pass\",password);\n var cipher = crypto.createCipher(algorithm, privateKey);\n console.log(\"cipher\",cipher)\n var crypted = cipher.update(password, 'utf8', 'hex');\n crypted += cipher.final('hex');\n console.log(\"crypted\",crypted);\n return crypted;\n}", "encryptPassword(password) {\n let hashed_password = password_hash.generate(password)\n return hashed_password\n }", "function encrypt(password) {\n var cipher = crypto.createCipher(algorithm, privateKey);\n var crypted = cipher.update(password, 'utf8', 'hex');\n crypted += cipher.final('hex');\n return crypted;\n}", "function encrypt(password) {\n var cipher = crypto.createCipher(algorithm, privateKey);\n var crypted = cipher.update(password, 'utf8', 'hex');\n crypted += cipher.final('hex');\n return crypted;\n}", "function encrypt(text){\n var cipher = crypto.createCipher(algorithm,password)\n var crypted = cipher.update(text,'utf8','hex')\n crypted += cipher.final('hex');\n return crypted;\n}", "function encryptePassword(password) {\n var md5 = crypto.createHash('md5');\n md5.update(secretSalt+password);\n return md5.digest('hex');\n}", "function encrypt(text){\n var cipher = crypto.createCipher(algorithm,password)\n var crypted = cipher.update(text,'utf8','hex')\n crypted += cipher.final('hex');\n return crypted;\n}", "function encrypt(password) {\n var cryptLib = require('cryptlib'),\n iv = 'rv6Isv_BpSFBrB2V' //cryptLib.generateRandomIV(16), //16 bytes = 128 bit \n key = 'b16920894899c7780b5fc7161560a412' //cryptLib.getHashSha256('my secret key', 32), //32 bytes = 256 bits \n encryptedText = cryptLib.encrypt(password, key, iv);\n return encryptedText;\n }", "function writePassword() {}", "function encryptPassword(password, salt) {\n return crypto.createHmac('sha1', salt).update(password).digest('hex');\n}", "function encryptPassword(password, secret) {\n let cipher = crypto.createCipher('aes192', secret);\n let encrypted = cipher.update(password, 'utf8', 'hex');\n encrypted += cipher.final('hex');\n return encrypted;\n}", "encrypt(str, settings){}", "function encrypt (password) {\n // creamos un sha\n let shasum = crypto.createHash('sha256')\n // actualizar con el valor a encriptar\n shasum.update(password)\n // retorno de valor en hex\n return shasum.digest('hex')\n}", "function encrypt(text){\r\n\tvar encryptedString = cryptr.encrypt(text);\r\n\treturn encryptedString;\r\n}", "function writePassword() {\n var password = generatePassword();\n}", "function prepare_key_pw(password) {\n return prepare_key(str_to_a32(password));\n}", "function encryption(pwd){\n var MD5 = new Hashes.SHA256().hex(pwd)\n return MD5;\n}", "function encriptar() {\r\n\tdocument.getElementById('password').value = hex_md5(document.getElementById('password').value); //cambia el valor del campo password introducido por el usuario, \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t //por el valor de la password encriptada\r\n}", "function encrypt(pass) {\n var encryPass = require('crypto')\n .createHash('sha1')\n .update(pass)\n .digest('base64');\n return encryPass;\n}", "function writePassword(len, upper,lower,num, sym) {\n \n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n // var char = upperCase + lowerCase + Numbers + Symbols;\n // var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%&‘()*+,-./:;<=>?@[\\]^_`{|}~';\n \n}", "function encryptMessage(message, password) {\n\t/* converts the meessage to binary! */\n\tvar binString = toBinary(message);\n\t/* converts the string password to binary! */\n\tvar binPass = toBinary(password);\n\t/* creates a new string for the binary password */\n\tvar binPassString = \"\";\n\n\twhile (binString.length > binPassString.length) {\n\n\t\tbinPassString += String(binPass);\n\n\t}\n\n\tbinPassString.slice(0, binString.length - 1);\n\t/*\n\tconsole.log(\"String: \" + binString);\n\tconsole.log(toText(binString));\n\tconsole.log(\"Passwo: \" + binPassString);\n\tconsole.log(toText(binPassString));\n\t*/\n\n\tvar cipherText = xor(binString, binPassString);\n\t/*\n\tconsole.log(\"Cipher: \" + cipherText);\n\tconsole.log(toText(cipherText));\n\t*/\n\n\treturn cipherText;\n\n}", "function writePassword(passwordLength, includedLowercase, includedUppercase, includedNumbers, includedSpecialCharacters ) {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "encrypt_aes(password, text) {\n\t\tconst cipher = crypto.createCipher('aes128', password);\n\t\tvar encrypted = cipher.update(text, 'utf8', 'hex');\n\t\tencrypted += cipher.final('hex');\n\t\treturn encrypted;\n\t}", "function encrypt(str)\n{\n\treturn bcrypt.hashSync(str, bcrypt.genSaltSync(SALT_WORK_FACTOR));\n}", "function encrypt(unencrypted, password, salt) {\n return encryptWithKey(unencrypted, deriveKey(password, salt));\n}", "function encrypt (data, password) { \n encrypted_data = JSON.parse(sjcl.encrypt(password, data)); \n iv = encrypted_data['iv'];\n salt = encrypted_data['salt'];\n ct = encrypted_data['ct'];\n to_hash = iv + salt + ct;\n integrity_check_value = sha256_digest(to_hash); \n return integrity_check_value + to_hash; \n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector('#password');\n passwordText.value = password;\n charset = \"\";\n}", "function writePassword() {\n var passwordLen = getpasswordLength();\n var options = getPasswordOptionSet();\n\n\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = makePassword(passwordLen, options);\n\n\n}", "function encrypt(algorithm, secret, password) {\n\n\tlet cipher = crypto.createCipher(algorithm, secret);\n\tlet crypted = cipher.update(password,'utf8','hex');\n\n\tcrypted += cipher.final('hex');\n\n\treturn crypted;\n\n}", "function writePassword() {\n var characterNumbers = getCharacterNumbers()\n var characterType = getCharacterType()\n \n \n\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function encryptPassword(password, callback) {\n bcrypt.hash(password, 10, (err, data) => {\n if (err) {\n return callback(err);\n } else {\n return callback(null, data)\n }\n })\n}", "encryptPrivateKey(key, password) {\n return CryptoJS.AES.encrypt(key, password);\n }", "async function encryptPass(pass) {\n\tencryptedPassword = await bcrypt.hash(pass, 10);\n\treturn encryptedPassword;\n}", "function writePassword() {\n var criteria = passwordCriteria();\n var password = generatePassword(criteria);\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "encryptPassword(values, cb) {\n bcrypt.hash(values.password, 10, function(err, encryptedPassword) {\n if (err) return cb(err);\n values.password = encryptedPassword;\n cb();\n });\n }", "function writePassword() {\n var password = generatePassword();\n passwordText.value = password;\n passwordEngine.reset();\n}", "function writePassword() {\n\tvar params = {\n\t\tlowercase: confirm('Would you like to use lowercase characters?'),\n\t\tuppercase: confirm('Would you like to use uppercase characters?'),\n\t\tspecialChars: confirm('Would you like to use special characters?'),\n\t\tnumericChars: confirm('Would you like to use numeric characters?'),\n\t};\n\twhile (params.length < 8 || params.length > 128 || params.length === undefined) {\n\t\tparams.length = parseInt(prompt('How long would you like your password to be? Greater than 8 Less than 128'));\n\t}\n\tvar password = generatePassword(params);\n\tvar passwordText = document.querySelector('#password');\n\n\tpasswordText.value = password;\n}", "encrypt(value){\n return this.encryptWithkey(new Buffer(value,'utf8'), helper.Constants.AppKey);\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n generatePassword()\n }", "function writePassword() {\n var passwordReqs = {};\n passwordReqs = passReqs(passwordReqs);\n var password = generatePassword(passwordReqs);\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n }", "function writePassword() {\n \n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = password;\n \n }", "function writePassword() {\n let password = generatePassword(passwordlength).join(\"\");\n let passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function _encryptBlock(plain, algorithm, password) {\n var cipher = crypto.createCipher(algorithm,password);\n var encrypted = cipher.update(plain,'utf8','hex')\n encrypted += cipher.final('hex');\n return encrypted;\n}", "function writePassword() {\n\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n }", "function writePassword() {\n var password = generatePassword(confirmedCount, yesUpper, yesLower);\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function aesEncryption(message, password){\r\n var ciphertext = CryptoJS.AES.encrypt(message, password).toString();\r\n return ciphertext;\r\n}", "function encrypt(text){\n var cipher = crypto.createCipher('aes-256-cbc','wu23x7po')\n var crypted = cipher.update(text,'utf8','hex')\n crypted += cipher.final('hex')\n return crypted\n}", "function writePassword() {\n\n var password = generatePassword(); \n\n\n \n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n \n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n }", "function writePassword() {\n var password = passWordGen();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n }", "function writePassword() {\n var length = getPasswordLength();\n length = parseInt(length);\n ensureCharacterType();\n var password = generatePassword(length);\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword()\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n }", "function writePassword() {\n var password = pwCriteria();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n }", "function writePassword() {\n // resets password and character strings on repeat \n arrayChar = '';\n password = '';\n password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = password;\n }", "function encryptStr(rawStr, pwd) {\n\tvar cipher = crypto.createCipher('des-ede3-cbc', pwd);//pwd needs 24 Byte\n\tvar ciph = cipher.update(rawStr, 'utf8', 'hex');\n\tciph += cipher.final('hex');\n\treturn ciph;\n}", "function writePassword() {\r\n\r\n var password = generatePassword(),\r\n passwordText = document.querySelector(\"#password\");\r\n\r\n passwordText.value = password;\r\n \r\n}", "function addDigitToPassword(digitInput){\r\n pass += digitInput;\r\n var enteredPswd = document.getElementById(\"password\");\r\n encryptedPassword += \"*\";\r\n enteredPswd.value = encryptedPassword;\r\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n\n // clears password variables in case user doesn't click clear button before generating a new password\n passCreate = \"\";\n password = \"\";\n}", "function writePassword() {\n\n\n // you can create a function named generatePassword that creates the password\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword();\n \n\n passwordText.value = password;\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n }", "function writePassword() {\n var password = generatePassword().join(\"\");\n // console.log(password);\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function writePassword() {\n var userPassword = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = userPassword;\n }", "function writePassword() \n{\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n}", "function writePassword() { \n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function writePassword()\n{\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function writePassword() {\r\n var password = generatePassword();\r\n var passwordText = document.querySelector(\"#password\");\r\n passwordText.value = password;\r\n}", "function writePassword() {\n pwd = '';\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePass();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePass();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n password=\"\";\n password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n return;\n}", "function writePassword() {\n\n\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = password;\n \n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = password;\n \n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = password;\n \n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = password;\n \n }", "function writePassword() {\n\n \n \n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword();\n\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function writePassword() {\n var password = generatePassword();\n\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function writePassword() {\r\n var password = generatePassword();\r\n var passwordText = document.querySelector(\"#password\");\r\n\r\n passwordText.value = password;\r\n \r\n}", "function encrypt(text) {\n var iv = crypto.randomBytes(8).toString(\"hex\");\n var cipher = crypto.createCipheriv(algorithm, password, iv);\n var encrypted = cipher.update(text.toString(), 'utf8', 'hex');\n encrypted += cipher.final('hex');\n\n return {\n content : encrypted,\n iv : iv\n };\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = PassEmpty.join(\"\");\n}", "function Encrypt(str) {\n if (!str) str = \"\";\n str = (str == \"undefined\" || str == \"null\") ? \"\" : str;\n try {\n var key = EncryptKey;\n var pos = 0;\n ostr = '';\n while (pos < str.length) {\n ostr = ostr + String.fromCharCode(str.charCodeAt(pos) ^ key);\n pos += 1;\n }\n return ostr;\n } catch (ex) {\n return '';\n }\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function writePassword() {\r\n var password = generatePassword();\r\n var passwordText = document.querySelector(\"#password\");\r\n\r\n passwordText.value = password; \r\n}", "function writePassword() {\n \n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.value = password;\n \n}", "function writePassword() {\n\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n}", "function writePassword() {\n var password = buildPassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n return password;\n}", "function writePassword() {\n var password = passwordGenerator();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n}" ]
[ "0.76149404", "0.75778526", "0.74944186", "0.74570376", "0.7374853", "0.7374853", "0.71472377", "0.7125782", "0.71183157", "0.702803", "0.7019693", "0.69415605", "0.687509", "0.6871541", "0.68300706", "0.6810715", "0.6776599", "0.67360896", "0.67202425", "0.6670661", "0.66617244", "0.66591114", "0.66472495", "0.6635141", "0.6628342", "0.6573132", "0.6544118", "0.6521969", "0.65193325", "0.6508357", "0.6497637", "0.64802426", "0.64782864", "0.6476139", "0.6466576", "0.6455099", "0.6433676", "0.6422123", "0.64143866", "0.6407041", "0.6384898", "0.63773066", "0.63759404", "0.63701797", "0.6367062", "0.63630927", "0.6361597", "0.6359003", "0.6345725", "0.6341607", "0.63392425", "0.6337232", "0.63314116", "0.633012", "0.6328691", "0.63263565", "0.6324893", "0.6322318", "0.63204044", "0.6318481", "0.6314717", "0.6314421", "0.63126487", "0.6311527", "0.631018", "0.63053054", "0.63017595", "0.628703", "0.6281286", "0.6281261", "0.62804633", "0.6280341", "0.62793803", "0.6274631", "0.6272034", "0.6269703", "0.6269703", "0.62672573", "0.6266356", "0.6266321", "0.6266173", "0.6266173", "0.6266173", "0.6266173", "0.6264329", "0.6263926", "0.6263926", "0.6256245", "0.62558097", "0.62540376", "0.6251933", "0.62501186", "0.62489855", "0.6245849", "0.6245185", "0.6245059", "0.6244138", "0.6243917", "0.6242718", "0.6242718" ]
0.7111993
9
Path to the fixture file.
get FIXTURE() { return resolve(FIXTURE, 'test.txt') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fixturePath() {\n for (var _len = arguments.length, pathParts = Array(_len), _key = 0; _key < _len; _key++) {\n pathParts[_key] = arguments[_key];\n }\n\n return _path2.default.join.apply(_path2.default, [__dirname, '..', 'fixtures'].concat(pathParts));\n}", "function fixturePath(path, extension, fixtureLocation) {\n var split_path = path.split('/');\n split_path.splice(-1, 1);\n var index = split_path.indexOf('helpers');\n split_path[index] = 'fixtures/' + extension + '/' + fixtureLocation;\n return split_path.join('/');\n}", "function fixture(filename) {\n return normalizeLineEndings(String(fs.readFileSync(filename)));\n}", "get templateFullPath() {\n return path.join(this.assembly.directory, this.templateFile);\n }", "getCurrentEnvPath() {\r\n let TestDataPath = \"\\\\Resources\\\\\" + env + \"_TestData\";\r\n let absolutePath = __basedir + TestDataPath;\r\n return absolutePath;\r\n }", "function loadFile(filename) {\n var filepath = path.join(__dirname, 'fixtures/cms/' + filename);\n var txtfile = fs.readFileSync(filepath, 'utf-8');\n return txtfile;\n\n}", "async getTemplateFile(template) {\n // TODO: Raise exeption if file do not exists\n //\n console.log(HandlebarsRenderer.extension);\n return fs.readFileSync(\n path.join(this.directory, 'fixtures/handlebars', template + '.hbs'),\n 'utf8'\n );\n }", "getStub() {\n return path_1.join(__dirname, '..', '..', 'templates', 'provider.txt');\n }", "_getConfigFilePath(testCase) {\n let filePath = null;\n\n if (typeof testCase !== 'string') {\n throw new TypeError(`_getConfigFilePath: testCase parameter: expected type 'string', was instead '${typeof testCase}'`);\n }\n\n // set filePath depending on whether the generator is running a test case or not\n if (testCase === '') {\n filePath = path.join(process.cwd(), '/.yo-rc.json');\n } else if (DBH_CONSTANTS.testCases[testCase] !== undefined) {\n filePath = path.join(__dirname, '..', DBH_CONSTANTS.testConfigFiles[testCase]);\n } else {\n throw new Error(`_getConfigFilePath: testCase parameter: not a test case we know of. testCase was: ${testCase}`);\n }\n\n if (!fs.existsSync(filePath)) {\n throw new Error(`_getConfigFilePath: Sought after this file, but it doesn't exist. Path was:\\n${filePath}`);\n }\n\n return filePath;\n }", "function datafilePath() {\n return path.resolve(__dirname, DOWNLOAD_STATS_FILENAME);\n}", "getFilePath() {\n let filePath = callsites()[2].getFileName(); // [0] and [1] return global fractal.config.js.\n return filePath.replace('.js', '.yml');\n }", "getTexPathname() {\n return path.join(this.tempDir, 'input.tex')\n }", "get settingsPath() {\n const environment = this.services.get(environment_1.IEnvironmentService);\n return path.join(environment.userDataPath, \"coder.json\");\n }", "filePath({ dir, name }) {\n return join(dir, `${name}.json`)\n }", "get fixture() {\r\n\t\t\treturn this.fixtureList;\r\n\t\t}", "function fixTestPath(filename) {\n return path.join(__dirname, \"..\", \"tests\", filename);\n}", "function testpuerF() {\n fs.copySync(path.join(__dirname, 'assets', 'someJSON.json'), path.join(__dirname, 'tmp', 'someJSON.json'));\n puerf.start({\n freemarker: ftlRoutesFile,\n mock: routesFile,\n combined: combinedFile,\n templates: templateFolderPath,\n port: testPort,\n root: tmpPath,\n noBrowser: true\n }, testFileServing);\n }", "getAbsoluteDataPath(path = \"\") {\r\n // Get the path from the root to the indicated file\r\n return path_1.default.join(process.cwd(), this.dataPath, path);\r\n }", "function baseDir () {\n return _path.join(__dirname, '/../.data/')\n}", "function testFilePath(funcName) {\n return path.join(testFolder, `${funcName.replace(/.*\\//g, '')}.js`);\n }", "function storeFixture() {\n\n \t\t// Avoid overwriting user-defined values\n \t\tif (hasOwn.call(config, \"fixture\")) {\n \t\t\treturn;\n \t\t}\n\n \t\tvar fixture = document.getElementById(\"qunit-fixture\");\n \t\tif (fixture) {\n \t\t\tconfig.fixture = fixture.innerHTML;\n \t\t}\n \t}", "function getDocTemplatePath() {\n return _path2.default.resolve(__dirname, '..', '..', 'tpl', 'doc.md.mustache');\n}", "getDefaultFileData () {\n return this.getFileData(EXAMPLE_PATH)\n }", "get heartbeatPath() {\n const environment = this.services.get(environment_1.IEnvironmentService);\n return path.join(environment.userDataPath, \"heartbeat\");\n }", "getSrcPath()\n {\n return path.join(this.getRootPath(), 'src');\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 }", "static get credFilePath () {\n return path.join(__dirname, '..', '.credentials')\n }", "function readTestFile(name) {\n\tlet fullName = path.join(__dirname, '../testcode', name + '.js');\n\treturn fs.readFileSync(fullName, 'utf8');\n}", "get sourceBookFullPath() {\n return path.normalize(path.join(this.configDirPath, this.bookroot ? this.bookroot : \"\"));\n }", "function FakeFile(path)\n{\n this.path = path;\n}", "get template() {\n if (this._template === undefined) {\n this._template = JSON.parse(fs.readFileSync(this.templateFullPath, 'utf-8'));\n }\n return this._template;\n }", "function reminderFile() {\n return path.join(u.dataLoc(), 'eskill-alarm.txt')\n}", "function setFilesUpForTesting(){\n fixedPath.push( testPath());\n return fixedPath;\n}", "function getPath() {\n var path;\n if (BST.DEBUG) {\n path = \"../php/bst.php\";\n }\n else {\n path = \"../../../php/bst/bst.php\";\n }\n return path;\n }", "function FilePath() {\n\n}", "resourceTempPath (name) {\n return path.join(this.tmpPath, name)\n }", "constructor (filename) {\n \n // Obtém conteúdo da template.\n this.template = fs.readFileSync(filename).toString(); \n }", "function test_fixture(key){\n return function(done){\n var grunt = fake_grunt(key, function(error){\n compare_fixtures(\n grunt,\n __dirname + '/../.tmp/' + key + '.dest.json',\n fixture('json/' + key + '.exp.json')\n );\n expect(error).to.be.an('undefined');\n done();\n });\n };\n}", "function getEmail(input) {\n\treturn fs.readFileSync(path.join('fixtures', input)).toString();\n}", "get path () {\n return __dirname\n }", "GetPath() {return this.filePath;}", "function getAssetsPath()\n\t{\n\t\tvar generatorConfigFile = new File(\"~/generator.js\");\n\t\tvar cfgObj = {};\n\t\tvar gao = {};\n\t\tvar baseDirectory = undefined;\n\n\t\tif(generatorConfigFile.exists)\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\tvar str = JSUI.readFromFile(generatorConfigFile, \"UTF-8\");\n\n\t\t\t\tcfgObj = JSON.parse(str.replace(\"module.exports = \", \"\"));\n\t\t\t\tgao = cfgObj[\"generator-assets\"];\n\t\t\t\tbaseDirectory = gao[\"base-directory\"];\n\n\t\t\t}\n\t\t\tcatch(e)\n\t\t\t{\n\t\t\t\tif($.level) $.writeln(\"Error parsing generator.js\");\n\t\t\t}\n\t\t}\n\t\treturn baseDirectory;\n\t}", "dbPath() {\n var dbfile, found;\n var locations = [];\n\n dbfile = this.config.get( 'cachefile' );\n if ( dbfile != '' && dbfile != undefined ) {\n if ( path.isAbsolute( dbfile ) || fs.existsSync( dbfile ) )\n return dbfile;\n found = findConfig( dbfile, { dir: 'data' } );\n if ( found != null )\n return dbfile;\n if ( fs.existsSync( 'data' ) )\n return 'data/' + dbfile;\n else {\n mkdirp.sync( 'data' );\n return 'data/' + dbfile;\n }\n }\n\n mkdirp.sync( 'data' );\n return 'data/cache.json';\n }", "function getS3FilePath(env){\n var prefix = env + \"/RD013/\";\n var filename = prefix + \"investigators.json\";\n return filename;\n}", "function articleFilePath(articleId) {\n return $path.join(articlesDir, `${articleId}.json`);\n}", "static storage_path() { return '.'; }", "get localPath() {\n return this._manager.contents.localPath(this._path);\n }", "async function fixture(t, entry, options) {\n\tconst { mockFs, compiler } = setupEnv(entry, options)\n\n\tawait new Promise((resolve, reject) => {\n\t\tcompiler.run((err, stats) => {\n\t\t\terr ? reject(err) : resolve(stats)\n\t\t})\n\t})\n\n\t// uncomment to update expected files\n\t/* const bundle = mockFs.readFileSync('/bundle.js', 'utf8')\n\tfs.writeFileSync(path.join(__dirname, 'src', 'expected', entry), bundle.replace(/\\r/g, '')) */\n\n\tt.is(\n\t\tnormalize(mockFs.readFileSync('/bundle.js', 'utf8')),\n\t\tnormalize(fs.readFileSync(path.join(__dirname, 'src', 'expected', entry), 'utf8'))\n\t)\n}", "generateFile(path) {\n return fs.writeFileSync(path, this.template);\n }", "function getTemplatePath(templateFileName, config) {\n if (config.templatePath !== undefined) {\n return path.join(untildify(config.templatePath), `${templateFileName}.pug`);\n }\n\n return path.join(fileURLToPath(import.meta.url), '../../views/chart', `${templateFileName}.pug`);\n}", "loadData(callback){\n var fs = require('fs')\n var file = __dirname + '/../assets/data/templates.json'\n fs.readFile(file, 'utf8', (err, data) => {\n if (err){\n return callback(err)\n }\n else{\n return callback(undefined, JSON.parse(data))\n }\n })\n }", "function articleFilePath(article) {\n return `${contentDir}/${article.id}.json`\n}", "function get_file (file){\n return path.resolve(temp_dir + '/' + file);\n }", "function getNewFilePath() {\n //choose a name\n var fileName = getCurrentDateTime() + \".txt\";\n \n if (!folderLocation) {\n folderLocation = os.tmpdir();\n folderLocation = path.join(folderLocation, 'vslogcat');\n }\n\n var filePath = path.join(folderLocation, fileName);\n console.log(\"File path is \" + filePath);\n return filePath;\n\n}", "function scriptPath() {\n try {\n return app.activeScript;\n }\n catch (e) {\n return File(e.fileName);\n }\n}", "get assetPath() {}", "get assetPath() {}", "constructor() {\n let dataFile = `${__dirname}/db.json`;\n super(dataFile);\n }", "get tempDirectory () {\n return this.tmpPath\n }", "readTemplate() {\n try {\n return fs_1.readFileSync(this.templatePath, 'utf8');\n }\n catch (err) {\n if (err.code === 'ENOENT') {\n throw Error(`Template file not found: ${this.templatePath}`);\n }\n else {\n throw err;\n }\n }\n }", "_getTarballFilePath(project) {\n return path.join(this._rushConfiguration.commonTempFolder, RushConstants_1.RushConstants.rushTempProjectsFolderName, `${project.unscopedTempProjectName}.tgz`);\n }", "_getIndexFile() {\n return join(this.destination, 'index.json');\n }", "function pathTo(filename) {\n return __dirname + '/' + filename;\n}", "get reportsPath() {\n return this._args.reportsPath;\n }", "getTemp(filename) {\n invariant(this.tempFolder, 'No temp folder');\n return path.join(this.tempFolder, filename);\n }", "getTestPath(argv) {\n let testPath = undefined;\n if (argv.length >= 3 && fs.existsSync(argv[2])) {\n const isDirectory = fs.lstatSync(argv[2]).isDirectory();\n testPath = isDirectory ? argv[2] : path.dirname(argv[2]);\n }\n return testPath;\n }", "get path() {}", "function pathToTrSection(testFile) {\n\n let trPath = testFile;\n if (path.isAbsolute(trPath)) {\n let parsed = path.parse(trPath);\n trPath = trPath.substring(parsed.root.length);\n }\n trPath = path.dirname(trPath);\n\n if (trPath == '.') return \"\";\n\n let hierarchy = trPath.split(path.sep);\n hierarchy = hierarchy.join(' > ');\n\n return hierarchy;\n}", "resolvePath() {\n return this.resolve().resolvedPath;\n }", "function initScript() {\n puerf.init({\n mockFolder: mockFolderPath,\n templateFolder: templateFolderPath\n }, function() {\n fs.stat(mockFolderPath, function(err, stat) {\n t.ok(stat, 'init script created files');\n testpuerF();\n });\n });\n }", "get file() {\n return this.args.file;\n }", "static uploadPoPFile() {\n return `purchase/payment-methods/regular-eft/payment-proof/upload`\n }", "cwd () {\n return process.cwd();\n }", "function scriptPath(lang) {\n return path.resolve(__dirname, 'detectors', lang + '.sh');\n}", "saveTemplates(callback){\n var fs = require('fs')\n var file = __dirname + '/../assets/data/templates.json'\n fs.writeFile(file, JSON.stringify(this.templates), function(err) {\n if(err) {\n return callback(err)\n }\n else{\n return callback(undefined, true)\n }\n })\n }", "function fullyQualifiedPath(filename) {\n\treturn path.join(OTRTALK_ROOT, filename);\n}", "getMasterTexPath() {\n const masterPath = this.getMagicCommentMasterFile();\n if (masterPath) { return masterPath; }\n if (!this.isMasterFileSearchEnabled()) { return this.filePath; }\n if (this.isMasterFile(this.filePath)) { return this.filePath; }\n\n return this.searchForMasterFile();\n }", "function getItemFilePath (item) {\n\t\tvar f = config.archiveFolder + utils.getDatePath (item.when) + utils.padWithZeros (item.id, 5) + \".json\";\n\t\treturn (f);\n\t\t}", "getRootPath()\n {\n return process.cwd();\n }", "static FilePath(file) {\n\t\tfile = file.charAt(0) == \"/\" ? file.substr(1) : file;\n\t\t\n\t\tvar path = [Net.AppPath(), file];\n\t\t\t\t\n\t\treturn path.join(\"/\");\n\t}", "get fullPath() {\n return path.join(this.assembly.directory, this.directoryName);\n }", "file () {\n try {\n const file = this.currentFile()\n\n if (!file) throw createError({ code: 'ENOENT', message: 'No file selected' })\n return file\n } catch (e) {\n throw new Error(e)\n }\n }", "static uploadReturnFile() {\n return `purchase/customer/returns/create/upload_file`\n }", "get tmpDirPath() {\n return this.tmpPath || tmpdir();\n }", "getFile(){\n\t\tif(!this.settings.outputFile)return false;\n if(this.settings.singleFile)return this.settings.singleFile;\n if(this.settings.folder){\n\t\t\tvar date = new Date();\n\t\t\tif(!fs.existsSync(this.settings.folder))fs.mkdirSync(this.settings.folder);\n var filePath = path.join(this.settings.folder, [\n date.getFullYear(), \n date.getMonth()+1, \n date.getDate()\n ].join('-') + '.log');\n try{\n fs.readFileSync(filePath);\n }catch(e){\n fs.writeFileSync(filePath, \"\");\n }\n return filePath;\n }else{\n return false;\n }\n }", "function getPath() {\n let i = 1\n let repeat = true;\n while (repeat) {\n if (fs.existsSync(`./dist/Team-${i}.html`)) {\n i++\n }\n else {\n return `./dist/Team-${i}.html`\n }\n }\n}", "getDataPath() {\n const validApp = process.type === 'renderer' ? remote.app : app\n let configFolder = path.join(validApp.getPath('appData'), configFolderName)\n if (getOS() === 'linux') {\n configFolder = path.join(validApp.getPath('home'), '.CloakCoin')\n }\n return configFolder\n }", "getAppPath()\n {\n return path.join(this.getRootPath(), 'app');\n }", "function getFontPath() {\r\n return getAssetsPath() + config.build.fontPath;\r\n}", "get file() {\r\n return new File(this, \"file\");\r\n }", "function createFakeFile() {\n const owner = ld.sample(owners);\n const startedAt = faker.date.past().getTime();\n\n return {\n uploadId: uuid.v4(),\n status: ld.sample(statusValues),\n startedAt,\n uploadedAt: startedAt + 1000,\n name: faker.commerce.productName(),\n files: JSON.stringify([]), // can insert real files, but dont care\n contentLength: ld.random(1, 2132311),\n parts: ld.random(1, 4),\n [FILES_OWNER_FIELD]: owner,\n };\n }", "get fileDirectory() {\n return this.config.fileDirectory || null;\n }", "function require_seed_info_file(file, callback) {\n path.exists( file, function (exists) { \n if( exists ) callback();\n else abort(\"seed.yml file required.\", callback);\n });\n}", "function getLocalChangelogFilePath(projectDir) {\n return path.join(projectDir, changelogPath);\n}", "get projectPath() {\n return this.findProjectDir();\n }", "function loadFixtures () {\n const fixtures = {}\n const blockHex = loadFixture('test/fixtures/block.hex').toString()\n fixtures.block = Buffer.from(blockHex, 'hex')\n fixtures.blockHeader = fixtures.block.slice(0, ZCASH_BLOCK_HEADER_SIZE)\n fixtures.nonHeader = fixtures.block.slice(ZCASH_BLOCK_HEADER_SIZE, fixtures.block.length)\n return fixtures\n}", "async getFile() {\n return await jsonStorage.getItem(plantPath).then(item => {\n return item;\n\n }).catch(() => {\n return null;\n });\n }", "function getTmpFileForData(path, callback) {\r\n let uri = require(\"self\").data.url(path);\r\n let ext = path.match(/\\.(.+)$/)[1];\r\n let file = FileUtils2.getTmpFile(\"tmp-test\", ext);\r\n FileUtils2.copyURLToFile(uri, file, function () {\r\n callback(file);\r\n });\r\n}" ]
[ "0.7704921", "0.6518775", "0.6440356", "0.6153649", "0.60106796", "0.58949023", "0.5857106", "0.5853383", "0.57627285", "0.5690874", "0.5611548", "0.5584239", "0.5522971", "0.5452458", "0.53591", "0.53410643", "0.5321657", "0.52875394", "0.5273929", "0.5271327", "0.52455354", "0.52417284", "0.51637405", "0.5160957", "0.5157552", "0.51478964", "0.5126507", "0.51123244", "0.51108485", "0.50940394", "0.50936544", "0.50900453", "0.50688267", "0.5048524", "0.50133866", "0.50044376", "0.5002422", "0.4975748", "0.49629724", "0.49501142", "0.4945203", "0.4900231", "0.48994046", "0.4881579", "0.48790798", "0.4856539", "0.48514974", "0.48409036", "0.48325774", "0.48263738", "0.4823257", "0.48090106", "0.48079", "0.48068777", "0.480049", "0.47992593", "0.47992593", "0.47890773", "0.4784908", "0.47770363", "0.47723314", "0.47661132", "0.47569817", "0.47548133", "0.47498378", "0.4725994", "0.47200552", "0.4713587", "0.4703706", "0.469612", "0.46886596", "0.46778655", "0.46778476", "0.4677119", "0.4655704", "0.4650756", "0.46501583", "0.46491203", "0.46470526", "0.4641995", "0.46372616", "0.46324167", "0.46312693", "0.46303657", "0.46238393", "0.462093", "0.4618518", "0.46150696", "0.46140212", "0.46127", "0.4610238", "0.46097404", "0.46086052", "0.46034303", "0.45899257", "0.45860794", "0.45817733", "0.45782194" ]
0.63638514
5
We're giving you this function. Take a look at it, you might see some usage that's new and different. That's because we're avoiding a wellknown, but sneaky bug that we'll cover in the next few lessons! As a result, the lessons for this function will pass and it will be available for you to use if you need it!
function createEmployeeRecord(array){ return{ firstName: array[0], familyName: array[1], title: array[2], payPerHour: array[3], timeInEvents: [], timeOutEvents: [] } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "transient protected internal function m189() {}", "transient final protected internal function m174() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "function StupidBug() {}", "static transient final protected public internal function m46() {}", "static private protected internal function m118() {}", "function B(e){\"new\"in e&&(e.returnOriginal=!e.new,delete e.new)}", "transient private protected public internal function m181() {}", "function ForgetNew(){\n if(!(this instanceof arguments.callee)){\n return new ForgetNew();\n }\n this.message = \" it's amazin how you can speak right to my heart\";\n}", "transient final private protected internal function m167() {}", "static final private internal function m106() {}", "static transient private protected internal function m55() {}", "static transient final private internal function m43() {}", "static private internal function m121() {}", "static private protected public internal function m117() {}", "static transient private protected public internal function m54() {}", "static transient final protected internal function m47() {}", "__previnit(){}", "transient final private internal function m170() {}", "function NewObj() {}", "function isThisNew(tweet){\n\n\t//\n}", "static transient final private protected internal function m40() {}", "transient private public function m183() {}", "transient final private protected public internal function m166() {}", "function _construct()\n\t\t{;\n\t\t}", "function NewObj(){}", "static transient private public function m56() {}", "obtain(){}", "function _____SHARED_functions_____(){}", "InitNew() {\n\n }", "function HelperConstructor() {}", "function newThing(){\n console.log(\"HEY!\")\n}", "_mapDeprecatedFunctionality(){\n\t\t//all previously deprecated functionality removed in the 5.0 release\n\t}", "function createCurrentCallObject() {\n\n}", "function createAnother(original) { // 1\n\t \t\t\t\tvar clone = object(original); // 2 \n\t \t\t\t\tclone.sayHi = function() {\t\t\t// 3\n\t \t\t\t\t\treturn \"hello world\";\n\t \t\t\t\t};\n\t \t\t\t\treturn clone;\t\t\t\t\t\t\t// 4\n\t \t\t\t}", "function makeBigger() {\n\n}", "function Yielder() {}", "function Bare() {}", "function Bare() {}", "static transient final protected function m44() {}", "function factory() {}", "function factory() {}", "function newObject() { return {}; }", "function tempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function TempCtor() {}", "function hzNew(callee) {\n\t\tconst seqExp = hzCall(callee);\n\t\tseqExp.expressions[0].argument.callee.property.name = \"new\";\n\t\treturn seqExp;\n\t}", "function ExampleNew(attrs) {\n this.one = attrs.one;\n this.two = attrs.two;\n this.three = attrs.three;\n console.log(this); // 'new' binds 'this' in ExampleNew function to obj1 and obj2 objects\n}", "static transient final private protected public internal function m39() {}", "static transient final private public function m41() {}", "function SuperclassBare() {}", "function SuperclassBare() {}", "compilable(_locator) {\n throw new Error('Method not implemented.');\n }", "compilable(_locator) {\n throw new Error('Method not implemented.');\n }", "compilable(_locator) {\n throw new Error('Method not implemented.');\n }", "static transient private internal function m58() {}", "function ExtraMethods() {}", "static transient final private protected public function m38() {}", "function Adaptor() {}", "function NewThreadLocal() {\r\n}", "function learnWithNew(str){\n this.name = str;\n this.functionObj = {name:str};\n let prop = \"its private variable\";\n }", "create() {\n\t}", "function myNewFunc() {\n return {};\n}", "static private public function m119() {}", "function NewString() {\r\n}", "function temporaryConstructor() {}", "_copy () {\n return new this.constructor()\n }", "_copy () {\n return new this.constructor()\n }", "patch() {\n }", "function returnNewNinja() {\n return {};\n}", "static protected internal function m125() {}", "static create () {}", "transient final private public function m168() {}", "constructur() {}", "function fm(){}", "function NewList() {\r\n}", "function cheapNew(cls) {\n\t\t\t\tdisable_constructor = true;\n\t\t\t\tvar rv = new cls;\n\t\t\t\tdisable_constructor = false;\n\t\t\t\treturn rv;\n\t\t\t}", "hacky(){\n return\n }", "function create() {\n\n}", "function Utils() {}", "function Utils() {}", "function positionMapTools(){\r\n\t//deprecated...\t\r\n}", "function createAnother(original){\n var clone = object(original); //create a new object by calling a function\n clone.sayHi = function(){ //augment the object in some way\n alert(\"hi\");\n };\n return clone; //return the object\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}", "function new1(func){\n let obj = Object.create(func.prototype);\n let k = func.call(obj);\n if (typeof k === 'object'){\n return k\n }else {\n return obj;\n }\n}", "function newFunction() {\n return require('assert');\n}", "function closureOfYourOwnCreation() {\n let name = \"Russ\";\n function greetme() {\n return \"my name is \" + name;\n };\n return greetme();\n}", "function fresh_program() {\n return make_program(\"new\",1);\n}", "function nonewFun() {}", "function construct() { }", "function newKeyword() {\n function ask(question) {\n console.log(this.teacher, question)\n }\n \n // Invokes a function and points `this` to a brand new empty object.\n const newEmptyObject = new ask('How does new work?')\n}", "function newHowTo() {\n console.log('how to is working');\n }", "function usoNTgt(nombre) {\n if (typeof new.target != \"undefined\") {\n this.nombre = nombre;\n } else {\n throw new Error(\"Debe ser utilizada con el new\");\n }\n\n}" ]
[ "0.62395704", "0.61227185", "0.6059905", "0.6038518", "0.5978909", "0.59690875", "0.5925256", "0.5879324", "0.57484204", "0.5731846", "0.57314694", "0.56979316", "0.5684633", "0.56527984", "0.56388783", "0.56274456", "0.56184494", "0.5584748", "0.5572903", "0.5569722", "0.55686146", "0.54983443", "0.54923284", "0.54850614", "0.5451007", "0.5448641", "0.5442483", "0.54404145", "0.54029566", "0.5394006", "0.5381867", "0.531157", "0.5309226", "0.5244", "0.5238877", "0.522296", "0.5183166", "0.5170765", "0.5164763", "0.5161473", "0.51424456", "0.5130464", "0.5130464", "0.5108055", "0.51021564", "0.51021564", "0.50922304", "0.507977", "0.5065795", "0.5065795", "0.5065795", "0.5065795", "0.5065795", "0.5065795", "0.50642896", "0.5064181", "0.505122", "0.5051027", "0.5048748", "0.5048748", "0.5046969", "0.5046969", "0.5046969", "0.5045641", "0.5034402", "0.50248855", "0.5007323", "0.50069314", "0.5000329", "0.49906063", "0.49838132", "0.49810183", "0.4972807", "0.49628186", "0.49575323", "0.49575323", "0.49568394", "0.49561408", "0.49557763", "0.4949084", "0.49467734", "0.49433255", "0.49281958", "0.49231702", "0.49228677", "0.49209028", "0.49194622", "0.4915216", "0.4915216", "0.49151304", "0.4903619", "0.49023837", "0.48900735", "0.48884037", "0.48865196", "0.48834217", "0.48774832", "0.48759586", "0.4875464", "0.4874094", "0.4866294" ]
0.0
-1
Given a node it returns the Microsoft Word list level, returning undefined for an item that isn't a MS Word list node
function getMsWordListLevel (node) { if (node.nodeName.toLowerCase() !== 'p') { return } const style = node.getAttribute('style') const levelMatch = style && style.match(/mso-list/i) ? style.match(/level(\d+)/) : null return levelMatch ? parseInt(levelMatch[1], 10) : undefined }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLevel(node){\n\tif(node.properties.hasOwnProperty(\"Level\")){\n\t\treturn node.properties.Level;\n\t}else{\n\t\treturn -1;\n\t}\n}", "function getFakeBulletText(node, levels) {\n // Word uses the following format for their bullets:\n // &lt;p style=\"mso-list:l1 level1 lfo2\"&gt;\n // &lt;span style=\"...\"&gt;\n // &lt;span style=\"mso-list:Ignore\"&gt;1.&lt;span style=\"...\"&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;/span&gt;\n // &lt;/span&gt;\n // Content here...\n // &lt;/p&gt;\n //\n // Basically, we need to locate the mso-list:Ignore SPAN, which holds either one text or image node. That\n // text or image node will be the fake bullet we are looking for\n var result = null;\n var child = node.firstChild;\n while (!result && child) {\n // First, check if we need to convert the Word list comments into real elements\n child = fixWordListComments(child, true /*removeComments*/);\n // Check if this is the node that holds the fake bullets (mso-list: Ignore)\n if (isIgnoreNode(child)) {\n // Yes... this is the node that holds either the text or image data\n result = child.textContent.trim();\n // This is the case for image case\n if (result.length == 0) {\n result = 'o';\n }\n }\n else if (child.nodeType == 1 /* Element */ && levels > 1) {\n // If this is an element and we are not in the last level, try to get the fake bullet\n // out of the child\n result = getFakeBulletText(child, levels - 1);\n }\n child = child.nextSibling;\n }\n return result;\n}", "function getLevel(el) {\n\t\treturn parseInt(el.parentNode.getAttribute('data-o-hierarchical-nav-level'), 10);\n\t}", "function msWordListMarker (node, bulletListMarker) {\n const markerElement = node.querySelector('span[style=\"mso-list:Ignore\"]')\n\n // assume the presence of a period in a marker is an indicator of an\n // ordered list\n if (!markerElement || !markerElement.textContent.match(/\\./)) {\n return bulletListMarker\n }\n\n const nodeLevel = getMsWordListLevel(node)\n\n let item = 1\n let potentialListItem = node.previousElementSibling\n\n // loop through previous siblings to count list items\n while (potentialListItem) {\n const itemLevel = getMsWordListLevel(potentialListItem)\n\n // if there are no more list items or we encounter the lists parent\n // we don't need to count further\n if (!itemLevel || itemLevel < nodeLevel) {\n break\n }\n\n // if on same level increment the list items\n if (nodeLevel === itemLevel) {\n item += 1\n }\n\n potentialListItem = potentialListItem.previousElementSibling\n }\n\n return `${item}.`\n}", "function getListItemMetadata(node) {\n if (node.nodeType == 1 /* Element */) {\n var listatt = getStyleValue(node, MSO_LIST_STYLE_NAME);\n if (listatt && listatt.length > 0) {\n try {\n // Word mso-list property holds 3 space separated values in the following format: lst1 level1 lfo0\n // Where:\n // (0) List identified for the metadata in the &lt;head&gt; of the document. We cannot read the &lt;head&gt; metada\n // (1) Level of the list. This also maps to the &lt;head&gt; metadata that we cannot read, but\n // for almost all cases, it maps to the list identation (or level). We'll use it as the\n // list indentation value\n // (2) Contains a specific list identifier.\n // Example value: \"l0 level1 lfo1\"\n var listprops = listatt.split(' ');\n if (listprops.length == 3) {\n return {\n level: parseInt(listprops[1].substr('level'.length)),\n wordListId: listatt,\n originalNode: node,\n uniqueListId: 0,\n };\n }\n }\n catch (e) { }\n }\n }\n return null;\n}", "getListLevel(list, listLevelNumber) {\n if (!isNullOrUndefined(list)) {\n let abstractList = this.viewer.getAbstractListById(list.abstractListId);\n if (!isNullOrUndefined(list) && abstractList.levels.length <= listLevelNumber\n && listLevelNumber >= 0 && listLevelNumber < 9) {\n this.addListLevels(abstractList);\n }\n let levelOverrideAdv = undefined;\n let level = false;\n level = (!isNullOrUndefined(list.levelOverrides))\n && !isNullOrUndefined(((levelOverrideAdv = list.levelOverrides[listLevelNumber])))\n && (!isNullOrUndefined(levelOverrideAdv.overrideListLevel));\n if (level) {\n return levelOverrideAdv.overrideListLevel;\n }\n else if (!isNullOrUndefined(abstractList) && listLevelNumber >= 0 && listLevelNumber < abstractList.levels.length) {\n return abstractList.levels[listLevelNumber];\n }\n }\n return undefined;\n }", "function recurringGetOrCreateListAtNode(node, level, listMetadata) {\n var parent = null;\n var possibleList;\n if (level == 1) {\n // Root case, we'll check if the list is the previous sibling of the node\n possibleList = getRealPreviousSibling(node);\n }\n else {\n // If we get here, we are looking for level 2 or deeper... get the upper list\n // and check if the last element is a list\n parent = recurringGetOrCreateListAtNode(node, level - 1, null);\n possibleList = parent.lastChild;\n }\n // Check the element that we got and verify that it is a list\n if (possibleList && possibleList.nodeType == 1 /* Element */) {\n var tag = roosterjs_editor_dom_1.getTagOfNode(possibleList);\n if (tag == 'UL' || tag == 'OL') {\n // We have a list.. use it\n return possibleList;\n }\n }\n // If we get here, it means we don't have a list and we need to create one\n // this code path will always create new lists as UL lists\n var newList = node.ownerDocument.createElement(listMetadata ? listMetadata.tagName : 'UL');\n if (level == 1) {\n // For level 1, we'll insert the list beofre the node\n node.parentNode.insertBefore(newList, node);\n }\n else {\n // Any level 2 or above, we insert the list as the last\n // child of the upper level list\n parent.appendChild(newList);\n }\n return newList;\n}", "function listItem( node ) {\n\t\treturn node.type == CKEDITOR.NODE_ELEMENT && node.is( 'li' );\n\t}", "get listLevelNumber() {\n return this.listLevelNumberIn;\n }", "function getOrCreateListForNode(wordConverter, node, metadata, listMetadata) {\n // First get the last list next to this node under the specified level. This code\n // path will return the list or will create lists if needed\n var list = recurringGetOrCreateListAtNode(node, metadata.level, listMetadata);\n // Here use the unique list ID to detect if we have the right list...\n // it is possible to have 2 different lists next to each other with different formats, so\n // we want to detect this an create separate lists for those cases\n var listId = CustomData_1.getObject(wordConverter.customData, list, UNIQUE_LIST_ID_CUSTOM_DATA);\n // If we have a list with and ID, but the ID is different than the ID for this list item, this\n // is a completely new list, so we'll append a new list for that\n if ((listId && listId != metadata.uniqueListId) || (!listId && list.firstChild)) {\n var newList = node.ownerDocument.createElement(listMetadata.tagName);\n list.parentNode.insertBefore(newList, list.nextSibling);\n list = newList;\n }\n // Set the list id into the custom data\n CustomData_1.setObject(wordConverter.customData, list, UNIQUE_LIST_ID_CUSTOM_DATA, metadata.uniqueListId);\n // This call will convert the list if needed to the right type of list required. This can happen\n // on the cases where the first list item for this list is located after a deeper list. for that\n // case, we will have created a UL for it, and we may need to convert it\n return convertListIfNeeded(wordConverter, list, listMetadata);\n}", "function listItemType(el) {\n const content = el.textContent.trim();\n\n if (/^[\\*\\-]\\s/.test(content)) {\n return 'ul';\n } else if (/^\\d+\\.\\s/.test(content)) {\n return 'ol';\n }\n\n return false;\n}", "function insertListItem(listRootElement, itemToInsert, listType, doc) {\n if (!listType) {\n return;\n }\n // Get item level from 'data-aria-level' attribute\n var itemLevel = parseInt(itemToInsert.getAttribute('data-aria-level'));\n var curListLevel = listRootElement; // Level iterator to find the correct place for the current element.\n // if the itemLevel is 1 it means the level iterator is at the correct place.\n while (itemLevel > 1) {\n if (!curListLevel.firstChild) {\n // If the current level is empty, create empty list within the current level\n // then move the level iterator into the next level.\n curListLevel.append(doc.createElement(listType));\n curListLevel = curListLevel.firstElementChild;\n }\n else {\n // If the current level is not empty, the last item in the needs to be a UL or OL\n // and the level iterator should move to the UL/OL at the last position.\n var lastChild = curListLevel.lastElementChild;\n var lastChildTag = roosterjs_editor_dom_1.getTagOfNode(lastChild);\n if (lastChildTag == constants_1.UNORDERED_LIST_TAG_NAME || lastChildTag == constants_1.ORDERED_LIST_TAG_NAME) {\n // If the last child is a list(UL/OL), then move the level iterator to last child.\n curListLevel = lastChild;\n }\n else {\n // If the last child is not a list, then append a new list to the level\n // and move the level iterator to the new level.\n curListLevel.append(doc.createElement(listType));\n curListLevel = curListLevel.lastElementChild;\n }\n }\n itemLevel--;\n }\n // Once the level iterator is at the right place, then append the list item in the level.\n curListLevel.appendChild(itemToInsert);\n}", "function getLevel(elem) {\n const pattern = /level-(\\d+)/\n for (const cls of elem.classList) {\n const match = cls.match(pattern);\n if (match) {\n return Number(match[1]);\n }\n }\n return undefined;\n}", "getRootFromSelection(node) {\n let current_node = node;\n while (current_node !== null && current_node.tagName !== \"LI\") {\n current_node = current_node.parentNode;\n }\n return current_node;\n }", "function getLevel (d) {\n if (_.isArray(d)) {\n return d[0].level\n } else {\n return d.level\n }\n }", "function getHeadingLevel(heading) {\n return parseInt(heading.nodeName.slice(-1), 10);\n}", "function calculateWidestLevel(root) {}", "function getUl(el, level) {\n var $row = $(el).closest('.row')\n , nest_level = arguments[1] || $row.data('ul-level');\n if (nest_level == 2) return $row.find('> ul ul');\n return $row.find('> ul');\n}", "function getLevel(l) {\n return LEVELS[l] || 7; // Default to debug\n}", "function processNodesDiscovery(wordConverter) {\n var args = wordConverter.wordConverterArgs;\n while (args.currentIndex < args.nodes.length) {\n var node = args.nodes.item(args.currentIndex);\n // Try to get the list metadata for the specified node\n var itemMetadata = getListItemMetadata(node);\n if (itemMetadata) {\n var levelInfo = args.currentListIdsByLevels[itemMetadata.level - 1] || LevelLists_1.createLevelLists();\n args.currentListIdsByLevels[itemMetadata.level - 1] = levelInfo;\n // We need to drop some list information if this is not an item next to another\n if (args.lastProcessedItem && getRealPreviousSibling(node) != args.lastProcessedItem) {\n // This list item is not next to the previous one. This means that there is some content in between them\n // so we need to reset our list of list ids per level\n resetCurrentLists(args);\n }\n // Get the list metadata for the list that will hold this item\n var listMetadata = levelInfo.listsMetadata[itemMetadata.wordListId];\n if (!listMetadata) {\n // Get the first item fake bullet.. This will be used later to check what is the right type of list\n var firstFakeBullet = getFakeBulletText(node, LOOKUP_DEPTH);\n // This is a the first item of a list.. We'll create the list metadata using the information\n // we already have from this first item\n listMetadata = {\n numberOfItems: 0,\n uniqueListId: wordConverter.nextUniqueId++,\n firstFakeBullet: firstFakeBullet,\n // If the bullet we got is emtpy or not found, we ignore the list out.. this means\n // that this is not an item we need to convert of that the format doesn't match what\n // we are expecting\n ignore: !firstFakeBullet || firstFakeBullet.length == 0,\n // We'll use the first fake bullet to try to figure out which type of list we create. If this list has a second\n // item, we'll perform a better comparasion, but for one item lists, this will be check that will determine the list type\n tagName: getFakeBulletTagName(firstFakeBullet),\n };\n levelInfo.listsMetadata[itemMetadata.wordListId] = listMetadata;\n args.lists[listMetadata.uniqueListId.toString()] = listMetadata;\n }\n else if (!listMetadata.ignore && listMetadata.numberOfItems == 1) {\n // This is the second item we've seen for this list.. we'll compare the 2 fake bullet\n // items we have an decide if we create ordered or unordered lists based on this.\n // This is the best way we can do this since we cannot read the metadata that Word\n // puts in the head of the HTML...\n var secondFakeBullet = getFakeBulletText(node, LOOKUP_DEPTH);\n listMetadata.tagName =\n listMetadata.firstFakeBullet == secondFakeBullet ? 'UL' : 'OL';\n }\n // Set the unique id to the list\n itemMetadata.uniqueListId = listMetadata.uniqueListId;\n // Check if we need to ignore this list... we'll either know already that we need to ignore\n // it, or we'll know it because the previous list items are not next to this one\n if (listMetadata.ignore ||\n (listMetadata.tagName == 'OL' &&\n listMetadata.numberOfItems > 0 &&\n levelInfo.currentUniqueListId != itemMetadata.uniqueListId)) {\n // We need to ignore this item... and we also need to forget about the lists that\n // are not at the root level\n listMetadata.ignore = true;\n args.currentListIdsByLevels[0].currentUniqueListId = -1;\n args.currentListIdsByLevels = args.currentListIdsByLevels.slice(0, 1);\n }\n else {\n // This is an item we don't need to ignore... If added lists deep under this one before\n // we'll drop their ids from the list of ids per level.. this is because this list item\n // breaks the deeper lists.\n if (args.currentListIdsByLevels.length > itemMetadata.level) {\n args.currentListIdsByLevels = args.currentListIdsByLevels.slice(0, itemMetadata.level);\n }\n levelInfo.currentUniqueListId = itemMetadata.uniqueListId;\n // Add the list item into the list of items to be processed\n args.listItems.push(itemMetadata);\n listMetadata.numberOfItems++;\n }\n args.lastProcessedItem = node;\n }\n else {\n // Here, we know that this is not a list item, but we'll want to check if it is one \"no bullet\" list items...\n // these can be created by creating a bullet and hitting delete on it it... The content will continue to be indented, but there will\n // be no bullet and the list will continue correctly after that. Visually, it looks like the previous item has multiple lines, but\n // the HTML generated has multiple paragraphs with the same class. We'll merge these when we find them, so the logic doesn't skips\n // the list conversion thinking that the list items are not together...\n var last = args.lastProcessedItem;\n if (last &&\n getRealPreviousSibling(node) == last &&\n node.tagName == last.tagName &&\n node.className == last.className) {\n // Add 2 line breaks and move all the nodes to the last item\n last.appendChild(last.ownerDocument.createElement('br'));\n last.appendChild(last.ownerDocument.createElement('br'));\n while (node.firstChild != null) {\n last.appendChild(node.firstChild);\n }\n // Remove the item that we don't need anymore\n node.parentNode.removeChild(node);\n }\n }\n // Move to the next element are return true if more elements need to be processed\n args.currentIndex++;\n }\n return args.listItems.length > 0;\n}", "levels(root){\n if (root == null){\n return 0\n }else{\n return 1 + Math.max(this.levels(root.nodeL),this.levels(root.nodeL))\n }\n }", "get listText() {\n let listFormat = undefined;\n let list = this.viewer.getListById(this.listId);\n if (list instanceof WList && this.listLevelNumberIn > -1 && this.listLevelNumberIn < 9) {\n let listLevel = list.getListLevel(this.listLevelNumber);\n if (listLevel instanceof WListLevel) {\n if (listLevel.listLevelPattern === 'Bullet') {\n listFormat = listLevel.numberFormat;\n }\n else {\n listFormat = listLevel.numberFormat;\n for (let i = 0; i < 9; i++) {\n let levelPattern = '%' + (i + 1);\n if (listFormat.indexOf(levelPattern) > -1) {\n let level = i === this.listLevelNumberIn ? listLevel : list.getListLevel(i);\n let listTextElement = this.selection.getListTextElementBox(this.selection.start.paragraph);\n let listText = listTextElement ? listTextElement.text : '';\n listFormat = listText;\n }\n }\n }\n }\n }\n return listFormat;\n }", "function processList(ul) {\n if (!ul.childNodes || ul.childNodes.length == 0) { return; }\n // Iterate LIs\n var childNodesLength = ul.childNodes.length;\n for (var itemi = 0; itemi < childNodesLength; itemi++) {\n var item = ul.childNodes[itemi];\n if (item.nodeName == \"LI\") {\n // Iterate things in this LI\n var subLists = false;\n var itemChildNodesLength = item.childNodes.length;\n for (var sitemi = 0; sitemi < itemChildNodesLength; sitemi++) {\n var sitem = item.childNodes[sitemi];\n if (sitem.nodeName == \"UL\") {\n subLists = true;\n processList(sitem);\n }\n }\n var s = document.createElement(\"SPAN\");\n var t = '\\u00A0'; // &nbsp;\n s.className = nodeLinkClass;\n if (subLists) {\n // This LI has UL's in it, so it's a +/- node\n if (item.className == null || item.className == \"\") {\n item.className = nodeClosedClass;\n }\n // If it's just text, make the text work as the link also\n if (item.firstChild.nodeName == \"#text\") {\n t = t + item.firstChild.nodeValue;\n item.removeChild(item.firstChild);\n }\n s.onclick = treeNodeOnclick;\n }\n else {\n // No sublists, so it's just a bullet node\n item.className = nodeBulletClass;\n s.onclick = retFalse;\n }\n s.appendChild(document.createTextNode(t));\n item.insertBefore(s, item.firstChild);\n }\n }\n }", "function xWalkUL(oUL,data,fn)\r\n{\r\n var r, ul, li = xFirstChild(oUL);\r\n while (li) {\r\n ul = xFirstChild(li,'ul');\r\n r = fn(oUL,li,ul,data);\r\n if (ul) {\r\n if (!r || !xWalkUL(ul,data,fn)) {return 0;};\r\n }\r\n li = xNextSib(li);\r\n }\r\n return 1;\r\n}", "function processList(ul) {\n if (!ul.childNodes || ul.childNodes.length==0) { return; }\n // Iterate LIs\n var childNodesLength = ul.childNodes.length;\n for (var itemi=0;itemi<childNodesLength;itemi++) {\n var item = ul.childNodes[itemi];\n item = $(item);\n if (item.nodeName == \"LI\") {\n // Iterate things in this LI\n var subLists = false;\n var itemChildNodesLength = item.childNodes.length;\n for (var sitemi=0;sitemi<itemChildNodesLength;sitemi++) {\n var sitem = item.childNodes[sitemi];\n if (sitem.nodeName==\"UL\") {\n subLists = true;\n processList(sitem);\n }\n }\n var s= document.createElement(\"SPAN\");\n var t= '\\u00A0'; // &nbsp;\n s.className = nodeLinkClass;\n if (subLists) {\n // This LI has UL's in it, so it's a +/- node\n //if (item.className==null || item.className==\"\") {\n if (!item.hasClass(nodeClosedClass)) {\n item.addClass(nodeClosedClass);\n }\n // If it's just text, make the text work as the link also\n if (item.firstChild.nodeName==\"#text\") {\n t = t+item.firstChild.nodeValue;\n item.removeChild(item.firstChild);\n }\n s.onclick = treeNodeOnclick;\n }\n else {\n // No sublists, so it's just a bullet node\n item.addClass(nodeBulletClass);\n s.onclick = retFalse;\n }\n s.appendChild(document.createTextNode(t));\n item.insertBefore(s,item.firstChild);\n }\n }\n}", "function scanLevel(element){if(element){for(var i=0,len=element.length;i<len;i++){if(element[i].nodeName.toLowerCase()===nodeName){return element[i];}}}return null;}", "function mt(e){var t=null,i=e;if(i.liDom.previousSibling){var n=gt(i.liDom.previousSibling);t=n||i.liDom.previousSibling.node}else t=i.parent;return t}", "get levels() {\n return this.getNodeByVariableCollectionId('levels').variableCollection;\n }", "function getLevel(){\n return level\n}", "function isListContent(node) {\n return ListItem_1.isListItem(node);\n}", "function getLevel (d) {\n var init\n init = d[0].level\n if (_.every(d, function (g) {\n if (_.isArray(g)) return true\n return g.level == init\n })) {\n return init\n } else {\n return\n }\n }", "getListTextListLevel(listLevel, listValue) {\n switch (listLevel.listLevelPattern) {\n case 'UpRoman':\n return this.getAsRoman(listValue).toUpperCase();\n case 'LowRoman':\n return this.getAsRoman(listValue).toLowerCase();\n case 'UpLetter':\n return this.getAsLetter(listValue).toUpperCase();\n case 'LowLetter':\n return this.getAsLetter(listValue).toLowerCase();\n case 'Arabic':\n return (listValue).toString();\n case 'LeadingZero':\n return this.getAsLeadingZero(listValue);\n case 'Number':\n return (listValue).toString();\n case 'OrdinalText':\n return (listValue).toString();\n case 'Ordinal':\n return (listValue).toString();\n case 'FarEast':\n return (listValue).toString();\n case 'Special':\n return (listValue).toString();\n default:\n return '';\n }\n }", "getListLevelPattern(value) {\n switch (value) {\n case 0:\n return 'Arabic';\n case 1:\n return 'UpRoman';\n case 2:\n return 'LowRoman';\n case 3:\n return 'UpLetter';\n case 4:\n return 'LowLetter';\n case 5:\n return 'Ordinal';\n case 6:\n return 'Number';\n case 7:\n return 'OrdinalText';\n case 8:\n return 'LeadingZero';\n case 9:\n return 'Bullet';\n case 10:\n return 'FarEast';\n case 11:\n return 'Special';\n default:\n return 'None';\n }\n }", "function walk_list(ul, level)\n {\n var result = [];\n ul.children('li').each(function(i,e){\n var state, li = $(e), sublist = li.children('ul');\n var node = {\n id: dom2id(li),\n classes: String(li.attr('class')).split(' '),\n virtual: li.hasClass('virtual'),\n level: level,\n html: li.children().first().get(0).outerHTML,\n text: li.children().first().text(),\n children: walk_list(sublist, level+1)\n }\n\n if (sublist.length) {\n node.childlistclass = sublist.attr('class');\n }\n if (node.children.length) {\n if (node.collapsed === undefined)\n node.collapsed = sublist.css('display') == 'none';\n\n // apply saved state\n state = get_state(node.id, node.collapsed);\n if (state !== undefined) {\n node.collapsed = state;\n sublist[(state?'hide':'show')]();\n }\n\n if (!li.children('div.treetoggle').length)\n $('<div class=\"treetoggle '+(node.collapsed ? 'collapsed' : 'expanded') + '\">&nbsp;</div>').appendTo(li);\n\n li.attr('aria-expanded', node.collapsed ? 'false' : 'true');\n }\n if (li.hasClass('selected')) {\n li.attr('aria-selected', 'true');\n selection = node.id;\n }\n\n li.data('id', node.id);\n\n // declare list item as treeitem\n li.attr('role', 'treeitem').attr('aria-level', node.level+1);\n\n // allow virtual nodes to receive focus\n if (node.virtual) {\n li.children('a:first').attr('tabindex', '0');\n }\n\n result.push(node);\n indexbyid[node.id] = node;\n });\n\n ul.attr('role', level == 0 ? 'tree' : 'group');\n\n return result;\n }", "function displayNodes(DOC)\r\n\r\n{\r\n NodesAsList += \"<ol>\";\r\n \r\n // Loop through all of the children of the current node\r\n for (var i = 0; i < DOC.childNodes.length; i++)\r\n {\r\n var Node = DOC.childNodes[i]; \r\n \r\n // If the node is valid then write its data\r\n if (Node)\r\n {\r\n var Class = (Node.nodeType == 3) ? \"TextNode\" : \"NonTextNode\";\r\n\r\n NodesAsList += \"<li class=\" + Class + \">\";\r\n NodesAsList += \"<font color='red'>Element: \" + Node.nodeName +\r\n //\"</font><font color='blue'> Text: \" + Node.innerText +\r\n \"</font><font color='Green'> ID: \" + Node.id + \r\n \"</font><font color='purple'> Class: \" + Node.className + \"</font>\";\r\n \r\n // If the node has any children then process each of them\r\n if (Node.hasChildNodes())\r\n {\r\n displayNodes(Node);\r\n }\r\n }\r\n NodesAsList += \"</li>\";\r\n }\r\n\r\n NodesAsList += \"</ol>\";\t\r\n}", "function _getNodeType(liElement){\n\t\t\tvar rel = $(liElement).attr(\"rel\");\n\t\t\tif(!rel || rel === \"default\") rel = \"file\";\n\t\t\treturn rel;\n\t\t}", "getHierarchyLevel() {\n\t if (this.hierarchyLevel > -1) {\n\t return this.hierarchyLevel;\n\t }\n\t // since the template may have visual elements from different leves, output the highest value\n\t // between all sub-hierarchies\n\t if (this.visualElements.length === 0) {\n\t return 0;\n\t }\n\t const subHierarchies = this.visualElements.map(v => v.getHierarchyLevel());\n\t this.hierarchyLevel = Math.max(...subHierarchies) + 1;\n\t return this.hierarchyLevel;\n\t }", "findNodeLevel(node, findvalue, level) {\n if (findvalue == node.value) {\n return level;\n } else {\n if (node.left) return this.findNodeLevel(node.left, findvalue, level + 1);\n if (node.right)\n return this.findNodeLevel(node.right, findvalue, level + 1);\n return level;\n }\n }", "function scanLevel(element) {\n if (element) {\n for (var i = 0, len = element.length; i < len; i++) {\n if (element[i].nodeName.toLowerCase() === nodeName) {\n return element[i];\n }\n }\n }\n return null;\n }", "function printLevels( node, list, solve) {\r\n for(i = 1; i <10; i++) {\r\n let newElement = document.createElement('li');\r\n newElement.textContent = list[i] + \" = \" + solve[i];\r\n\r\n //append element to end of list\r\n node.appendChild(newElement);\r\n }\r\n}", "function createLevelLists() {\n return {\n listsMetadata: {},\n currentUniqueListId: -1,\n };\n}", "function scanLevel(element) {\n if ( element ) {\n for (var i = 0, len = element.length; i < len; i++) {\n if (element[i].nodeName.toLowerCase() === nodeName) {\n return element[i];\n }\n }\n }\n return null;\n }", "function scanLevel(element) {\n if ( element ) {\n for (var i = 0, len = element.length; i < len; i++) {\n if (element[i].nodeName.toLowerCase() === nodeName) {\n return element[i];\n }\n }\n }\n return null;\n }", "function scanLevel(element) {\n if ( element ) {\n for (var i = 0, len = element.length; i < len; i++) {\n if (element[i].nodeName.toLowerCase() === nodeName) {\n return element[i];\n }\n }\n }\n return null;\n }", "function rSllLength(node) {\n return node != null ? 1 + rSllLength(node.next) : 0 \n}", "function getLevel(id) {\n\t\tvar level = 0;\n\t\twhile($(\".select2-results__options li[parent][val='\" + id + \"']\").length > 0) {\n\t\t\tid = $(\".select2-results__options li[val='\" + id + \"']\").attr(\"parent\");\n\t\t\tlevel++;\n\t\t}\n\t\treturn level;\n\t}", "function scanLevel(element) {\n if ( element ) {\n for (var i = 0, len = element.length; i < len; i++) {\n if (element[i].nodeName.toLowerCase() === nodeName) {\n return element[i];\n }\n }\n }\n return null;\n }", "function getLevel(id) {\n\t\tvar level = 0;\n\t\twhile ($(\".select2-results__options li[parent][val='\" + id + \"']\").length > 0) {\n\t\t\tid = $(\".select2-results__options li[val='\" + id + \"']\").attr(\"parent\");\n\t\t\tlevel++;\n\t\t}\n\t\treturn level;\n\t}", "function getListForItem(\n opts: Options,\n editor: Editor,\n value: Value,\n item: Block\n): ?Block {\n const { document } = value;\n const parent = document.getParent(item.key);\n return parent && isList(opts, parent) ? parent : null;\n}", "function corpusType(node) {\n if (node instanceof Element) {\n if (node.tagName != 'SPAN') {return null}\n\n if (node.key) {\n return node.type\n } \n }\n\n return null\n}", "function calcNodeLevel(node){\n if(!node.parent || node.parent.type == 'root')\n return 0;\n return calcNodeLevel(node.parent) + 1;\n}", "function getRootNode( target ) {\n\t\t\tif ( target.hasClass( 'n-list-group-item' ) ) {\n\t\t\t\tif ( target.is( 'dd' ) ) {\n\t\t\t\t\treturn target.closest( 'dl' );\n\t\t\t\t}\n\t\t\t\treturn target.closest( 'ul' );\n\t\t\t}\n\n\t\t\tif ( target.hasClass( 'tree-branch-name' ) || target.hasClass( 'tree-item-name' ) ) {\n\t\t\t\treturn target.closest( 'ul.tree' );\n\t\t\t}\n\n\t\t\treturn target.closest( 'ul' );\n\t\t}", "function processNodeConvert(wordConverter) {\n var args = wordConverter.wordConverterArgs;\n args.currentIndex = 0;\n while (args.currentIndex < args.listItems.length) {\n var metadata = args.listItems[args.currentIndex];\n var node = metadata.originalNode;\n var listMetadata = args.lists[metadata.uniqueListId.toString()];\n if (!listMetadata.ignore) {\n // We have a list item that we need to convert, get or create the list\n // that hold this item out\n var list = getOrCreateListForNode(wordConverter, node, metadata, listMetadata);\n if (list) {\n // Clean the element out.. this call gets rid of the fake bullet and unneeded nodes\n cleanupListIgnore(node, LOOKUP_DEPTH);\n // Create a new list item and transfer the children\n var li = node.ownerDocument.createElement('LI');\n while (node.firstChild) {\n li.appendChild(node.firstChild);\n }\n // Append the list item into the list\n list.appendChild(li);\n // Remove the node we just converted\n node.parentNode.removeChild(node);\n if (listMetadata.tagName == 'UL') {\n wordConverter.numBulletsConverted++;\n }\n else {\n wordConverter.numNumberedConverted++;\n }\n }\n }\n args.currentIndex++;\n }\n return wordConverter.numBulletsConverted > 0 || wordConverter.numNumberedConverted > 0;\n}", "function getOpenNodes()\n{\n\tvalue = new Array();\n\tvar myLists = document.getElementsByTagName(\"UL\");\n\tfor(i=0;i<myLists.length;i++)\n\t{\n\t\tif(myLists[i].className == \"Xtree\" && myLists[i].style.display == \"block\")\tvalue += myLists[i].id + \"-\";\n\t}\n\treturn value;\n}", "getNodeMaxLevel(node, max) {\n\t\tif (node == undefined)\n\t\t\treturn;\n\n\t\tif (node.level > max.level)\n\t\t\tmax.level = node.level;\n\n\t\tfor (let i = 0; i < node.kids.length; i++) {\n\t\t\tthis.getNodeMaxLevel(node.kids[i], max)\n\t\t}\n\n\t\treturn max.level;\n\t}", "function listItem(node, parent, position, bullet) {\n var self = this;\n var style = self.options.listItemIndent;\n var loose = node.loose;\n var children = node.children;\n var length = children.length;\n var values = [];\n var index = -1;\n var value;\n var indent;\n var spacing;\n\n while (++index < length) {\n values[index] = self.visit(children[index], node);\n }\n\n value = CHECKBOX_MAP[node.checked] + values.join(loose ? '\\n\\n' : '\\n');\n\n if (style === '1' || (style === 'mixed' && value.indexOf('\\n') === -1)) {\n indent = bullet.length + 1;\n spacing = ' ';\n } else {\n indent = Math.ceil((bullet.length + 1) / 4) * 4;\n spacing = repeat(' ', indent - bullet.length);\n }\n\n value = bullet + spacing + pad(value, indent / 4).slice(indent);\n\n if (loose && parent.children.length - 1 !== position) {\n value += '\\n';\n }\n\n return value;\n}", "function ITGetLevel() {\r\n\t//attributes.rank dovrebbe essere il road rank\r\n //attributes.lockRank è il lock alla quale il segmento è bloccato.\r\n\tvar sel = unsafeWindow.W.selectionManager.selectedItems;\r\n\tvar max = sel[0].attributes.lockRank; //ITuserRank(sel[0]);\r\n //for(var propertyName in sel[0]) {\r\n //console.log(propertyName + ': ' + sel[0][propertyName]);\r\n\t\t//}\r\n\tfor (i = 1; i < sel.length; i++) \r\n {\r\n //consoleLog(sel[i].attributes.lockRank);\r\n\t\tif (max == 5)\r\n\t\t\treturn 6; //5+1\r\n\t\t//var usrRank = ITuserRank(sel[i]);\r\n\t\tif (sel[i].attributes.lockRank > max) \r\n {\r\n\t\t\tmax = rank;\r\n\t\t}\r\n\t}\r\n\treturn max + 1;\r\n}", "getWindDangerLevel(data) {\n var j, len, ref, w;\n ref = this.getWarnings(data);\n for (j = 0, len = ref.length; j < len; j++) {\n w = ref[j];\n if (w.type === 'wind') {\n return w.level;\n }\n }\n return 0;\n }", "function listItem() {\n // To do: remove `loose` in next major.\n return {type: LIST_ITEM, loose: false, spread: false, children: []}\n}", "getLevel(feature) {\n return feature.properties.level;\n }", "function getListForItem(opts, value, item) {\n var document = value.document;\n\n var parent = document.getParent(item.key);\n return parent && (0, _isList2.default)(opts, parent) ? parent : null;\n}", "function getFolderTree() {\n \n var root = DocsList.getRootFolder()\n var first_level = root.getFolders()\n for (var i = 0; i < first_level.length; i++) {\n Logger.log(first_level[i].getName()) \n }\n}", "_readListItem(token) {\n let item = null,\n // The item of the list\n list = null,\n // The list itself\n next = this._readListItem; // The next function to execute\n const previousList = this._subject,\n // The previous list that contains this list\n stack = this._contextStack,\n // The stack of parent contexts\n parent = stack[stack.length - 1]; // The parent containing the current list\n\n switch (token.type) {\n case '[':\n // Stack the current list quad and start a new quad with a blank node as subject\n this._saveContext('blank', this._graph, list = this._blankNode(), this.RDF_FIRST, this._subject = item = this._blankNode());\n next = this._readBlankNodeHead;\n break;\n case '(':\n // Stack the current list quad and start a new list\n this._saveContext('list', this._graph, list = this._blankNode(), this.RDF_FIRST, this.RDF_NIL);\n this._subject = null;\n break;\n case ')':\n // Closing the list; restore the parent context\n this._restoreContext('list', token);\n // If this list is contained within a parent list, return the membership quad here.\n // This will be `<parent list element> rdf:first <this list>.`.\n if (stack.length !== 0 && stack[stack.length - 1].type === 'list') this._emit(this._subject, this._predicate, this._object, this._graph);\n // Was this list the parent's subject?\n if (this._predicate === null) {\n // The next token is the predicate\n next = this._readPredicate;\n // No list tail if this was an empty list\n if (this._subject === this.RDF_NIL) return next;\n }\n // The list was in the parent context's object\n else {\n next = this._getContextEndReader();\n // No list tail if this was an empty list\n if (this._object === this.RDF_NIL) return next;\n }\n // Close the list by making the head nil\n list = this.RDF_NIL;\n break;\n case 'literal':\n // Regular literal, can still get a datatype or language\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n next = this._readListItemDataTypeOrLang;\n }\n // Pre-datatyped string literal (prefix stores the datatype)\n else {\n item = this._literal(token.value, this._namedNode(token.prefix));\n next = this._getContextEndReader();\n }\n break;\n case '{':\n // Start a new formula\n if (!this._n3Mode) return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph, this._subject, this._predicate, this._graph = this._blankNode());\n return this._readSubject;\n default:\n if ((item = this._readEntity(token)) === undefined) return;\n }\n\n // Create a new blank node if no item head was assigned yet\n if (list === null) this._subject = list = this._blankNode();\n\n // Is this the first element of the list?\n if (previousList === null) {\n // This list is either the subject or the object of its parent\n if (parent.predicate === null) parent.subject = list;else parent.object = list;\n } else {\n // Continue the previous list with the current list\n this._emit(previousList, this.RDF_REST, list, this._graph);\n }\n // If an item was read, add it to the list\n if (item !== null) {\n // In N3 mode, the item might be a path\n if (this._n3Mode && (token.type === 'IRI' || token.type === 'prefixed')) {\n // Create a new context to add the item's path\n this._saveContext('item', this._graph, list, this.RDF_FIRST, item);\n this._subject = item, this._predicate = null;\n // _readPath will restore the context and output the item\n return this._getPathReader(this._readListItem);\n }\n // Output the item\n this._emit(list, this.RDF_FIRST, item, this._graph);\n }\n return next;\n }", "function hc_nodelistindexnotzero() {\n var success;\n var doc;\n var elementList;\n var employeeNode;\n var employeeList;\n var child;\n var childName;\n doc = load(\"hc_staff\");\n elementList = doc.getElementsByTagName(\"p\");\n employeeNode = elementList.item(2);\n employeeList = employeeNode.childNodes;\n\n child = employeeList.item(3);\n childName = child.nodeName;\n\n \n\tif(\n\t(\"#text\" == childName)\n\t) {\n\tassertEquals(\"childName_space\",\"#text\",childName);\n \n\t}\n\t\n\t\telse {\n\t\t\tassertEqualsAutoCase(\"element\", \"childName_strong\",\"strong\",childName);\n \n\t\t}\n\t\n}", "getLevel() {\n return this.level;\n }", "get leaves () {\r\n return this.levels[0];\r\n }", "function getLevel () {\n var val = window.location.search.match(new RegExp('[?&]level=(\\\\d+)'));\n val = val ? val[1] : MIN_LEVEL;\n val = Math.min(Math.max(MIN_LEVEL, val), MAX_LEVEL);\n return val;\n }", "get depth() {}", "function markListLevels($lists, level) {\n level = level || 1;\n $lists\n .addClass('fp-level-' + level)\n .each(function (index, element) {\n $(this).data().flexiPanda.level = level;\n });\n $lists = $lists.children('li').children('ul');\n if ($lists.length > 0) {\n markListLevels($lists, (level + 1));\n }\n }", "function SllLength (node) {\n let leng = 0;\n\n while(node) {\n node = node.next;\n leng++;\n }\n\n return leng;\n}", "levelOrderSearch(node) {\n if (node === null) {\n return;\n }\n\n let discoveredNodes = [];\n discoveredNodes.push(node);\n\n while(discoveredNodes.length > 0) {\n let currentNode = discoveredNodes[0];\n console.log(currentNode.data);\n\n if (currentNode.leftChild !== null) {\n discoveredNodes.push(currentNode.leftChild);\n }\n if (currentNode.rightChild !== null) {\n discoveredNodes.push(currentNode.rightChild);\n }\n\n discoveredNodes.shift();\n }\n }", "function nextRight(node) {\n\t var children = node.children;\n\t return children.length && node.isExpand ? children[children.length - 1] : node.hierNode.thread;\n\t }", "function listItem(node, parent, position, bullet, ordered) {\n var self = this\n var style = self.options.listItemIndent\n var marker = `\\\\item` || self.options.bullet // bullet\n var spread = node.spread == null ? true : node.spread\n var checked = node.checked\n var children = node.children\n var length = children.length\n var values = []\n var index = -1\n var value\n var indent\n var spacing = space\n\n while (++index < length) {\n values[index] = self.visit(children[index], node)\n }\n\n value = values.join(lineFeed)\n\n if (typeof checked === 'boolean') {\n // Note: I’d like to be able to only add the space between the check and\n // the value, but unfortunately github does not support empty list-items\n // with a checkbox :(\n value =\n (checked ? `[\\\\done] ` : ' ') +\n value\n } else {\n marker += ' '\n }\n\n indent = marker.length + 1\n\n return marker + value\n}", "function getLangInfo(node, attribute, fallBack) {\n var string = fallBack;\n if (node != undefined && node != null) {\n if (attribute == false) {\n string = node.childNodes[0].nodeValue;\n } else {\n string = node.getAttribute(attribute);\n }\n }\n return string;\n}", "function setItemLevel(menuItem, level){\n\t // For root node\n\t // Careful level is 0 from the begining because it is the index from the map function\n\t if(!level){\n\t menuItem.level = 1;\n\t } else {\n\t menuItem.level = ++level;\n\t }\n\n\t if(menuItem.items && menuItem.items.length) {\n\t menuItem.items.map(function(node) {\n\t return setItemLevel(node, menuItem.level);\n\t });\n\t }\n\n\t return menuItem;\n\t \t}", "function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) {\n if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos) ||\n ts.rangeContainsStartEnd(range, startPos, endPos) /* Not to miss zero-range nodes e.g. JsxText */) {\n if (inheritedIndentation !== -1 /* Unknown */) {\n return inheritedIndentation;\n }\n }\n else {\n var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line;\n var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile);\n var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options);\n if (startLine !== parentStartLine || startPos === column) {\n // Use the base indent size if it is greater than\n // the indentation of the inherited predecessor.\n var baseIndentSize = formatting.SmartIndenter.getBaseIndentation(options);\n return baseIndentSize > column ? baseIndentSize : column;\n }\n }\n return -1 /* Unknown */;\n }", "function getLogLevel(cb) {\n Settings.get(1).run().then(function(res) {\n cb(null, res.logLevel);\n }).catch(Errors.DocumentNotFound, function(err) {\n initSettings(function(err){\n if(err) cb(err);\n\n getLogLevel(cb);\n });\n }).error(function(error) {\n cb(error);\n });\n}", "get level () { return this._level; }", "function listDepth(tree, level = 0, result = []) {\n\n if (tree === null) {\n return result;\n }\n\n if (result[level] === undefined) {\n result[level] = new LinkedList();\n result[level].addToTail(tree.value);\n\n } else {\n result[level].addToTail(tree.value);\n }\n\n level++;\n\n listDepth(tree.left, level, result);\n listDepth(tree.right, level, result);\n return result;\n\n}", "function unorderedItems(node) {\n var self = this;\n var bullet = self.options.bullet;\n var fn = self.visitors.listItem;\n var children = node.children;\n var length = children.length;\n var index = -1;\n var values = [];\n\n while (++index < length) {\n values[index] = fn.call(self, children[index], node, index, bullet);\n }\n\n return values.join('\\n');\n}", "get root () {\r\n return this.levels[this.levels.length - 1][0];\r\n }", "get dir() { return this.level % 2 ? RTL : LTR; }", "function checkList() {\n\treturn document.getElementsByTagName('li').length;\n}", "_readListItem(token) {\n var item = null,\n // The item of the list\n list = null,\n // The list itself\n previousList = this._subject,\n // The previous list that contains this list\n stack = this._contextStack,\n // The stack of parent contexts\n parent = stack[stack.length - 1],\n // The parent containing the current list\n next = this._readListItem; // The next function to execute\n\n switch (token.type) {\n case '[':\n // Stack the current list quad and start a new quad with a blank node as subject\n this._saveContext('blank', this._graph, list = this._blank(), this.RDF_FIRST, this._subject = item = this._blank());\n\n next = this._readBlankNodeHead;\n break;\n\n case '(':\n // Stack the current list quad and start a new list\n this._saveContext('list', this._graph, list = this._blank(), this.RDF_FIRST, this.RDF_NIL);\n\n this._subject = null;\n break;\n\n case ')':\n // Closing the list; restore the parent context\n this._restoreContext(); // If this list is contained within a parent list, return the membership quad here.\n // This will be `<parent list element> rdf:first <this list>.`.\n\n\n if (stack.length !== 0 && stack[stack.length - 1].type === 'list') this._emit(this._subject, this._predicate, this._object, this._graph); // Was this list the parent's subject?\n\n if (this._predicate === null) {\n // The next token is the predicate\n next = this._readPredicate; // No list tail if this was an empty list\n\n if (this._subject === this.RDF_NIL) return next;\n } // The list was in the parent context's object\n else {\n next = this._getContextEndReader(); // No list tail if this was an empty list\n\n if (this._object === this.RDF_NIL) return next;\n } // Close the list by making the head nil\n\n\n list = this.RDF_NIL;\n break;\n\n case 'literal':\n // Regular literal, can still get a datatype or language\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n next = this._readListItemDataTypeOrLang;\n } // Pre-datatyped string literal (prefix stores the datatype)\n else {\n item = this._literal(token.value, this._namedNode(token.prefix));\n next = this._getContextEndReader();\n }\n\n break;\n\n default:\n if ((item = this._readEntity(token)) === undefined) return;\n } // Create a new blank node if no item head was assigned yet\n\n\n if (list === null) this._subject = list = this._blank(); // Is this the first element of the list?\n\n if (previousList === null) {\n // This list is either the subject or the object of its parent\n if (parent.predicate === null) parent.subject = list;else parent.object = list;\n } else {\n // Continue the previous list with the current list\n this._emit(previousList, this.RDF_REST, list, this._graph);\n } // If an item was read, add it to the list\n\n\n if (item !== null) {\n // In N3 mode, the item might be a path\n if (this._n3Mode && (token.type === 'IRI' || token.type === 'prefixed')) {\n // Create a new context to add the item's path\n this._saveContext('item', this._graph, list, this.RDF_FIRST, item);\n\n this._subject = item, this._predicate = null; // _readPath will restore the context and output the item\n\n return this._getPathReader(this._readListItem);\n } // Output the item\n\n\n this._emit(list, this.RDF_FIRST, item, this._graph);\n }\n\n return next;\n }", "function getFakeBulletTagName(fakeBullet) {\n return isFakeBullet(fakeBullet) ? 'UL' : 'OL';\n}", "static getLevelNumber (_priority) {\n switch ((typeof(_priority) == \"string\") ? _priority.toLowerCase(): _priority) {\n case -2:\n case \"-2\":\n case \"hidden\":\n return -2; break;\n case -1:\n case \"-1\":\n case \"none\":\n return -1; break;\n case 0:\n case \"0\":\n case \"emer\":\n case \"emergency\":\n return 0; break;\n case \"1\":\n case 1:\n case \"alert\":\n return 1; break;\n case 2:\n case \"2\":\n case \"crit\":\n case \"critical\":\n return 2; break;\n case 3:\n case \"3\":\n case \"err\":\n case \"error\":\n return 3; break;\n case 4:\n case \"4\":\n case \"warn\":\n case \"warning\":\n return 4; break;\n case 5:\n case \"5\":\n case \"notice\":\n return 5; break;\n case 6:\n case \"6\":\n case \"info\":\n case \"informational\":\n return 6; break;\n // debug:\n default:\n return 7; break;\n }\n }", "function getTag(el) {\n return (el.firstChild === null) ? {'UL':'LI','DL':'DT','TR':'TD'}[el.tagName] || el.tagName : el.firstChild.tagName;\n}", "function getTag(el) {\n return (el.firstChild === null) ? {'UL':'LI','DL':'DT','TR':'TD'}[el.tagName] || el.tagName : el.firstChild.tagName;\n}", "function getID(node) {\n var parentID = \"\", nodeIndex = \"\";\n if(node.marktype != undefined && !node.group) {\n // The node is a root node.\n return \"0\";\n } else if(node.marktype != undefined && node.group) {\n // The node is a GROUP mark.\n parentID = getID(node.group);\n if(node.group.items.indexOf(node) != -1) {\n // The node exists in the parent's list of items.\n myIndex = node.group.items.indexOf(node) + \"i\";\n } else if(node.group.axisItems.indexOf(node) != -1) {\n // The node exists in the parent's list of axis items.\n myIndex = node.group.axisItems.indexOf(node) + \"a\";\n } else if(node.group.legendItems.indexOf(node) != -1) {\n // The node exists in the parent's list of legend items.\n myIndex = node.group.legendItems.indexOf(node) + \"l\";\n } else {\n myIndex = \"NaN\";\n }\n } else if(node.mark) {\n // The node is an ITEM.\n parentID = getID(node.mark);\n myIndex = node.mark.items.indexOf(node);\n }\n return parentID + \".\" + myIndex;\n} // end getID", "function generateLevel(createElement, items, level, defaultOpenLevel) {\n const children = [];\n\n items.forEach(item => {\n const navItem = getNavItem(createElement, item);\n\n if (item.hasOwnProperty('children')) {\n children.push(\n createElement(NavigationList, {\n props: {\n level,\n defaultOpenLevel,\n },\n }, [\n navItem,\n ...generateLevel(createElement,\n item.children,\n level + 1,\n defaultOpenLevel),\n ])\n );\n } else {\n children.push(createElement('li', [\n navItem,\n ]));\n }\n });\n\n return children;\n}", "get_level(mod) {\n const parts = mod.split(\".\");\n let tmp_mod = this._modules;\n //find the desired node to set level for\n for (let ind = 0; ind < parts.length; ++ind) {\n if (!tmp_mod[parts[ind]]) {\n if (console_wrapper) {\n console_wrapper.original_console();\n }\n console.log(\"No such module \" + mod + \" registered\");\n if (console_wrapper) {\n console_wrapper.wrapper_console();\n }\n return;\n }\n tmp_mod = tmp_mod[parts[ind]];\n }\n return tmp_mod.__level;\n }", "function displayLevel(lvl) {\n DOMelems.displyaLevel.innerText = `level: ${lvl}`;\n}", "function levelWidth(root) {\n let widthArr = [0];\n let nodeArr = [root, \"STOP\"];\n while(nodeArr.length > 1) {\n let curr = nodeArr.shift();\n if(curr === \"STOP\") {\n widthArr.push(0);\n nodeArr.push(\"STOP\"); \n }\n else {\n widthArr[widthArr.length-1] = widthArr[widthArr.length-1] +1 ;\n nodeArr.push(...curr.children); \n }\n }\n return widthArr;\n}", "function getRootNode(selfUL) {\r\n\t\tvar rootNodes = getRootNodes(selfUL);\r\n\t\tif (rootNodes.length) {\r\n\t\t\treturn rootNodes[0];\r\n\t\t} else {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}", "function nextLeft(node) {\n\t var children = node.children;\n\t return children.length && node.isExpand ? children[0] : node.hierNode.thread;\n\t }", "function checkListLen() {\n return ul.children.length;\n}", "_selectLevel() {\n this.level = this.win === 0 ? document.getElementById('level').value : this.level;\n return this.level;\n }", "function headingLevel(elm) {\n return (elm[0].nodeName.match(/^h(\\d)/i) || [null, 0])[1] * 1;\n }", "function TreeMenuComponent_li_2_Template(rf, ctx) { if (rf & 1) {\n ɵɵelementStart(0, \"li\");\n ɵɵelement(1, \"tree-menu-item\", 3);\n ɵɵelementEnd();\n} if (rf & 2) {\n const key_r1 = ctx.$implicit;\n const ctx_r0 = ɵɵnextContext();\n ɵɵadvance(1);\n ɵɵproperty(\"label\", key_r1)(\"value\", ctx_r0.record.get(key_r1))(\"schema\", ctx_r0.schema.properties[key_r1])(\"path\", ctx_r0.getChildPath(key_r1))(\"depth\", 1);\n} }", "function is_high_level( node ) {\n return node['max_depth'] >= 2;\n }" ]
[ "0.6671859", "0.6670137", "0.63771504", "0.621316", "0.61555356", "0.57949203", "0.57655865", "0.57128376", "0.5696541", "0.5672241", "0.5568159", "0.5547469", "0.55358106", "0.55073684", "0.5431245", "0.5384732", "0.5379493", "0.53498167", "0.5301591", "0.5284614", "0.5268219", "0.52372193", "0.5213167", "0.5209525", "0.5202185", "0.5187021", "0.51364917", "0.5129644", "0.51270175", "0.50742346", "0.5063157", "0.5056284", "0.5055936", "0.50320536", "0.5031744", "0.49837142", "0.4979467", "0.49681696", "0.4943339", "0.4942449", "0.49368834", "0.4934474", "0.4934474", "0.4934474", "0.49286288", "0.492165", "0.49146792", "0.49112117", "0.48903504", "0.48792604", "0.48764405", "0.48753294", "0.48640722", "0.48472017", "0.48227835", "0.4817761", "0.47917604", "0.47898906", "0.47629502", "0.47608554", "0.47603714", "0.47334385", "0.47157055", "0.47120988", "0.47069144", "0.47045493", "0.47002244", "0.46965048", "0.46958312", "0.4691443", "0.46905774", "0.46893534", "0.4687384", "0.4678841", "0.4670129", "0.4659262", "0.465266", "0.46515563", "0.46498218", "0.46490315", "0.46470407", "0.46433353", "0.46429917", "0.46419215", "0.46368706", "0.46344906", "0.4632895", "0.4632895", "0.4624911", "0.4618499", "0.46178472", "0.4617527", "0.46099624", "0.46072912", "0.4597567", "0.45957127", "0.45934176", "0.45759735", "0.45751545", "0.4571547" ]
0.84267855
0
Based on a node that is a list item in a MS Word document, this returns the marker for the list.
function msWordListMarker (node, bulletListMarker) { const markerElement = node.querySelector('span[style="mso-list:Ignore"]') // assume the presence of a period in a marker is an indicator of an // ordered list if (!markerElement || !markerElement.textContent.match(/\./)) { return bulletListMarker } const nodeLevel = getMsWordListLevel(node) let item = 1 let potentialListItem = node.previousElementSibling // loop through previous siblings to count list items while (potentialListItem) { const itemLevel = getMsWordListLevel(potentialListItem) // if there are no more list items or we encounter the lists parent // we don't need to count further if (!itemLevel || itemLevel < nodeLevel) { break } // if on same level increment the list items if (nodeLevel === itemLevel) { item += 1 } potentialListItem = potentialListItem.previousElementSibling } return `${item}.` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getListItemMetadata(node) {\n if (node.nodeType == 1 /* Element */) {\n var listatt = getStyleValue(node, MSO_LIST_STYLE_NAME);\n if (listatt && listatt.length > 0) {\n try {\n // Word mso-list property holds 3 space separated values in the following format: lst1 level1 lfo0\n // Where:\n // (0) List identified for the metadata in the &lt;head&gt; of the document. We cannot read the &lt;head&gt; metada\n // (1) Level of the list. This also maps to the &lt;head&gt; metadata that we cannot read, but\n // for almost all cases, it maps to the list identation (or level). We'll use it as the\n // list indentation value\n // (2) Contains a specific list identifier.\n // Example value: \"l0 level1 lfo1\"\n var listprops = listatt.split(' ');\n if (listprops.length == 3) {\n return {\n level: parseInt(listprops[1].substr('level'.length)),\n wordListId: listatt,\n originalNode: node,\n uniqueListId: 0,\n };\n }\n }\n catch (e) { }\n }\n }\n return null;\n}", "function listItem( node ) {\n\t\treturn node.type == CKEDITOR.NODE_ELEMENT && node.is( 'li' );\n\t}", "function markerPoint(current) {\r\n\t\tvar $this = $(current);\r\n\t\tvar li = $($this.parents()[0]);\r\n\t\treturn new Point(parseInt(li.css('left')),parseInt(li.css('top')));\r\n\t}", "function getMsWordListLevel (node) {\n if (node.nodeName.toLowerCase() !== 'p') {\n return\n }\n\n const style = node.getAttribute('style')\n const levelMatch = style && style.match(/mso-list/i) ? style.match(/level(\\d+)/) : null\n return levelMatch ? parseInt(levelMatch[1], 10) : undefined\n}", "function listItem(node, parent, position, bullet, ordered) {\n var self = this\n var style = self.options.listItemIndent\n var marker = `\\\\item` || self.options.bullet // bullet\n var spread = node.spread == null ? true : node.spread\n var checked = node.checked\n var children = node.children\n var length = children.length\n var values = []\n var index = -1\n var value\n var indent\n var spacing = space\n\n while (++index < length) {\n values[index] = self.visit(children[index], node)\n }\n\n value = values.join(lineFeed)\n\n if (typeof checked === 'boolean') {\n // Note: I’d like to be able to only add the space between the check and\n // the value, but unfortunately github does not support empty list-items\n // with a checkbox :(\n value =\n (checked ? `[\\\\done] ` : ' ') +\n value\n } else {\n marker += ' '\n }\n\n indent = marker.length + 1\n\n return marker + value\n}", "function addListElementPosition(pinIcon, type) {\n var contains = $.inArray(type, listleftMarkerArray);\n if (contains == -1) {\n listleftMarkerArray.push(type);\n $('<li><a><img src=' + pinIcon + ' class=\"ui-li-icon ui-corner-none\">' + type + '<span class=\"ui-li-count\" data-bind=\"text: '+type+'\"</a></a><a id='+type+' class=\"position\"></a></li>').appendTo('#listleftMarker');\n //refresh list\n ko.applyBindings(mapMarkerNumberNeeds);\n $('#listleftMarker').listview(\"refresh\");\n }\n }", "function parseListMarker(parser, container) {\n var rest = parser.currentLine.slice(parser.nextNonspace);\n var match;\n var nextc;\n var data = {\n type: 'bullet',\n tight: true,\n bulletChar: '',\n start: 0,\n delimiter: '',\n padding: 0,\n markerOffset: parser.indent,\n // GFM: Task List Item\n task: false,\n checked: false,\n };\n if (parser.indent >= 4) {\n return null;\n }\n if ((match = rest.match(reBulletListMarker))) {\n data.type = 'bullet';\n data.bulletChar = match[0][0];\n }\n else if ((match = rest.match(reOrderedListMarker)) &&\n (container.type !== 'paragraph' || match[1] === '1')) {\n data.type = 'ordered';\n data.start = parseInt(match[1], 10);\n data.delimiter = match[2];\n }\n else {\n return null;\n }\n // make sure we have spaces after\n nextc = peek(parser.currentLine, parser.nextNonspace + match[0].length);\n if (!(nextc === -1 || nextc === C_TAB || nextc === C_SPACE)) {\n return null;\n }\n // if it interrupts paragraph, make sure first line isn't blank\n if (container.type === 'paragraph' &&\n !parser.currentLine.slice(parser.nextNonspace + match[0].length).match(reNonSpace)) {\n return null;\n }\n // we've got a match! advance offset and calculate padding\n parser.advanceNextNonspace(); // to start of marker\n parser.advanceOffset(match[0].length, true); // to end of marker\n var spacesStartCol = parser.column;\n var spacesStartOffset = parser.offset;\n do {\n parser.advanceOffset(1, true);\n nextc = peek(parser.currentLine, parser.offset);\n } while (parser.column - spacesStartCol < 5 && isSpaceOrTab(nextc));\n var blankItem = peek(parser.currentLine, parser.offset) === -1;\n var spacesAfterMarker = parser.column - spacesStartCol;\n if (spacesAfterMarker >= 5 || spacesAfterMarker < 1 || blankItem) {\n data.padding = match[0].length + 1;\n parser.column = spacesStartCol;\n parser.offset = spacesStartOffset;\n if (isSpaceOrTab(peek(parser.currentLine, parser.offset))) {\n parser.advanceOffset(1, true);\n }\n }\n else {\n data.padding = match[0].length + spacesAfterMarker;\n }\n return data;\n}", "isMarker(node) {\n return node && node.nodeType === 8 && node.data.startsWith(marker);\n }", "function skipOrderedListMarker(state, startLine) {\n var ch, start = state.bMarks[startLine] + state.tShift[startLine], pos = start, max = state.eMarks[startLine];\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) {\n return -1;\n }\n ch = state.src.charCodeAt(pos++);\n if (ch < 48 /* 0 */ || ch > 57 /* 9 */) {\n return -1;\n }\n for (;;) {\n // EOL -> fail\n if (pos >= max) {\n return -1;\n }\n ch = state.src.charCodeAt(pos++);\n if (ch >= 48 /* 0 */ && ch <= 57 /* 9 */) {\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) {\n return -1;\n }\n continue;\n }\n // found valid marker\n if (ch === 41 /* ) */ || ch === 46 /* . */) {\n break;\n }\n return -1;\n }\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n if (!isSpace$7(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n }", "function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace$3(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n /* istanbul ignore if */\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace$7(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}", "function getListForItem(\n opts: Options,\n editor: Editor,\n value: Value,\n item: Block\n): ?Block {\n const { document } = value;\n const parent = document.getParent(item.key);\n return parent && isList(opts, parent) ? parent : null;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine];\n\n // List marker should have at least 2 chars (digit + dot)\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) { return -1; }\n\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n return pos;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n start = state.bMarks[startLine] + state.tShift[startLine],\n pos = start,\n max = state.eMarks[startLine]; // List marker should have at least 2 chars (digit + dot)\n\n if (pos + 1 >= max) {\n return -1;\n }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30\n /* 0 */\n || ch > 0x39\n /* 9 */\n ) {\n return -1;\n }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) {\n return -1;\n }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30\n /* 0 */\n && ch <= 0x39\n /* 9 */\n ) {\n // List marker should have no more than 9 digits\n // (prevents integer overflow in browsers)\n if (pos - start >= 10) {\n return -1;\n }\n\n continue;\n } // found valid marker\n\n\n if (ch === 0x29\n /* ) */\n || ch === 0x2e\n /* . */\n ) {\n break;\n }\n\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function getMarkerId(l, inverse) {\n return (l.type ? l.type : 'normal') + l.id + (inverse ? 'inverse' : '');\n }", "handleListItemClick(position) {\n const markers = this.state.refs.markers;\n const marker = markers.filter(marker => {\n const location = marker.props.location;\n const _position = [location.latitude, location.longitude];\n return ''+_position === ''+position\n })\n .shift();\n\n if (marker) {\n const map = this.state.refs.map;\n const listItems = this.state.refs.listItems;\n\n map.leafletElement.flyTo(position);\n\n listItems.map(listItem => this.constructor.handleListItemSelection(listItem, position));\n }\n }", "function skipOrderedListMarker(state, startLine) {\n var ch,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n return pos;\n }", "function skipOrderedListMarker(state, startLine) {\n\t var ch,\n\t pos = state.bMarks[startLine] + state.tShift[startLine],\n\t max = state.eMarks[startLine];\n\n\t if (pos + 1 >= max) { return -1; }\n\n\t ch = state.src.charCodeAt(pos++);\n\n\t if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n\t for (;;) {\n\t // EOL -> fail\n\t if (pos >= max) { return -1; }\n\n\t ch = state.src.charCodeAt(pos++);\n\n\t if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\t continue;\n\t }\n\n\t // found valid marker\n\t if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n\t break;\n\t }\n\n\t return -1;\n\t }\n\n\n\t if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n\t // \" 1.test \" - is not a list item\n\t return -1;\n\t }\n\t return pos;\n\t}", "function skipOrderedListMarker(state, startLine) {\n\t var ch,\n\t pos = state.bMarks[startLine] + state.tShift[startLine],\n\t max = state.eMarks[startLine];\n\n\t if (pos + 1 >= max) { return -1; }\n\n\t ch = state.src.charCodeAt(pos++);\n\n\t if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n\t for (;;) {\n\t // EOL -> fail\n\t if (pos >= max) { return -1; }\n\n\t ch = state.src.charCodeAt(pos++);\n\n\t if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\t continue;\n\t }\n\n\t // found valid marker\n\t if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n\t break;\n\t }\n\n\t return -1;\n\t }\n\n\n\t if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n\t // \" 1.test \" - is not a list item\n\t return -1;\n\t }\n\t return pos;\n\t}", "function skipOrderedListMarker(state, startLine) {\n\t var ch,\n\t pos = state.bMarks[startLine] + state.tShift[startLine],\n\t max = state.eMarks[startLine];\n\n\t if (pos + 1 >= max) { return -1; }\n\n\t ch = state.src.charCodeAt(pos++);\n\n\t if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n\t for (;;) {\n\t // EOL -> fail\n\t if (pos >= max) { return -1; }\n\n\t ch = state.src.charCodeAt(pos++);\n\n\t if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n\t continue;\n\t }\n\n\t // found valid marker\n\t if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n\t break;\n\t }\n\n\t return -1;\n\t }\n\n\n\t if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n\t // \" 1.test \" - is not a list item\n\t return -1;\n\t }\n\t return pos;\n\t}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n return pos;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n return pos;\n}", "function skipOrderedListMarker(state, startLine) {\n var ch,\n pos = state.bMarks[startLine] + state.tShift[startLine],\n max = state.eMarks[startLine];\n\n if (pos + 1 >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }\n\n for (;;) {\n // EOL -> fail\n if (pos >= max) { return -1; }\n\n ch = state.src.charCodeAt(pos++);\n\n if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {\n continue;\n }\n\n // found valid marker\n if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {\n break;\n }\n\n return -1;\n }\n\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20/* space */) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n\t var marker, pos, max;\n\n\t pos = state.bMarks[startLine] + state.tShift[startLine];\n\t max = state.eMarks[startLine];\n\n\t if (pos >= max) { return -1; }\n\n\t marker = state.src.charCodeAt(pos++);\n\t // Check bullet\n\t if (marker !== 0x2A/* * */ &&\n\t marker !== 0x2D/* - */ &&\n\t marker !== 0x2B/* + */) {\n\t return -1;\n\t }\n\n\t if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n\t // \" 1.test \" - is not a list item\n\t return -1;\n\t }\n\n\t return pos;\n\t}", "function skipBulletListMarker(state, startLine) {\n\t var marker, pos, max;\n\n\t pos = state.bMarks[startLine] + state.tShift[startLine];\n\t max = state.eMarks[startLine];\n\n\t if (pos >= max) { return -1; }\n\n\t marker = state.src.charCodeAt(pos++);\n\t // Check bullet\n\t if (marker !== 0x2A/* * */ &&\n\t marker !== 0x2D/* - */ &&\n\t marker !== 0x2B/* + */) {\n\t return -1;\n\t }\n\n\t if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n\t // \" 1.test \" - is not a list item\n\t return -1;\n\t }\n\n\t return pos;\n\t}", "function skipBulletListMarker(state, startLine) {\n\t var marker, pos, max;\n\n\t pos = state.bMarks[startLine] + state.tShift[startLine];\n\t max = state.eMarks[startLine];\n\n\t if (pos >= max) { return -1; }\n\n\t marker = state.src.charCodeAt(pos++);\n\t // Check bullet\n\t if (marker !== 0x2A/* * */ &&\n\t marker !== 0x2D/* - */ &&\n\t marker !== 0x2B/* + */) {\n\t return -1;\n\t }\n\n\t if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n\t // \" 1.test \" - is not a list item\n\t return -1;\n\t }\n\n\t return pos;\n\t}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n marker = state.src.charCodeAt(pos++); // Check bullet\n\n if (marker !== 0x2A\n /* * */\n && marker !== 0x2D\n /* - */\n && marker !== 0x2B\n /* + */\n ) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n} // Search `\\d+[.)][\\n ]`, returns next pos after marker on success", "function isListContent(node) {\n return ListItem_1.isListItem(node);\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n if (pos >= max) { return -1; }\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n\n return pos;\n }", "function getListForItem(opts, value, item) {\n var document = value.document;\n\n var parent = document.getParent(item.key);\n return parent && (0, _isList2.default)(opts, parent) ? parent : null;\n}", "function getID(node) {\n var parentID = \"\", nodeIndex = \"\";\n if(node.marktype != undefined && !node.group) {\n // The node is a root node.\n return \"0\";\n } else if(node.marktype != undefined && node.group) {\n // The node is a GROUP mark.\n parentID = getID(node.group);\n if(node.group.items.indexOf(node) != -1) {\n // The node exists in the parent's list of items.\n myIndex = node.group.items.indexOf(node) + \"i\";\n } else if(node.group.axisItems.indexOf(node) != -1) {\n // The node exists in the parent's list of axis items.\n myIndex = node.group.axisItems.indexOf(node) + \"a\";\n } else if(node.group.legendItems.indexOf(node) != -1) {\n // The node exists in the parent's list of legend items.\n myIndex = node.group.legendItems.indexOf(node) + \"l\";\n } else {\n myIndex = \"NaN\";\n }\n } else if(node.mark) {\n // The node is an ITEM.\n parentID = getID(node.mark);\n myIndex = node.mark.items.indexOf(node);\n }\n return parentID + \".\" + myIndex;\n} // end getID", "createItemNode(item, typeMap, orderedTypes) {\n let li = document.createElement('li');\n li.className = ITEM_CLASS;\n // Set the raw, un-marked up value as a data attribute.\n li.setAttribute('data-value', item.raw);\n let matchNode = document.createElement('code');\n matchNode.className = 'jp-Completer-match';\n // Use innerHTML because search results include <mark> tags.\n matchNode.innerHTML = apputils_1.defaultSanitizer.sanitize(item.text, {\n allowedTags: ['mark']\n });\n // If there are types provided add those.\n if (!coreutils_1.JSONExt.deepEqual(typeMap, {})) {\n let typeNode = document.createElement('span');\n let type = typeMap[item.raw] || '';\n typeNode.textContent = (type[0] || '').toLowerCase();\n let colorIndex = (orderedTypes.indexOf(type) % N_COLORS) + 1;\n typeNode.className = 'jp-Completer-type';\n typeNode.setAttribute(`data-color-index`, colorIndex.toString());\n li.title = type;\n let typeExtendedNode = document.createElement('code');\n typeExtendedNode.className = 'jp-Completer-typeExtended';\n typeExtendedNode.textContent = type.toLocaleLowerCase();\n li.appendChild(typeNode);\n li.appendChild(matchNode);\n li.appendChild(typeExtendedNode);\n }\n else {\n li.appendChild(matchNode);\n }\n return li;\n }", "function listItem(node, parent, position, bullet) {\n var self = this;\n var style = self.options.listItemIndent;\n var loose = node.loose;\n var children = node.children;\n var length = children.length;\n var values = [];\n var index = -1;\n var value;\n var indent;\n var spacing;\n\n while (++index < length) {\n values[index] = self.visit(children[index], node);\n }\n\n value = CHECKBOX_MAP[node.checked] + values.join(loose ? '\\n\\n' : '\\n');\n\n if (style === '1' || (style === 'mixed' && value.indexOf('\\n') === -1)) {\n indent = bullet.length + 1;\n spacing = ' ';\n } else {\n indent = Math.ceil((bullet.length + 1) / 4) * 4;\n spacing = repeat(' ', indent - bullet.length);\n }\n\n value = bullet + spacing + pad(value, indent / 4).slice(indent);\n\n if (loose && parent.children.length - 1 !== position) {\n value += '\\n';\n }\n\n return value;\n}", "function ListItem() {}", "function ListItem() {}", "function ListItem() {}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 42 /* * */ && marker !== 45 /* - */ && marker !== 43 /* + */) {\n return -1;\n }\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n if (!isSpace$7(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n return pos;\n }", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n if (pos >= max) { return -1; }\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n if (pos >= max) { return -1; }\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n if (pos >= max) { return -1; }\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max && state.src.charCodeAt(pos) !== 0x20) {\n // \" 1.test \" - is not a list item\n return -1;\n }\n\n return pos;\n}", "function addListElement(pinIcon, type) {\n var contains = $.inArray(type, listleftMarkerArray);\n if (contains == -1) {\n listleftMarkerArray.push(type);\n $('<li><a><img src=' + pinIcon + ' class=\"ui-li-icon ui-corner-none\">' + type + '<span class=\"ui-li-count\" data-bind=\"text: '+type+'\"</a></a><a id='+type+' class=\"need\"></a></li>').appendTo('#listleftMarker');\n //refresh list\n ko.applyBindings(mapMarkerNumberNeeds);\n $('#listleftMarker').listview(\"refresh\");\n }\n }", "function getOffsetsAfterListCheck(docStr,offset1,offset2){\n var newOffset1 = offset1;\n var newOffset2 = offset2;\n var openListItems = new Array(\"<ol>\",\"<OL>\",\"<ul>\",\"<UL>\");\n var i, nItems = openListItems.length, closeListItem1, closeListItem2, currItem;\n var selStr = docStr.substring(offset1,offset2);\n \n for (i=0;i<nItems;i++){\n if (selStr.indexOf(openListItems[i]) == 0){\n currItem = openListItems[i];\n closeListItem1 = \"</\" + currItem.toLowerCase().substring(1);\n closeListItem2 = \"</\" + currItem.toUpperCase().substring(1);\n \n if ( selStr.indexOf(closeListItem1) == -1 && selStr.indexOf(closeListItem2) == -1){\n newOffset1 += currItem.length;\n }\n } \n }\n return new Array(newOffset1,newOffset2);\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function getFakeBulletText(node, levels) {\n // Word uses the following format for their bullets:\n // &lt;p style=\"mso-list:l1 level1 lfo2\"&gt;\n // &lt;span style=\"...\"&gt;\n // &lt;span style=\"mso-list:Ignore\"&gt;1.&lt;span style=\"...\"&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;/span&gt;\n // &lt;/span&gt;\n // Content here...\n // &lt;/p&gt;\n //\n // Basically, we need to locate the mso-list:Ignore SPAN, which holds either one text or image node. That\n // text or image node will be the fake bullet we are looking for\n var result = null;\n var child = node.firstChild;\n while (!result && child) {\n // First, check if we need to convert the Word list comments into real elements\n child = fixWordListComments(child, true /*removeComments*/);\n // Check if this is the node that holds the fake bullets (mso-list: Ignore)\n if (isIgnoreNode(child)) {\n // Yes... this is the node that holds either the text or image data\n result = child.textContent.trim();\n // This is the case for image case\n if (result.length == 0) {\n result = 'o';\n }\n }\n else if (child.nodeType == 1 /* Element */ && levels > 1) {\n // If this is an element and we are not in the last level, try to get the fake bullet\n // out of the child\n result = getFakeBulletText(child, levels - 1);\n }\n child = child.nextSibling;\n }\n return result;\n}", "function _getBoundaryItemOfSameList( item, getFirst ) {\n const indent = item.getAttribute( 'indent' );\n const direction = getFirst ? 'previousSibling' : 'nextSibling';\n\n let result = item;\n\n while ( item[ direction ] && item[ direction ].is( 'listItem' ) && item[ direction ].getAttribute( 'indent' ) >= indent ) {\n item = item[ direction ];\n\n if ( item.getAttribute( 'indent' ) == indent ) {\n result = item;\n }\n }\n\n return result;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace$7(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function skipBulletListMarker(state, startLine) {\n var marker, pos, max, ch;\n\n pos = state.bMarks[startLine] + state.tShift[startLine];\n max = state.eMarks[startLine];\n\n marker = state.src.charCodeAt(pos++);\n // Check bullet\n if (marker !== 0x2A/* * */ &&\n marker !== 0x2D/* - */ &&\n marker !== 0x2B/* + */) {\n return -1;\n }\n\n if (pos < max) {\n ch = state.src.charCodeAt(pos);\n\n if (!isSpace$3(ch)) {\n // \" -test \" - is not a list item\n return -1;\n }\n }\n\n return pos;\n}", "function getOrCreateListForNode(wordConverter, node, metadata, listMetadata) {\n // First get the last list next to this node under the specified level. This code\n // path will return the list or will create lists if needed\n var list = recurringGetOrCreateListAtNode(node, metadata.level, listMetadata);\n // Here use the unique list ID to detect if we have the right list...\n // it is possible to have 2 different lists next to each other with different formats, so\n // we want to detect this an create separate lists for those cases\n var listId = CustomData_1.getObject(wordConverter.customData, list, UNIQUE_LIST_ID_CUSTOM_DATA);\n // If we have a list with and ID, but the ID is different than the ID for this list item, this\n // is a completely new list, so we'll append a new list for that\n if ((listId && listId != metadata.uniqueListId) || (!listId && list.firstChild)) {\n var newList = node.ownerDocument.createElement(listMetadata.tagName);\n list.parentNode.insertBefore(newList, list.nextSibling);\n list = newList;\n }\n // Set the list id into the custom data\n CustomData_1.setObject(wordConverter.customData, list, UNIQUE_LIST_ID_CUSTOM_DATA, metadata.uniqueListId);\n // This call will convert the list if needed to the right type of list required. This can happen\n // on the cases where the first list item for this list is located after a deeper list. for that\n // case, we will have created a UL for it, and we may need to convert it\n return convertListIfNeeded(wordConverter, list, listMetadata);\n}", "handleMarkerClick(position) {\n const listItems = this.state.refs.listItems;\n const listItem = listItems.filter(listItem => {\n const location = listItem.props.location;\n const _position = [ location.latitude, location.longitude ];\n\n return _position.toString() === position.toString();\n }).shift();\n\n if (listItem) {\n this.scrollTo(listItem.state.item.parentElement, listItem.state.item.offsetTop, 1250);\n listItems.map(listItem => this.constructor.handleListItemSelection(listItem, position));\n }\n }", "function listItem() {\n // To do: remove `loose` in next major.\n return {type: LIST_ITEM, loose: false, spread: false, children: []}\n}", "function getPrefixedItem(itemText) {\n\t\t\t// The numbering flag is unset when called by autoindent.\n\t\t\tif(args.tag === undefined){\n\t\t\t\targs.tag = /^\\s*\\d/.test(itemText) ? \"ol\" : \"ul\";\n\t\t\t}\n\t\t\t\n\t\t\t// Renumber/bullet the list element.\n\t\t\titemText = itemText.replace(/^[ ]{0,3}([*+-]|\\d+[.])\\s/gm, function( _ ) {\n\t\t\t\treturn getItemPrefix();\n\t\t\t});\n\t\t\t\t\n\t\t\treturn itemText;\n\t\t}", "function getBookmarkId(bookmark){\n return $(bookmark)\n .closest('.list-item')\n .data('id');\n}", "function ListItem() { }", "function elementPositionInList(list, position) {\n\t// -1 to match list numbering starting from 0 not 1;\n\tvar arrayPosition = position - 1;\n\treturn list[arrayPosition]\n}", "function findMarker(datasetNum, arrayOfMarkers) {\n return arrayOfMarkers[datasetNum].current.marker;\n }", "function listItemType(el) {\n const content = el.textContent.trim();\n\n if (/^[\\*\\-]\\s/.test(content)) {\n return 'ul';\n } else if (/^\\d+\\.\\s/.test(content)) {\n return 'ol';\n }\n\n return false;\n}", "function findMarker(lat, lng) {\r\n\t\t\tvar marker = null;\r\n\r\n\t\t\tfor (var i = 0; i < _markers.length; i++) {\r\n\t\t\t\tvar m = _markers[i];\r\n\t\t\t\tif (m.position.lat() == lat && m.position.lng() == lng) {\r\n\t\t\t\t\tmarker = m;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn marker;\r\n\r\n\t\t} // findMarker", "function getMarkedSpanFor(spans, marker) {\n\t\t if (spans) for (var i = 0; i < spans.length; ++i) {\n\t\t var span = spans[i];\n\t\t if (span.marker == marker) return span;\n\t\t }\n\t\t }", "@expression(\"item <position> of <List>\", { types: [ undefined, List ], returns: undefined })\n\tstatic item_of(list, position) {\n\t\tif (!(list instanceof List)) return undefined\n\t\treturn list.items[position - 1]\n\t}", "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}", "markLocation(node/*, startLocation*/) {\n return node;\n }", "function getMarkedSpanFor(spans, marker) {\n\t\t if (spans) { for (var i = 0; i < spans.length; ++i) {\n\t\t var span = spans[i];\n\t\t if (span.marker == marker) { return span }\n\t\t } }\n\t\t }", "function getDocumentListItem(type) {\n const defaultListItem = S.documentTypeListItem(type);\n const defaultDocList = S.documentTypeList(type);\n return S.listItem()\n .id(type)\n .schemaType(type)\n .title(defaultListItem.getTitle())\n .icon(defaultListItem.getIcon())\n .child(\n S.documentList()\n .id(type)\n .schemaType(type)\n .title(defaultListItem.getTitle())\n .filter('_type == $type && $userId in authors[]._ref')\n .params({userId: window._sanityUser?.id, type})\n .menuItems([\n {\n title: 'Create new',\n icon: PlusIcon,\n intent: {\n type: 'create',\n params: {\n type: type,\n template: type,\n },\n },\n showAsAction: true,\n },\n ...defaultDocList.getMenuItems(),\n ])\n );\n}", "function getItemIdFromElement(bookmark) {\n return $(bookmark)\n .closest('.bookmark-list-element')\n .data('item-id');\n }", "function getMarkedSpanFor(spans, marker) {\n\t if (spans) for (var i = 0; i < spans.length; ++i) {\n\t var span = spans[i];\n\t if (span.marker == marker) return span;\n\t }\n\t }", "function getMarkedSpanFor(spans, marker) {\n\t if (spans) for (var i = 0; i < spans.length; ++i) {\n\t var span = spans[i];\n\t if (span.marker == marker) return span;\n\t }\n\t }", "function getMarkedSpanFor(spans, marker) {\n\t if (spans) for (var i = 0; i < spans.length; ++i) {\n\t var span = spans[i];\n\t if (span.marker == marker) return span;\n\t }\n\t }", "get _focusedItem() {\n const that = this;\n\n if (!that.$ || !that.$.listBox) {\n return;\n }\n\n return that.$.listBox._focusedItem;\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }", "function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }" ]
[ "0.6383941", "0.5983728", "0.5825579", "0.57465446", "0.56685364", "0.5611878", "0.55966437", "0.54887724", "0.5485846", "0.5417776", "0.54173636", "0.541471", "0.54123527", "0.54061615", "0.54061615", "0.54061615", "0.54061615", "0.54061615", "0.54061615", "0.54061615", "0.54061615", "0.5354709", "0.5331688", "0.5307137", "0.5268838", "0.52417576", "0.52417576", "0.52417576", "0.52386355", "0.52386355", "0.52386355", "0.5222592", "0.5222592", "0.5222592", "0.5217117", "0.5198144", "0.51519", "0.51436543", "0.5133783", "0.5133281", "0.5132977", "0.5095798", "0.5095798", "0.5095798", "0.5092007", "0.507486", "0.507486", "0.507486", "0.50338835", "0.50226", "0.50222373", "0.50222373", "0.50222373", "0.50222373", "0.50222373", "0.50222373", "0.50222373", "0.50222373", "0.50222373", "0.5019722", "0.501844", "0.5005668", "0.5000376", "0.50000185", "0.49911317", "0.49324125", "0.4925526", "0.49246755", "0.48892346", "0.4882429", "0.48770133", "0.4861669", "0.4859395", "0.4851115", "0.48416775", "0.48374867", "0.4834815", "0.48281398", "0.48259676", "0.48258513", "0.48168552", "0.48168552", "0.48168552", "0.4792023", "0.47907737", "0.47907737", "0.47907737", "0.47907737", "0.47907737", "0.47907737", "0.47907737", "0.47907737", "0.47907737", "0.47907737", "0.47907737", "0.47907737", "0.47907737", "0.47907737", "0.47907737", "0.47907737" ]
0.7593762
0
Scroll to Our STORY
function scrollToStory() { storyText.scrollIntoView(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function work() {\n var scrollPos = $(\".case-studies\").offset().top - 80;\n TweenLite.to(window, 2, {scrollTo: {y: scrollPos}, ease: Power2.easeOut});\n }", "function goToWidget(id) {\n document.getElementById(id).scrollIntoView({\n behavior: 'smooth'\n });\n }", "function goToSection(_sectionName,offest){\n var section = document.getElementById(_sectionName) ;\n gsap.to(window, {duration: 1 , scrollTo: {y: section.offsetTop-offest}});\n\n}", "function navigate_to(id){\n\t\t\t$('html, body').animate({scrollTop: $(\".section\"+id).offset().top}, 500);\n\t}", "function goToByScroll(where){\n\t$('html,body').animate({scrollTop: where.offset().top},'slow');\n}", "function projectSection() {\n window.scrollTo({ top: 2250, behavior: 'smooth' })\n}", "function scrollTO(section) {\n section.scrollIntoView();\n}", "function goToByScroll(id) {\n $('html,body').animate({scrollTop: $(id).offset().top - 70}, 'slow');\n }", "function goToByScroll(id) {\n $('html,body').animate({scrollTop: $(id).offset().top - 70}, 'slow');\n }", "scrollToTitle() {\n let $self = $(`#${this.idDOM}`);\n\n $('html, body').animate({\n scrollTop: $self.find('.article-big-category').offset().top\n }, 1000);\n }", "function goToLondon(){\n\tvar position = findPos(document.getElementById(\"London\"));\n\teasingScrollAction(position,2000);\n}", "function goToByScroll(dataslide) {\n htmlbody.animate({\n scrollTop:$('.slide[data-slide=\"' + dataslide + '\"]').offset().top\n }, 2000, 'easeInOutQuint');\n }", "function goToByScroll(dataslide) {\n htmlbody.animate({\n scrollTop: $('.slide[data-slide=\"' + dataslide + '\"]').offset().top\n }, 2000, 'easeInOutQuint');\n }", "function goToByScroll(dataslide) {\n htmlbody.animate({\n scrollTop: $('.slide[data-slide=\"' + dataslide + '\"]').offset().top\n }, 2000, 'easeInOutQuint');\n }", "function goToByScroll(dataslide) {\n htmlbody.animate({\n scrollTop: $('.slide[data-slide=\"' + dataslide + '\"]').offset().top\n }, 2000, 'easeInOutQuint');\n }", "function scroll() {\n\t\telement.scrollIntoView({behavior: \"smooth\"});\n\t\t\n\t}", "function scrollTo( id ) {\n scroller.scrollTo( id );\n}", "function goToByScroll(dataslide) {\n htmlbody.animate({\n scrollTop: $('.slide[data-slide=\"' + dataslide + '\"]').offset().top\n }, 2000, 'easeInOutQuint');\n }", "function topFunction() {\r\n const topsy = document.querySelector(\"#section1\");\r\n topsy.scrollIntoView({ behavior: \"smooth\" });\r\n}", "function scrollToTopBookNow() {\n\t\t\t//$(window).scrollTop($('.scrolltobooknow').offset().top);\n\t\t\tdocument.getElementById('scrolltobooknow').scrollIntoView(true);\n\t\t}", "pageScrollTo(){\n let element = document.getElementById( App.current_page );\n \n //scroll to the particular section of the page.\n if( element ){\n element.scrollIntoView({behavior: 'smooth'});\n }\n }", "function scrollToGame() {\n var element_to_scroll_to = $('.example-gameplay')[0];\n element_to_scroll_to.scrollIntoView();\n }", "function scrollToShowMe(oid) {\n obj = document.getElementById(oid);\n if (obj != null) {\n obj.scrollIntoView(true);\n obj.focus();\n }\n}", "function scrollToBio() {\n TweenLite.to(window, 0.5, {\n scrollTo: { y: `.bio-wrapper`, offsetY: 20 }\n });\n }", "function goToTokyo (){\n\tvar position = findPos(document.getElementById(\"Tokyo\"));\n\teasingScrollAction(position,2000);\n}", "function scrollTo( dest ) {\n $('html, body').animate({\n \tscrollTop: $( dest ).offset().top\n },750);\n}", "function scrollTo() {\n $('a.scroll').on(action, function() {\n if (location.pathname.replace(/^\\//, '') === this.pathname.replace(/^\\//, '') && location.hostname === this.hostname) {\n var target = $(this.hash);\n target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');\n if (target.length) {\n $('html,body').animate({\n scrollTop: target.offset().top\n }, 500);\n return false;\n }\n }\n });\n }", "function scrollTo() {\n $('a.scroll').on(action, function() {\n if (location.pathname.replace(/^\\//, '') === this.pathname.replace(/^\\//, '') && location.hostname === this.hostname) {\n var target = $(this.hash);\n target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');\n if (target.length) {\n $('html,body').animate({\n scrollTop: target.offset().top\n }, 500);\n return false;\n }\n }\n });\n }", "function gotoTop() {\n $anchorScroll('add-new-student-button');\n }", "function swoopTo(position){\n\t\t$('html, body').stop().animate({\n scrollTop: position\n }, 1000);\n\t}", "function focusScrollLondon(){\n\tconsole.log(\"Made it here into focus scrolling\");\n\tgoToLondon();\n\tspotlightLondon();\n}", "function showSynopsis(){\n window.scrollTo(0, document.getElementById('Synopsis').offsetTop);\n}", "function scrollToSection(self) {\n // get the target href\n var href = $(self).attr('href');\n\n // get the target position\n var targetPos = $(href).offset().top + 5;\n\n // scroll to target\n $('html, body').animate({\n scrollTop: targetPos\n }, 400);\n }", "function scrollDown() \n{\n console.log(\"hello\")\n document.querySelector(`.journalHTML`).scrollIntoView({\n behavior: \"auto\",\n block: \"center\",\n inline: \"center\"\n });\n}", "function redirect() {\n TREND_BLOCK.scrollIntoView({ behavior: \"smooth\" })\n}", "function readyToSearchScrollPosition() {\n window.scrollTo({\n 'top': scrollAnchor.offsetTop,\n 'left': 0,\n 'behavior': 'auto',\n });\n }", "function gotoAtop () {\n later ( ( () => {\n let t = $ (\"#highUp\").offset ().top;\n scrollTo (null, t);\n //scrollTo (null, 66);\n }), 3999);\n}", "function faqScrolltodiv(divname) {\n\t\t\tvar element = document.getElementById(\"physiotherapy\");\n\t element.scrollIntoView();\n\t\t}", "function readMore() {\n $('html, body').animate({\n scrollTop: $(\".project\").offset().top\n }, 800);\n }", "function clFun(secId) { \n \n // use scrollIntoView to scroll to the wanted section \n secId.scrollIntoView({behavior: \"smooth\", block: \"start\"});\n}", "breakoutClicked () {\n this.SceneManager.switchToUsingTransaction('Breakout/Level1', Transition.named('ScrollFrom', { direction: 'bottom' }))\n }", "function scrollTo(item) {\n $('html, body').animate({\n scrollTop: $(item).offset().top\n }, 500);\n }", "function scrollWin() {\r\n var url = window.location.href;\r\n if (url==\"http://localhost/Final-Blog/index.php\")\r\n {window.scrollTo(0, 550)}\r\n else {\r\n window.location.href = \"index.php\" ;\r\n }\r\n}", "function scrollTo(){\n if(window.location.hash) {\n var element_to_scroll_to = document.querySelectorAll(window.location.hash)[0];\n element_to_scroll_to.scrollIntoView();\n\n } \n}", "function scrollTo() {\n if ($('body').find('.scroll-to').length > 0) {\n $('.scroll-to').click(function () {\n scrollToLink = $(this).attr('rel');\n $('html, body').animate({\n scrollTop: $('#' + scrollToLink).offset().top\n }, 500);\n return false;\n });\n };\n }", "function go_targetd_section(e) {\r\n e = document.querySelector(\".\" + e).getBoundingClientRect().top;\r\n document.body.scrollTop = e;\r\n document.documentElement.scrollTop = e;\r\n}", "goTo(id) {\n this.setState({\n scrolling: true,\n currSlide: id\n });\n this.scrollTo();\n }", "function scrollToNextPage() {\n card_scroller.scrollBy(card_item_size, 0);\n }", "function scrolltodiv(divname) {\n\t\t\tif(divname = \"physiotherapy\") {\n\t\t\t\t$state.go(\"homepages.faq\");\n\t\t\t\tvm.scrolltodivName = \"physiotherapy\";\n\t\t\t}\n\t\t}", "function scrollToID(id) {\n document.querySelector('#'+id).scrollIntoView({\n behavior: 'smooth'\n });\n}", "function scrollToId(id) {\n document.getElementById(id).scrollIntoView(true);\n window.scrollBy(0, -60);\n}", "function scrollToObject() {\n\t\t\t$q.all([\n\t\t\t FindElement.byId(\"resultTableWrapper\"),\n\t\t\t FindElement.byQuery(\"#resultsTable .selectedRow\")\n\t\t\t ]).then(function(elements) {\n\t\t\t\t var table = angular.element(elements[0]);\n\t\t\t\t var selected = angular.element(elements[1]);\n\t\t\t\t var offset = 30;\n\t\t\t\t table.scrollToElement(selected, offset, 0);\n\t\t\t });\n\t\t\t//setFocus();\n\t\t}", "function scrollToTop() {\n Reporter_1.Reporter.debug('Scroll to the top of the page');\n scrollToPoint(0, 0);\n }", "function scrollToElement1() {\n document.querySelector(\"#about-us\").scrollIntoView({\n behavior: \"smooth\"\n });\n}", "function readyToSearchScrollPosition() {\n window.scrollTo({\n top: scrollAnchor.offsetTop,\n left: 0,\n behavior: 'auto',\n });\n }", "function scrollTo(yoffset) {\n window.scrollTo({\n top : yoffset,\n left : 0,\n // behavior : 'smooth',\n });\n}", "function goToParis(){\n\tvar position = findPos(document.getElementById(\"Paris\"));\n\teasingScrollAction(position,2000);\n}", "function scrollToObject() {\n\t\t\t$q.all([\n\t\t\t FindElement.byId(\"resultTableWrapper\"),\n\t\t\t FindElement.byQuery(\"#resultsTable .selectedRow\")\n\t\t\t ]).then(function(elements) {\n\t\t\t\t var table = angular.element(elements[0]);\n\t\t\t\t var selected = angular.element(elements[1]);\n\t\t\t\t var offset = 30;\n\t\t\t\t table.scrollToElement(selected, offset, 0);\n\t\t\t });\n\t\t\tsetFocus();\n\t\t}", "function scrollTo(target){\n\t\t$.scrollTo( $(target), 800 );\n\t}", "scrollTo() {\n window.scroll({\n top: this.getCurrSlide().offsetTop,\n left: 0,\n behavior: 'smooth'\n })\n }", "function scrollToStartHandler() {\n scrollTo({top: 0, behavior: 'smooth'});\n}", "function learnMoreFunction() {\n document.querySelector('#about').scrollIntoView({ \n behavior: 'smooth',\n block: 'center'\n });\n}", "function sec1() {\n var elmnt1 = document.getElementById(\"container\");\n elmnt1.scrollIntoView();\n}", "function scrollToQ(n){\n window.location.href=`#q-${n}`\n}", "pixelShooterClicked () {\n this.SceneManager.switchToUsingTransaction('PixelShooter/Level1', Transition.named('ScrollFrom', { direction: 'left' }))\n }", "function goToByScroll(id) {\n $('html, body').animate({\n scrollTop: $(\"#\"+id).offset().top\n },'slow');\n}", "goTop() {\n refs.galleryList.scrollIntoView({\n block: \"start\",\n behavior: \"smooth\",\n });\n }", "function scrollToHead(anchor) {\n scrollTo(anchor);\n }", "function scrollToHead(anchor) {\n scrollTo(anchor);\n }", "function scroll(divname){\n $('html, body').animate({\n scrollTop: ($(divname).first().offset().top)\n },150);\n}", "ScrollDown(ScrollTo){\n window.scrollTo(0,ScrollTo.offsetTop + 300)\n }", "function scrollTo( url ) {\n var hash = url.slice( url.lastIndexOf('#'), url.length );\n var $bookmark = $(hash);\n \n // if you're already at that URL just scroll to that position\n if( router.activeInstruction().params[0] == hash ) {\n $(\"body,html,document\").animate({ scrollTop: $bookmark.offset().top-65 });\n }\n // else add the url to the history and then scroll to that section (this is useful for a refresh since it will load on refresh, but won't cause a page reload)\n else {\n router.navigate( url, { replace: true, trigger: false } );\n $(\"body,html,document\").animate({ scrollTop: $bookmark.offset().top-65 });\n }\n }", "function scrollToStep(num) {\n getAtw().scrollToStep(num);\n}", "function scrollToTop() {\n\troot.scrollTo({\n\t\ttop: 0,\n\t\tbehavior: \"smooth\"\n\t});\n}", "function scroll() {\n var id = $stateParams.rid;\n if (id && _.find(vm.reviews, ['id', id])) {\n $timeout(function () {\n scrollToReview(id);\n });\n }\n }", "function scrollToTop() {\n\t\tcurrentLocation.hash = '#main';\n\t\twindow.scrollTo(0, this.offSetTop);\n\t}", "function scrollTo() {\n var hash = '#main';\n var destination = $(hash).offset().top;\n stopAnimatedScroll();\n $('html, body').stop().animate({\n scrollTop: destination\n }, 400, function() { window.location.hash = hash; });\n return false;\n }", "function scrollTo($selector) {\n\t\tvar trgt = $selector.attr('href');\n\n\t\t$('html, body').animate({\n\t\t\tscrollTop: $(trgt).offset().top - 72\n\t\t}, 1000);\n\t}", "function jumpto(sectionName){\n //window.location.hash = sectionName;\n document.getElementById(sectionName).scrollIntoView({behavior: 'smooth'});\n\n $('#dropdown').removeClass('show-dropdown');\n $('#dropdown').addClass('hide-dropdown');\n}", "function scrollTo(classOrId){\n $('html, body').animate({\n scrollTop: ($(classOrId).offset().top)\n }, 500);\n \n $(\".site-container\").scrollTop(0);\n}", "scrollToTheTopOfPage() {\r\n browser.executeScript('window.scrollTo(0,0);').then(function () {\r\n logger.Log().debug('++++++SCROLLED UP+++++');\r\n });\r\n }", "function scrollToElement(elt) { content.window.scrollTo(0, elt.offsetTop); }", "function goToConclusion() {\n dispatch.call('stop-force', null)\n SCROLLINGTO = 'conclusion_container'\n document.querySelector('#'+SCROLLINGTO).scrollIntoView({ \n behavior: 'smooth' \n });\n}", "function movepointer(offset){\n var token = window.location.pathname+window.location.search;\n var tStamp = new Date();\n if (offset === undefined){\n if (tStamp.getTime() - GM_getValue(token+\"_time\",tStamp.getTime()) > 600000){//10 minutes in milliseconds\n offset = 0;\n cursorpointer = 0;\n }\n else {\n offset = 0;\n cursorpointer = GM_getValue(token,0);\n }\n }\n if (cursorpointer > 0 && cursorpointer < stories.snapshotLength-1){\n if(cursorpointer + offset >= stories.snapshotLength)\n offset = stories.snapshotLength-cursorpointer-1;\n if(cursorpointer + offset < 0)\n offset = -cursorpointer;\n }\n //are we moving to a new topic...\n if (cursorpointer + offset >= 0 && cursorpointer + offset < stories.snapshotLength){\n getItem(\"cursor\").innerHTML = \"\";\n cursorpointer = cursorpointer + offset;\n GM_setValue(token,cursorpointer);\n GM_setValue(token+\"_time\",tStamp.getTime()+\"\");\n getItem(\"cursor\").innerHTML = CURSOR;\n //And now, to scroll to the proper location.\n //I could have used scrollInto, but that one doesn't work as nice as this.\n if (window.pageYOffset > getAbsoluteOffset(getItem(\"self\"))){\n window.scroll(window.pageXOffset,getAbsoluteOffset(getItem(\"self\")));\n }\n else {\n if (window.pageYOffset+window.innerHeight < getAbsoluteOffset(getItem(\"itemEnd\")) + getItem(\"itemEnd\").clientHeight){\n window.scroll(window.pageXOffset,getAbsoluteOffset(getItem(\"itemEnd\"))-window.innerHeight+getItem(\"itemEnd\").clientHeight);\n }\n }\n }\n //...or have we reached the bottom.\n else {\n if (cursorpointer == 0 && offset < 0){\n window.scroll(window.pageXOffset,0);\n }\n if (cursorpointer == stories.snapshotLength-1 && offset > 0){\n window.scroll(window.pageXOffset,document.height);\n }\n }\n}", "function gotoMap() {\n $anchorScroll('map-canvas');\n }", "function scollban(){\n\tscrollTo(0,0);\n}", "function scrollDown() {\n var elmnt = document.getElementById(\"medalchart\");\n elmnt.scrollIntoView({behavior: \"smooth\"});\n // $('html, body').animate({\n // scrollTop: $(\"#main-container\").offset().top\n // }, 1000);\n //\n // console.log(\"animation\");\n}", "function scrollToObject() {\n\t\t\tconsole.log(\"scrollToObject()\");\n\t\t\t$q.all([\n\t\t\t FindElement.byId(\"resultTableWrapper\"),\n\t\t\t FindElement.byQuery(\"#resultsTable .selectedRow\")\n\t\t\t ]).then(function(elements) {\n\t\t\t\t var table = angular.element(elements[0]);\n\t\t\t\t var selected = angular.element(elements[1]);\n\t\t\t\t var offset = 30;\n\t\t\t\t table.scrollToElement(selected, offset, 0);\n\t\t\t });\n\t\t\tsetFocus();\n\t\t}", "function scrollToNextPage() {\n gallery_scroller.scrollBy({\n left: gallery_item_size,\n top: 0,\n behavior: 'smooth'\n });\n// updateBtns()\n}", "scrollToSection(linkName) {\n $('html, body').animate({\n scrollTop: $(\"#\" + linkName).offset().top\n }, 850);\n }", "function toProjects() {\n let elmnt = document.getElementById(\"projectsWithPadding\");\n elmnt.scrollIntoView();\n}", "_scrollTo (params) {\n let selector\n if (params.nodeId) {\n selector = `[data-id=\"${params.nodeId}\"]`\n } else if (params.section) {\n selector = `[data-section=\"${params.section}\"]`\n } else {\n throw new Error('Illegal argument')\n }\n let comp = this.refs.contentPanel.find(selector)\n if (comp) {\n this._scrollElementIntoView(comp.el, true)\n }\n let router = this.context.router\n // ATTENTION: do not change the route when running tests otherwise the test url get's lost\n if (router && !platform.test) {\n router.writeRoute(Object.assign({ viewName: this.props.viewName }, params))\n }\n }", "scrollElementIntoView() {\n const element = document.querySelector('#classification-view');\n if (element) {\n element.scrollIntoView();\n }\n }", "function scrollToTarget() {\n $(document.getElementById(\"mainportion\")).scrollTo(document.getElementById($(this).context.title), 800);\n return this;\n }", "static scrollToId(id) {\n $('html, body').animate({\n scrollTop: $(id).offset().top - 10,\n }, 500);\n }", "function hsClickScroll()\n {\n var imageOffset = self.getOffsetRect(this).top; \n var clientOffset = (docElement.clientHeight-hs.maxHeight) / 2;\n window.scrollTo(0,imageOffset-clientOffset);\n }", "function scrollProfile() {\n\tcloseContact();\n\tdocument.getElementById(\"perfil\").scrollIntoView();\n}", "function scrollTo_anchor(action) {\n if (action.target.nodeName === \"A\") {\n const allSecId = action.target.getAttribute(\"data-id\");\n const allSec = document.getElementById(allSecId);\n allSec.scrollIntoView({ behavior: \"smooth\" });\n }\n}", "function whereTo(e){\n\n$('html, body').animate({\n scrollTop: $(e).offset().top\n }, 1000);\n}", "function jumpToPosition(){\n flexImages3.scrollIntoView({behavior: \"smooth\", block: 'center',inline: 'center'});\n}" ]
[ "0.6868092", "0.66545063", "0.6495838", "0.64606917", "0.64475346", "0.64205945", "0.64086664", "0.63724476", "0.63724476", "0.6349916", "0.63439167", "0.63286847", "0.63221884", "0.63221884", "0.63221884", "0.63145316", "0.63108826", "0.6302561", "0.63000506", "0.6259576", "0.62502044", "0.6229988", "0.6201478", "0.6187519", "0.6152115", "0.614828", "0.6144399", "0.6144399", "0.61321884", "0.61238784", "0.6109818", "0.6091167", "0.6086439", "0.60833657", "0.6069974", "0.60691035", "0.60672736", "0.6060841", "0.60452604", "0.60399705", "0.6028889", "0.60224867", "0.6014087", "0.6010185", "0.6008829", "0.59993494", "0.5996065", "0.5995298", "0.59896815", "0.5978578", "0.5972163", "0.59698784", "0.59568125", "0.5948819", "0.5942345", "0.59359866", "0.59354", "0.5928638", "0.592758", "0.59270674", "0.59235704", "0.59212047", "0.5921186", "0.59180886", "0.5917707", "0.5913685", "0.5899785", "0.5898591", "0.5898591", "0.5880347", "0.58699155", "0.5866875", "0.586349", "0.5862617", "0.58579475", "0.58556676", "0.58421177", "0.5836177", "0.58176655", "0.58123654", "0.5811963", "0.5808339", "0.57962966", "0.57959193", "0.5794723", "0.5787954", "0.57873285", "0.5782944", "0.5778359", "0.57745713", "0.577016", "0.5770132", "0.57682455", "0.57676524", "0.5766777", "0.5761351", "0.5761045", "0.57592225", "0.5744842", "0.57399815" ]
0.76658046
0
globals __VUE_SSR_CONTEXT__ IMPORTANT: Do NOT use ES2015 features in this file (except for modules). This module is a runtime utility for cleaner component module output and will be included in the final webpack user bundle.
function normalizeComponent ( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, /* server only */ shadowMode /* vue-cli only */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = shadowMode ? function () { injectStyles.call( this, (options.functional ? this.parent : this).$root.$options.shadowRoot ) } : injectStyles } if (hook) { if (options.functional) { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functional component in vue file var originalRender = options.render options.render = function renderWithStyleInjection (h, context) { hook.call(context) return originalRender(h, context) } } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } } return { exports: scriptExports, options: options } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Es(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "extend(config, ctx) {\n // if (process.server && process.browser) {\n if (ctx.isDev && ctx.isClient) {\n config.devtool = \"source-map\";\n // if (isDev && process.isClient) {\n config.plugins.push(\n new StylelintPlugin({\n files: [\"**/*.vue\", \"**/*.scss\"],\n })\n ),\n config.module.rules.push({\n enforce: \"pre\",\n test: /\\.(js|vue)$/,\n loader: \"eslint-loader\",\n exclude: /(node_modules)/,\n options: {\n formatter: require(\"eslint-friendly-formatter\"),\n },\n });\n if (ctx.isDev) {\n config.mode = \"development\";\n }\n }\n for (const rule of config.module.rules) {\n if (rule.use) {\n for (const use of rule.use) {\n if (use.loader === \"sass-loader\") {\n use.options = use.options || {};\n use.options.includePaths = [\n \"node_modules/foundation-sites/scss\",\n \"node_modules/motion-ui/src\",\n ];\n }\n }\n }\n }\n // vue-svg-inline-loader\n const vueRule = config.module.rules.find((rule) =>\n rule.test.test(\".vue\")\n );\n vueRule.use = [\n {\n loader: vueRule.loader,\n options: vueRule.options,\n },\n {\n loader: \"vue-svg-inline-loader\",\n },\n ];\n delete vueRule.loader;\n delete vueRule.options;\n }", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}", "function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode, /* vue-cli only */\n components, // fixed by xxxxxx auto components\n renderjs // fixed by xxxxxx renderjs\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // fixed by xxxxxx auto components\n if (components) {\n if (!options.components) {\n options.components = {}\n }\n var hasOwn = Object.prototype.hasOwnProperty\n for (var name in components) {\n if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {\n options.components[name] = components[name]\n }\n }\n }\n // fixed by xxxxxx renderjs\n if (renderjs) {\n (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {\n this[renderjs.__module] = this\n });\n (options.mixins || (options.mixins = [])).push(renderjs)\n }\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}" ]
[ "0.5848382", "0.572857", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887" ]
0.0
-1
Stores and maybe overrides an edge in this tiddler
insertEdge(tObj, edge, type) { const toTRef = this.tracker.getTiddlerById(edge.to); if (toTRef == null) { // null or undefined return; } // only use the name without the private marker or the namespace utils.setField(tObj, type.name, toTRef); return edge; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get edge () { return this._edge; }", "function setEdge(edge){\n\t\t$.ajax({\n\t\t\turl:'/api/?setedge='+edge.toString(),\n\t\t\tsuccess:function(data){\n\t\t\t\tif(data.success==1){\n\t\t\t\t\t$('#setedge').removeClass('zero one two three four five').addClass(numtoname[data.edge]);\n\t\t\t\t\tlocation.reload();\n\t\t\t\t}else alert(\"Failed to set edge! \"+data.msg);\n\t\t\t},\n\t\t\terror:function(){\n\t\t\t\talert('Failed to set edge!');\n\t\t\t}\n\t\t});\n\t}", "addEdge(edge = {}) {\n edge.weight = this.weighted && edge.hasOwnProperty('weight') ? edge.weight : 1;\n\n if (!this.adjacencyList.hasOwnProperty(edge.from)) {\n this.adjacencyList[edge.from] = {};\n }\n\n this.adjacencyList[edge.from][edge.to] = edge.weight;\n\n if (!this.direcred) {\n if (!this.adjacencyList.hasOwnProperty(edge.to)) {\n this.adjacencyList[edge.to] = {};\n }\n\n this.adjacencyList[edge.to][edge.from] = edge.weight;\n }\n\n this.addNode(edge.from);\n this.addNode(edge.to);\n }", "addEdge(newEdge) {\n this.links.push(newEdge);\n this.svgsManager.edgeManager.update();\n Utils_1.HtmlArranger.placeBeforeNode(\"link\");\n }", "function set_edges() {\n }", "function checkandaddEdge(edge) {\n\tvar found = cy.$id(\"edge_\" + edge.identity.low);\n\tif (found[\"length\"] == 0) {\n\t\tvar output = {\n\t\t\t\tid: \"edge_\" + edge.identity.low,\n\t\t\t\tneo4j_id: edge.identity.low,\n\t\t\t\tneo4j_type: edge.type,\n\t\t\t\tsource: \"node_\" + edge.start.low,\n\t\t\t\ttarget: \"node_\" + edge.end.low\n\t\t}\n\n\t\tObject.keys(edge.properties).forEach(key => {\n\t\t\toutput[key] = edge.properties[key];\n\t\t});\n\t\t\n\t\tcy.add({\n\t\t\tgroup: \"edges\",\n\t\t\tdata: output\n\t\t});\n\t}\n\telse {\n\t\t// console.log(\"edge_\" + edge.identity.low + \" already exists\");\n\t}\n}", "function edge_dblclick (evt) {\r\n\t\tvar edge = evt.target, i;\r\n\tif (algo) return;\r\n\trefresh();\r\n\tif (aef == 2)\taef = 1;\r\n\t\r\n\tfor (i = 0; edges[i].gi != edge; i++) ;\r\n\tedges[i].wei = parseInt(prompt(\"Modifying an edge; specify integer weight lower than 10,000:\",\"1\")%10000);\r\n\tedges[i].weigi.firstChild.data = edges[i].wei.toString(10);\r\n}", "function update_graph_edges(edges) {\n\t\t$.each(edges, function (i, edge) {\n\t\t\tvar edge_id = edge[\"id\"];\n\t\t\tvar ele = g.elements(\"edge\" + \"[id='\" + edge_id + \"']\")[0];\n\t\t\tif (ele) {\n\t\t\t\tele.data(edge);\n\t\t\t}\n\t\t\telse {\n\t\t\t\talert(edge_id + \" no ele\");\n\t\t\t}\n\t\t});\n\t}", "resetNewEdge(){\n this.newEdge1 = null;\n this.newEdge2 = null;\n }", "function edgeAsHardToRead(edge, hideColor1, hideColor2, network, type){\n //console.info(\"edgeAsHardToRead\")\n \n if(type === \"edge\"){\n //console.info(\"edge\")\n //console.info(edge.id)\n \n // saving color information (if we have)\n if (edge.hiddenColor === undefined && edge.color !== hideColor1 && edge.color !== hideColor2) {\n edge.hiddenColor = edge.color;\n }\n // set \"hard to read\" color\n edge.color = hideColor1;\n \n // reset and save label\n if (edge.hiddenLabel === undefined) {\n edge.hiddenLabel = edge.label;\n edge.label = undefined;\n }\n edge.isHardToRead = true;\n } else {\n //console.info(\"cluster\")\n //console.info(edge.id)\n //console.info(edge)\n // saving color information (if we have)\n if (edge.hiddenColor === undefined && edge.color !== hideColor1 && edge.color !== hideColor2) {\n //network.clustering.updateEdge(edge.id, {hiddenColor : edge.color});\n edge.hiddenColor = edge.color;\n }\n // set \"hard to read\" color\n edge.color = hideColor1;\n //network.clustering.updateEdge(edge.id, {color : hideColor1});\n //edge.color = hideColor1;\n // reset and save label\n if (edge.hiddenLabel === undefined) {\n edge.hiddenLabel = edge.label;\n edge.label = undefined;\n }\n edge.isHardToRead = true;\n }\n\n}", "toggleRDirection(event, edge, connection) {\n\n let currentDirection = edge.data.direction || \"none\";\n connection.hideOverlays(); // hide everything and then selectively show below\n // the updateXXXX methods take a second argument that provides the updates - you do not need to manually\n // set values in the data and then call update.\n this.jsToolkit.updateEdge(edge, {\n direction: ({\n \"none\": \"left\",\n \"left\": \"right\",\n \"right\": \"left-right\",\n \"left-right\": \"none\"\n })[currentDirection]\n });\n // show the overlays we need. use a little regex for this. the values map to the `id` values\n // of the overlays defined in the relationship edge type.\n _.each(edge.data.direction.match(/left|right/g), function (oid) {\n connection.showOverlay(oid);\n });\n let dot = connection.getOverlay('customOverlay')\n dot.show()\n }", "setEdges(edges){\n this.edges = edges\n }", "handlerOnClickEdge(edge) {\n\t\tthis.selectingEdge = edge\n\n\t\tlet selected = d3.select(`#${edge.id}`)\n\t\tlet currentPath = selected.attr('d')\n\t\td3.select(`#${this.groupEdgePointId}`)\n\t\t\t.style('display', 'block')\n\t\t\t.moveToFront()\n\t\td3.select(`#${this.groupEdgePathId}`)\n\t\t\t.style('display', 'block')\n\t\t\t.moveToFront()\n\t\td3.select(`#${this.edgePathId}`)\n\t\t\t.attr('d', currentPath)\n\t\t\t.attr('ref', edge.id)\n\n\t\td3.select(`#${this.pointStartId}`)\n\t\t\t.attr('cx', edge.source.x)\n\t\t\t.attr('cy', edge.source.y)\n\t\td3.select(`#${this.pointEndId}`)\n\t\t\t.attr('cx', edge.target.x)\n\t\t\t.attr('cy', edge.target.y)\n\t}", "edge() {\n return new Graph.Features.EdgeFeatures();\n }", "removeEdge(edge) {\n let index = this.links.indexOf(edge);\n //Prevent multiple deletion on the same element causing bugs\n if (index != -1) {\n this.links.splice(index, 1);\n this.svgsManager.edgeManager.update();\n }\n }", "deleteEdge(tObj, edge, type) {\n\n const toTRef = this.tracker.getTiddlerById(edge.to);\n\n if (toTRef == null) { // null or undefined\n return;\n }\n\n // only use the name without the private marker or the namespace\n utils.setField(tObj, type.name, undefined);\n\n return edge;\n\n }", "removeEdge(g, e) { }", "removeEdge(g, e) { }", "prepareEdge(){\n if(this.newEdge1 == null){ //first vert selected\n this.newEdge1 = this.selectedVert;\n }\n else if(this.selectedVert != this.newEdge1){ //we now have two vertices and no duplicates\n this.newEdge2 = this.selectedVert;\n\n this.newEdge1.addNeighbor(this.newEdge2);\n this.newEdge2.addNeighbor(this.newEdge1);\n\n this.resetNewEdge();\n }\n }", "function addEdgeOnto(src,tgt){\n if(src>=0 && src<node_dataOnto.length){\n if(tgt>=0 && tgt<node_dataOnto.length){\n if(-1==indexOfLinkOnto(src,tgt)){\n link_dataOnto.push({source: node_dataOnto[src],target: node_dataOnto[tgt]});\n refreshGraphOnto(node_dataOnto,link_dataOnto);\n }\n }\n }\n}", "function prepareEdgeData() {\n //First only keep the edges that exist in the node list\n edges = edges.filter(function (d) {\n return node_by_id[d.source] && node_by_id[d.target];\n });\n linked_to_id = {};\n edges.forEach(function (d) {\n d.id = d.source + ',' + d.target;\n edge_by_id[d.id] = true; //Save all of the edges to a specific node\n\n if (!linked_to_id[d.source]) linked_to_id[d.source] = [];\n if (!linked_to_id[d.target]) linked_to_id[d.target] = [];\n linked_to_id[d.source].push(node_by_id[d.target]);\n linked_to_id[d.target].push(node_by_id[d.source]); //Save default specific stylings\n\n d.focus = 'secondary';\n d.opacity = edge_secondary_opacity;\n d.stroke_hidden = genColor(); //A unique rgb color for the edge hover later on\n\n color_to_edge[d.stroke_hidden] = d; //Save a mapping of the color to the edge\n }); //forEach\n } //function prepareEdgeData", "addEdge(outNode, outPort, inNode, inPort, metadata = {}) {\n outPort = this.getPortName(outPort);\n inPort = this.getPortName(inPort);\n for (let i = 0; i < this.edges.length; i++) {\n // don't add a duplicate edge\n var edge = this.edges[i];\n if (edge.from.node === outNode && edge.from.port === outPort && edge.to.node === inNode && edge.to.port === inPort) { return; }\n }\n if (!this.getNode(outNode)) { return; }\n if (!this.getNode(inNode)) { return; }\n\n this.checkTransactionStart();\n\n var edge = {\n from: {\n node: outNode,\n port: outPort\n },\n to: {\n node: inNode,\n port: inPort\n },\n metadata\n };\n this.edges.push(edge);\n this.emit('addEdge', edge);\n\n this.checkTransactionEnd();\n return edge;\n }", "function updateEdge(curr_edge) {\n //First, obtain values\n var sourcex = curr_edge.sourceObject.x;\n var sourcey = curr_edge.sourceObject.y + curr_edge.sourceObject.questionRowHeight / 2;\n var targetx = curr_edge.targetObject.x;\n var targety = curr_edge.targetObject.y + curr_edge.targetObject.questionRowHeight / 2;\n var sourcestub = LEFT; //-1 is left, 1 is right\n\n //If source completely on the left side of target, make source x be the righter edge\n //Also, sourcestub becomes on the right\n if (sourcex + curr_edge.sourceObject.rowWidth < targetx) {\n sourcex = curr_edge.sourceObject.x + curr_edge.sourceObject.rowWidth; sourcestub = RIGHT;\n }\n\n //overrides for blue and red edges, always goes out from the right\n if (curr_edge.color === \"blue\" || curr_edge.color === \"red\") {\n sourcex = curr_edge.sourceObject.x + curr_edge.sourceObject.rowWidth; sourcestub = RIGHT;\n }\n //handle seperation of red and blue edges from black\n if (curr_edge.color === \"blue\") {\n sourcey -= curr_edge.targetObject.questionRowHeight / 4;\n targety -= curr_edge.targetObject.questionRowHeight / 4;\n }\n if (curr_edge.color === \"red\") {\n sourcey += curr_edge.targetObject.questionRowHeight / 4;\n targety += curr_edge.targetObject.questionRowHeight / 4;\n }\n\n var i;\n var largestRowWidth = 0;\n for (i = 0; i < allquestions.length; i += 1) {\n if (allquestions[i].rowWidth > largestRowWidth) {\n largestRowWidth = allquestions[i].rowWidth;\n }\n }\n\n //bad: if there was a collision with a node or there was no place to put the edge, bad is true\n var bad = determineEdgeMidpointsLR(curr_edge, sourcex, targetx, sourcey, targety, sourcestub, largestRowWidth);\n\n //If there was a collision with a node or there was overlap... first, try the other source port\n if (bad && curr_edge.color === \"black\") {\n sourcestub *= -1;\n if (sourcestub === LEFT) {\n sourcex = curr_edge.sourceObject.x;\n } else {\n sourcex = curr_edge.sourceObject.x + curr_edge.sourceObject.rowWidth;\n }\n bad = determineEdgeMidpointsLR(curr_edge, sourcex, targetx, sourcey, targety, sourcestub, largestRowWidth);\n }\n //Try original source port and other target port\n if (bad) {\n sourcestub *= -1;\n if (curr_edge.color === \"blue\") {\n sourcestub = 1;\n }\n if (sourcestub === LEFT) {\n sourcex = curr_edge.sourceObject.x;\n } else {\n sourcex = curr_edge.sourceObject.x + curr_edge.sourceObject.rowWidth;\n }\n targetx = curr_edge.targetObject.x + curr_edge.targetObject.rowWidth / 2;\n if (curr_edge.color === \"blue\") {\n targetx -= curr_edge.targetObject.questionRowHeight / 4;\n }\n targety = curr_edge.targetObject.y;\n bad = determineEdgeMidpointsTOP(curr_edge, sourcex, targetx, sourcey, targety, sourcestub, largestRowWidth);\n }\n\n //Try other source port and other target port\n if (bad) {\n sourcestub *= -1;\n if (curr_edge.color === \"blue\") {\n sourcestub = 1;\n }\n if (sourcestub === LEFT) {\n sourcex = curr_edge.sourceObject.x;\n } else {\n sourcex = curr_edge.sourceObject.x + curr_edge.sourceObject.rowWidth;\n }\n bad = determineEdgeMidpointsTOP(curr_edge, sourcex, targetx, sourcey, targety, sourcestub, largestRowWidth);\n }\n\n //If it still fails on all two-midpoint solutions or not a black edge, have the edge move around nodes\n if (bad) {\n targetx = curr_edge.targetObject.x;\n targety = curr_edge.targetObject.y;\n // add new midpoints that goes around the node here\n resetEdgeToLoop(curr_edge, sourcestub, sourcex, sourcey, targetx, targety); \n }\n}", "saveHarvestingEndpoint(endpoint) {\n if (this._Wallet.network == nem.model.network.data.mainnet.id) {\n this._storage.harvestingMainnetNode = endpoint;\n } else if (this._Wallet.network == nem.model.network.data.testnet.id) {\n this._storage.harvestingTestnetNode = endpoint;\n } else {\n this._storage.harvestingMijinNode = endpoint;\n }\n }", "function setUpNewEdge(source, target, sourceHandle, targetHandle) {\n\t\tlet newEdgeId = 'e' + source + '_' + sourceHandle + '-' + target;\n\t\tlet newEdge = {\n\t\t\tid: newEdgeId,\n\t\t\tsource: source,\n\t\t\ttarget: target,\n\t\t\tsourceHandle: sourceHandle,\n\t\t\ttargetHandle: targetHandle,\n\t\t\tclassName: newEdgeId,\n\n\t\t\ttype: props?.pathSettings,\n\t\t\tanimated: true,\n\n\t\t\tstyle: { stroke: '#fff', strokeWidth: '5px' },\n\t\t\tlabel: \"jank\",\n\t\t\tlabelStyle: { visibility: 'hidden' },\n\t\t\tlabelBgBorderRadius: '100%',\n\t\t\tlabelBgStyle: {\n\t\t\t\theight: '24.3594', fill: 'var(--color-mud_black)', stroke: 'white', strokeWidth: '3',\n\t\t\t\tvisibility: (props?.edgeGripSetting ? 'visible' : 'hidden')\n\t\t\t},\n\t\t};\n\n\t\treturn newEdge;\n\t}", "setEdgeMetadata(node, port, node2, port2, metadata) {\n let edge = this.getEdge(node, port, node2, port2);\n if (!edge) { return; }\n\n this.checkTransactionStart();\n let before = clone(edge.metadata);\n if (!edge.metadata) { edge.metadata = {}; }\n\n for (let item in metadata) {\n let val = metadata[item];\n if (val != null) {\n edge.metadata[item] = val;\n } else {\n delete edge.metadata[item];\n }\n }\n\n this.emit('changeEdge', edge, before);\n return this.checkTransactionEnd();\n }", "function restoreOE() {\n\tcy.edges().forEach(function(item, index, array) {\n\t\tvar oE = item.data().originalEnds;\n\t\tif ( oE && typeof oE.source == 'string'\n\t \t&& cy.$id(oE.target).length > 0\n\t\t&& cy.$id(oE.source).length > 0) {\n\t \t\titem.data().originalEnds = {\n\t\t\t\tsource: cy.$id(oE.source),\n\t\t\t\ttarget: cy.$id(oE.target)\n\t\t\t}\n\t\t};\n\t});\n}", "adoptEdgeData() {\n\n\t\tconst edgeData = this.hermiteData.edgeData;\n\t\tconst zeroCrossings = edgeData.zeroCrossings;\n\t\tconst normals = edgeData.normals;\n\n\t\tconst d = this.edgeId.x;\n\t\tconst i = this.edgeId.y;\n\t\tconst n = new Vector3();\n\n\t\tthis.t = zeroCrossings[d][i];\n\t\tthis.s.setFromVector3(n.fromArray(normals[d], i * 3));\n\n\t}", "function updateEdge(edge_label) {\n\t\tsaveFAState();\n\t\texecuteEditEdge(g, label, edge_label);\n\t\tupdateAlphabet();\n\t\tcheckAllEdges();\n\t\t// Check to see if shorthand notation is disabled, and whether the transitions on this edge are therefore allowed (i.e. only one character long).\n\t\tif (!g.shorthand) {\n\t\t\tvar weights = edge_label.split(\"<br>\");\n\t\t\tfor (var i = 0; i < weights.length; i++) {\n\t\t\t\tif (weights[i].length > 1) {\n\t\t\t\t\twindow.alert(\"Shorthand notation is disabled for this automaton.\\n\\nTo traverse, please enter only single character transition labels.\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t}", "function toggleEdge(edgeVerticesMap, e, agency_style, edge_style){\r\n\te.setStyle({opacity:edgeStyle[edge_style].opacity, color:edgeStyle[edge_style].color});\r\n\t$.each(edgeVerticesMap[e.id],function(index, item){\r\n\t\titem.setStyle({\r\n\t\t\tfillOpacity:agencyStyle[agency_style].opacity, \r\n\t\t\topacity:agencyStyle[agency_style].opacity, \r\n\t\t\tfillColor:agencyStyle[agency_style].color, \r\n\t\t\tcolor:agencyStyle[agency_style].color\r\n\t\t});\r\n\t});\r\n}", "function replaceOE() {\n cy.edges().forEach(function(item, index, array) {\n let oE = item.data().originalEnds;\n if ( oE ) {\n let src = oE.source.id();\n let dst = oE.target.id();\n cy.$id(item.id()).data().originalEnds = {\n\t source: src,\n\t target: dst\n }\n };\n });\n}", "function drawEdgeIfPossible() {\r\n // check if edge already exists\r\n if (edgeStartNode == edgeTargetNode) {\r\n endEdgeDrawing();\r\n return false;\r\n } else if (!graph.isConnected(edgeStartNode, edgeTargetNode)\r\n && edgeStartNode != edgeTargetNode) {\r\n // create new edge \r\n let edge = new Edge(edgeStartNode, edgeTargetNode, 0, 'black');\r\n\r\n // calculate edge length for default value\r\n let startX = (edgeStartNode.x * 20 + 20);\r\n let startY = (edgeStartNode.y * 20 + 20);\r\n\r\n // get target node center\r\n let targetX = (edgeTargetNode.x * 20 + 20);\r\n let targetY = (edgeTargetNode.y * 20 + 20);\r\n\r\n // calculate vector length\r\n let vecLength = Math.sqrt((targetX - startX) * (targetX - startX)\r\n + (targetY - startY) * (targetY - startY));\r\n\r\n // set edge default cost edge length\r\n edge.cost = Math.floor(vecLength / 20) - 2;\r\n\r\n // store edge in graph\r\n edge.draw(Canvas.graphCtx);\r\n graph.addEdge(edge);\r\n\r\n // if graph is not in distanced edges mode\r\n if (!graph.isDistanced) {\r\n // show context menu to change edge value instantly\r\n Context.showMenu('context-menu-edge-value',\r\n getSidebarWidth() + (edgeStartNode.x + (edgeTargetNode.x - edgeStartNode.x) / 2) * 20,\r\n (edgeStartNode.y + (edgeTargetNode.y - edgeStartNode.y) / 2) * 18);\r\n\r\n // set initial input field value\r\n let inputField = document.getElementById('new-edge-value');\r\n inputField.value = edge.cost;\r\n inputField.select();\r\n }\r\n\r\n lastSelectedEdge = edge;\r\n endEdgeDrawing();\r\n\r\n // save to undo history\r\n saveCurrentState();\r\n return true;\r\n } else { // edge already exists\r\n // move context menu to click location as an anchor for the tooltip\r\n let anchorContext = document.getElementById('context-menu-edge-value');\r\n anchorContext.style.left = getSidebarWidth() + (edgeStartNode.x + (edgeTargetNode.x - edgeStartNode.x) / 2) * 20;\r\n anchorContext.style.top = (edgeStartNode.y + (edgeTargetNode.y - edgeStartNode.y) / 2) * 18;\r\n\r\n Tooltip.showSmall(\r\n anchorContext,\r\n 'duplicate edge',\r\n 'an edge between these nodes already exists, choose another target node.',\r\n );\r\n\r\n endEdgeDrawing();\r\n return false;\r\n }\r\n}", "_addConfigElementEdges(edges) {\n\t\tedges.forEach((configEdge) => {\n\t\t\tconst name = configEdge.name;\n\n\t\t\tif (this.edges[name]) {\n\t\t\t\tconst msg = {\n\t\t\t\t\t\"message\": `The edge '${name}' was already in the model.`,\n\t\t\t\t\t\"config\": configEdge\n\t\t\t\t};\n\t\t\t\tthis.error(msg);\n\t\t\t\tthrow new Error(msg);\n\t\t\t}\n\n\t\t\tthis.edges[name] = configEdge;\n\n\t\t\tthis.edgeOrder.push(name);\n\t\t});\n\t}", "edgeType(sourceNode, targetNode) {\n // can return 'flat' for flat edges between nodes or 'node' for intermediate node between them\n // returning null/undefined means an edge can't be added between the two nodes\n return 'flat';\n }", "function modifyEdge(i, j) {\n if (i === j) return;\n st = realCoordinates(i);\n en = realCoordinates(j);\n drawLineLowerLayer(st, en);\n}", "function highlightEdge(id) {\n d3.selectAll(\".edge\").classed(\"edge-faded\", true);\n\n d3.selectAll(\".node\").classed(\"node-faded\", true);\n\n d3.select(\"#\" + id)\n .style(\"stroke\", \"#FDB813\")\n .style(\"stroke-opacity\", \"1\");\n\n d3.select(\"#\" + id).classed(\"edge-faded\", false);\n\n var sourceIpNode = \"n\" + d3.select(\"#\" + id).data()[0].source.ip.replace(/\\./g, \"_\");\n var targetIpNode = \"n\" + d3.select(\"#\" + id).data()[0].target.ip.replace(/\\./g, \"_\");\n\n d3.select(\"#\" + sourceIpNode).classed(\"node-faded\", false);\n d3.select(\"#\" + targetIpNode).classed(\"node-faded\", false);\n}", "function GraphEdge(label, fromKey, toKey, data, order) {\n this.label = label;\n this.fromKey = fromKey;\n this.toKey = toKey;\n this.data = data;\n this.order = order;\n}", "removeEdgeFromDOM(edge) {\n edge.html.node().parentNode.remove();\n }", "addEdge(node1, node2) {\n\t\tnode1.edges.add(node2);\n\t\tnode2.edges.add(node1);\n\t\t// Update server\n\t\tserver.send('add-edge', {id1: node1.id, id2: node2.id})\n\t}", "function addEdge(edge) {\r\n var fromNode = edge[0], toNode = edge[1];\r\n var children = graph.get(toNode);\r\n if (children) {\r\n children.push(fromNode);\r\n }\r\n else {\r\n graph.set(toNode, [fromNode]);\r\n }\r\n }", "function edgeListener(i){\n connections[i].on('click',\n\t\t function(e){\n\t\t\t edgeClick(i);\n\t\t });\n //connections[i].bindPopup(edgeInfo(i));\n}", "function addEdge(weight, node1, node2){\n\tthis.edge = new Edge(node1, node2, weight);\n\tadjacencyMatrix[node1.num][node2.num] = weight;\n\tadjacencyMatrix[node2.getNum()][node1.getNum()] = weight;\n\tnode1_edge = null;\n\tnode2_edge = null;\n}", "function createEdge(edge_label) {\n\t\tsaveFAState();\n\t\tvar edge = executeAddEdge(g, first, selected, edge_label);\n\t\t$(edge._label.element).click(labelClickHandler);\n\t\t// This new edge does need its edge label click handler to be set individually.\n\t\tupdateAlphabet();\n\t\tcheckEdge(edge);\n\t}", "hasEdge(edge) {\n for (const entry of this.store.values()) {\n if (entry.lastEdge === edge) return true;\n }\n\n return false;\n }", "function setGraphEdges(graph, edgesToSet, multigraph) {\n edgesToSet.forEach((e) => {\n if (\n !multigraph ||\n (graph.nodes().includes(`${e.source}`) &&\n graph.nodes().includes(`${e.target}`))\n ) {\n graph.setEdge(e.source, e.target, {\n label: e.label,\n lineInterpolate: \"basis\",\n class: edgeClassDecider(e),\n id: `arg-edge${e.source}${e.target}`,\n weight: edgeWeightDecider(e),\n });\n }\n });\n }", "function edge(parser, commandFiltersProcessor, vocabularyProcessor, uiDispatcher, settings, hold = false) {\n parser.wait();\n\n var edgeTauntsParser = createEdgeTauntingParser(commandFiltersProcessor, vocabularyProcessor, uiDispatcher, settings);\n\n uiDispatcher.registerInputListener(\"edging\", \"on edge\", 100, () => {\n edgeTauntsParser.stop(() => {\n uiDispatcher.unregisterInputListener(\"edging\");\n if(hold) {\n uiDispatcher.displayText(vocabularyProcessor.processVocabularyFilters('#HoldTheEdge'),()=>{\n holdTheEdge(commandFiltersProcessor, vocabularyProcessor, uiDispatcher, settings, parser);\n });\n } else {\n stopStroking(uiDispatcher, vocabularyProcessor, parser);\n }\n });\n });\n}", "xfer(other) {\n\t\tsuper.xfer(other);\n\t\tthis._firstEp = other._firstEp;\n\t\tthis._left = other._left; this._right = other._right;\n\t\tthis._weight = other._weight;\n\t\tthis._edges = other._edges; this._epLists = other._epLists;\n\t\tother._firstEp = other._left = other._right = other._weight = null;\n\t\tother._edges = null; other._epLists = null;\n\t}", "function createEdge(first,second){\n var temp = {};\n var t = {};\n t['id'] = first.toString()+second.toString();\n t['source'] = first;\n t['target'] = second;\n temp['data'] = t;\n return temp;\n}", "function createUsedInEdge(fromKey, toKey) {\n if (fromKey.indexOf('claims/') == -1) {\n console.log('WARNING only claims can be USED_IN arguments, you\\re trying to use:', fromKey);\n }\n if (toKey.indexOf('arguments/') == -1) {\n console.log('WARNING only arguments can have USED_IN edges pointing _to them, you\\re trying to point _to:', toKey);\n }\n return new Promise(function (resolve, reject) {\n var PremiseCollection = Arango.getPremisLinkCollection();\n var datetime = Utils.getCreateDateForDb();\n PremiseCollection.save({\n \"_from\": fromKey,\n \"_to\": toKey,\n \"type\": \"USED_IN\",\n \"creationDate\": datetime\n }).then((meta) => {\n resolve({\n \"_from\": fromKey,\n \"_to\": toKey,\n \"type\": \"USED_IN\",\n \"creationDate\": datetime,\n \"_id\": meta._id,\n \"_key\": meta._key\n });\n }).catch((err) => {\n reject(err);\n });\n });\n}", "edgeParams(sourceNode, targetNode) {\n let maxNode = _.max(\n self.cy.edges().toArray().map(\n e => parseInt(\n _.slice(e.data('id'), 1, e.data('id').length).join(''),\n 10,\n ),\n ),\n ) || 0;\n\n maxNode += 1;\n return {\n group: 'edges',\n data: {\n id: `e${maxNode}`,\n source: sourceNode.data('id'),\n target: targetNode.data('id'),\n text: '',\n },\n classes: `e${maxNode}`,\n };\n }", "createEdgeConfig() {\n return createEdgeConfig_1.default(this);\n }", "function switchEdgeType(){\r\n\tcy.$('edge:selected').each(function(edge, j, edges){\r\n\t\tfor(let i = 0; i < EDGE_TYPES_SWITCH.current.length; i++){\r\n\t\t\tedge_class = EDGE_TYPES_SWITCH.current[i];\r\n\t\t\tif(edge.hasClass(edge_class)){\r\n\t\t\t\tedge.removeClass(edge_class).addClass(EDGE_TYPES_SWITCH.next[i]);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}", "function addEdge(s, t, c) {\r\n for (let i = 0; i < links.length; i++) {\r\n if (links[i].source === s && links[i].target === t) {\r\n links[i].capacity = c;\r\n return;\r\n }\r\n }\r\n links.push({ source: s, target: t, capacity: c, flow: 0 });\r\n}", "function addEdge(first,second){\n d.push(createEdge(first,second));\n}", "addEdge(destination, origin) {\n // We represent the relationship with the edge with an array with the node that has a node within it\n this.adjacenyList.get(destination).push(origin);\n this.adjacenyList.get(origin).push(destination);\n }", "hasEdge(edge) {\n return Array.from(this.store.values()).some(entry => (\n entry.lastEdge === edge\n ));\n }", "function addEdge(graph, seenNodes, seenEdges, sourceNode, targetNode, value) {\n var sourceIndex = seenNodes.indexOf(sourceNode);\n var targetIndex = seenNodes.indexOf(targetNode)\n\n var edge = getEdgeString(sourceIndex, targetIndex);\n var edgeIndex = seenEdges.indexOf(edge);\n\n if (edgeIndex < 0) {\n graph.edges.push({\n 'source':sourceIndex,\n 'target':targetIndex,\n 'value':parseInt(value) / 10\n });\n seenEdges.push(edge);\n } else {\n graph.edges[edgeIndex].value += parseInt(value);\n }\n}", "function EdgeView() {\n this.vertex = -1;\n }", "function addEdge(v1, v2) {\n adjMatrix[v1][v2] = 1;\n adjMatrix[v2][v1] = 1;\n}", "constructor() {\n super(\n 'Edges',\n new SimpleSchema({\n // vertices are stored as the _ids of the skillgraph documents each edge connects\n v: { label: 'v', optional: false, type: String },\n w: { label: 'w', optional: false, type: String },\n vID: { label: 'vID', optional: false, type: String },\n wID: { label: 'wID', optional: false, type: String },\n weight: { label: 'weight', optional: false, type: Number },\n baseWeight: { label: 'baseWeight', optional: false, type: Number },\n }),\n undefined\n );\n\n this._edgeCount = 0;\n this._incAmount = 10;\n }", "function reindex_edge(graph, old_index, new_index){\n\tif(graph.faces_edges != null){\n\t\tgraph.faces_edges.forEach((fe,fi) => fe.forEach((e,ei) => {\n\t\t\tif(e == old_index){ graph.faces_edges[fi][ei] = new_index; }\n\t\t}))\n\t}\n\tif(graph.edgeOrders != null){\n\t\tgraph.edgeOrders.forEach((fe,fi) => fe.forEach((e,ei) => {\n\t\t\t// exception. third index is orientation, not index\n\t\t\tif(i != 2 && e == old_index){\n\t\t\t\tgraph.edgeOrders[fi][ei] = new_index;\n\t\t\t}\n\t\t}))\n\t}\n}", "applyUndo(e)\n {\n const graph = this.controller.getGraph();\n let edge = graph.getEdgeByElementID(e.eventData.edgeID);\n\n const from = graph.getNodeByElementID(e.eventData.fromID);\n if (!from) throw new Error('Trying to create a sourceless edge');\n const to = graph.getNodeByElementID(e.eventData.toID) || null;\n\n if (!edge)\n {\n edge = graph.createEdge(from, to, e.eventData.edgeID);\n }\n else\n {\n edge.setEdgeFrom(from);\n edge.changeDestinationNode(to);\n }\n\n edge.setEdgeLabel(e.eventData.label);\n edge.setQuadraticRadians(e.eventData.quad.radians);\n edge.setQuadraticLength(e.eventData.quad.length);\n }", "insertEdge(from, to, weight){ \r\n let pair = {\r\n toName: to.name,\r\n weight: weight,\r\n };\r\n if(!this.graph.has(from.name)){\r\n this.graph.set(from.name, from);\r\n let n = this.graph.get(from.name).neighbors;\r\n n.push(pair);\r\n }\r\n \r\n else{\r\n let n = this.graph.get(from.name).neighbors;\r\n n.push(pair);\r\n }\r\n \r\n this.nodeCount = this.nodeList.length;\r\n }", "function onEdgeDelete() {\n\t\t// get the edge id from the class name list of the parent\n\t\t// i stored the id in the class name \n\t\t// since it's the only place I can store data in the html of a default edge\n\t\tlet currEdgeId = edgeContextMenuState['currEdge'].parentNode.classList.item(2);\n\n\t\t// loop through the elements until you find an id that matches currEdgeId\n\t\t// this way you can remove the actual edge that is in elements (we only have the html DOM element)\n\t\t// for loop in order to break out as soon as edge is found\n\t\t//console.log(\"DELETING FROM\", elements);\n\t\tfor (var i = 0; i < elements.length; i++) {\n\t\t\tif (elements[i]['id'] == currEdgeId) {\n\n\t\t\t\t// if id matches, remove the edge from the database\n\t\t\t\tprops?.nodeHelper.RemoveConnection(elements[i]['source'], elements[i]['target'], elements[i]['sourceHandle']);\n\n\t\t\t\t// if id matches, remove the edge from elements\n\t\t\t\t// also update data\n\t\t\t\tsetElements(function (els) {\n\t\t\t\t\tels = removeElements([elements[i]], els);\n\t\t\t\t\tels = updateOutgoingNodesData(els);\n\t\t\t\t\treturn els;\n\t\t\t\t});\n\t\t\t\t//console.log(\"deleted edge\", elements[i]);\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// close the context menu\n\t\tsetEdgeContextMenuState(initialEdgeContextMenuState);\n\t}", "createEdge(src, dest) {\n let selected = src.isSelected && dest.isSelected;\n return new Types_1.Edge(0, dest, \"#aaa\", 0, src, \"\", selected);\n }", "function makeEdge(parent_id, child_id) {\n g.setEdge(parent_id, child_id);\n }", "updateEdgeData() {\n\n\t\tconst activeEdge = this.activeEdge;\n\t\tconst activePlane = this.activePlane;\n\n\t\tconst a = new Vector3();\n\t\tconst b = new Vector3();\n\t\tconst c = new Vector3();\n\t\tconst n = new Vector3();\n\n\t\tconst edgeData = this.hermiteData.edgeData;\n\t\tconst zeroCrossings = edgeData.zeroCrossings;\n\t\tconst normals = edgeData.normals;\n\n\t\tconst d = this.edgeId.x;\n\t\tconst i = this.edgeId.y;\n\n\t\tif(activeEdge !== null) {\n\n\t\t\t// Adjust the selected plane.\n\t\t\ta.fromArray(activeEdge.geometry.getAttribute(\"position\").array);\n\t\t\tb.fromArray(activeEdge.geometry.getAttribute(\"position\").array, 3);\n\t\t\tc.copy(a).add(b.sub(a).multiplyScalar(this.t));\n\t\t\tn.setFromSpherical(this.s).normalize();\n\n\t\t\tactivePlane.position.copy(c);\n\t\t\tactivePlane.lookAt(c.add(n));\n\n\t\t\tzeroCrossings[d][i] = this.t;\n\t\t\tn.toArray(normals[d], i * 3);\n\n\t\t\tthis.dispatchEvent(updateEvent);\n\n\t\t}\n\n\t}", "edgeForId(edge_id, geometry) {\n return geometry.edges.find(e => e.id === edge_id);\n }", "function addEdge(i, j) {\n if (i === j) return;\n edges.push([i, j]);\n st = realCoordinates(i);\n en = realCoordinates(j);\n drawLineLowerLayer(st, en);\n}", "pushCatmullClarkEdge(edge)\n {\n this.catmullClarkEdges.push(edge);\n // Ajout de l'edge adjacente aux vertice de l'edge\n edge.v1.incidentEdges.push(edge);\n edge.v2.incidentEdges.push(edge);\n }", "function selectEdge(id) {\n d3.selectAll(\".edge\")\n .filter(\".active\")\n .classed(\"active\", false)\n .classed(\"blink_me\", false);\n\n d3.selectAll(\".node\")\n .filter(\".blink_me\")\n .classed(\"blink_me\", false);\n\n var edge = d3.select(\"#\" + id)\n .style(\"stroke\", \"#FDB813\")\n .style(\"stroke-opacity\", \"1\")\n .classed(\"blink_me\", true)\n .classed(\"active\", true);\n var parent = $(\"#\" + edge.attr(\"id\")).parent()\n edge.remove();\n parent.append(edge[0]);\n\n var sourceIpNode = \"n\" + d3.select(\"#\" + id).data()[0].source.ip.replace(/\\./g, \"_\");\n var targetIpNode = \"n\" + d3.select(\"#\" + id).data()[0].target.ip.replace(/\\./g, \"_\");\n\n d3.select(\"#\" + sourceIpNode)\n .classed(\"blink_me\", true);\n d3.select(\"#\" + targetIpNode)\n .classed(\"blink_me\", true);\n\n showFullGraphWithSelectedEdge();\n\n}", "function Edge(vert_i,weight)\n{\n\n\t// published docs section (ref. assignment page)\n\t// for this section, strip line comments\n\t// no JSDOC comments in this section\n\n\n\t// base property fields\n \t this.target_v = vert_i;\t\t//Id of edge target vertex\n \t this.weight = weight;\n\n\n}", "function addEdge (parent, child, callback) {\n\t// if we find an edge, don't create another\n\tif ( findEdge(parent, child) )\n\t\treturn;\n\t// otherwise, create new edge between the parent and child\n\telse {\n\t\tEdge.create({\n\t\t\tnodeA: parent,\n\t\t\tnodeB: child\n\t\t}, function (err, edge) {\n\t\t\treturn edge;\n\t\t});\n\t}\n}", "function edge(vertex1, vertex2, weight)\r\n{\r\n this.vertex1 = vertex1;\r\n this.vertex2 = vertex2;\r\n this.weight = weight;\r\n\r\n}", "function getStreetEdgeId () {\n return taskSetting.features[0].properties.street_edge_id\n }", "function generateEdge(source, target, value) {\n\treturn {\n\t\tsource: source,\n\t\ttarget: target,\n\t\tvalue: value\n\t};\n}", "removeEdge(node, port, node2, port2) {\n this.checkTransactionStart();\n port = this.getPortName(port);\n port2 = this.getPortName(port2);\n let toRemove = [];\n let toKeep = [];\n if (node2 && port2) {\n for (var index = 0; index < this.edges.length; index++) {\n var edge = this.edges[index];\n if (edge.from.node === node && edge.from.port === port && edge.to.node === node2 && edge.to.port === port2) {\n this.setEdgeMetadata(edge.from.node, edge.from.port, edge.to.node, edge.to.port, {});\n toRemove.push(edge);\n } else {\n toKeep.push(edge);\n }\n }\n } else {\n for (var index = 0; index < this.edges.length; index++) {\n var edge = this.edges[index];\n if ((edge.from.node === node && edge.from.port === port) || (edge.to.node === node && edge.to.port === port)) {\n this.setEdgeMetadata(edge.from.node, edge.from.port, edge.to.node, edge.to.port, {});\n toRemove.push(edge);\n } else {\n toKeep.push(edge);\n }\n }\n }\n\n this.edges = toKeep;\n for (let i = 0; i < toRemove.length; i++) {\n var edge = toRemove[i];\n this.emit('removeEdge', edge);\n }\n\n return this.checkTransactionEnd();\n }", "function edge(event, Dt, Op) {\n\n var handles = Dt.base.data('handles'), to, i;\n\n i = Op['orientation'] ? event['pointY'] : event['pointX'];\n i = i < Dt.base.offset()[Op['style']];\n\n to = i ? 0 : 100;\n i = i ? 0 : handles.length - 1;\n\n jump(Dt.base, handles[i], to, [Op['slide'], Op['set']]);\n }", "addEdge(vertex1, vertex2, weight) {\n // need to worry about addEdge('A', 'B') then addEdge('B', 'A')?\n this.adjacencyList[vertex1].push({ node: vertex2, weight });\n this.adjacencyList[vertex2].push({ node: vertex1, weight });\n }", "function _addEdges(vNodes, vEdges, graphEdges) {\n let i, j, qtNodes, qtEdges;\n qtNodes = vNodes.length;\n\n //------- Includes edges\n vNodes.forEach(function (node, k) {\n graphEdges.forEach(function (edge) {\n if (edge.src === node.idOrig) {\n for (i = k + 1; i < qtNodes; i++) {\n if (edge.tgt === vNodes[i].idOrig) {\n vEdges.push({\n src: edge.src,\n tgt: edge.tgt,\n labels: edge.labels,\n values: edge.values\n });\n break;\n }\n }\n } else {\n if (edge.tgt === node.idOrig) {\n for (i = k + 1; i < qtNodes; i++) {\n if (edge.src === vNodes[i].idOrig) {\n vEdges.push({\n src: edge.src,\n tgt: edge.tgt,\n labels: edge.labels,\n values: edge.values\n });\n break;\n }\n }\n }\n }\n });\n });\n //------- Adjust the ids to conform to the indices\n qtNodes = vNodes.length;\n qtEdges = vEdges.length;\n\n for (i = 0; i < qtEdges; i++) {\n for (j = 0; j < qtNodes; j++) {\n if (vNodes[j].idOrig === vEdges[i].src) {\n vEdges[i].src = j;\n break;\n }\n }\n for (j = 0; j < qtNodes; j++) {\n if (vNodes[j].idOrig === vEdges[i].tgt) {\n vEdges[i].tgt = j;\n break;\n }\n }\n }\n\n vNodes.forEach(function (node, k) {\n node.id = k;\n });\n }", "function addEdgeToCy(source, target){\r\n\tedge = { \tgroup: 'edges',\r\n\t\t\t\tdata: { source: source,\r\n\t\t\t\ttarget: target },\r\n\t\t\t\tclasses: ['base']\r\n\t\t\t}\r\n\treturn cy.add(edge);\r\n}", "next(e) { return this._edges.next(e); }", "drawEdge(edge, pt1, pt2) {\n // let fromNodeAct = this.getActivationAlpha(edge.source)\n // let toNodeAct = this.getActivationAlpha(edge.target);\n\n let gradient = this._ctx.createLinearGradient(pt1.x, pt1.y, pt2.x, pt2.y);\n gradient.addColorStop(0, this.getNodeColor(edge.source));\n gradient.addColorStop(1, this.getNodeColor(edge.target));\n\n //this._ctx.strokeStyle = REN.LINK_COLOR;\n this._ctx.strokeStyle = gradient;\n this._ctx.lineWidth = 1;\n this._ctx.beginPath();\n this._ctx.moveTo(pt1.x, pt1.y);\n this._ctx.lineTo(pt2.x, pt2.y);\n this._ctx.stroke();\n\n // draw arrow head \n var endRadians = Math.atan((pt2.y-pt1.y)/(pt2.x-pt1.x));\n endRadians+=( (pt2.x > pt1.x) ? 90 :- 90 ) * Math.PI / 180;\n this.drawArrowHead(pt2.x, pt2.y, endRadians);\n }", "updateEdgePositions() {\n this.html\n .attr(\"x1\", this.x1)\n .attr(\"y1\", this.y1)\n .attr(\"x2\", this.x2)\n .attr(\"y2\", this.y2)\n }", "function injectEdgeLabelProxies(g){_.forEach(g.edges(),function(e){var edge=g.edge(e);if(edge.width&&edge.height){var v=g.node(e.v),w=g.node(e.w),label={rank:(w.rank-v.rank)/2+v.rank,e:e};util.addDummyNode(g,\"edge-proxy\",label,\"_ep\")}})}", "function endEdgeDrawing() {\r\n drawingEdge = false;\r\n edgeStartNode = undefined;\r\n edgeTargetNode = undefined;\r\n Canvas.update();\r\n\r\n // draw edge overlay if edge value change context menu is visible\r\n let edgeContextValue = document.getElementById('context-menu-edge-value');\r\n if (edgeContextValue.style.visibility == 'visible') {\r\n lastSelectedEdge.drawOverlay(Canvas.ctx);\r\n }\r\n\r\n console.log('endEdgeDrawing');\r\n}", "function drawEdge(id, vertex1, vertex2, vertex1Info, vertex2Info, vertex1VisualInfo, vertex2VisualInfo, edgeInfo, edgeVisualInfo) {\r\n var path = this._getEdgePath(vertex1, vertex2);\r\n var clickAreaWidth = 10;\r\n var edge = this.paper.path(path).attr(this.lineAttr).toBack();\r\n //var clickArea = this.paper.path(path).attr({\"stroke\":\"transparent\",\"stroke-width\":\"20\",\"stroke-opacity\":\"0\"}).toBack();\r\n var center = { \"x\" : (path[1]+path[4])/2, \"y\" : (path[2]+path[5])/2 };\r\n var shapePosition = {\r\n x: center[\"x\"],\r\n y: center[\"y\"]\r\n }\r\n var set = this.paper.set();\r\n var button = this.paper.rect(center.x -buttonSide/2,center.y-buttonSide/2,buttonSide,buttonSide).attr(buttonAttr);\r\n\r\n var shape = drawShape(answer[id],this.paper, shapePosition);\r\n set.push(edge,button,shape);\r\n var vGraph = this.visualGraph;\r\n var nbChoices = data[level].nbDistinctShapes + 1;\r\n set.click(function(){\r\n answer[id] = (answer[id]+2)%nbChoices - 1; // next choice, including blank choice\r\n redraw();\r\n if((sim != undefined) && (sim.isPlaying())){\r\n sim.stop();\r\n }\r\n subTask.resetDisplay();\r\n });\r\n return [set];\r\n }", "function edgeWeightDecider(edge) {\n if (edge.type === \"covered\") return 0;\n return 1;\n }", "function equalEdge( ea, eb ) {\n\t\t\treturn ea[ 0 ] === eb[ 1 ] && ea[ 1 ] === eb[ 0 ];\n\t\t}", "function addEdge(v1, v2) {\n\n // add an edge from v1 to v2 and also from v2 to v1 as this is a undirected graph\n if (currentGraph.vertices[v1] == undefined || currentGraph.vertices[v2] == undefined) {\n alert(\"One or more entered vertex not present\");\n } else {\n if (currentGraph.vertices[v1].adjList.indexOf(v2) < 0) {\n currentGraph.vertices[v1].adjList.push(v2);\n currentGraph.vertices[v2].adjList.push(v1);\n }\n }\n\n}", "function addEdge(from, to) { // The parameters of this function represent an item from the obj.arr split into two items called: \"from\" and \"to\" \n if (graph[from] == null) { // addEdge = adding a path/road; \n graph[from] = [to];\n } else {\n graph[from].push(to);\n // console.log(graph[from]);\n }\n }", "removeEdge(vertex1,vertex2){\n //*Reassigning the key of vertex1 to a new array that does not have vertex2\n this.adjacencyList[vertex1] = this.adjacencyList[vertex1].filter(\n (v) => v !== vertex2\n );\n //*Reassigning the key of vertex2 to a new array that does not have vertex1\n this.adjacencyList[vertex2] = this.adjacencyList[vertex2].filter(\n (v) => v !== vertex1\n );\n }", "addEdge(from, to) {\n let edge = new Edge(from, to, this.options.directed);\n if (this.options.directed) {\n edge.root.setAttribute('marker-end', `url(#arrow)`);\n }\n this.root.prepend(edge.root);\n from.addEdge(edge);\n to.addEdge(edge);\n return edge;\n }", "function process_edge(x, y){\n console.log(\"processed edge (\",x,\",\",y,\")\");\n}", "validEdge(e) { return e == ~~e && this._edges.in(e,1); }", "addEdge(node1, node2){\n this.adjList[node1].edges.push(node2);\n this.adjList[node2].edges.push(node1);\n }", "removeEdge(v1, v2) {\n if (v1 in this.adjacencyList && v2 in this.adjacencyList) {\n this.adjacencyList[v1] = this.adjacencyList[v1].filter((v) => v !== v2);\n this.adjacencyList[v2] = this.adjacencyList[v2].filter((v) => v !== v1);\n }\n }", "AddEdge(A_id, B_id) {\n\n // make sure both nodes exist\n const A_data = this._make_set(A_id);\n const B_data = this._make_set(B_id);\n\n return this._union(A_data, B_data).self;\n }", "function formatLinkColour(edge) {\n if (edge.conflict_attributes.label_discrete == 1) {\n\treturn \"#91cfa2\";\n }\n\n return \"#ff6666\";\n}", "is_edge() {\n return this.level > 0;\n }" ]
[ "0.6465942", "0.6356465", "0.61815774", "0.60650307", "0.5993444", "0.59295934", "0.592179", "0.5826054", "0.5819139", "0.58050716", "0.57608664", "0.5736146", "0.5720413", "0.5665284", "0.56340754", "0.5631371", "0.56108606", "0.56108606", "0.56066597", "0.55967414", "0.5583665", "0.5567371", "0.55316484", "0.5531535", "0.55177474", "0.5488027", "0.54693145", "0.5433558", "0.5428574", "0.54064137", "0.5383766", "0.53632426", "0.5359266", "0.53260624", "0.5320915", "0.53110135", "0.5305433", "0.5290591", "0.5279975", "0.5272635", "0.5263488", "0.52476627", "0.5245403", "0.52422637", "0.52370137", "0.52212834", "0.5210299", "0.52098906", "0.51919407", "0.51815635", "0.51800096", "0.5150337", "0.51460856", "0.5141278", "0.5134588", "0.51269567", "0.51243335", "0.5119729", "0.5113864", "0.5096449", "0.50860673", "0.50773555", "0.50762963", "0.5065046", "0.50216043", "0.5016984", "0.5008458", "0.5006031", "0.49983454", "0.49913856", "0.49897566", "0.49800202", "0.49780798", "0.497563", "0.49639368", "0.4951585", "0.49513778", "0.49508804", "0.49477586", "0.49474284", "0.49347946", "0.49268976", "0.49256033", "0.49225166", "0.49219263", "0.4888517", "0.48878843", "0.4885684", "0.4877583", "0.48604602", "0.485863", "0.48563486", "0.48556742", "0.4853589", "0.48380744", "0.48330426", "0.4820718", "0.48173562", "0.4816851", "0.48154992" ]
0.6174179
3
Deletes an edge in this tiddler
deleteEdge(tObj, edge, type) { const toTRef = this.tracker.getTiddlerById(edge.to); if (toTRef == null) { // null or undefined return; } // only use the name without the private marker or the namespace utils.setField(tObj, type.name, undefined); return edge; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeEdge(g, e) { }", "removeEdge(g, e) { }", "removeEdge(edge) {\n let index = this.links.indexOf(edge);\n //Prevent multiple deletion on the same element causing bugs\n if (index != -1) {\n this.links.splice(index, 1);\n this.svgsManager.edgeManager.update();\n }\n }", "function onEdgeDelete() {\n\t\t// get the edge id from the class name list of the parent\n\t\t// i stored the id in the class name \n\t\t// since it's the only place I can store data in the html of a default edge\n\t\tlet currEdgeId = edgeContextMenuState['currEdge'].parentNode.classList.item(2);\n\n\t\t// loop through the elements until you find an id that matches currEdgeId\n\t\t// this way you can remove the actual edge that is in elements (we only have the html DOM element)\n\t\t// for loop in order to break out as soon as edge is found\n\t\t//console.log(\"DELETING FROM\", elements);\n\t\tfor (var i = 0; i < elements.length; i++) {\n\t\t\tif (elements[i]['id'] == currEdgeId) {\n\n\t\t\t\t// if id matches, remove the edge from the database\n\t\t\t\tprops?.nodeHelper.RemoveConnection(elements[i]['source'], elements[i]['target'], elements[i]['sourceHandle']);\n\n\t\t\t\t// if id matches, remove the edge from elements\n\t\t\t\t// also update data\n\t\t\t\tsetElements(function (els) {\n\t\t\t\t\tels = removeElements([elements[i]], els);\n\t\t\t\t\tels = updateOutgoingNodesData(els);\n\t\t\t\t\treturn els;\n\t\t\t\t});\n\t\t\t\t//console.log(\"deleted edge\", elements[i]);\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// close the context menu\n\t\tsetEdgeContextMenuState(initialEdgeContextMenuState);\n\t}", "deleteEdge(sourceNodeId, targetNodeId, edgeLabel) {\n\n }", "removeEdgeFromDOM(edge) {\n edge.html.node().parentNode.remove();\n }", "function removeEdge(fa, edgeID) {\r\n\tfa.edges.splice(edgeID, 1);\r\n\taddHelpfulInfoToNodesAndEdges(fa);\r\n}", "removeEdge(vertex1, vertex2) {\n let index;\n index = this.adjacencyList[vertex1].indexOf(vertex2);\n this.adjacencyList[vertex1].splice(index, 1);\n\n index = this.adjacencyList[vertex2].indexOf(vertex1);\n this.adjacencyList[vertex2].splice(index, 1);\n }", "removeEdge(v1, v2) {\n v1.adjacent.delete(v2);\n v2.adjacent.delete(v1);\n }", "removeEdge(v1, v2) {\n v1.adjacent.delete(v2);\n v2.adjacent.delete(v1);\n }", "removeEdge(v1, v2) {\n v1.adjacent.delete(v2);\n v2.adjacent.delete(v1);\n }", "removeEdge(v1, v2) {\n v1.adjacent.delete(v2);\n v2.adjacent.delete(v1);\n }", "removeEdge(v1, v2) {\n v1.adjacent.delete(v2);\n v2.adjacent.delete(v1);\n }", "removeEdge(v1, v2) {\n v1.adjacent.delete(v2);\n v2.adjacent.delete(v1);\n }", "removeEdge(vertex1, vertex2) {\n this.adjacencyList[vertex1] = this.adjacencyList[vertex1].filter(\n v => v !== vertex2\n );\n }", "delete(e) {\n\t\tea && assert(this.validEdge(e));\n\t\tthis._edges.swap(e);\n\t\tlet u = this._left[e]; let v = this._right[e];\n\t\tthis._firstEp[u] = this._epLists.delete(2*e, this._firstEp[u]);\n\t\tthis._firstEp[v] = this._epLists.delete(2*e+1, this._firstEp[v]);\n\t\treturn true;\n\t}", "removeNode(node){\n delete this.adjList[node];\n\n Object.keys(this.adjList).map(eachNode => {\n let currentNode = this.adjList[eachNode];\n let currentIndex = currentNode.edges.indexOf(node);\n if(currentIndex > -1){\n currentNode.edges.splice(currentIndex,1);\n }\n })\n }", "function removeEdgeOnto(src,tgt){\n i = indexOfLinkOnto(src,tgt);\n if(i==-1) return;\n link_dataOnto.splice(i,1);\n refreshGraphOnto(node_dataOnto,link_dataOnto);\n}", "removeEdge(vertex1, vertex2) {\n this.adjacencyList[vertex1] = this.adjacencyList[vertex1].filter(\n (v) => v !== vertex2\n );\n this.adjacencyList[vertex2] = this.adjacencyList[vertex2].filter(\n (v) => v !== vertex1\n );\n }", "disconnect(blob1, blob2) {\n // Find the Edge\n const edgeToRemove = this.getEdge(blob1, blob2)\n if (edgeToRemove === null) {\n log(\"Edge not found.\")\n return null;\n }\n // Remove the Edge\n this.edges = this.edges.filter(function(edge) {\n return edgeToRemove !== edge;\n })\n // Remove from DOM\n this.removeEdgeFromDOM(edgeToRemove);\n }", "removeVertex(vertex) {\n while (this.adjacencyList[vertex].length) {\n const adjacentVertex = this.adjacencyList[vertex].pop();\n this.removeEdge(vertex, adjacentVertex);\n }\n delete this.adjacencyList[vertex];\n }", "removeVertex(vertex) {\n while (this.adjacencyList[vertex].length) {\n const adjacentVertex = this.adjacencyList[vertex].pop();\n this.removeEdge(vertex, adjacentVertex);\n }\n delete this.adjacencyList[vertex];\n }", "delete() {\n const source = internal(this).source;\n const model = internal(source).model;\n internal(model).connections.remove(this);\n }", "removeVertex(vertex) {\n if (vertex in this.adjacencyList) {\n let neighbors = this.adjacencyList[vertex];\n for (let neighbor of neighbors) {\n this.removeEdge(vertex, neighbor);\n }\n delete this.adjacencyList[vertex];\n }\n }", "removeVertex(vertex) {\n while (this.adjacencyList[vertex].length) {\n const adjacentVertex = this.adjacencyList[vertex].pop()\n this.removeEdge(vertex, adjacentVertex);\n }\n delete this.adjacencyList[vertex];\n }", "removeEdge(node, port, node2, port2) {\n this.checkTransactionStart();\n port = this.getPortName(port);\n port2 = this.getPortName(port2);\n let toRemove = [];\n let toKeep = [];\n if (node2 && port2) {\n for (var index = 0; index < this.edges.length; index++) {\n var edge = this.edges[index];\n if (edge.from.node === node && edge.from.port === port && edge.to.node === node2 && edge.to.port === port2) {\n this.setEdgeMetadata(edge.from.node, edge.from.port, edge.to.node, edge.to.port, {});\n toRemove.push(edge);\n } else {\n toKeep.push(edge);\n }\n }\n } else {\n for (var index = 0; index < this.edges.length; index++) {\n var edge = this.edges[index];\n if ((edge.from.node === node && edge.from.port === port) || (edge.to.node === node && edge.to.port === port)) {\n this.setEdgeMetadata(edge.from.node, edge.from.port, edge.to.node, edge.to.port, {});\n toRemove.push(edge);\n } else {\n toKeep.push(edge);\n }\n }\n }\n\n this.edges = toKeep;\n for (let i = 0; i < toRemove.length; i++) {\n var edge = toRemove[i];\n this.emit('removeEdge', edge);\n }\n\n return this.checkTransactionEnd();\n }", "removeEdge(v1, v2) {\n this.adjacencyList[v1] = this.adjacencyList[v1].filter(\n v => v !== v2\n );\n this.adjacencyList[v2] = this.adjacencyList[v2].filter(\n v => v !== v1\n );\n }", "removeVertex(vertex) {\n // remove links to the vertex's adjacencies\n for (let link of vertex.adjacent) {\n vertex.adjacent.delete(link);\n }\n // remove the vertex\n this.nodes.delete(vertex);\n }", "removeAllEdgeConnectToVertex(vertex)\n\t{\n\t\tthis.findEdgeRelateToVertex(vertex.id).forEach(edge=>{\n\t\t\tedge.remove()\n\t\t})\n\t}", "removeVertex(vertex) { \n for (let node of this.nodes) {\n if (node.adjacent.has(vertex)) {\n node.adjacent.delete(vertex);\n }\n }\n this.nodes.delete(vertex);\n }", "removeEdge(v1, v2) {\n if (v1 in this.adjacencyList && v2 in this.adjacencyList) {\n this.adjacencyList[v1] = this.adjacencyList[v1].filter((v) => v !== v2);\n this.adjacencyList[v2] = this.adjacencyList[v2].filter((v) => v !== v1);\n }\n }", "removeNode(node) {\n assertHasNode(this, node);\n\n for (let [type, nodesForType] of this.inboundEdges.get(node.id)) {\n for (let from of nodesForType) {\n this.removeEdge(from, node.id, type, // Do not allow orphans to be removed as this node could be one\n // and is already being removed.\n false\n /* removeOrphans */\n );\n }\n }\n\n for (let [type, toNodes] of this.outboundEdges.get(node.id)) {\n for (let to of toNodes) {\n this.removeEdge(node.id, to, type);\n }\n }\n\n let wasRemoved = this.nodes.delete(node.id);\n (0, _assert.default)(wasRemoved);\n }", "removeVertext(vertex) {\n // loop through adjacencyList\n while (this.adjacencyList[vertex].length) {\n const adjacentVertex = this.adjacencyList[vertex].pop()\n // removeEdge for each vertex and all respective vertexes\n this.removeEdge(vertex, adjacentVertex);\n }\n // delete vertex's key\n delete this.adjacencyList[vertex]\n }", "function deleteRangeEdge(writer, connectionID, nodeID) {\n\t var recordWriter = writer.getRecordWriter();\n\t var edgeID = generateClientEdgeID(connectionID, nodeID);\n\t recordWriter.applyRangeUpdate(connectionID, edgeID, REMOVE);\n\n\t deleteRecord(writer, edgeID);\n\t if (writer.hasChangeToRecord(edgeID)) {\n\t writer.recordUpdate(connectionID);\n\t }\n\t}", "function deleteRangeEdge(writer, connectionID, nodeID) {\n\t var recordWriter = writer.getRecordWriter();\n\t var edgeID = generateClientEdgeID(connectionID, nodeID);\n\t recordWriter.applyRangeUpdate(connectionID, edgeID, REMOVE);\n\n\t deleteRecord(writer, edgeID);\n\t if (writer.hasChangeToRecord(edgeID)) {\n\t writer.recordUpdate(connectionID);\n\t }\n\t}", "removeVertex(vertex) {\n this.nodes.delete(vertex);\n vertex.adjacent.forEach(node => node.adjacent.delete(vertex));\n // for(let node of this.nodes) {\n // node.adjacent.delete(vertex);\n // }\n }", "removeEdgeCommand(edge, _isFirst) {\n if (this.links.indexOf(edge) != -1) {\n CommandePatern_1.myManager.Execute(CommandePatern_1.CommandsRepository.SupprEdgeCommand(this, edge, _isFirst));\n }\n }", "removeVertex(vertex) {\n for (let node of this.nodes) {\n if (node.adjacent.has(vertex)) {\n node.adjacent.delete(vertex);\n }\n }\n this.nodes.delete(vertex);\n }", "removeVertex(vertex) {\n for (let node of this.nodes) {\n if (node.adjacent.has(vertex)) {\n node.adjacent.delete(vertex);\n }\n }\n this.nodes.delete(vertex);\n }", "removeVertex(vertex) {\n for (let edge of vertex.adjacent) this.removeEdge(vertex, edge);\n this.nodes.delete(vertex);\n }", "removeEdge(node1, node2) {\n const list = this.lists[node1];\n if (list == null) {\n return;\n }\n // once we got the list of successors, we look for node2\n for (let i = 0; i < list.getSize(); i++) {\n if (list.get(i) === node2) {\n list.remove(i);\n break;\n }\n }\n }", "removeEdge(v1, v2) {\n if (this.adjacencyList[v1].includes(v2)) {\n this.adjacencyList[v1] = this.adjacencyList[v1].filter((v) => v !== v2);\n }\n if (this.adjacencyList[v2].includes(v1)) {\n this.adjacencyList[v2] = this.adjacencyList[v2].filter((v) => v !== v1);\n }\n }", "function deleteEdge(graphId, sourceNodeId, targetNodeId) {\n\n\tvar array = MAIN_GRAPHS[graphId].allSVGEdges;\n\tfor (var i = 0; i < array.length; i++) {\n\t\tvar node1Id = $(array[i].node1).parent()[0].getAttribute('nodeId');\n\t\tvar node2Id = $(array[i].node2).parent()[0].getAttribute('nodeId');\n\t\tif ((sourceNodeId == node1Id && targetNodeId == node2Id)\n\t\t\t\t|| (sourceNodeId == node2Id && targetNodeId == node1Id)) {\n\t\t\tvar edgeSvg = array[i].lineSvg;\n\t\t\t// remove from svg elemetns\n\t\t\tedgeSvg.remove();\n\t\t\tarray.splice(i, 1);\n\t\t}\n\t}\n\tarray = MAIN_GRAPHS[graphId].allEdges;\n\tfor (var i = 0; i < array.length; i++) {\n\t\tvar source = array[i].source;\n\t\tvar target = array[i].target;\n\t\tif ((sourceNodeId == source && targetNodeId == target)\n\t\t\t\t|| (sourceNodeId == target && targetNodeId == source)) {\n\t\t\tarray.splice(i, 1);\n\t\t}\n\t}\n\t// TODO: call a function to recalculate graph parameters // num of edges ...\n}", "applyRedo(e)\n {\n const graph = this.controller.getGraph();\n const edge = graph.getEdgeByElementID(e.eventData.edgeID);\n if (!edge) throw new Error('Unable to find target in graph');\n\n graph.deleteEdge(edge);\n }", "function removeEdge (graph, source, dest){\n let linkedList = graph.list[source];\n linkedList.deleteVal(dest);\n return graph;\n}", "function deleteAssociations( a_edgeuuid, callback )\n{\n pool.cql( \"delete from associations where edgeuuid = \" + a_edgeuuid, [], function( err, results )\n {\n callback( err );\n });\n}", "function deleteRangeEdge(writer, connectionID, nodeID) {\n\t var recordWriter = writer.getRecordWriter();\n\t var edgeID = __webpack_require__(350)(connectionID, nodeID);\n\t recordWriter.applyRangeUpdate(connectionID, edgeID, REMOVE);\n\n\t deleteRecord(writer, edgeID);\n\t writer.recordUpdate(connectionID);\n\t}", "function delete_relatededges(_node, _edges, _edges_tangents){\r\n\tvar currentid = _node.id;\r\n\tfor (var i=0; i<_edges.length; i++){\r\n\t\tvar tempedge=edges[i];\r\n\t\tif (_edges[i].power === 2){\r\n\t\t\tif (_edges[i].startid === currentid || _edges[i].endid === currentid ) {\r\n\t\t\t\tif ( edge_delete(i) ) i--;\r\n\t\t\t}\r\n\t\t} else if (_edges[i].power === 3){\t\t\t\t\t\t\t\t\r\n\t\t\tif (_edges[i].nodeid === currentid) {\r\n\t\t\t\tif ( edge_delete(i) ) i--;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn {edges: _edges, edges_tangents: _edges_tangents};\r\n}", "removeEdge(from, to, type = null, removeOrphans = true) {\n if (!this.outboundEdges.get(from).get(type).has(to)) {\n throw new Error(`Outbound edge from ${from} to ${to} not found!`);\n }\n\n if (!this.inboundEdges.get(to).get(type).has(from)) {\n throw new Error(`Inbound edge from ${to} to ${from} not found!`);\n }\n\n this.outboundEdges.get(from).get(type).delete(to);\n this.inboundEdges.get(to).get(type).delete(from);\n let connectedNode = (0, _nullthrows.default)(this.nodes.get(to));\n\n if (removeOrphans && this.isOrphanedNode(connectedNode)) {\n this.removeNode(connectedNode);\n }\n }", "removeVertex(vertex) {\n if (!this.adjacencyList) return null;\n if (!this.adjacencyList[vertex]) return null;\n for (let v of this.adjacencyList[vertex]) {\n this.removeEdge(v, vertex);\n }\n delete this.adjacencyList[vertex];\n }", "removeVertex(vertex){\n //*This will loop through the array while the vertex has any values in its array\n while(this.adjacencyList[vertex].length){\n //*Variable that will take the value of the vertex to be removed\n const adjacentVertex = this.adjacencyList[vertex].pop();\n //*This will remove the edges from any other vertices that have a relation with that vertex\n this.removeEdge(vertex, adjacentVertex);\n }\n //*Deleting the vertex from the list by the key\n delete this.adjacencyList[vertex]\n }", "delete(){\n let neighborList = this.neighbors.iterator();\n\n while(!neighborList.isEmpty()){\n neighborList.currItem().removeNeighbor(this); //remove this from its list\n\n neighborList.next();\n }\n\n }", "removeEdge(fromVertex, toVertex) {\n if (!this.checkIfEdgeExists(fromVertex, toVertex)) return false;\n fromVertex.edges = fromVertex.edges.filter(vertex => vertex.value !== toVertex.value); // return boolean, any vertex that passed test then add array\n toVertex.edges = toVertex.edges.filter(vertex => vertex.value !== fromVertex.value); // return boolean, any vertex that passed test then add array\n if (fromVertex.numberOfEdges === 0) this.removeVertex(fromVertex.value);\n if (toVertex.numberOfEdges === 0) this.removeVertex(toVertex.value);\n }", "removeEdge (source, destination) {\n if (\n this.nodes.get(source).includes(destination) &&\n this.nodes.get(destination).includes(source)\n ) {\n let sourceEdges = this.nodes.get(source)\n let destinationEdges = this.nodes.get(destination)\n\n let newSourceEdges = sourceEdges.filter(edge => edge !== destination)\n let newDestinationEdges = destinationEdges.filter(edge => edge !== source)\n\n while (sourceEdges.length > 0) {\n sourceEdges.pop()\n }\n\n while (destinationEdges.length > 0) {\n destinationEdges.pop()\n }\n newSourceEdges.forEach(sourceEdge => sourceEdges.push(sourceEdge))\n\n newDestinationEdges.forEach(destEdge => destinationEdges.push(destEdge))\n } else {\n return false\n }\n }", "removeEdge(vertex1,vertex2){\n //*Reassigning the key of vertex1 to a new array that does not have vertex2\n this.adjacencyList[vertex1] = this.adjacencyList[vertex1].filter(\n (v) => v !== vertex2\n );\n //*Reassigning the key of vertex2 to a new array that does not have vertex1\n this.adjacencyList[vertex2] = this.adjacencyList[vertex2].filter(\n (v) => v !== vertex1\n );\n }", "resetNewEdge(){\n this.newEdge1 = null;\n this.newEdge2 = null;\n }", "removeVertex(vertex) {\n // remove from vertices\n let index = this.vertices.indexOf(vertex);\n this.vertices.splice(index, 1);\n // remove from adjacencyList\n delete this.adjacencyList[vertex];\n\n for (const prop in this.adjacencyList) {\n index = this.adjacencyList[prop].indexOf(vertex);\n if (index >= 0) {\n this.adjacencyList[prop].splice(index, 1);\n }\n }\n }", "function deletenode(e) {\n jsPlumb.remove(e.parentNode.parentNode.parentNode.parentNode);\n}", "delete(node) {\n mona_dish_1.DQ.byId(node.id.value, true).delete();\n }", "delVertex(){\n if(this.selectedVert != null){\n this.selectedVert.delete();\n\n this.vertices.delete(this.selectedVert);\n\n this.selectedVert = null; //pretty simple using OOP\n }\n }", "async function undoEdgeFields() {\n readerForm.querySelector('.edge-group').remove();\n readerForm.querySelector('.undo-btn').remove();\n if (typeof visualGraph === 'object') visualGraph.destroy();\n document.querySelector('#adjacency-list').innerHTML = null;\n readerForm.querySelector('#numVertexes').disabled = false;\n readerForm.querySelector('#numEdges').disabled = false;\n readerForm.querySelector('button[type=\"submit\"]').innerHTML = 'Definir arestas';\n}", "function removeEdges(elements) {\n var filteredElements = filter(elements, function (element) {\n if (!isConnection$3(element)) {\n return true;\n } else {\n return find(elements, matchPattern({\n id: element.source.id\n })) && find(elements, matchPattern({\n id: element.target.id\n }));\n }\n });\n return filteredElements;\n }", "removeEdgeLostPropOnVertex(vertex) {\n\t\t// Find edge start from this vertex\n\t\tconst arrSrcPaths = _.filter(this.dataContainer.edge, (e) => {\n\t\t\treturn e.source.vertexId === vertex.id\n\t\t})\n\n\t\t// Find edge end at this vertex\n\t\tconst arrDesPaths = _.filter(this.dataContainer.edge, (e) => {\n\t\t\treturn e.target.vertexId === vertex.id\n\t\t})\n\n\t\tarrSrcPaths.forEach(src => {\n\t\t\tconst {source: {prop, vertexId}} = src\n\n\t\t\tif(prop.indexOf('title') == -1 && this.objectUtils.findIndexPropInVertex(vertexId, prop) === null)\n\t\t\t\tsrc.remove()\n\t\t})\n\n\t\tarrDesPaths.forEach(des => {\n\t\t\tconst {target: {prop, vertexId}} = des\n\n\t\t\tif(prop.indexOf('title') == -1 && this.objectUtils.findIndexPropInVertex(vertexId, prop) === null)\n\t\t\t\tdes.remove()\n\t\t})\n\t}", "delete() {\n this.removeAllConnections()\n \n let parent = this.getParent()\n let diagram = this.getDiagram()\n \n if (parent) {\n parent.removeChild(this)\n } else {\n diagram.removePane(this)\n }\n \n this.redrawAllConnectionsInDiagram()\n }", "delete() {\n this.eachElem((node) => {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n });\n }", "delete() {\n this.eachElem((node) => {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n });\n }", "removeAllEdgeConnectToTheseVertex(lstVertex)\n\t{\n\t\tlstVertex.forEach(e=>{\n\t\t\tthis.findEdgeRelateToVertex(e.id).forEach(edge=>{\n\t\t\t\tedge.remove()\n\t\t\t})\n\t\t})\n\t}", "function deleteConnection(element) {\n element.removeAttr(\"href\");\n element.unbind('click');\n element.addClass(\"glyphicon-plus\")\n element.removeClass(\"glyphicon-remove\")\n element.draggable(\"enable\");\n drawLines();\n}", "function removeEdges(rect) {\n for(var i = 0; i < rect.edge.length; ++i) {\n\tvar idx = rect.edge[i].edge.indexOf(rect);\n\trect.edge[i].edge.splice(idx, 1);\n }\n}", "unlink() {\n let pos;\n let inode = this.inputNode;\n let onode = this.outputNode;\n\n if (!(inode && onode)) {\n return;\n }\n\n (pos = inode.edges.indexOf(this)) > -1 && inode.edges.splice(pos, 1);\n (pos = onode.edges.indexOf(this)) > -1 && onode.edges.splice(pos, 1);\n (pos = inode.outputEdges.indexOf(this)) > -1 &&\n inode.outputEdges.splice(pos, 1);\n (pos = onode.inputEdges.indexOf(this)) > -1 &&\n onode.inputEdges.splice(pos, 1);\n\n if (this.duplex) {\n (pos = inode.inputEdges.indexOf(this)) > -1 &&\n inode.inputEdges.splice(pos, 1);\n (pos = onode.outputEdges.indexOf(this)) > -1 &&\n onode.outputEdges.splice(pos, 1);\n }\n\n this.inputNode = null;\n this.outputNode = null;\n\n this.duplex = false;\n\n return true;\n }", "function DeleteConnectionHandler(canvas, modeling) {\n this._canvas = canvas;\n this._modeling = modeling;\n }", "function DeleteConnectionHandler(canvas, modeling) {\n this._canvas = canvas;\n this._modeling = modeling;\n}", "function DeleteConnectionHandler(canvas, modeling) {\n this._canvas = canvas;\n this._modeling = modeling;\n}", "function DeleteConnectionHandler(canvas, modeling) {\n this._canvas = canvas;\n this._modeling = modeling;\n}", "function DeleteConnectionHandler(canvas, modeling) {\n this._canvas = canvas;\n this._modeling = modeling;\n}", "removeNeighbor(neighbor){\n if(neighbor == null || arguments.length == 0 || !(neighbor instanceof Vertex)){\n throw new Error(\"Invalid neighbor\");\n }\n this.neighbors.delete(neighbor);\n }", "function deleteDiag(req, res) {\n \n diagramService.delete(req.body)\n .then(function () {\n res.sendStatus(200);\n })\n .catch(function (err) {\n res.status(400).send(err);\n });\n}", "function removeDuplicateEdges(oldEdges) {\n for (var i = 0; i < oldEdges.length; i++) {\n if (oldEdges[i].reversed) {\n oldEdges.splice(i, 1);\n i--;\n }\n }\n\n}", "delete(node) {\n node.next.prev = node.prev;\n node.prev.next = node.next;\n }", "function DeleteConnectionHandler(canvas, modeling) {\n this._canvas = canvas;\n this._modeling = modeling;\n}", "removeNodeConnection(targetID) {\n if(this.nodeToPeer[targetID]){\n this.nodeToPeer[targetID].destroy()\n }\n if(this.nodeList.includes(targetID)){\n var index = this.nodeList.indexOf(targetID);\n this.nodeList.splice(index, 1);\n }\n delete this.nodeToPeer[targetID];\n }", "function removeNode(node) {\n let { nodes, links } = Graph.graphData();\n links = links.filter(l => l.source !== node && l.target !== node); // Remove links attached to node\n nodes=nodes.filter(n=>n!==node); // Remove node\n nodes.forEach((n, idx) => { n.ID = idx; }); // Reset node ids to array index\n Graph.graphData({ nodes, links });\n }", "function removeAllEdgesOnto(index){\n for(var i = 0;i<link_dataOnto.length;i++){\n if(link_dataOnto[i].target.index==index || link_dataOnto[i].source.index==index){\n link_dataOnto.splice(i,1);\n removeAllEdgesOnto(index);\n return;\n }\n }\n}", "function removeSelfEdge(\n edgeArray,\n vertexArray,\n vertexA,\n vertexB,\n arrayVertexB,\n arrayVertexA\n) {\n // console.log(arrayVertexB, \"delete array A\");\n // console.log(arrayVertexA, \"delele array B\");\n\n //remove b point to a\n for (let j = 0, j2 = 0; j < arrayVertexB.length; j++) {\n // console.log(arrayVertexB[j]);\n\n edgeArray[vertexA].splice(arrayVertexB[j] + j2, 1);\n j2--;\n }\n\n //remove a point to b\n for (let k = 0, k2 = 0; k < arrayVertexA.length; k++) {\n edgeArray[vertexB].splice(arrayVertexA[k] + k2, 1);\n k2--;\n }\n // edgeArray[vertexB].splice(indexvertexA, 1);\n // remove vertex B from vertex Array\n for (let i = 0; i < vertexArray.length; i++) {\n if (vertexArray[i] === vertexB) {\n vertexArray.splice(i, 1);\n }\n }\n\n // change edge that point to B\n changeEdgePointer(edgeArray, vertexB, vertexA);\n // change edge B to null because it has been merged to edge A\n edgeArray[vertexB] = null;\n\n return edgeArray;\n}", "function deleteNode(node){\n node.data = node.next.data\n node.next = node.next.next\n}", "removeDuplicateEdges() {\n // search all nodes for duplicate edges\n var nodes = this._nodeMap;\n for(var i in nodes){\n var node = nodes[i];\n\n // compare each edge from this node with all other edges from this node\n var edges = node.edgesFromMe;\n for(let j in edges){\n var edge1 = edges[j];\n\n for(let k in edges){\n var edge2 = edges[k];\n\n // remove edge if it is deemed to be a duplicate\n if(j != k && edge1.to.id === edge2.to.id && edge1.label === edge2.label){\n this.removeEdge(edge2);\n delete edges[k];\n }\n }\n }\n }\n }", "removeVertex(value) {\n // for (let i = 0; i < this.value.length; i++) {\n // if (value === this.value[i]) {\n // this.value[i] = null;\n // }\n // }\n // this.checkIfEdgeExists(fromVertex, toVertex);\n // if (this.contains(value)) return;\n // const forRemoval = this.vertices.filter(vertex => vertex.value === value)[0];\n\n const filteredVertices = [];\n let vertexforDeletion;\n for (let i = 0; i < this.vertices.length; i++) {\n if (this.vertices[i].value === value) {\n vertexforDeletion = this.vertices[i];\n } else {\n filteredVertices.push(this.vertices[i]);\n }\n }\n this.vertices = filteredVertices;\n vertexforDeletion.edges.forEach((vertex) => {\n this.removeEdge(vertexforDeletion, vertex);\n });\n }", "function _deleteNode() {\n const id = diagram.selection.toArray()[0].key;\n const node = diagram.findNodeForKey(id);\n diagram.startTransaction();\n diagram.remove(node);\n diagram.commitTransaction(\"deleted node\");\n diagramEvent()\n}", "function deleteSide( id, callback ) {\n\n\tif ( !id ) {\n\t\tcallback( 'Requires side ID' );\n\t}\n\telse {\n\t\tSide.remove({ _id: id }, callback );\n\t}\n}", "function getOppositeEdge(edge) {\r\n return edge * -1;\r\n}", "function getOppositeEdge(edge) {\n return edge * -1;\n}", "function getOppositeEdge(edge) {\n return edge * -1;\n}", "function getOppositeEdge(edge) {\n return edge * -1;\n}", "function getOppositeEdge(edge) {\n return edge * -1;\n}", "function getOppositeEdge(edge) {\n return edge * -1;\n}", "async delete(outing_id) {\n this.update(outing_id, { deleted: true });\n }", "function removeNode(fa, nodeID) {\r\n\tfa.nodes.splice(nodeID, 1);\r\n\tfor (var i = 0; i < fa.edges.length; i++) {\r\n\t\tif (fa.edges[i].fromID === nodeID || fa.edges[i].toID === nodeID) {\r\n\t\t\tfa.edges.splice(i, 1);\r\n\t\t\ti--;\r\n\t\t}\r\n\t}\r\n\tif (nodeID < fa.startID) fa.startID--;\r\n\taddHelpfulInfoToNodesAndEdges(fa);\r\n}", "function edge_dblclick (evt) {\r\n\t\tvar edge = evt.target, i;\r\n\tif (algo) return;\r\n\trefresh();\r\n\tif (aef == 2)\taef = 1;\r\n\t\r\n\tfor (i = 0; edges[i].gi != edge; i++) ;\r\n\tedges[i].wei = parseInt(prompt(\"Modifying an edge; specify integer weight lower than 10,000:\",\"1\")%10000);\r\n\tedges[i].weigi.firstChild.data = edges[i].wei.toString(10);\r\n}", "handlerOnClickEdge(edge) {\n\t\tthis.selectingEdge = edge\n\n\t\tlet selected = d3.select(`#${edge.id}`)\n\t\tlet currentPath = selected.attr('d')\n\t\td3.select(`#${this.groupEdgePointId}`)\n\t\t\t.style('display', 'block')\n\t\t\t.moveToFront()\n\t\td3.select(`#${this.groupEdgePathId}`)\n\t\t\t.style('display', 'block')\n\t\t\t.moveToFront()\n\t\td3.select(`#${this.edgePathId}`)\n\t\t\t.attr('d', currentPath)\n\t\t\t.attr('ref', edge.id)\n\n\t\td3.select(`#${this.pointStartId}`)\n\t\t\t.attr('cx', edge.source.x)\n\t\t\t.attr('cy', edge.source.y)\n\t\td3.select(`#${this.pointEndId}`)\n\t\t\t.attr('cx', edge.target.x)\n\t\t\t.attr('cy', edge.target.y)\n\t}", "function deleteTag(element) {\n var interesse_ID = element.data('interesse_id');\n\n databaseManager\n .query(\"DELETE FROM fys_is105_4.interesses WHERE ID_INTERESSES = (?)\", [interesse_ID]);\n\n element.remove();\n }" ]
[ "0.7873422", "0.7873422", "0.779132", "0.75574404", "0.74871176", "0.705967", "0.70426166", "0.6763776", "0.668116", "0.668116", "0.668116", "0.668116", "0.668116", "0.668116", "0.6513484", "0.64923596", "0.64727736", "0.64702016", "0.6438437", "0.6413313", "0.6401881", "0.6401881", "0.63614357", "0.63572234", "0.6324989", "0.63222784", "0.6265827", "0.6265006", "0.62463504", "0.62298805", "0.62292093", "0.6192938", "0.61919916", "0.6183076", "0.6183076", "0.6170747", "0.616703", "0.6165788", "0.6165788", "0.6147408", "0.61349505", "0.6109307", "0.6084762", "0.60815066", "0.6066132", "0.60575277", "0.60444427", "0.60252684", "0.60226846", "0.59828347", "0.5954236", "0.5926908", "0.59099805", "0.5906232", "0.5865121", "0.58649695", "0.58648473", "0.58321565", "0.5776893", "0.5767144", "0.5724145", "0.5721421", "0.57168823", "0.57077515", "0.5671021", "0.5671021", "0.56296325", "0.5614055", "0.55777544", "0.5545274", "0.5500724", "0.549731", "0.549731", "0.549731", "0.549731", "0.54743737", "0.5473009", "0.54428476", "0.54419297", "0.5429291", "0.5427076", "0.54097563", "0.5397214", "0.5380913", "0.5378766", "0.5364294", "0.5351243", "0.53479785", "0.53399867", "0.53259635", "0.53215086", "0.53215086", "0.53215086", "0.53215086", "0.53215086", "0.5316041", "0.53051066", "0.52947253", "0.5293916", "0.5287426" ]
0.70733297
5
var j = 0;
function particle() { for (var i=0; i<50; i++) { var dir = new THREE.Vector3(2*Math.random()-1, Math.random()*4, 2*Math.random()-1); dir.multiplyScalar(6/dir.length()); var color = (Math.random() > 0.5) ? 0x333333 : 0x666666; var p = new Particle(obj.position, dir, color, 0.1); p.maxLife = 3; } /* j += 1; if (j < 5) { setTimeout(particle, 1); } */ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function e$j(){return [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}", "function z(){this.i=0,this.j=0,this.S=new Array}", "function j(){}", "function j(){}", "function j(){}", "function re(){this.i=0,this.j=0,this.S=new Array}", "function a() {\n for(var i=0; i<10; i++){\n for(var j=0; j<10; j++){\n console.log(j);\n }\n console.log(i);\n }\n}", "function rt(){this.i=0,this.j=0,this.S=new Array}", "function rt(){this.i=0,this.j=0,this.S=new Array}", "function a() {\n for(var i=0; i<10; i++){\n for(var j=0; j<10; j++){\n console.log(i,j);\n }\n console.log(j,i);\n }\n}", "function a(){\n for(var i=0; i<10; i++){\n for(var j=0; j<10; j++){\n console.log(j);\n }\n console.log(i);\n }\n}", "function a(){\n for(var i=0; i<10; i++){\n for(var j=0; j<10; j++){\n console.log(j);\n }\n console.log(i);\n }\n}", "function me(){this.i=0,this.j=0,this.S=new Array}", "function a() {\n for (var i = 0; i < 10; i++) {\n for (var j = 0; j < 10; j++) {\n console.log(j);\n }\n console.log(i);\n }\n}", "function a() {\n for (var i = 0; i < 10; i++) {\n for (var j = 0; j < 10; j++) {\n console.log(j);\n }\n console.log(i);\n }\n}", "function a() {\n for (var i = 0; i < 10; i++) {\n for (var j = 0; j < 10; j++) {\n console.log(j);\n }\n console.log(i);\n }\n}", "function $(){this.i=0,this.j=0,this.S=new Array}", "function a() {\n for (var i = 0; i < 10; i++) {\n for (var j = 0; j < 10; j++) {\n console.log(i, j);\n }\n console.log(j, i);\n }\n}", "function a() {\n for (var i = 0; i < 10; i++) {\n for (var j = 0; j < 10; j++) {\n console.log(i, j);\n }\n console.log(j, i);\n }\n}", "function a() {\n for (var i = 0; i < 10; i++) {\n for (var j = 0; j < 10; j++) {\n console.log(i, j);\n }\n console.log(j, i);\n }\n}", "function whilee(j) {\n let ami = [0, 1];\n let m = 2;\n while (m < j) {\n ami[m] = ami[m - 1] + ami[m - 2];\n\n m++;\n }\n return ami;\n}", "function It(){this.i=0,this.j=0,this.S=new Array}", "function G(){this.i=0,this.j=0,this.S=new Array}", "function G(){this.i=0,this.j=0,this.S=new Array}", "function K(){this.i=0,this.j=0,this.S=new Array}", "function setPos(j) {\n pos = j;\n update();\n\n\n}", "function increment() {\n i++;\n document.querySelector(\"h1#counter\").textContent = i;\n j = 0;\n}", "function double_jump(i, j)\n{\n\tconsole.log(j);\n\tif (i > j){\n\t\treturn gravita(0, \"doppio\");\n\t}\n\n\ty-=1\n\n var interv = setTimeout(function() {\n double_jump(i+1);\n }, 100);\n}", "function ie(){this.i=0,this.j=0,this.S=new Array}", "function dg(a){this.j=a}", "getNumber(i, j){\r\n return this.numbers[(i-1)*9 + (j-1)];\r\n }", "constructor () {\n this._i = 0\n }", "function J(){var t;t=(new Date).getTime(),G[Y++]^=255&t,G[Y++]^=t>>8&255,G[Y++]^=t>>16&255,G[Y++]^=t>>24&255,Y>=X&&(Y-=X)}", "function variavel(){\n return ++x;\n\n }", "function randomFunction(){\n for(let i=0;i<5;i++){\n console.log(i);\n var j = i;\n }\n //console.log(i);\n console.log(j); // j gets printed even though its outside of its scope. its because its a var\n}", "function xj(a,b){this.G=[];this.X=a;this.U=b||null;this.F=this.A=!1;this.C=void 0;this.L=this.R=this.I=!1;this.H=0;this.B=null;this.J=0}", "function O(){this.i=0,this.j=0,this.S=new Array}", "function g() {\n\t\treturn a++;\n\t}", "function a(){\n for(var i=0; i<10; i++){\n i = i +2;\n console.log(i);\n }\n}", "function a(){\n for(var i=0; i<10; i++){\n i = i +2;\n console.log(i);\n }\n}", "function child2c() {\n let j = 5;\n\n }", "function jh(a,b){this.g=[];this.v=a;this.u=b||null;this.f=this.a=!1;this.c=void 0;this.m=this.w=this.i=!1;this.h=0;this.b=null;this.l=0}", "function vietuSukeitimas (i, j) {\n if (i >= 0 && j >= 0 && i !== j){\n var x = prekiautojai[i];\n prekiautojai[i] = prekiautojai[j];\n prekiautojai[j] = x;\n console.log(prekiautojai);\n } else {\n return \"Iveskite 0, teigiama reiksme ir skirtingas reiksmes\"\n }\n}", "function a() {\n for (var i = 0; i < 10; i++) {\n i = i + 2;\n console.log(i);\n }\n}", "function a() {\n for (var i = 0; i < 10; i++) {\n i = i + 2;\n console.log(i);\n }\n}", "function jesusSolve() {\n\n}", "function incrementVariable() {\n \t\ti = i + 1;\n \t}", "function i(t, e) {\n 0;\n }", "function V(){this.i=0,this.j=0,this.S=new Array}", "function test() {\r\n for (var i = 0; i < 10; i++) {\r\n console.log(i);\r\n }\r\n}", "function Y(){this.i=0,this.j=0,this.S=new Array}", "function Y(){this.i=0,this.j=0,this.S=new Array}", "function nj(){var a=this;this.ga=new Ee(function(){return Nj(a)},function(b){var c=Nj(a);c&&(fa(b.y)&&(a.ga.scrollY=-c.Jb*b.y-c.Ub),a.ga.Oa.setAttribute(\"transform\",\"translate(0,\"+(a.ga.scrollY+c.Ib)+\")\"))});this.ga.sj=!0;this.bj=[];this.Ya=this.xa=0;this.Cg=[];this.jc=[]}", "function child2c() {\n let j = 5;\n }", "function first() {\n this.i = 1;\n this.j = 2;\n }", "function Of(a){this.j=a}", "function prime(index) {\n\n}", "function J(a,b){this.l=[];this.kb=a;this.V=b||null;this.f=this.a=!1;this.b=void 0;this.C=this.ya=this.s=!1;this.i=0;this.c=null;this.A=0}", "function i(t, e) {\n 0\n }", "function Ot(){this.i=0,this.j=0,this.S=new Array}", "function e(){return [0,0,0,1]}", "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}", "function Y(e,t){var n,i;for(z=e.length;--z>=0;){n=z,(i=z-1)<0&&(i=e.length-1);//console.log('b', i,j, i-1, k,vertices.length);\nvar r=0,o=m+2*b;for(r=0;r<o;r++){var a=U*r,s=U*(r+1);J(t+n+a,t+i+a,t+i+s,t+n+s)}}}", "function countTestPost(i) { var k = 0; while (i--) { k++; } return k; }", "function Hj(){}", "function start1(){\r\n for(var i=0;i<=5;i++)\r\n console.log(i);\r\n console.log(i);\r\n}", "function index(i,j){\n\t\tvar temp = i*_mapW + j;\n\t\treturn temp < 0 ? -1 :\n\t\t\t temp > _mapW * _mapH -1 ? -1 :\n\t\t\t temp ;\n\t}", "p(i) { return this.#p[i]; }", "function i(a){for(var b=\"\",c=0;c<a.length;c++)b+=j(a[c]);return b}", "function j() {\r\n var offset = parseInt($(\"#immediate\").val());\r\n incrementPc(offset);\r\n}", "function hrb(){this.j=0;this.F=[];this.C=[];this.L=this.V=this.g=this.G=this.O=this.H=0;this.ia=[]}", "function i(n){return n}", "get LinearLoop(){ return 2; }", "function Lt(){this.i=0,this.j=0,this.S=new Array}", "function Jg(a,b){this.f=[];this.A=b||null;this.a=this.b=!1;this.c=void 0;this.o=this.J=this.h=!1;this.g=0;this.i=null;this.D=0}", "function jg(a,b){this.Lc=[];this.ue=a;this.Wd=b||null;this.Mb=this.lb=!1;this.ya=void 0;this.Gd=this.bf=this.bd=!1;this.Rc=0;this.o=null;this.dd=0}", "function pJ(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}", "function end(){\n for(var i =0;i<5;i++) console.log(i);\n\n console.log(i); // drawback of var\n}", "index(i, j) {\n if (i < 0 || i > this.cols - 1 || j < 0 || j > this.rows - 1) return -1;\n else return i + j * this.cols;\n }", "function xx(i){\n \treturn 2*i/width - 1;\n}", "function xx(i){\n \treturn 2*i/width - 1;\n}", "function nbv(i) { var r = []; fromInt(r,i); return r; }", "nextAmbientIndex(ix) {\nvar nextix;\n//---------------\nnextix = ix + 1;\nif (nextix === this.N_FRAMES) {\nnextix = 0;\n}\nreturn nextix;\n}", "function a(b) { //a(3) / a(4)\n for (var i = 0; i < 10; i++) { //i=0>1>2>3>4>5>6>7>8>9>10 /i=0\n console.log(i); //console.log(0,1,3,4,5,6,7,8,9) /\n }\n return i;\n}", "function countBomb(i, j) {\n return minefield[i-1][j-1] + minefield[i-1][j] + minefield[i-1][j+1] +\n minefield[i][j-1] + minefield[i][j+1] +\n minefield[i+1][j-1] + minefield[i+1][j] + minefield[i+1][j+1];\n\n }", "function start(){\n\tconsole.log(\"************** START ***************\");\n\tmatr=[[0,0,0],[0,0,0],[0,0,0]];\n\tgiocatore=1;\n\tturno=1;\n\tnumMosse=0;\n\tresultString=\"\";\n\tcol=[0,0,0];\n\trig=[0,0,0];\n\tdig=[0,0];\n\tdet=0;\n}", "function i(){}", "function i(){}", "function i(){}", "function i(){}", "function i(){}", "function i(){}", "function i(){}", "function ix(i, j){\n\t\treturn j * (width) + i; \n\t}", "function btod ( i ) {\nconsole.log(i);\n}", "function e$1(){return [1,0,0,0,1,0,0,0,1]}", "function rok() {\n for (var i = 0; i < 5; i++){ //trebali smo let ovdje koristiti\n console.log(i);\n }\n console.log(i); //ovo je dostupno ovdje zbog vara i pravi probleme. Treba da jes dostupno samo u odredjenom bloku. \n \n}", "function f() {\n var i; // Line 1.\n for (i = 0; i < 1000; i++) { // Line 2.\n x = 1; // Line 3.\n }\n}", "function delayNumber (j) {\n // j is actually a scoped value for i\n setTimeout(function () {\n console.log(j);\n }, j * 1000);\n}", "function start1() {\r\n for (let i = 0; i < 5; i++) {\r\n console.log(i);\r\n }\r\n\r\n // console.log(i);\r\n}", "getNumber_blockBased(i_block, j_block, i, j){\r\n return this.getNumber((i_block-1)*3+i, (j_block-1)*3+j);\r\n }" ]
[ "0.6916648", "0.657339", "0.6556979", "0.6556979", "0.6556979", "0.64466566", "0.641133", "0.6392126", "0.6392126", "0.63794315", "0.6375725", "0.6375725", "0.6309701", "0.6305316", "0.6305316", "0.6305316", "0.62911266", "0.62623817", "0.62623817", "0.62623817", "0.61422426", "0.60284555", "0.5991721", "0.5991721", "0.59578675", "0.5954118", "0.5945406", "0.5911977", "0.5907442", "0.5837891", "0.58151555", "0.5787348", "0.57419497", "0.5737878", "0.5732207", "0.57242626", "0.5708455", "0.5703483", "0.566893", "0.566893", "0.56461823", "0.5636014", "0.56353796", "0.56212425", "0.56212425", "0.56142306", "0.56013495", "0.559982", "0.55991113", "0.55932367", "0.5587343", "0.5587343", "0.55590206", "0.5555034", "0.5547165", "0.5545925", "0.5537047", "0.5523493", "0.5504857", "0.54931426", "0.5489539", "0.5480939", "0.54761064", "0.54527295", "0.5425806", "0.5417359", "0.5406034", "0.5382628", "0.5375525", "0.53730816", "0.5361669", "0.53599906", "0.5353299", "0.5338351", "0.5331257", "0.53152496", "0.5313011", "0.53119254", "0.530966", "0.5304482", "0.5304482", "0.5292336", "0.5288441", "0.5286378", "0.5285652", "0.52851504", "0.5280558", "0.5280558", "0.5280558", "0.5280558", "0.5280558", "0.5280558", "0.5280558", "0.5276508", "0.52708256", "0.5265344", "0.52633464", "0.5261174", "0.5255666", "0.5255418", "0.52484155" ]
0.0
-1
return an Array that contain all of acceptable key
getAnswerKey() { var result = []; (this.text).split("").forEach(function(element){ if(!(result.includes(element))) { result.push(element.toLowerCase()); } }) return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "keys() {\n let keysArr = [];\n for (let i = 0; i < this.keyMap.length; i++) {\n if (this.keyMap[i]) {\n for (let j = 0; j < this.keyMap[i].length; i++) {\n if (!keysArr.includes(this.keyMap[i][j][1])) {\n keysArr.push(this.keyMap[i][j][1]);\n }\n }\n }\n }\n return keysArr;\n }", "keys() {\n let result = []\n for (let i = 0; i<this.keyMap.length; i++) {\n if (!!this.keyMap[i]) {\n if (this.keyMap[i].length>0) {\n for (let j=0; j<this.keyMap[i].length; j++) {\n result.push(this.keyMap[i][j][0])\n }\n }\n }\n }\n return result\n }", "keys() {\n let keysArray = [];\n for (let i = 0; i < this.keyMap.length; i++) {\n if (this.keyMap[i]) {\n for (let j = 0; j < this.keyMap[i].length; j++) {\n if (!keysArray.includes(this.keyMap[i][j][0])) {\n keysArray.push(this.keyMap[i][j][0]);\n }\n }\n }\n }\n return keysArray;\n }", "keys() {\n let keysArr = [];\n for (let i = 0; i < this.keyMap.length; i++) {\n //loop through out entire hashmap\n if (this.keyMap[i]) {\n //check if exist and check for subarrays\n for (let j = 0; j < this.keyMap[i].length; j++) {\n //loop through subarrays\n if (!keysArr.includes(this.keyMap[i][j][0])) {\n //make sure there are not duplicates of keys in oour hashmap\n keysArr.push(this.keyMap[i][j][0]); //push to our initialized arary because we want to keep in insisde of DS\n }\n }\n }\n }\n return keysArr;\n }", "keys() {\n const keysArray = [];\n for (let i = 0; i < this.data.length; i++) {\n if (this.data[i]) {\n keysArray.push(this.data[i][0][0]);\n }\n }\n return keysArray;\n }", "keys() {\n const keyArr = [];\n for (let i = 0; i < this.data.length; i++) {\n if (this.data[i]) {\n for (let j = 0; j < this.data[i].length; j++) {\n keyArr.push(this.data[i][j][0]);\n }\n }\n }\n return keyArr;\n }", "values() {\n let valuesArr = [];\n for (let i = 0; i < this.keyMap.length; i++) {\n if (this.keyMap[i]) {\n for (let j = 0; j < this.keyMap[i].length; i++) {\n if (!valuesArr.includes(this.keyMap[i][j][1])) {\n valuesArr.push(this.keyMap[i][j][1]);\n }\n }\n }\n }\n return valuesArr;\n }", "values() {\n let valuesArray = [];\n for (let i = 0; i < this.keyMap.length; i++) {\n if (this.keyMap[i]) {\n for (let j = 0; j < this.keyMap[i].length; j++) {\n if (!valuesArray.includes(this.keyMap[i][j][1])) {\n valuesArray.push(this.keyMap[i][j][1]);\n }\n }\n }\n }\n return valuesArray;\n }", "allKeys() {\n return this.k2s.keys();\n }", "get keys() {}", "allKeys() {\n return null;\n }", "keys(key) {\n return state[`keys.${key}`] || [];\n }", "keys() {\n const result = [];\n for (let i = 0; i < this.map.length; i += 1) {\n if (this.map[i] !== undefined) {\n for (let j = 0; j < this.map[i].length; j += 1) {\n const key = this.map[i][j][0];\n result.push(key);\n }\n }\n }\n\n return result;\n }", "function keyToArray(key) {\n if (!key) return [];\n if (typeof key != \"string\") return key;\n return key.split('.');\n }", "validator(key, params, exp) {\n return [key, params, exp]\n }", "complete(text) {\n //@TODO\n let arrayKeys = Array.from(map2.keys());\n\n let finalArray = arrayKeys.filter(function(value){\n if(value.match(`^${text}`)){\n return value;\n }\n });\n\n return finalArray;\n }", "async getPartialKeyArray(ctx, indexName, partialKey) {\n //Calling ing the function with the partial key and storing the iterator\n let iterator = await ctx.stub.getStateByPartialCompositeKey(indexName, [partialKey]);\n //declaring an empty array\n let array = [];\n //while condtion to iterate over the itertaor\n while (true) {\n var data = await iterator.next();\n //If iterator has a value\n if (data.value) {\n array.push(data.value.value.toString('utf8'));\n }\n if (data.done) {\n await iterator.close();\n //return array\n return array;\n }\n }\n }", "getAuthorityMetadataKeys() {\n return this.getKeys().filter(key => {\n return this.isAuthorityMetadata(key);\n });\n }", "values() {\n let valArr = [];\n for (let i = 0; i < this.keyMap.length; i++) {\n //loop through out entire hashmap\n if (this.keyMap[i]) {\n //check if exist and check for subarrays\n for (let j = 0; j < this.keyMap[i].length; j++) {\n //loop through subarrays\n if (!valArr.includes(this.keyMap[i][j][1])) {\n //make sure there are not duplicates of values in our hashmap if so, return once\n valArr.push(this.keyMap[i][j][1]); //push to our initialized arary because we want to keep in insisde of DS\n }\n }\n }\n }\n return valArr;\n }", "function getKeyValues(req){\n var reqArray = [];\n var i = 0;\n for(var key in req.body){\n reqArray[i] = JSON.parse(key);\n i++;\n }\n return reqArray;\n}", "function getArrayOfKeys(arr, key) {\n\tlet arrVal = [];\n\texecuteforEach(arr, function(arr){\n\t\tarrVal.push(arr[key])\n\t});\n\treturn arrVal;\n}", "keys() {\n const keysArray = [];\n for (let i = 0; i < this.data.length; i++) {\n if (this.data[i]) {\n // if there's something in memory space\n console.log(this.data[i][0][0]);\n keysArray.push(this.data[i][0][0]);\n }\n }\n return keysArray;\n }", "function filterKey(key) {\n\tvar result = [];\n\tfor (var i = 0; i < key.length; i++) {\n\t\tvar c = key.charCodeAt(i);\n\t\tif (isLetter(c)){\n\t\t\tresult.push((c - 65) % 32);\n }\n\t}\n\treturn result;\n}", "static getArray(key) {\n if (Array.isArray(Preferences.get(key))) {\n return Preferences.get(key);\n }\n return JSON.parse(Preferences.get(key));\n }", "static getArray(key) {\n if (Array.isArray(Preferences.get(key))) {\n return Preferences.get(key);\n }\n return JSON.parse(Preferences.get(key));\n }", "function filterKey(key) {\r\n var result = [];\r\n for (var i = 0; i < key.length; i++) {\r\n var c = key.charCodeAt(i);\r\n if (isLetter(c))\r\n result.push((c - 65) % 32);\r\n }\r\n return result;\r\n}", "function getAllKeys(data) {\n let keys = Object.keys(data[0].meta);\n\n for (let i = 1; i < data.length; i++) {\n let currentKeys = Object.keys(data[i].meta);\n for (let currentKey of currentKeys) {\n if (keys.indexOf(currentKey) === -1) {\n keys.push(currentKey);\n }\n }\n }\n return keys;\n}", "function getKeys(key) {\n if (!key) key = '';\n\n key = key.replace(/\\s/g, ''); // Matches any whitespace characters, including spaces, tabs, page breaks, etc.\n var keys = key.split(','); // Set multiple shortcuts at the same time, split by ','\n var index = keys.lastIndexOf('');\n\n // Shortcuts may contain ',' and require special handling\n for (; index >= 0;) {\n keys[index - 1] += ',';\n keys.splice(index, 1);\n index = keys.lastIndexOf('');\n }\n\n return keys;\n }", "keys() {\n this.init();\n return Array.from(this.map.keys());\n }", "keys() {\n this.init();\n return Array.from(this.map.keys());\n }", "keys() {\n this.init();\n return Array.from(this.map.keys());\n }", "keys() {\n this.init();\n return Array.from(this.map.keys());\n }", "keys() {\n this.init();\n return Array.from(this.map.keys());\n }", "keys() {\n this.init();\n return Array.from(this.map.keys());\n }", "function listKeys() {\n return ec2.describeKeyPairs({})\n .then(data => data.KeyPairs.filter(key => key.KeyName.indexOf(UID) === 0));\n}", "function keys() {\n return this.pluck('key');\n }", "mustBeKeys(action) {\n const data = this.extractData(action);\n if (!Array.isArray(data)) {\n return this.throwError(action, `should be an array of entity keys (id)`);\n }\n data.forEach((id, i) => {\n if (this.isNotKeyType(id)) {\n const msg = `${this.entityName} ', item ${i + 1}, is not a valid entity key (id)`;\n this.throwError(action, msg);\n }\n });\n return data;\n }", "function all() {\n return dictionary.slice();\n}", "getAllPossible(category){\n let res = [];\n for (let item of json.jsonArray){\n if(item.key === category){\n for(let character of item.value){\n res.push(character);\n }\n }\n }\n return res;\n }", "keys() {\n this.init();\n return Array.from(this.normalizedNames.values());\n }", "function keyComboArrayFromString(keyString) {\n var keysArr = [];\n var currModifiers = '';\n\n while (keyString.length) {\n var modifierMatch = keyString.match(/^(ctrl|meta|shift|alt)\\+/i);\n var multiCharMatch = keyString.match(multiCharRegex);\n\n if (modifierMatch) {\n currModifiers += modifierMatch[0];\n keyString = keyString.substring(modifierMatch[0].length);\n } else if (multiCharMatch) {\n keysArr.push(currModifiers + multiCharMatch[0]);\n keyString = keyString.substring(multiCharMatch[0].length);\n currModifiers = '';\n } else {\n keysArr.push(currModifiers + keyString[0]);\n keyString = keyString.substring(1);\n currModifiers = '';\n }\n }\n\n return keysArr;\n }", "keys() {\n this.init();\n return Array.from(this.normalizedNames.values());\n }", "keys() {\n this.init();\n return Array.from(this.normalizedNames.values());\n }", "keys() {\n this.init();\n return Array.from(this.normalizedNames.values());\n }", "keys() {\n this.init();\n return Array.from(this.normalizedNames.values());\n }", "keys() {\n this.init();\n return Array.from(this.normalizedNames.values());\n }", "keys() {\n\t\tif (!this.data.length) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst keysArray = [];\n\t\tfor (let i = 0; i < this.data.length; i++) {\n\t\t\t// if data at index i exists push it to the array\n\t\t\tif (this.data[i]) {\n\t\t\t\t// when data at i lengh is greater than 1, then probably here hash collision had happened\n\t\t\t\t// need to loop over this array to get all the values\n\t\t\t\tif (this.data[i].length > 1) {\n\t\t\t\t\tfor (let j = 0; j < this.data[i].length; j++) {\n\t\t\t\t\t\tkeysArray.push(this.data[i][j][0]);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// else, just push first value in that array\n\t\t\t\t\tkeysArray.push(this.data[i][0][0]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn keysArray;\n\t}", "function __keys__ () {\n\t\tvar keys = []\n\t\tfor (var attrib in this) {\n\t\t\tif (!__specialattrib__ (attrib)) {\n\t\t\t\tkeys.push (attrib);\n\t\t\t} \n\t\t}\n\t\treturn keys;\n\t}", "getKeywordsArr() {\n return this.state.keywords.split(',').map(k => k.trim()).filter(k => k);\n }", "listKeys(bucket) {\n\n let allKeys = this.store.keys();\n let bucketKeys = [];\n\n for (let i in allKeys) {\n\n if (allKeys[i].startsWith(`${bucket}${DELIM}`)) {\n bucketKeys.push(allKeys[i]);\n }\n }\n\n return bucketKeys;\n }", "function getKeys(key) {\n\t var keys;\n\t key = key.replace(/\\s/g, '');\n\t keys = key.split(',');\n\t if ((keys[keys.length - 1]) == '') {\n\t keys[keys.length - 2] += ',';\n\t }\n\t return keys;\n\t }", "function getKeys(key) {\n\t var keys;\n\t key = key.replace(/\\s/g, '');\n\t keys = key.split(',');\n\t if ((keys[keys.length - 1]) == '') {\n\t keys[keys.length - 2] += ',';\n\t }\n\t return keys;\n\t }", "function getKeyCombo(event){\r\n\t\t\t\tvar arr = [], keycode = event.keyCode,\r\n\t\t\t\t\t// determines if keyCode is valid\r\n\t\t\t\t\t// non-control character\r\n\t\t\t\t\tvalid;\r\n\r\n\t\t\t\t// first element should be the modifiers\r\n\t\t\t\tif(event.shiftKey) arr.push(\"shiftKey\");\r\n\t\t\t\telse if(event.ctrlKey) arr.push(\"ctrlKey\");\r\n\t\t\t\telse if(event.altKey) arr.push(\"altKey\");\r\n\t\t\t\telse if(event.metaKey) arr.push(\"metaKey\");\r\n\r\n\t\t\t\t// below code from\r\n\t\t\t\t// http://stackoverflow.com/questions/12467240/determine-if-javascript-e-keycode-is-a-printable-non-control-character\r\n\t\t\t\t// http://stackoverflow.com/users/1585400/shmiddty\r\n\r\n\t\t\t\t// determine if key is non-control key\r\n\t\t\t\tvalid =\r\n\t\t\t\t\t(keycode > 47 && keycode < 58) || // number keys\r\n\t\t\t\t\tkeycode == 32 || keycode == 13 || // spacebar & return key(s)\r\n\t\t\t\t\t(keycode > 64 && keycode < 91) || // letter keys\r\n\t\t\t\t\t(keycode > 95 && keycode < 112) || // numpad keys\r\n\t\t\t\t\t(keycode > 185 && keycode < 193) || // ;=,-./` (in order)\r\n\t\t\t\t\t(keycode > 218 && keycode < 223); // [\\]' (in order)\r\n\r\n\t\t\t\tif(valid)\r\n\t\t\t\t\t// then push the key also\r\n\t\t\t\t\tarr.push(keycode);\r\n\r\n\t\t\t\treturn valid ? arr : null;\r\n\t\t\t}", "function getKeys(key) {\r\n var keys;\r\n key = key.replace(/\\s/g, '');\r\n keys = key.split(',');\r\n if ((keys[keys.length - 1]) == '') {\r\n keys[keys.length - 2] += ',';\r\n }\r\n return keys;\r\n }", "keys() {\n return this.values();\n }", "get keys() {\n return Object.keys(this._keyMap);\n }", "function getKeys(compositeKey) {\n if (typeof compositeKey === 'string') {\n // else assume string and split around dots\n var keyList = keyMap[compositeKey];\n if (!keyList) {\n keyList = compositeKey.split('.');\n keyMap[compositeKey] = keyList;\n }\n return keyList;\n }\n // Wrap in array if needed\n return Array.isArray(compositeKey) ? compositeKey : [compositeKey];\n}", "function keyParser(key) {\n var valList = [];\n tableData.forEach(function(x) {\n var currentVal = x[key];\n if(!(valList.includes(currentVal))) {\n valList.push(currentVal);\n };\n });\n // Sort values in alpha order for easier usability\n valList.sort();\n dropdownDict[key] = valList;\n}", "getKeys() {\n return [...this.keys];\n }", "function selectedValues(obj) {\n var keysWithTrueValue = [];\n for (var key in obj) {\n if (obj[key]) {\n keysWithTrueValue.push(key);\n }\n }\n return keysWithTrueValue;\n}", "getKeys() {\n this._ensureUnpacked();\n if (this.unpackedArray) {\n return Array.from(this.unpackedArray.keys());\n } else if (this.unpackedAssocArray) {\n this._ensureAssocKeys();\n return Array.from(this.unpackedAssocKeys);\n }\n return [];\n }", "function queryParamsKeys() {\n const params = [];\n urlBase.searchParams.forEach((_value, key) => {\n params.push(key);\n });\n\n return params;\n }", "getAllDataAttrKeys() {\n\t\treturn Object.keys(this.attributesObject).filter(field => field.startsWith('data-attr'));\n\t}", "function getKeys(key) {\n var keys;\n key = key.replace(/\\s/g, '');\n keys = key.split(',');\n if ((keys[keys.length - 1]) == '') {\n keys[keys.length - 2] += ',';\n }\n return keys;\n }", "function getKeys(key) {\n var keys;\n key = key.replace(/\\s/g, '');\n keys = key.split(',');\n if ((keys[keys.length - 1]) == '') {\n keys[keys.length - 2] += ',';\n }\n return keys;\n }", "function getKeys(key) {\n var keys;\n key = key.replace(/\\s/g, '');\n keys = key.split(',');\n if ((keys[keys.length - 1]) == '') {\n keys[keys.length - 2] += ',';\n }\n return keys;\n }", "function getKeys(key) {\n var keys;\n key = key.replace(/\\s/g, '');\n keys = key.split(',');\n if ((keys[keys.length - 1]) == '') {\n keys[keys.length - 2] += ',';\n }\n return keys;\n }", "function getKeys(key) {\n var keys;\n key = key.replace(/\\s/g, '');\n keys = key.split(',');\n if ((keys[keys.length - 1]) == '') {\n keys[keys.length - 2] += ',';\n }\n return keys;\n }", "function et2_arrayKeys(_arr)\n{\n\tvar result = [];\n\tfor (var key in _arr)\n\t{\n\t\tresult.push(key);\n\t}\n\n\treturn result;\n}", "getKeys(obj){\n var keys = [];\n for(var key in obj) keys.push(key);\n return keys;\n }", "getAll(filter) {\n\t\t// this flattens the hash into an array\n\t\tlet result = _.map(this._cache);\n\n\t\tif (typeof filter === 'object') {\n\t\t\tresult = _.where(result, filter);\n\t\t}\n\n\t\treturn result;\n\t}", "function queryParamsKeys() {\n const params = [];\n urlBase.searchParams.forEach((_value, key) => {\n params.push(key);\n });\n\n return params;\n }", "addExistingKeys() {\n const items = [];\n const inputKeys = this.props.uiState.fieldsKvString.split(' ');\n inputKeys.forEach((item) => {\n if (item.includes('=')) {\n items.push(item.substring(0, item.indexOf('=')));\n }\n });\n this.setState({existingKeys: items});\n }", "function getUsedKeys(filter) {\n if (!filter) {\n return [];\n }\n const usedKeys = [];\n if (filter.$and) {\n for (const subfilter of filter.$and) {\n for (const key of getUsedKeys(subfilter)) {\n if (!usedKeys.includes(key)) {\n usedKeys.push(key);\n }\n }\n }\n } else if (filter.$or) {\n for (const subfilter of filter.$or) {\n for (const key of getUsedKeys(subfilter)) {\n if (!usedKeys.includes(key)) {\n usedKeys.push(key);\n }\n }\n }\n } else if (filter.yg) {\n // Single filter grouped in brackets\n usedKeys.push(...getUsedKeys(filter.yg));\n } else {\n usedKeys.push(...Object.keys(filter));\n }\n\n return usedKeys;\n}", "function KeyValueToArray(List) {\r\n var array = [];\r\n angular.forEach(List, function (V, K) {\r\n if (K.indexOf('$') >= 0)\r\n { }\r\n else {\r\n array.push({ id: K, name: V })\r\n }\r\n })\r\n\r\n return array;\r\n}", "keys()\n\t{\n\t\tvar it = super.keys();\n\t\tvar res = new Runtime.Collection();\n\t\tvar next = it.next();\n\t\twhile (!next.done)\n\t\t{\n\t\t\tres.push( next.value );\n\t\t\tnext = it.next();\n\t\t}\n\t\treturn res;\n\t}", "values(){\n return Object.keys(this.items);\n\n /*\n var result;\n for (var key in this.items){\n if (this.items.hasOwnProperty(key)){\n result.push(key);\n }\n }\n return result;\n */\n }", "function allKeys(obj) {\n if (isArray(obj)) {\n return ownKeys(obj);\n } else {\n var result = [];\n for (var k in obj) {\n if (canEnumPub(obj, k)) {\n result.push(k);\n }\n }\n if (obj !== void 0 && obj !== null && obj.handleEnum___) {\n result = result.concat(obj.handleEnum___(false));\n }\n return result;\n }\n }", "function getAvailableCyrillicChars()\r\n{\r\n\tvar list = new Array();\r\n\tvar a = '';\r\n\tfor (var item in Object.keys(chars)) {\r\n\t\tif (Object.keys(chars).hasOwnProperty(item)){\r\n\t\t\ta = Object.keys(chars)[item];\r\n\t\t}\r\n\t\t\r\n\t \tlist.push(chars[a].lower);\r\n\t \t\r\n\t \tif (chars[a].upper!==undefined) list.push(chars[a].upper);\r\n\t}\r\n\r\n\treturn list;\r\n}", "get keys() {\n return Object.keys(this.raw());\n }", "function getSpellCheckArray() {\r\n\tvar fieldsToCheck=new Array();\r\n\t\r\n\tfieldsToCheck[0]=[document,\"bio\"];\r\n\tfieldsToCheck[1]=[document,\"careerPlans\"];\r\n\tfieldsToCheck[2]=[document,\"shortAnswer\"];\r\n\t\r\n\treturn fieldsToCheck;\r\n}", "function namedParamsKeys() {\n const allNamedParamsKeys = namedParamsWithIndex();\n\n return allNamedParamsKeys.reduce((values, paramKey) => {\n values.push(paramKey.value);\n return values;\n }, []);\n }", "function keyAndTimeSignature() {\n\n var timeSignature = document.getElementsByTagName('option');\n\n //zero out the array\n var keyAndTimeSig = [];\n \n for (var i = 0; i < timeSignature.length; i++) {\n\n // create an array for the time signature\n if (timeSignature[i].selected == true) {\n\n var keyAndTimeSigAdd =[timeSignature[i].value];\n Array.prototype.push.apply(keyAndTimeSig, keyAndTimeSigAdd); \n }\n }\n console.log(\"key\", keyAndTimeSig);\n return keyAndTimeSig;\n}", "function getPotentialWildcardMatches ( keypath ) {\n\t \tvar keys, starMap, mapper, i, result, wildcardKeypath;\n\n\t \tkeys = splitKeypathI( keypath );\n\t \tif( !( starMap = starMaps[ keys.length ]) ) {\n\t \t\tstarMap = getStarMap( keys.length );\n\t \t}\n\n\t \tresult = [];\n\n\t \tmapper = function ( star, i ) {\n\t \t\treturn star ? '*' : keys[i];\n\t \t};\n\n\t \ti = starMap.length;\n\t \twhile ( i-- ) {\n\t \t\twildcardKeypath = starMap[i].map( mapper ).join( '.' );\n\n\t \t\tif ( !result.hasOwnProperty( wildcardKeypath ) ) {\n\t \t\t\tresult.push( wildcardKeypath );\n\t \t\t\tresult[ wildcardKeypath ] = true;\n\t \t\t}\n\t \t}\n\n\t \treturn result;\n\t }", "function construyeFiltros(){\n let x = [];\n\n for(var i in _data){\n x.push(_data[i]);\n }\n return x;\n}", "schemafy(keys, schema) {\n return keys\n .concat(schema.required || [])\n .filter(key => this.isNotHidden(key, schema) || this.appGlobalsService.adminMode)\n .concat(schema.alwaysShow || [])\n .sort((a, b) => this.compareKeysBySchemaService.compare(a, b, schema))\n .toOrderedSet();\n }", "getToGenerateArray() {\n const self = this;\n let\n iterator, next,\n items = [];\n\n // go over each item in toGenerate\n iterator = self.toGenerate.keys();\n next = iterator.next();\n\n while ( !next.done ) {\n items.push( self.toGenerate.get( next.value ) );\n next = iterator.next();\n }\n\n return items;\n }", "values() {\n const result = [];\n for (let i = 0; i < this.map.length; i += 1) {\n if (this.map[i] !== undefined) {\n for (let j = 0; j < this.map[i].length; j += 1) {\n const value = this.map[i][j][1];\n if (!result.includes(value)) {\n result.push(value);\n }\n }\n }\n }\n\n return result;\n }", "function keys () {\n var result = [];\n\n window.document.cookie.split(/; /).each(function (cookie) {\n cookie = cookie.split(/=/);\n\n result.push(cookie[0]);\n });\n\n return result.uniq();\n }", "function isKeyAllowed(key , lists){\n\t\tvar status = false;\n\t\tfor(var i=0 ; i < lists.length ;i++){\n\t\t\tif(lists[i].indexOf(key) > -1){\n\t\t\t\tstatus = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn status;\n\t}", "function unique(input, key) {\n var unique = {};\n var uniqueList = [];\n for (var i = 0; i < input.length; i++) {\n if (typeof unique[input[i][key]] === 'undefined') {\n unique[input[i][key]] = '';\n uniqueList.push(input[i]);\n }\n }\n return uniqueList;\n }", "ownKeys(trapTarget) {\n return Reflect.ownKeys(trapTarget).filter( key => (key !== 'array' && key !== 'length' && key !== 'checkValidIndex'))\n }", "async keys () {\n const results = await this.client.zRange(this.ZSET_KEY, 0, -1);\n return results.map(key => key.slice(`${this.namespace}`.length));\n }", "keys (includeExpired) {\n // create list to return\n var ret = []\n\n // iterate over storage keys to find all non-expiration keys\n var that = this\n this._iterKeys(function (storageKey) {\n // if its not a timestamp key, skip it\n if (storageKey.indexOf(that._expiration_key_prefix) !== 0) {\n // add to return list, but only if including expired keys or if not expired yet\n if (includeExpired || !that.isExpired(storageKey)) {\n ret.push(storageKey)\n }\n }\n })\n\n // return keys\n return ret\n }", "get possibleChoices() {\n return Array.from(this.choices.keys())\n }", "allSelectedUniqueItemResources(selectedUniqueItems) {\n let resArray = [];\n for (let catName of Object.keys(selectedUniqueItems)) {\n\t for (let displayStr of Object.keys(selectedUniqueItems[catName])) {\n\t resArray = resArray.concat(selectedUniqueItems[catName][displayStr])\n\t }\n }\n\n return resArray;\n }", "function namedParamsKeys() {\n const allNamedParamsKeys = namedParamsWithIndex();\n\n return allNamedParamsKeys.reduce((values, paramKey) => {\n values.push(paramKey.value);\n return values;\n }, []);\n }", "getKeys() {\n this.logger.trace(\"Retrieving all cache keys\");\n // read cache\n const cache = this.getCache();\n return [...Object.keys(cache)];\n }", "find(key) {\n let result = [];\n let keyArray = key.split('');\n // here I would use a forEach loop, but having bigger callstack costs you, also forEach may be slower in general\n const wordsLen = words.length;\n for (let i = 0; i < wordsLen; i++) {\n const word = words[i];\n if (containsKey(word, keyArray)) {\n result.push(word.join(''));\n }\n }\n return result;\n }", "function allKeyMaps(cm) {\r\n var maps = cm.state.keyMaps.slice(0);\r\n if (cm.options.extraKeys) maps.push(cm.options.extraKeys);\r\n maps.push(cm.options.keyMap);\r\n return maps;\r\n }" ]
[ "0.68787193", "0.6815506", "0.67043084", "0.66145074", "0.6563455", "0.6413596", "0.6384232", "0.6379176", "0.6245468", "0.62219363", "0.6123341", "0.61029136", "0.6098591", "0.60450935", "0.6000911", "0.599229", "0.5978049", "0.595493", "0.5954633", "0.5945082", "0.59410894", "0.58904994", "0.588788", "0.58684725", "0.58684725", "0.58566976", "0.5847813", "0.5842501", "0.58322746", "0.58322746", "0.58322746", "0.58322746", "0.58322746", "0.5826802", "0.58223724", "0.58221537", "0.5812531", "0.58000094", "0.57913375", "0.5783407", "0.57527816", "0.57501906", "0.57501906", "0.57501906", "0.57501906", "0.57501906", "0.57237464", "0.57179725", "0.571131", "0.5678645", "0.5677773", "0.5677773", "0.5674624", "0.5652519", "0.56467843", "0.5641851", "0.5641232", "0.56379455", "0.56121945", "0.5605338", "0.56050986", "0.55801463", "0.5562154", "0.5558501", "0.5558501", "0.5558501", "0.5558501", "0.5555686", "0.5548592", "0.5542454", "0.5535454", "0.55218023", "0.5504783", "0.5504707", "0.5501791", "0.54980606", "0.54914474", "0.5487699", "0.5485318", "0.54841495", "0.54779553", "0.5476581", "0.5476199", "0.5474101", "0.5469528", "0.54631525", "0.54507214", "0.54492456", "0.5448861", "0.54392", "0.5437921", "0.54371905", "0.543552", "0.5434104", "0.5432551", "0.5428508", "0.54170156", "0.5410879", "0.54097027", "0.5405282" ]
0.57746065
40
get an array of keys when a valid answer is supply answerChar are assure by gameBoard to always supply the correct answer and give response to bad answer
getAnswerIndex(answerChar) { var tempText = this.text; var result = []; while(tempText.includes(answerChar)) { var foundIndex = tempText.indexOf(answerChar); result.push(foundIndex); tempText = tempText.replace(answerChar,"*"); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processChoice(key, answer, valid) {\n if (valid.indexOf(key) > -1) {\n validPicked.push(key);\n lettersPicked.push(key);\n lettersRemaining = (answerKey.length - validPicked.length) \n rebuildBoard(validPicked);\n } else {\n document.getElementById(\"lettersPicked\").textContent += \" \" + key;\n lettersPicked.push(key);\n guessesRemaining--;\n document.getElementById(\"guessesRemaining\").textContent = guessesRemaining;\n\n }\n checkForGameOver(guessesRemaining, lettersRemaining);\n}", "function checkInput() {\n drawMan();\n //console.log(\"this is the\" + underscoreArray);\n if(remainingGuesses > 0)\n { \n if(event.which < 65 || event.which > 90)\n {\n alert(\"Please guess a letter!!!\");\n return;\n } \n else if(event.which >= 65 && event.which <= 90)\n {\n letters.push(event.key);\n $(\"#guessedLetters\").append(event.key + \", \");\n }\n\n for(let i = 0; i < wordSplit.length; i++)\n {\n if(event.key === wordSplit[i])\n {\n underscoreArray[i] = event.key;\n underscoreArray[i] = underscoreArray[i].toLowerCase(); \n document.getElementById(\"underscores\").innerHTML = underscoreArray.join(\"\");\n ifYouWin(); \n }\n \n }\n if(!wordSplit.includes(event.key))\n {\n remainingGuesses--;\n ifYouLose();\n }\n $(\"#remaining\").html(remainingGuesses);\n }\n}", "function checkKey(key) {\n // enter\n if (key.keyCode == \"13\" && numberOfEnterPresses === 1) {\n // var numberOfEnterPresses is needed beecause if u press enter during game u will skip quiz questions so it disables this eventListener during questions\n numberOfEnterPresses++;\n fetchApi();\n }\n // A\n else if (key.keyCode == \"65\") {\n randomOptions(options[0]);\n }\n // B\n else if (key.keyCode == \"66\") {\n randomOptions(options[1]);\n }\n // C\n else if (key.keyCode == \"67\") {\n randomOptions(options[2]);\n }\n // D\n else if (key.keyCode == \"68\") {\n randomOptions(options[3]);\n } else if (key.keyCode == \"83\") {\n if (sPressed === 0) {\n skipQuestion();\n sPressed++;\n } else {\n return;\n }\n }\n}", "unlocked(){return hasChallenge(\"燃料\",11)}", "unlocked(){return hasChallenge(\"燃料\",11)}", "gameOver() {\n const {matchedKeys, letter, error} = this.state;\n let goodLetters = 0;\n letter.forEach((element) => {\n if (matchedKeys.includes(element)) goodLetters++;\n });\n if (goodLetters === letter.length) return 'won';\n if (error >= 10) return 'loose';\n else return 'playing';\n }", "function askLetters() {\n\n\n inquirer.prompt([\n {\n type: \"input\",\n name: \"userInputGuess\",\n message: \"What letter do you guess???\"\n }\n ]).then(function (UserData) {\n\n\n // Passing in the user input as a parameter for the Word updateLetter Function to check if it's wrong or right\n wordConstructed.updateLetter(UserData.userInputGuess);\n\n // running display to switch whatever was guessed each time\n console.log(wordConstructed.display());\n\n // Guessed Wrong when the array length is not empty\n if (wordConstructed.wrongLetters.length > 0) {\n\n // logging the array of wrong letters\n console.log(\"wrong letters: \" + wordConstructed.wrongLetters);\n console.log(\" \");\n // logging the remainning guesses\n console.log(\"Remaining Guesses: \" + (7 - wordConstructed.wrongLetters.length));\n }\n\n // If the wrong letters array reaches 7 that means the 7 guesses are finish so the game is over\n if (wordConstructed.wrongLetters.length === 7) {\n\n console.log(\"You lost - the correct word was \" + wordUsedForGame + \".\");\n\n\n // If the wrong letters array reaches is less than 7 and the dashes in the word are still there we keep asking the letters\n } else if (wordConstructed.wrongLetters.length < 7 && wordConstructed.display().indexOf(\"_\") != -1) {\n askLetters();\n // If the dashes are finished in the word that means the user guessed all letters So Winnn!!\n } else if (wordConstructed.display().indexOf(\"_\") === -1){\n console.log(\"Great Job!!!! You Rock\");\n }\n });\n\n\n}", "function checkKeys() {\n // Look at each key\n for (var i = 0; i < keyArray.length; i++) {\n // Check for collision\n if (blockCollision(playerRect, keyArray[i])) {\n // Pick up the key\n if(keyArray[i].visible) {\n keyArray[i].visible = false;\n keyPickedUp += 1;\n }\n\n // Check if all the keys are collected\n if(keyPickedUp == keyArray.length && keyArray.length != 0) {\n goalRect.colour = color(255);\n keysCollected = true;\n }\n }\n }\n}", "function getPassCharacters() {\n var passParameter = [];\n\n passParameter.push(confirm(\"Would you like to use uppercase chracters?\"));\n passParameter.push(confirm(\"Would you like to use lowercase chracters?\"));\n passParameter.push(confirm(\"Would you like to include numbers?\"));\n passParameter.push(confirm(\"Would you like to use special characters?\"));\n\n //Prompt user to try again if a case sensitive or special character is not selected\n if (!passParameter.includes(true)) {\n alert(\"Please choose at least one special character or Uppercase character\");\n passParameter = getPassCharacters\n }\n return passParameter;\n}", "function keyboardHandler(evt){\r\n\r\n\tconsole.log(evt.keyCode);\r\n\t\r\n\tif (keyObj.keyCheck===1){\r\n\r\n\t\tvar check=0;\r\n\t\tvar endTime = new Date().getTime();\r\n\r\n\t\tswitch (evt.keyCode){\r\n\t\t\tcase 49: //1\r\n\t\t\t\tcheck=1;\r\n\t\t\t\tupdateResult(1,checkAnswerCorrect(1),endTime-stimuliCurrentInfo.startTime);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 50: //2\r\n\t\t\t\tcheck=1;\r\n\t\t\t\tupdateResult(2,checkAnswerCorrect(2),endTime-stimuliCurrentInfo.startTime);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 51: //3\r\n\t\t\t\tcheck=1;\r\n\t\t\t\tupdateResult(3,checkAnswerCorrect(3),endTime-stimuliCurrentInfo.startTime);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 52: //4\r\n\t\t\t\tcheck=1;\r\n\t\t\t\tupdateResult(4,checkAnswerCorrect(4),endTime-stimuliCurrentInfo.startTime);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 53: //5\r\n\t\t\t\tcheck=1;\r\n\t\t\t\tupdateResult(5,checkAnswerCorrect(5),endTime-stimuliCurrentInfo.startTime);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 54: //6\r\n\t\t\t\tcheck=1;\r\n\t\t\t\tupdateResult(6,checkAnswerCorrect(6),endTime-stimuliCurrentInfo.startTime);\r\n\t\t\t\tbreak;\r\n\t\t\tcase 55: //7\r\n\t\t\t\tif (stimuliCurrentInfo.seriesLetter==\"A\" || stimuliCurrentInfo.seriesLetter==\"B\"){\r\n\t\t\t\t\tdisplayKeyError();\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tcheck=1;\r\n\t\t\t\t\tupdateResult(7,checkAnswerCorrect(7),endTime-stimuliCurrentInfo.startTime);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase 56: //8\r\n\t\t\t\tif (stimuliCurrentInfo.seriesLetter==\"A\" || stimuliCurrentInfo.seriesLetter==\"B\"){\r\n\t\t\t\t\tdisplayKeyError();\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\tcheck=1;\r\n\t\t\t\t\tupdateResult(8,checkAnswerCorrect(8),endTime-stimuliCurrentInfo.startTime);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault: //other key\r\n\t\t\t\tdisplayKeyError();\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tif (check===1){\r\n\t\t\tcheck=0;\r\n\t\t\tstimuliCurrentInfo.taskNumber+=2;\r\n\t\t\tstimuliCurrentInfo.seriesNumber+=2;\r\n\t\t\tcheckSeries();\r\n\r\n\t\t\tif (stimuliCurrentInfo.taskNumber>=60){\r\n\t\t\t\tkeyObj.keyCheck=0;\r\n\t\t\t\tshowExitPage();\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tdisplayTask();\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\t\r\n\r\n}", "function populateAnswerKey() {\n // order array get shuffled.\n // Index of value 0 is where correct answer will populate on page.\n shuffle(questionOrder);\n // console.log(questionOrder);\n answerKey[questionCount] = questionOrder.indexOf(0);\n // console.log(answerKey);\n}", "function gameStart() {\n\n // Create an array of incorrect guesses\n failGuess = [];\n // Create an array of incorrect guesses\n goodGuess = [];\n // Create Variable for number of guesses\n numGuess = 7;\n\n guitarist = guitarists[Math.floor(Math.random() * guitarists.length)];\n // Display underscores and clear message\n displayAnswer(guitarist);\n displayMessage(\"\");\n displayGuessesLeft();\n\n // Get user input\n document.onkeyup = function(event) {\n var userInput = event.key.toLowerCase();\n // console.log(userInput);\n // Test if letter already used\n if (alreadyChosen(userInput)) {\n var message = \"You have already chosen that letter, try again\";\n displayMessage(message);\n } else { // continue with game\n var message = \"\";\n displayMessage(message);\n // Compare user input to guitarist\n if (compareInputToGuitarist(userInput)) {\n displayAnswer(guitarist);\n } else {\n displayUsedLetters();\n displayGuessesLeft();\n }\n } // end ALREADYchosen\n\n //Test win or lose?\n if (testWin()) {\n return true;\n }\n } //end keyup\n} // end game", "function checkInputs(arr, thisButton, answer){\n var counter = 0;\n\n //wildChar shows one other specific Character that the string should have, like . or =\n\n for(var i=0; i< arr.length; i++){\n /*http://stackoverflow.com/questions/17938186/trimming-whitespace-from-the-end-of-a-string-only-with-jquery*/\n var trimmedAns= $(arr[i][0]).val().replace(/\\s*$/,\"\");\n var wrongPhrase = '';\n var falsePos = '';\n\n //check if it contains all key phrases\n for(var j=0; j < arr[i][1].length; j++){\n var activeChar= arr[i][1][j];\n if(trimmedAns.indexOf(activeChar) == -1){\n wrongPhrase = activeChar;\n break;\n }\n }\n\n // this is for the Characters we don't want to see in there\n for(var l=0; l < arr[i][2].length; l++){\n var activeChar= arr[i][2][l];\n if(trimmedAns.indexOf(activeChar) > -1)\n falsePos = activeChar;\n }\n\n // make sure we save original err msg\n var origMsg= $(thisButton).siblings('.warn').text();\n\n // if it has both correct property name and value, and semi and colon are in there\n if(falsePos.length ==0 && wrongPhrase.length ==0)\n counter++\n else if(wrongPhrase.length > 1 && wrongCount == 0){\n $(thisButton).siblings('.warn').text('Did you spell everything correctly in answer '+(i+1)+'? Attempts Remaining: ' +(5-wrongCount)).show('slide');\n $(arr[i][0]).effect('highlight');\n wrongCount++;\n }\n else if(wrongPhrase.length > 1 && wrongCount > 0){\n $(thisButton).siblings('.warn').text('I think you are missing ' + wrongPhrase + ' in answer ' +(i+1)+ '. Attempts Remaining: ' +(5-wrongCount) ).show('slide');\n $(arr[i][0]).effect('highlight');\n wrongCount++;\n }\n else if(wrongPhrase.length == 1 && wrongCount == 0){\n $(thisButton).siblings('.warn').text('Did you remember all the correct syntax? Attempts Remaining: ' +(5-wrongCount)).show('slide');\n $(arr[i][0]).effect('highlight');\n wrongCount++;\n }\n else if(wrongPhrase.length == 1 && wrongCount > 0){\n $(thisButton).siblings('.warn').text('I think you forgot to include '+wrongPhrase + ' in answer ' +(i+1) + '. Attempts Remaining: ' +(5-wrongCount)).show('slide');\n $(arr[i][0]).effect('highlight');\n wrongCount++;\n }\n else if(falsePos.length > 0 && wrongCount == 0){\n $(thisButton).siblings('.warn').text('You included a character that should not be in there in answer ' +(i+1)+'! Attempts Remaining: ' +(5-wrongCount)).show('slide');\n $(arr[i][0]).effect('highlight');\n wrongCount++;\n }\n else if(falsePos.length > 0 && wrongCount > 0){\n $(thisButton).siblings('.warn').text('You included ' +falsePos+ ' in answer '+(i+1)+', which should not be in there. Attempts Remaining: ' +(5-wrongCount) ).show('slide');\n $(arr[i][0]).effect('highlight');\n wrongCount++;\n }\n //this case should never happen but fuck it I am leaving it in there\n else{\n $(thisButton).siblings('.warn').text(origMsg).show('slide');\n $(arr[i][0]).effect('highlight');\n wrongCount++;\n }\n\n //user has gotten it wrong three times or more\n if (wrongCount > 5){\n //put it in a span so the answer looks distinct\n if(answer.length == 1)\n $(thisButton).siblings('.warn').html(\"The answer is- <span>\"+answer[0]+\"</span>\").show('slide');\n else{\n $(thisButton).siblings('.warn').html(\"The answer is- <span>\"+answer[0]+\"</span><span>\"+answer[1]+\"</span>\").show('slide');\n }\n }\n }\n\n if(counter === arr.length){\n wrongCount=0;\n $(thisButton).siblings('.warn').hide()\n\n // enable continue button\n $('.advanceBtn:visible').css('pointer-events', 'auto');\n $('.advanceBtn:visible').css('background-color', 'green');\n $('.advanceBtn:visible').css('opacity', '1');\n\n // this needs to be outside the function below due to setTimeout\n //http://stackoverflow.com/questions/5226285/settimeout-in-for-loop-does-not-print-consecutive-values\n function setTheFields(i){\n var startTime = 2000 * i\n var endTime= 2000 * (i+1);\n setTimeout(function(){\n $('.interactme:visible').find('.userIn').eq(i).parent().siblings('.codeExp').css('opacity', '0')\n $('.interactme:visible').find('.userIn').eq(i).children('span').first().trigger('mouseover')\n }, startTime)\n setTimeout(function(){\n $('.interactme:visible').find('.userIn').eq(i).parents().eq(1).trigger('mouseleave')\n $('.interactme:visible').find('.userIn').eq(i).parent().siblings('.codeExp').css('opacity', '1')\n }, endTime)\n }\n\n // do all animations with delay in between\n for(var i=0; i< arr.length; i++){\n setTheFields(i);\n }\n\n }\n}", "function checkLetters(userkey) {\n\n\t//See if the userkey exists in the wrong guesses array\n\tvar letterExist = false;\n\n\tfor (var i = 0; i < wrongGuesses.length; i++) {\n\n\t\tif(userkey === wrongGuesses[i]){\n\n\t\t\tletterExist = true;\n\n\t\t};\n\n\t};\n\n\tif (letterExist === false) {\n\n\t\tvar flag = false;\n\n\t\tfor (var i = 0; i < numBlanks; i++) {\n\t \t\n\t \t\tif(randomWord[i] === userkey) {\n\t \t\t\tflag = true;\n\t \t\t}\n\t \t}\n\n\n\t\t// If the letter exists somewhere in the word, then figure out exactly where (which indices).\n\t\tif (flag) {\n\n\t\t // Loop through the word.\n\t\t for (var i = 0; i < numBlanks; i++) {\n\n\t\t //If the first letter equals the user's input, make it capitalized\n\t\t\t\tif (randomWord[0] === userkey) {\n\n\t\t\t\t\tlettersInWord[0] = userkey.toUpperCase();;\n\n\t\t\t\t} \n\n\t\t\t\t//Else set the specific space in blanks and letter equal to the letter when there is a match.\n\t\t\t\telse if(randomWord[i] === userkey) {\n\n\t\t\t\t\tlettersInWord[i] = userkey\n\n\t\t\t\t};\n\t\t }\n\t\t}\n\n\t\t // If the letter doesn't exist at all...\n\t\telse {\n\n\t\t // ..then we add the letter to the list of wrong letters, and we subtract one of the guesses.\n\t\t\twrongGuesses.push(userkey);\n\n\t\t // numGuesses--;\n\t\t turns--;\n\t\t \n\t \t\tdocument.getElementById(\"turns\").innerHTML = turns;\n\t \n \t\t}\t\n\n\t roundComplete();\n\t}\n}", "function validateKey(keystroke)\n{\n\tif (correctLetters.includes(letterGuessed) || wrongLetters.includes(letterGuessed))\n\t{\n\t\tvalid = false;\n\t}\n\telse\n\t{\n\t\tvalid = true;\n\t}\n}", "function askType(){\n for(i = 0; i<characterType.length; i++){\n responseHolder[i] = confirm(\"Would you like to include \" + characterType[i]+ \" in your password?\")\n }\n }", "getAnswerKey() {\n var result = [];\n (this.text).split(\"\").forEach(function(element){\n if(!(result.includes(element))) {\n result.push(element.toLowerCase());\n }\n })\n return result;\n }", "checkSelected(keys){\n const selected = this.props.selected;\n const correct = this.props.correct;\n if(selected != null) {\n \n if(selected.indexOf(keys) >= 0 && correct.indexOf(keys) >= 0) {\n return \"key chosen\";\n } else if (selected.indexOf(keys) >= 0 && correct.indexOf(keys) <= 0) {\n return \"key wrong\";\n } else {\n return \"key\";\n }\n }\n }", "function checkGuessedLetters() {\n //This is checking that if users guess is in alailableLetters\n if(availableLetters.indexOf(this.event.key) > -1) {\n //Looping through guessed letters for the length of word\n for(var i = 0; i < word.length; i++) {\n //If the users guess has already been guessed then we will set guessed to true\n if(this.event.key === guessedLetters[i]) {\n guessed = true;\n }\n }\n }\n}", "handleInteraction(key) {\n $key.eq(key).prop('disabled', true);\n if (gamePhrase.checkLetter(key) === 0) {\n $key.eq(key).addClass('wrong');\n game.removeLife();\n } else {\n $key.eq(key).addClass('chosen');\n if (this.checkForWin()) {\n this.gameOver();\n }\n }\n }", "function $gameplay () { \n var $string = \"\";\n for (i = 1; i <= $currentNickname.length; i++){ \n $string = $string + \"_\";\n $(\"#blank-answer\").text($string); \n }\n var keysGuessed = \"\";\n if ($string !== $currentNickname && $guesses <= 10){\n $(document).keypress(function(event){\n var letterPressed = event.key;\n var lowerCasedArray = $currentNickname.split('').map(function(char){\n return char.toLowerCase();\n });\n var indexValue = lowerCasedArray.indexOf(letterPressed);\n \n if (indexValue >= 0){\n var newAnswers = $(\"#blank-answer\").text().split('');\n newAnswers[indexValue] = $currentNickname[indexValue];\n console.log(newAnswers);\n\n $(\"#blank-answer\").text(newAnswers.join(''));\n }\n\n else {\n if(keysGuessed !== '') {\n keysGuessed += ', ' + letterPressed;\n }\n else {\n keysGuessed += letterPressed;\n }\n console.log(keysGuessed);\n $(\"#letters-used-area\").text(keysGuessed);\n } \n }) \n }\n}", "function keyPress(){\n\n\tguessedLetters[counter] = event.key.toUpperCase();\t\n\n\tvar correct = 0;\n\tfor(var i = 0; i < randomWord.length; i++){\n\t\tif(guessedLetters[counter] == randomWord.charAt(i)){\n\t\t\thiddenLetters[i] = guessedLetters[counter];\t\n\t\t\tcorrect++;\n\t\t\t}\n\t}\n\n\n\tif(isDuplicate() !== true && (guessedLetters[counter].charCodeAt(0) >= 65 && guessedLetters[counter].charCodeAt(0) <= 90 && guessedLetters[counter].length <= 1)){\n\t\tcounter++;\n\t\tdocument.getElementById(\"hangmanTextLower\").textContent = \"Guessed Letters: \" + guessedLetters;\n\n\t\trefresh();\n\t\tifWon();\n\t\tifLost(correct);\n\t}\n}", "handleInteraction(e) {\r\n if (prevGuesses.indexOf(e) === -1){\r\n let clickedLetter = (e)\r\n let buttons = document.getElementsByClassName('key')\r\n if(this.activePhrase.checkLetter(splitPhraseArray,clickedLetter)){\r\n for(let i = 0; i < buttons.length; i++){\r\n if(buttons[i].textContent === clickedLetter){\r\n buttons[i].disabled = true;\r\n buttons[i].classList.add('chosen')\r\n }\r\n }\r\n } else {\r\n for(let i = 0; i < buttons.length; i++){\r\n if(buttons[i].textContent === clickedLetter){\r\n buttons[i].disabled = true;\r\n buttons[i].classList.add('wrong')\r\n prevGuesses.push(clickedLetter);\r\n this.removeLife();\r\n }\r\n }\r\n }\r\n this.activePhrase.showMatchedLetter(clickedLetter)\r\n if(this.checkForWin()){\r\n this.gameOver()\r\n };\r\n }\r\n }", "function checkLetters(letter) {\n\n\tvar lettersInWord = false;\n\tvar letter = event.key;\n\n\t// Check if a letter exists insidethe array at all\n\tfor (var i = 0; i < underscores; i++) {\n\t\t\n\t\tif (word[i] === letter) {\n\t\t\tconsole.log('word[i] ' + word[i])\n\t\t\tlettersInWord = true;\n\t\t}\n\t}\n// If the letter exists in the word, find which index\n\tif (lettersInWord) {\n\t\t\n\t\tfor (var j = 0; j < underscores; j++) {\n\t\t//Populate the blanksAndSuccesses with every correct letter.\n\t\t\tif (word[j] === letter) {\n\t\t\t// This is where the specfic space in blanks is set and letter is equal to the letter when there is a match.\n\t\t\tblanksAndSuccesses[j] = letter;\n\t\t\t}\n\t\t}\t\n\t}\n\t\n\telse {\n\t\twrongLetter.push(letter);\n\t\tguesses--;\n\t}\n}", "function cheats(key) {\n\tvar mightMatchCode = 0; //counts possible solutions\n\tvar keyBuffer = \"\";\n\t\n\t// Turn inputs to lowercase and special case buttons to uppercase letters\n\tif(key.length === 1) {\n\t\tkeyBuffer = key.toLowerCase();\n\t} else if(key === \"ArrowUp\") {\n\t\tkeyBuffer = \"U\";\n\t} else if(key === \"ArrowDown\") {\n\t\tkeyBuffer = \"D\";\n\t} else if(key === \"ArrowLeft\") {\n\t\tkeyBuffer = \"L\";\n\t} else if(key === \"ArrowRight\") {\n\t\tkeyBuffer = \"R\";\n\t}\n\t\n\tif(keyBuffer != \"\") {\n\t\t//add the pressed key to the current buffer string\n\t\tcheatBuffer += keyBuffer;\n\t\t//run a check for each cheatcode in the array\n\t\tcheatList.forEach (function (val,index) {\n\n\t\t\t//Give points for each cheatCode in the array\n\t\t\tmightMatchCode++;\n\n\t\t\t//check if cheatbuffer string matches to an element\n\t\t\tfor (var i = 0; i < cheatBuffer.length++; i++) {\t\n\t\t\t\tif (cheatBuffer.charAt(i) == val.code.charAt(i)) {\n\t\t\t\t\t\n\t\t\t\t\t//If cheatcode fully matches\n\t\t\t\t\tif(cheatBuffer == val.code) {\n\t\t\t\t\t\t//is cheatcode enabled?\t\t\n\t\t\t\t\t\tif(val.active == true) {\n\t\t\t\t\t\t\tval.action();\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//remove point if string doesnt matched\n\t\t\t\t\tmightMatchCode--;\n\t\t\t\t\tbreak;\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t//Reset complete string if nothing has matched.\n\t\t//We keep the string in the cheatbuffer if we still have possible matches left.\n\t\tif (mightMatchCode == 0 && keyBuffer.length == 1 && keyBuffer != \" \" && cheatBuffer.length > 1) {\n\t\t\tcheatBuffer = \"\";\n\t\t\t//We run this to see if it was a single letter cheatCode\n\t\t\tcheats(keyBuffer);\n\t\t}\n\t}\n}", "function newGame(){\n i = 0, hits = 0, failures = 0\n questions = [\n { letter: \"a\", answer: \"abducir\", status: 0, question: \"CON LA A. Dicho de una supuesta criatura extraterrestre: Apoderarse de alguien\" },\n \n { letter: \"b\", answer: \"bingo\", status: 0, question: \"CON LA B. Juego que ha sacado de quicio a todos los 'Skylabers' en las sesiones de precurso\" },\n \n { letter: \"c\", answer: \"churumbel\", status: 0, question: \"CON LA C. Niño, crío, bebé\" },\n \n { letter: \"d\", answer: \"diarrea\", status: 0, question: \"CON LA D. Anormalidad en la función del aparato digestivo caracterizada por frecuentes evacuaciones y su consistencia líquida\" },\n \n { letter: \"e\", answer: \"ectoplasma\", status: 0, question: \"CON LA E. Gelatinoso y se encuentra debajo de la membrana plasmática. Los cazafantasmas medían su radiación\" },\n \n { letter: \"f\", answer: \"facil\", status: 0, question: \"CON LA F. Que no requiere gran esfuerzo, capacidad o dificultad\" },\n \n { letter: \"g\", answer: \"galaxia\", status: 0, question: \"CON LA G. Conjunto enorme de estrellas, polvo interestelar, gases y partículas\" },\n \n { letter: \"h\", answer: \"harakiri\", status: 0, question: \"CON LA H. Suicidio ritual japonés por desentrañamiento\" },\n \n { letter: \"i\", answer: \"iglesia\", status: 0, question: \"CON LA I. Templo cristiano\" },\n \n { letter: \"j\", answer: \"jabali\", status: 0, question: \"CON LA J. Variedad salvaje del cerdo que sale en la película 'El Rey León', de nombre Pumba\" },\n \n { letter: \"k\", answer: \"kamikaze\", status: 0, question: \"CON LA K. Persona que se juega la vida realizando una acción temeraria\" },\n \n { letter: \"l\", answer: \"licantropo\", status: 0, question: \"CON LA L. Hombre lobo\" },\n \n { letter: \"m\", answer: \"misantropo\", status: 0, question: \"CON LA M. Persona que huye del trato con otras personas o siente gran aversión hacia ellas\" },\n \n { letter: \"n\", answer: \"necedad\", status: 0, question: \"CON LA N. Demostración de poca inteligencia\" },\n \n { letter: \"ñ\", answer: \"señal\", status: 0, question: \"CONTIENE LA Ñ. Indicio que permite deducir algo de lo que no se tiene un conocimiento directo.\" },\n \n { letter: \"o\", answer: \"orco\", status: 0, question: \"CON LA O. Humanoide fantástico de apariencia terrible y bestial, piel de color verde creada por el escritor Tolkien\" },\n \n { letter: \"p\", answer: \"protoss\", status: 0, question: \"CON LA P. Raza ancestral tecnológicamente avanzada que se caracteriza por sus grandes poderes psíonicos del videojuego StarCraft\" },\n \n { letter: \"q\", answer: \"queso\", status: 0, question: \"CON LA Q. Producto obtenido por la maduración de la cuajada de la leche\" },\n \n { letter: \"r\", answer: \"raton\", status: 0, question: \"CON LA R. Roedor\" },\n \n { letter: \"s\", answer: \"stackoverflow\", status: 0, question: \"CON LA S. Comunidad salvadora de todo desarrollador informático\" },\n \n { letter: \"t\", answer: \"terminator\", status: 0, question: \"CON LA T. Película del director James Cameron que consolidó a Arnold Schwarzenegger como actor en 1984\" },\n \n { letter: \"u\", answer: \"unamuno\", status: 0, question: \"CON LA U. Escritor y filósofo español de la generación del 98 autor del libro 'Niebla' en 1914\" },\n \n { letter: \"v\", answer: \"vikingos\", status: 0, question: \"CON LA V. Nombre dado a los miembros de los pueblos nórdicos originarios de Escandinavia, famosos por sus incursiones y pillajes en Europa\" },\n \n { letter: \"w\", answer: \"sandwich\", status: 0, question: \"CONTIENE LA W. Emparedado hecho con dos rebanadas de pan entre las cuales se coloca jamón y queso\" },\n \n { letter: \"x\", answer: \"botox\", status: 0, question: \"CONTIENE LA X. Toxina bacteriana utilizada en cirujía estética\" },\n \n { letter: \"y\", answer: \"peyote\", status: 0, question: \"CONTIENE LA Y. Pequeño cáctus conocido por sus alcaloides psicoactivos utilizado de forma ritual y medicinal por indígenas americanos\" },\n \n { letter: \"z\", answer: \"zen\", status: 0, question: \"CON LA Z. Escuela de budismo que busca la experiencia de la sabiduría más allá del discurso racional\" },\n ];\n\n document.getElementById (\"newgame\").style.display = \"none\";\n document.getElementById(\"rank\").style.display = \"none\";\n document.getElementById(\"name\").style.display = \"block\";\n document.getElementById(\"timer\").innerHTML = \"\";\n\n document.getElementById(\"info\").innerHTML = \"¿Cual es tu nombre?\";\n\n for(var j = 0; j < questions.length; j++){\n document.getElementById(questions[j].letter).style.color = \"white\";\n }\n}", "function questions() {\n return {\n 1: {\n ques: \"Archipiélago conocido como 'Las afortunadas'.\",\n ans: \"ISLAS CANARIAS\",\n showAns: \"I**AS **N*R*AS\"\n },\n 2: {\n ques: \"¿Cómo se llama el satélite de planeta Tierra?\",\n ans: \"LUNA\",\n showAns: \"L**A\"\n },\n 3: {\n ques: \"¿Cuál es la capital de Arizona?\",\n ans: \"PHOENIX\",\n showAns: \"P**E**X\"\n },\n 4: {\n ques: \"Personajes que han salido en todas las pelicula de Star Wars:\",\n ans: \"R2-D2 y C-3PO\",\n showAns: \"R*-D* y C-**O\"\n },\n 5: {\n ques: \"¿De qué color es el caballo blanco de Santiago?\",\n ans: \"BLANCO\",\n showAns: \"B**N*O\"\n },\n 6: {\n ques: \"¿Cómo se llama el mejor de amigo de John Snow?\",\n ans: \"SAMWELL TARLY\",\n showAns: \"S**W**L T*RL*\"\n },\n 7: {\n ques: \"¿En qué año se firmó la declaración de independencia de EEUU?\",\n ans: \"1776\",\n showAns: \"1**6\"\n }\n };\n}", "function getWhatWasClicked (letter, possibleAnswers){\n\tvar ans = false;\n\tswitch (letter){\t\t\n\t\tcase \"a\":\n\t\t\tpossibleAnswers.a.isAnswer ? ans = true : ans = false;\t\t\t\n\t\t\tbreak;\n\t\tcase \"b\":\n\t\t\tpossibleAnswers.b.isAnswer ? ans = true : ans = false;\t\t\t\n\t\t\tbreak;\n\t\tcase \"c\":\n\t\t\tpossibleAnswers.c.isAnswer ? ans = true : ans = false;\t\t\t\n\t\t\tbreak;\n\t\tcase \"d\":\n\t\t\tpossibleAnswers.d.isAnswer ? ans = true : ans = false;\t\t\t\n\t\t\tbreak;\n\t}//switch\n\treturn ans;\n}//function getWhatWasClicked", "decodeAnswers(type, answers) {\n var correct = [];\n for (var i = 0; i < answers.length; i++) {\n if (type == \"multichoice\" || type == \"multichoiceset\") {\n correct.push(answers[i].toLowerCase().charCodeAt(0) - 97);\n }\n }\n return correct;\n }", "function EvaluateGuess(guess) {\n var GuessCorrect = false;\n\n for (var w = 0; w < EmptySlots; w++) { //checks to see if guessed letter is in word, sets to true if so\n if (SelectedSlang[w] == guess) {\n GuessCorrect = true;\n }\n }\n\n console.log(GuessCorrect);\n\n if (GuessCorrect) { \n for (var w =0; w < EmptySlots; w++) {\n if (SelectedSlang[w] == guess) { //checks to see which slots hold correct letter\n FilledAndEmpty[w] = guess;\n }\n }\n console.log(FilledAndEmpty);\n }\n\n else {\n WrongLetters.push(guess); //enters wrongly guessed letter into an array\n RemainingTrys--;\n\n console.log(RemainingTrys);\n \n }\n}", "function wordCheck(key) {\n\n // Push guessedLetter to wordCheckArray\n wordCheckArray.push(key.guessedLetter);\n }", "function checkLetter() {\n if (validKeys.indexOf(currentGuess) > -1) {\n if ((secretPhrase.indexOf(currentGuess) > -1)) {\n for (var i = 0; i < secretPhrase.length; i++) {\n if (phraseArray[i] === currentGuess) {\n blankArray[i] = currentGuess;\n spanSecretRandom.innerHTML = blankArray.join(\" \");\n }\n }\n } else {\n lettersGuessed.push(currentGuess);\n spanLettersGuessed.innerHTML = lettersGuessed.join(\" \");\n numGuesses--;\n numGuesses <= 0 ? spanNumGuesses.innerHTML = 0 : spanNumGuesses.innerHTML = numGuesses;\n }\n } else {\n alert(\"Please guess a valid letter\");\n }\n}", "function displayWrongKeys() {\n let wrongAttempts = document.querySelector(\"#wrongAttempts\");\n if (wrongAttempts != null) {\n while (wrongAttempts.firstChild) {\n wrongAttempts.removeChild(wrongAttempts.firstChild);\n }\n }\n for (let i = 0; i < wrongKeys.length; i++) {\n let characterFromArray = wrongKeys[i];\n let characterplace = document.createElement(\"p\");\n characterplace.innerText = characterFromArray + \", \";\n wrongAttempts.append(characterplace);\n }\n}", "function initGame(){\r\n if(Math.random()<0.5) //use random map:\r\n boardItemCosts=[0,0,KOEF_WORD2,0,0,0,KOEF_LETTER2,0,KOEF_LETTER2,0,0,0,KOEF_WORD2,0,0];\r\n else\r\n\tboardItemCosts=[KOEF_WORD3,0,0,KOEF_LETTER2,0,0,0,KOEF_WORD3,0,0,0,KOEF_LETTER2,0,0,KOEF_WORD3]; \r\n boardLength=boardItemCosts.length;\r\n for(i=0;i<NUMBER_PICES;i++)\r\n\t usedLetters[i]=0;\r\n for(i=0;i<boardLength;i++)\r\n lettersOnBoard[i]=EMPTY;\r\n counterLetters=1;\r\n}", "function askWhichCharacters() {\n var\n specialCharsAllowed = window.confirm(\"Do you want special characters in your password?\"), // ask user if special characters should be included\n numbersAllowed = window.confirm(\"Do you want numbers in your password?\"), // ask user if numerical characters should be included\n lowercaseAllowed = window.confirm(\"Do you want lowercase letters in your password?\"), // ask user if lowercase characters should be included\n uppercaseAllowed = window.confirm(\"Do you want uppercase letters in your password?\"); // ask user if uppercase characters should be included\n\n var // start with an empty character set\n special = \"\",\n number = \"\",\n lower = \"\",\n upper = \"\";\n\n if (specialCharsAllowed) { // if user selects special characters (true)\n special = \"!@#$^&%*()+=-[]{}|:<>?,.\"; // set special to include all special characters\n }\n console.log(special.split(\"\"));\n\n if (numbersAllowed) { // if user selects numerical characters (true)\n number = \"1234567890\"; // set number to include all numbers\n }\n console.log(number.split(\"\"));\n\n if (lowercaseAllowed) { // if user selects lowercase characters (true)\n lower = \"abcdefghijklmnopqrstuvwxyz\"; // set lower to include all lowercase characters\n }\n console.log(lower.split(\"\"));\n\n if (uppercaseAllowed) { // if user selects uppercase characters (true)\n upper = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"; // set upper to include all uppercase characters\n }\n console.log(upper.split(\"\"));\n\n if (specialCharsAllowed + numbersAllowed + lowercaseAllowed + uppercaseAllowed === 0) { // if user selects (false) for all characters\n alert(\"At least one character type must be selected\"); // tell user what is a valid input\n return askWhichCharacters(); // ask user for input again\n }\n\n criteria = special + number + lower + upper; // combine the selected character sets\n console.log(criteria.split(\"\"));\n return criteria; // return combined character sets selected\n}", "function checkLetter()\n { \n //verify if the letter was an incorrect guess \n if (movie.indexOf(letter) === -1) {\n letter = event.key.toUpperCase();\n wrongGuesses.push(letter); \n //if incorrect guess join letter to wrongGuesses array \n document.getElementById('lettersWronglyGuessed').innerHTML = wrongGuesses.join(' ');\n //display number of guesses remaining and decrement allottedGuesses counter\n document.getElementById('guessesRemaining').innerHTML = allottedGuesses--\n } else {\n //if not incorrect check to see if it is a correct letter \n for (i = 0; i <movie.length; i++) {\n if (movie[i] === letter) {\n answerArray[i] = letter; \n }\n //if correct join the movie to the currentMovie span and display the letter\n document.getElementById(\"currentmovie\").innerHTML = answerArray.join(' ');\n } \n\n }\n //go to checkIfWon function to check if the player has won \n checkIfWon(); \n}", "function playGame() {\n inquirer\n .prompt([\n {\n type: \"input\",\n name: \"play\",\n message:\n \"Enter y or Y to play the game again and any key to terminate the game\",\n validate: function(value) {\n if (isNaN(value) === true && isAlpha(value) === true) {\n return true;\n }\n\n return false;\n }\n }\n ])\n .then(answers => {\n guessesLeft = 8;\n words = secretWords.possibleWords;\n randomWord = words[Math.floor(Math.random() * words.length)];\n currentWord = new Word(randomWord);\n guessedLettersArr = [];\n gameMessage();\n if (answers.play === \"y\" || answers.play === \"Y\") {\n initGame();\n } else {\n /** gameMessage === Thank You for playing!!! */\n console.log(gameMessage()[5].bold.green);\n }\n });\n}", "function psychicGame () {\n\n // resets the game\n reset();\n \n // main game logic all triggered here by key-up\n document.onkeyup = function(event) {\n \n // var containting the letter on the key pressed\n var guess = event.key;\n\n console.log(secretLetter);\n\n\n for (g = 9; g > 0; g--) {\n if (guess == secretLetter)\n {\n wins++;\n reset();\n break;\n }\n else if (guessesLeft == 0)\n {\n losses++;\n reset();\n break;\n }\n else \n {\n guessesLeft--;\n break;\n }\n }\n\n guessedLetters.push(\" \" + guess);\n\n scorecard();\n\n }\n\n }", "function letterCheck() {\n unknown.forEach((x, i) => {\n if (guess.localeCompare(unknown[i], \"en\", { sensitivity: \"base\" }) == 0) {\n underscores[i] = unknown[i];\n }\n document.getElementById(\"mysteryWord\").innerHTML = underscores.join(\"\");\n });\n}", "function _1initializePrompts() {\n \n // Sanity check for starting the function\n console.log(\"initializing prompts...\")\n \n // Prompts for setting the key values\n var pwLength = prompt(\"What length would you like the pw to be? \\n (8 - 128 characters)\",\"10\")\n \n if (pwLength > 128 || pwLength < 8)\n {alert(\"Please use input a value between 8-128.\");}\n \n else\n {var useSpecial = confirm(\"Do you want to use: Special characters?\");\n var useLowercase = confirm(\"Do you want to include: Lowercase letters?\");\n var useUppercase = confirm(\"Do you want to include: Uppercase letters?\");\n var useNumeric = confirm(\"Do you want to include: Numbers?\");\n \n var boolKey = [pwLength,useSpecial,useLowercase,useUppercase,useNumeric];}\n return boolKey;\n}", "function questions() {\n let validLength = false;\n let passwordLength, parsedLength;\n do {\n passwordLength = prompt('Please enter the length of your password');\n parsedLength = parseInt(passwordLength)\n if (isNaN(parsedLength) || parsedLength < 8 || parsedLength > 128) {\n alert('Please enter a password length between 8 and 128 characters');\n } else {\n validLength = true\n }\n }\n while (!validLength);\n let validCharacter = false;\n let questionInput;\n do {\n let askNumbers = confirm(\"Would you like to include numbers in your password?\");\n let askLowerCase = confirm(\"Would you like to include lower case letters in your password?\");\n let askUpperCase = confirm(\"Would you like to include upper case letters in your password?\");\n let askSpecial = confirm(\"Would you like to include special characters in your password?\");\n questionInput = {\n length: passwordLength,\n usesNumbers: askNumbers,\n usesLowerCase: askLowerCase,\n usesUpperCase: askUpperCase,\n usesSpecial: askSpecial\n }\n if ((!askNumbers) && (!askLowerCase) && (!askUpperCase) && (!askSpecial)) {\n alert(\"Must choose at least one character type.\");\n } else {\n validCharacter = true\n }\n }\n while (!validCharacter);\n return questionInput;\n}", "function isValidGuess(letter){\n\tif(letter.length > 1){\n\t\treturn [{msg: \"The guess \", color: null}, {msg: letter, color: \"yellowBright\"}, {msg: \" is more than 1 character. Please limit to only 1 letter per guess.\", color: null}];\n\t}\n\telse if(letterCheck.indexOf(letter.toUpperCase()) == -1){\n\t\treturn [{msg: \"The guess \", color: null}, {msg: letter, color: \"yellowBright\"}, {msg: \" is not a valid guess.\", color: null}];\n\t}\n\telse\n\t\treturn null;\n}", "function lettersGuessed(){\n\tinquirer.prompt([\n\t {type: \"input\",\n\t name: \"letterGuessed\",\n\t message: \"Your Letter: \"}\n\n\t]).then(function(data){\n\t // var lettersToCheck = [];\n\t var newLett = new Letter(data.letterGuessed);\n\t console.log(newLett);\n\t console.log(newLett);\n\t console.log(newLett);\n\t console.log(newLett);\n\n\t // console.log(newLett)\n\t // return newLett;\n\t // lettersToCheck.push(newLett);\n \n \t\t // console.log(newLett);\n \t// console.log(lettersToCheck); \n\t\n\t});\n}", "function getPasswordRequirements() {\n var passwordLength = parseInt(prompt(\"How many characters do you want in your password?\"))\n if (isNaN(passwordLength) === true) {\n alert(\"The length of the password must be a number\");\n return\n }\n if (passwordLength < 8) {\n alert(\"Please make sure your password is at least 8 characters long\");\n return\n }\n if (passwordLength > 128) {\n alert(\"Please make sure your password is less than 128 characters\");\n return\n }\n var containsSpecialCharacters = confirm(\"Click the OK button to confirm you want to use the special characters\")\n var containsNumbers = confirm(\"Click OK button to confirm you want numbers\")\n var containsLowercase = confirm(\"Click OK if you want lowercase characters\")\n var containsUppercase = confirm(\"Click OK if you want Uppercase characters\")\n\n if (containsSpecialCharacters === false && containsNumbers === false && containsLowercase === false && containsUppercase === false) {\n alert(\"You must select one character type in order to form a password\");\n }\n var allCharacters = [];\n\n if (containsUppercase) allCharacters = allCharacters.concat(uppercase);\n if (containsLowercase) allCharacters = allCharacters.concat(lowercase);\n if (containsNumbers) allCharacters = allCharacters.concat(numbers);\n if (containsSpecialCharacters) allCharacters = allCharacters.concat(specialCharaters);\n console.log(allCharacters);\n \n var secretCode = [];\n\n for (var i = 0; i < passwordLength; i++) {\n var pickChoices = allCharacters[Math.floor(Math.random() * allCharacters.length)];\n secretCode.push(pickChoices);\n console.log(secretCode);\n\n\n // var getPasswordRequirements={\n // passwordLength: passwordLength, \n // containsSpecialCharacters: containsSpecialCharacters,\n // containsNumbers: containsNumbers,\n // containsLowercase: containsLowercase,\n // containsUppercase: containsUppercase\n // }\n \n }\n return secretCode.join(\"\");\n}", "function setLetter( letter ) {\n var div = document.getElementById( \"guess\" );\n // div.innerHTML = div.innerHTML + letter;\n brisket = characters.includes(letter)\n if (brisket == true){\n dashRemover();\n div.innerHTML = div.innerHTML + letter;\n \n \n letters.push(letter);\n } else {\n // alert(\"wrong\")\n attempts--\n console.log(attempts) \n switch (attempts){\n case 9:\n drawLeg1();\n break;\n case 8:\n drawLeg2();\n break;\n case 7:\n drawLeg3();\n break;\n case 6:\n drawLeg4();\n break;\n case 5:\n drawMakeupTable();\n break;\n case 4:\n drawMirror();\n break;\n case 3:\n drawFoundation();\n break;\n case 2:\n drawPowder();\n break;\n case 1:\n drawBlender();\n break;\n case 0:\n drawContour()\n alert(\"Game Over. Refresh the page to play again\") \n break;\n }\n };\n // console.log(brisket);\n // console.log(letter);\n}", "function passReqs(reqsDict){\n reqsDict = {\n passLen: null,\n charTypes: [false, false, false, false],\n }\n while(checkLenInput(reqsDict.passLen) ){\n alert(\"Password must be at least 8 characters long, and no longer than 128 characters. Please input only numbers.\");\n reqsDict.passLen = prompt(\"Enter the desired length of your password.\")\n }\n while(reqsDict.charTypes[0] == false && reqsDict.charTypes[1] == false && reqsDict.charTypes[2] == false && reqsDict.charTypes[3] == false){\n alert(\"Please respond to the following with 'yes' or 'no'. The following prompts will ask if you would like: lower case letters, upper case letters, numbers, and special characters. You will need to answer yes to at least one.\");\n let userResponse = prompt(\"Would you like lower case letters in your password? (yes/no)\");\n while(checkYesNoInput(userResponse)){\n userResponse = prompt(\"Would you like lower case letters in your password? (yes/no)\");\n }\n userResponse= userResponse.trim();\n if(userResponse.toLowerCase() == \"yes\"){\n reqsDict.charTypes[0] = true;\n }\n userResponse = prompt(\"Would you like upper case letters in your password? (yes/no)\");\n while(checkYesNoInput(userResponse)){\n userResponse = prompt(\"Would you like upper case letters in your password? (yes/no)\");\n }\n userResponse= userResponse.trim();\n if(userResponse.toLowerCase() == \"yes\"){\n reqsDict.charTypes[1] = true;\n }\n userResponse = prompt(\"Would you like numbers in your password? (yes/no)\");\n while(checkYesNoInput(userResponse)){\n userResponse = prompt(\"Would you like numbers in your password? (yes/no)\");\n }\n userResponse= userResponse.trim();\n if(userResponse.toLowerCase() == \"yes\"){\n reqsDict.charTypes[2] = true;\n }\n userResponse = prompt(\"Would you like special characters in your password? (yes/no)\");\n while(checkYesNoInput(userResponse)){\n userResponse = prompt(\"Would you like special characters in your password? (yes/no)\");\n }\n userResponse= userResponse.trim();\n if(userResponse.toLowerCase() == \"yes\"){\n reqsDict.charTypes[3] = true;\n }\n }\n return reqsDict;\n}", "handleInteraction(keyButton) {\r\n const keys = document.getElementsByClassName('key');\r\n for (let key of keys) {\r\n if (key.textContent === keyButton.textContent) {\r\n key.setAttribute('disabled', 'disabled');\r\n }\r\n }\r\n const isMatched = this.activePhrase.checkLetter(keyButton.textContent);\r\n if (isMatched) {\r\n keyButton.classList.add('chosen');\r\n this.activePhrase.showMatchedLetter(keyButton.textContent);\r\n if (this.checkForWin()) {\r\n this.gameOver(this.checkForWin());\r\n }\r\n } else {\r\n keyButton.classList.add('wrong');\r\n this.removeLife();\r\n }\r\n console.log(keyButton);\r\n }", "handleInteraction(letter) {\n const buttons = document.querySelectorAll('.keyrow > button');\n if(this.activePhrase.checkLetter(letter.toLowerCase())){\n this.activePhrase.showMatchedLetter(letter.toLowerCase());\n for(let i = 0; i < buttons.length; i++) {\n if(buttons[i].innerHTML === letter.toLowerCase()){\n buttons[i].classList.add('chosen')\n }\n }\n if(this.checkWin()) {\n this.gameOver();\n }\n } else {\n for(let i = 0; i < buttons.length; i++) {\n if(letter.toLowerCase() === buttons[i].innerHTML) {\n buttons[i].disabled = true;\n buttons[i].classList.add('wrong');\n }\n }\n this.removeLife();\n }\n }", "function newLtrOnly(usrGs) {\n let letters = /^[A-Za-z]$/;\n if (usrGs.match(letters)) {\n\n if (!(allKeyGs.includes(usrGs))) { //add to the all keys guessed array if not guessed before\n allKeyGs.push(usrGs);\n return true;\n }\n else { //alert user that the letter has been guessed before\n alert(\"Try another letter, you have already guessed '\" + usrGs + \"'.\");\n return false;\n }\n }\n else { //alert the user that letters from the alphabet only are acceptable inputs\n alert(\"Please choose keys from the alphabet only.\");\n return false;\n }\n }", "function evaluateGuess(letter) {\r\n var positions = [];\r\n\r\n for (var i = 0; i < transformersCharacters[computerPick].length; i++) {\r\n if(transformersCharacters[computerPick][i] === letter) {\r\n positions.push(i);\r\n }\r\n }\r\n\r\n if (positions.length <= 0) {\r\n guessesLeft--;\r\n } else {\r\n for(var i = 0; i < positions.length; i++) {\r\n wordGuessed[positions[i]] = letter;\r\n }\r\n }\r\n}", "function lettersGuessed() {\n //This checks if the users input was a letter or not\n if(this.event.key.match(/^[a-z]+$/)) {\n //This sets the state of guessed back to false each time user guesses\n guessed = false;\n //This runs the checkGuessedLetters function after guessed has been set back to false\n checkGuessedLetters();\n //This will reset the message that tells user they clicked an invalid key\n document.getElementById(\"letter-error\").innerHTML = \"\";\n\n //The if statement checks if a character has been uesd before\n //If character has NOT been used then it pushes the character up to guessedLetters\n //Else display error \"You have already used CHARACTER\"\n if(guessed != true) {\n guessedLetters.push(this.event.key);\n } else {\n document.getElementById(\"letter-error\").innerHTML = \"You already guessed \" + this.event.key;\n }\n }\n //If users input was not a letter then let them know\n else {\n //Displays invalid key error message\n document.getElementById(\"letter-error\").innerHTML = \"You pressed an invalid key\";\n }\n document.getElementById(\"letters-guessed\").innerHTML = guessedLetters;\n}", "function Letter(){\n var letter = document.getElementById(\"letter\") .value;\n if (letter.length > 0){\n for (var i=0; i < randomWord.length; i++);{\n if (randomWord[i]=== letter){\n answerArray[i] = letter;\n }\n }\n }\n }", "function gamePlay(word, guesses) {\n\n inquirer\n .prompt({\n name: \"letter\",\n type: \"input\",\n message: \"Guess a letter!\\n\"\n })\n .then(function(answer) {\n\n // call .checkGuess() method on whole word, passing in answer.letter\n // switches guessed: from false to true \n // if input matches any letter's character: in Word\n word.checkGuess(answer.letter);\n // console.log(answer.letter);\n\n\n\n // Array of Booleans of whether answer.letter matched a letter in word\n var matchedArray = [];\n\n // loop wordArray and create matchedArray of Booleans for a user guess match\n for (let b = 0; b < word.wordArray.length; b++) {\n\n // variable to hold a Boolean state of whether player guessed a correct character\n var matched;\n\n // set a true or false value for var matched\n if (word.wordArray[b].character === answer.letter) {\n matched = true;\n } else {\n matched = false;\n }\n\n // then push each resulting matched Boolean value into matchedArray\n matchedArray.push(matched);\n\n }\n // check matchedArray after it has been filled by the for loop\n // console.log(matchedArray);\n\n // then check to see if any values in matchedArray are true\n if (matchedArray.includes(true)) {\n // if a letter was matched, print happy message\n console.log(`\\nAwesome!`);\n } else {\n // but if no letters were matched, subtract 1 from guesses left\n guesses = guesses - 1;\n }\n\n\n // ==========================================================================\n // CHECKING TO SEE IF PLAYER HAS ANY MORE GUESSES LEFT; IF NOT, GAME OVER\n // ==========================================================================\n\n // check to see if there are more guesses left\n if (guesses < 1) {\n // if there are no more guesses left\n console.log(\"Cujo ate all your guesses!\")\n // check to see if player wants to play again\n anotherGame();\n // reset the number of guesses\n guesses = 12;\n // AND RETURN! THIS IS A CRUCIAL PART OF CORRECT FUNCTIONALITY\n return;\n } else {\n // otherwise just tell the player how many guesses are left\n console.log(`\\nYou have ${guesses} guesses left.\\n`);\n }\n\n\n // ==========================================================================\n // AND THEN WRITE THE CURRENT STATE OF THE WORD STRING TO THE CONSOLE\n // ==========================================================================\n\n // THIS CONSOLE.LOG() IS PART OF THE GAME:\n // IT DISPLAYS THE CURRENTLY UPDATED ROW OF BLANK LETTERS\n console.log(word.wordString + '\\n');\n\n\n // ==========================================================================\n // IF USER HAS GUESSED EVERY LETTER IN WORD, WINNER WINNER CHICKEN DINNER\n // ==========================================================================\n\n // checks to see if .every() letter in wordArray is guessed: true\n // to see if the game is over or not\n var finishCheck = word.wordArray.every(function(letter) {\n return letter.guessed === true;\n });\n // console.log(finishCheck);\n\n // and if .every() letter is NOT guessed: true, then\n if (finishCheck === false) {\n // call gamePlay() again to guess the next letter\n gamePlay(word, guesses);\n } else {\n // otherwise, if all letters guessed: true,\n // print celebratory message\n console.log(\"Well I'll be dipped in shiff, you read my mind!!\");\n // ask if player wants another game\n anotherGame();\n // and reset the number of guesses to 12\n AudioScheduledSourceNodef\n gamePlayh\n jk\n\n guesses = 12;\n // and return; here it's not crucial for game function, but good form\n return;\n };\n\n });\n}", "function showAnswerAndCongratulatePlayer(remainingLetters, wrongGuesses, answerArray) {\n \"use strict\";\n if (remainingLetters === 0) {\n alert(answerArray.join(' '));\n alert('Good job! The answer was ' + word);\n } else if (wrongGuesses === 7) {\n //alert('You guessed incorrectly 3 times. The answer was ' + word);\n } else {\n alert('Game Over!');\n }\n}", "function addCorrectLetter(letter) {\n for (var i = 0; i < character.length; i++) {\n // If current letter(input) has already been pressed\n if (letter.key === character[i]) {\n // change letter inputed to uppercase\n answerArray[i] = letter.key.toUpperCase();\n currentWordDisplay();\n //reduce letters left remaining to guess by 1\n lettersRemaining--;\n console.log(\"letters Remaning: \" + lettersRemaining);\n //if letters left to guess are equal to 0 \n if (lettersRemaining === 0) {\n winScore++;\n displayWinCount();\n alert(\"YOU WON!!!\");\n restartGame();\n\n\n }\n }\n }\n}", "checkWinner(playerChoice, aiChoice) {\n if (playerChoice === aiChoice) {\n return [\"draw\", \"same\"];\n }\n\n if (playerChoice === \"sword\") {\n if (aiChoice === \"magic\") {\n return [\"player\", \"magic\"];\n } else {\n return [\"enemy\", \"magic\"];\n }\n }\n\n if (playerChoice === \"magic\") {\n if (aiChoice === \"shield\") {\n return [\"player\", \"shield\"];\n } else {\n return [\"enemy\", \"shield\"];\n }\n }\n if (playerChoice === \"shield\") {\n if (aiChoice === \"sword\") {\n return [\"player\", \"sword\"];\n } else {\n return [\"enemy\", \"sword\"];\n }\n }\n }", "handleInteraction(key){\n key.disabled = true;\n if (this.activePhrase.checkLetter(key.textContent) === true) {\n key.classList = \"chosen\";\n this.activePhrase.showMatchedLetter(key.textContent);\n if (this.checkForWin() === true) {\n this.gameOver(false);\n }\n } else {\n key.classList = \"wrong\";\n this.removeLife();\n }\n }", "checkLetter(keyClicked) {\r\n if (this.phrase.includes(keyClicked)) {\r\n console.log('Yeah bitch');\r\n return true;\r\n } else {\r\n console.log('No Bitch');\r\n return false;\r\n }\r\n }", "function makeGuess(){\ninquirer\n .prompt([\n {\n type: 'input',\n message: 'Guess a letter between A-Z',\n name: 'userguess'\n }\n ]).then(function(response){\n var character = response.userguess.toLowerCase();\n if(word.indexOf(character) === -1 || character === ''){\n //Log an incorrect with red text\n console.log('\\x1b[41m%s\\x1b[0m', 'INCORRECT');\n //Decrease guesses left\n guessesLeft--;\n //push to wrong letters array\n wrongLetters.push(character);\n \n }else{\n console.log('\\x1b[42m%s\\x1b[0m', 'CORRECT');\n }\n // if the user input is null or larger has a length larger than one ask them to enter a proper argument.\n if(response.userguess === '' || response.userguess.length > 1){\n console.log('Please return one letter betwen A-Z')\n console.log('You lose a life.')\n }\n // Run the guessWord method which will change the object value to true if it is guessed\n console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');\n constructWord.guessWord(character);\n constructWord.buildWord();\n console.log('Guesses Left: ' + guessesLeft);\n console.log('Wrong Guesses:')\n console.log(wrongLetters);\n console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');\n // If the guess equals a character in the objectArray \n //Filter the letter object array and create array where letter check value is true.\n correctObjectArray = constructWord.letterObjArray.filter(function(arr){\n //console.log(arr);\n return arr.letterCheck === true;\n });\n // console.log(correctObjectArray);\n //Win Condition\n if(correctObjectArray.length === constructWord.letterObjArray.length){\n console.log('You win! Congratulations')\n console.log('The word was: '+word);\n newGame();\n return\n }\n //Loss Condition\n if(guessesLeft <= 0){\n console.log('You lose');\n console.log('The word was: '+word);\n newGame();\n return\n }\n makeGuess();\n\n });\n}", "function prepareGame() {\n// defines the secret word\n secretWord = ['J','A','V','A','S','C','R', 'I', 'P', 'T'];\n\n \n// Step 1 TASK: call the drawWord and drawHangman function here (inside the prepareGame function). \ndrawWord()\ndrawHangman() \n}", "function correct() {\n awnsered[chosen-1] = true;\n awnsered[chosen] = true;\n nextQuestion();\n}", "function getValidLetterGuess() {\n function guessIsValid(letter) {\n return (\n letter.length === 1 &&\n letter.toUpperCase() !== letter.toLowerCase() &&\n !Object.values(gameDataObj).includes(letter)\n );\n }\n let letter = \"\";\n while (!letter) {\n console.log(`\\n${board.join(\" \")}\\n`); // display board\n let input = readline.question(\"Please enter your guess: \");\n if (guessIsValid(input)) {\n letter = input;\n console.log(displayLettersGuessed(letter)); // display user input\n compareLetters(letter); // comapre if user input is in secret word\n } else {\n console.clear();\n console.log(displayLettersGuessed(letter)); // display user input\n console.log(chalk.red(\"Please enter a valid letter\"));\n }\n }\n return letter.toLowerCase();\n}", "function handleGuess(chosenLetter) {\r\n guessed.indexOf(chosenLetter) === -1 ? guessed.push(chosenLetter) : null;\r\n document.getElementById(chosenLetter).setAttribute('disabled', true);\r\n\r\n if (answer.indexOf(chosenLetter) >= 0) {\r\n guessedWord();\r\n checkIfGameWon();\r\n } else if (answer.indexOf(chosenLetter) === -1) {\r\n mistakes++;\r\n updateMistakes();\r\n checkIfGameLost();\r\n updatedinoPicture();\r\n }\r\n}", "function findPwChoices() {\n if (specChar === true) {\n pwChoices = pwChoices + specCharSet;\n }\n if (lwrChar === true) {\n pwChoices = pwChoices + lwrCharSet;\n }\n if (uprChar === true) {\n pwChoices = pwChoices + uprCharSet;\n }\n if (numChar === true) {\n pwChoices = pwChoices + numCharSet;\n }\n return pwChoices;\n}", "function hangman(letter){\n //is the key a valid letter? \n if (availableLetters.indexOf(letter)!==-1) {\n availableLetters.splice(availableLetters.indexOf(letter),1);\n letterClicked.push(letter);\n document.getElementById(\"outputError\").innerText= messages.correct;\n //is valid\n /* does guess exist in current word? if so, add to answer, if final letter added, game over with win message */\n if(existInWord(letter)){\n printAnswer();\n }\n else{\n lives--;\n printLives(messages.incorrect);\n error.play();\n }\n }else if(letterClicked.indexOf(letter)!==-1){\n lives--;\n printLives(messages.guessed); \n error.play(); \n }else{\n lives--;\n printLives(messages.validLetter);\n error.play();\n }\n checkScores();\n\n}", "function getGuess (word,selection,screenDisplay,badGuess,guessedLetters) {\n\n inquirer\n .prompt([ {\n \n name: \"guess\",\n message: \"Please guess a letter\",\n \n /*convert upper case entries to lower case */\n filter: function(val) {\n return val.toLowerCase();\n },\n \n }\n ])\n .then(answers => {\n guess=answers.guess\n\n \n\n if(guessedLetters.includes(guess)) {\n console.log(guess + \" was already guessed\")\n selection.update(screenDisplay)\n getGuess\n } else {\n guessedLetters.push(guess);\n badGuess=selection.guess(guess,goodGuess,screenDisplay,badGuess);\n }\n \n\n \n \n playGame(word,selection,screenDisplay,badGuess,guessedLetters);\n });\n}", "function checkAnswer(answer, answerSelection) {\n //Write your code in here\n // if the \"veryPositive\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"very positive\"\n if (possibleAnswers.veryPositive.includes(answer, [answerSelection])) {\n return \"very positive\";\n }\n // if the \"positive\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"positive\"\n else if (possibleAnswers.positive.includes(answer, [answerSelection])) {\n return \"positive\";\n }\n // if the \"negative\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"negative\"\n else if (possibleAnswers.negative.includes(answer, [answerSelection])) {\n return \"negative\";\n }\n // if the \"veryNegative\" values in the possibleAnswers object include the string assigned to \"answer\" at the index specified by \"answerSelection\", then return \"very negative\"\n else if (possibleAnswers.veryNegative.includes(answer, [answerSelection])) {\n return \"very negative\";\n }\n}", "function prepareNextQuestion() {\n // Obtain information about the current board\n var availableArray = [];\n // Note: foreach loop not working very well\n for (a=0; a<answers.length; a++) {\n if (answers[a].available == true) {\n availableArray.push(answers[a]);\n }\n }\n\n // Select one of the avaiable numbers\n var randAvailable = availableArray[getRandomInt(0, availableArray.length - 1)];\n // Toggle availibility off\n randAvailable.available = false;\n // Retrieve the answer\n return randAvailable.answer;\n}", "checkForWin() {\r\n return this.activePhrase.phrase.split(\"\")\r\n // if any letter in the phrase hasn't been guessed, allLettersGuessed\r\n // will be false from that point on, and false will be returned.\r\n // if all letters of the phrase have been guessed, they'll all be in\r\n // this.guessedLetters, and truth will be maintained;\r\n .reduce((allLettersGuessed,currentLetter) => {\r\n return (this.guessedLetters[currentLetter] || false) && allLettersGuessed\r\n },true);\r\n }", "function checkLetters(letter) {\n\n var letterInWord = false;\n\n //check if letter exists inside the array\n for (var i = 0; i < numBlanks; i++) {\n if(chosenWord[i] === letter) {\n letterInWord = true;\n }\n }\n\n // If the letter exists somewhere in the word, then figure out exactly where (which indices).\n if (letterInWord) {\n\n //loop through the word\n for (var j = 0; j < numBlanks; j++) {\n\n //populate the blanksAndSuccesses with every instance of the letter.\n if (chosenWord[j] === letter) {\n blanksAndSuccesses[j] = letter;\n }\n }\n console.log(blanksAndSuccesses);\n }\n\n else {\n wrongGuesses.push(letter);\n numGuesses--;\n }\n}", "function keyAnswer1(){\n\tresponse[trial-1]=0;\n\tif (tone1[trial-1]>tone2[trial-1]){\n\t\tacc[trial-1] = 1;\n\t}else{\n\t\tacc[trial-1] = 0;\n\t}\n\tpressButton();\n}", "function key(x) {\n userKey = x;\n// When you need to check\n if (validKeys.includes(userKey)) {\n console.log('A Valid key')\n \n \n } else {\n console.error('invalid key')\n }\n }", "function checkLetter(event) {\n var userGuess = event.key.toLowerCase();\n if ($(\"#loseModal\").css(\"display\") !== \"block\" && $(\"#winModal\").css(\"display\") !== \"block\") {\n if ((event.which >= 65 && event.which <= 90) || ((event.which >= 97 && event.which <= 122)) && (guesses.indexOf(userGuess) == -1)) { \n guesses.push(userGuess);\n guessMatch(userGuess);\n appearLetters(indexChecker, userGuess);\n }\n winOrLose(winCounter, lives);\n indexChecker = [];\n }\n}", "function checkLetters(letter) {\n\n // just in case the user puts a number\n var letterInWord = false;\n\n // to see if the letter is even in the array\n for (var i = 0; i < numBlanks; i++) {\n if (chosenWord[i] === letter) {\n // if it does exist than go on\n letterInWord = true;\n }\n }\n\n // if it does exist this will tell where exactly that it does\n if (letterInWord) {\n\n // loop through the word.\n for (var j = 0; j < numBlanks; j++) {\n\n // populate the blanksAndSuccesses with every instance of the letter.\n if (chosenWord[j] === letter) {\n // here we set the specific space in blanks and letter equal to the letter when there is a match.\n blanksAndSuccesses[j] = letter;\n }\n }\n // log for testing.\n console.log(blanksAndSuccesses);\n }\n // if the letter doesnt exist at all\n else {\n // ..then we add the letter to the list of wrong letters, and we subtract one of the guesses.\n wrongGuesses.push(letter);\n numGuesses--;\n }\n}", "function validateLetter (usersKeypress) {\n message.innerText = \"\";\n\n var repeatGuess = lettersGuessed.some(function(item){\n return item === usersKeypress;\n })\n\n //alert player if the above code is true.\n if (repeatGuess) {\n //alert(usersKeypress + \" already guessed. Try again!\");\n message.innerHTML = \"<span class='duplicateMessage'>Already guessed that. Try again!</span>\";\n\n //if it is not a repeat guess, check if it's in word\n } else {\n lettersGuessed.push(usersKeypress);\n console.log(\"Guessed so far\", lettersGuessed);\n\n //show user's input in browser\n showLettersGuessed();\n //is user's input a match to computer guess\n guessMatch(usersKeypress);\n }\n\n}", "function askQuestion() {\n\n inquirer.prompt([\n {\n type: \"input\",\n name: \"character\",\n message: \"Guess a letter!\"\n }\n ])\n .then(function (answers) {\n // stores inquirer guess into a variable\n // console.log(answers);\n var character = answers.character;\n // Adds to the word constructor. Stores character (guess).\n // var newGuess = new Word(character);\n\n const userAnswer = answers.character;\n\n if (user.word.includes(userAnswer)) {\n var index = user.word.indexOf(userAnswer);\n dashed[index] = userAnswer;\n \n console.log(\"Here is the word for you to guess \" + dashed);\n \n var guessword = dashed.join(\"\"); \n \n if(guessword === user.word){\n console.log(\"You win!!!\");\n } else{\n askQuestion();\n }\n \n\n } else {\n console.log(\"Sorry, that is not the correct letter.\");\n askQuestion();\n\n }\n\n });\n\n}", "function Guess(letter) {\nconsole.log(letter);\n\nif (gameRunning && GuessedLetters.indexOf(letter) === -1) {\n\n//Run Game \nGuessedLetters.push(letter);\n\n//check if guessed letter is in picked word\n\nfor (var i = 0 ; i < ChosenWord.length ; i++) {\n //convert both values to lower case for comaprison.\n if (ChosenWord[i].toLowerCase() === letter.toLowerCase()) {\n //if match swap out character in placeholder\n ChosenWordarr[i] = ChosenWord[i];\n }\n}\nplaceholder.innerHTML = ChosenWordarr.join('');\nIncorrect(letter);\n}\nelse{\n if(!gameRunning) {\n alert(\"Press the Button to save the world!\")\n Alert();\n } else {\n alert(\"This button has already been pressed!\")\n Alert();\n }\n}\n }", "function questions (){\r\n\r\n if (character === 1){\r\n if (gameState === 3){\r\n \r\n\r\n }\r\n if (gameState === 6){\r\n\r\n }\r\n if (gameState === 9){\r\n\r\n }\r\n if (gameState === 12){\r\n\r\n }\r\n }\r\n if (character === 2) {\r\n if (gameState === 3) {\r\n\r\n\r\n }\r\n if (gameState === 6) {\r\n\r\n }\r\n if (gameState === 9) {\r\n\r\n }\r\n if (gameState === 12) {\r\n\r\n }\r\n }\r\n \r\n}", "function correctLetter(letter) {\n for (let key of keyboard) {\n if (key.textContent == letter) {\n key.classList.add(\"chosen\");\n key.disabled = true;\n }\n }\n}", "function startGame(){\n\t//choose a random word.\n\tvar randomWord = hangmanWords[Math.floor(hangmanWords.length * Math.random())];\n\tvar splitWord = randomWord.split (\"\");\n\tfor (i = 0; i < randomWord.length; i++) {\n\t\tarrayOfBlanks[i] = \"_\";\n\t\tconsole.log(arrayOfBlanks);\n\t\t// Print scoring info on game start\n\t\t$(\"#mysteryWord\").html(\"Try and guess me! \" + arrayOfBlanks.join(\" \"));\n\t\t$(\"#guessesRemaining\").html(\"Guesses Remaining: \" + guessesRemaining);\n\t\t$(\"#lettersGuessed\").html(\"Letters Guessed: \" + alreadyGuessed);\n\t}\n\n\n// Keystroke recognition.\ndocument.onkeyup = function(press) { \n var letterGuessed = (press.key);\n console.log(letterGuessed);\n $(\"#youlose\").html(\"\")\n\t$(\"#youwin\").html(\"\")\n \n// Check if letter pressed exists in the hidden word.\n\t//loop for the word in blanks/has letter been guessed?\n\tfor (i = 0; i < alreadyGuessed.length; i++) \n for(j = 0; j< arrayOfBlanks.length; j++){\n\n \t//Is the letter guessed correct?\n\t\t\tif (letterGuessed == randomWord[j]) {\n\t\t\t\tconsole.log(\"correct\");\n\t\t\t\tarrayOfBlanks[j] = letterGuessed;\n\t\t\t\tconsole.log(arrayOfBlanks);\n\t\t\t\t$(\"#mysteryWord\").html(\"Try and guess me! \" + arrayOfBlanks.join(\" \"));\n\t\t\t} // end replace blank\n\t\t}\n\t\t\t//Is the guess wrong?\n\t\t\tif(randomWord.indexOf(letterGuessed) < 0) {\n\t\t\t\tif (alreadyGuessed.indexOf(letterGuessed) == -1) {\n \t\t\t\talreadyGuessed.push(letterGuessed);\n \t\t\t\tguessesRemaining --;\n\t\t\t}\n\t\t\t\tconsole.log(guessesRemaining);\n\t\t\t\t$(\"#guessesRemaining\").html(\"Guesses Remaining: \" + guessesRemaining);\n\t\t\t}\n\t\t\t//How does the user win/reset.\n\t\t\tif (randomWord == arrayOfBlanks.join('')) {\n\t\t\t\t$(\"#youwin\").html(\"Awesome climbing rockstar!\");\n\t\t\t\tpoints ++;\n\t\t\t\talreadyGuessed = [];\n\t\t\t\tarrayOfBlanks = [];\n\t\t\t\tguessesRemaining = 10;\n\t\t\t\tstartGame();\t\n\t\t\t}\n\t\t\t//How the use loses/reset.\n\t\t\tif (guessesRemaining == 0) {\n\t\t\t\t$(\"#youlose\").html(\"You just fell to your death...\");\n\t\t\t\talreadyGuessed = [];\n\t\t\t\tarrayOfBlanks = [];\n\t\t\t\tguessesRemaining = 10;\n\t\t\t\tpoints = 0;\n\t\t\t\tstartGame();\n\t\t\t}\n\t\t\t//print out results as game progesses\n\t\t\t$(\"#guessesRemaining\").html(\"Guesses Remaining: \" + guessesRemaining);\n\t\t\t$(\"#mysteryWord\").html(\"Try and guess me! \" + arrayOfBlanks.join(\" \"));\n\t\t\t$(\"#lettersGuessed\").html(\"Letters Guessed: \" + alreadyGuessed);\n\t\t\t$(\"#points\").html(\" Points: \" + points);\n\t}//onclick function\n}//startgame function", "function checkInput() {\n if (attempts > 0) {\n let counter = 0;\n\n for (let toValidate of domList.children) {\n let li = toValidate;\n let wordChar = li.getAttribute(\"data-char\").toLowerCase();\n let pChar = toValidate.querySelector(\"p\");\n\n if (wordChar === inputChar) {\n counter = counter + 1;\n pChar.classList.remove(\"hidden\");\n }\n }\n let check = wrongKeys.includes(inputChar);\n\n if (counter === 0 && check === false) {\n wrongKeys.push(inputChar);\n displayWrongKeys();\n }\n }\n countWrongAttempts();\n}", "validateInput() {\n const errors = [];\n if (this.state.key.length === 0) {\n errors.push(\"You must enter a key\");\n } else if (this.state.key.length !== 20) {\n errors.push(\"The key entered is not the expected length\");\n }\n return errors;\n }", "function inputResult() {\n\n\tvar action = \"none\";\n\n\tfor(var i=0; i < allPlayers.length; i++) {\n\t\tif( isKeyboardKeyDown( playerControls[i].up ) )\n\t\t\t{ keyboardKeys[ playerControls[i].up ] = \"none\"; action = \"up\"; }\n\t\telse if( isKeyboardKeyDown( playerControls[i].gc_up ) )\n\t\t\t{ keyboardKeys[ playerControls[i].gc_up ] = \"none\"; action = \"up\"; }\n\n\t\telse if( isKeyboardKeyDown( playerControls[i].down ) )\n\t\t\t{ keyboardKeys[ playerControls[i].down ] = \"none\"; action = \"down\"; }\n\t\telse if( isKeyboardKeyDown( playerControls[i].gc_down ) )\n\t\t\t{ keyboardKeys[ playerControls[i].gc_down ] = \"none\"; action = \"down\"; }\n\t\t\n\t\telse if( isKeyboardKeyDown( playerControls[i].left ) )\n\t\t\t{ keyboardKeys[ playerControls[i].left ] = \"none\"; action = \"left\"; }\n\t\telse if( isKeyboardKeyDown( playerControls[i].gc_left ) )\n\t\t\t{ keyboardKeys[ playerControls[i].gc_left ] = \"none\"; action = \"left\"; }\n\t\t\n\t\telse if( isKeyboardKeyDown( playerControls[i].right ) )\n\t\t\t{ keyboardKeys[ playerControls[i].right ] = \"none\"; action = \"right\"; }\n\t\telse if( isKeyboardKeyDown( playerControls[i].gc_right ) )\n\t\t\t{ keyboardKeys[ playerControls[i].gc_right ] = \"none\"; action = \"right\"; }\n\n\t\t//only char change if over a char\n\t\tif( resultVars[ \"blockp\" + i] < 4) {\n\t\t\tif( action === \"up\") {\n\t\t\t\tresultVars[ \"c\" + resultVars[ \"blockp\" + i] + \"p\" + i] += 1;\n\t\t\t\tif( resultVars.ccZref < resultVars[ \"c\" + resultVars[ \"blockp\" + i] + \"p\" + i] )\n\t\t\t\t\t{ resultVars[ \"c\" + resultVars[ \"blockp\" + i] + \"p\" + i] = resultVars.ccAref; }\n\t\t\t}\n\t\t\tif( action === \"down\") {\n\t\t\t\tresultVars[ \"c\" + resultVars[ \"blockp\" + i] + \"p\" + i] -= 1;\n\t\t\t\tif( resultVars.ccAref > resultVars[ \"c\" + resultVars[ \"blockp\" + i] + \"p\" + i] )\n\t\t\t\t\t{ resultVars[ \"c\" + resultVars[ \"blockp\" + i] + \"p\" + i] = resultVars.ccZref; }\n\t\t\t}\n\t\t\tallResultVisuals.midLayer[\"player\" + (i+1) + \"c\" + resultVars[ \"blockp\" + i] ].text(\n\t\t\t\tString.fromCharCode( resultVars[ \"c\" + resultVars[ \"blockp\" + i] + \"p\" + i] )\n\t\t\t);\n\t\t}//end if changing a char\n\n\t\t//move the block\n\t\tif( (action === \"left\") && (resultVars[ \"blockp\" + i] > 1) ) {\n\t\t\tresultVars[ \"blockp\" + i] -= 1;\n\t\t\tallResultVisuals.frontLayer[\"player\" + (i+1) + \"block\"].x( allResultVisuals.midLayer[\"player\" + (i+1) + \"c\" + resultVars[ \"blockp\" + i] ].x() );\n\t\t}\n\t\telse if( (action === \"right\") && (resultVars[ \"blockp\" + i] < 4) ) {\n\t\t\tresultVars[ \"blockp\" + i] += 1;\n\t\t\tallResultVisuals.frontLayer[\"player\" + (i+1) + \"block\"].x(\n\t\t\t\tallResultVisuals.midLayer[\"player\" + (i+1) + \"c1\" ].x()\n\t\t\t\t+ ( (resultVars[ \"blockp\" + i] - 1) * allResultVisuals.frontLayer[\"player\" + (i+1) + \"block\"].width() )\n\t\t\t);\n\t\t}\n\n\t} //end for each player\n\n\n\n\n\t//End the input to submit scores.\n\tif(keyboardKeys[\"Enter\"] === \"down\") {\n\n\t\tresultScoreCheckingBeforePageReload();\n\n\t\tdocument.location.reload(true);\n\t}\n\n}", "function theLogic() {\n\n if (requireNewWord) {\n var randomIndex = Math.floor(Math.random() * yoga.length);\n var randomWord = yoga[randomIndex];\n\n computerWord = new Word(randomWord);\n\n requireNewWord = false;\n }\n //array that holds the word that is complete\n var wordComplete = [];\n\n if (wordComplete.includes(false)) {\n inquirer.prompt([\n {\n type: \"input\",\n message: \"Pick a letter, from a-z\",\n name: \"userinput\"\n }\n ])\n .then(function (input) {\n if (\n !letterArray.includes(input.userinput) ||\n input.userinput.length > 1\n ) {\n console.log(\"Nice try, try again!\\n\");\n theLogic();\n } else {\n if (\n incorrectletters.includes(input.userinput) ||\n correctletters.includes(input.userinput) ||\n input.userinput === \"\"\n ) {\n console.log(\"\\nYou already guessed it or nothings been entered yet\\n\");\n theLogic();\n } else {\n var wordCheckArray = [];\n computerWord.userGuess(input.userinput);\n\n computerWord.objArray.forEach(wordCheck);\n if (wordCheckArray.join(\"\") === wordComplete.join(\"\")) {\n console.log(\"\\nOooops, that's incorrect\\n\");\n\n incorrectletters.push(input.userinput);\n guessesleft--;\n } else {\n console.log(\"\\nAwesome, that's correct!\\n\");\n correctletters.push(input.userinput);\n }\n\n computerWord.log();\n\n //shows the guesses left \n console.log(\"Guess Left: \" + guessesleft + \"\\n\");\n\n //shows the letters that've been guessed already \n console.log(\"Letters Guessed: \" + incorrectletters.join(\" \") + \"\\n\");\n\n //guess that are left \n if (guessesleft > 0) {\n theLogic();\n } else {\n console.log(\"Sorry, but you lose\\n\");\n restartGame();\n }\n function wordCheck(key) {\n wordCheckArray.push(key.guessed);\n }\n }\n }\n }); \n\n } else {\n console.log(\"WINNER!!\\n\");\n restartGame(); \n }\n function completeCheck(key) {\n wordComplete.push(key.guessed); \n }\n}", "function completeCheck(key) {\n\n // Push guessedLetter to wordComplete array\n wordComplete.push(key.guessedLetter);\n }", "function checkLetters(letter) {\n var lettersInChosenWord = false;\n\n // checks if the selected letter exists within the array\n for (var i = 0; i < numBlanks; i++) {\n if (selectedWord[i] === letter) {\n lettersInChosenWord = true;\n };\n }\n // IF LETTER EXIST, POPULATE THE BLANKSANDSUCCESS ARRAY\n if (lettersInChosenWord) {\n for (var j = 0; j < numBlanks; j++) {\n if (selectedWord[j] === letter) {\n blanksAndSuccess[j] = letter;\n }\n }\n // LETTER WASNT FOUND\n } else {\n wrongLetters.push(letter);\n guessesLeft--;\n }\n // TEST/ DEBUGGING\n // console.log(letter)\n // console.log(blanksAndSuccess);\n}", "function generates(){\nvar option1 = [\"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\"];\nvar option2 = [\"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\"];\nvar option3 = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"0\"];\nvar option4 = [\"~\",\"!\",\"@\",\"#\",\"$\",\"%\",\"^\",\"&\",\"*\",\"(\",\")\",\"-\",\"+\",\"_\",\"=\"];\n\nvar isOp1;\nvar isOp2;\nvar isOp3;\nvar isOp4;\nvar possibleOptions = [];\n\n\nfunction confirms(){\n isOp1 = confirm(\"Would you like to use Upper case letters?\");\n isOp2 = confirm(\"Would you like to use Lower case letters?\");\n isOp3 = confirm(\"Would you like to use numbers?\");\n isOp4 = confirm(\"Would you like to Special characters?\");\n generate();\n}\n\nfunction generate(){\n if (isOp1 || isOp2 || isOp3 || isOp4) {\n if (isOp1) {\n possibleOptions = possibleOptions.concat(option1)\n };\n \n if (isOp2) {\n possibleOptions = possibleOptions.concat(option2)\n };\n \n if (isOp3) {\n possibleOptions = possibleOptions.concat(option3)\n };\n if (isOp4){\n possibleOptions = possibleOptions.concat(option4)\n }\n password();\n\n \n } else {\n alert(\"You must enable an option\");\n confirms();}\n };\n\nfunction randomNumber(){\n return Math.floor(Math.random()* possibleOptions.length)\n};\n\nfunction password() {\n var text = \"\";\n for (var i = 0; i<16; i++){\n text+=possibleOptions[randomNumber()]\n }\n document.getElementById(\"password\").value = text;\n \n}\n\nconfirms();\n}", "validateInput(event){\n var value = event.target.value.toLowerCase();\n\n //rejex is including everything but a-zA-Z. If value is anything but a letter, match = true, nonLetters = true. If value is a latter, match = false, nonLetter = true\n var nonLetters = value.match(/^[^a-zA-Z]+$/) ? true : false;\n\n //if value is not an empty character and is a letter\n if (value.length && !nonLetters) {\n var error = true;\n this.setState({guessedCharacter: value});\n this.state.randomSelectedWord.split('').map((item, index) => {\n if(item === value){\n this.state.successItems[index] = value;\n this.setState({successItems: this.state.successItems});\n error = false;\n }\n });\n\n if(error){\n if(!this.state.errorItems.includes(value)){\n this.state.errorItems.push(value);\n this.setState({errorItems: this.state.errorItems, numGuesses: --this.state.numGuesses});\n }\n this.drawBodyPart();\n }\n //if the array containing '_' initially does not contain an '_' after 6 guesses, set wordGuessed to true\n if(!this.state.successItems.includes('_')){\n this.setState({wordGuessed: true});\n }\n //set gameOver to true when number of guesses equals 0\n if(this.state.numGuesses === 0){\n this.setState({gameOver: true});\n }\n }\n else{\n this.setState({guessedCharacter: ''});\n }\n }", "function passwordRequirements() {\n\n var findTrue = -1;\n\n // A while loop starts by assuming that the user has not selected a valid set of requirements\n while (findTrue === -1) {\n\n var numbersBoolean = confirm(\"Do you want to include numbers?\");\n var specialCharsBoolean = confirm(\"Do you want to include special characters?\");\n var lowerCaseBoolean = confirm(\"Do you want to include lower case?\");\n var upperCaseBoolean = confirm(\"Do you want to include upper case?\");\n var userOptions = [numbersBoolean, specialCharsBoolean, lowerCaseBoolean, upperCaseBoolean];\n\n // find true stores the result of index of the user options. One must be true in order for the find true value to change\n findTrue = userOptions.indexOf(true);\n if (findTrue === -1) {\n alert(\"You did not select any character requirements! Let's do this again\")\n }\n\n\n }\n //A list of the user requirements will be returned when this function runs\n return userOptions\n}", "function userPick(event){\n //if the key is a not a letter key\n if(event.keyCode > 90 || event.keyCode < 65) {\n //don't do anything\n return\n }\n //determine the letter that the user pressed\n var pick = event.key.toLowerCase();\n //if the letter has already been picked\n if(wrongGuesses.textContent.includes(pick)) {\n //don't do anything\n return\n }\n //if the letter can be found in the word\n if(chosenWord.includes(pick)) {\n //walk through the word to locate the match(es)\n for(var i = 0; i < chosenWord.length; i++){\n //if we find a matching letter in this position\n if(pick == chosenWord[i]) {\n //replace the blank in this position with the letter\n blanksAndSuccesses[i] = pick;\n //decrement the number of blanks\n numBlanks--\n }\n }\n //update the page with a representation of the current state of blanksAndSuccesses\n wordBlanks.textContent = blanksAndSuccesses.join(\" \");\n //if we can't find the pick in the word\n } else {\n //decrement the number of guesses left\n numGuesses--;\n //update the page with the number of guesses left\n guessesLeft.textContent = numGuesses.toString();\n //update the wrong guesses\n wrongGuesses.textContent += pick; \n }\n //detect if the user has won or lost\n //if the user has guessed the word there will be no more blanks left\n if(numBlanks == 0) {\n //tally the wins\n winCounter++;\n //reset for another game\n initializeGame();\n //if there are no more guesses left\n } else if (numGuesses == 0) {\n //tally the losses\n lossCounter++;\n //reset for another game\n initializeGame();\n }\n}", "handleInteraction(key) {\n if (game.activePhrase.checkLetter(key.textContent)) {\n key.setAttribute('disabled', true);\n game.activePhrase.showMatchedLetter(key.textContent);\n key.className = 'key chosen';\n if (this.checkForWin()){\n setTimeout(function () {\n game.gameOver(true)\n }, 1500\n );\n } \n }\n else {\n key.className = 'key wrong';\n key.setAttribute('disabled', true); \n this.removeLife()\n this.checkForWin();\n if (this.missed === 5){\n setTimeout(function () {\n game.gameOver(false)\n }, 500\n );\n }\n }\n }", "function getUserKey(event) {\n usersGuess = event.key\n let correct = false;\n\n for( let i = 0; i < currentWord.length; i++) {\n if (usersGuess.toLowerCase() === currentWord[i].toLowerCase()) {\n list.childNodes[i].textContent = currentWord[i];\n characterCount--;\n remainingLettersElement.textContent = characterCount;\n correct = true;\n }\n }\n\n if (!correct) {\n lettersGuessedElement.textContent += usersGuess;\n }\n\n if (characterCount === 0) {\n winsElement.textContent = winsCount++;\n setup();\n }\n\n\n }", "function getCharacterInputs() {\n getPasswordLower();\n getPasswordUpper();\n getPasswordNumber();\n getPasswordSpecial();\n if (passwordLower === false && passwordUpper === false && passwordNumber === false && passwordSpecial === false) {\n window.alert(\"You must select at least one character type!\");\n getCharacterInputs();\n }\n}", "function checkSolved(selection) {\n notGuessed=0;\n selection.letters.forEach(function(element) {\n \n if(element.guessed===false) {\n notGuessed++\n }\n\n })\n}", "function checkCombination(arr, playerChar){\n\tvar correctNum = 0;//stores the correct number selected by the player.\n\tvar panelCount = 0;//stores the panel count selected.\n\tvar thisNum;//refers to the current number selected\n\t$(\"#game-area .panel\").each(function(i, val){//iterate over the panels...\n\t\tthisNum = (i+1);//increment our thisNum var, it's 0 based.\n\t\tif($(\"#game-area .panel\").eq(i).text() == playerChar){//check if the current panel has the players char in it.\n\t\t\tfor (var j = 0;j<arr.length;j++){//loop over the length of the array passed into this function...\n\t\t\t\tif(thisNum == arr[j]){//check this num against the passed in array...\n\t\t\t\t\tcorrectNum += 1;//test is true, we are correct, increment our correctnum var.\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\tif(correctNum == arr.length){//if correct num is equal to the arrays length, we are all correct\t!\t\t\n\t\t$(\"#game-area #feedback\").fadeIn().children(\"p\").text('\"'+playerChar+'\"'+' has won!');//show the feedback message, indicating which player has won!\n\t\t$(\"#game-area .panel.enabled\").unbind(\"click\").css({\"cursor\":\"default\"}).removeClass(\"enabled\");//disable all the panels, game is over!\n\t\tfor (var k = 0;k<arr.length;k++){//loop over the winning array found...\n\t\t\t$(\"#game-area #panel\"+(arr[k]-1)).addClass(\"winner\");//add a class to the winning panels! \n\t\t}\n\t\tscoreCount +=1;\n\t\t$(\"#score p\").text(\"Score: \"+scoreCount);\n\t\tgameOver = true;\t\t\n\t}\t\n\t//determine if game is a tie...\n\t$(\"#game-area .panel\").each(function(i, val){//loop over all the panels...\n\t\tif($(this).text()!=\"\"){//check if the current iterator of the loop is not an empty string...\n\t\t\tpanelCount+= 1;//add to our panel count.\n\t\t}\t\t\n\t});//show the feedback indicating game is a tie...\n\tif(panelCount == $(\"#game-area .panel\").length){//if panel count indicates that all panels are filled, then...\n\t\t$(\"#game-area #feedback\").fadeIn().children(\"p\").text(\"Game is a tie!\");//show the message that the game is a tie!\n\t}\n}", "function playGame() {\n // Creating the text prompts for the command line using inquirer's node package. \n inquirer.prompt([\n //\n {\n type: 'input',\n message: 'Guess a letter!',\n name: 'userInput',\n },\n ])\n .then(function(response) {\n console.log(randomWord);\n console.log(`You guessed letter: ${response.userInput}`);\n randomWord.guessCheck(response.userInput);\n\n // for (var i = 0; i < randomWord.letterObjArray.length; i++) {\n // console.log(`Letter from randomWord: ${randomWord.letterObjArray[i].letter}`);\n // if (randomWord.letterObjArray[i].letter === response.userInput) {\n // console.log('YES!');\n // correctlyGuessed.push(response.userInput);\n // console.log(`Corrected Guesses: ${correctlyGuessed}`);\n // } else {\n // console.log('No matching letter.');\n // incorrectlyGuessed.push(response.userInput);\n // console.log(`Incorrect Guesseses: ${incorrectlyGuessed}`);\n // }\n // };\n // if (randomWord.includes(response.userInput)) {\n // console.log('==============================================');\n // console.log('You got a letter!')\n // console.log('==============================================');\n // } else {\n // console.log('==============================================');\n // console.log('Sorry! Guess again')\n // console.log('==============================================');\n // };\n });\n //\n}", "function keyPressed() {\n\tif (gameOn === true) {\n\t\tvar key = event.keyCode;\n\t\tif (key > 64 && key < 91) {\n\t\t\t\n\t\t\tcountGuess = true;\n\n\t\t\t// Checks to see if letter guessed is in the word\n\t\t\tvar keyString = String.fromCharCode(key + 32);\n\t\t\tfor (var j = 0; j < characterArray.length; j++) {\n\t\t\t\tif (keyString == characterArray[j]) {\n\t\t\t\t\tcountGuess = false;\n\t\t\t\t\tconsole.log(keyString);\n\t\t\t\t\tconsole.log(characterArray[j]);\n\t\t\t\t\tconsole.log(countGuess);\n\t\t\t\t} \n\t\t\t}\n\n\t\t\t// Checks to see if letter was already guessed\n\t\t\tvar keyNumber = (key + 32);\n\t\t\tfor (var k = 0; k < guessedArray.length; k++) {\n\t\t\t\tif (keyNumber == guessedArray[k]) {\n\t\t\t\t\tcountGuess = true;\n\t\t\t\t\tconsole.log(k);\n\t\t\t\t\tconsole.log(keyNumber);\n\t\t\t\t\tconsole.log(guessedArray[k]);\n\t\t\t\t\tconsole.log(countGuess);\n\t\t\t\t} \n\t\t\t}\n\n\t\t\t// If letter pressed is not in the word or has already been guessed, increment down Guesses Remaining\n\t\t\tif (countGuess == true) {\n\t\t\t\tguessesRemaining -= 1;\n\t\t\t}\n\n\t\t\tguessedArray.push(key + 32);\n\t\t\tletterString += String.fromCharCode(key) + \", \";\n\t\t\t$(\"#lettersString\").text(letterString);\n\t\t\tdisplayWord();\n\n\t\t\t// If guesses remaining run out, player losses\n\t\t\tif (guessesRemaining == 0) {\n\t\t\t\tgameLose();\n\t\t\t}\n\n\t\t} else {\n\t\t\talert(\"That is not a valid letter!\");\n\t\t}\n\t}\n}", "function checkGuess(userGuess) {\n for (var j = 0; j < numberOfLetters; j++) {\n if (userGuess === wordArray[j]) {\n blanksArray[j] = userGuess;\n letterPresent = true;\n\n } else {\n letterPresent = false;\n } \n }\n\n if (letterPresent === false) {\n incorrectArray.push(userGuess); \n chancesLeft--;\n\n } else {\n lettersRemaining--;\n\n }\n\n\n \n \n\n\n document.getElementById(\"attempts\").innerHTML = \"You have \" + chancesLeft + \" guesses before you lose.\";\n document.getElementById(\"passedGuesses\").innerHTML = incorrectArray.join(\" \");\n document.getElementById(\"unkown-olympian\").innerHTML = blanksArray.join(\" \");\n console.log(\"letters remaining in word \" + lettersRemaining);\n console.log(\"number of guesses remaining \" + chancesLeft);\n \n}", "function guessLetter() {\n\n if (slotsFilledIn < someWord.letters.length || guessesRemaining > 0) {\n inquirer.prompt([\n {\n name: \"letter\",\n message: \"Guess a letter:\",\n validate: function (value) {\n if (isLetter(value)) {\n return true;\n }\n else {\n return false;\n }\n }\n }\n ]).then(function (guess) {\n guess.letter.toUpperCase();\n console.log(gameTextColor(\"You guessed: \" + guess.letter.toUpperCase()));\n userGuessedCorrectly = false;\n\n if (lettersAlreadyGuessedListArray.indexOf(guess.letter.toUpperCase()) > -1) {\n console.log(gameTextColor(\"You already guessed that letter. Enter another one.\"));\n console.log(gameTextColor(\"=====================================================================\"));\n guessLetter();\n }\n\n //If user entered a letter that was not already guessed...\n else if (lettersAlreadyGuessedListArray.indexOf(guess.letter.toUpperCase()) === -1) {\n\n lettersAlreadyGuessedList = lettersAlreadyGuessedList.concat(\" \" + guess.letter.toUpperCase());\n lettersAlreadyGuessedListArray.push(guess.letter.toUpperCase());\n\n console.log('Letters already guessed: ' + lettersAlreadyGuessedList);\n\n for (i = 0; i < someWord.letters.length; i++) {\n\n if (guess.letter.toUpperCase() === someWord.letters[i].character && someWord.letters[i].letterGuessedCorrectly === false) {\n\n someWord.letters[i].letterGuessedCorrectly === true;\n userGuessedCorrectly = true;\n someWord.underscores[i] = guess.letter.toUpperCase();\n slotsFilledIn++\n }\n }\n console.log(gameTextColor(\"WORD TO GUESS:\"));\n\n someWord.splitWord();\n someWord.generateLetters();\n\n //If user guessed correctly...\n if (userGuessedCorrectly) {\n\n console.log(correct('CORRECT!'));\n console.log(gameTextColor(\"=====================================================================\"));\n checkIfUserWon();\n }\n\n //Else if user guessed incorrectly...\n else {\n console.log(incorrect('INCORRECT!'));\n\n guessesRemaining--;\n\n console.log(gameTextColor(\"You have \" + guessesRemaining + \" guesses left.\"));\n console.log(gameTextColor(\"=====================================================================\"));\n checkIfUserWon();\n }\n }\n });\n }\n}", "function generateOptions (){ \n var arrayAllOptions = [];\n\n characterCriteriaAmount = window.prompt(\"Please select how many characters you would like your password to be (between 8-128).\");\n //if statement sets allowed number of characters for characterCriteriaAmount\n if (characterCriteriaAmount < 8 || characterCriteriaAmount > 128) {\n window.alert(\"You must choose a number between 8 and 128\")\n return\n }\n\n var characterCriteriaUppercase = window.confirm(\"Would you like uppercase characters in your password? (Okay for Yes or Cancel for No)\");\n //if yes is selected, equals true, then the characterCriteria is concated to arrayAllOptions as its own predefined array.\n if (characterCriteriaUppercase === true) {\n arrayAllOptions = arrayAllOptions.concat(arrayUppercase)\n }\n\n var characterCriteriaLowercase = window.confirm(\"Would you like lowercase characters in your password? (Okay for Yes or Cancel for No)\");\n if (characterCriteriaLowercase === true) {\n arrayAllOptions = arrayAllOptions.concat(arrayLowercase)\n }\n\n var characterCriteriaNumeric = window.confirm(\"Would you like Numeric characters in your password? (Okay for Yes or Cancel for No)\");\n if (characterCriteriaNumeric === true) {\n arrayAllOptions = arrayAllOptions.concat(arrayNumeric)\n }\n\n var characterCriteriaSpecial = window.confirm(\"Would you like Special characters in your password? (Okay for Yes or Cancel for No)\");\n if (characterCriteriaSpecial === true) {\n arrayAllOptions = arrayAllOptions.concat(arraySpecial)\n }\n \n //result of all true and concated array options \n return arrayAllOptions;\n}", "function getQuestions() {\n\n\tgame = [];\n\n\tvar tempQuestion = {};\n\tvar tempAnswer = {};\n\n\tfor(var i = 0; i < states.length; i++) {\n\t\t\n\t\ttempQuestion = {state: states[i], answers: [{answer: capitals[i], isCorrect: true}]};\n\n\t\tgame.push(tempQuestion);\n\n\t\t// get 3 answers for positions [1 - 3] in answers array\n\t\tfor(var j = 1; j < 4; j++) {\n\n\t\t\t// get a random capital\n\t\t\ttempAnswer = {answer: capitals[Math.floor(Math.random() * capitals.length)],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect: false};\n\t\t\t// first time\n\t\t\tif(j === 1) {\n\n\t\t\t\t// if the first random capital is the same as the correct capital...\n\t\t\t\twhile (tempAnswer.answer === game[i].answers[0].answer) {\n\n\t\t\t\t\t// ...get a new random capital and try again\n\t\t\t\t\ttempAnswer = {answer: capitals[Math.floor(Math.random() * capitals.length)],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect: false};\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\n\t\t\t// second time\n\t\t\tif (j === 2) {\n\t\t\t\t\n\t\t\t\t// if the second random capital is the same as the state capital AND first decoy.\n\t\t\t\twhile (tempAnswer.answer === game[i].answers[0].answer ||\n\t\t\t\t\t\t\t\t\ttempAnswer.answer === game[i].answers[1].answer) {\n\n\t\t\t\t\t// get a new random capital\n\t\t\t\t\ttempAnswer = {answer: capitals[Math.floor(Math.random() * capitals.length)],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect: false};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// do it again for the third random capital\n\t\t\tif (j === 3) {\n\n\t\t\t\t// Check all 3 previous elements for duplicates\n\t\t\t\twhile (tempAnswer.answer === game[i].answers[0].answer ||\n\t\t\t\t\t\t\t\t\ttempAnswer.answer === game[i].answers[1].answer ||\n\t\t\t\t\t\t\t\t\ttempAnswer.answer === game[i].answers[2].answer) {\n\n\t\t\t\t\t// get a new one and try again\n\t\t\t\t\ttempAnswer = {answer: capitals[Math.floor(Math.random() * capitals.length)],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisCorrect: false};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// if here, tempAnswer must not be a duplicate\n\t\t\tgame[i].answers.push(tempAnswer);\n\t\t}\n\t}\n}" ]
[ "0.7012983", "0.63013333", "0.62695575", "0.62284845", "0.62284845", "0.61676466", "0.61432225", "0.6088627", "0.6070105", "0.60391235", "0.6024035", "0.60220677", "0.60207564", "0.60188234", "0.59986264", "0.5997301", "0.59849507", "0.59667146", "0.5956831", "0.5934647", "0.59112954", "0.58994615", "0.58923197", "0.5881272", "0.5877745", "0.5856465", "0.5842066", "0.58172846", "0.58169025", "0.5816679", "0.5811826", "0.5803682", "0.5796244", "0.5787733", "0.5778861", "0.57771045", "0.57676667", "0.5766669", "0.57482696", "0.5745811", "0.5745094", "0.572809", "0.5720982", "0.57174814", "0.57084244", "0.5695578", "0.569507", "0.5688058", "0.5686272", "0.56855214", "0.5683664", "0.56786376", "0.5676918", "0.5672344", "0.567015", "0.5660089", "0.5659879", "0.5648644", "0.5639778", "0.5633617", "0.56330687", "0.56314594", "0.5629011", "0.5628455", "0.56215984", "0.5616751", "0.56163424", "0.5615314", "0.56099933", "0.56075704", "0.560665", "0.5603194", "0.5602987", "0.5598179", "0.5592339", "0.55918944", "0.5582747", "0.5569908", "0.5566886", "0.55648816", "0.55647457", "0.55614847", "0.5560158", "0.55577755", "0.555665", "0.55560756", "0.5555787", "0.5555466", "0.5550981", "0.5550085", "0.5548123", "0.5542047", "0.5537094", "0.55351734", "0.5525764", "0.5525477", "0.55165386", "0.55164593", "0.551554", "0.5514516", "0.5508951" ]
0.0
-1
var score = currentWord. display score
function displayFail() { if (fail > 1) { document.getElementById('score').textContent = fail; } else if (fail === 1) { var scoreBoardEle = document.getElementById('score-display'); while(scoreBoardEle.firstChild) { scoreBoardEle.removeChild(scoreBoardEle.firstChild); } var warnEle = document.createElement('span') var warnText = document.createTextNode("Be careful! You only have 1 try left") warnEle.appendChild(warnText) scoreBoardEle.appendChild(warnEle); } else if (fail === 0) { state = 1; var scoreBoardEle = document.getElementById('score-display'); while(scoreBoardEle.firstChild) { scoreBoardEle.removeChild(scoreBoardEle.firstChild); } var warnEle = document.createElement('span') var warnText = document.createTextNode("You have lost! ") warnEle.appendChild(warnText) scoreBoardEle.appendChild(warnEle); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scrabbleScore() {\n console.log(`Currently using : ${scoringAlgorithms[2].name}`);\n\tconsole.log(`The score for your word, ${userWord}, is ${oldScrabbleScoreTotal(userWord)}!`);\n}", "function simpleScore() {\n return simpleScrabbleScorer(userWord);\n}", "function yourScore() {\n return fname + ' scored ' + (mid + final);\n }", "function score_this_term(w) {\r\n\ttotalscore = 0;\r\n\t// note that while we allow words to contain hyphens, the job dictionary array cannot handle them\r\n\tfor(y=3;y<socREC[w].length;y++) { totalscore = totalscore + job_dictionary[socREC[w][y].replace(/[-]+/g,'')]; };\r\n\treturn (totalscore / (socREC[w].length - 3));\r\n}", "function displayScore() {\n displayText(36, score, width / 2, height - 50);\n}", "function score() {\n\treturn `Human: ${playerPoints} Computer: ${computerPoints}`;\n}", "function scrabbleScore(word) {\n\tword = word.toLowerCase();\n\tlet letterPoints = 0;\n\tfor(let i=0; i < word.length; i++){\n\t\tletterPoints += Number(newPointStructure[word[i]]);\n\t}\n\t\t\t\t\treturn letterPoints;\n}", "function score(){\n\tdocument.getElementById('score').innerHTML = \"Score: \" + score;\n}", "function updateScore() {\n\t$(\"#wordsCorrect\").html(\"<h5>Words Guessed Correctly: </h5><h3>\" + scoreCorrect + \"</h3>\");\n\t$(\"#wordsSkipped\").html(\"<h5>Words Skipped: </h5><h3>\" + scoreSkipped + \"</h3>\");\n}", "function logRemainScore(){\r\n\tconsole.log(\"Remaining Word Score:\");\r\n\tconsole.log(wordScore);\r\n}", "function drawScore(){\n document.getElementById('score').innerText = `Human vs Computer: ${score[0]} to ${score[1]}!`\n}", "function score()\n{\n score_obj.text = score_count.ToString();\t\n}", "function getScore(){\n return score\n}", "function simpleScore(word) {\n let letterPoints = word.length;\n for (i = 0; i < word.length; i++) {\n console.log(`\\nPoints for '${word[i]}': ${letterPoints / word.length}'`);\n }\n return letterPoints;\n}", "function scrabbleScore(word){\n word = word.toLowerCase();\n\n let points = 0;\n\n for (let i=0; i<word.length; i++){\n points = points + newPointStructure[word.slice(i,i+1)]\n }\n return points;\n}", "function getCurrentScore(score, counter) { return \"Your current score is \" + score + \" out of \" + counter + \". \"; }", "function updateScore() {\n score += questions[currentQuestionId - 1].worth;\n scoreElement.textContent = score;\n}", "function updateScore() {\n $score.text(score);\n}", "function score() {\r\n\t\tvar score = \"Score:\" + food.score;\r\n\t\tctx.fillStyle = \"#ccc\";\r\n\t\tctx.font = \"20px Lucida Console\";\r\n\t\tctx.fillText(score, d, d);\r\n\t}", "function getWordValue (wordArray) {\n var score = 0;\n for (var i = 0; i < wordArray.length; i++) {\n score += wordArray[i].score;\n }\n return score;\n}", "function displayScore() {\r\n id(\"this-score\").innerText = scoreGot;\r\n id(\"score\").innerText = score;\r\n id(\"max-score\").innerText = maxScore;\r\n }", "scoreWord(word) {\n // console.log(word);\n let score = 0;\n let wordArray = word.toUpperCase().split('');\n for (let char of wordArray) {\n // console.log(`Char ${char} has a score of ${scoreLetters[char]}`);\n score += scoreLetters[char];\n }\n if (wordArray.length >= 7) {\n score += 8;\n }\n return score\n }", "function bonusScore () {\n // Currently, we have two kinds of bonus: Match and Phrase\n var bonus = 0;\n\n // TODO: Yeah, I know we can fail faster here, but it's 3 in the morning\n var firstWord = formWord(state.words[0]);\n var secondWord = formWord(state.words[1]);\n\n // Check for a Match Bonus, where both words are the same\n if (firstWord.toUpperCase() === secondWord.toUpperCase()) {\n bonus += 2 * getWordValue(state.words[0].toUpperCase());\n }\n\n // Check for a Phrase Bonus\n var phrase = firstWord.toLowerCase() + \" \" + secondWord.toLowerCase();\n if (bonusPhrases[phrase]) {\n bonus += config.phraseBonus;\n }\n console.log(\"The phrase bonus result is: \" + bonus);\n return bonus;\n}", "function showScore() {\n $(\"h2\").text(`Score: ${score}`);\n}", "function updateScore() {\n document.getElementById(\"demo9\").innerHTML = \"Score: \" + score;\n }", "_updateScore() {\n\t\tthis._$scoreBoard.textContent= this._score+'';\n\t}", "function renderScore(currentScore){\n currentScore.text(score);\n }", "function updateScore(){\r\n $('.score').text(`Score: ${score}`)\r\n}", "function displayScore() {\n $('#scoreCurrent').text(total);\n}", "function calcscore() {\n var id;\n var scoreofWord = 0;\n var isDoublescoreofWord = false;\n\n $(\"#board div img\").each(function (index) {\n //loops through each tile on board\n id = this.id;\n\n if ($(this).parent().attr(\"id\") == \"spot2\") {\n //spot2 is a double word score\n scoreofWord += ScrabbleTiles[id].value;\n isDoublescoreofWord = true;\n } else if ($(this).parent().attr(\"id\") == \"spot6\") {\n //spot6 is a triple letter score\n scoreofWord += ScrabbleTiles[id].value * 3;\n } else {\n scoreofWord += ScrabbleTiles[id].value;\n }\n });\n //double word tile\n if (isDoublescoreofWord) {\n scoreofWord = scoreofWord * 2;\n }\n\n return scoreofWord;\n}", "function displayScore(){\n document.getElementById('score').innerHTML = 'Score: '+ score;\n}", "function drawScore() {\n document.getElementById('score').innerText = score.toString();\n }", "function wordScore(word, scoreList){\n\tif (word[0] == undefined){\n\t\treturn 0;\n\t} else if (word[0] == scoreList[0][0]){\n\t\treturn (scoreList[0][1]) + wordScore(word.slice(1), scoreList);\n\t} else {\n\t\treturn wordScore(word, scoreList.slice(1).concat([scoreList[0]]));\n\t}\n}", "function outputResults(score) {\n\n\n}", "function yourScore(){\n finalScore.innerHTML = score; \n}", "function getCurrentScore (score, counter) {\n return ' Your current score is ' + score + ' out of ' + counter + '. '\n}", "function showScore(){\n\t\t$(\"#score\").html(score+\"/6\");\n\t}", "function simpleScore(word) {\n\n let simplestScore = word.length;\n return simplestScore;\n\n}", "function displayNewScore() {\n score++;\n $('.score').text(score);\n}", "function displayScore() {\n let currentScore = document.getElementById(\"scoreboardScore\");\n currentScore.textContent = `${HURWin} - ${AIRWin}`;\n}", "highestScoringWord() {\n // TODO: test and implement\n return this.at(-1);\n }", "function showWord(value){\n\n let word = value.toLowerCase();\n let words = document.getElementsByName(word);\n let wordFound = false;\n let occurences = 0;\n\n for(var letter = 0; letter < currentWord.length; letter++){\n if(currentWord[letter] === word.toLowerCase()){\n wordFound = true;\n ++ occurences;\n }\n }\n\n for(var x = 0; x < words.length; x++){\n words[x].style.color = \"black\";\n }\n\n updateScoreGuesses(wordFound, occurences);\n}", "function updateScore() {\n scoreElement.textContent = `Score: ${score}`;\n}", "function updateScore() {\n scoreElement.textContent = `Score: ${score}`;\n}", "function oldScrabbleScorer(word) {\n\tword = word.toUpperCase();\n\tlet letterPoints = \"\";\n\tlet totalPoints = 0;\n \n\tfor (let i = 0; i < word.length; i++) {\n \n\t for (const pointValue in oldPointStructure) {\n \n\t\t if (oldPointStructure[pointValue].includes(word[i])) {\n\t\t\ttotalPoints += Number(pointValue);\n\t\t\tletterPoints += `Points for '${word[i]}': ${pointValue}\\n`\n\t\t }\n \n\t }\n\t}\n\tletterPoints += `Total points for word: ${totalPoints}.\\n`;\n\treturn totalPoints;\t\t// Used to be \"return letterPoints\"\n }", "function displayScore() {\n\tctx.font = \"60px sans-serif\";\n\tctx.textAlign = \"end\";\n\tctx.fillStyle = \"white\";\n\tctx.fillText(points, 550, 55);\n}", "function updateScore() {\n document.querySelector(\"#score\").innerHTML = \"Score: \" + score;\n }", "function getScore() {\n\treturn parseInt(currentScore);\n}", "function ttt_score(score) {\n var won_text = document.querySelector(\"#ttt_score\");\n won_text.innerHTML = score;\n}", "function scoreRender(score) {\r\n document.querySelector(\".score-text\").textContent = `${score}/15`;\r\n}", "function scoreUpdate(){\r\n document.getElementById('score').innerText = piece.score;\r\n }", "function displayScore(){\n push();\n textFont(`Blenny`);\n fill(tileWhite.fill.r, tileWhite.fill.g, tileWhite.fill.b); // Same white as white tiles\n textSize(40);\n text(`${score} points`, 1050, 150);\n pop();\n}", "function updateScore () {\n score++;\n $('.score').text(score);\n}", "function displayScore() {\n \tstop();\n \tvar score = $('<p>',{id: 'question'});\n\n \tvar numCorrect = 0;\n \tfor (var i = 0; i < selections.length; i++) {\n \t\tif (selections[i] === questions[i].correctAnswer) {\n \t\t\tnumCorrect++;\n \t\t}\n \t}\n\n \tscore.append('You scored: ' + numCorrect + ' out of ' +\n \t\tquestions.length + ' questions.');\n \treturn score;\n }", "printScore() {\n if (this.gameOver()) {\n return `${this.getLeadingPlayer()} wins the game`;\n }\n if (this.deuce()) {\n return 'Deuce';\n }\n if (this.inAdvantage()) {\n return `${this.getLeadingPlayer()} has the advantage`;\n }\n return `Score is ${this.scoreNames[this.playerOneScore]} - ${this.scoreNames[this.playerTwoScore]}`;\n }", "function Score() { }", "function updateScore () {\n incrementScore ();\n $('.js-score').text(score);\n}", "function displayScore() {\n // Create the score\n $('.score').append(`<b>${followers}</b><p>Followers</p>`);\n // Create the post counter\n $('.numPosts').append(`<b>${posts.length}</b><p>Posts</p>`);\n // Create the follower counter\n $('.following').append(`<b>644</b><p>Following</p>`);\n}", "function updateScore() {\n score++;\n $('.score').text(score);\n}", "function updateScore() {\n score++;\n $('.score').text(score);\n}", "get score() {\n return this._score;\n }", "function updateScore(){\n scoreCount.innerText=score;\n}", "function update() {\n element.winsDoc.textContent = \"Wins: \" + score.win.toString();\n element.losesDoc.textContent = \"Losses: \" + score.lose.toString();\n element.guesses.textContent = \"Guesses Left: \" + score.letterGuess.toString();\n element.wordGuess.textContent = guessedWord;\n}", "displayBestWord(){\n var bestValue = pathValues[0].value;\n var bestWord = '';\n\n pathValues.forEach(function(pathValue){\n if(pathValue.value > bestValue){\n bestValue = pathValue.value;\n bestWord = pathValue.word;\n }\n });\n\n $('#mazeSolution').html(\n 'Best word is ' + bestWord + ' at ' + bestValue + ' points'\n );\n }", "function screenScore(score) {\n var element = document.getElementById(\"scor\");\n element.innerHTML = \"Score: \"+score;\n}", "function userScore() {\n $(\"#yourscore\").html(yourScore);\n console.log(\"yourscore \" + yourScore)\n console.log(\"crystalscore \" + crystalScore)\n }", "function simpleScore(word) {\n\tword = word.toUpperCase();\n word = word.trim();\n\tlet simplePoints = 0;\n simplePoints = Number(simplePoints);\n \n\tfor (let i = 0; i < word.length; i++) {\n \n\t for (const pointValue in oldPointStructure) {\n \n\t\t if (oldPointStructure[pointValue].includes(word[i])) {\n\t\t\tsimplePoints += 1\n\t\t }\n \n\t }\n\t}\n\treturn simplePoints;\n }", "function scrabbleScore(word) {\n word = word.toUpperCase();\n let letterScore = 0;\n\n for (let i = 0; i < word.length; i++) {\n\t for (const pointValue in newPointStructure) {\n \n if (pointValue.includes(word[i])) {\n letterScore += Number(newPointStructure[pointValue]) \n }\n \n\t }\n\t}\n // console.log({letterPoints}); //for testing\n\treturn letterScore;\n\n}", "function displayscores() {\n\tlet timeto = endTime;\n\tif(!timeto)\n\t\ttimeto = Date.now();\n\tlet formattime = formatTime(timeto-startTime);\n\tlet t = statstext.replace(\"$score\",(score/100 | 0)).replace(\"$level\",\"\" + diffToLevel()).replace(\"$health\",health).replace(\"$kills\",kills).replace(\"$time\",formattime).replace(\"$difficulty\",difficultyGame);\n\tif(difficultyGame == \"easy\") {\n\t\tt = t.replace(\"Health\",\"Amount of Damage received\");\n\t}\n\ttext(t,0,0);\n}", "function displayscore(){\n \t$('#playerscore').html('Correct Answer: ' + correctanswer + \n \t\t '<br>Wrong Answer: ' + wronganswer +\n '<br>Unanswer: ' + unanswered);\n }", "get score() {\n return this._score;\n }", "_incScore() {\n this.score++;\n this.scoreElem.innerText = \"Score: \" + this.score;\n }", "function displayScore() {\n let type = \"\";\n var score = $('<p>',{id: 'question'});\n let intro = 0, extro = 0, intu = 0, sens = 0, think = 0, feel = 0, judge = 0, perceive = 0;\n for (let i = 0; i < pref.length; i++){\n console.log(pref[i])\n switch (pref[i]){\n case 'i':\n intro++;\n break;\n case 'e':\n extro++;\n break;\n case 'n':\n intu++;\n break;\n case 's':\n sens++;\n break;\n case 't':\n think++;\n break;\n case 'f':\n feel++;\n break;\n case 'j':\n judge++;\n break;\n case 'p':\n perceive++;\n break;\n }\n }\n if (intro > extro){\n type += \"I\"\n }else{\n type += \"E\"\n }\n\n if (intu > sens){\n type += \"N\"\n }else{\n type += \"S\"\n }\n\n if (think > feel){\n type += \"T\"\n }else{\n type += \"F\"\n }\n\n if (judge > perceive){\n type += \"J\"\n }else{\n type += \"P\"\n }\n score.append(\"According to your response, you are most likely \" + type);\n return score;\n }", "function showScore() {\n var scoreDiv = document.getElementById(\"scoreOutput\");\n var span = '<span id=\"score\">' + score + '</score>';\n scoreDiv.innerHTML = \"Score: \" + span;\n }", "function updateScore(){\n score++\n if(score === 10){\n result.textContent = 'Wow! 10/10 You are the snake genius!'\n } else if(score === 9 ){\n result.textContent= '9/10 Amazing!'\n } else if( score === 8){\n result.textContent = '8/10 Great job!'\n } else if( score === 7){\n result.textContent= '7/10 Good job!'\n }else if(score === 6){\n result.textContent = '6/10 Good Job!'\n }else if(score === 5){\n result.textContent = '5/10 Looks like you need to learn!'\n }else if(score === 4){\n result.textContent = '4/10 Looks like you need to learn!'\n }else if(score === 3){\n result.textContent = '3/10 Looks like you need to learn!'\n }else if(score === 2){\n result.textContent= '2/10 Looks like you need to learn!'\n }else if(score === 1){\n result.textContent = '1/10 Looks like you need to learn!'\n }else if(score === 0){\n result.textContent = '0/10 FAIL!'\n }\n}", "function updateScore(currentScore) {\n $('#score').text(currentScore);\n}", "function updateScore() {\n score++;\n\n $('.score').text(score);\n}", "function updateScore () {\n score++;\n $('.js-score').text(`${score} `);\n console.log(`updateScore ran and the score is ${score}`);\n}", "function get_text_score(text) {\n\tvar punctuationless = text.replace(/[\\.,-\\/#!$%\\^&\\*;:{}=\\-_`~()]/g, \" \");\n\t// S(text).stripPunctuation().s; //My string full of punct\n\tvar words = punctuationless.toLowerCase().split(' ');\n\tvar sum = 0;\n\t// var unknown_words = [];\n\t_.each(words, function(word) {\n\t\tif (word in afinn.words) {\n\t\t\tsum += afinn.words[word];\n\t\t} else {\n\t\t\t// unknown_words.push(word);\n\t\t}\n\t});\n\tconsole.log('SCORE', text, sum);\n\n\t/*\n\tunknown_words = _.uniq(unknown_words);\n\n\t_.each(unknown_words, function(unknown_word) {\n\t\t// console.log('afinn.unknown_words: ',afinn.unknown_words);\n\t\tif (afinn.unknown_words.hasOwnProperty(unknown_word)) {\n\t\t\tconsole.log('HAS PROPERTY: ', unknown_word);\n\t\t\tafinn.unknown_words[unknown_word].push(sum);\n\t\t} else {\n\t\t\tconsole.log('NO PROPERTY: ', unknown_word);\n\t\t\tafinn.unknown_words[unknown_word] = [sum];\n\t\t\tconsole.log('unknown_words: ', unknown_words);\n\t\t}\n\t});\n\t*/\n\treturn sum;\n}", "function showCurrentScore() {\n score1.innerHTML = `<p><strong>${gameData.score[0]}</strong><\\p>`;\n score2.innerHTML = `<p><strong>${gameData.score[1]}</strong><\\p>`;\n }", "function renderScore(){\r\n\tscore.innerHTML = \"<p>Score: \" + qscore + \"</p>\";\r\n}", "function showFinalScore() {\n finalScore.textContent = \"Your score: \" + userScore;\n}", "function Score() {\n\t ctx.font = \"20px Arial\";\n\t ctx.fillStyle = pink;\n\t ctx.fillText(\"Score: \"+score, 0, 20);\n}//Score", "function displayScore() {\n $(\"#score\").text(\"Score:\" + score)\n $(\"#incorrect\").text(\"Incorrect:\" + incorrect)\n}", "getScore()\r\n\t{\r\n\t\treturn this._score;\r\n\t}", "function update_text() {\r\n textSize(32)\r\n text(\"Score : \" + score, 0, 40); \r\n }", "function updateDisplay() {\n document.getElementById(\"counterWins\").innerText = wins;\n var guessingWordText = \"\";\n for (var i = 0; i < guessingWord.length; i++) {\n guessingWordText += guessingWord[i];\n }\n document.getElementById(\"currentWord\").innerText = guessingWordText;\n document.getElementById(\"counterLives\").innerText = remainingGuesses;\n document.getElementById(\"counterGuessed\").innerText = guessedLetters;\n}", "function calcScore() {\n console.log(\"incorrect answers: \" + wrongCount);\n console.log(\"correct answers: \" + correctCount);\n let totalAttempts = wrongCount + correctCount;\n let score = (correctCount / totalAttempts) * 100;\n console.log(\"total score: \" + score);\n // textScore = toString(score);\n let printScore = $(\"<h2>\").text(score);\n $('.displayScore').append(printScore);\n\n }", "function showWords(){\n return profanities;\n }", "drawScore() {\n\t\tthis.ctx.font = '500 16px Noto Sans JP';\n\t\tthis.ctx.fillStyle = 'white';\n\t\tthis.ctx.fillText(`Score : ${this.score}`, 10, 30);\n\t\tthis.ctx.fillText(`Highest Score : ${this.highestScore}`, 150, 30);\n\t}", "function printScore() {\n scoreboardRiktig.innerHTML = `Du har klikket riktig: ${scoreRiktig} ganger`;\n scoreboardFeil.innerHTML = `Du har klikket feil: ${scoreFeil} ganger`;\n scoreboardPoints.innerHTML = `Poeng: ${scorePoints}`;\n}", "function incScore() {\n currentScore++;\n $(\".score\").text(currentScore);\n}", "function displayScore() {\r\n var score = $('<p>',{id: 'question'});\r\n \r\n var numCorrect = 0;\r\n for (var i = 0; i < selections.length; i++) {\r\n if (selections[i] === questions[i].correctAnswer) {\r\n numCorrect++;\r\n }\r\n }\r\n \r\n var result = numCorrect*100/questions.length;\r\n\tresult = Math.round(result);\r\n\tscore.append('You scored ' + result + ' % ');\r\n\t\t\t \r\n return score;\r\n }", "function updateScore() {\n\tdocument.getElementById(\"score\").innerHTML = score;\n}", "function game_score(score) {\n var score_text = document.querySelector(\"#score\");\n score_text.innerHTML = score;\n}", "function generateUnderScore() {\n for (var i=0; i < chosenWord.length; i++) {\n underScore.push('_');\n $underScore.textContent = underScore.join(' ');\n };\n}", "function displayResults() {\n finalScore.innerHTML += `<h3>Your score is ${score}</h3>`;\n const sentences = {\n 0: \"Wax on, wax off NOOB\",\n 1: \"Wax on, wax off NOOB\",\n 2: \"Wax on, wax off NOOB\",\n 3: \"Almost there, Baby-IronHacker!\",\n 4: \"Almost there, Baby-IronHacker!\",\n 5: \"Welcome Home WebDev ! \",\n 6: \"Welcome Home WebDev ! \",\n 7: \" YEAH, Welcome to you Ironhacker!\",\n 8: \" YEAH, Welcome to you IronHacker!\",\n 9: \" Congratulations ! Biggest IRONHACKER Ever ! \",\n 10: \"Congratulations ! Biggest IRONHACKER Ever !\"\n };\n scoreSentences.innerHTML += `<p>${sentences[score]}</p>`;\n}", "function increaseScore() {\n score++;\n $(\".score\").text(score);\n}", "function initialScore () {\n score = 0;\n $(\"#current-score\").text(score);\n}", "function displayScores() {\n score0El.innerText = score0;\n score1El.innerText = score1;\n }", "displayWordInfo() {\r\n this.displayHangman();\r\n this.displayLives();\r\n this.displayLetters();\r\n this.displayLettersToGuess();\r\n }" ]
[ "0.76759154", "0.7562457", "0.741675", "0.733921", "0.7164103", "0.71154153", "0.7046352", "0.7038931", "0.7019699", "0.7007606", "0.6973773", "0.69712704", "0.6969135", "0.6957746", "0.69251734", "0.69147706", "0.69136447", "0.68994874", "0.68867", "0.6885498", "0.68832546", "0.68437254", "0.67962354", "0.67867464", "0.67835325", "0.67777145", "0.67750305", "0.67617464", "0.6761511", "0.67584276", "0.67424077", "0.673891", "0.673695", "0.67341626", "0.67322844", "0.6731104", "0.67291534", "0.67171615", "0.6708184", "0.67055106", "0.6685313", "0.66795236", "0.6665944", "0.6665944", "0.6663361", "0.66631514", "0.6657207", "0.6639564", "0.66356033", "0.6627677", "0.6626326", "0.66239434", "0.6607293", "0.6602007", "0.6595231", "0.65902835", "0.65891", "0.6586086", "0.6584519", "0.6584519", "0.6574227", "0.6570798", "0.6568497", "0.6564429", "0.65628874", "0.6558767", "0.6553674", "0.6538213", "0.6535013", "0.6534279", "0.65303", "0.65270996", "0.65267336", "0.65258914", "0.65103656", "0.6509091", "0.6495223", "0.6487814", "0.6486933", "0.64847964", "0.64805675", "0.6479198", "0.64761764", "0.64690816", "0.6469065", "0.64685917", "0.6466494", "0.6459015", "0.645848", "0.64531016", "0.6452296", "0.6451016", "0.64493257", "0.64473766", "0.64437884", "0.644142", "0.64390016", "0.6436245", "0.6431168", "0.64275163", "0.6426882" ]
0.0
-1
function to dynamically display the question on board
function displayWord(wordAnswerInst) { var questionEl = document.getElementById("question"); questionEl.textContent = wordAnswerInst.question; console.log("hello"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayQuestion() {\n\t\t\tstartTime30();\t\n\t\t\t$(\"#question\").html(eachone[count].question);\n\t\t\t$(\"#option1\").html(eachone[count].option1.answer);\n\t\t\t$(\"#option2\").html(eachone[count].option2.answer);\n\t\t\t$(\"#option3\").html(eachone[count].option3.answer);\n\t\t\t$(\"#option4\").html(eachone[count].option4.answer);\n\t\t\t$(\"#okButton\").html(\"\");\n\t\t}", "function showQuestion() {\n // quiz questions along with possible answers\n questionEl.innerHTML = questions[currentQuesIndex].question;\n answerA.innerHTML = questions[currentQuesIndex].choiceA;\n answerB.innerHTML = questions[currentQuesIndex].choiceB;\n answerC.innerHTML = questions[currentQuesIndex].choiceC;\n\n}", "function displayQuestion() {\n $(\".questions\").text(currentQuestionData.question);\n $(\".answer-1\").text(currentQuestionData.otherAnswers[0]);\n $(\".answer-2\").text(currentQuestionData.otherAnswers[1]);\n $(\".answer-3\").text(currentQuestionData.otherAnswers[2]);\n $(\".answer-4\").text(currentQuestionData.otherAnswers[3]);\n }", "function displayQuestion() {\n\n questionsEl.textContent = quizQuestions[currentQuestionIndex].title\n answer1El.textContent = quizQuestions[currentQuestionIndex].choices[0];\n answer2El.textContent = quizQuestions[currentQuestionIndex].choices[1];\n answer3El.textContent = quizQuestions[currentQuestionIndex].choices[2];\n answer4El.textContent = quizQuestions[currentQuestionIndex].choices[3];\n}", "function displayQuestion() {\n let question = STORE.questions[STORE.currentQuestion];\n updateScoreAndQuestionCounter();\n\n $(\"main\").html(generateQuestionTemplate(question.question));\n showOptions();\n $(\"#next\").hide();\n}", "function showQuestion(){\n var q = questions[runningQuestion];\n questionContainer.innerHTML = q.question;\n a.innerHTML = q.answerA;\n b.innerHTML = q.answerB;\n c.innerHTML = q.answerC;\n d.innerHTML = q.answerD;\n}", "function displayQuestion() {\n hideResults();\n $(\"#answer\").hide();\n $(\"#time\").show();\n showDiv();\n $(\"#question\").html(question[questionCount]);\n $(\"#choice1\").html(firstChoice[questionCount]);\n $(\"#choice2\").html(secondChoice[questionCount]);\n $(\"#choice3\").html(thirdChoice[questionCount]);\n $(\"#choice4\").html(fourthChoice[questionCount]);\n }", "display() {\n document.querySelector(\"#question\").innerHTML = this.question;\n for (let i = 0; i < 4; i++)\n showAnswer = selectValue(showAnswer, 4);\n answer1.innerHTML = this.answers[showAnswer[0]];\n answer2.innerHTML = this.answers[showAnswer[1]];\n answer3.innerHTML = this.answers[showAnswer[2]];\n answer4.innerHTML = this.answers[showAnswer[3]];\n }", "function questionContent() {\n\t\t// a for loop would be cool here...\n \t$(\"#gameScreen\").append(\"<p><strong>\" + \n \t\tquestions[questionCounter].question + \n \t\t\"</p><p class='choices'>\" + \n \t\tquestions[questionCounter].choices[0] + \n \t\t\"</p><p class='choices'>\" + \n \t\tquestions[questionCounter].choices[1] + \n \t\t\"</p><p class='choices'>\" + \n \t\tquestions[questionCounter].choices[2] + \n \t\t\"</p><p class='choices'>\" + \n \t\tquestions[questionCounter].choices[3] + \n \t\t\"</strong></p>\");\n\t}", "function questionContent() {\n\t\t// a for loop would be cool here...\n \t$(\"#gameScreen\").append(\"<p><strong>\" + \n \t\tquestions[questionCounter].question + \n \t\t\"</p><p class='choices'>\" + \n \t\tquestions[questionCounter].choices[0] + \n \t\t\"</p><p class='choices'>\" + \n \t\tquestions[questionCounter].choices[1] + \n \t\t\"</p><p class='choices'>\" + \n \t\tquestions[questionCounter].choices[2] + \n \t\t\"</p><p class='choices'>\" + \n \t\tquestions[questionCounter].choices[3] + \n \t\t\"</strong></p>\");\n\t}", "function displayQuestions() {\n //gets the current question from global variable currentQuestion\n // display a question\n currentQuestion++;\n $(\".questions\").text(triviaQuestions[currentQuestion].questions);\n }", "function showQuestion() {\n\t$('#answer').text(''); // Reset user input\n\t$('#answer').focus();\n\t$('#question').text(questionNumber + '. ' + Questions[questionIndex][0]); // Print question\n\tquestionNumber++;\n}", "function questionContent() {\n \n $(\"#gameScreen\").append(\"<p><strong>\" +\n questions[questionCounter].question + \"</p><p class= 'choices'>\" +\n questions[questionCounter].choices[0] + \"</p><p class='choices'>\" + \n questions[questionCounter].choices[1] + \"</p><p class='choices'>\" + \n questions[questionCounter].choices[2] + \"</p><p class='choices'>\" + \n questions[questionCounter].choices[3] + \"</strong></p>\");\n \n }", "function displayQuestion(q_id){\n var map = getMap();\n rightPane.innerHTML = templates.renderExpandedQuestion(map[q_id]);\n }", "function showQuestion(question) {\n questionEl.innerText = question.question;\n}", "function showQuestion() {\n if (questionCount === questionsObj.length) {\n stop();\n }\n else {\n $(\"#question\").html(questionsObj[questionCount].question);\n $(\"#answer1\").html(questionsObj[questionCount].choices[0]);\n $(\"#answer2\").html(questionsObj[questionCount].choices[1]);\n $(\"#answer3\").html(questionsObj[questionCount].choices[2]);\n $(\"#answer4\").html(questionsObj[questionCount].choices[3]);\n questionTime = 5;\n }\n }", "function showQuestion() {\n\n questionSpot.textContent = questions[questionIndex].question;\n showAnswers(); \n \n \n}", "function renderQuestion() {\n if (questionNum < STORE.length) {\n renderQuestAns(questionNum);\n } else {\n $(\"questionNumber\").text(7);\n results();\n }\n}", "function showQuestion() {\n let q = myQuestions[runningQuestion];\n question.innerHTML = q.question;\n choiceA.innerHTML = q.choiceA;\n choiceB.innerHTML = q.choiceB;\n choiceC.innerHTML = q.choiceC;\n}", "function displayQuestion() {\n questionText.textContent = currentQuestionObject.question;\n for (i=0; i<4; i++) {\n answerButtons[i].textContent = currentQuestionObject.choices[i]\n }\n}", "function displayQuestion() {\n\tvar question='', choice='', choices='', i=0;\n\tquestion = questions[questionCounter].question;\n\tchoiceArray = questions[questionCounter].choices;\n\t \n\tfor (var i in choiceArray){\n\t\t choice = questions[questionCounter].choices[i];\n\t\t choices += \"<p class='choices'>\" + choice + \"</p>\";\n\t}\n $(\"#QuizArea\").append(\"<p><strong>\" + question + \"</strong></p>\" + choices );\n}", "function displayQuestion() {\n\n $(\"#question\").html(questionID.question);\n\n\n\n // Displays question's possible answers.\n\n displayQuestionAnswers();\n\n}", "function questionContent() {\n \t$(\".gameScreen\").append(\"<p><strong>\" + \n \t\tquestions[questionCounter].question + \n \t\t\"</p><p class='choices'>\" + \n \t\tquestions[questionCounter].choices[0] + \n \t\t\"</p><p class='choices'>\" + \n \t\tquestions[questionCounter].choices[1] + \n \t\t\"</p><p class='choices'>\" + \n \t\tquestions[questionCounter].choices[2] + \n \t\t\"</p><p class='choices'>\" + \n \t\tquestions[questionCounter].choices[3] + \n \t\t\"</strong></p>\");\n\t}", "function displayQuestion() {\n \n //create a variable nextQuestion equal to the question element at questionIndex in questionArray\n var nextQuestion = questionArray[questionIndex].question;\n \n //Display the question on the screen by using the id #questionDisplayed\n $(\"#questionDisplayed\").text(nextQuestion);\n\n}", "function displayQs() {\n\tfor (i = 1; i <=10; i++) {\t\n\t\t$(\"#displayQ\" + i).html(\"<h2>\" + trivia[currentQuestion].question + \"</h2>\");\n\t\tcurrentQuestion++;\n\t}\n}", "function displayQuestion() {\n var q = questionsArr[currentQuestion];\n\n question.innerHTML = \"<p>\" + q.question + \"</p>\";\n choiceA.innerHTML = q.choiceA;\n choiceB.innerHTML = q.choiceB;\n choiceC.innerHTML = q.choiceC;\n choiceD.innerHTML = q.choiceD;\n}", "function displayQ() {\n $(\"#aa\").html(\"\");\n $(\"#qa\").css(\"display\", \"grid\");\n $(\"#complete\").css(\"display\", \"none\");\n $(\"#timesup\").css(\"display\", \"none\");\n $(\"#timer\").css(\"display\", \"inline\");\n $(\"#time\").text(time);\n $(\"#correct\").css(\"display\", \"none\");\n $(\"#incorrect\").css(\"display\", \"none\");\n clicked = false;\n if (qNum < 21) {\n qTimer = setInterval(function () {\n if (time > 0) {\n time--\n $(\"#time\").text(time);\n } else if (time === 0) {\n clearTimer();\n timesUp();\n time = 15;\n }\n }, 1000);\n $(\"#question\").text(eval(\"q\" + qNum + \".question\"));\n for (var j = 0; j < 4; j++) {\n var newDiv = $(\"<button>\");\n newDiv.text(eval(\"q\" + qNum + \".answers[\" + j + \"]\"));\n newDiv.attr(\"id\", \"choices\");\n $(\"#aa\").append(newDiv);\n }\n } else if (qNum === 21) {\n complete();\n }\n }", "function showQuestion() {\n $('main').html(generateQuestion());\n}", "function displayQuestion() {\n\t$(\"#question\").html(questionID.question);\n\n\t// Displays question's possible answers.\n\tdisplayQuestionAnswers();\n}", "function showQuestions() {\n $(questionText).text(quizObject[index].question);\n $(optionA).text(quizObject[index].answerA);\n $(optionB).text(quizObject[index].answerB);\n $(optionC).text(quizObject[index].answerC);\n $(optionD).text(quizObject[index].answerD);\n }", "function displayQuestion() {\n let i = questions[currentQuestion];\n question.innerHTML = i.question;\n answerA.innerHTML = i.answerA;\n answerB.innerHTML = i.answerB;\n answerC.innerHTML = i.answerC;\n answerD.innerHTML = i.answerD;\n console.log();\n}", "function showQuestion() {\n clearSection();\n currentQuestion = questions[questionNum];\n var loc = questionNum + 1;\n questionStat.textContent = \"Question: \" + loc + \"/\" + questionLength;\n var question = document.createElement(\"h2\");\n question.textContent = currentQuestion.questionPrompt;\n quizEl.appendChild(question);\n showQuestionOptions();\n}", "function displayQuestion(arg) {\n setTimer();\n $(\"#alerts\").hide();\n $(\"#questionDisplay\").html(arg.question);\n $(\"#choice1\").html(arg.choices[0]);\n $(\"#choice2\").html(arg.choices[1]);\n $(\"#choice3\").html(arg.choices[2]);\n $(\"#choice4\").html(arg.choices[3]); \n }", "function displayQuestions(questionNum) {\n var questionLine = $(\"<div></div>\").text(trivia[questionNum].question );\n var choice1Line = $(\"<div></div>\").text(trivia[questionNum].choices[0] );\n var choice2Line = $(\"<div></div>\").text(trivia[questionNum].choices[1] );\n var choice3Line = $(\"<div></div>\").text(trivia[questionNum].choices[2] );\n var choice4Line = $(\"<div></div>\").text(trivia[questionNum].choices[3] );\n\n trivia[0].choices\n $(\"#insertHere\").append(questionLine); \n $(\"#insertHere\").append(choice1Line); \n $(\"#insertHere\").append(choice2Line); \n $(\"#insertHere\").append(choice3Line); \n\n $(\"#insertHere\").append(choice4Line); \n\n alert(trivia[0].question + trivia[0].choices[trivia[0].answer] );\n }", "function displayQuestion() {\n questionBox.textContent = myQuestions[questionIndex].question\n displayAnswers()\n}", "function showQ() {\n\t$question.show();\n}", "function showQuestions(passQuestion) {\n questionEl.innerText = passQuestion.question;\n answerBtn1.innerText = passQuestion.answers[0].text;\n answerBtn2.innerText = passQuestion.answers[1].text;\n answerBtn3.innerText = passQuestion.answers[2].text;\n answerBtn4.innerText = passQuestion.answers[3].text;\n}", "function displayQuestion() {\n let q = questions[currentQuestion];\n question.innerHTML = q.question;\n btnA.innerHTML = q.choiceA;\n btnB.innerHTML = q.choiceB;\n btnC.innerHTML = q.choiceC;\n btnD.innerHTML = q.choiceD\n}", "function displayQuestionAnswer(question){\n\t\t$(\"#questionResponse\").text(question);\n\t\tcurrentAnswer = currentTopicChoice[currentQuestion][0];\n\t\tcurrentOptions = currentTopicChoice[currentQuestion][1];\n\t\tcurrentAnswerImage = currentTopicChoice[currentQuestion][2];\n\n\t\t//Build the button for all options proposed\n\t\tBuildOptionButtons(currentOptions);\n\n\t}", "function showQuestion(question) {\n questionElement.innerText = question.question\n}", "function showQuestion(){\n let listQuestion = theQuestions[questionIndex].question\n placeQuestion.textContent = listQuestion\n questionEl.appendChild(placeQuestion)\n \n //show answers as buttons\n function showAnswers(){\n let answerA = theQuestions[questionIndex].answer[0].list\n let answerB = theQuestions[questionIndex].answer[1].list\n let answerC = theQuestions[questionIndex].answer[2].list\n let answerD = theQuestions[questionIndex].answer[3].list\n btnTextA.textContent = answerA\n btnTextB.textContent = answerB\n btnTextC.textContent = answerC\n btnTextD.textContent = answerD\n multChoiceA.appendChild(btnTextA)\n multChoiceB.appendChild(btnTextB)\n multChoiceC.appendChild(btnTextC)\n multChoiceD.appendChild(btnTextD)\n }\n\n showAnswers()\n }", "function showQuestions() {\n if (quizBank.length == questionCounter) {\n endQuiz();\n } else {\n questionDisplay.innerText = quizBank[questionCounter].question;\n showAnswers();\n }\n}", "function showQuestions() {\n DOMSelectors.quizQuestion.innerHTML = questions[index].question;\n DOMSelectors.choice1.innerHTML = questions[index].choices[0];\n DOMSelectors.choice2.innerHTML = questions[index].choices[1];\n DOMSelectors.choice3.innerHTML = questions[index].choices[2];\n DOMSelectors.choice4.innerHTML = questions[index].choices[3];\n}", "function displayQuestions() {\n // Show questions starting with question one\n var displayedQuestion = gameQuestionEl.innerHTML = questions[currentQuestion].question;\n // Console log displayed question\n console.log(\"Displayed question: \", displayedQuestion);\n // Display each answer choice for user to select from\n choiceA.innerHTML = questions[currentQuestion].choices[0];\n choiceB.innerHTML = questions[currentQuestion].choices[1];\n choiceC.innerHTML = questions[currentQuestion].choices[2];\n choiceD.innerHTML = questions[currentQuestion].choices[3];\n}", "function print_question(question){\r\n var parent_place = document.getElementById('reponses');\r\n var question_place = document.createElement('div');\r\n question_place.setAttribute('id', 'qplace');\r\n var to_show = ` \r\n <p> Alors mon petit, ta question est donc: ${question} </p> \r\n <p> Je dois réfléchir </p>\r\n <p>\r\n <img src=\"http://vip-identity-ui.s3-website-us-east-1.amazonaws.com/latest/images/loader.gif\" alt=\"\" />\r\n </p>\r\n `;\r\n question_place.innerHTML = to_show\r\n parent_place.append(question_place);\r\n scrollDown();\r\n}", "function renderQuestion(){\n\n // Create a variable to hold the index\n let q = questions[runningQuestion];\n \n // Show the question\n question.html(q.question);\n\n // Show the choices\n choiceA.html(q.choiceA);\n choiceB.html(q.choiceB);\n choiceC.html(q.choiceC);\n // choices.show();\n}", "function DisplayQues(quesarr, optarr, index) {\n document.querySelector(\".questionNoBox\").innerHTML = \"Question no \" + count;\n document.querySelector(\".questionBox\").innerHTML = quesarr[index];\n document.querySelector(\"#opt1\").innerHTML = optarr[index][0];\n document.querySelector(\"#opt2\").innerHTML = optarr[index][1];\n document.querySelector(\"#opt3\").innerHTML = optarr[index][2];\n document.querySelector(\"#opt4\").innerHTML = optarr[index][3];\n}", "function renderQuestions() {\n var questionsIndexLength = questions.length - 1;\n if (index <= questionsIndexLength) {\n document.getElementById(\"question\").innerHTML = questions[index].title;\n renderQuestionChoices();\n }\n quizOver();\n}", "function displayQuestion() {\n formQuestion.textContent = questions[currentQuestion].question;\n answer1.textContent = \" 1. \" + questions[currentQuestion].answers[1];\n answer2.textContent = \" 2. \" + questions[currentQuestion].answers[2];\n answer3.textContent = \" 3. \" + questions[currentQuestion].answers[3];\n answer4.textContent = \" 4. \" + questions[currentQuestion].answers[4];\n}", "function showQuestion() {\n // automatically closes question party dropdown\n questionPartyDropdown.style.display = \"none\";\n partyIsOpen = false;\n\n // removes active styling on buttons\n eensBtn.classList.remove(\"active\");\n noneBtn.classList.remove(\"active\");\n oneensBtn.classList.remove(\"active\");\n\n // if the question has already been answered\n if(answers.length >= index && answers[index] != undefined && answers[index].answer != '') {\n\n // get button and apply active styling to the previous answered questions\n var prevSelectedBtn = document.getElementById(answers[index].answer);\n prevSelectedBtn.classList.add(\"active\");\n }\n\n // shows the current data\n questionTopic.innerHTML = (index + 1) + \". \" + subjects[index]['title'];\n questionInfo.innerHTML = subjects[index]['statement'];\n\n // will be called to generate all parties at the question page and display their side on the topic (function is in generation.js)\n generateParties();\n}", "function showQuetions(index) {\r\n document.getElementById(\"question-id\").innerHTML = questions[index];\r\n \r\n}", "function renderQuestion (){\n var q = questions[runningQuestion];\n\n question.innerHTML = \"<p>\" + q.question +\"<p>\"\n choiceA.innerHTML = q.choiceA;\n choiceB.innerHTML = q.choiceB;\n choiceC.innerHTML = q.choiceC;\n // choiceD.innerHTML = q.choiceD;\n \n\n}", "function showQuestion(counter) {\n if (counter > questionCounter) {\n document.getElementsByTagName(\"h1\")[0].innerHTML = \"Game Over\";\n question.innerHTML = \"You scored \" + currentScore + \" out of \" + questionCounter;\n choice1.style.display = \"none\";\n choice2.style.display = \"none\";\n \n guess0.style.display = \"none\";\n guess1.style.display = \"none\";\n questionOf.style.display = \"none\";\n return;\n } else {\n \n questionOf.innerHTML = \"Question \" + counter + \" of \" + questionCounter;\n \n currentQ = \"q\";\n currentQ += counter;\n console.log(currentQ);\n currentQ += \".question\";\n \n question.innerHTML = eval(currentQ)\n \n showAnswers(counter);\n }\n}", "function presentQuestion(obj){\n\t\tvar int_to_string;\n\t\t$(\"#actual_question\").html(obj.the_questions.the_question[4]);\n\t\tanswer = obj.the_questions.the_question[5];\n\t\tfor (x = 0; x < 4; x++) {\n\t\t\t$(\"#solution_\" + x + \"_right\").html(obj.the_questions.the_question[x]).fadeIn('slow');\n\t\t\t$(\"#solution_\" + x + \"_container\").css(\"background-color\", \"#BFBB11\").css(\"border-color\", \"#730046\").css(\"color\", \"black\");\n\t\t}\n\t\tif (user_type == 'host') {\n\t\t\tswitch (obj.the_questions.the_question[5]) {\n\t\t\t\tcase 0:\n\t\t\t\t\tint_to_string = \"A\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\tint_to_string = \"B\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tint_to_string = \"C\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tint_to_string = \"D\";\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tint_to_string = \"-\";\n\t\t\t}\n\t\t\t$(\"#correct_answer\").html(int_to_string);\n\t\t}\n\t}", "function showQuestions() {\n var currentQuestion = codeQuestions[currentQuestionIndex];\n\n var titleEl = document.getElementById(\"question-title\");\n titleEl.textContent = currentQuestion.question;\n\n answersEl.innerHTML = \"\";\n\n //create loop for questions\n currentQuestion.answers.forEach(function (answer, i) {\n var answerNode = document.createElement(\"button\");\n answerNode.setAttribute(\"class\", \"answers\");\n answerNode.setAttribute(\"class\", \"answers\");\n\n answerNode.textContent = i + 1 + \".\" + rightAnswer;\n\n //clicky boy\n answerNode.onclick = answerClick;\n answersEl.appendChild(answerNode);\n });\n }", "function displayQuestion() {\n let questionNumber = STORE.questions[STORE.questionNumber];\n return `\n <img src=${picStore[STORE.questionNumber + 1]} alt=\"new girl jess winston schmidt\" width=\"375\">\n <form id=\"question-form\" class=\"question-form\">\n <fieldset>\n <div class=\"question\">\n <legend> ${questionNumber.question}</legend>\n </div>\n <div class=\"options\">\n <div class=\"answers\">\n ${displayAnswers()}\n </div>\n </div>\n <button type=\"submit\" id=\"submit-answer-btn\" tabindex=\"5\" class=\"start\">Submit</button>\n <button type=\"button\" id=\"next-question-btn\" tabindex=\"6\" class=\"start\">Next</button>\n </fieldset>\n </form>\n `;\n }", "function showQuestion(col,number,num) {\n // reset parameters\n document.getElementById(\"feedback\").innerHTML = 'Enter your answer above';\n document.getElementById(\"myAnswerBox\").value = '';\n document.getElementById('dailyDouble').style.display = \"none\";\n\n // test for daily double\n if(num === dailyDoubleNum) {\n console.log('Daily Double!');\n showDD();\n document.getElementById(\"feedback\").innerHTML = 'Please place a bet below.';\n }\n // Get Question Number\n myQuestionNum = num;\n console.log(\"Question: \" + myQuestionNum);\n // add to temporary vars\n tempRows = number;\n tempCols = col;\n // Get the Question\n myQuestion = jeopardyGame2[(col-1)].content[(number - 1)];\n console.log(myQuestion);\n // console.log(myQuestion.question);\n\n // test for repeated questions\n var foo = document.getElementById('jBtn' + myQuestionNum);\n if(foo.style.backgroundColor === 'green' || foo.style.backgroundColor === 'red'){\n document.getElementById(\"feedback\").innerHTML = '<p class=\"error\">You have already answered this question.</p>';\n return;\n }\n // Add question to the DOC\n document.getElementById(\"questionBox\").innerHTML = '<p>' + myQuestion.question + '</p>';\n // add focus to the answer box\n document.getElementById(\"myAnswerBox\").focus();\n}", "function printQuestions(){\n\t\t//Access div on page to hold the questions\n\t\tquestionEl = document.getElementById(\"questionEl\");\n\t\t//start with a blank question area each time the game is played\n\t\tquestionEl.innerHTML = \"\";\n\t\tfor(var i = 0; i < questions.length; i++){\n\t\t\t//Put the question on the page\n\t\t\tquestionEl.innerHTML += '<h3>Question ' + (i + 1)+ ': ' + questions[i] + '</h3>';\n\t\t}\n\t}", "function afficherQuestion(num)\n{\n for(var i=1;i<=nbQuestions;i++)\n {\n hide(i);\n }\n show(num);\n}", "function displayQ(object){\n \n answers.style.display = \"inline-block\";\n\n question.textContent = object[0][0].Question;\n option1El.textContent = object[0][0].option1;\n option2El.textContent = object[0][0].option2;\n option3El.textContent = object[0][0].option3;\n option4El.textContent = object[0][0].option4;\n\n}", "function renderQuestion() {\r\n var q = questions[runningQuestion];\r\n\r\n question.innerHTML = \"<p>\" + q.question + \"</p>\";\r\n choiceA.innerHTML = q.choiceA;\r\n choiceB.innerHTML = q.choiceB;\r\n choiceC.innerHTML = q.choiceC;\r\n choiceD.innerHTML = q.choiceD;\r\n}", "function renderQuestion(){\n var q = questions[runningQuestion];\n \n question.innerHTML = \"<p>\"+ q.question +\"</p>\";\n qImg.innerHTML = \"<img src=\"+ q.imgSrc +\">\";\n choiceA.innerHTML = q.choiceA;\n choiceB.innerHTML = q.choiceB;\n\tchoiceC.innerHTML = q.choiceC;\n\tchoiceD.innerHTML = q.choiceD;\n}", "function renderQuestion() {\n var q = questions[runningQuestion];\n question.innerHTML = \"<p>\" + q.question + \"</p>\";\n choiceA.innerHTML = q.choiceA;\n choiceB.innerHTML = q.choiceB;\n choiceC.innerHTML = q.choiceC;\n choiceD.innerHTML = q.choiceD;\n}", "function displayQuestion(index) {\n if (index < questionArr.length && time !== 0) {\n\n $(\"main\").empty();\n var viewQuestion = $(\"<div>\");\n viewQuestion.attr(\"id\", \"view-question\");\n $(\"main\").append(viewQuestion);\n\n // Append the question to the div\n viewQuestion.append(\"<p id='question-id'>\" + questionArr[index].question + \"</p>\");\n viewQuestion.append(\"<p id='option1-id' class='question-class'>\" + questionArr[index].option1 + \"</p>\");\n viewQuestion.append(\"<p id='option2-id' class='question-class'>\" + questionArr[index].option2 + \"</p>\");\n viewQuestion.append(\"<p id='option3-id' class='question-class'>\" + questionArr[index].option3 + \"</p>\");\n viewQuestion.append(\"<p id='option4-id' class='question-class'>\" + questionArr[index].option4 + \"</p>\");\n }\n }", "function showQuestion() {\n\n if (currentQuestion <= lastQuestion) {\n\n console.log(currentQuestion);\n questionDisplayed = questions[currentQuestion];\n\n question.textContent = questionDisplayed.question;\n answer1.textContent = questionDisplayed.optionA;\n answer2.textContent = questionDisplayed.optionB;\n answer3.textContent = questionDisplayed.optionC;\n answer4.textContent = questionDisplayed.optionD;\n\n }\n\n}", "function renderQuestion() {\n var q = questions[runningQuestion];\n\n questionDisplay.textContent = q.question;\n choiceA.innerHTML = q.choiceA;\n choiceB.innerHTML = q.choiceB;\n choiceC.innerHTML = q.choiceC;\n choiceD.innerHTML = q.choiceD;\n}", "function renderQuestion() {\n var q = questions[runningQuestion];\n question.innerHTML = \"<p>\" + q.question + \"</p>\";\n choiceA.innerHTML = q.choiceA;\n choiceB.innerHTML = q.choiceB;\n choiceC.innerHTML = q.choiceC;\n}", "function printQuestion(question, quiz){\n //storing some variables from the html to change\n //storing important data from the questions object to be used\n var questionBox = $(\".question-text\");\n var answers = question.choices;\n\n //changing the text in the boxes needed\n //adding buttons/answer choices to boxes needed\n questionBox.text(question.title);\n createAnswers(answers, quiz);\n}", "function renderQuestion() {\n let q = questionsE[runningQuestion];\n questionE.innerHTML = \"<p>\" + q.questionE + \"</p>\";\n choiceA.innerHTML = q.choiceA;\n choiceB.innerHTML = q.choiceB;\n choiceC.innerHTML = q.choiceC;\n}", "function showNewQuestion() {\n currentQuestionNumber++;\n\n if (currentQuestionNumber > 5) {\n $(\".questionAndScore\").hide();\n showFinalResults();\n } else {\n $(\".quizForm\").html(`<legend class=\"displayedQuestion\">${STORE.questions[currentQuestionNumber-1].question}</legend><br>`)\n\n displayTestInfo();\n showAnswerChoices();\n }\n}", "function showQuestion(){\n var _item_question = getQuestion();\n //show layout\n $(\"#question2\").html(_item_question[\"question\"]);\n}", "function generateQuizQuestion() {\n gameoverDiv.style.display = \"none\";\n if (currentQuestionIndex === finalQuestionIndex) {\n return showScore();\n }\n var currentQuestion = quizQuestions[currentQuestionIndex];\n questionsEl.innerHTML = \"<p>\" + currentQuestion.question + \"</p>\";\n buttonA.innerHTML = currentQuestion.choiceA;\n buttonB.innerHTML = currentQuestion.choiceB;\n buttonC.innerHTML = currentQuestion.choiceC;\n buttonD.innerHTML = currentQuestion.choiceD;\n}", "function renderQuestion() {\n // debugger\n let q = state.questions[state.runningQuestion];\n\n document.getElementById(\"question\")\n .innerHTML = \"<p>\" + q.question + \"</p>\";\n // document.getElementById(\"qImg\")\n // .innerHTML = \"<img src=\" + q.imgSrc + \">\";\n document.getElementById(\"A\")\n .innerHTML = q.choiceA;\n document.getElementById(\"B\")\n .innerHTML = q.choiceB;\n document.getElementById(\"C\")\n .innerHTML = q.choiceC;\n}", "function renderQuestion() {\n let q = questions[runningQuestion];\n\n question.innerHTML = \"<p>\" + q.question + \"<p>\";\n choiceA.innerHTML = q.choiceA;\n choiceB.innerHTML = q.choiceB;\n choiceC.innerHTML = q.choiceC;\n}", "function generateQuestionCard(i) {\n // Select and display the current question\n var currentQuestion = allQuestions[i][0];\n currentQuestionTitle.text(currentQuestion);\n // Display each answer option\n answerOptionOne.text(allQuestions[i][1]);\n answerOptionTwo.text(allQuestions[i][2]);\n answerOptionThree.text(allQuestions[i][3]);\n answerOptionFour.text(allQuestions[i][4]);\n}", "function renderQuestion() {\n let q = questions[runningQuestion];\n console.log(q)\n question.innerHTML = \"<p>\" + q.question + \"</p>\";\n questionImage.innerHTML = \"<img src=\" + q.imgSrc + \">\";\n choiceA.innerHTML = q.choiceA;\n choiceB.innerHTML = q.choiceB;\n choiceC.innerHTML = q.choiceC;\n choiceD.innerHTML = q.choiceD;\n}", "function renderQuestion(){\n let q = questions[runningQuestion];\n question.innerHTML = \"<p>\"+ q.title + \"</p>\";\n choiceA.innerHTML = q.choices[0];\n choiceB.innerHTML = q.choices[1];\n choiceC.innerHTML = q.choices[2];\n}", "function showQuestion(question) {\n //look up to understand this entire function\n questionElement.innerText = question.question;\n question.answers.forEach(answer => {\n const button = document.createElement('button');\n button.innerText = answer.text;\n button.classList.add('btn');\n if (answer.correct) {\n button.dataset.correct = answer.correct;\n }\n button.addEventListener('click', selectAnswer);\n answerButtonsElement.appendChild(button);\n });\n}", "function showQuestion() {\n var showQuestion = document.getElementById(\"showQuestion\");\n showQuestion.style.display = \"block\";\n var intro = document.getElementById(\"intro\");\n intro.style.display = \"none\";\n\n var currentQuestion = questions[currentQuestionIndex];\n questionEl.innerHTML = currentQuestion.question;\n answerButtonAEl.innerHTML = currentQuestion.choices[0];\n answerButtonBEl.innerHTML = currentQuestion.choices[1];\n answerButtonCEl.innerHTML = currentQuestion.choices[2];\n answerButtonDEl.innerHTML = currentQuestion.choices[3];\n}", "function showQuestion(n) {\n\t\t// cache the current question number for use by other functions\n\t\tcurrentQuestionNumber = n;\n\t \t// Update the current question number indicator, ex : Question 3 of 20\n\t \t$(\".q-number span\").first().text(currentQuestionNumber);\n\t \t// Hide the next button until user submits the answer\n\t\t$(\"#quiz-panel .next\").hide();\n\n\t\tvar question = QUESTIONS[currentTrackName][n - 1];\n\t\t\n\t\tvar questionHtml = buildHTML(QUIZ_TEMPLATE_QUESTION, question.title);\n\n\t\tvar answersHtml = \"\";\n\t\t$.each(question.options, function (index, value) {\n\t\t\t// constructing the li including radio button\n\t\t\tanswersHtml += buildHTML(QUIZ_TEMPLATE_OPTION, index + 1, value);\n\t\t});\n\t\tanswersHtml = buildHTML(QUIZ_TEMPLATE_LIST, answersHtml);\n\n\t\t$(\"#question-box\").html(questionHtml + answersHtml);\n\n\t\t$(\"#quiz-panel .submit\").attr(\"disabled\", \"disabled\").show();\n\n \t\t// we should enable the submit button when radio button value changes\n\t \t$(\"input:radio[name=answer]\").change(function () {\n\t \t\t$(\"#quiz-panel .submit\").removeAttr(\"disabled\");\n\t \t});\n\t}", "function displayQuestion() {\n push();\n textAlign(LEFT, CENTER);\n textSize(28);\n fill(255);\n text(`lvl #2`, width / 20, height / 20);\n text(`On a scale from 'I got this' to 'AAAAAAH',\nhow confident do you feel about the future?`, width / 20, height / 10 * 2)\n pop()\n}", "function WriteQuestion(x) {\n\t\t$('#questDisplay').html('<p>' + formOne[x].question +'</p>');\n\t}", "function showNextQuestion() {\n questionParagraph.textContent = newArrayQuestions[index].question;\n}", "function answersQuestionPrint() {\n questionChooser();\n answerChooser(currentQuestion);\n }", "function renderQuestionText() {\n //console.log('Rendering question');\n const currQuestion = getCurrentQuestion();\n $('.quiz').html(generateQuestion(currQuestion));\n}", "function showQuizzes() {\n /* put 1/3 in each column inc to count, reset : inc colm */\n var count = Math.ceil(quizList.length/3);\n var col=0;\n var row=0;\n for (var i=0; i<quizList.length; i++) {\n content = '<div id='+quizList[i].quiz_id+' class=\"alert alert-info\">';// blue\n content += quizList[i].title;\n content += ': total questions: '+quizList[i].questions.length;//.question_count;\n //content += ' worth: '+quizList[i].points_possible;\n content += '</div>';\n $('#col_'+col).append(content);\n row++;\n if (row==count) { row=0; col++; }\n }\n //click quiz to view questions\n $('.alert').on('click', function(e) {\n e.preventDefault();\n selectedQuiz=e.target.id;// quiz_id\n orchidConfig.quiz_id = selectedQuiz;\n \n showQuizQuestions(selectedQuiz);\n });\n }", "function generateQuizQuestion(){\n gameoverDiv.style.display = \"none\";\n if (currentQuestionIndex === finalQuestionIndex){\n return showScore();\n } \n var currentQuestion = quizQuestions[currentQuestionIndex];\n questionsEl.innerHTML = \"<p>\" + currentQuestion.question + \"</p>\";\n buttonA.innerHTML = currentQuestion.choiceA;\n buttonB.innerHTML = currentQuestion.choiceB;\n buttonC.innerHTML = currentQuestion.choiceC;\n buttonD.innerHTML = currentQuestion.choiceD;\n}", "function showQuestion(question) {\n\tquestionElement.innerText = question.question;\n\t//populate the answers by creating a button for each of them\n\tquestion.answers.forEach(answer => {\n\t\tconst button = document.createElement(\"button\");\n\t\tbutton.innerText = answer.text;\n\t\tbutton.classList.add(\"btn\");\n\t\t//check if the answer is correct by adding a data attribute to the button\n\t\tif (answer.correct) {\n\t\t\tbutton.dataset.correct = answer.correct;\n\t\t}\n\t\t\tbutton.addEventListener(\"click\", selectAnswer);\n\t\t\tanswerButtonsElement.appendChild(button);\n\t});\n}", "function renderQuestion(){\r\n let q = questions[runningQuestion];\r\n \r\n question.innerHTML = \"<p>\"+ q.question +\"</p>\";\r\n qImg.innerHTML = \"<img src=\"+ q.imgSrc +\">\";\r\n choiceA.innerHTML = q.choiceA;\r\n choiceB.innerHTML = q.choiceB;\r\n}", "function generateQuizQuestion(){\n $(gameoverDiv).hide();\n if (currentQuestionIndex === finalQuestionIndex){\n return showScore();\n } \n var currentQuestion = quizQuestions[currentQuestionIndex];\n questionsEl.innerHTML = \"<p>\" + currentQuestion.question + \"</p>\";\n buttonA.innerHTML = currentQuestion.choiceA;\n buttonB.innerHTML = currentQuestion.choiceB;\n buttonC.innerHTML = currentQuestion.choiceC;\n buttonD.innerHTML = currentQuestion.choiceD;\n}", "function questionGen() {\n $(\"#game\").append(\"<p class='question'>\" + questions[questionNumb].question + \"</p>\" +\n \"<p class='options'>\" + questions[questionNumb].options[0] + \"</p>\" +\n \"<p class='options'>\" + questions[questionNumb].options[1] + \"</p>\" +\n \"<p class='options'>\" + questions[questionNumb].options[2] + \"</p>\" +\n \"<p class='options'>\" + questions[questionNumb].options[3] + \"</p>\");\n }", "function questionDisplay(answer) {\n if (answer != \"start-button\") {\n checkAnswer(answer);\n counter++\n }\n if (counter < 5) {\n document.getElementById(\"questionText\").textContent = questions[counter].title;\n document.getElementById(\"optionA\").textContent = questions[counter].choices[0];\n document.getElementById(\"optionB\").textContent = questions[counter].choices[1];\n document.getElementById(\"optionC\").textContent = questions[counter].choices[2];\n document.getElementById(\"optionD\").textContent = questions[counter].choices[3];\n }\n else {\n document.getElementById(\"questionText\").style.display = \"none\"\n document.getElementById(\"questionChoices\").style.display = \"none\"\n }\n}", "function displayQuestion(question) {\n let div = document.createElement('div');\n div.className = \"chat-question-bloc\";\n let p = document.createElement('p');\n p.className = \"chat-question\";\n p.textContent = question;\n div.appendChild(p);\n\n return div;\n}", "function displayQuestions() {\n let q = triviaQuestions[questionCount];\n \n question.innerHTML = \"<p>\"+ q.question +\"</p>\";\n choice1.innerHTML = q.choice1;\n choice2.innerHTML = q.choice2;\n choice3.innerHTML = q.choice3;\n choice4.innerHTML = q.choice4;\n\n //Ends the quiz after the questions are finished and displays results\n if (questionCount > 9) {\n alert(\"The quiz is now over. Let's see your results.\");\n stopTimer();\n $(\"#timer\").hide();\n $(\"#trivia\").hide();\n showResults(); \n } \n }", "function renderQuestions () {\n console.log(`Next Question, #${questionNumber + 1} Render question screen.`);\n updateQuestionNumber();\n //generate the string we need to Display\n const questionString = getQuestionString();\n $('main').html(questionString);\n\n}", "function renderQuestions() {\n var q = questionArr[currentIndex];\n questionEl.innerHTML = \"<h3><strong>Question \" + parseInt(currentIndex+1) + \"/10 <br>\" + q.question + \"</strong></h3>\";\n choiceA.textContent = q.choiceA;\n choiceB.textContent = q.choiceB;\n choiceC.textContent = q.choiceC;\n choiceD.textContent = q.choiceD;\n}", "function showQuestions(index){\n \n document.querySelector(\"#que_text\").textContent = questions[index].numb + \". \" + questions[index].question\n document.querySelector(\"#button0\").textContent = questions[index].options[0]\n document.querySelector(\"#button1\").textContent = questions[index].options[1]\n document.querySelector(\"#button2\").textContent = questions[index].options[2]\n document.querySelector(\"#button3\").textContent = questions[index].options[3]\n \n}", "function displayQuestion() {\n // checks if there are existing answers already displayed\n var buttonElChildElementsCount = document.querySelector(\".btn-wrapper\")\n .childElementCount;\n\n if (buttonElChildElementsCount > 0) {\n document.querySelector(\".btn-wrapper\").innerHTML = \"\";\n }\n\n // id counter that will be then assigned to DOM entry for a given answer\n var index = 0;\n // Dynamically retrieves all 'answer' keys from given quiz object using regex;\n // for each 'answer' creates a new button and writes answer's value into element's text\n for (var key in quiz[0]) {\n if (/^answer/.test(key)) {\n var newSpanEl = document.createElement(\"span\");\n newSpanEl.innerText = `${index}. `;\n\n var answerBtnEl = document.createElement(\"button\");\n answerBtnEl.setAttribute(\"class\", \"btn left-aligned\");\n answerBtnEl.innerHTML = `<span>${index}. </span>${quiz[0][key]}`;\n\n // displays question\n pageTitleEl.textContent = quiz[0].question;\n\n // displays answers\n buttonsWrapperEl.appendChild(answerBtnEl);\n }\n index++;\n }\n return;\n}", "function renderQuestion() {\n var q = multipleChoice[currentQuestionIndex];\n\n question.innerHTML = \"<p>\" + q.question + \"<p>\";\n answerA.innerHTML = q.answerA;\n answerB.innerHTML = q.answerB;\n answerC.innerHTML = q.answerC;\n}", "function formulateQuestion(){\n\ty = 0; //static variable to ensure only questions are asked\n\t\n\tgeneratedQuestion = alert(questions[answerIncrementor][y]); //generates question\n\t\n}", "function displayQuestion(data){\n //Update the question, text, answers and categories\n $(\"#questionText\").text(data.question);\n $(\"#quizgamecategory\").text(data.category);\n\n //show the question section\n $('#quizgamequestion').show();\n}" ]
[ "0.76573485", "0.762619", "0.7450181", "0.7448028", "0.7436253", "0.742672", "0.73986614", "0.7368413", "0.7367368", "0.7367368", "0.73631614", "0.7351798", "0.73508483", "0.7331302", "0.7330321", "0.7315764", "0.7308022", "0.72923887", "0.7292088", "0.728525", "0.72816867", "0.72591966", "0.7253541", "0.7250142", "0.7249896", "0.7245685", "0.7232166", "0.7220278", "0.7217714", "0.7217291", "0.7216209", "0.72109365", "0.72101855", "0.71848464", "0.71676105", "0.7164912", "0.7162469", "0.7162441", "0.71551883", "0.71439326", "0.71390224", "0.712075", "0.7116715", "0.70987827", "0.7095051", "0.7083945", "0.70713645", "0.7044323", "0.70304024", "0.70179063", "0.7010909", "0.7009682", "0.7008879", "0.70079327", "0.7001227", "0.69957745", "0.6989428", "0.698248", "0.6981299", "0.6981139", "0.6980324", "0.6980254", "0.69749254", "0.6974341", "0.6969244", "0.69690484", "0.69579715", "0.69499713", "0.6935055", "0.69321823", "0.6927075", "0.6913508", "0.6903661", "0.69025666", "0.68914646", "0.6889163", "0.68890023", "0.688026", "0.68726045", "0.68721527", "0.6856106", "0.6850684", "0.68500495", "0.68494797", "0.6842229", "0.68400556", "0.6839039", "0.6833902", "0.683198", "0.68306875", "0.6828897", "0.68288815", "0.6817971", "0.6815301", "0.6814189", "0.6808254", "0.6808161", "0.6806624", "0.6804033", "0.6801345", "0.6798744" ]
0.0
-1
function to add character box on board
function displayBox(wordAnswerInst) { var answer = wordAnswerInst.text.split(''); console.log(answer); for (i=0;i<answer.length;i++) { var boxSpan = document.createElement('span'); var textInBox = document.createTextNode("_"); boxSpan.appendChild(textInBox); boxSpan.className = "h1"; boxSpan.setAttribute("id","box-text-"+i) var boxWrap = document.createElement('div'); boxWrap.style.height="70px"; boxWrap.style.width="70px"; boxWrap.className = "border bd-dark bg-white mx-3 d-flex justify-content-center align-middle "; boxWrap.appendChild(boxSpan); document.getElementById("answer-display").appendChild(boxWrap); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawBoxes()\r\n{\r\n for(var i=0;i<word.length;i++)\r\n {\r\n var box=document.createElement(\"div\");\r\n var text=document.createTextNode(\"_\");\r\n box.classList.add(\"letter\");\r\n box.appendChild(text);\r\n wordDiv.appendChild(box);\r\n }\r\n}", "function addUserBox(cell) {\n ctx.beginPath();\n ctx.fillStyle = lineColor;\n ctx.fillRect(cell.getCoord().getX() - dotRadius*4, cell.getCoord().getY() - dotRadius * 4, boxSize/4, boxSize/4);\n ctx.closePath();\n\n cell.drawThis();\n}", "function createBoard() {\n\t// clear previous board and saved word\n\tclearPreviousBoard(letterSpaces);\n\tclearPreviousBoard(guessRemaining);\n\t// reset image to blank board\n\tmanImage.setAttribute('src', `images/hangman7.png`);\n\t// reset the incorrectGuess to 6\n\tincorrectGuess = 6;\n\t// create guesses remaining\n\tfor (let i = 0; i < incorrectGuess; i++) {\n\t\tconst divElement = document.createElement('div');\n\t\tdivElement.classList.add('show-circle');\n\t\tdivElement.setAttribute('id', [i + 1]);\n\t\tguessRemaining.appendChild(divElement);\n\t}\n\n\t// loop through letters array and create divs for all of them\n\tfor (let i = 0; i < letters.length; i++) {\n\t\tconst divElement = document.createElement('div');\n\t\tdivElement.innerText = letters[i];\n\t\tdivElement.classList.add('letter-button');\n\t\tdivElement.setAttribute('id', letters[i]);\n\t\tletterSpaces.appendChild(divElement);\n\t}\n}", "function addIn(){\n var textBox = document.getElementById(\"userIn\").value;\n //console.log(\"tb - \" + textBox)\n var canvas = document.getElementById(\"mycanvas\");\n var child = document.getElementById(\"temp\");\n var posCounter = 0;\n for(var i = 0; i < textBox.length; i++){\n var cur = document.createElement(\"div\");\n cur.style.position = \"absolute\";\n cur.innerHTML = textBox[i]\n cur.id = getNextId();\n cur.className = \"padElm\"\n cur.style.width = \"100px\";\n cur.style.height = \"100px\";\n cur.style.fontSize = \"50px\";\n cur.style.paddingTop = \"40px\";\n cur.style.border=\"solid\";\n cur.style.borderRadius = \"10px\";\n cur.style.textAlign = \"center\";\n cur.style.left = numToString(posCounter);\n //console.log(\"new pos = \" + posCounter)\n cur.style.top = \"0\";\n canvas.insertBefore(cur,child);\n posCounter += 100;\n }\n}", "_addSnake(){\n for(let i =0; i<this._snake.length; i++){\n const elem = document.createElement(\"div\");\n elem.className=\"box\";\n elem.id = \"box-id\";\n elem.style.top=this._snake[i].row*this._boxSize+\"px\";\n elem.style.left=this._snake[i].col*this._boxSize+\"px\";\n this._screen.append(elem);\n this._snakeBodyElems.push(elem);\n }\n }", "function addCharacter(){\n\t\n\t//prevents blank characterBlocks from being added\n\tif ((document.getElementById(\"addName\").value == \"\") &&\n\t(document.getElementById(\"addAC\").value == \"\") &&\n\t(document.getElementById(\"addMaxHP\").value == \"\")){\n\t\tresetAddFocus();\n\t\treturn false;\n\t}\n\t\n\t//catch blank or non-number initiative values\n\tif ((document.getElementById(\"addInitiative\").value == \"\") ||\n\tisNaN(document.getElementById(\"addInitiative\").value)){\n\t\treturn false;\n\t}\n\t\n\tvar newBlockDiv = document.createElement('div');\n\tnewBlockDiv.id=\"characterBlock\";\n\t\n\tvar newCloseButton = document.createElement('button');\n\tnewCloseButton.type=\"button\";\n\tnewCloseButton.id=\"closeButton\";\n\tnewCloseButton.onclick=function(){removeDiv(newBlockDiv)};\n\tnewCloseButton.append(\"\\u2716\");\n\tnewBlockDiv.appendChild(newCloseButton);\n\t\n\tvar newDetailsDiv = document.createElement('div');\n\tnewDetailsDiv.id=\"characterDetails\";\n\t\n\t\tvar newInitiativeP = document.createElement('p');\n\t\tnewInitiativeP.id=\"initiativeP\";\n\t\tvar newInitiative = document.createElement('input');\n\t\tnewInitiative.type=\"text\";\n\t\tnewInitiative.id=\"initiative\";\n\t\tnewInitiative.value = (document.getElementById(\"addInitiative\").value);\n\t\t\n\t\t//if initiative is manually changed, re-places character block accordingly\n\t\tnewInitiative.addEventListener(\"keyup\", function(event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ((event.keyCode === 13) && (!isNaN(newInitiative.value))){\n\t\t\t\t\tplaceByInitiative(newBlockDiv);\n\t\t\t\t}\n\t\t});\n\t\tnewInitiativeP.append(newInitiative);\n\t\tnewInitiativeP.append(\"\\xa0\");\n\t\tvar newNameDiv = document.createElement('div');\n\t\tnewNameDiv.id = \"nameDiv\";\n\t\tvar newNameP = document.createElement('p');\n\t\tnewNameP.id=\"nameP\";\n\t\tvar newName = document.createElement('input');\n\t\tnewName.type=\"text\";\n\t\tnewName.id=\"name\";\n\t\tnewName.value = document.getElementById(\"addName\").value;\n\t\tnewNameP.append(newName);\n\t\tnewNameDiv.appendChild(newInitiativeP);\n\t\tnewNameDiv.appendChild(newNameP);\n\t\tnewDetailsDiv.appendChild(newNameDiv);\n\t\n\t\tvar newDetailP = document.createElement('p');\n\t\t\n\t\t\tvar newAC = document.createElement('input');\n\t\t\tnewAC.type=\"text\";\n\t\t\tnewAC.id=\"AC\";\n\t\t\tnewAC.value = document.getElementById(\"addAC\").value;\n\t\t\tnewDetailP.append(\"AC: \");\n\t\t\tnewDetailP.append(newAC);\n\t\t\n\t\t\tvar newMaxHP = document.createElement('input');\n\t\t\tnewMaxHP.type=\"text\";\n\t\t\tnewMaxHP.id=\"maxHP\";\n\t\t\tnewMaxHP.value = document.getElementById(\"addMaxHP\").value;\n\t\t\tnewDetailP.append(\" Max HP: \");\n\t\t\tnewDetailP.append(newMaxHP);\n\t\t\n\t\t\tvar newCurrentHP = document.createElement('input');\n\t\t\tnewCurrentHP.type=\"text\";\n\t\t\tnewCurrentHP.id=\"currentHP\";\n\t\t\tnewCurrentHP.value = document.getElementById(\"addMaxHP\").value;\n\t\t\tnewDetailP.append(\" Current HP: \");\n\t\t\tnewDetailP.append(newCurrentHP);\n\t\t\n\t\t\tvar newDamageTaken = document.createElement('input');\n\t\t\tnewDamageTaken.type=\"text\";\n\t\t\tnewDamageTaken.id=\"damageTaken\";\n\t\t\tnewDetailP.append(\" Damage Taken: \");\n\t\t\tnewDetailP.append(newDamageTaken);\n\t\t\tnewDamageTaken.addEventListener(\"keyup\", function(event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ((event.keyCode === 13) && (!isNaN(newDamageTaken.value)) && (!isNaN(newCurrentHP.value))){\n\t\t\t\t\tnewCurrentHP.value = \n\t\t\t\t\t\tnewCurrentHP.value - newDamageTaken.value;\n\t\t\t\t\tnewDamageTaken.value = \"\";\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif (newCurrentHP.value <= 0){\n\t\t\t\t\t\tsetBackground(newBlockDiv, '#8c8c8c');\n\t\t\t\t\t}\n\t\t\t\t\telse if (newCurrentHP.value < (newMaxHP.value)/2){\n\t\t\t\t\t\tsetBackground(newBlockDiv, '#fb6251');\n\t\t\t\t\t}\n\t\t\t\t\telse setBackground(newBlockDiv, '#d2a479');\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\tnewDetailsDiv.appendChild(newDetailP);\n\t\n\tnewBlockDiv.appendChild(newDetailsDiv);\n\t\n\tvar newNotesDiv = document.createElement('div');\n\t\tvar newNotesArea = document.createElement('textarea');\n\t\tnewNotesArea.rows=\"1\";\n\t\tnewNotesArea.placeholder=\"NOTES\";\n\t\t\n\t\t//prevents textarea overflow in Firefox\n\t\tnewNotesArea.style.overflowX = \"hidden\";\n\t\tnewNotesDiv.append(newNotesArea);\n\t\t\n\tnewBlockDiv.appendChild(newNotesDiv);\t\n\tplaceByInitiative(newBlockDiv);\n\tclearAddDetails();\n\t\n\treturn false;\n}", "function addBoxes(wrapper) {\n let container = document.getElementById(wrapper);\n container.innerHTML = \"\";\n let letter = wrapper.slice(wrapper.length -1);\n for (var box = 0; box < 12; box++) {\n // check for column, set text style \n switch(letter.toLowerCase()) {\n case \"a\":\n container.innerHTML = container.innerHTML + \"<div>\" + letter.toLowerCase() + \"0\" + box + \"</div>\";\n break;\n case \"b\":\n container.innerHTML = container.innerHTML + \"<div><b>\" + letter.toLowerCase() + \"0\" + box + \"</b></div>\";\n break;\n case \"c\":\n container.innerHTML = container.innerHTML + \"<div>\" + letter.toLowerCase() + \"0\" + box + \"</div>\";\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 addBox(level, name, x, y, onclick) {\n\t\tif (typeof $scope.objects[level + ''] == 'undefined') {\n\t\t\t$scope.objects[level + ''] = [];\n\t\t}\n\t\tif (typeof onclick == 'undefined') {\n\t\t\tonclick = function () {\n\t\t\t\t(function (shape) {\n\t\t\t\t\tsetTimeout(function () {//csak hogy aszinron legyen a későbbiek miatt\n\t\t\t\t\t\tvar newName = prompt('Mi legyen az új név?', shape.name);\n\t\t\t\t\t\tif (typeof newName == 'string') {\n\t\t\t\t\t\t\tshape.name = newName;\n\t\t\t\t\t\t\tcanvas.redraw();\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 1);\n\t\t\t\t})(this);\n\t\t\t}\n\t\t}\n\t\t$scope.objects[level + ''].push({name: name, x: x, y: y, w: 150, h: 200, onclick: onclick});\n\t\tcanvas.redraw();\n\t}", "function insertBoxContent(data){\n emptyBoxes()\n for (var i = 0; i < data.length; i++) {\n currentLetter = data.charAt(i)\n $(\".code-box:eq(\"+i+\")\").val(currentLetter)\n }\n }", "addCharacterToSquare(xCoord, yCoord, keyCharacter) {\n // add 1 to the y value as coordinate is top corner of grid square\n this.context.fillText(keyCharacter, xCoord * gridDimension.x, ((yCoord + 1) * gridDimension.y) - yAlignment);\n \n //mark the grid square as filled\n this.markGridSquareAsFilled({x: xCoord, y: yCoord + 1});\n }", "function createBoard() {\r\n\r\n var randomWord = wordList[Math.floor(Math.random() * (77 -4) + 6)];\r\n generatedWord = randomWord.split(\"\");\r\n\r\n for(var i = 0; i < randomWord.length; i++){\r\n var letterElement = document.createElement(\"span\");\r\n letterElement.textContent = \"_\" ///player1SelectedWord[i];\r\n letterElement.id = \"letters\";\r\n //letterElement.style.letterspacing = \"2px\";\r\n wordsArea.appendChild(letterElement);\r\n }\r\n}", "function putLetter(_event) {\n let box = document.createElement(\"div\");\n box.style.width = \"30px\";\n box.style.height = \"30px\";\n box.style.backgroundColor = \"blue\";\n box.innerText = currentLetter;\n box.style.marginLeft = \"3px\";\n box.style.marginTop = \"3px\";\n box.id = currentLetter;\n box.className = \"letters\";\n box.style.position = \"absolute\";\n box.style.left = _event.pageX + \"px\";\n box.style.top = _event.pageY + \"px\";\n document.body.appendChild(box);\n box.addEventListener(\"click\", deleteLetter);\n let clicking = _event.target;\n }", "function createBoard(){ \r\n let index = 1;\r\n for(let r = 0; r < 3; r++){ // rows\r\n const newRow = gameBoard.insertRow(r);\r\n\r\n for(let c = 0; c < 3; c++){ // columns\r\n const newBox = newRow.insertCell(c)\r\n newBox.className = \"box\"+index; // specify class names to define styles in css for the game board\r\n newBox.addEventListener(\"click\", playerMove, {once: true});\r\n index++;\r\n }\r\n }\r\n}", "function addRect(x, y, w, h, fill,sector,place, line,cell,pricenum) {\n var rect = new Box;\n rect.x = x;\n rect.y = y;\n rect.w = w\n rect.h = h;\n rect.fill = fill;\n rect.sector = sector;\n rect.pricenum = pricenum;\n rect.state = '1';\n rect.line= line;\n rect.cell= cell;\n rect.place=place;\n\n primer[line][cell]=rect; \n invalidate();\n}", "function addIn(){\n var jList = createJsonList();\n var oldRow = getRow(0,jList);\n for(var i = 0; i < oldRow.length; i++){\n var cur = oldRow[i];\n deleteById(parseInt(cur.id));\n }\n var textBox = document.getElementById(\"userIn\").value;\n //console.log(\"tb - \" + textBox)\n var canvas = document.getElementById(\"mycanvas\");\n var child = document.getElementById(\"temp\");\n var posCounter = 0;\n for(var i = 0; i < textBox.length; i++){\n if(/\\s/.test(textBox[i])){\n continue;\n }\n var cur = document.createElement(\"div\");\n cur.style.position = \"absolute\";\n cur.innerHTML = textBox[i]\n cur.id = getNextId();\n cur.className = \"padElm\"\n cur.style.width = \"100px\";\n cur.style.height = \"100px\";\n cur.style.fontSize = \"80px\";\n //cur.style.paddingTop = \"40px\";\n //cur.style.border=\"solid\";\n cur.style.borderRadius = \"45px\";\n //cur.style.color = \"red\";\n cur.style.textAlign = \"center\";\n cur.style.left = numToString(posCounter);\n //console.log(\"new pos = \" + posCounter)\n cur.style.top = \"0\";\n cur.style.cursor = \"pointer\";\n canvas.insertBefore(cur,child);\n posCounter += 100;\n }\n}", "_addFruit(){\n const fruit = document.createElement(\"div\");\n fruit.classList.add(\"box\");\n fruit.classList.add(\"box-fruit\"); \n fruit.id=\"fruit-id\"\n this._assignRandomCords();\n fruit.style.top=this._fruit[0].row*this._boxSize+\"px\";\n fruit.style.left=this._fruit[0].col*this._boxSize+\"px\";\n this._screen.append(fruit);\n }", "function startTheGame(board){\r\n\tboard.boxes\r\n\t.forEach(elm => elm.addEventListener(\"click\", insertSymbol.bind(event,board), {once: true}));\r\n}", "function addBoxes() {\n O('box-container').innerHTML += \"<div class='box'>More Boxes!!!!</div>\"\n}", "function addBlockToScreen(scriptText, startChar, endChar, actors, positions) {\n\n\tconst scriptPartText = scriptText.slice(startChar, endChar + 1);\n\tconst html = `<h4>Part ${blocks.children.length + 1}</h4>\n <p><em>\"${scriptPartText}\"</em></p>\n <div class='actors'></div>`\n\n const block = document.createElement('div')\n block.className = 'col-lg-12'\n block.innerHTML = html;\n for (let j = 0; j < actors.length; j++) {\n \tconst actorHtml = `${actors[j]}<input id='scriptText' style=\"width: 40px;\" type=\"text\" name=\"\" value=\"${positions[j]}\">`\n \tconst actorContainer = document.createElement('p');\n \tactorContainer.innerHTML = actorHtml;\n \tblock.children[2].appendChild(actorContainer)\n\t} \n\n console.log(block)\n blocks.appendChild(block)\n\n}", "function createInputBoxes(random_word) {\n\n word_letters = random_word.split('');\n var letter_container = document.getElementById('letter_container');\n\n for (var i= 0; i < word_letters.length; i++){\n var div = document.createElement('div');\n div.className = 'letter ' + word_letters[i];\n letter_container.appendChild(div)\n }\n}", "function boxCreator() {\n let attributesForBoxes = document.createAttribute('class');\n attributesForBoxes.value = 'box-attributes';\n let box = document.createElement('div');\n box.id = `box${i}`;\n box.setAttributeNode(attributesForBoxes);\n document.getElementById('game').appendChild(box);\n document.getElementById('game').style.display = 'flex';\n }", "addElement(tile) {\n let self = this;\n let div = document.createElement('div');// create a new div element\n let newContent = document.createTextNode(tile);// and give it some content\n \n div.style.height = ((self.board.clientHeight - 2) / 12).toFixed().toString() + 'px'; // make the tile fit in a twelve tiles row\n div.style.width = ((self.board.clientWidth - 2) / 12).toFixed().toString() + 'px'; // make the tile fit in a twelve tiles row\n div.className = 'tile'; // add .tile class for further css styling\n div.onclick = self.tileClick.bind(self); // add callback function to the click event and bind the current 'this' to it. otherwise the 'this' will be the event.\n \n div.setAttribute('data-location', tile);\n div.appendChild(newContent);// add the text node to the newly created div\n self.board.appendChild(div);// add the newly created element and its content into the DOM\n }", "function startCharacter(){\n createRoundRectangle(player[0].color, 40, player[0].x, player[0].y);\n addNumbers(player[0].num, \"#ffffff\", player[0].x+20, player[0].y+20);\n\n createRoundRectangle(player[1].color, 40, player[1].x, player[1].y);\n addNumbers(player[1].num, \"#ffffff\", player[1].x+20, player[1].y+20);\n\n return stage.update();\n}", "function drawBoard(){\n for (var i = 0; i < gameboard.length; i++){\n for (var j = 0; j < gameboard.length; j++){\n var xCoord = 15 + i * 32;\n var yCoord = 25 + j * 32;\n gameboard[i][j].xCoord = xCoord;\n gameboard[i][j].yCoord = yCoord;\n tile.beginPath();\n tile.fillStyle = '#000000';\n tile.font = '24px monospace';\n tile.fillText(gameboard[i][j].letter, xCoord, yCoord);\n tile.closePath();\n }\n }\n}", "function messageBoard() {\n $('<div></div>').appendTo('.gameboard').addClass('messageBoard');\n}", "function createLettersDisplay(text){\n\t\tif(gameLettersDisplay){\n\t\t\tstage.removeChild(gameLettersDisplay);\n\t\t}\n\t\tgameLettersDisplay = new Text();\n\t\tgameLettersDisplay.text = text; // ;\n\t\tgameLettersDisplay.font = \"bold 42px Arial\";\n\t\tgameLettersDisplay.x = 20;\n\t\tgameLettersDisplay.y = 550;\n\t\tstage.addChild(gameLettersDisplay);\n\t\tupdate = true;\n\t}", "function addQuestion() {\n // Create a new div \n var maincanvas= document.getElementById(\"maincanvas\")\n var questbox = document.createElement('div')\n questbox.className = 'questbox';\n questbox.innerHTML = '<textarea id=question rows=\"1\" cols=\"50\" placeholder=\"QUESTION\"></textarea><br><textarea id=answer rows=\"6\" cols=\"50\" placeholder=\"Type Here...\"></textarea>'\n // Add it to the main canvas\n maincanvas.appendChild(questbox);\n $(questbox).draggable({cursor: \"crosshair\"})\n\n}", "function GenerateField(boardContainer, cells){\n for (i = 0; i < cols; i++) {\n for (j = 0; j < rows; j++) {\n\n var cell = document.createElement(\"div\");\n boardContainer.appendChild(cell);\n\n cell.id = 'cell' + i + j;\n\n var topPosition = j * squareSize;\n var leftPosition = i * squareSize;\n\n cell.style.top = topPosition + 'px';\n cell.style.left = leftPosition + 'px';\n cell.style.width = squareSize + 'px';\n cell.style.height = squareSize + 'px';\n cells.push(cell);\n }\n }\n \n}", "function addText() {\n // Create a new div \n var maincanvas= document.getElementById(\"maincanvas\")\n var textbox = document.createElement('div')\n textbox.className = 'textbox';\n textbox.innerHTML = '<textarea id=text rows=\"1\" cols=\"50\" placeholder=\"Type Here...\"></textarea>'\n // Add it to the main canvas\n maincanvas.appendChild(textbox);\n $(textbox).draggable({cursor: \"crosshair\"})\n\n}", "function draw_rectangle()\r\n{\r\n\t//tips:24 dot matrix;x=112,y=112;show string is 'make block';1(red)\r\n\tvar str = \"DS24(112,112,'make block',1);\";\r\n\t//draw rectangle >>Upper left corner:x1=85,y1=45;Lower right corner:x2=235,y2=195;4(yellow)\r\n\tvar rectangle = \"BOX(85,45,235,195,4);\";\r\n\ttftlcd.send(clear);\t\r\n\ttftlcd.send(upright);\t\r\n\ttftlcd.send(str);\r\n\ttftlcd.send(rectangle);\r\n\ttftlcd.send(println);\t\r\n}", "function createBoard(){\n let boardCont = document.createElement('div');\n for (i=0;i<9;i++){\n let cell = document.createElement('div');\n cell.classList.add('cell');\n cell.id = `${i}`;\n cell.addEventListener('click',function (event){\n changeSymbol(event.target)\n checkEnd()\n });\n boardCont.appendChild(cell);\n }\n boardCont.classList.add('container');\n boardCont.id = 'boardCont';\n document.body.appendChild(boardCont);\n}", "function createBox()\n\t{\n\t\tbox = that.add('rect', {\n\t\t\tcolor: style.boxColor,\n\t\t\tborderWidth: style.borderWidth,\n\t\t\tborderColor: style.borderColor,\n\t\t\tdepth: that.depth\n\t\t}, fw.dockTo(that));\n\t}", "function addBox(coin) {\nvar options = {\n width : \"18%\",\n height : \"25%\",\n content: \"Coin Pool Net Ratio\",\n tags: true,\n border: {\n type: 'line'\n },\n style: {\n fg: 'white',\n border: {\n fg: '#f0f0f0'\n },\n hover: {\n bg: 'green'\n }\n }\n}\nif (r == 1) {\n options.right = r\n} else {\n options.left = l\n}\noptions.label = \"{bold}\"+coin+\"{/bold}\";\nif (b == 1) {\n options.bottom = b;\n} else {\n options.top= t;\n}\nconsole.log(coin + t + b + l + r );\nbox[coin] = blessed.box( options);\n\n\n\nscreen.append(box[coin]);\n \n P++;\n l = P*20 + \"%\";\n \n if (P == '5' ) {\n r = '';\n rcount++;\n t = rcount * 25 + \"%\";\n l = '0%';\n P = 0;\n } \n \n \n\n}", "function drawBox(text)\n{\n ctx.beginPath();\n ctx.rect(150, 100, 300, 275);\n ctx.fillStyle = '#222';\n ctx.fill();\n\n ctx.beginPath();\n ctx.strokeStyle = 'white';\n ctx.rect(150, 100, 300, 275);\n ctx.stroke();\n\n ctx.fillStyle = 'white';\n ctx.fillText(text, MID_CANVAS, 150);\n}", "function makeBox() {\n\n}", "function createNewLetter() {\r\n let letter = randomLetter()\r\n let color = randomColor()\r\n let top = randomPosition()\r\n let right = randomPosition()\r\n //cream un nou elem. div (initial este gol si fara stil)\r\n let div = document.createElement(\"div\")\r\n //adaugam clasa letter elem. nostru (care are stilizarea in css)\r\n div.classList.add(\"letter\")\r\n //setam textul din interiorul div-ului sa fie litera aleatorie\r\n div.innerText = letter\r\n //setam culoare in css\r\n div.style.backgroundColor = color\r\n //setam top si right in css\r\n div.style.top = top\r\n div.style.right = right\r\n //setam o clasa cu valoarea literei aleatorii\r\n div.classList.add(letter)\r\n //adaugam elem. div in body\r\n document.querySelector(\"body\").appendChild(div)\r\n}", "function criarCobra()\n{\n for(i=0; i < cobra.length; i++)\n {\n context.fillStyle = \"#5b9f02\";\n context.fillRect(cobra[i].x, cobra[i].y, box, box);\n }\n}", "drawBoxes() {\r\n let len = this._answer.length\r\n let div = document.createElement('div')\r\n\r\n for (var i = 0; i < len; i++) {\r\n let v = this._answer.charAt(i)\r\n let elem = document.createElement('span')\r\n div.appendChild(elem)\r\n\r\n if (v == '-') {\r\n this._container.appendChild(div)\r\n elem.className += 'hyphen'\r\n elem.innerText = '-'\r\n div = document.createElement('div')\r\n }\r\n if (v == ' ') {\r\n this._container.appendChild(div)\r\n elem.className += 'space'\r\n elem.innerText = ' '\r\n div = document.createElement('div')\r\n }\r\n if (v == \"'\") {\r\n this._container.appendChild(div)\r\n elem.className += 'apostrophe'\r\n elem.innerText = \"'\"\r\n div = document.createElement('div')\r\n }\r\n }\r\n this._container.appendChild(div)\r\n }", "function AddtoChat1(text,message_side) {\n\tvar cb = document.getElementById(\"cbox\");\n cb.innerHTML += \"<div class='l_im'><div class='mtxt'>\"+text+\"</div></div>\"; \n\n}", "function placePiece(row, col, color){\n //start and end are arrays with the starting and ending indices of the pieces boxing in those to be changed\n if(color == \"white\")\n { \n cells[row*8+col].innerHTML = '<w class=\"white-piece\" id=\"'+nextwhitePieceId+'\"></w>';\n //console.log(\"THIS IS CELL:\" + cells[row*8+col])\n whitesPieces = document.querySelectorAll(\"w\");\n board[row][col] = nextwhitePieceId;\n nextwhitePieceId+=2; \n }\n else{\n cells[row*8+col].innerHTML = '<b class=\"black-piece\" id=\"'+nextblackPieceId+'\"></b>';\n blacksPieces = document.querySelectorAll(\"b\");\n board[row][col] = nextblackPieceId;\n nextblackPieceId+=2;\n } \n replaceMiddlePieces(row,col)\n changePlayer(true);\n}", "function boxClickedForHuman(e){\n const id = e.target.id; \n if(!spaces[id] && flag == true ){\n spaces[id] = currentPlayer;\n e.target.innerText = currentPlayer;\n if(currentPlayer == \"X\"){\n var element = document.querySelectorAll(\".box\");\n element[id].classList.add(\"color-red\")\n }else{\n var element = document.querySelectorAll(\".box\");\n element[id].classList.add(\"color-blueviolet\")\n }\n currentPlayer = currentPlayer == O_TEXT? X_TEXT:O_TEXT;\n setText('turn' , currentPlayer+\"'s turn\");\n count++;\n winX();\n winO();\n }\n}", "function putchar(charId)\n{\n//alert(\"put called\");\nvar elemm = document.getElementById(charId);\nvar sor = document.getElementById(\"source\");\nvar charPos=elemm.getBoundingClientRect();\nsourceCount();\n//alert(charPos.left);\n//alert(charPos.top);\n\n if(charPos.left<=216){\n if(checkBoatCount()<2){\n\n sor.removeChild(elemm);\n elemm.style.position=\"absolute\"\n appendBoat(elemm,charId);\n }\n else{\n alert(\"boat is full\");\n }\n }\n else{\n \n // elem.style.top=432;\n var b = document.getElementById(\"boat1\");\n \n // elemm.style.left=216;\n \n \n // alert(checkBoatCount());\n b.removeChild(elemm);\n elemm.style.position=\"static\";\n if(charId==\"c3\" || charId==\"c2\" || charId==\"c1\")\n elemm.setAttribute(\"class\",\"canni\");\n else\n elemm.setAttribute(\"class\",\"saint\");\n sor.appendChild(elemm);\n\n \n // alert(\"hello\");\n \n\n }\n}", "function placeClues() {\n\tvar game;\n \tgame = Game.instance;\n \t //get available clue data\n \t var currentClueDataArray = [];\n currentClueDataArray = getAvailableClues();\n //create array of objects and add to screen\n var clueLabelArray = [];\n for (var i = 0; i < currentClueDataArray.length; i++) {\n \tclueLabelArray[i] = new clueType(currentClueDataArray[i]);\n \tclueLabelArray[i].x = (i * 60) + 20 - (Math.floor(i/6) * 360);\n \tclueLabelArray[i].y = (Math.floor(i/6) * 60) + 80;\n \tif (clueLabelArray[i].available == 1) {\n \t\tgame.currentScene.addChild(clueLabelArray[i]);\n \t}\n }\n}", "function addWarmUpTextArea(letter, offset, color)\n{\n textArea = game.add.text(game.world.centerX, game.world.centerY - offset, letter, instructionStyle);\n textArea.anchor.set(0.5);\n textArea.addColor(color, 0);\n}", "function showSpaces() {\n $(\".game-word\").html(\"\");\n for (var i=0; i<numLetter; i++){\n $(\".game-word\").append(\"<div class='letterSpace'>\"+ lettersArray[i] +\"</div>\");\n $(\".game-word\").append(\"<div class='spaceBorder'></div>\");\n }\n}", "function addCell (piece,column,row) {\n let newCell = document.createElement('div')\n\n if (piece === 'W') newCell.className = 'walls'\n else if (piece === 'S') newCell.className = 'start'\n else if (piece === 'F') newCell.className = 'finish'\n else newCell.className = 'blank'\n\n newCell.id = `[${column}][${row}]`\n\n let columnDest = document.getElementById(column)\n columnDest.appendChild(newCell)\n}", "generateGameBoard() {\n var numberOfSpaces = this.answer.length\n console.log(numberOfSpaces)\n // counting how many letters there are in this.answer and creating that many 'spaces'\n for (var i = 0; i < numberOfSpaces; i++) {\n console.log('number of _ is working')\n $('.gameboard').append(\n '<span class=\"space\"><span class=\"spaceLetter\" data-letter=\"' +\n this.answer[i] +\n '\">' +\n this.answer[i] +\n '</span></span>'\n )\n }\n $('.spaceLetter').addClass('hidden')\n }", "addBoard() {\n boardDiv.appendChild(this.toHTML());\n }", "function startGame() {\n for (var i = 0; i < letters.length; i++) {\n var div = $('<div>');\n div.attr('id', i);\n div.addClass(\"column\");\n div.appendTo($(\"div#game\"));\n }\n cardClick();\n}", "function addInput() {\n var node = document.createElement(\"INPUT\");\n document.getElementById(\"magicBox\").appendChild(node);\n}", "function buildBoard(){\n self.ttt.boxes = [{select: false, status: \"\"},\n {select: false, status: \"\"},\n {select: false, status: \"\"},\n {select: false, status: \"\"},\n {select: false, status: \"\"},\n {select: false, status: \"\"},\n {select: false, status: \"\"},\n {select: false, status: \"\"},\n {select: false, status: \"\"}];\n self.ttt.$save();\n }", "function buildBoard() { \r\n let row = 'a';\r\n for(var i = 0; i < boardHeight; i++) {\r\n for(var j = 0; j < boardWidth; j++) {\r\n $('.board').append(\"<button class='button' id='\" + row + j + \"'></button>\");\r\n if(j === boardWidth - 1) {\r\n $('.board').append(\"<br>\"); \r\n row = nextChar(row);\r\n }\r\n }\r\n }\r\n}", "function createBoard() {\n\tfor (let i = 0; i < layout.length; i++) {\n\t\tconst square = document.createElement('div')\n\t\tgrid.appendChild(square)\n\t\tsquares.push(square)\n\n\t\t//add layout to the board\n\t\t//we want to check what is on the board on every position :\n\t\tif (layout[i] === 0) {\n\t\t\tsquares[i].classList.add('pac-dot')\n\t\t} else if (layout[i] === 1) {\n\t\t\tsquares[i].classList.add('wall')\n\t\t} else if (layout[i] === 2) {\n\t\t\tsquares[i].classList.add('ghost-lair')\n\t\t} else if (layout[i] === 3) {\n\t\t\tsquares[i].classList.add('power-pellet')\n\t\t}\n\t}\n}", "function createBoard() {\n debug(\"createBoard\");\n shuffle(cardList);\n cardList.forEach(function(i) {\n newCard = document.createElement('li');\n newIcon = document.createElement('i');\n deck = document.querySelector('.deck');\n \n newCard.setAttribute(\"class\", \"card\");\n newIcon.setAttribute(\"class\", i);\n deck.appendChild(newCard);\n deck.lastChild.appendChild(newIcon);\n })\n evtListener(); \n }", "function addChar() {\n //updateBtnColor();\n document.body.style.backgroundColor = \"white\";\n let code = $(\"code1\").innerText;\n if(code.length < PULL_LENGTH)\n $(\"code1\").innerText += this.innerText;\n }", "function drawBoard() {\n var s = '<table class=\"table\">\\n';\n\n for (var i = 0; i < 9; ++i) {\n s += '<tr>';\n for (var j = 0; j < 9; ++j) {\n var c = 'cell';\n if ((i + 1) % 3 == 0 && j % 3 == 0) {\n c = 'cell3';\n } else if ((i + 1) % 3 == 0) {\n c = 'cell1';\n } else if (j % 3 == 0) {\n c = 'cell2';\n }\n s += '<td class=\"' + c + '\"><input class=\"input\" onkeypress=\"return isNumberKey(event)\" type=\"text\" size=\"1\" maxlength=\"1\" id=\"cell' + (i * 9 + j) + '\"></td>';\n }\n s += '</tr>\\n';\n }\n \n s += '</table>';\n document.getElementById('9x9').innerHTML = s;\n initCells('009600103146039807500108006300251078005300902628900005987060031000812009201003084');\n }", "function workingboard(widthworkingarea, heightworkingarea, workingareapanel){\nwidthof_box=40;\nheightof_box=40;\nnumberof_boxes = ((widthworkingarea * heightworkingarea) / (widthof_box * heightof_box))*.82\n for (var i=0; i < numberof_boxes; i++)\n\t\t\t\t{\n\t\t\t\tidcounter=mycontainercounter();\n\t\t\t\tvar boxx = document.createElement(\"div\");\n\t\t\t\tboxx.setAttribute(\"id\",\"div\" + idcounter)\n\t\t\t\tboxx.setAttribute('style', 'margin: 0px;border: 1px solid black;background: #ca8c45;width:' + widthof_box + 'px;display:inline-block;height:' + heightof_box + 'px;')\n\t\t\t\tboxx.setAttribute(\"class\",\"imagcontainer\");\n\t\t\t\tboxx.setAttribute(\"onclick\",\"hide(event)\");\n\t\t\t\tboxx.setAttribute(\"ondrop\",\"drop2(event,idchanger)\");\n\t\t\t\tboxx.setAttribute(\"ondragover\",\"allowDrop(event,idchanger)\");\n\t\t\t\tworkingareapanel.appendChild(boxx);\n\t\t\t\t}\t\t\t \n}", "function buildMessageBoard() {\n //message board at bottom of screen, above the floor where paddel rests\n board = new createjs.Shape();\n board.graphics.beginFill('#333')\n .drawRect(0, 0, canvas.width, config.Game.SCORE_BOARD_HEIGHT);\n board.y = canvas.height - config.Game.SCORE_BOARD_HEIGHT;\n stage.addChild(board);\n //lives text\n livesTxt = new createjs.Text('lives: ' + lives, '20px Times', '#fff');\n livesTxt.y = board.y + 10;\n livesTxt.x = config.Game.WALL_THICKNESS;\n stage.addChild(livesTxt);\n //score text\n scoreTxt = new createjs.Text('score: ' + score, '20px Times', '#fff');\n scoreTxt.textAlign = 'right';\n scoreTxt.y = board.y + 10;\n scoreTxt.x = canvas.width - config.Game.WALL_THICKNESS;\n stage.addChild(scoreTxt);\n //message text\n messageTxt = new createjs.Text('press spacebar to pause', '18px Times', '#fff');\n messageTxt.textAlign = 'center';\n messageTxt.y = board.y + 10;\n messageTxt.x = canvas.width / 2;\n stage.addChild(messageTxt);\n }", "function preparaCanvas()\n{\n div = document.getElementById(\"lifegameBoard\");\n c.width = (cellsize + 1) * numeroColonne + 2;\n c.height = (cellsize + 1) * numeroRighe + 2;\n\n ctx.beginPath();\n disegnaCampo(\"#657b83\")\n ctx.stroke();\n div.appendChild(c);\n\n}", "function CreateBox(){\n for(i = 0; i < Letters.length; i++){\n var newBox = document.createElement(\"p\")\n var newContent = document.createTextNode(Letters[i])\n newBox.appendChild(newContent) \n \n newDiv.style.backgroundColor = \"red\"\n newDiv.appendChild(newBox)\n newDiv.hidden = true;\n }\n}", "function addStarterChars() {\n $.each(characters, function (index, value) {\n $('.slot[slot=' + index + ']').append(createCharCard(characters[index]));\n $('.slot[slot=' + index + '] > .charCard').data(characters[index]);\n });\n}", "function drawBoxes(boxesArray)\t{\n\tvar scene = document.getElementById('scene');\n\tfor (i=0; i < boxesArray.length; i++)\t{\n\t\tvar myDiv = document.createElement('div');\n\t\tmyDiv.setAttribute('id',boxesArray[i].id);\n\t\tmyDiv.style.backgroundColor = boxesArray[i].color;\n\t\tmyDiv.setAttribute('class','box');\n\t\tmyDiv.style.left = boxesArray[i].x +'px';\n\t\tmyDiv.style.top = boxesArray[i].y + 'px';\n\t\tmyDiv.innerHTML = boxesArray[i].name;\n\t\tmyDiv.onclick = displayBoxContents;\n\t\tscene.appendChild(myDiv);\n\t}\n\t\n}", "setupCharCards() {\n for (let i=0; i<this.characters.length; ++i) {\n $(\"#characterSelect\").append(this.createCharDiv(this.characters[i]));\n }\n }", "function letterCounter(boardid, tileid, char) {\n var shoveTile = { boardPos: boardid, tileId : tileid, charVal: char, immobile: false };\n tileObj = $.grep(tileObj, function(e){\n return e.tileId != tileid;\n });\n\n var result = $.grep(boardObj, function(e){ return e.tileId == tileid; });\n if (result.length != 0) {\n var $temp = '#block-' + result[0].boardPos;\n $($temp).droppable(\"enable\");\n }\n boardObj = $.grep(boardObj, function(e){\n return e.tileId != tileid;\n });\n\n boardObj.push(shoveTile);\n\n var $boardid = '#block-' + boardid;\n $($boardid).droppable(\"disable\");\n}", "function createBoard() {//create game board function, based on name chosen\n\tfor(i=0; i<arrGameName.length; i++) {\n\t\tif(arrGameName[i] === \" \") {//check if there is a blank space in array, if so run statement\n\t\t\tletterList = \"<li style='border-bottom:none;margin:0 15px 0 15px' id='\" + i + \"'>\" + arrGameName[i] + \"</li>\";//add <li> and class for blank space with id=i\n\t\t\tdocument.getElementById('game').innerHTML += letterList; \n\t\t} else {//if not black space add <li> with id=i\n\t\t\tletterList = \"<li id='\" + i + \"'></li>\";\n\t\t\tdocument.getElementById('game').innerHTML += letterList;\n\t\t}\n\t}\n}", "function generateHTML(character) {\n //ADD WITH APPPEND jQUERY METHOD\n $('#grid-characters').append(componentCharacterCard(character));\n}", "function put_character(workspace, char, x, y, fg, bg) {\n // Draw the character\n workspace.ctx.globalCompositeOperation = 'source-over';\n workspace.ctx.putImageData(char, x, y);\n // Overlay it with the foreground colour\n workspace.ctx.fillStyle = fg;\n workspace.ctx.globalCompositeOperation = 'source-atop';\n workspace.ctx.fillRect(x, y, font_width, font_height);\n // Draw the background colour behind it\n workspace.ctx.globalCompositeOperation = 'destination-over';\n workspace.ctx.fillStyle = bg;\n workspace.ctx.fillRect(x, y, font_width, font_height);\n }", "function boxes() {\n rectMode(CORNER);\n\n //array of different colored boxes\n for (var i = 0; i <= width - 20; i += 20) {\n for (var j = 0; j <= height - 20; j += 20) {\n stroke(0);\n fill(i * 0.50, j * 0.50, 180, 90);\n rect(i, j, 20, 20);\n }\n }\n\n noStroke();\n fill(textColor2);\n text(\"Move the mouse to make the white box move.\", 50, 50);\n\n}", "function createGameBoard(){\n // Store the value set to uppercase, spilt into arr in var\n inputWord = inputField.val();\n // Stores the return value for validate func\n let valiadation = validate(inputWord);\n if (valiadation) {\n inputWord = inputWord.toUpperCase().split('');\n input.hide();\n createLetterHolders(inputWord);\n createAlphabet();\n alphabet.show();\n wordField.show();\n }else {\n inputField.val('');\n }\n }// end createGameBoard func", "function fillCharacterSelection() {\n if (!($(\".user-instructions\").hasClass(\".basic-box\"))) { \n $(\".user-instructions\").empty();\n $(\".user-instructions\").addClass(\"basic-box\");\n $(\".user-instructions\").html(\"<p>Choose a character to play!</p>\");\n }\n for (var i = 0; i < characters.length; i++) {\n //Create character div\n var character = $(\"<div>\");\n character.addClass(\"character-box select-character\");\n character.attr(\"id\", characters[i].imgName);\n\n //Add image\n var imgName = \"<img class='character-image' id='\" + characters[i].imgName + \"Img' src='assets/images/\" + characters[i].imgName + \".jpg'/>\";\n character.append(imgName);\n\n\n //Add Character Name\n var charName = $(\"<h3>\");\n charName.addClass(\"character-name\");\n charName.text(characters[i].name);\n character.append(charName);\n\n //Add Hit Points\n var charHP = $(\"<h4>\");\n charHP.addClass(\"character-HP\");\n charHP.text(\"HP: \" + characters[i].hitPoints)\n character.append(charHP);\n\n //Add it to the screen\n $(\".select-character-list\").append(character);\n }\n }", "function init(){\r\n\r\n\tvar identifier =0;\r\n\r\n\tvar box1=document.getElementById('box1');\r\n\tvar box2=document.getElementById('box2');\r\n\tvar box3=document.getElementById('box3');\r\n\tvar box4=document.getElementById('box4');\r\n\tvar box5=document.getElementById('box5');\r\n\tvar box6=document.getElementById('box6');\r\n\tvar box7=document.getElementById('box7');\r\n\tvar box8=document.getElementById('box8');\r\n\tvar box9=document.getElementById('box9');\r\n\r\n\tfor(var i=0;i<N_SIZE;i++){\r\n\r\n\t\tfor(var j=0;j<N_SIZE;j++){\r\n\r\n\t\t\tvar cell;\r\n\r\n\t\t\tif(i==0 & j==0){ cell = box1;}\r\n\t\t\telse if(i==0 & j==1){ cell = box2;}\r\n\t\t\telse if(i==0 & j==2){ cell = box3;}\r\n\t\t\telse if(i==1 & j==0){ cell = box4;}\r\n\t\t\telse if(i==1 & j==1){ cell = box5;}\r\n\t\t\telse if(i==1 & j==2){ cell = box6;}\r\n\t\t\telse if(i==2 & j==0){ cell = box7;}\r\n\t\t\telse if(i==2 & j==1){ cell = box8;}\r\n\t\t\telse if(i==2 & j==2){ cell = box9;}\r\n\r\n\r\n\r\n\t\t\tcell.identifier=identifier;//know \r\n\t\t\tboxes.push(cell);\r\n\t\t\tidentifier+=+1;\r\n\t\t}\r\n\t}\r\n\t\r\n\r\n\tstartNewGame();\r\n\r\n}", "function place_player()\n{\n\tvar col;\n\tvar row;\n\t\n\tswitch(player_number)\n\t{\n\t\tcase 0:\n\t\t\tif(is_two_player_game)\n\t\t\t{\n\t\t\t\tcol = 27;\n\t\t\t\trow = 20;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcol = 27;\n\t\t\t\trow = 19;\n\t\t\t}\n\t\t\t\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tif(is_two_player_game)\n\t\t\t{\n\t\t\t\tcol = 29;\n\t\t\t\trow = 20;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcol = 29;\n\t\t\t\trow = 21;\n\t\t\t}\n\t\t\t\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tcol = 29;\n\t\t\trow = 19;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tcol = 27;\n\t\t\trow = 21;\n\t\t\tbreak;\n\t}\n\t\n\tvar player_text = Crafty.e(\"2D, DOM, Text\")\n\t\t.attr({x: col * 16, y: row * 16 - 15, w: 75})\n\t\t.textColor('#FFFFFF')\n\t\t.text(list_of_users[player_number]);\n\t\t\n\tplayer = Crafty.e('PlayerCharacter').at(col, row).attach(player_text);\n}", "function createGrid(board){\n if (board === 'board1') {\n var prefix = 'P1'\n } else {\n var prefix = 'P2'\n }\n board = document.getElementById(board)\n var letters = ['A', 'B', 'C','D','E','F','G','H','I','J']\n var tbl = document.createElement('table');\n var tblBody = document.createElement('tbody');\n\n for(var i = 0; i < 10; i++){\n var row = document.createElement('tr');\n for(var j = 0; j < 10; j++){\n var id = prefix + letters[j] + (i + 1);\n var col = document.createElement('td');\n col.setAttribute('id', id);\n col.setAttribute('class', 'box');\n row.appendChild(col);\n }\n tblBody.appendChild(row);\n }\n tbl.appendChild(tblBody);\n board.appendChild(tbl);\n\n\n}", "function createCharacterCell(character, characterTable, card) {\n currentCell = document.getElementById(`cell${characterCell}`);\n\n currentCell.hidden = false;\n\n currentCell.appendChild(card);\n}", "addBox(){\n\t\tvar x=Math.floor((Math.random()*this.width)); \n\t\tvar y=Math.floor((Math.random()*this.height)); \n\t\tif(this.getSquare(x,y)===null){\n\t\t\tvar velocity = new Pair(0,0);\n\t\t\tvar length = 50;\n\t\t\tvar health = 50;\n\t\t\tvar colour= 'rgba(223, 252, 3, 0.6)';\n\t\t\tvar position = new Pair(x,y);\n\t\t\t// check if the boxes would exceed the world\n\t\t\tif (position.x - length < 0){\n\t\t\t\tlength = position.x // boxes start from the left bound\n\t\t\t} \n\t\t\tif (position.x + length > this.width){\n\t\t\t\tlength = this.width - position.x // boxes end at the right bound\n\t\t\t} \n\t\t\tif (position.y - length < 0){\n\t\t\t\tlength = position.y // boxes start from the upper bound\n\t\t\t} \n\t\t\tif (position.y + length > this.height){\n\t\t\t\tlength = this.height - position.y // boxes end at the lower bound\n\t\t\t}\n\t\t\t// check if the boxes disappear after the above adjustments \n\t\t\tif (length != 0){\n\t\t\t\t// create the boxes and add to the list\n\t\t\t\t// the health of the boxes would be 50\n\t\t\t\tvar box = new Box(this, position, velocity, colour, length, health);\n\t\t\t\tthis.addSquare(box);\n\t\t\t\tthis.boxes_number += 1; // update the enemies number for stats\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}", "function drawGame(word, letters) {\n document.querySelector('#display-status').innerHTML = displayStatus(word, letters);\n document.querySelector('#letter-slots').innerHTML = letterSlots(word, letters);\n document.querySelector('#keyboard').innerHTML = keyboard(letters);\n}", "function createBoard(){\n\tdocument.body.style.setProperty('--size', size);\n\tdocument.body.style.setProperty('--grid-size', size+1);\n\n\tvar th = document.createElement('div');\n\tth.className = \"content head\";\n\tth.innerHTML = \"\";\n\tth.id = \"header\"\n\tdom.gameBoard.appendChild(th);\n\t//initialize alphabetical headers\n\tfor (var row = 0; row < size; row++) {\n\t\tvar letter = (row+10).toString(36);\n\t\tvar th = document.createElement('div');\n\t\tth.className = \"content head\";\n\t\tth.innerHTML = letter;\n\t\tth.id = \"header\"\n\t\tdom.gameBoard.appendChild(th);\n\t}\n\n\tfor(var i = 0; i < size; i++){\n\t\tvar th = document.createElement('div');\n\t\tth.className = \"content head\";\n\t\tth.innerHTML = i+1;\n\t\tth.id = \"header\"\n\t\tdom.gameBoard.appendChild(th);\n\n\t\tfor(var x = 1; x <= size; x++){\n\t\t\tvar cell = document.createElement(\"div\");\n\t\t\tcell.classList.add(\"content\");\n\n\t\t\t//logic for borders\n\t\t\tif (x == size){\n\t\t\t\tcell.classList.add(\"child-with-border\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcell.classList.add(\"child\");\n\t\t\t}\n\t\t\tif (i == size-1){\n\t\t\t\tcell.classList.add(\"child-edge\");\n\t\t\t}\n\t\t\tvar num = (i * (size) + x).toString();\n\t\t\tcell.id = \"cell\"+num;\n\t\t\tdom.gameBoard.appendChild(cell);\n\t\t}\n\t}\n}", "initBoardGraphic() {\n let board = document.createElement(\"div\");\n board.style.padding = `${BOARD_BORDER_THICKNESS}px`;\n board.id = \"board\";\n this.boardGraphic = board;\n this.container.appendChild(board);\n\n \n\n return board;\n }", "function init(){\n\n\tvar board=document.createElement('table');//create table \n\tboard.id='board';\n\tboard.setAttribute('border',1);\n\tboard.setAttribute('cellspacing',0);\n\n\n\tvar identifier =1;\n\n\tfor(var i=0;i<N_SIZE;i++){\n\t\tvar row=document.createElement('tr');\n\t\tboard.appendChild(row);\n\n\t\tfor(var j=0;j<N_SIZE;j++){\n\t\t\tvar cell=document.createElement('td');\n\t\t\tcell.setAttribute('height',3*110/(N_SIZE));\n\t\t\tcell.setAttribute('width',3*120/(N_SIZE));\n\t\t\tcell.setAttribute('align','center');\n\t\t\tcell.setAttribute('valign','center');\n\t\t\tcell.classList.add('col'+j,'row'+i);// learn\n\t\t\tif(i==j){\n\t\t\t\tcell.classList.add('diagonal0');\n\t\t\t}\n\t\t\tif(j==N_SIZE-i-1){\n\t\t\t\tcell.classList.add('diagonal1');\n\t\t\t}\n\n\t\t\tcell.identifier=identifier;//know \n\n\t\t\t// cell.addEventListener('click',set);\n\t\t\trow.appendChild(cell);\n\t\t\tboxes.push(cell);\n\t\t\tidentifier+=identifier;\n\t\t}\n\n\t}\n\tdocument.getElementById('tictactoe').appendChild(board);\n\tstartNewGame();\n\n}", "function init()\n{\n for (let i = 8; i > 0; i--)\n {\n for (let k = 0; k < 8; k++) \n {\n let mark = squareNames[k] + i;\n let div = document.createElement(\"div\");\n div.id = mark;\n \n div.style.width = \"98px\";\n div.style.height = \"98px\";\n div.style.cssFloat = 'left';\n div.style.border = 'solid 1px';\n \n //div.addEventListener('ondrop', drop_handler);\n document.getElementById(\"canvas\").appendChild(div);\n let piece = {\n mark: mark,\n chessPiece: \"\",\n pieceDiv: div,\n };\n \n initPiece(mark, piece);\n\n //board[i-1][k] = piece;\n board[mark] = piece;\n }\n }\n}", "makeBigger(){\n const nextCell = document.createElement(`div`);\n nextCell.classList.add(`snake-cell`);\n board.appendChild(nextCell);\n this.snake.push(nextCell);\n }", "function addNewCharacter(){\n\tlet topDiv = document.getElementById('new-character-container')\n\n\tlet newCharacterForm = document.getElementById('new-character')\n\t\tnewCharacterForm.addEventListener('submit', handleSubmit)\n\t\ttopDiv.appendChild(newCharacterForm)\n}", "setupC() {\n for(let i = 0; i < this.height; i++) {\n this.spaces.push(new Space(\"empty\"));\n if(i%2 == 0) {\n boxy.innerHTML += tokens;\n }\n }\n }", "function addNewBox () {\n if (input.value == \"\") {\n return false;\n } else { \n index++;\n var newDiv = document.createElement(\"div\");\n var inputValue = document.createTextNode(input.value);\n parent.appendChild(newDiv);\n newDiv.appendChild(inputValue)\n newDiv.setAttribute(\"id\", \"box-\"+index);\n\n var newCloseIcon = closeIconThree.cloneNode(true);\n newCloseIcon.setAttribute(\"id\", \"box-\"+index);\n newCloseIcon.setAttribute(\"onclick\", \"deleteNewBox()\");\n newDiv.appendChild(newCloseIcon);\n newDiv.setAttribute(\"style\", \"margin: 5px 2px;\");\n \n // for deleting new boxes\n newCloseIcon.addEventListener(\"click\", function deleteNewBox() {\n if (newDiv.id == newCloseIcon.id) {\n newDiv.parentNode.removeChild(newDiv);\n }\n });\n \n }\n}", "function addCharacterToCard(character, i){\n\n var front = document.createElement(\"div\");\n front.setAttribute(\"class\", \"front\");\n front.style.display = \"block\";\n\n var picture = document.createElement(\"img\");\n picture.src = \"../images/\"+images[character.Name]+\".png\";\n picture.alt = character.Name+\" Token\";\n front.appendChild(picture);\n\n var name = document.createElement(\"h2\");\n name.innerHTML = character.Name;\n front.appendChild(name);\n\n var culture = document.createElement(\"p\");\n culture.innerHTML = character.Culture;\n front.appendChild(culture);\n\n var born = document.createElement(\"p\");\n born.innerHTML = \"Born \" + character.Born;\n front.appendChild(born);\n\n var back = document.createElement(\"div\");\n back.setAttribute(\"class\", \"back\");\n back.style.display = \"none\";\n\n var titles = document.createElement(\"p\");\n titles.setAttribute(\"class\", \"titles\");\n titles.innerHTML = character.Titles.slice(0,3);\n back.appendChild(titles);\n\n var aliases = document.createElement(\"p\");\n aliases.setAttribute(\"class\", \"aliases\");\n aliases.innerHTML = character.Aliases.slice(0,3);\n back.appendChild(aliases);\n\n var allegiances = document.createElement(\"p\");\n allegiances.setAttribute(\"class\", \"allegiances\");\n allegiances.innerHTML = \"Allegiances: \";\n var allegianceIDs = character.Allegiances;\n for (var j = 0; j < allegianceIDs.length; j++){\n var houseIndex = allHouses.findIndex(element => element.Id == allegianceIDs[j]);\n var houseName = allHouses[houseIndex].Name;\n allegiances.innerHTML += \"<br />\" + houseName;\n }\n back.appendChild(allegiances);\n\n characterDivs[i].appendChild(front);\n characterDivs[i].appendChild(back);\n}", "function add() { \n gameCells = document.querySelectorAll('.game-square')\n \n gameCells.forEach(cell => {\n if (!cell.hasChildNodes()) {\n cell.addEventListener('click', mainGame.placeMove());\n }\n });\n }", "function createBoard(){\n\tdocument.body.style.setProperty('--size', size);//set\n\tdocument.body.style.setProperty('--grid-size', size+1);//set\n\n\tvar th = document.createElement('div');\n\tth.className = \"content head\";\n\tth.innerHTML = \"\";\n\tth.id = \"header\"\n\tdom.gameBoard.appendChild(th);\n\t//initialize alphabetical headers\n\tfor (var row = 0; row < size; row++) {\n\t\tvar letter = (row+10).toString(36);\n\t\tvar th = document.createElement('div');\n\t\tth.className = \"content head\";\n\t\tth.innerHTML = letter;\n\t\tth.id = \"header\"\n\t\tdom.gameBoard.appendChild(th);\n\t}\n\n\tfor(var i = 0; i < size; i++){\n\t\tvar th = document.createElement('div');\n\t\tth.className = \"content head\";\n\t\tth.innerHTML = i+1;\n\t\tth.id = \"header\"\n\t\tdom.gameBoard.appendChild(th);\n\n\t\tfor(var x = 1; x <= size; x++){\n\t\t\tvar cell = document.createElement(\"div\");\n\t\t\tcell.classList.add(\"content\");\n\t\t\t//logic for borderes\n\t\t\tif (x == size){\n\t\t\t\tcell.classList.add(\"child-with-border\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcell.classList.add(\"child\");\n\t\t\t}\n\t\t\tif (i == size-1){\n\t\t\t\tcell.classList.add(\"child-edge\");\n\t\t\t}\n\t\t\tvar num = (i * (size) + x).toString();\n\t\t\tcell.id = \"cell\"+num;\n\t\t\tdom.gameBoard.appendChild(cell);\n\t\t}\n\t}\n}", "function drawboard(location, word) {\n for (var i = 0; i < word.length; i++) {\n context.fillText('_ ', (location[0] + i * 20), location[1]);\n }\n }", "function addRect(x, y, w, h, fill) {\n var rect = new Box;\n rect.x = x;\n rect.y = y;\n rect.w = w\n rect.h = h;\n rect.fill = fill;\n boxes.push(rect);\n invalidate();\n}", "function addRect(x, y, w, h, fill) {\n\t\tvar rect = new Box2;\n\t\trect.x = x;\n\t\trect.y = y;\n\t\trect.w = w\n\t\trect.h = h;\n\t\trect.fill = fill;\n\t\tboxes2.push(rect);\n\t\tinvalidate();\n\t}", "addRandomBox(){\n\n\t\t// use a do...while statement because there can't be intersecting polygons\n\t\tdo{\n\n\t\t\t// random x and y coordinates, width and height\n\t\t\tvar startX = Phaser.Math.Between(10, game.config.width - 10 - gameOptions.sizeRange.max);\n\t\t\tvar startY = Phaser.Math.Between(10, game.config.height - 10 - gameOptions.sizeRange.max);\n\t\t\tvar width = Phaser.Math.Between(gameOptions.sizeRange.min, gameOptions.sizeRange.max);\n\t\t\tvar height = Phaser.Math.Between(gameOptions.sizeRange.min, gameOptions.sizeRange.max);\n\n\t\t\t// check if current box intersects other boxes\n\t\t} while(this.boxesIntersect(startX, startY, width, height));\n\n\t\t// draw the box\n\t\tthis.wallGraphics.strokeRect(startX, startY, width, height);\n\n\t\t// insert box vertices into polygons array\n\t\tthis.polygons.push([[startX, startY], [startX + width, startY], [startX + width, startY + height], [startX, startY + height]]);\n\t}", "function resizeBoxDraw(){\n state.boxArr.forEach(function(el){\n ctx.fillStyle = el.resizeStyle;\n ctx.fillRect(el.resize.top.x, el.resize.top.y, el.resize.top.w, el.resize.top.h)\n // ctx.fillRect(el.resize.bottom.x, el.resize.bottom.y, el.resize.bottom.w, el.resize.bottom.h)\n // ctx.fillRect(el.resize.left.x, el.resize.left.y, el.resize.left.w, el.resize.left.h)\n ctx.fillRect(el.resize.right.x, el.resize.right.y, el.resize.right.w, el.resize.right.h) \n })\n \n }", "function slotFiller() {\n\t//set the innerHTML of each slot to its letter1\n\tletter1.innerHTML = levelArray[currentLevel][0];\n\tletter2.innerHTML = levelArray[currentLevel][1];\n\tletter3.innerHTML = levelArray[currentLevel][2];\n\tletter4.innerHTML = levelArray[currentLevel][3];\n\tletter5.innerHTML = levelArray[currentLevel][4];\n\tletter6.innerHTML = levelArray[currentLevel][5];\n\tletter7.innerHTML = levelArray[currentLevel][6];\n\tletter8.innerHTML = levelArray[currentLevel][7];\n\t//this is static, it doesn't change until level up\n\t//set current char - this will change\n}", "function addCharacterCards(element, arr) {\n $.each(arr, function (indexInArray) {\n element.append(createCharacterCard(arr[indexInArray], indexInArray));\n });\n }", "function spawnSecondaryCharacters(x, y, elementId) {\r\n\tvar boxSd = new b2BoxDef();\r\n\tboxSd.density = 0.1;\r\n\tboxSd.friction = 0.0; //1.0 or 1.4\r\n\tboxSd.restitution = 0.1; // 0.4\r\n\tboxSd.extents.Set(20, 20); // 20 30\r\n\tboxSd.userData = document.getElementById(elementId);\r\n\tvar boxBd = new b2BodyDef();\r\n\tboxBd.AddShape(boxSd);\r\n\tboxBd.preventRotation = true;\r\n\tboxBd.position.Set(x,y);\r\n\tvar playerBody = game.world.CreateBody(boxBd);\r\n\treturn playerBody;\r\n}", "function drawMine(){\n // Draw the mine using buttons.\n // Set each button with id i-j to refer to the location in the 2d array. \n // Attribute clicked stores how many times this button is clicked.\n for(let i = 1; i <= height; i++){\n for (let j = 1; j <= width; j++){\n $(\"#mine-field\").append(\"<a class = 'btn' x = \" + i + \" y = \" + j + \n \" hasBomb = \" + minefield[i][j] + \" id = \" + i + \"-\" + j + \n \" clicked = 0 rclicked = 0\" + \">\" + \"</a>\");\n }\n $(\"#mine-field\").append(\"<br>\");\n }\n }", "constructor(canvas, x, y, w, h)\r\n\t{\r\n\t\tthis.x = x; //x of the box\r\n\t\tthis.y = y; //y of the box\r\n\t\t\r\n\t\tthis.w = w; //width of the box\r\n\t\tthis.h = h; //height of the box\r\n\t\t\r\n\t\tthis.id = Box.counter++; //giving unique id and incrementing counter\r\n\t\t\r\n\t\tcanvas.appendChild(this.box = document.createElement('div')); //box refers to the html element\r\n\t\tthis.box.id = 'Box_' + this.id; //giving unique id to the html element\r\n\t\tthis.box.classList.add('box'); //class just for box\r\n\t\tthis.box.classList.add('game_element'); //class for all game elements\r\n\t\t\r\n\t\tthis.draft(); //drawing box\r\n\t}", "place() {\n for (let i = 0; i < 7; i++) {\n let slot = `0${i}`;\n let slotElement = document.getElementById(slot);\n slotElement.addEventListener(\"click\", () => {\n //document.getElementById(slot).style.fill = \"ff0000\";\n\n let col = slot.substring(1);\n let piece = new gamePiece(this.playerTurn, col);\n this.drop(piece);\n //this.board.boardArr[row][col] = piece;\n });\n }\n }", "function addBoard(boardId, height, width) {\n var hCanvas = (parseInt(height)-120);\n var wCanvas = (parseInt((parseInt(width) / 100) * 98));\n /*set column height of board to equal screen height*/\n $('#bord').before('<div class=\"board-col\" id = \"bord' + boardId + '\" style=\"width: '+ wCanvas +'px; height: '+ hCanvas + 'px; position: absolute; z-index: 1000001;\">'\n + '<div id=\"menu' + boardId + '\" class=\"board_menu\"><div style=\"float: left;padding-bottom:0px;padding-left: 10px;\">Whiteboard</div>'\n + '<a type=\"button\" style=\"float:right;\" id = \"delete_board' + boardId + '\"><i class=\"fas fa-times boardicon\" style=\"padding:5px 5px 3px 5px;\"></i></a>'\n + '<a type=\"button\" style=\"float:right;\" id = \"max_board' + boardId + '\"><i class=\"fas fa-window-restore boardicon\" style=\"padding:5px 5px 0px 5px;\"></i></a>'\n + '<a type=\"button\" style=\"float:right;\" id = \"min_board' + boardId + '\"><i class=\"fas fa-window-minimize boardicon\" style=\"padding:5px 5px 3px 15px;\"></i></a>'\n + '<div class=\"dropdown\"><button class=\"dropbtn-menu dropdown-whiteboard\" id = \"clr_board' + boardId + '\">Colour</button>'\n + '<div class=\"dropdown-content dropdown-whiteboard\" style=\"min-width: 100px;\">'\n + '<a type=\"button\" id = \"color_blue\"><i class=\"fas fa-tint boardicon-blue\" style=\"padding:5px 10px 5px 5px;\"></i>Blue</a>'\n + '<a type=\"button\" id = \"color_red\"><i class=\"fas fa-tint boardicon-red\" style=\"padding:5px 10px 5px 5px;\"></i>Red</a>'\n + '<a type=\"button\" id = \"color_yellow\"><i class=\"fas fa-tint boardicon-yellow\" style=\"padding:5px 10px 5px 5px;\"></i>Yellow</a>'\n + '<a type=\"button\" id = \"color_green\"><i class=\"fas fa-tint boardicon-green\" style=\"padding:5px 10px 5px 5px;\"></i>Green</a>'\n + '<a type=\"button\" id = \"color_black\"><i class=\"fas fa-tint boardicon-black\" style=\"padding:5px 10px 5px 5px;\"></i>Black</a>'\n + '</div>'\n + '</div>'\n + '<div class=\"dropdown\"><button class=\"dropbtn-menu dropdown-whiteboard\" id = \"clr_board' + boardId + '\">Size</button>'\n + '<div class=\"dropdown-content dropdown-whiteboard\" style=\"min-width: 100px;\">'\n + '<a type=\"button\" id = \"width5\"><i class=\"fas fa-pen boardicon-pen5\" style=\"padding:5px 10px 5px 5px;\"></i>50</a>'\n + '<a type=\"button\" id = \"width4\"><i class=\"fas fa-pen boardicon-pen4\" style=\"padding:5px 11px 5px 5px;\"></i>40</a>'\n + '<a type=\"button\" id = \"width3\"><i class=\"fas fa-pen boardicon-pen3\" style=\"padding:5px 12px 5px 5px;\"></i>30</a>'\n + '<a type=\"button\" id = \"width2\"><i class=\"fas fa-pen boardicon-pen2\" style=\"padding:5px 13px 5px 5px;\"></i>20</a>'\n + '<a type=\"button\" id = \"width1\"><i class=\"fas fa-pen boardicon-pen1\" style=\"padding:5px 14px 5px 5px;\"></i>10</a>'\n + '</div>'\n + '</div>'\n + '<div class=\"dropdown\"><button class=\"dropbtn-menu dropdown-whiteboard\" id = \"clr_board' + boardId + '\">Eraser</button>'\n + '<div class=\"dropdown-content dropdown-whiteboard\" style=\"min-width: 100px;\">'\n + '<a type=\"button\" id = \"erase5\"><i class=\"fas fa-eraser boardicon-pen5\" style=\"padding:5px 10px 5px 5px;\"></i>50</a>'\n + '<a type=\"button\" id = \"erase4\"><i class=\"fas fa-eraser boardicon-pen4\" style=\"padding:5px 11px 5px 5px;\"></i>40</a>'\n + '<a type=\"button\" id = \"erase3\"><i class=\"fas fa-eraser boardicon-pen3\" style=\"padding:5px 12px 5px 5px;\"></i>30</a>'\n + '<a type=\"button\" id = \"erase2\"><i class=\"fas fa-eraser boardicon-pen2\" style=\"padding:5px 13px 5px 5px;\"></i>20</a>'\n + '<a type=\"button\" id = \"erase1\"><i class=\"fas fa-eraser boardicon-pen1\" style=\"padding:5px 14px 5px 5px;\"></i>10</a>'\n + '</div>'\n + '</div>'\n + '<div class=\"dropdown\"><button class=\"dropbtn-menu dropdown-whiteboard\" id = \"clr_board' + boardId + '\">Draw</button>'\n + '<div class=\"dropdown-content dropdown-whiteboard\" style=\"min-width: 100px;\">'\n + '<a type=\"button\" id = \"line7\"><i class=\"fas fa-arrows-alt-h boardicon-pen5\" style=\"padding:5px 10px 5px 5px;\"></i>Arrow</a>'\n + '<a type=\"button\" id = \"line6\"><i class=\"fas fa-arrow-right boardicon-pen5\" style=\"padding:5px 10px 5px 5px;\"></i>Arrow</a>'\n + '<a type=\"button\" id = \"line5\"><i class=\"fas fa-circle boardicon-pen4\" style=\"padding:5px 11px 5px 5px;\"></i>Circle</a>'\n + '<a type=\"button\" id = \"line4\"><i class=\"fas fa-square boardicon-pen3\" style=\"padding:5px 12px 5px 5px;\"></i>Square</a>'\n + '<a type=\"button\" id = \"line3\"><i class=\"fas fa-slash boardicon-pen2\" style=\"padding:5px 13px 5px 5px;\"></i>Line</a>'\n + '<a type=\"button\" id = \"line2\"><i class=\"fas fa-signature boardicon-pen1\" style=\"padding:5px 14px 5px 5px;\"></i>Draw</a>'\n + '<a type=\"button\" id = \"line1\"><i class=\"fas fa-caret-up boardicon-pen0\" style=\"padding:5px 14px 5px 5px;\"></i>Triangle</a>'\n + '</div>'\n + '</div>'\n + '<label class=\"color-picker\"><input type=\"color\" id=\"selectColor\" style=\"float:right; visibility: hidden;\"/><div id=\"selectClr\" class=\"fas fa-eye-dropper boardicon-select\" style=\"padding: 5px 5px 3px 5px; color: #000000\"></div></label>'\n + '<a type=\"button\" style=\"float:right;\" id = \"board_BG\"><i class=\"fas fa-clone boardicon-clone\" style=\"padding:5px 5px 3px 5px;\"></i></a>'\n + '<a type=\"button\" style=\"float:right;\" id = \"resize\"><i class=\"fas fa-compress boardicon-save\" style=\"padding:5px 5px 3px 5px;\"></i></a>'\n + '<a type=\"button\" style=\"float:right;\" id = \"downloadLnk\"><i class=\"fas fa-save boardicon-save\" style=\"padding:5px 5px 3px 5px;\"></i></a>'\n + '<input type=\"text\" style=\"float:right; font-weight: 100; font-size: 10pt; width: 150px; display: none;\" id=\"fileName\" name=\"fileName\"/>'\n + '<label class=\"color-picker\"><input type=\"file\" style=\"float:right; font-weight: 100; font-size: 10pt; width: 5px; visibility: hidden;\" id=\"imageLoader\" name=\"imageLoader\"/><div id=\"selectClr\" class=\"fas fa-file boardicon-select\" style=\"padding: 5px 5px 3px 5px; color: #000000\"></div></label>'\n + '<div style=\"padding: 0px;\"><BR>'\n + '<canvas id=\"canvas\" width = ' + parseInt(wCanvas-3) + ' height = ' + parseInt(hCanvas-45) + ' onmouseout=\"clearMousePositions()\"></canvas>'\n + '</div></div></div>');\n\n /*Set column dragable*/\n $('#bord' + boardId).attr('draggable', 'false');\n\n var imageLoader = document.getElementById('imageLoader');\n imageLoader.addEventListener('change', loadImage, false);\n\n downloadLnk.addEventListener('click', downloadFiles, false);\n\n var selectColor = document.getElementById('selectColor');\n selectColor.addEventListener('change', userColor, false);\n\n /*Delete selected column. */\n $('a[id ^= \"delete_board' + boardId + '\"]').on('click', function (event) {\n var column = $(this).parent().parent().attr('id');\n $('#' + column).remove();\n });\n\n $('a[id ^= \"min_board' + boardId + '\"]').on('click', function (event) {\n var column = $(this).parent().parent().attr('id');\n $('#' + column).css({ \"height\": \"150px\" });\n });\n\n $('a[id ^= \"max_board' + boardId + '\"]').on('click', function (event) {\n var column = $(this).parent().parent().attr('id');\n $('#' + column).css({ \"height\": \"\" });\n });\n\n canvas = $(\"#canvas\");\n ctx = canvas[0].getContext('2d');\n var hCanvas = (parseInt(pageHeight));\n var wCanvas = ((parseInt(pageWidth) / 100) * 98.5);\n ctx.fillStyle = \"#ffffff\";\n ctx.fillRect(0, 0, wCanvas, hCanvas);\n clr = 'black'; type = 'source-over'; drawType ='random';\n\n /*Set Colour of line*/\n $('a[id ^= \"color_black\"]').on('click', function (event) {\n clr = 'black';\n type = 'source-over';\n });\n $('a[id ^= \"color_red\"]').on('click', function (event) {\n clr = 'red';\n type = 'source-over';\n });\n $('a[id ^= \"color_yellow\"]').on('click', function (event) {\n clr = 'yellow';\n type = 'source-over';\n });\n $('a[id ^= \"color_green\"]').on('click', function (event) {\n clr = 'green';\n type = 'source-over';\n });\n $('a[id ^= \"color_blue\"]').on('click', function (event) {\n clr = 'blue';\n type = 'source-over';\n });\n /*Set width of line*/\n $('a[id ^= \"width1\"]').on('click', function (event) {\n wth = 1;\n type = 'source-over';\n });\n $('a[id ^= \"width2\"]').on('click', function (event) {\n wth = 3;\n type = 'source-over';\n });\n $('a[id ^= \"width3\"]').on('click', function (event) {\n wth = 5;\n type = 'source-over';\n });\n $('a[id ^= \"width4\"]').on('click', function (event) {\n wth = 8;\n type = 'source-over';\n });\n $('a[id ^= \"width5\"]').on('click', function (event) {\n wth = 10;\n type = 'source-over';\n });\n /*Set the action to erase and line width 10*/\n $('a[id ^= \"erase5\"]').on('click', function (event) {\n type = 'destination-out';\n wth = 12;\n drawType = 'random';\n });\n $('a[id ^= \"erase4\"]').on('click', function (event) {\n type = 'destination-out';\n wth = 10;\n drawType = 'random';\n });\n $('a[id ^= \"erase3\"]').on('click', function (event) {\n type = 'destination-out';\n wth = 8;\n drawType = 'random';\n });\n $('a[id ^= \"erase2\"]').on('click', function (event) {\n type = 'destination-out';\n wth = 6;\n drawType = 'random';\n });\n $('a[id ^= \"erase1\"]').on('click', function (event) {\n type = 'destination-out';\n wth = 4;\n drawType = 'random';\n });\n/*Set the action to select drawing tool*/\n $('a[id ^= \"line7\"]').on('click', function (event) {\n type = 'source-over';\n drawType = 'arrow2';\n });\n $('a[id ^= \"line6\"]').on('click', function (event) {\n type = 'source-over';\n drawType = 'arrow1';\n });\n $('a[id ^= \"line5\"]').on('click', function (event) {\n type = 'source-over';\n drawType = 'circle';\n });\n $('a[id ^= \"line4\"]').on('click', function (event) {\n wth = 1;\n type = 'source-over';\n drawType = 'square';\n });\n $('a[id ^= \"line3\"]').on('click', function (event) {\n type = 'source-over';\n drawType = 'straight';\n });\n $('a[id ^= \"line2\"]').on('click', function (event) {\n type = 'source-over';\n drawType = 'random';\n });\n $('a[id ^= \"line1\"]').on('click', function (event) {\n type = 'source-over';\n drawType = 'triangle';\n });\n /*Set background color between white and transparent*/\n $('a[id ^= \"board_BG\"]').on('click', function (event) {\n $(\"#bord\" + boardId).toggleClass(\"board-col-bg\");\n\n var hCanvas = (parseInt(pageHeight));\n var wCanvas = ((parseInt(pageWidth) / 100) * 98.5);\n ctx.clearRect(0, 0, wCanvas, hCanvas);\n });\n /*Set resize of image and canvas*/\n $('a[id ^= \"resize\"]').on('click', function (event) {\n var hCanvas = (parseInt(pageHeight));\n var wCanvas = ((parseInt(pageWidth) / 100) * 98.5);\n var pDiv = 'bord' + boardId;\n resizeWhiteBoard(hCanvas, wCanvas, pDiv);\n\n });\n\n $(function () {\n $('.board-col').css('border', '1px solid grey');\n /*move the work area to the top as the item is dragged over the other work areas by increasing the z-index*/\n $(\"#bord\" + boardId).droppable({\n over: function (event, ui) {\n $(\"#\" + dragFrom).css(\"z-index\", colUAZindex++);\n }\n });\n });\n\n \"use strict\";\n\n var CLIPBOARD = new CLIPBOARD_CLASS(\"canvas\", false);\n\n connection = new signalR.HubConnectionBuilder()\n .withUrl('/draw')\n .build();\n\n /*connection.on('draw', function (prev_x, prev_y, x, y, clr, wth, type) {\n rawCanvas(prev_x, prev_y, x, y, clr, wth, type);\n });*/\n connection.start();\n\n // calculate where the canvas is on the window these vars will hold the starting mouse position\n var $canvas = $(\"#canvas\");\n var canvasOffset = $canvas.offset();\n var offsetX = canvasOffset.left;\n var offsetY = canvasOffset.top;\n var canvasx = $(canvas).offset().left;\n var canvasy = $(canvas).offset().top;\n var mousex = mousey = 0;\n // listen for mouse events\n $(\"#canvas\").mousedown(function (e) {\n if (drawType == 'square') {\n squareMouseDown(e, canvasOffset, offsetX, offsetY);\n }\n else if (drawType == 'random') {\n randomMouseDown(e, canvasOffset, canvasx, canvasy);\n }\n else if (drawType == 'circle') {\n circleMouseDown(e, canvasOffset, offsetX, offsetY);\n }\n else if (drawType == 'triangle') {\n triangleMouseDown(e, canvasOffset, offsetX, offsetY);\n }\n else if (drawType == 'straight') {\n lineMouseDown(e, canvasOffset, offsetX, offsetY);\n }\n else if (drawType == 'arrow1') {\n arrowLineMouseDown(e, offsetX, offsetY);\n }\n else if (drawType == 'arrow2') {\n arrowLineMouseDown(e, offsetX, offsetY);\n }\n });\n $(\"#canvas\").mousemove(function (e) {\n if (drawType == 'square') {\n squareMouseMove(e, canvasOffset, startX, startY, offsetX, offsetY);\n }\n else if (drawType == 'random') {\n randomMouseMove(e, canvasOffset, canvasx, canvasy, mousex, mousey);\n }\n else if (drawType == 'circle') {\n circleMouseMove(e, canvasOffset, offsetX, offsetY);\n }\n else if (drawType == 'triangle') {\n triangleMouseMove(e, canvasOffset, offsetX, offsetY);\n }\n else if (drawType == 'straight') {\n lineMouseMove(e, canvasOffset, offsetX, offsetY);\n }\n else if (drawType == 'arrow1') {\n arrowLineMouseMove(e);\n }\n else if (drawType == 'arrow2') {\n arrowLineMouseMove(e);\n }\n });\n $(\"#canvas\").mouseup(function (e) {\n if (drawType == 'square') {\n squareMouseUp(e);\n }\n else if (drawType == 'random') {\n randomMouseUp(e);\n }\n else if (drawType == 'circle') {\n circleMouseUp(e);\n }\n else if (drawType == 'triangle') {\n triangleMouseUp(e);\n }\n else if (drawType == 'straight') {\n lineMouseUp(e, offsetX, offsetY);\n }\n else if (drawType == 'arrow1') {\n arrowLineMouseUp(e, offsetX, offsetY, 5, 8, false, true);\n }\n else if (drawType == 'arrow2') {\n arrowLineMouseUp(e, offsetX, offsetY, 5, 8, true, true);\n }\n });\n $(\"#canvas\").mouseout(function (e) {\n if (drawType == 'square') {\n squareMouseOut(e);\n }\n else if (drawType == 'random') {\n randomMouseOut(e);\n }\n else if (drawType == 'circle') {\n circleMouseOut(e);\n }\n else if (drawType == 'triangle') {\n triangleMouseOut(e);\n }\n else if (drawType == 'straight') {\n lineMouseOut(e);\n }\n else if (drawType == 'arrow1') {\n arrowLineMouseOut(e);\n }\n else if (drawType == 'arrow2') {\n arrowLineMouseOut(e);\n }\n });\n\n //reset last mouse position back to home \n clearMousePositions = function () {\n last_mousex = 0;\n last_mousey = 0;\n }\n}", "function createBoard() {\n for (let i = 0; i < width * width; i++) {\n const square = document.createElement(\"div\");\n //put this child into the gird\n grid.appendChild(square);\n squares.push(square);\n\n // Assigning a random colour to each div\n let randomColor = Math.floor(Math.random() * coloursOfCancy.length);\n square.style.backgroundImage = coloursOfCancy[randomColor];\n\n //To drag each square and give unique ID to each cell so we can see which square is actually moved.\n square.setAttribute(\"draggable\", \"true\");\n square.setAttribute(\"id\", i);\n }\n }" ]
[ "0.6886482", "0.66848356", "0.6679635", "0.6599066", "0.65682465", "0.6531686", "0.6527432", "0.643013", "0.6408846", "0.6386122", "0.6307393", "0.63026726", "0.62909484", "0.62809265", "0.6268311", "0.62595916", "0.6258533", "0.6212745", "0.6212403", "0.6182016", "0.6146454", "0.61401635", "0.61375105", "0.6125702", "0.6113554", "0.611218", "0.6078527", "0.60665846", "0.6054322", "0.6048167", "0.60464567", "0.6042702", "0.60126543", "0.59942496", "0.5991906", "0.5991742", "0.5982538", "0.59777826", "0.59741014", "0.59648657", "0.59564227", "0.59532017", "0.5946441", "0.59432536", "0.5936728", "0.5936096", "0.5932247", "0.59301037", "0.5923359", "0.59186035", "0.59132683", "0.590919", "0.59077483", "0.5907465", "0.5900224", "0.5892931", "0.58913416", "0.5891251", "0.5888138", "0.5882804", "0.5880246", "0.58761305", "0.5868727", "0.5857927", "0.5857219", "0.5846522", "0.5844838", "0.58424675", "0.58418864", "0.5840887", "0.5839787", "0.5839346", "0.5835854", "0.58224756", "0.58217543", "0.5813534", "0.5809961", "0.5808669", "0.580569", "0.5803633", "0.5803297", "0.580166", "0.58005434", "0.5799547", "0.579931", "0.5793413", "0.5790024", "0.5789792", "0.57886195", "0.57848746", "0.57756144", "0.5772565", "0.5772299", "0.5769598", "0.57682484", "0.5765976", "0.57659715", "0.5765832", "0.5765721", "0.5763041", "0.5761348" ]
0.0
-1
aborts the execution with the specified error message
function abort(message) { util.error(message); process.exit(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abort() {\n }", "abort () {\n // ...\n }", "function abort(what) {\n if (Module['onAbort']) {\n Module['onAbort'](what);\n }\n\n what += '';\n out(what);\n err(what);\n\n ABORT = true;\n EXITSTATUS = 1;\n\n var output = 'abort(' + what + ') at ' + stackTrace();\n what = output;\n\n // Throw a wasm runtime error, because a JS error might be seen as a foreign\n // exception, which means we'd run destructors on it. We need the error to\n // simply make the program stop.\n throw new WebAssembly.RuntimeError(what);\n}", "abort() {\n this.aborted = true;\n requestErrorSteps(this);\n updateReadyState(this, FakeXMLHttpRequest.UNSENT);\n }", "function error(message) {\n\talert('Error occured, unable to proceed.');\n\tthrow Error(message);\n}", "function setFailed(message) {\r\n process.exitCode = ExitCode.Failure;\r\n error(message);\r\n}", "function setFailed(message) {\r\n process.exitCode = ExitCode.Failure;\r\n error(message);\r\n}", "onabort() {}", "async abort() {\n return;\n }", "function abort() {\r\n console.log.apply(null, arguments);\r\n program.help();\r\n process.exit(1);\r\n}", "abort() {\n abortSignal(getSignal(this));\n }", "abort() {\n abortSignal(getSignal(this));\n }", "function exitWithArgError(message)\n{\n\tprint(\"ERROR: \" + message);\n\tprint();\n\n\tprintHelp();\n\n\tdelete testEnv;\n\tjava.lang.System.exit(1);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}", "function error(msg, _continue) {\n if (state.error === null)\n state.error = '';\n state.error += state.currentCmd + ': ' + msg + '\\n';\n \n if (msg.length > 0)\n log(state.error);\n \n if (config.fatal)\n process.exit(1);\n \n if (!_continue)\n throw '';\n }", "abort() {\n this.emit('abort');\n }", "function error(message) {\n command_1.issue('error', message);\n}", "function error(message) {\n command_1.issue('error', message);\n}", "function error(message) {\n command_1.issue('error', message);\n}", "function error(message) {\n command_1.issue('error', message);\n}", "function error(message) {\n command_1.issue('error', message);\n}", "function setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n }", "function fail(message) {\r\n\t throw new Error(message);\r\n\t}", "function error(message) {\r\n command_1.issue('error', message);\r\n}", "function error(message) {\r\n command_1.issue('error', message);\r\n}", "BreakOperation() {\n this._message = \"The test operation ended with errors\";\n }", "function exitError() {\n process.exit(1);\n }", "function fail() {\n\n var text = \"Something has gone wrong:\\n\";\n for(var i=0; i < arguments.length; ++i)\n text += \"\\n\" + arguments[i];\n line = '\\n--------------------------------------------------------';\n text += line + '\\nCALL STACK' + line + '\\n' +\n new Error().stack + line;\n console.log(text);\n alert(text);\n stop();\n // It makes no sense that we can throw after calling stop(),\n // but it works.\n throw text;\n}", "function error(message) {\n throw message;\n}", "function fail(message) {\n throw new Error(message);\n }", "function WebauthnAbortError () {\n this.name = Enums.WEBAUTHN_ABORT_ERROR;\n}", "abortErrorReason() {\n throw new Error('Not implemented');\n }", "function cli_error(message) {\n console.error(`error: ${message}`);\n process.exit(1);\n}", "abort() {\n if (this._objectWriter) {\n this._objectWriter.abort();\n } else {\n throw(createError(ErrorCode.ABORTED, 'Abort was triggered.'));\n this.destroy();\n }\n }", "function error(errorText)\n{\n alert('ERROR: ' + errorText);\n\n throw errorText;\n}", "abort () {\n this.request.abort();\n }", "function send_err(msg, input) {\n\t\t\tsendMsg({ msg: 'tx_error', e: msg, input: input });\n\t\t\tsendMsg({ msg: 'tx_step', state: 'committing_failed' });\n\t\t}", "function send_err(msg, input) {\n\t\t\tsendMsg({ msg: 'tx_error', e: msg, input: input });\n\t\t\tsendMsg({ msg: 'tx_step', state: 'committing_failed' });\n\t\t}", "function fail(msg) { throw new Error(msg); }", "function fail(message) {\n throw new Error(message);\n}", "function fail(message) {\n throw new Error(message);\n}", "function caml_failwith (msg) {\n caml_raise_with_string(caml_global_data[3], msg);\n}", "abort() {\n // Abort is not supported for this uploader\n }", "function fail() {\r\n\terror(new Error(join(arguments, ' ')));\r\n}", "function errorExit () {\n var msg = _.toArray(arguments).join(' ') + '\\n'\n process.stderr.write(msg)\n process.exit(1)\n}", "function ExecError(m) {\n this.message = m;\n}", "abort() {\n this.transaction_.abort();\n }", "async cancel() {\n throw new Error(this.cancelMessage);\n }", "function verificationError(msg) {\n if (inharness) {\n window.parent.JSBNG_handleResult({error:true, msg: msg});\n } else replayMessage(msg);\n throw new Error();\n }", "function cancelTask(err) {\n var message = Array.prototype.slice.call(arguments).map(function (message) {\n return String(message);\n }).join(' ');\n console.error(message);\n process.exit(1);\n }", "function abortRequest(){\n this.aborted = true;\n this.clearTimeout();\n this.emit('abort');\n}", "async function main() {\n try {\n await main_();\n } catch (error) {\n if (error !== help) {\n // re-throwing here causes \"Quitting on a rejected promise...\"\n console.log(error);\n process.exit(1);\n }\n }\n}", "function quit(code, line, chr) {\n var percentage = Math.floor((line / state.lines.length) * 100);\n var message = messages.errors[code].desc;\n \n throw {\n name: \"JSHintError\",\n line: line,\n character: chr,\n message: message + \" (\" + percentage + \"% scanned).\",\n raw: message,\n code: code\n };\n }" ]
[ "0.73568654", "0.7273281", "0.66536456", "0.6487658", "0.64087343", "0.64084333", "0.64084333", "0.6369309", "0.6358718", "0.63555205", "0.6352029", "0.6352029", "0.6335197", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.63286936", "0.6302333", "0.6247581", "0.6247581", "0.6247581", "0.6247581", "0.6247581", "0.62475586", "0.62467366", "0.6209486", "0.6209486", "0.6205144", "0.61951077", "0.6178317", "0.6137173", "0.61278206", "0.6053689", "0.6041075", "0.6030873", "0.60001606", "0.5971379", "0.5966437", "0.59589624", "0.59589624", "0.59562147", "0.5953118", "0.5953118", "0.59236896", "0.5911848", "0.58452797", "0.58409524", "0.5838515", "0.5812201", "0.5797757", "0.5792071", "0.578703", "0.5781438", "0.578067", "0.57438946" ]
0.7767521
0
Trim 'node' and the script path.
function isOption(arg) { return (/^-/).test(arg); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "truncatePath(path) {\n\n // remove the project root\n if (path.startsWith(rootPath)) path = path.substr(rootPath.length+1);\n else if (path.startsWith(`file://${rootPath}`)) path = path.substr(rootPath.length+1+7);\n\n // check for node modules, remove that\n const index = path.lastIndexOf('node_modules');\n if (index >= 0) path = 'nm:'+path.substr(index+'node_modules'.length);\n\n return path;\n }", "function cleanScript(value) {\n return value\n // Remove carriage returns, comments, trailing whitespace\n .replace(/\\r|\\s*!.*$|[ \\t]+$/gm, '')\n\n // Remove blank lines\n .replace(/\\n{2,}/g, '\\n')\n\n // Remove first blank lines\n .replace(/^\\n+/, '');\n}", "trim(fileName) {\n fileName = BasePath.normalize(fileName);\n for (let n = 0, c = this.basePaths.length; n < c; n++) {\n const basePath = this.basePaths[n];\n if (fileName.substring(0, basePath.length) === basePath) {\n return fileName.substring(basePath.length + 1);\n }\n }\n return fileName;\n }", "cleanScript(jsfile) {// N/A in web\n }", "function removeLeadingSlash(path) {\n return path.replace(/^[/\\\\]+/, '');\n}", "function trimOut(inp)\r\n{\r\n\tlet temp=inp.substring(inp.lastIndexOf(\"/\")+1,inp.length);\r\n\treturn temp.trim();\r\n}", "function rtrim(path) {\n\t\treturn _.str.rtrim(path, \"/\");\n\t}", "function removeTrailingSlash(path) {\n return path.replace(/[/\\\\]+$/, '');\n}", "_stripLeadingSlash(path) {\n if (path[0] === '/') {\n return path.slice(1);\n }\n return path;\n }", "function trimSlashes(path) {\n\tconst from = path[0] === \"/\" ? 1 : undefined;\n\tconst to = path[path.length - 1] === \"/\" ? -1 : undefined;\n\n\treturn path.slice(from, to);\n}", "function stripFilename(path) {\n if (!path)\n return '';\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n }", "function stripFilename(path) {\n if (!path)\n return '';\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n }", "clearSlashes(path) {\n return path.toString().replace(/\\/$/, '').replace(/^\\//, '');\n }", "clearSlashes(path) {\n return path.toString().replace(/\\/$/, '').replace(/^\\//, '');\n }", "function sanitizePath(path) {\n var clean;\n // Handle spaces\n if (path.indexOf(\" \") > -1) {\n if (PLATFORM === \"darwin\" || PLATFORM === \"linux\") {\n clean = replaceAll(path, \" \", \"\\\\ \");\n }\n else {\n clean = '\"' + path + '\"';\n }\n }\n else {\n clean = path;\n }\n return clean;\n}", "function removeSlash(path) {\n if (path.indexOf('/') === 0) {\n path = path.slice(1);\n }\n return path;\n }", "function removeSlash(path) {\n if (path.indexOf('/') === 0) {\n path = path.slice(1);\n }\n return path;\n }", "static _getSpaceRoot(){\n return process.cwd(); //path.dirname(module.parent.paths[0])\n }", "function stripFilename(path) {\n if (!path)\n return '';\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}", "removeLeadingSlash(text) {\n if (text.startsWith('/') || text.startsWith('\\\\')) {\n return text.substring(1);\n }\n else {\n return text;\n }\n }", "function getShortPath(entry, currentWorkingDirectory) {\n return entry.replace(currentWorkingDirectory, \"\");\n}", "function scriptPath() {\n try {\n return app.activeScript;\n }\n catch (e) {\n return File(e.fileName);\n }\n}", "function scriptPath()\n {\n // obtain plugin path from the script element\n var src;\n if (document.currentScript) {\n src = document.currentScript.src;\n } else {\n var sel = document.querySelector('script[src$=\"/whiteboard.js\"]')\n if (sel) {\n src = sel.src;\n }\n }\n\n var path = typeof src === undefined ? src\n : src.slice(0, src.lastIndexOf(\"/\") + 1);\n return path;\n }", "function removePrefix(path){\r\n\tvar result = \"\";\r\n\tvar parts = path.split(\"://\");\r\n\tresult += parts[1];\r\n\treturn result;\r\n}", "function clean(node) {\n if ( node.source ) {\n var file = node.source.input.file\n node.source = {input:{}}\n node.source.input.file = path.basename(file);\n }\n if ( node.nodes ) node.nodes = node.nodes.map(clean);\n return node;\n}", "function stripArgs (cmd) {\n if (cmd) return cmd.split(' ')[0]\n}", "function normalizePath(path) { return path.replace(/\\\\/g, '/') }", "function trimPath(path, num = 1) {\n const split = path.split('/');\n const { length } = split;\n return split.slice(0, length - num).join('/');\n}", "function drop_double_slashes(pathname) {\n return pathname.replace(/\\/\\//g,'/');\n}", "static clean(string) {\n if (typeof string === 'string') {\n return string.trim().replace(/\\/$/, '');\n }\n return string;\n }", "function String_StripLineFeed()\n{\n\t//remove targets\n\treturn this.replace(/\\r/g, \"\").replace(/\\n/g, \"\");\n}", "function filterPath(string) {\n return string\n .replace(/^\\//, '')\n .replace(/(index|default).[a-zA-Z]{3,4}$/, '')\n .replace(/\\/$/, '');\n }", "function normalizeWhitespace(str) {\n return str ? str.replace(/^\\s+$|\\s+$/g, \"\").replace(/\\s\\s+/g, \" \") : \"\";\n } // Get script object based on the `src` URL", "function getScriptPath() {\n var scripts = document.getElementsByTagName('SCRIPT');\n var fileRegex = new RegExp('\\/ndt-wrapper\\.js$');\n var path = '';\n if (scripts && scripts.length > 0) {\n for(var i in scripts) {\n if(scripts[i].src && scripts[i].src.match(fileRegex)) {\n path = scripts[i].src.replace(fileRegex, '');\n break;\n }\n }\n }\n return path.substring(location.origin.length);\n}", "function _getBasePath() {\r\n\tvar refPath = '/assets/kindeditor/';\r\n\tvar els = document.getElementsByTagName('script'), src;\r\n\tfor (var i = 0, len = els.length; i < len; i++) {\r\n\t\tsrc = els[i].src || '';\r\n\t\tif (/(kindeditor|application)[\\w\\-\\.]*\\.js/.test(src)) {\r\n\t\t\treturn src.substring(0, src.indexOf('assets')) + refPath;\r\n\t\t}\r\n\t}\r\n\treturn refPath;\r\n}", "function clearGoRuntimeBaseFromPATH() {\n if (exports.terminalCreationListener) {\n const l = exports.terminalCreationListener;\n exports.terminalCreationListener = undefined;\n l.dispose();\n }\n const pathEnvVar = pathEnvVarName();\n if (!pathEnvVar) {\n goLogging_1.logVerbose(`couldn't find PATH property in process.env`);\n return;\n }\n environmentVariableCollection === null || environmentVariableCollection === void 0 ? void 0 : environmentVariableCollection.delete(pathEnvVar);\n}", "function strip(str) {\n return str.replace(/^[\\/]+|[\\/]+$/g, '');\n}", "function stripSlash(url) {\n return url.replace(/\\/$/, '');\n}", "function stripSlash(url) {\n return url.replace(/\\/$/, '');\n}", "function filterPath(string) {\n return string\n .replace(/^\\//, '')\n .replace(/(index|default).[a-zA-Z]{3,4}$/, '')\n .replace(/\\/$/, '');\n }", "function safeTrimTrailingSeparator(p) {\n // Short-circuit if empty\n if (!p) {\n return '';\n }\n // Normalize separators\n p = normalizeSeparators(p);\n // No trailing slash\n if (!p.endsWith(path.sep)) {\n return p;\n }\n // Check '/' on Linux/macOS and '\\' on Windows\n if (p === path.sep) {\n return p;\n }\n // On Windows check if drive root. E.g. C:\\\n if (IS_WINDOWS && /^[A-Z]:\\\\$/i.test(p)) {\n return p;\n }\n // Otherwise trim trailing slash\n return p.substr(0, p.length - 1);\n}", "function safeTrimTrailingSeparator(p) {\n // Short-circuit if empty\n if (!p) {\n return '';\n }\n // Normalize separators\n p = normalizeSeparators(p);\n // No trailing slash\n if (!p.endsWith(path.sep)) {\n return p;\n }\n // Check '/' on Linux/macOS and '\\' on Windows\n if (p === path.sep) {\n return p;\n }\n // On Windows check if drive root. E.g. C:\\\n if (IS_WINDOWS && /^[A-Z]:\\\\$/i.test(p)) {\n return p;\n }\n // Otherwise trim trailing slash\n return p.substr(0, p.length - 1);\n}", "function safeTrimTrailingSeparator(p) {\n // Short-circuit if empty\n if (!p) {\n return '';\n }\n // Normalize separators\n p = normalizeSeparators(p);\n // No trailing slash\n if (!p.endsWith(path.sep)) {\n return p;\n }\n // Check '/' on Linux/macOS and '\\' on Windows\n if (p === path.sep) {\n return p;\n }\n // On Windows check if drive root. E.g. C:\\\n if (IS_WINDOWS && /^[A-Z]:\\\\$/i.test(p)) {\n return p;\n }\n // Otherwise trim trailing slash\n return p.substr(0, p.length - 1);\n}", "function safeTrimTrailingSeparator(p) {\n // Short-circuit if empty\n if (!p) {\n return '';\n }\n // Normalize separators\n p = normalizeSeparators(p);\n // No trailing slash\n if (!p.endsWith(path.sep)) {\n return p;\n }\n // Check '/' on Linux/macOS and '\\' on Windows\n if (p === path.sep) {\n return p;\n }\n // On Windows check if drive root. E.g. C:\\\n if (IS_WINDOWS && /^[A-Z]:\\\\$/i.test(p)) {\n return p;\n }\n // Otherwise trim trailing slash\n return p.substr(0, p.length - 1);\n}", "function safeTrimTrailingSeparator(p) {\n // Short-circuit if empty\n if (!p) {\n return '';\n }\n // Normalize separators\n p = normalizeSeparators(p);\n // No trailing slash\n if (!p.endsWith(path.sep)) {\n return p;\n }\n // Check '/' on Linux/macOS and '\\' on Windows\n if (p === path.sep) {\n return p;\n }\n // On Windows check if drive root. E.g. C:\\\n if (IS_WINDOWS && /^[A-Z]:\\\\$/i.test(p)) {\n return p;\n }\n // Otherwise trim trailing slash\n return p.substr(0, p.length - 1);\n}", "function safeTrimTrailingSeparator(p) {\n // Short-circuit if empty\n if (!p) {\n return '';\n }\n // Normalize separators\n p = normalizeSeparators(p);\n // No trailing slash\n if (!p.endsWith(path.sep)) {\n return p;\n }\n // Check '/' on Linux/macOS and '\\' on Windows\n if (p === path.sep) {\n return p;\n }\n // On Windows check if drive root. E.g. C:\\\n if (IS_WINDOWS && /^[A-Z]:\\\\$/i.test(p)) {\n return p;\n }\n // Otherwise trim trailing slash\n return p.substr(0, p.length - 1);\n}", "function getPathPrefix() {\n return THIS_SCRIPT.src.substring(\n 0,\n THIS_SCRIPT.src.lastIndexOf('/')\n ) + '/';\n}", "function drop_double_slashes(pathname) {\n return pathname.replace(/\\/\\//g, '/');\n}", "function sanitizePath(path) {\n var path = path.charAt(0) == '/' ? path : \"/\" + path;\n return path.replace(/\\#.*|\\?.*/, '');\n }", "function removePath(filename) {\n var pos = filename.lastIndexOf(\"/\");\n return filename.substr(pos+1);\n}", "function scriptPath() {\n\t\t// obtain plugin path from the script element\n\t\tvar path;\n\t\tif (document.currentScript) {\n\t\t\tpath = document.currentScript.src.slice(0, -20);\n\t\t} else {\n\t\t\tvar sel = document.querySelector('script[src$=\"scrollable_slides.js\"]');\n\t\t\tif (sel) {\n\t\t\t\tpath = sel.src.slice(0, -20);\n\t\t\t}\n }\n\n\t\treturn path;\n\t}", "function cleanAttachNodePath(node){\n if (node.payload !== undefined) {\n node.payload.referenceParentCombinedNodePath = undefined\n if (node.savedPayload !== undefined) {\n node.savedPayload.referenceParentCombinedNodePath = undefined\n }\n }\n }", "clearPath() {\n if (this.node.data.isFolder() || this.node.data.isRepo()) {\n this.deployFile.targetPath = this.node.data.path;\n } else {\n this.deployFile.targetPath = this.deployFile.targetPath.replace(\"/\" + this.deployFile.fileName, \"\");\n }\n this.uploadCompleted = false;\n }", "function dwscripts_stripScriptDelimiters(expression)\n{\n var dom = dw.getDocumentDOM();\n var delimInfo = dom.serverModel.getDelimiters();\n var i = 0;\n var delim = null;\n var re = null;\n var match = null;\n var retVal = \"\";\n var withoutDelimiters = null;\n\n // Iterate through all the script delimiters for this server model, looking\n // for one that matches expression. If multiple matches are found, choose\n // the one that trims the most characters off the beginning and end of the\n // expression (i.e.: choose \"<%=\" over \"<%\")\n for (i=0; i < delimInfo.length; i++)\n {\n delim = delimInfo[i];\n re = new RegExp(\"^\" + delim.startPattern + \"([^\\\\0]*)\" + delim.endPattern + \"$\", \"i\");\n match = re.exec(expression);\n if (match != null)\n {\n withoutDelimiters = match[1];\n if (retVal.length == 0 || withoutDelimiters.length < retVal.length)\n retVal = withoutDelimiters;\n }\n }\n \n // If no match was found, just return the original expression \n if (retVal.length == 0)\n return expression;\n\n // Trim space off the beginning and ending of the string\n var firstChar = 0;\n var lastChar = retVal.length - 1;\n while (retVal[firstChar] == ' ' && firstChar < lastChar)\n firstChar++;\n while (retVal[lastChar] == ' ' && lastChar > firstChar)\n lastChar--;\n retVal = retVal.substr(firstChar, lastChar-firstChar+1);\n\n return retVal;\n}", "function minifyJS(script) {\n /**\n * Strip unnecessary parts:\n * - Block comment: /\\/\\*[^\\*]*?\\*\\//gm\n * - Line comment: /^\\s*\\/\\/.+$/gm\n * - Leading indentation: /^\\s+/gm\n * - Line break: /\\n/gm\n */\n const kStripRE = /\\/\\*[^\\*]*?\\*\\/|^\\s*\\/\\/.+$|^\\s+|\\n/gm;\n\n return script.replace(kStripRE, '');\n }", "function basename(path) { return path.replace( /.*\\//, \"\" ); }", "function removeModuleDirCalls() {\n return replace({\n delimiters: ['', ''],\n values: {\n 'getModuleDirectory(import.meta)': '\"\"',\n },\n });\n}", "function currentDir() {\n var s = WScript.scriptFullName\n s = s.substring(0, s.lastIndexOf(\"\\\\\") + 1)\n return s\n}", "function filterPath(string) {\n return string\n .replace(/^\\//,'')\n .replace(/(index|default).[a-zA-Z]{3,4}$/,'')\n .replace(/\\/$/,'');\n}", "rel (relativePath) {\n return nodePath.normalize(relativePath);\n }", "function defaultWebRoot()\n{\n\tconst file= Path.traceBack( 2, );\n\t\n\treturn Path.dirname( file, ).replace( /^file:\\/\\//, '', ).replace( /\\/([A-Z]:\\/)/, '$1', );\n}", "function clean() {\r\n return del(['./wwwroot/css/site.min.css', './wwwroot/js/site.min.js']);\r\n}", "function getRelativePath(dir) {\n var standardizedDir = dir.replace(SEP_PATT, \"/\");\n //remove the workspace path\n return standardizedDir.replace(\n workspacePath.replace(SEP_PATT, \"/\")\n , \"\"\n )\n //remove the source directory\n .replace(\n defaults.sourceDirectory\n , \"\"\n )\n //remove the left over path separaters from the begining\n .replace(\n LEADING_SEP_PATT\n , \"\"\n );\n }", "function basePathEnv(){\n let pathObj = path.dev_scripts;\n pkg.env = '_dev';\n if ( env == 'release' ) {\n pathObj = path.scripts;\n pkg.env = '';\n }\n return pathObj;\n}", "function FixPath(p) {\n if (p === '/') {\n return '';\n }\n else {\n return p;\n }\n}", "function FixPath(p) {\n if (p === '/') {\n return '';\n }\n else {\n return p;\n }\n}", "function cleanName(fullPath){\n var noDir = fullPath.replace(dirStr,'');\n var noLAS = noDir.replace('.LAS','');\n return noLAS\n}", "async protectWhitespace(path) {\n if (!path.startsWith(\" \")) {\n return path;\n }\n // Handle leading whitespace by prepending the absolute path:\n // \" test.txt\" while being in the root directory becomes \"/ test.txt\".\n const pwd = await this.pwd();\n const absolutePathPrefix = pwd.endsWith(\"/\") ? pwd : pwd + \"/\";\n return absolutePathPrefix + path;\n }", "function absPath(path) {\n\t\tif (!(path.match(/^\\//) || path.match(/^https?:/i))) {\n\t\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\t\tpath = (scripts[scripts.length-1].src).replace(/[^\\/]*$/,path);\n\t\t}\n\t\treturn path;\n\t}", "function filterPath(string) {\n return string\n .replace(/^\\//,'')\n .replace(/(index|default).[a-zA-Z]{3,4}$/,'')\n .replace(/\\/$/,'');\n }", "function filterPath(string) {\n return string\n .replace(/^\\//,'')\n .replace(/(index|default).[a-zA-Z]{3,4}$/,'')\n .replace(/\\/$/,'');\n }", "function filterPath(string) {\n return string\n .replace(/^\\//,'')\n .replace(/(index|default).[a-zA-Z]{3,4}$/,'')\n .replace(/\\/$/,'');\n }", "function filterPath(string) {\n return string\n .replace(/^\\//,'')\n .replace(/(index|default).[a-zA-Z]{3,4}$/,'')\n .replace(/\\/$/,'');\n }", "function normalize(path) {\n\tvar last = path.length - 1;\n\tvar lastC = path.charAt(last);\n\n\t// If the uri ends with `#`, just return it without '#'\n\tif (lastC === \"#\") {\n\t\treturn path.substring(0, last);\n\t}\n\tvar arr = path.split(\".\");\n\tvar extname = \"js\";\n\tif (arr.length > 1) {\n\t\textname = arr[arr.length - 1];\n\t\tif (indexOf.call(data.extnames, extname) == -1) {\n\t\t\treturn path + \".js\";\n\t\t} else {\n\t\t\treturn path;\n\t\t}\n\t} else {\n\t\treturn path + \".js\";\n\t}\n}", "function GetNormalizedPath() {\n}", "function file2moduleName(filePath) {\n\treturn filePath.replace(/\\\\/g, \"/\")\n\t\t.replace(/^\\/base\\//, \"\")\n\t\t.replace(/\\.js/, \"\");\n}", "abs (relativePath) {\n return nodePath.resolve(relativePath);\n }", "function stripFileName(s) {\n\tlastSlash=s.lastIndexOf('/',s.length-1)\n\treturn s.substring (lastSlash+1,s.length);\n}", "function removeFilename(path){\n\tvar filename = /[^\\/]*$/;\n\tpath = path.replace(filename, '');\n\treturn path;\n}", "function unixify(filepath) {\n return filepath.replace(/\\\\/g, '/');\n }", "function stripTrailingSlash(str) {\n\t if(str.substr(-1) == '/') {\n\t return str.substr(0, str.length - 1);\n\t }\n\t return str;\n\t }", "function dirname(path) {\r\n return path.replace(/\\\\/g,'/').replace(/\\/[^\\/]*$/, '');;\r\n}", "function normalize (actual) {\n const dir = path.join(__dirname, '..', '..', '..');\n const reDir = new RegExp(dir.replace(reEscape, '\\\\$1'), 'g');\n const reSep = new RegExp(path.sep.replace(reEscape, '\\\\$1'), 'g');\n\n return actual\n .replace(reDir, '/qunit')\n // Replace backslashes (\\) in stack traces on Windows to POSIX\n .replace(reSep, '/')\n // Convert \"at processModule (/qunit/qunit/qunit.js:1:2)\" to \"at qunit.js\"\n // Convert \"at /qunit/qunit/qunit.js:1:2\" to \"at qunit.js\"\n .replace(/^(\\s+at ).*\\/qunit\\/qunit\\/qunit\\.js.*$/gm, '$1qunit.js')\n // Strip inferred names for anonymous test closures (as Node 10 did),\n // to match the output of Node 12+.\n // Convert \"at QUnit.done (/qunit/test/foo.js:1:2)\" to \"at /qunit/test/foo.js:1:2\"\n .replace(/\\b(at )\\S+ \\((\\/qunit\\/test\\/[^:]+:\\d+:\\d+)\\)/g, '$1$2')\n // Convert sourcemap'ed traces from Node 14 and earlier to the\n // standard format used by Node 15+.\n // https://github.com/nodejs/node/commit/15804e0b3f\n // https://github.com/nodejs/node/pull/37252\n // Convert \"at foo (/min.js:1)\\n -> /src.js:2\" to \"at foo (/src.js:2)\"\n .replace(/\\b(at [^(]+\\s\\()[^)]+(\\))\\n\\s+-> ([^\\n]+)/g, '$1$3$2')\n // CJS-style internal traces:\n // Convert \"at load (internal/modules/cjs/loader.js:7)\" to \"at internal\"\n //\n // ESM-style internal traces from Node 14+:\n // Convert \"at wrap (node:internal/modules/cjs/loader:1)\" to \"at internal\"\n .replace(/^(\\s+at ).+\\([^/)][^)]*\\)$/gm, '$1internal')\n\n // Convert /bin/qunit and /src/cli to internal as well\n // Because there are differences between Node 10 and Node 12 in terms\n // of how much back and forth occurs, so by mapping both to internal\n // we can flatten and normalize across.\n .replace(/^(\\s+at ).*\\/qunit\\/bin\\/qunit\\.js.*$/gm, '$1internal')\n .replace(/^(\\s+at ).*\\/qunit\\/src\\/cli\\/.*$/gm, '$1internal')\n\n // Strip frames from indirect nyc dependencies that are specific\n // to code coverage jobs:\n // Convert \"at load (/qunit/node_modules/append-transform/index.js:6\" to \"at internal\"\n .replace(/ {2}at .+\\/.*node_modules\\/append-transform\\/.*\\)/g, ' at internal')\n // Consolidate subsequent qunit.js frames\n .replace(/^(\\s+at qunit\\.js$)(\\n\\s+at qunit\\.js$)+/gm, '$1')\n // Consolidate subsequent internal frames\n .replace(/^(\\s+at internal$)(\\n\\s+at internal$)+/gm, '$1');\n}", "function s(e,t){\"\"===e&&(e=\".\"),e=e.replace(/\\/$/,\"\");// XXX: It is possible to remove this block, and the tests still pass!\nvar n=r(e);return\"/\"==t.charAt(0)&&n&&\"/\"==n.path?t.slice(1):0===t.indexOf(e+\"/\")?t.substr(e.length+1):t}", "function withoutExtension(path) {\n ensure(path, \"string\");\n\n if (!path) return \"\";\n\n var names = path.split(\"/\");\n\n names[names.length - 1] = strip(names[names.length - 1]);\n\n path = names.join(\"/\");\n\n return path;\n}", "function removeTrailingDirectorySeparator(path) {\n if (path.charAt(path.length - 1) === ts.directorySeparator) {\n return path.substr(0, path.length - 1);\n }\n return path;\n }", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}", "function removePathTrailingSlash(path) {\n return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n}" ]
[ "0.588619", "0.57783306", "0.56163", "0.54969263", "0.54607624", "0.5459142", "0.5407623", "0.5398286", "0.5270211", "0.5252921", "0.5211208", "0.5211208", "0.52044696", "0.52044696", "0.5201744", "0.5201468", "0.5201468", "0.51980233", "0.5159523", "0.51580805", "0.515029", "0.51384807", "0.51321274", "0.5113147", "0.50949764", "0.5087402", "0.50726336", "0.50553876", "0.5040776", "0.5031688", "0.5027242", "0.50243694", "0.501949", "0.5017847", "0.49847123", "0.49671605", "0.49638245", "0.49573222", "0.49573222", "0.4955252", "0.49544257", "0.49544257", "0.49544257", "0.49544257", "0.49544257", "0.49544257", "0.49447867", "0.49428537", "0.49426183", "0.49278283", "0.49271393", "0.49220812", "0.49209782", "0.49209613", "0.4916716", "0.4916408", "0.49156892", "0.4914566", "0.49123833", "0.49035922", "0.48937172", "0.48874205", "0.4876933", "0.48768455", "0.4869253", "0.4869253", "0.4836027", "0.48272672", "0.47995442", "0.47796944", "0.47796944", "0.47796944", "0.47796944", "0.47620383", "0.4759791", "0.47597018", "0.4756912", "0.4755139", "0.47495434", "0.47480175", "0.47395337", "0.47358158", "0.4727453", "0.47233453", "0.47215918", "0.47202745", "0.47200525", "0.47200525", "0.47200525", "0.47200525", "0.47200525", "0.47200525", "0.47200525", "0.47200525", "0.47200525", "0.47200525", "0.47200525", "0.47200525", "0.47200525", "0.47200525", "0.47200525" ]
0.0
-1
gets the extension of the specified filename
function getExtension(filename) { var i = filename.lastIndexOf('.'); return (i < 0) ? '' : filename.substr(i); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getExtension(filename){\n\treturn splitFromBack(filename, '.')[1];\n}", "function getExtension(filename) {\n const dot = filename.lastIndexOf('.');\n if (dot === -1) return '';\n return filename.substring(dot + 1, filename.length);\n }", "function getExtension(filename){\n var parts = filename.split('.');\n\n return parts[parts.length - 1];\n }", "function getExtension(filename) {\n return filename.split('.').pop();\n }", "function getFileExtension(filename){\t\n\treturn filename.substr(filename.lastIndexOf('.')+1);\n}", "function getfileextension(filename) { \r\n\tif (!filename || filename == null || filename.length == 0) return \"\";\r\n\tvar dot = filename.lastIndexOf(\".\"); \r\n\tif (dot == -1) return \"\"; \r\n\tvar extension = filename.substr(dot+1,filename.length); \r\n\treturn extension; \r\n}", "function getExtension(filename) {\n var parts = filename.split('.');\n return parts[parts.length - 1];\n}", "function getFileExtension(filename) {\n var pos = filename.lastIndexOf('.');\n if (pos != -1)\n return filename.substring(pos+1);\n else // if '.'' never occurs\n return '';\n }", "function getExtension(filename)\r\n{\r\n var idx = filename.lastIndexOf('.');\r\n return 0 <= idx ? filename.substr(idx) : \".\";\r\n}", "function getFileExtension(filename) {\n return filename.split('.').pop();\n }", "function extension(filename){\n return filename.split('.').pop();\n}", "function getExtension(filename) {\n return filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();\n}", "function getExtension(filename) {\n let parts = filename.split('.');\n return parts[parts.length - 1];\n}", "function getFileNameExtension(filename) {\n var parts = filename.split(\".\");\n return parts[parts.length - 1];\n }", "getFileExtension(filename) {\n return filename.slice((filename.lastIndexOf(\".\") - 1 >>> 0) + 2);\n }", "function _get_extention(filename)\n\t\t{\n\t\t\treturn filename.split('.').pop();\n\t\t}", "function getFileExtension(filename) {\n return filename ? filename.split('.').pop() : '';\n}", "function getExtensionFile(filename) {\n return (/[.]/.exec(filename)) ? /[^.]+$/.exec(filename) : undefined;\n}", "function getExtension(_filename){\n let extension =_filename.split('.');\n extension=extension[extension.length-1];\n return extension.toLowerCase();\n\n}", "function getExtension(file){\n file = file.split(\".\");\n return file[1];\n}", "function extname(filename) {\n\treturn path.extname(filename).slice(1).toLowerCase();\n}", "function getExtensionFilename(filename) {\n return path.extname(filename).replace('.', '');\n}", "function GetExtensionFileName(filename) {\n var fileExt = filename.split('.').pop();\n fileExt = isEmpty(fileExt) ? \"\" : fileExt.toLowerCase();\n\n return fileExt;\n}", "function getExtension(filename) {\n // Strip pathname, in case the filename has no dot but a path component does.\n // Not sure if we need to support backslash here.\n const slash = filename.lastIndexOf(\"/\");\n if (slash >= 0) {\n filename = filename.substr(slash + 1);\n }\n // Look for extension.\n const dot = filename.lastIndexOf(\".\");\n // If the dot is at position 0, then it's just a hidden file, not an extension.\n return dot > 0 ? filename.substr(dot).toUpperCase() : \"\";\n}", "function getFileExtension(filename){\n let arr = [];\n arr = filename.split(\".\");\n return arr[arr.length - 1];\n}", "function getFileExtension(curFileName) {\n return curFileName.substr(curFileName.lastIndexOf('.'), curFileName.length);\n}", "function extname(file) {\n return path.extname(file).slice(1);\n}", "getFileExtension1(filename) {\r\n return /[.]/.exec(filename) ? /[^.]+$/.exec(filename)[0] : undefined;\r\n }", "function findFileExtention(filename){\nalert(filename.split('.').pop());\n}", "function getExtensionFromName(fileName) {\n\n try {\n\n var fileExt = \"\";\n var lastDotIndex = -1;\n\n if (typeof fileName != 'undefined' && fileName.length > 0) {\n lastDotIndex = fileName.lastIndexOf(\".\");\n }\n if (lastDotIndex > -1) {\n fileExt = fileName.substr(lastDotIndex + 1, fileName.length - lastDotIndex - 1);\n }\n\n return fileExt.toLowerCase();\n } catch (e) { alertExceptionDetails(e); }\n}", "function getExtension(fpath) {\n var sp = fpath.split(\".\");\n return sp[1];\n}", "function getExtension(fpath) {\n var sp = fpath.split(\".\");\n return sp[1];\n}", "function getFileExt(fileName) {\n // todo: handle special file names (eg. .gitignore .babelrc)\n let arr = fileName.split('.');\n if (arr.length == 1)\n return '';\n else\n return arr[arr.length - 1];\n}", "function getExtension(fn) {\n return fn.split('.').pop();\n}", "function file_ext(file) {\n return (/[.]/.exec(file)) ? /[^.]+$/.exec(file.toLowerCase()) : '';\n }", "function getFileExtension( path ) {\n\n if ( path.indexOf( \".\" ) > -1 ) {\n return path.split( \".\" ).pop();\n }\n\n return \"\";\n }", "function getExtension(){\n\tvar files = fs.readdirSync(\"tests\");\n\t// check for main in the files list\n\t// could get more fancy like finding the most frequent extension\n\tvar first = files[0].split(\".\");\n\tvar ext = first[1];\n\treturn ext;\n}", "function getFileExtension(path)\n{\n return path.lastIndexOf(\".\") > 0 ? path.split(\".\").pop() : \"\";\n}", "function getFileExtension(fileName, removeDot) {\n if (removeDot === void 0) { removeDot = false; }\n var extension = '';\n if (fileName) {\n var index = fileName.lastIndexOf('.');\n if (index >= 0) {\n if (removeDot) {\n extension = fileName.substr(index + 1);\n }\n else {\n extension = fileName.substr(index);\n }\n }\n }\n return extension;\n}", "static getFileExtension(path) {\n return path.substring(path.lastIndexOf('.'), path.length);\n }", "function changeFileExt(filename, ext)\r\n{\r\n var arr = filename.split(\".\");\r\n arr[arr.length - 1] = ext;\r\n return arr.join(\".\");\r\n}", "function getFileType(fileName){\n var type = \"\";\n for(var i = fileName.length; i > 0; i--) {\n var letter = fileName.charAt(i);\n if(letter === '.'){\n return type\n } else {\n type = letter + type;\n }\n }\n //default to plain file if no extension found\n return \"file\";\n}", "getExtension() {\n return this.rawFilename.substr(8).trim();\n }", "function getExt(nombre){\n return nombre.split('.').pop();\n}", "function _calcExtension(filename, currentExt) {\n\t// simply return the rightmost extension\n\tvar ext = filename.split('.').slice(-1);\n\tif (ext=='tem' || ext=='html')\n\t\t// revert to html if no better option.\n\t\t// The html check is here to rename 'tem.html' to '.hubla' if 'hubla' has been set as the new default extension\n\t\treturn _config.DEF_EXTENSION;\n\treturn ext;\n}", "getExtension(path) {\n let basename = path.split(/[\\\\/]/).pop()\n ,pos = basename.lastIndexOf(\".\");\n\n if (basename === \"\" || pos < 1) return \"\";\n\n return basename.slice(pos + 1);\n }", "function getExtension(url) {\n var a = url.split('.');\n\n if (a.length === 1 || (a[0] === '' && a.length === 2))\n return '';\n return a.pop();\n }", "function mime(filename) {\n\t\tvar fileext = filename.match(/[^\\.]*$/)[0], ext;\n\n\t\tfor (ext in mimes) {\n\t\t\tif (new RegExp(\"(\" + mimes[ext].replace(/ /g, \"|\") + \")\").test(fileext)) {\n\t\t\t\treturn fileext.replace(/.+/, ext);\n\t\t\t}\n\t\t}\n\n\t\treturn \"\";\n\t}", "function getFileNameWithOutExt(fn) {\n return path.basename(fn, path.extname(fn));\n}", "function getExtention(file) {\n // surasti prievardi\n // jei yra . tai yra prievardis\n let dot = file.lastIndexOf(\".\");\n console.log(\"dot\", dot);\n if (dot !== -1) {\n let prievardis = file.slice(dot);\n console.log(prievardis);\n } else {\n console.warn(\"prievardzio nera\");\n }\n}", "function extname(path) {\n return posix.extname(path);\n }", "function extname(path) {\n return posix.extname(path);\n }", "function getExt(fileName) {\n return {\n /** base extension (e.g. `.js`) */\n baseExt: path.extname(fileName).toLocaleLowerCase(),\n\n /** full extension, if applicable (e.g. `.proxy.js`) */\n expandedExt: path.basename(fileName).replace(/[^.]+/, '').toLocaleLowerCase()\n };\n}", "function extension(path) {\n var name = base(path);\n if (!name) {\n return '';\n }\n name = name.replace(/^\\.+/, '');\n var index = name.lastIndexOf('.');\n return index > 0 ? name.substring(index) : '';\n}", "function getExtension(url) {\n return new URL(url).pathname.split(\".\").pop();\n}", "function fileExtension(str){\n\n // code goes here\n\n}", "function getExtensionFromPath(filePath) {\n return getExtensionFromName(getFileName(filePath));\n}", "function getFileExtension(fullPath) {\n\tvar startIndex = (fullPath.indexOf('\\\\') >= 0 ? fullPath.lastIndexOf('\\\\') : fullPath.lastIndexOf('/'));\n\tvar filename = fullPath.substring(startIndex);\n\tif (filename.indexOf('\\\\') === 0 || filename.indexOf('/') === 0) {\n\t\tfilename = filename.substring(1);\n\t}\n\tvar extension = filename.split('.').pop();\n\treturn extension;\n}", "function getExt(fileName) {\n return {\n /** base extension (e.g. `.js`) */\n baseExt: path_1.default.extname(fileName).toLocaleLowerCase(),\n /** full extension, if applicable (e.g. `.proxy.js`) */\n expandedExt: path_1.default.basename(fileName).replace(/[^.]+/, '').toLocaleLowerCase(),\n };\n}", "function getExt(files) {\n return files.map(function(file) {\n return path.extname(file);\n }).filter(function(item, index, arr) {\n return index === arr.indexOf(item);\n });\n}", "function getExtension(url) {\n return (url = url.substr(1 + url.lastIndexOf(\"/\")).split(/\\#|\\?/)[0]).substr(url.lastIndexOf(\".\"));\n}", "function getFileExtension(url) {\n if (typeof url !== 'string') {\n return '';\n }\n // from DataURL\n if (url.slice(0, 5) === 'data:') {\n var match = url.match(/data:audio\\/(ogg|mp3|opus|wav|m4a)/i);\n if (match && match.length > 1) {\n return match[1].toLowerCase();\n }\n }\n // from Standard URL\n url = url.split('?')[0];\n url = url.slice(url.lastIndexOf('/') + 1);\n\n var a = url.split('.');\n if (a.length === 1 || a[0] === '' && a.length === 2) {\n return '';\n }\n return a.pop().toLowerCase();\n}", "function getExtension(url) {\r\n\tvar ext = url.match(/\\.(avi|asf|fla|flv|mov|mp3|mp4|mpg|mpeg|qt|swf|wma|wmv)$/i);\r\n\tif(ext != null && ext.length && ext.length > 0) {\r\n\t\text = ext[1];\r\n\t}else{\r\n\t\text = '';\r\n\t}\r\n\treturn ext;\r\n}", "function getExtension(fichier) {\n var extArray = [];\n var is_ok = true;\n var is_point = false;\n var i = fichier.length - 1;\n var nom = fichier;\n var ext = \"\";\n\n while (is_ok && !is_point && i > 0) {\n is_ok = ((nom[i] != '/') && (i > 0));\n is_point = nom[i] == \".\"\n extArray.unshift(nom[i]);\n i--;\n }\n\n for (var j = 0; j < extArray.length; j++) {\n ext = ext + extArray[j];\n }\n\n return ext;\n}", "function stripFileExt (filename) {\n var name = filename.replace(/-/g, ' ');\n return name.split('.')[0];\n}", "function appendFileExtension(filename,extension) {\r\n\tvar extension_position=filename.length-extension.length;\r\n\tvar current_extension=filename.slice(extension_position);\r\n\tif(current_extension.toLowerCase()!=extension.toLowerCase()) {\r\n\t\tfilename+=extension;\r\n\t}\r\n\treturn filename;\r\n}", "function addExtensionToFileName(fileName)\r\n{\r\n var retVal = fileName;\r\n var hasExtension = (fileName.search(/\\.\\w+$/) != -1);\r\n\r\n if (!hasExtension)\r\n {\r\n var fileExtension = dwscripts.getFileExtension(dw.getDocumentDOM().URL)\r\n retVal = fileName +\".\" + fileExtension;\r\n }\r\n\r\n return retVal;\r\n}", "function getImageURLFileExtension(url) {\n let ext_regex = /\\.([0-9a-z]+)(?=[?#])|(\\.)(?:[\\w]+)$/gmi;\n let ext = ``;\n if (url.match(ext_regex)) { ext = url.match(ext_regex)[0]; }\n return ext;\n}", "function findLongestRegisteredExtension(filename) {\n\t const name = pathBrowserify.basename(filename);\n\t let currentExtension;\n\t let index;\n\t let startIndex = 0;\n\t while ((index = name.indexOf('.', startIndex)) !== -1) {\n\t startIndex = index + 1;\n\t if (index === 0) continue; // Skip dotfiles like .gitignore\n\t currentExtension = name.slice(index);\n\t if (Module._extensions[currentExtension]) return currentExtension;\n\t }\n\t return '.js';\n\t }", "getFileExtension(docName) {\n let fileExtension;\n let documentArray = docName.split('.');\n if(documentArray.length > 2)\n {\n let fileExtensionArray = documentArray[2].split('/');\n fileExtension = fileExtensionArray[fileExtensionArray.length - 1];\n } \n else\n fileExtension = documentArray[1];\n \n return fileExtension;\n\n }", "function getRemoteFileExtension(url) {\n return getParsedPath(url).ext;\n}", "function getExtFileName(subdir, ext, filename) {\n var prefix;\n filename = getFileName(filename);\n if (ext.level > 0 && subdir) {\n prefix = subdir.split('/')[ext.level - 1];\n if (prefix) {\n filename = prefix + ext.hyphen + filename;\n }\n }\n return filename;\n}", "function extractExtension(url){\n\treturn (/[.]/.exec(url)) ? /[^.]+$/.exec(url)[0] : undefined;\n}", "static extension(url) {\n var name = this.name(url)\n if (!name.match(/\\./)) return undefined\n return name.toLowerCase().replace(/.*\\./,\"\") \n }", "function getFileType(filename) {\n var ext = getFileNameExtension(filename);\n switch (ext.toLowerCase()) {\n case \"jpg\":\n case \"jpeg\":\n case \"gif\":\n case \"bmp\":\n case \"png\":\n return \"image\";\n case \"m4v\":\n case \"avi\":\n case \"mpg\":\n case \"mp4\":\n return \"video\";\n case \"pdf\":\n return \"pdf\";\n case \"txt\":\n return \"text\";\n case \"tex\":\n return \"latex\";\n }\n return \"text\";\n }", "get extname() {\n return typeof this.path === 'string' ? path.extname(this.path) : undefined\n }", "function getFilenameWithoutExtension(filename) {\n return filename.replace(/^.*[\\\\\\/]/, '').slice(0, -5);\n}", "get extname() {\n return typeof this.path === 'string' ? path$1.extname(this.path) : undefined\n }", "function getextension(link){\n\tvar y = getIndicesOf('.',link,false)\n\t\n\tvar z = [];\n\tfor (var i = 0; i < y.length; i ++) \n\t{\n\t\tz.push(link.substring(y[i] ,y[i] + 4));\n\t}\n\t\n\tvar exts = [\".jpg\",\".png\",\".gif\",\".jpe\"];\n\tres = z.filter(f => exts.includes(f));\n\tif (res[0] == \".jpe\")\n\t{\tres[0] = \".jpeg\";}\n\t\n\tif (res.length > 0)\n\t{\n\t\treturn res[res.length - 1];\n\t}\n\telse \n\t{\n\t\treturn exts[0];\n\t}\n}", "function getExt(key) {\n switch (key) {\n case 'photo':\n return 'jpg';\n case 'voice':\n return 'ogg';\n case 'audio':\n return 'mp3';\n case 'animation':\n case 'video':\n case 'video_note':\n return 'mp4';\n case 'sticker':\n return 'webp';\n default:\n return 'dat';\n }\n}", "function getFileType(file) {\r\n var stringFile = getFileNameAndType(file);\r\n return stringFile.split(\".\")[1];\r\n }", "function getFileName(file) {\r\n var stringFile = getFileNameAndType(file);\r\n return stringFile.split(\".\")[0];\r\n }", "function getExtension (lang) {\n if (~lang.indexOf('.')) {\n return lang.replace(/^.*\\.([^\\.]+)$/, '$1')\n } else {\n return lang\n }\n}", "function getFileName(filename, version) {\n var pos = filename.lastIndexOf('.');\n if (version) {\n version = '.' + version;\n return ~pos ? filename.substring(0, pos) + version + filename.slice(pos) : filename + version;\n } else {\n return ~pos ? filename.substring(0, pos) : filename;\n }\n}", "function getContentType(filename) {\n\tconst extension = filename.match(/.*\\.([^\\.]*)$/)[1];\n \treturn getMimeType(extension);\n}", "getActiveFileName() /*:string*/ {\n const activeFilePath = this.getActiveFilePath();\n if (!activeFilePath) {\n return '';\n }\n\n const basename = path.basename(activeFilePath);\n let ext = basename.split('.').slice(1).join('.');\n\n // Detection dot-files.\n if ('.' + ext === basename) {\n ext = '';\n }\n\n const exceptionalExts = [\n '',\n 'json',\n 'cson',\n 'md',\n 'yml',\n 'yaml',\n 'conf',\n 'lock',\n 'properties'\n ];\n\n if (~exceptionalExts.indexOf(ext)) {\n return '';\n }\n\n return basename;\n }", "function getFileName(curFileName) {\n return curFileName.substr(0, curFileName.lastIndexOf('.'));\n}", "function get_mime(filename)\n{\n let ext, type\n for (let ext in MIME_TYPES) {\n type = MIME_TYPES[ext]\n if (filename.indexOf(ext, filename.length - ext.length) !== -1) {\n return type\n }\n }\n return MIME_TYPES[\"txt\"]\n}", "function getFilenameWithoutExtension(path) {\n if (!path) {\n return '';\n }\n var filename = path.substring(path.lastIndexOf('/') + 1);\n var extensionLength = getFileExtension(filename).length;\n return filename.slice(0, -(extensionLength + 1));\n}", "function UpdateFileName(fileName, extension) {\n\tvar fileName = fileName.split('.');\n\tfileName.pop();\n\t(extension == null) ? \"\" : fileName.push(extension);\n\treturn fileName.join(\".\");\n}", "function basename (filename, ext) {\n return path__WEBPACK_IMPORTED_MODULE_0___default.a.basename(\n filename.replace(/^[a-zA-Z]:/, '').replace(/\\\\/g, '/'),\n ext\n )\n}", "getExtension() {\n\t\treturn this.extension;\n\t}", "extension(mimeType) {\n const type = mimeType.match(/^\\s*([^;\\s]*)(?:;|\\s|$)/)[1].toLowerCase();\n return this.extensions[type];\n }", "supportedExtExtract(filename) {\n let extensions = [\"csv\", \"doc\", \"docx\", \"eml\", \"epub\", \"gif\", \"htm\", \"html\",\n \"jpeg\", \"jpg\", \"json\", \"log\", \"mp3\", \"msg\", \"odt\", \"ogg\",\n \"pdf\", \"png\", \"pptx\", \"ps\", \"psv\", \"rtf\", \"tff\", \"tif\",\n \"tiff\", \"tsv\", \"txt\", \"wav\", \"xls\", \"xlsx\"];\n return extensions.some(ext => filename.endsWith(ext));\n }", "function getFilename(url) {\n return url.split('/').pop();\n }", "function tryExtensions(p, exts) {\n for (var i = 0, EL = exts.length; i < EL; i++) {\n var filename = tryFile(p + exts[i]);\n\n if (filename) {\n return filename;\n }\n }\n return false;\n}", "function enumerateFilename(fileName) {\n const fileArr = fileName.split('.');\n const extension = fileArr.pop();\n let fileStem = fileArr.join('.');\n const suffix = fileStem.split('--').pop();\n \n if (isNaN(suffix)) {\n return [fileStem, '--', 1, '.', extension].join('');\n } else {\n fileStem = fileStem.split('--');\n fileStem.pop();\n fileStem = fileStem.join('--');\n return [fileStem, '--', parseInt(suffix) + 1, '.', extension].join('');\n }\n}", "function _getOutputFileName(path, extension) {\n var filename = path.split('/');\n filename = filename[filename.length - 1];\n filename = filename.split('.');\n \n // No extension found\n if (filename.length === 1) {\n return filename[0] + '.' + extension;\n }\n \n // Hidden file\n if (filename[0] === '') {\n filename = filename.slice(1);\n filename[0] = '.' + filename[0];\n if (filename.length === 1) {\n return filename[0] + '.' + extension;\n }\n }\n \n filename = filename.slice(0, -1);\n \n return filename + '.' + extension;\n }", "function getFileNameAndType(file) {\r\n var forwardSlash = file.lastIndexOf(\"/\");\r\n var backSlash = file.lastIndexOf(\"\\\\\");\r\n if (forwardSlash === -1 && backSlash === -1) {\r\n return file;\r\n }\r\n return file.substring((forwardSlash > backSlash) ? forwardSlash + 1 : backSlash + 1);\r\n }", "function mimeType(filename) {\n var types = {\n '.html' : 'text/html',\n '.css' : 'text/css',\n '.js' : 'application/javascript',\n '.jpg' : 'image/jpeg',\n '.jpeg' : 'image/jpeg',\n '.png' : 'image/png',\n '.ico' : 'image/x-icon'\n };\n var i = filename.lastIndexOf('.');\n var extension = (i < 0) ? '' : filename.substr(i);\n return types[extension.toLowerCase()] || 'application/octet-stream';\n}" ]
[ "0.9158451", "0.9026896", "0.89727604", "0.8954833", "0.89212495", "0.8825532", "0.88243985", "0.8823371", "0.8802874", "0.8801707", "0.8776765", "0.8739993", "0.8719651", "0.8713896", "0.86786854", "0.8656118", "0.8630418", "0.8596909", "0.8511837", "0.8511035", "0.84860224", "0.84678054", "0.8416344", "0.8391235", "0.83083016", "0.8277077", "0.8273914", "0.82623154", "0.8164045", "0.8158569", "0.80908275", "0.80908275", "0.80761456", "0.7989905", "0.7867109", "0.78650004", "0.7861555", "0.7844574", "0.78001624", "0.771238", "0.7679829", "0.76727504", "0.767016", "0.7670095", "0.7637172", "0.7596163", "0.7594717", "0.7481021", "0.7469335", "0.7467489", "0.7450455", "0.7450455", "0.74483067", "0.744267", "0.7396982", "0.7391331", "0.73762864", "0.7355426", "0.73369044", "0.72704566", "0.7268898", "0.7262031", "0.72308934", "0.71833336", "0.71768486", "0.71715623", "0.71233857", "0.70964414", "0.7059089", "0.7026132", "0.69997424", "0.6993365", "0.698448", "0.6982831", "0.69396317", "0.6936558", "0.69231904", "0.69051504", "0.6891411", "0.6877046", "0.67884755", "0.6776818", "0.6759684", "0.6757522", "0.6757302", "0.6693571", "0.66834205", "0.66737777", "0.6588973", "0.6572816", "0.65687376", "0.65528333", "0.654696", "0.65454865", "0.6522751", "0.6510552", "0.65056086", "0.64850026", "0.6449504", "0.6445464" ]
0.8868673
5
run a test over the specified file
function test(filename) { console.log(' + ' + filename); try { if (options.ast) { return engines[4].run( filename , PHP ); } var extension = getExtension(filename); for(var i = 0; i<engines.length; i++) { if (engines[i].handles(filename, extension)) { if (engines[i].explode) { return engines[i].run( fs.readFileSync(filename).toString().split('\r\n') , filename , PHP ); } else { return engines[i].run(filename, PHP); } } } console.info('\n(i) IGNORED : unrecognized extension "'+getExtension(filename)+'" for ' + filename); return false; } catch(e) { util.error( (e.stack || e) + '\n' ); throw e; return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runFile(test) {\n // load a test module from a file and pass in pep API as scope\n let file = Components.classes['@mozilla.org/file/local;1']\n .createInstance(Components.interfaces.nsILocalFile);\n file.initWithPath(test.path);\n let uri = gIOS.newFileURI(file).spec;\n \n // initialize test scope\n let testScope = new pep.PepAPI(test.name);\n \n utils.dumpLine('TEST-START ' + test.name);\n let startTime = Date.now();\n subscriptLoader.loadSubScript(uri, testScope);\n let runTime = Date.now() - startTime;\n utils.dumpLine('TEST-END ' + test.name + ' ' + runTime); \n}", "function _test(scriptfile, cb){\n\t\n\tvar args = util_args2json();\n\tvar file = path.join(__dirname, path.normalize(scriptfile));\n\n\tconsole.log(\"@testing \"+ chalk.blue(file) +\" with args:\", args );\n\n\n\t//cloudfn.verify.rawfile(file);\n\t// or\n\tcloudfn.run.rawfile(file, args);\n\n\t// thinking is, that scripts might be using things available in the server.api -> which we cant \"run\" locally\n\t// req and res springs to mind. Lets see. \n}", "function run(args) {\n var name = args.name;\n var src = args.src;\n\n test(name, function(t) {\n vm.runInNewContext(src, { test: t.test.bind(t), window: {} });\n })\n}", "function runFile (inFile, outFile) {\n const currentTest = new NameParser(inFile, outFile)\n currentTest.uniqueFullNameCount()\n currentTest.uniqueLastNameCount()\n currentTest.uniqueFirstNameCount()\n currentTest.commonLastNames()\n currentTest.commonFirstNames()\n currentTest.modifiedNames(25)\n}", "function testCurrentFile(goConfig, args) {\r\n let editor = vscode.window.activeTextEditor;\r\n if (!editor) {\r\n vscode.window.showInformationMessage('No editor is active.');\r\n return;\r\n }\r\n if (!editor.document.fileName.endsWith('_test.go')) {\r\n vscode.window.showInformationMessage('No tests found. Current file is not a test file.');\r\n return;\r\n }\r\n return getTestFunctions(editor.document).then(testFunctions => {\r\n return goTest({\r\n goConfig: goConfig,\r\n dir: path.dirname(editor.document.fileName),\r\n flags: getTestFlags(goConfig, args),\r\n functions: testFunctions.map(func => { return func.name; })\r\n });\r\n }).then(null, err => {\r\n console.error(err);\r\n return Promise.resolve(false);\r\n });\r\n}", "async runTests() {\n for (let file of this.testFiles) {\n console.log(chalk.gray(`--- ${file.shortName}`));\n const beforeEaches = [];\n\n global.render = render;//jsdom\n\n global.beforeEach = (fn) => {\n beforeEaches.push(fn)\n };\n global.it = async (desc, fn) => {\n // console.log(desc);\n beforeEaches.forEach(func => func());\n //to handle errors ocurred during our test we need to do try and catch to avoid the test to collapse\n try {\n await fn();\n console.log(chalk.green(`\\tOK - ${desc}`));\n } catch (err) {\n const message = err.message.replace(/\\n/g, '\\n\\t\\t');\n console.log(chalk.red(`\\tX - ${desc}`));\n console.log(chalk.red('\\t', message));// \\t is tab \n }\n\n };\n //to skip the typo in stopping test for running\n try {\n require(file.name);//when we require the file inside a func node will find it and execute the file here\n } catch (err) {\n console.log(chalk.red('X - Error Loading File'), file.name);\n console.log(chalk.red(err));\n }\n\n }\n }", "run_test() { start_tests(); }", "function testFile(filePath) {\n\tlet [input, expectedOutput] = splitFile(filePath);\n\t//c.log(input)\n\tlet tranformedCode = stripBlankLines(babel.transform(input, transformOptions).code);\n\t//c.log(tranformedCode)\n\tif (tranformedCode === expectedOutput) {\n\t\tgreen('PASS: ' + filePath)\n\t} else {\n\t\tExitCode = 1;\n\t\tred('FAIL: ' + filePath)\n\t\tprintDiff(tranformedCode, expectedOutput)\n\t}\n\treset()\n}", "function loadTest (filename) {\n var content = fs.readFileSync(filename) + '';\n var parts = content.split(/\\n-----*\\n/);\n\n return {\n source: parts[0],\n compiled: parts[1],\n ast: parts[2],\n transformed: parts[3]\n };\n}", "function readTestFile(name) {\n\tlet fullName = path.join(__dirname, '../testcode', name + '.js');\n\treturn fs.readFileSync(fullName, 'utf8');\n}", "function runTest(callback) {\n currentIncrement = testsToRun[0];\n odfeRunner.setTestIncrement(currentIncrement);\n odfeRunner.setDocsBaseDir(testClassesDirectory);\n\tcurrentTest = currentIncrement.test;\n console.log(\"\\nRun test \" + currentTest);\n\tfs.copy(srcDir + currentTest, trgDir + currentTest, function (err) {\n\t\tif (err) {\n\t\t\tcallback(err);\n\t\t} else {\n\t\t\tconsole.log(\"To Run Moved \" + srcDir + currentTest + \" to \" + trgDir + currentTest);\n\t\t\ttestsToRun.shift();\n async.series([\n cover,\n parseCoverage,\n odfe,\n deleteTrgTest,\n deleteTrgTestFromTarget\n ], function (err) {\n console.log(\"Run test done for \" + currentTest);\n callback();\n });\n\t\t}\n\t});\n}", "run(name, rule, tests) {\n const errorMessage = `Do not set the parser at the test level unless you want to use a parser other than ${parser}`;\n // standardize the valid tests as objects\n tests.valid = tests.valid.map(test => {\n if (typeof test === 'string') {\n return {\n code: test,\n };\n }\n return test;\n });\n tests.valid.forEach(test => {\n if (typeof test !== 'string') {\n if (test.parser === parser) {\n throw new Error(errorMessage);\n }\n if (!test.filename) {\n test.filename = this.getFilename(test.parserOptions);\n }\n }\n });\n tests.invalid.forEach(test => {\n if (test.parser === parser) {\n throw new Error(errorMessage);\n }\n if (!test.filename) {\n test.filename = this.getFilename(test.parserOptions);\n }\n });\n super.run(name, rule, tests);\n }", "function testRun()\r\n{\r\n}", "function run(){\n\n\tdescribe(\"XML Tester\", function(){\n\t\t\n\t\t//gameName = process.env.npm_config_gamename;\n\t\t//console.log(\"Testing \" + gameName);\n\t\t\n\t\t//findXML();\n\t\t//parseXML();\n\t\t//loadGame();\n\t\t//StartMultiGameTest();\n\t});\n}", "function runTest(test, fileName, debug) {\n var css = fs.readFileSync('./test/fixture/' + fileName + '.css').toString();\n var styl = fs.readFileSync('./test/expected/' + fileName + '.styl').toString();\n var converter = new Css2Stylus.Converter(css);\n converter.processCss();\n var output = converter.getStylus();\n if (debug) {\n console.log(' ');\n console.log('### Output ###');\n console.log(output);\n }\n test.equal(output, styl);\n test.done();\n}", "function loadTestFromFile(filePath) {\n var tests = require(filePath);\n var setUpTest = tests.setUp || null;\n var tearDownTest = tests.tearDown || null;\n for ( var name in tests) {\n if(name == \"setUp\" || name == \"tearDown\") continue;\n var handler = tests[name];\n var test = new Test(name, handler);\n test.setUp = setUpTest;\n test.tearDown = tearDownTest;\n testCollection.push(test);\n testResults.totalTests++;\n }\n}", "function runJasmineNode() {\n var entry = ProjectManager.getSelectedItem();\n if (entry === undefined) {\n entry = DocumentManager.getCurrentDocument().file;\n }\n var path = entry.fullPath;\n nodeConnection.domains.jasmine.runTest(path)\n .fail(function (err) {\n console.log(\"[brackets-jasmine] error running file: \" + entry.fullPath + \" message: \" + err.toString());\n var dlg = Dialogs.showModalDialog(\n Dialogs.DIALOG_ID_ERROR,\n \"Jasmine Error\",\n \"The test file contained an error: \" + err.toString()\n );\n });\n }", "function run(file, timer) {\n\n //console.log(sourcecode);\n if (timer) {\n\n process.on(\"exit\", () => console.timeEnd(\"\\ntime needed\"))\n }\n try {\n //console.log(program.timer)\n if (timer) console.time(\"\\ntime needed\");\n var sourcecode = fs.readFileSync(file, \"utf-8\"); //read the file\n parse(sourcecode);\n\n }\n\n catch (error) {\n if (error.constructor.name == \"Maus\") {\n console.error(error.toString());\n //console.log(error.msg);\n }\n else {\n console.error(error);\n }\n\n }\n}", "function testSubmitFile() {\n testAddFile();\n onSubmit();\n}", "function testCurrentFile(goConfig, isBenchmark, args) {\n return __awaiter(this, void 0, void 0, function* () {\n const editor = vscode.window.activeTextEditor;\n if (!editor) {\n vscode.window.showInformationMessage('No editor is active.');\n return;\n }\n if (!editor.document.fileName.endsWith('_test.go')) {\n vscode.window.showInformationMessage('No tests found. Current file is not a test file.');\n return;\n }\n const getFunctions = isBenchmark ? testUtils_1.getBenchmarkFunctions : testUtils_1.getTestFunctions;\n const isMod = yield goModules_1.isModSupported(editor.document.uri);\n return editor.document\n .save()\n .then(() => {\n return getFunctions(editor.document, null).then((testFunctions) => {\n const testConfig = {\n goConfig,\n dir: path.dirname(editor.document.fileName),\n flags: testUtils_1.getTestFlags(goConfig, args),\n functions: testFunctions.map((sym) => sym.name),\n isBenchmark,\n isMod,\n applyCodeCoverage: goConfig.get('coverOnSingleTestFile')\n };\n // Remember this config as the last executed test.\n lastTestConfig = testConfig;\n return testUtils_1.goTest(testConfig);\n });\n })\n .then(null, (err) => {\n console.error(err);\n return Promise.resolve(false);\n });\n });\n}", "function testNode() {\n return src(['test/test.js'], { read: false })\n .pipe(mocha({\n reporter: 'dot',\n exit: true,\n environment: 'node'\n }));\n}", "function Testcase(f, t, e, a, b) {\n this.filename = f;\n this.testcase = t;\n this.expected = e;\n this.actual = a;\n this.result = false;\n this.bug = b;\n\n // Evaluate Test Result\n this.result = evaluateResult(this.expected, this.actual);\n}", "run(name, rule, testsReadonly) {\n const errorMessage = `Do not set the parser at the test level unless you want to use a parser other than ${parser}`;\n const tests = Object.assign({}, testsReadonly);\n // standardize the valid tests as objects\n tests.valid = tests.valid.map(test => {\n if (typeof test === 'string') {\n return {\n code: test,\n };\n }\n return test;\n });\n tests.valid = tests.valid.map(test => {\n if (typeof test !== 'string') {\n if (test.parser === parser) {\n throw new Error(errorMessage);\n }\n if (!test.filename) {\n return Object.assign(Object.assign({}, test), { filename: this.getFilename(test.parserOptions) });\n }\n }\n return test;\n });\n tests.invalid = tests.invalid.map(test => {\n if (test.parser === parser) {\n throw new Error(errorMessage);\n }\n if (!test.filename) {\n return Object.assign(Object.assign({}, test), { filename: this.getFilename(test.parserOptions) });\n }\n return test;\n });\n super.run(name, rule, tests);\n }", "function testMain() {\n var mode = 'test';\n main(mode);\n}", "function testFilePreprocessor() {\n\n return function(content, file, done) {\n b.bundleFile(file, function(err, content) {\n done(content && content.toString());\n });\n };\n }", "function toggleTestFile() {\n const editor = vscode.window.activeTextEditor;\n if (!editor) {\n vscode.window.showInformationMessage('Cannot toggle test file. No editor selected.');\n return;\n }\n const currentFilePath = editor.document.fileName;\n if (!currentFilePath.endsWith('.go')) {\n vscode.window.showInformationMessage('Cannot toggle test file. File in the editor is not a Go file.');\n return;\n }\n let targetFilePath = '';\n if (currentFilePath.endsWith('_test.go')) {\n targetFilePath = currentFilePath.substr(0, currentFilePath.lastIndexOf('_test.go')) + '.go';\n }\n else {\n targetFilePath = currentFilePath.substr(0, currentFilePath.lastIndexOf('.go')) + '_test.go';\n }\n for (const doc of vscode.window.visibleTextEditors) {\n if (doc.document.fileName === targetFilePath) {\n vscode.commands.executeCommand('vscode.open', vscode.Uri.file(targetFilePath), doc.viewColumn);\n return;\n }\n }\n vscode.commands.executeCommand('vscode.open', vscode.Uri.file(targetFilePath));\n}", "function runTest(testName, done) {\n let results = run(INPUT_DIR + \"/\" + testName, testName, ACTUAL_OUT_DIR).then(([spec, results]) => {\n expect(results).toEqual(spec.expectedFlows);\n\n done();\n });\n}", "function test(msg, run){\n\t\t\tTimer.start(msg);\n\t\t\tvar activeTest = {\n\t\t\t\tname: msg\n\t\t\t};\n\t\t\tactiveSuite.tests.push(activeTest);\n\t\t\ttry {\n\t\t\t\trun();\n\t\t\t\tactiveSuite.passedTestsCount++;\n\t\t\t\tactiveTest.duration = Timer.stop(msg);\n\t\t\t} catch(e) {\n\t\t\t\tactiveTest.duration = Timer.stop(msg);\n\t\t\t\tactiveTest.error = true;\n\t\t\t\tactiveSuite.error = true;\n\t\t\t\tactiveSuite.failedTestsCount++;\n\t\t\t\tif(e.name == \"AssertionError\"){\n\t\t\t\t\tactiveTest.message = e.message;\n\t\t\t\t\tactiveTest.actual = \"\" + e.actual;\n\t\t\t\t\tactiveTest.expected = \"\" + e.expected;\n\t\t\t\t} else {\n\t\t\t\t\tactiveTest.message = \"Error: \" + e;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "static checkFileExist(fileName) {\n expect(Shell.test('-e', `${TESTS_EXECUTION_FOLDER}/${fileName}`)).toBe(true);\n }", "function oneTestServer(counter){\r\n\r\n /*options to the http*/\r\n var option = {\r\n port: PORT,\r\n path: FILE_TO_CHECK,\r\n headers : {connection: 'keep-alive'}\r\n }\r\n var fullSrc = ROOT_FOLDER + FILE_TO_CHECK;\r\n fullSrc.replace(/\\//g, '\\\\');\r\n\r\n http.get(option, function(res){\r\n\r\n var str = '';\r\n\r\n res.on('data', function(chunk){\r\n str += chunk;\r\n });\r\n\r\n res.on('end', function(){\r\n fs.readFile(fullSrc, function(err,data){\r\n if (err) {\r\n console.log(\"Failed loading the tests\");\r\n }\r\n else{\r\n if (data.toString('utf8') === str) {\r\n\r\n console.log(\"Test number: \" + counter + \", Status:\" +\r\n \" SUCCESS, on file:\" +\r\n \" \" + FILE_TO_CHECK);\r\n success++;\r\n\r\n }\r\n else {\r\n console.log(\"Test number: \" + counter + \", Status :\" +\r\n \" ERROR, on file:\" + FILE_TO_CHECK);\r\n }\r\n }\r\n });\r\n });\r\n res.on('error', function(err){\r\n console.log(err.message);\r\n });\r\n });\r\n}", "runFile () {\n var editor = atom.workspace.getActiveTextEditor()\n\n if (editor && editor.getGrammar().scopeName === 'source.matlab') {\n if (MatlabEditor.checkSessionStatus()) {\n var fileName = editor.buffer.file.getBaseName()\n var filePath = '\"' + editor.getPath() + '\"'\n var currentDate = MatlabEditor.getCurrentDate()\n\n MatlabEditor.provider.add(currentDate + ' Running ' + fileName)\n MatlabEditor.executeText(filePath, '0')\n } else {\n atom.notifications.addError('Unavailable Matlab Session',\n { stack: '', detail: 'Unable to connect to MATLAB session.\\nType \"matlab.engine.shareEngine(\\'AtomMatlabEngine\\')\" in your Matlab instance.', dismissable: true })\n }\n }\n }", "function runTest(test) {\n debug(\"parsing test\");\n var testConfig = jf.readFileSync(process.env.SUITE_CONFIG);\n var wptLoc = testConfig.wptServer\n ? testConfig.wptServer\n : \"https://www.webpagetest.org\";\n\n var wpt = new WebPageTest(wptLoc, testConfig.wptApiKey),\n options = {\n pollResults: 5, //poll every 5 seconds\n timeout: 600, //wait for 10 minutes\n video: true, //this enables the filmstrip\n location: test.location,\n firstViewOnly: test.firstViewOnly, //refresh view?\n requests: false, //do not capture the details of every request\n lighthouse: true\n };\n\n wptScript = wpt.scriptToString(test.script);\n\n debug(\n \"starting test on script \" + wptScript + \" in location \" + test.location\n );\n\n wpt.runTest(wptScript, options, function(err, results) {\n if (err) {\n return console.error([err, { url: test.url, options: options }]);\n }\n dataStore.saveDatapoint(test, results);\n });\n}", "function testAllFilesInDir() {\n\tfs.readdirSync(__dirname).forEach(file => {\n\t\tif (file.startsWith('test_')) {\n\t\t\ttestFile(__dirname + '/' + file);\n\t\t}\n\t});\n\t\n}", "function testBrowser() {\n return src(['test/test.js'], { read: false })\n .pipe(mocha({\n reporter: 'dot',\n exit: true,\n environment: 'browser'\n }));\n}", "function fsTest() {\n const fn = './test.txt';\n fs.writeFile(fn, 'TEST', err => {\n if (err) {\n console.log(err)\n } else {\n fs.readFile(fn, 'utf8', (err, data) => {\n console.log(data)\n })\n }\n })\n}", "function run() {\n var sf = require('../StepFactory')\n , mod = require(process.cwd())\n , fixtureName = process.argv[3] || 'default'\n , fixture = require(process.cwd()+'/fixtures/'+fixtureName+'.js')\n ;\n\n var Runner = function() {\n var step = sf.create(mod);\n step.run(fixture);\n\n step.deferred.promise.then(function(out) {\n console.log(JSON.stringify(out,null,4));\n }, function(err) {\n console.error('fail', err);\n });\n };\n new Runner();\n}", "async function main() {\n const g_tests = async (flag) => {\n let test_base;\n let prefix = '';\n switch (flag) {\n case 'm':\n test_base = test_base_general;\n prefix = 'test_';\n break;\n case 'a':\n test_base = test_base_audio;\n prefix = 'test_';\n break;\n case 's':\n case 'c':\n test_base = test_base_toc;\n break;\n }\n ;\n const retval = await get_tests(`${test_base}/index.json`, prefix);\n return retval;\n };\n const preamble_run_test = async (name) => {\n if (name[0] === 'm' || name[0] === 'a' || name[0] === 's' || name[0] === 'c') {\n const tests = await g_tests(name[0]);\n run_test(tests[name].url);\n }\n else {\n throw new Error('Abnormal test id...');\n }\n };\n try {\n if (process.argv && process.argv.length > 2) {\n if (process.argv[2] === '-sm' || process.argv[2] === '-sa') {\n const label = process.argv[2][2];\n const tests = await g_tests(label);\n const scores = generate_scores(tests);\n console.log(JSON.stringify(scores, null, 4));\n }\n else if (process.argv[2] === '-l') {\n // run a local test that is not registered in the official test suite\n run_test(process.argv[3]);\n }\n else {\n preamble_run_test(process.argv[2]);\n }\n }\n else {\n preamble_run_test('m4.01');\n }\n }\n catch (e) {\n console.log(`Something went very wrong: ${e.message}`);\n process.exit(1);\n }\n}", "function doThis() {\n\n fs.readFile(\"random.txt\", \"utf8\", function(error, data) {\n\t var splitData = data.split(\",\");\n\t var inputOne = splitData[0];\n\t \n\t process.argv[3] = splitData[1];\n\n\t run(inputOne);\n\n\t \n\n\t});\n}", "function runTest(testName, f, input, output, expectFail) {\n if (output === void 0) { output = undefined; }\n if (expectFail === void 0) { expectFail = false; }\n try {\n console.log(\"test \" + testName);\n console.log(\" input: \" + input.toString());\n var result = f(input);\n console.log(\" result: \" + result.toString());\n var success = !result || (result && !expectFail || !result && expectFail);\n console.log(success ? \" passed\" : \" FAILED\");\n }\n catch (e) {\n if (expectFail) {\n console.log(\" passed: expected fail, error caught: \" + e.message);\n }\n else {\n console.log(\" FAILED: error caught = \" + e.message);\n }\n }\n}", "async runTest() {}", "function runExampleFile(file) {\n var relPath = path.relative(__dirname, file);\n\n if (!relPath.startsWith('.'))\n relPath = './' + relPath;\n\n var example = require(relPath);\n console.log(\"GO!\");\n var shapes = example();\n console.log(\"SHAPES\", shapes);\n// var faces = shapes.faces();\n var faces = shapes.map(shape => shape.faces ? shape.faces() : [shape])\n .reduce((a, b) => a.concat(b));\n console.log(\"faces\", faces);\n var meshes = faces.map(face => mesh(face, 0.02, 20, true));\n console.log(\"done\");\n\n return JSON.stringify(meshes, replacer);\n}", "function test_and_load (filename){//start function test_and_load\r\n\r\n var promise = new process.Promise();\r\n\r\n fs.stat(filename).addCallback(function(stat){//start funcion anonima\r\n\r\n if(!stat.isFile()){\r\n promise.emitError(error);\r\n\r\n return;\r\n\r\n }//end if\r\n\r\n //otra manera de leer un archivo dentro de\r\n fs.readFile(filename).andCallback(function (data){//start function anonima\r\n\r\n promise.emitSuccess(data);\r\n\r\n //end function anonima\r\n }).addErrback(function(error){//start function anonima\r\n\r\n\r\n promise.emitError(function(error){\r\n\r\n });//end function anonima\r\n\r\n\r\n }).addErrback(function(error){\r\n\r\n promise.emitError(error);\r\n\r\n });//end function anonima\r\n\r\n return promise;\r\n\r\n});\r\n}//end function test_and_load", "function updateTestFile( testFilePath ){\n var testsJson = JSON.parse(fs.readFileSync( testFilePath ));\n addTests( testsJson, function writeNewFile( newTestJson ){\n fs.writeFile( testFilePath, JSON.stringify( newTestJson, undefined, 2 ) );\n });\n}", "function runTest(comparison, text) {\n if(comparison) {\n testOutput(text, 'passed');\n passed += 1;\n } else {\n testOutput(text, 'failed');\n failed += 1;\n }\n }", "function runTests(){\n var test = currentTest();\n var error = {\n path: test.path,\n testName: test.name\n };\n\n try{\n test.func(helpers);\n } catch ( err ) {\n error.msg = err;\n error.contexts = textContexts;\n addError(error);\n advanceTests();\n }\n\n // if no initial errors, test eventually times out\n setTimeout(function(){\n error.contexts = textContexts;\n if ( currentTestError ) {\n error.msg = currentTestError;\n addError(error);\n }else if ( !currentTestCompleted ) {\n error.msg = \"Did not complete in time!\";\n addError(error);\n }\n advanceTests();\n }, test.timeout); \n }", "function runTests(e, p) {\n console.log(\"Check requested\")\n\n // Create Notification object (which is just a Job to update GH using the Checks API)\n var note = new Notification(`tests`, e, p);\n note.conclusion = \"\";\n note.title = \"Run Tests\";\n note.summary = \"Running the test targets for \" + e.revision.commit;\n note.text = \"This test will ensure build, linting and tests all pass.\"\n\n // Send notification, then run, then send pass/fail notification\n return notificationWrap(build(e, p), note)\n}", "function runTest(i) {\n if (i >= inputs.length) throw new Error('You do not have enough test cases');\n let expected = outputs[i];\n let actual = f(inputs[i]);\n verifyEquals(expected, actual); // verifyEquals is imported above\n}", "function runTests(e, p, jobFunc) {\n console.log(\"Check requested\");\n\n let job = jobFunc();\n\n // Create Notification object (which is just a Job to update GH using the Checks API)\n var note = new Notification(job.name, e, p);\n note.conclusion = \"\";\n note.title = `Run ${job.name}`;\n note.summary = `Running ${job.name} build/test targets for ${e.revision.commit}`;\n note.text = \"This task will ensure build, linting and tests all pass.\";\n\n // Send notification, then run, then send pass/fail notification\n return notificationWrap(job, note);\n}", "function testasync(callback){\n\n\tfs.readFile('test4.txt', (err, data) => {\n\t if (err) throw err;\n\t callback(data);\n\t});\n\n}", "function getFileAndLaunch(file) {\n if (file) {\n const startSimulatorCommand = `start ${file} && exit`;\n console.log(`Launching ${file}`);\n runCommand(startSimulatorCommand);\n return;\n }\n dialog.showOpenDialog(\n {\n properties: ['openFile'],\n filters: [{ name: 'Simulators', extensions: ['bat'] }],\n },\n function(filename) {\n filename = filename.toString();\n if (!filename) {\n return;\n }\n console.log(`Launching ${filename}`);\n const startSimulatorCommand = `start ${filename} && exit`;\n runCommand(startSimulatorCommand);\n getConnectedClient();\n },\n );\n}", "function testpuerF() {\n fs.copySync(path.join(__dirname, 'assets', 'someJSON.json'), path.join(__dirname, 'tmp', 'someJSON.json'));\n puerf.start({\n freemarker: ftlRoutesFile,\n mock: routesFile,\n combined: combinedFile,\n templates: templateFolderPath,\n port: testPort,\n root: tmpPath,\n noBrowser: true\n }, testFileServing);\n }", "function test() {\n console.log('Beginning test process!'.blue);\n projects.action = 'test';\n github.getCredentials()\n .catch(janitor.error('Failure getting credentials'.red))\n .then(greenlight.getGradable)\n .catch(janitor.error('Failure getting sessions'.red))\n .then(sessions.selectSession)\n .catch(janitor.error('Failure selecting session'.red))\n .then(projects.selectProject)\n .catch(janitor.error('Failure selecting project'.red))\n .then(grabTests)\n .catch(janitor.error('Failure grabbing tests'.red))\n .then(runTests)\n .catch(janitor.error('Failure running tests'.red))\n .then(displayResults)\n .catch(janitor.error('Failure displaying results'.red))\n .then(() => console.log('Successfully concluded test.'.blue))\n .catch((err) => { console.error(err); });\n}", "function ExecuteFile(){\n fs.readFile(\"random.txt\", \"utf8\", function(error, data) {\n\n // If the code experiences any errors it will log the error to the console.\n if (error) {\n return console.log(error);\n }\n \n // Then split it by commas (to make it more readable)\n var dataArr = data.split(\",\");\n\n \n ShowSongTrackInformation(dataArr[1]);\n \n });\n \n}", "async function startTests() {\n console.log(\"🎸 Built Source Code\");\n const time = new Date().getTime();\n const nodeTest = spawn(`${process.execPath}`, [`build/_tests/tests/test.js`]);\n\n nodeTest.stdout.on(\"data\", (data) => {\n console.log(`[TEST]: ${data}`);\n });\n\n nodeTest.stderr.on(\"data\", (data) => {\n console.error(`[TEST ERROR]: ${data}`);\n });\n\n nodeTest.on(\"close\", () => {\n console.log(`🎸 Test run finished in ${new Date().getTime() - time}ms`);\n if (!cliopts.watch) {\n process.exit();\n }\n });\n}", "function compileFile(file, basepath) {\n var filepath = path.join(basepath || test_dir, file);\n var ast;\n try {\n ast = RapydScript.parse(fs.readFileSync(filepath, \"utf-8\"), {\n filename: file,\n es6: argv.ecmascript6,\n toplevel: ast,\n readfile: fs.readFileSync,\n basedir: test_dir,\n libdir: path.join(src_path, 'lib'),\n });\n } catch(ex) {\n console.log(file + \":\\t\" + ex + \"\\n\");\n return;\n }\n // generate output\n var output = RapydScript.OutputStream({\n baselib: baselib,\n beautify: true\n });\n ast.print(output);\n return output;\n }", "function runTests() {\n\ttestBeepBoop();\n\ttestGetDigits();\n}", "async function executePrimaryTask(context) {\n\tconst saveFile = await vscode.commands.executeCommand(\"workbench.action.files.save\");\n\tlet codeforcesURL = vscode.window.activeTextEditor.document.getText();\n\tlet filepath = vscode.window.activeTextEditor.document.fileName;\n\tlet cases;\n\tif (!(filepath.substring(filepath.length - 4).toLowerCase() == '.cpp')) {\n\t\tvscode.window.showInformationMessage(\"Active file must be have a .cpp extension\");\n\t\treturn;\n\t} else {\n\t\tconsole.log(\"Is a cpp\");\n\t\tlatestFilePath = filepath;\n\t\tlatestTextDocument = vscode.window.activeTextEditor.document;\n\t}\n\tlet firstRun = true;\n\tcodeforcesURL = codeforcesURL.split(\"\\n\")[0];\n\tcodeforcesURL = codeforcesURL.substring(2);\n\tlet compilationError = false;\n\n\tlet passed_cases = [];\n\t/**\n\t * runs a particular testcase\n\t * @param {*} caseNum 0-indexed number of the case\n\t */\n\tfunction runTestCases(caseNum) {\n\t\ttry {\n\t\t\tfs.accessSync(filepath + \".tcs\")\n\t\t} catch (err) {\n\t\t\tlet html = downloadCodeforcesPage(codeforcesURL);\n\t\t\thtml.then(string => {\n\t\t\t\tconst [inp, op] = parseCodeforces(string);\n\t\t\t\tcreateTestacesFile(inp, op, filepath);\n\t\t\t\trunTestCases(0);\n\t\t\t}).catch(err => {\n\t\t\t\tconsole.error(\"Error\", err)\n\t\t\t})\n\t\t\treturn;\n\t\t}\n\n\t\tif (caseNum == 0) {\n\t\t\tstartWebView();\n\t\t\tconsole.l\n\t\t\tcases = parseTestCasesFile(filepath);\n\t\t\tif (!cases || !cases.inputs || cases.inputs.length === 0) {\n\t\t\t\tevaluateResults([], true);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresultsPanel.webview.html = \"<html><body><p style='margin:10px'>Runnung Testcases ...</p><p>If this message does not change in 10 seconds, it means an error occured. Please contact developer.<p/></body></html>\";\n\n\n\t\t} else if (caseNum == cases.numCases) {\n\t\t\treturn;\n\t\t}\n\t\tlet exec = [];\n\t\tlet stdoutlen = 0;\n\t\tlet spawned_process = spawn((filepath + '.bin'), {\n\t\t\ttimeout: 10000\n\t\t});\n\t\t// Creates a 10 second timeout to kill the spawned process.\n\t\tsetTimeout(() => {\n\t\t\tconsole.log(\"10 sec killed process - \", caseNum);\n\t\t\tspawned_process.kill();\n\t\t}, 10000)\n\t\tlet tm = Date.now();\n\t\tspawned_process.stdin.write(cases.inputs[caseNum] + \"\\n\");\n\t\tspawned_process.stdout.on('data', (data) => {\n\t\t\tif (stdoutlen > 10000) {\n\t\t\t\tstartWebView();\n\t\t\t\tconsole.log(\"STDOUT length >10000\");\n\t\t\t\tresultsPanel.webview.html = \"<html><body><p style='margin:10px'>Your code is outputting more data than can be displayed. It is possibly stuck in an infinite loop. <br><br><b>All testcases failed.</b></p></body></html>\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconsole.log(\"Go stdout\", data);\n\t\t\tlet ans = data.toString();\n\t\t\tlet tm2 = Date.now();\n\t\t\tlet time = tm2 - tm;\n\t\t\tans = ans.replace(/\\r?\\n|\\r/g, \"\\n\");\n\t\t\tcases.outputs[caseNum] = cases.outputs[caseNum].replace(/\\r?\\n|\\r/g, \"\\n\");\n\t\t\tlet stripped_case = cases.outputs[caseNum].replace(/\\r?\\n|\\r| /g, \"\");\n\t\t\tlet stripped_ans = ans.replace(/\\s|\\n|\\r\\n|\\r| /g, \"\");\n\t\t\tif (stripped_ans == stripped_case) {\n\t\t\t\tpassed_cases[caseNum] = {\n\t\t\t\t\tpassed: true,\n\t\t\t\t\ttime: time,\n\t\t\t\t\toutput: ans.trim(),\n\t\t\t\t\tinput: cases.inputs[caseNum].trim(),\n\t\t\t\t\texpected: cases.outputs[caseNum].trim(),\n\t\t\t\t\tgot: ans.trim()\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpassed_cases[caseNum] = {\n\t\t\t\t\tpassed: false,\n\t\t\t\t\ttime: time,\n\t\t\t\t\toutput: ans.trim(),\n\t\t\t\t\tinput: cases.inputs[caseNum].trim(),\n\t\t\t\t\texpected: cases.outputs[caseNum].trim(),\n\t\t\t\t\tgot: ans.trim()\n\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (caseNum == (cases.numCases - 1)) {\n\t\t\t\tevaluateResults(passed_cases, true);\n\t\t\t\tspawn(\"rm\", [filepath + \".bin\"]);\n\t\t\t\tspawn(\"del\", [filepath + \".bin\"]);\n\n\n\t\t\t} else {\n\t\t\t\tevaluateResults(passed_cases, false);\n\t\t\t}\n\n\t\t});\n\t\tspawned_process.stderr.on('data', (data) => {\n\t\t\tconsole.error(`stderr: ${data}`);\n\t\t\toc.clear();\n\t\t\toc.appendLine(\"STDERR:\");\n\t\t\toc.appendLine(data);\n\t\t});\n\n\t\tspawned_process.on('exit', (code, signal) => {\n\t\t\tlet tm2 = Date.now();\n\t\t\tconsole.log(\"Execution done with code\", code, \" with signal \", signal, \"for process \", caseNum);\n\t\t\tif (signal || code != 0) {\n\t\t\t\tpassed_cases[caseNum] = {\n\t\t\t\t\tpassed: false,\n\t\t\t\t\ttime: tm2 - tm,\n\t\t\t\t\toutput: `Runtime error. Exit signal ${signal}. Exit code ${code}.`,\n\t\t\t\t\tinput: cases.inputs[caseNum].trim(),\n\t\t\t\t\texpected: cases.outputs[caseNum].trim(),\n\t\t\t\t\tgot: `Runtime error. Exit signal ${signal}. Exit code ${code}.`,\n\t\t\t\t}\n\t\t\t\tif (caseNum == (cases.numCases - 1)) {\n\t\t\t\t\tevaluateResults(passed_cases, true);\n\t\t\t\t} else {\n\t\t\t\t\tevaluateResults(passed_cases, false);\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tlet tm2 = Date.now();\n\t\t\t\tif (!passed_cases[caseNum]) {\n\t\t\t\t\tpassed_cases[caseNum] = {\n\t\t\t\t\t\tpassed: cases.outputs[caseNum].trim().length == 0,\n\t\t\t\t\t\ttime: tm2 - tm,\n\t\t\t\t\t\toutput: \"<br/>\",\n\t\t\t\t\t\tinput: cases.inputs[caseNum].trim(),\n\t\t\t\t\t\texpected: cases.outputs[caseNum].trim(),\n\t\t\t\t\t\tgot: \"<br/>\"\n\t\t\t\t\t}\n\t\t\t\t\tif (caseNum == (cases.numCases - 1)) {\n\t\t\t\t\t\tevaluateResults(passed_cases, true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tevaluateResults(passed_cases, false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\trunTestCases(caseNum + 1);\n\t\t})\n\t}\n\n\t/**\n\t * Download a html page with the given codeforces url\n\t */\n\tasync function downloadCodeforcesPage(url) {\n\t\tif (verifyValidCodeforcesURL(url)) {\n\t\t\tvscode.window.showInformationMessage(\"Downloading Testcases\");\n\t\t\tconst html = await rp(url);\n\t\t\treturn html;\n\t\t} else {\n\t\t\ttestCasesHelper(filepath);\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Comiple the C++ file\n\t */\n\tconst gpp = spawn('g++', [filepath, '-o', filepath + \".bin\"]);\n\tgpp.stdout.on(\"data\", (data) => {\n\t\tconsole.log(`stdout: ${data}`);\n\t})\n\tgpp.stderr.on('data', (data) => {\n\t\toc.clear();\n\t\toc.append(\"Errors while compiling\\n\" + data.toString());\n\t\toc.show();\n\t\tcompilationError = true;\n\t});\n\n\tgpp.on('exit', async (exitCode) => {\n\t\tif (!compilationError) {\n\t\t\tawait runTestCases(0);\n\t\t}\n\t\tconsole.log(`Compiler exited with code ${exitCode}`);\n\t});\n}", "function loadSample(fname, callback){\n\n loadedFname = fname;\n loadExample(fname, function (err, data){\n //if err, return\n if (err) {\n return};\n run();\n });\n }", "function PyRun_VerySimpleFile(filename, ascode) {\n var code =`\ntry:\n exec( open('` + filename + `', 'r').read(), globals() , globals())\nexcept Exception as e:\n sys.print_exception(e)\n`\n if (ascode)\n return code\n pyscripts.push(code)\n}", "function sc_callWithInputFile(s, proc) {\n throw \"can't open \" + s;\n}", "function runTests(t, optimizely)\n{\n // prepare env\n optimizely.setOptimizely(optimizelyCode);\n\n // planning tests\n t.plan(7);\n\n // check that test line doesn't exists in teh original html\n t.equal(originalHtml.indexOf('Experiment: Text Change'), -1);\n\n // run the thing\n optimizely(req, originalHtml, function(err, html, extra)\n {\n t.equal(err, null);\n // check updated content\n t.inequal(html.indexOf('Experiment: Text Change'), -1);\n\n // check extras\n t.inequal(extra.images, null);\n t.equal(extra.images.length, 2);\n\n t.inequal(extra.cookies, null);\n t.inequal(extra.cookies.getCookieHeader().length, 0);\n });\n\n}", "function runTest() {\n return exports.handler(test_input3, test_context, function(err, result) {\n if (err) console.error(err);\n else console.log(result);\n });\n}", "function loadTestWithConfig(path, config) {\n\n}", "static executeFile(evt, {path=\"\", str=\"\"}){\n // if file is unsaved give a fake path to allow execution \n path = path || TEMP_EXEC_PATH;\n\n // fix problem where path folder had spaces\n // (don't save with this path, just special for ghci)\n let runPath = path.includes(\" \") ? `\\\"${path}\\\"` : path;\n\n // ghci must be working \n this.ghciSafeRun(evt, () => {\n // load and run the file \n // do not respond (using evt) because response is async\n // (handled with the wrapper's auto stdout listeners)\n if(str){\n // file changed\n FileUtils.writeFile(path, str)\n .then(() => {\n // file updated\n GHCI_PROCESS.responseEvt = evt;\n IpcResponder.respond(evt, \"file-write\", {path});\n\n // now run\n GHCI_PROCESS.load(runPath);\n })\n .catch(err => {\n // file write error (don't run)\n IpcResponder.respond(evt, \"file-write\", {err: err.message, path});\n console.log(\"ERR\");\n });\n }\n else{\n // file not changed\n GHCI_PROCESS.responseEvt = evt;\n GHCI_PROCESS.load(runPath);\n }\n });\n }", "function testAtCursor(goConfig, args) {\r\n let editor = vscode.window.activeTextEditor;\r\n if (!editor) {\r\n vscode.window.showInformationMessage('No editor is active.');\r\n return;\r\n }\r\n if (!editor.document.fileName.endsWith('_test.go')) {\r\n vscode.window.showInformationMessage('No tests found. Current file is not a test file.');\r\n return;\r\n }\r\n getTestFunctions(editor.document).then(testFunctions => {\r\n let testFunction;\r\n // Find any test function containing the cursor.\r\n for (let func of testFunctions) {\r\n let selection = editor.selection;\r\n if (selection && func.location.range.contains(selection.start)) {\r\n testFunction = func;\r\n break;\r\n }\r\n }\r\n ;\r\n if (!testFunction) {\r\n vscode.window.setStatusBarMessage('No test function found at cursor.', 5000);\r\n return;\r\n }\r\n return goTest({\r\n goConfig: goConfig,\r\n dir: path.dirname(editor.document.fileName),\r\n flags: getTestFlags(goConfig, args),\r\n functions: [testFunction.name]\r\n });\r\n }).then(null, err => {\r\n console.error(err);\r\n });\r\n}", "function runTest(testFunction, test, testNumber) {\n\tconst output = testFunction(test.input);\n\n\tconsole.log(\"Test #\" + testNumber);\n\tconsole.log(\"Input:\");\n\tconsole.log(test.input);\n\tconsole.log(\"Output:\");\n\tconsole.log(output);\n\tconsole.log(\"Expected output:\");\n\tconsole.log(test.expectedOutput);\n\n\tif (arrayIsEquals(output, test.expectedOutput)) {\n\t\tconsole.log(\"Success!\");\n\t}\n\telse {\n\t\tconsole.log(\"Failure!\");\n\t}\n\n\tconsole.log(\"\");\n}", "test(name, fn) {\n this.checkName(name);\n const test = new Test(name, this.fixture, fn);\n this.tests.push(test);\n return test;\n }", "function subTestAtCursor(goConfig, args) {\n return __awaiter(this, void 0, void 0, function* () {\n const editor = vscode.window.activeTextEditor;\n if (!editor) {\n vscode.window.showInformationMessage('No editor is active.');\n return;\n }\n if (!editor.document.fileName.endsWith('_test.go')) {\n vscode.window.showInformationMessage('No tests found. Current file is not a test file.');\n return;\n }\n yield editor.document.save();\n try {\n const testFunctions = yield testUtils_1.getTestFunctions(editor.document, null);\n // We use functionName if it was provided as argument\n // Otherwise find any test function containing the cursor.\n const currentTestFunctions = testFunctions.filter((func) => func.range.contains(editor.selection.start));\n const testFunctionName = args && args.functionName ? args.functionName : currentTestFunctions.map((el) => el.name)[0];\n if (!testFunctionName || currentTestFunctions.length === 0) {\n vscode.window.showInformationMessage('No test function found at cursor.');\n return;\n }\n const testFunction = currentTestFunctions[0];\n const simpleRunRegex = /t.Run\\(\"([^\"]+)\",/;\n const runRegex = /t.Run\\(/;\n let lineText;\n let runMatch;\n let simpleMatch;\n for (let i = editor.selection.start.line; i >= testFunction.range.start.line; i--) {\n lineText = editor.document.lineAt(i).text;\n simpleMatch = lineText.match(simpleRunRegex);\n runMatch = lineText.match(runRegex);\n if (simpleMatch || (runMatch && !simpleMatch)) {\n break;\n }\n }\n if (!simpleMatch) {\n vscode.window.showInformationMessage('No subtest function with a simple subtest name found at cursor.');\n return;\n }\n const subTestName = testFunctionName + '/' + simpleMatch[1];\n return yield runTestAtCursor(editor, subTestName, testFunctions, goConfig, 'test', args);\n }\n catch (err) {\n vscode.window.showInformationMessage('Unable to run subtest: ' + err.toString());\n console.error(err);\n }\n });\n}", "function test(command, argv) {\n const path = require('path');\n const spawn = require('cross-spawn');\n\n const karmaConfigPath = path.resolve(\n __dirname,\n '..',\n 'config/karma/' + command + '.karma.conf.js'\n );\n\n const flags = [\n '--max-old-space-size=4096',\n 'node_modules/karma/bin/karma',\n 'start',\n karmaConfigPath,\n '--command',\n command\n ];\n\n if (argv && argv.coverage === false) {\n flags.push('--no-coverage');\n } else {\n flags.push('--coverage');\n }\n\n const options = {\n stdio: 'inherit'\n };\n\n // Pass our exitCode up\n const test = spawn('node', flags, options);\n test.on('exit', exitCode => process.exit(exitCode));\n}", "function _runTest (index, basename, html) {\n const tests = [\n // preamble page\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // tests titlePage option\n _testToc(root, basename, 'Welcome');\n t.is(root.find('#_footnoteref_3').length, 1);\n t.is(root.find('#_footnotedef_3').length, 1);\n t.is(root.find('a.footnote').length, 1);\n t.is(root.find('div.footnote').length, 1);\n },\n // part I\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, 'Part I');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap 1\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, '1. First Chapter');\n t.is(root.find('#_footnoteref_4').length, 1);\n t.is(root.find('#_footnotedef_4').length, 1);\n t.is(root.find('a.footnote').length, 1);\n t.is(root.find('div.footnote').length, 1);\n },\n // chap 2\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, '2. Second Chapter');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap2 sec1\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, '2.1. Chap2. First Section');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap2 sec2 (depth:2)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, '2.2. Chap2. Second Section');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap2 sec2-1 (depth:3)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, '2.2.1. Chap2. Sec 2-1');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap2 sec2-1-1 (depth:4)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, 'Chap2. Sec 2-1-1');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap2 sec2-1-2 (depth:4)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, 'Chap2. Sec 2-1-2');\n t.is(root.find('#_footnoteref_4').length, 1);\n t.is(root.find('#_footnotedef_4').length, 1);\n t.is(root.find('a.footnote').length, 2); // multiply referred in Sec 2-1-2\n t.is(root.find('div.footnote').length, 1);\n },\n // chap2 sec2-2 (depth:3)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, '2.2.2. Chap2. Sec 2-2');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap2 sec2-2-1 (depth:4)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, 'Chap2. Sec 2-2-1');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap2 sec2-2-2 (depth:4)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, 'Chap2. Sec 2-2-2');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap2 sec2-2-3 (depth:4)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, 'Chap2. Sec 2-2-3<sup class=\"footnote\">[1]</sup>');\n t.is(root.find('#_footnoteref_1').length, 1);\n t.is(root.find('#_footnotedef_1').length, 1);\n t.is(root.find('a.footnote').length, 1);\n t.is(root.find('div.footnote').length, 1);\n },\n // chap2 sec2-3 (depth:3)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, '2.2.3. Chap2. Sec 2-3');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap2 sec3 (depth:2)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, '2.3. Chap2. Third Section');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // part II\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, 'Part II');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap 3 (depth:1)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, '3. Third Chapter<sup class=\"footnote\">[2]</sup>');\n t.is(root.find('#_footnoteref_2').length, 1);\n t.is(root.find('#_footnotedef_2').length, 1);\n t.is(root.find('a.footnote').length, 1);\n t.is(root.find('div.footnote').length, 1);\n },\n // chap3 sec1 (depth:2)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, '3.1. Chap3. First Section');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap3 sec2 (depth:2)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, '3.2. Chap3. Second Section');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n // chap3 sec3 (depth:2)\n (basename, html) => {\n const root = Node.getInstanceFromHTML(html);\n // check toc\n _testToc(root, basename, '3.3. Chap3. Third Section');\n t.is(root.find('a.footnote').length, 0);\n t.is(root.find('div.footnote').length, 0);\n },\n ];\n if (tests[index])\n tests[index](basename, html);\n }", "function test(name, url, commit, cb) {\n var localDir = path.join(tmpDir, name);\n\n async.series([\n async.apply(clearRepo, localDir),\n async.apply(cloneRepo, localDir, url),\n async.apply(checkoutCommit, localDir, commit),\n async.apply(bundleInstall, localDir)\n ], function(err, messages) {\n if(err) return cb(err);\n\n util.log(\"Running specs for \" + name + \"/\" + commit);\n runTests(localDir, 'spec', function(err, pass) {\n if(err) return cb(err);\n if(!pass) return cb(err, false, \"Specs\");\n\n util.log(\"Running features for \" + name + \"/\" + commit);\n runTests(localDir, 'cucumber', function(err, pass) {\n if(err) return cb(err);\n if(!pass) return cb(err, false, \"Features\");\n\n return cb(null, true);\n });\n });\n });\n}", "function testFileServing() {\n var req = request(`http://127.0.0.1:${testPort}/someJSON.json`, {\n timeout: 1000\n }, function(error, response, body) {\n if (error || response.statusCode !== 200) {\n t.fail('Bad request to static server');\n } else {\n t.ok(JSON.parse(body).theFile, 'The right file was server');\n }\n req.abort();\n end();\n });\n }", "function runTest(i) {\n if (i >= inputs.length) throw new Error('You do not have enough test cases');\n let expected = outputs[i];\n let actual = f(inputs[i]);\n verifyEquals(expected, actual);\n}", "function runTest(i) {\n if (i >= inputs.length) throw new Error('You do not have enough test cases');\n let expected = outputs[i];\n let actual = f(inputs[i]);\n verifyEquals(expected, actual);\n}", "function runTest(i) {\n if (i >= inputs.length) throw new Error('You do not have enough test cases');\n let expected = outputs[i];\n let actual = f(inputs[i]);\n verifyEquals(expected, actual);\n}", "function runTest(i) {\n if (i >= inputs.length) throw new Error('You do not have enough test cases');\n let expected = outputs[i];\n let actual = f(inputs[i]);\n verifyEquals(expected, actual);\n}", "function runKarma( testConfigFile, options ) {\n var args = [ 'start', testConfigFile, '--reporters=dots', '--colors' ].concat( options ),\n done = grunt.task.current.async(),\n child = grunt.util.spawn({\n cmd: karmaCmd,\n args: args\n }, function karmaError( err, result, code ) {\n grunt.log.writeln(\"Running cmd\");\n if ( code ) {\n done( false );\n } else {\n done();\n }\n });\n\n child.stdout.pipe(process.stdout);\n child.stderr.pipe(process.stderr);\n }", "function runTest(i) {\n if (i >= inputs.length) throw new Error(\"You do not have enough test cases\");\n let expected = outputs[i];\n let actual = f(inputs[i]);\n verifyEquals(expected, actual);\n}", "function importTest(name, path) {\n describe(name, function () {\n require(path);\n });\n}", "function runTestAtCursor(editor, testFunctionName, testFunctions, goConfig, cmd, args) {\n return __awaiter(this, void 0, void 0, function* () {\n const testConfigFns = [testFunctionName];\n if (cmd !== 'benchmark' && testUtils_1.extractInstanceTestName(testFunctionName)) {\n testConfigFns.push(...testUtils_1.findAllTestSuiteRuns(editor.document, testFunctions).map((t) => t.name));\n }\n const isMod = yield goModules_1.isModSupported(editor.document.uri);\n const testConfig = {\n goConfig,\n dir: path.dirname(editor.document.fileName),\n flags: testUtils_1.getTestFlags(goConfig, args),\n functions: testConfigFns,\n isBenchmark: cmd === 'benchmark',\n isMod,\n applyCodeCoverage: goConfig.get('coverOnSingleTest')\n };\n // Remember this config as the last executed test.\n lastTestConfig = testConfig;\n return testUtils_1.goTest(testConfig);\n });\n}", "function executeTests() {\n\n\tconsole.log('Executing tests...');\n\n\tsetupOutput();\n\n\tfor (var testFile of tests) {\n\t\tconsole.log('Running test %s', testFile);\n\n\t\trequire(testFile);\n\t}\n}", "function runTests(configData) {\n var deferred = defer();\n\n var summaries = [];\n\n var useVariants = [];\n if (TEST_VARIANT) {\n useVariants.push(TEST_VARIANT);\n } else {\n for (var variantName in configData.variants) {\n var variantData = configData.variants[variantName];\n if (!variantData.optional ||\n (variantName === 'imap:real' && TEST_PARAMS.type === 'imap') ||\n (variantName === 'activesync:real' &&\n TEST_PARAMS.type === 'activesync')) {\n useVariants.push(variantName);\n }\n }\n }\n console.log('legal variants for tests:', useVariants);\n\n var controlServer = FakeServerSupport.makeControlHttpServer().server;\n\n var runTests = [];\n for (var testName in configData.tests) {\n var testData = configData.tests[testName];\n var testVariants = testData.variants.filter(function(v) {\n return useVariants.indexOf(v) !== -1;\n });\n if (testVariants.length) {\n runTests.push(\n {\n name: testName.replace(/\\.js$/, ''),\n // filter out the variants that we don't want to run right now\n variants: testVariants,\n });\n console.log('planning to run test:', testName);\n }\n }\n\n if (runTests.length === 0) {\n console.warn('0 tests matched; are you sure that you added the file to',\n TEST_CONFIG, 'and that one of its supported variants is',\n 'listed above?');\n }\n\n var iTest = 0, iVariant = 0, curTestInfo = null;\n function runNextTest(summary) {\n if (summary)\n summaries.push(summary);\n\n if (curTestInfo && iVariant >= curTestInfo.variants.length) {\n iTest++;\n iVariant = 0;\n }\n if (iTest >= runTests.length) {\n controlServer.shutdown();\n deferred.resolve(summaries);\n return;\n }\n\n curTestInfo = runTests[iTest];\n\n runTestFile(configData.runner,\n curTestInfo.name, curTestInfo.variants[iVariant++],\n controlServer)\n .then(runNextTest,\n function(err) { console.error('Problem running test:', err); });\n }\n runNextTest();\n\n return deferred.promise;\n}", "function run(){\n\n\tdescribe(\"UnderseaWorld2\", function(){\n\n\t\tfindXML();\n\t\tparseXML();\n\t\tloadGame();\n\t\tsingleSpin(); // Start by doing a single spin\n\t\tfullGame();\n\t\texpandingTiles();\n\t\tbonusGame();\n\t\tbonusTime();\n\t});\n}", "function testStdout(input, args, callback) {\n return async () => {\n const thisTestDir = path.join(testDir, '' + testCount++)\n\n try {\n await fs.mkdir(thisTestDir, { recursive: true })\n const inputFile = path.join(thisTestDir, 'example.js')\n await fs.writeFile(inputFile, input)\n\n // Run whatever check the caller is doing\n await callback(async () => {\n const { stdout } = await execFileAsync(\n esbuildPath, [inputFile, '--log-level=warning'].concat(args), { cwd: thisTestDir, stdio: 'pipe' })\n return stdout\n })\n\n // Clean up test output\n removeRecursiveSync(thisTestDir)\n } catch (e) {\n console.error(`❌ test failed: ${e && e.message || e}\n dir: ${path.relative(dirname, thisTestDir)}`)\n return false\n }\n\n return true\n }\n}", "async function defineTests () {\n const examplesData = await loadExamplesData()\n describe('dt2js CLI integration test', function () {\n this.timeout(20000)\n examplesData.forEach(data => {\n context(`for file ${data.fpath}`, () => {\n data.names.forEach(typeName => {\n it(`should convert ${typeName}`, async () => {\n const schema = await dt2jsCLI(data.fpath, typeName)\n validateJsonSchema(schema)\n })\n })\n })\n })\n })\n}", "function runTest(test) {\n test.testOptions.screenCapture = './accessability-test/output/' + test.name +'.png'\n var options = { \n ...test.testOptions, \n standard: 'Section508'}; //standard: 'Section508'}; standard: 'WCAG2AAA'; \"WCAG2A\"; WCAG2AA}; \n pa11y(test.url, options).then((results) => {\n results.screenGrab = test.name + '.png';\n var htmlResults = accReporter.process(results, test.url, true);\n fs.writeFile('accessability-test/output/'+ test.name + '.html', htmlResults, function(err) {})\n }).catch((err) => {\n console.log(err);\n });\n}", "async function testReceiveFile() {\n let mockFile =\n {\n \"requestType\" : \"trip\",\n \"requestVersion\" : 3,\n \"options\" : {\"title\": \"Lil Trip\",\"earthRadius\":\"3959\",\"optimization\":\"short\"},\n \"places\" : [\n {\"name\":\"Denver\",\"latitude\":\"39.7\",\"longitude\":\"-105.0\"}],\n \"distances\" : [],\n \"type\" : \"plain/text\"\n };\n\n const event = {\n preventDefault() {},\n stopPropagation() {},\n target: {files: [mockFile]},\n };\n const readAsText = jest.fn();\n const addEventListener = jest.fn((_,evtHandler) => { evtHandler(); });\n const dummyFileReader = {addEventListener, readAsText, result: mockFile};\n window.FileReader = jest.fn(() => dummyFileReader);\n\n await app2.instance().onReceiveFile(event);\n expect(FileReader).toHaveBeenCalled();\n}", "function cleanupAndRunNext(v) {\n fileSystem.root.getFile(testFileName, {create:false}, function(entry) {\n // Remove the entry before start testing.\n entry.remove(runNextTest, errorCallback);\n }, runNextTest);\n}", "function test(test) {\n var attrs = {\n classname: test.parent.fullTitle()\n , name: test.title\n , time: test.duration / 1000\n };\n\n if ('failed' == test.state) {\n var err = test.err;\n attrs.message = escape(err.message);\n console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack))));\n } else if (test.pending) {\n console.log(tag('testcase', attrs, false, tag('skipped', {}, true)));\n } else {\n console.log(tag('testcase', attrs, true) );\n }\n}", "function runScript() {\n var entry = ProjectManager.getSelectedItem();\n if (entry === undefined) {\n entry = DocumentManager.getCurrentDocument().file;\n }\n var path = entry.fullPath,\n args = [],\n text = DocumentManager.getCurrentDocument().getText(),\n argsmatch = text.match(/brackets-xunit:\\s*args=\\S+/),\n argsstr = '',\n argsout = '';\n \n if (argsmatch !== null && argsmatch.length > 0) {\n argsstr = argsmatch[0].substring(argsmatch[0].indexOf(\"=\") + 1);\n args = argsstr.split(',');\n argsout = '';\n var i;\n for (i = 0; i < args.length; i++) {\n argsout = argsout + args[i] + \" \";\n }\n }\n nodeConnection.domains.process.spawnSession({executable: path, args: args, cacheTime: 100}).done(function (status) {\n var template = require(\"text!templates/process.html\"),\n html = Mustache.render(template, { path: path, title: \"script - \" + path, args: argsout}),\n newWindow = window.open(\"about:blank\", null, \"width=600,height=200\");\n newWindow.document.write(html);\n newWindow.document.getElementById(\"exitcode\").innerHTML = \"running with pid \" + status.pid;\n newWindow.focus();\n _windows[status.pid] = {window: newWindow, startTime: new Date(), type: \"script\"};\n });\n }", "function test() {\n runTests0();\n runTests1(); \n return true;\n}", "function run(file){\r\n file.process = spawn('stylus', [ abs_path + file['in'], '-o', abs_path + file['out'] ]);\r\n file.process.stdout.on('data', function(data) {\r\n console.log(data.toString());\r\n });\r\n file.process.stderr.on('data', function(data){\r\n console.log(data.toString());\r\n });\r\n file.process.on('exit', function(code){\r\n console.log('Process for file ' + file['in'] + ' exited with code ' + code);\r\n }); \r\n}", "function readTestDataJSON (file) {\n try {\n console.log(\"attempting to read file\", file);\n return JSON.parse(readFileSync(file, 'utf8'));\n } catch(error) {\n console.log(error);\n throw new Error(`file ${file} cannot be read. It must be available as a requirement to run this script`);\n }\n}", "async function runUnitTests(unitTests = allUnitTests) {\n if (busy) {\n pendingTests = _.union(pendingTests, unitTests);\n return;\n }\n console.log(chalk.cyan(`Running ${unitTests.length} unit test files`));\n\n // watchedFiles: all of the project files that mocha required (no node_modules)\n // list of source files and their associated unit tests\n busy = true;\n const {\n watchedFiles,\n unitTestsForSrc\n } = await runMochaTests(unitTests);\n busy = false;\n if (pendingTests.length > 0) {\n busy = false;\n process.nextTick(() => {\n runUnitTests(pendingTests);\n pendingTests = [];\n });\n console.log(chalk.yellow('Changes detected during last run.'));\n console.log(chalk.yellow('======'));\n return;\n } else {\n console.log(chalk.yellow('Watching for changes'));\n console.log(chalk.yellow('======\\n\\n'));\n };\n\n\n // watcher is only created once- if new files are added, then watcher must be restarted\n if (!watcher) {\n // start watcher with the files that mocha imported\n watcher = chokidar.watch(watchedFiles).\n on('change', file => {\n // if a unit test is updated just run that unit test\n if (file.includes('.unit.spec')) {\n runUnitTests([file]);\n }\n\n // if change is from a src file, run unit tests that import that src file\n if (file.includes('src') && unitTestsForSrc[file]) {\n runUnitTests(unitTestsForSrc[file]);\n } else {\n // if no unit tests import src file, run all unit tests\n runUnitTests();\n }\n });\n }\n}", "runTestCasesAndFinish()\n {\n this.runTestCases();\n InspectorTest.completeTest();\n }", "function runTests(project) {\n return new Promise(function (res, rej) {\n const name = changeCase.paramCase(project.name);\n console.log('Running tests. . .'.yellow);\n const directory = `${projectsDirectory}/${name}/`;\n const cmd = makeTestScript(directory);\n exec(cmd, function (err, stdout, stderr) {\n if (stderr) {\n rej(stderr);\n }\n // The split variable MUST have EXACTLY TWO spaces before \"stats\"\n const split = `{\n \"stats\": {`;\n const index = stdout.indexOf(split);\n if (index === -1) {\n console.log('There was an error.'.red, err);\n } else {\n const parsedStdout = JSON.parse(stdout.slice(index));\n const stats = parsedStdout.stats;\n console.log(` Total tests: ${stats.tests} `.bgBlack.white);\n console.log(` Passing tests: ${stats.passes} `.bgBlue.white);\n console.log(` Pending tests: ${stats.pending} `.bgYellow.black);\n console.log(` Failing tests: ${stats.failures} `.bgRed.white);\n res({ project, parsedStdout });\n }\n });\n });\n}", "function testFunctions() {\n loadSelectedTests(fileSystemTests, selectedTests, 'FileSystem');\n }", "function testCmd (files) {\n const paths = files.map((f) => {\n return `\"test/fixtures/${f}\"`\n }).join(' ')\n return `./node_modules/.bin/babel-node bin/kanu\n --reporter json\n ${paths}`.replace(/[\\s\\n]+/g, ' ')\n}", "function runCheck(e, p) {\n payload = JSON.parse(e.payload);\n\n // Extract the check name\n name = payload.body.check_run.name;\n\n // Determine which check to run\n switch(name) {\n case \"test-go\":\n return runTests(e, p, goTest);\n case \"test-javascript\":\n return runTests(e, p, jsTest);\n default:\n throw new Error(`No check found with name: ${name}`);\n }\n}", "function runQUnit() {\n var entry = ProjectManager.getSelectedItem();\n if (entry === undefined) {\n entry = DocumentManager.getCurrentDocument().file;\n }\n var dir = entry.fullPath.substring(0, entry.fullPath.lastIndexOf('/') + 1),\n dirEntry = new NativeFileSystem.DirectoryEntry(dir),\n fname = DocumentManager.getCurrentDocument().filename,\n contents = DocumentManager.getCurrentDocument().getText(),\n testName = entry.fullPath.substring(entry.fullPath.lastIndexOf(\"/\") + 1),\n testBase = testName.substring(0, testName.lastIndexOf('.')),\n qunitReportEntry = new NativeFileSystem.FileEntry(dir + testBase + '/qUnitReport.html'),\n includes = parseIncludes(contents, dir);\n var data = { filename : entry.name,\n title : 'QUnit test - ' + entry.name,\n includes : includes,\n templatedir : moduledir,\n contents : contents\n };\n var template = require(\"text!templates/qunit.html\");\n var html = Mustache.render(template, data);\n // write generated test report to file on disk\n dirEntry.getDirectory(dir + testBase, {create: true}, function () {\n FileUtils.writeText(qunitReportEntry, html).done(function () {\n // launch new window with generated report\n var report = window.open(qunitReportEntry.fullPath);\n report.focus();\n });\n });\n }" ]
[ "0.72810954", "0.70838", "0.6641919", "0.64004225", "0.63283724", "0.630544", "0.62578845", "0.61539394", "0.6091329", "0.5996837", "0.59594077", "0.59332865", "0.5927237", "0.59154767", "0.58949983", "0.5880468", "0.584527", "0.5790941", "0.57533413", "0.57286286", "0.5659215", "0.5656415", "0.5646178", "0.55457497", "0.55345297", "0.5519297", "0.55064094", "0.5499679", "0.54821056", "0.5480586", "0.54639846", "0.5450601", "0.5439398", "0.54223394", "0.5420524", "0.54177105", "0.54168713", "0.54006964", "0.53770626", "0.53740317", "0.5369334", "0.5369073", "0.53661937", "0.53636026", "0.5358298", "0.5350584", "0.5348481", "0.5345048", "0.53184474", "0.5315905", "0.5302523", "0.5301144", "0.5300065", "0.52957594", "0.52932054", "0.529228", "0.5291728", "0.529025", "0.5286417", "0.52768695", "0.5272577", "0.52542484", "0.5251596", "0.52346843", "0.5220941", "0.5219786", "0.5216517", "0.52144325", "0.5207884", "0.5204789", "0.520066", "0.5199121", "0.51976407", "0.51976407", "0.51976407", "0.51976407", "0.5195434", "0.51952577", "0.51940495", "0.5184478", "0.51818174", "0.51787883", "0.5177649", "0.5174656", "0.5171889", "0.51690507", "0.5166983", "0.5149365", "0.51449037", "0.5136852", "0.5134291", "0.5132449", "0.5100869", "0.5095558", "0.5085048", "0.5083743", "0.508162", "0.50772214", "0.5068952", "0.5068615" ]
0.5993082
10
This decodes the token so that we know the User Id
getUser() { return decode(this.getToken()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function decodeToken(token) {\n if (!token) {\n console.log(\"lol no token\");\n return;\n }\n \n const decodedToken = jwt_decode(token);\n \n const decodedUserId = decodedToken.userID;\n \n return decodedUserId;\n }", "getUser() {\n return decode(this.getToken());\n }", "function getUserDetails(token) {\n return jwt.decode(token);\n}", "function decryptToken(token) {\n var base64Url = token.split('.')[1];\n var base64 = base64Url.replace('-', '+').replace('_', '/');\n var currentUser = JSON.parse($window.atob(base64));\n\n return currentUser;\n }", "function decodeToken(req) {\n if (req.headers['auth_token']) {\n return Shared.decode(req.headers['auth_token']);\n } else {\n return Shared.decode(req.signedCookies['auth_token'])\n }\n}", "decode (token) {\n\t\treturn JWT.decode(\n\t\t\ttoken,\n\t\t\tthis.secret,\n\t\t\t{\n\t\t\t\talgorithms: [JWT_ALGORITHM]\n\t\t\t}\n\t\t);\n\t}", "function decode(token) {\n return _jsonwebtoken[\"default\"].decode(token, _env[\"default\"].jwtSecret);\n}", "function parseToken(req, res, next) {\r\n\tconst token = getToken(req.headers);\r\n\tlet resp = {};\r\n\ttry {\r\n\t\tlet decoded = jwt.verify(token, SECRET_KEY);\r\n\t\treq.userid = decoded.userid;\r\n\t\tnext();\r\n\t} catch (err) {\r\n\t\tresp.code = 500;\r\n\t\tresp.message = err;\r\n\t\tres.status(500).send(resp)\r\n\t}\r\n\t\r\n}", "async extractFromAuthCode () {\n\t\ttry {\n\t\t\tthis.payload = this.api.services.tokenHandler.decode(this.request.query.code);\n\t\t}\n\t\tcatch (error) {\n\t\t\tconst message = typeof error === 'object' ? error.message : error;\n\t\t\tthrow this.errorHandler.error('tokenInvalid', { reason: message });\n\t\t}\n\t\tif (this.payload.type !== 'pauth') {\n\t\t\tthrow this.errorHandler.error('tokenInvalid', { reason: 'not a provider authorization token' });\n\t\t}\n\t}", "function getUser(token){\n const tokenParts = token.split('.');\n const encodedPayload = tokenParts[1];\n const rawPayload = atob(encodedPayload);// atob zet versleutelde data om te zetten naar leesbare tekst\n const user = JSON.parse(rawPayload); // user uit token halen zonder dat je code nodig hebt.\n return user;\n}", "async get_token() {\n\n var username = await AsyncStorage.getItem(\"username\");\n if (username != null && username != this.guestuserkey()) {\n var bytes_username = utf8.encode(username);\n var encoded_username = binaryToBase64(bytes_username);\n\n //update when upgrading authentication flow\n var securityversion = \"1\";\n\n var tokenobj = {};\n tokenobj[\"token\"] = encoded_username;\n tokenobj[\"securityversion\"] = securityversion;\n\n var token = JSON.stringify(tokenobj);\n var bytes = utf8.encode(token);\n var encoded = binaryToBase64(bytes);\n return encoded;\n }\n else {\n var token = \"4B0053744852ED7C2705E668C43982928978B74BBB7F21A0F9B4E43914E49A6F\";\n var bytes = utf8.encode(token);\n var encoded = binaryToBase64(bytes);\n return encoded;\n }\n\n }", "function getTokenPayload(token) {\n let payload = jwt.decode(token);\n return payload.username;\n }", "function getUserFromToken() {\n const token = getToken();\n return token ? JSON.parse(atob(token.split('.')[1])).user : null;\n}", "function userId(decodedToken) {\n return jwt_1.readPropertyWithWarn(decodedToken, exports.mappingUserFields.id.keyInJwt);\n}", "function decodeToken(token, cb) \n{\n try \n {\n const payload = jwt.decode(token, process.env.TOPSECRET);\n const now = moment().unix();\n\n // Token verlopen?\n if (now > payload.exp) \n {\n console.log('[VERLOPEN] - Token is verlopen.');\n }\n\n // Return.\n cb(null, payload);\n console.log('[TOKEN] - Decoded token.');\n\n } \n \n catch (err) \n {\n cb(err, null);\n console.log(\"[FAILED] - Token error.\");\n }\n}", "function getUserID() {\n\n var token = getCookie()\n if (token == \"guest\") {\n return 'guest'\n }\n var decodedJWT = jwt_decode(token);\n return decodedJWT.sub\n}", "function parseValidateToken(req, res, next){\n // Decode token data from the request\n jwt.verify(req.body.token, config.KEY.ACCOUNT, function(err, decoded){\n // If an error occured with verifying the token\n if (err || decoded === undefined){\n return res.status(400).send(\n utils.errorResponse('ER_TOKEN_INVALID')\n );\n }\n // Find the user referenced in this token\n User.findOne({\n _id: decoded.id,\n email: decoded.email\n }, function(errr, user){\n // If an error occured with finding a user\n if (err){\n return res.status(500).send(\n utils.errorResponse('ER_SERVER', err)\n );\n }\n // If a user was not found\n if (!user){\n return res.status(400).send(\n utils.errorResponse('ER_NO_USER')\n );\n }\n // Extract ID, email and token type and bind to request\n req.token = {\n userID: user._id,\n type: decoded.type,\n userEmail: user.email\n };\n // Continue with the next piece of middleware\n next();\n });\n });\n}", "getIdToken() {\n const tokenResponse = this.state.tokenResponse;\n\n if (tokenResponse) {\n const idToken = tokenResponse.id_token;\n const scope = this.state.scope || \"\"; // We have been authorized against this server but we don't have\n // the id_token. This should be a scope issue.\n\n if (!idToken) {\n const hasOpenid = scope.match(/\\bopenid\\b/);\n const hasProfile = scope.match(/\\bprofile\\b/);\n const hasFhirUser = scope.match(/\\bfhirUser\\b/);\n\n if (!hasOpenid || !(hasFhirUser || hasProfile)) {\n debug(\"You are trying to get the id_token but you are not \" + \"using the right scopes. Please add 'openid' and \" + \"'fhirUser' or 'profile' to the scopes you are \" + \"requesting.\");\n } else {\n // The server should have returned the id_token!\n debug(\"The id_token is not available. Please check if your server supports that.\");\n }\n\n return null;\n }\n\n return (0, lib_1.jwtDecode)(idToken, this.environment);\n }\n\n if (this.state.authorizeUri) {\n debug(strings_1.default.noIfNoAuth, \"the id_token\");\n } else {\n debug(strings_1.default.noFreeContext, \"id_token\");\n }\n\n return null;\n }", "function decodeToken(req, res) {\n var token = req.body.token;\n\n var payload = jwt.decode(token, config.auth.tokenSecret);\n return res.status(200).send(payload);\n}", "function decodedToken (token) {\n\tconst decoded = new Promise((resolve, reject) => {\n\t\ttry {\n\t\t\tconst payload = jwt.decode(token, config.SECRET_TOKEN);\n\n\t\t\tif (payload.exp <= moment().unix()) {\n\t\t\t\treject({\n\t\t\t\t\tstatus : 401,\n\t\t\t\t\tmsg : 'El token ha expirado'\n\t\t\t\t});\n\t\t\t}\n\t\t\tresolve(payload.sub);\n\t\t} catch(error) {\n\t\t\treject({\n\t\t\t\tstatus : 500,\n\t\t\t\tmsg : 'Token invalido'\n\t\t\t});\n\t\t}\n\t});\n\treturn decoded;\n}", "function decodeToken(token) {\n return jwt.verify(token, process.env.SECRET_KEY_JWT);\n}", "validateToken(req, res, next) {\n //Token uit header halen\n const token = req.header(\"x-access-token\") || \"\";\n\n //Token decoderen\n authentication.decodeToken(token, (err, payload) => {\n if (err) {\n //Foutief token, ga naar error endpoint\n const error = new ApiError(err.message || err, 401);\n next(error);\n } else {\n //Correct\n //console.log(\"Authenticated! Payload = \");\n //console.dir(payload);\n req.user = payload.sub;\n next();\n }\n });\n }", "static decodeJwt(token) {\n let payload = null;\n\n try {\n payload = jwt.decode(token, config.TOKEN_SECRET);\n } catch (err) {\n utils.helpers.handleError(err, 'Authentication.authenticate');\n }\n return payload;\n }", "function parseUser(token) {\n let name;\n jwt.verify(token, env.access_token_secret, (err, username) => {\n if (!err) {\n name = username;\n }\n });\n return name;\n}", "setToken(token, opaqueId) {\n let role = '';\n let userId = '';\n\n try {\n const decoded = jwt.decode(token);\n userId = decoded.user_id;\n role = decoded.role;\n this._token = token;\n this._opaqueId = opaqueId;\n this._channelId = decoded.channel_id;\n } catch (e) {\n this._token = '';\n this._opaqueId = '';\n }\n this._userId = userId;\n this._role = role;\n }", "fetchIdToken(context) {\n return new Promise((resolve, reject) => {\n service\n .getUser()\n .then(function(user) {\n if (user == null) {\n context.dispatch('signIn');\n context.commit('setIdToken', null);\n return resolve(null);\n } else {\n context.commit('setIdToken', user.id_token);\n return resolve(user.id_token);\n }\n })\n .catch(function(err) {\n context.commit('setError', err);\n return reject(err);\n });\n });\n }", "function decodeIdToken(idtoken, keys, code) {\n var header = JSON.parse(new Buffer(idtoken.split('.')[0], 'base64').toString('utf8'));\n\n for (var i = 0; i < keys.length; i++) {\n if (keys[i].kid === header.kid) {\n return jwt.decode(idtoken, getpem(keys[i].n, keys[i].e));; \n } catch (e) {\n console.log(e);\n return null;\n }\n }\n }", "function addDecodedIdTokenToRequest(idToken, req) {\n return firebaseAdminApp.auth().verifyIdToken(idToken).then(decodedIdToken => {\n console.log('ID Token correctly decoded');\n req.user = decodedIdToken;\n }).catch(error => {\n console.error('Error while verifying Firebase ID token:', error);\n });\n}", "function decodeLocalStorage(callback) {\n const storageToken = localStorage.getItem(\"token\");\n axios\n .get(`http://192.168.0.13:4000/api/token/${storageToken}`)\n .then((res) => {\n callback(res.data._id);\n });\n }", "function jwtDecode(token, env) {\n const payload = token.split(\".\")[1];\n return payload ? JSON.parse(env.atob(payload)) : null;\n}", "getUser() {\n const token = localStorage.getItem('Authorization');\n let user = null;\n\n // If a token exists then decode it\n if (token) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const secondsSinceEpoch = new Date() / 1000;\n const parsedToken = JSON.parse(window.atob(base64));\n\n // If current date is after expiration date then destroy it\n if (secondsSinceEpoch > parsedToken.exp) {\n this.destroyToken();\n } else {\n user = parsedToken;\n }\n }\n\n return user;\n }", "getEncodedToken() {\n\t\treturn this.encodeTokenWithIdentityProvider(this.getToken());\n\t}", "function fetch_user_token()\n{\n if(document.cookie.indexOf(\"_bn_ut\")>=0)\n return getCookie(\"_bn_ut\");\n else\n {\n var err = {\"responseText\":'INVALID_TOKEN',\"status\":403};\n error_response(err);\n }\n}", "function decodeJWTtoken(token) {\n var _context;\n\n var base64Url = token.split('.')[1];\n var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/'); // no need to check availability of `encodeURIComponent`, since it is a function highly supported in browsers, node and other platforms.\n\n var jsonPayload = decodeURIComponent((0, _map.default)(_context = (0, _base.decodeFromBase64)(base64).split('')).call(_context, function (c) {\n var _context2;\n\n return '%' + (0, _slice.default)(_context2 = '00' + c.charCodeAt(0).toString(16)).call(_context2, -2);\n }).join(''));\n return JSON.parse(jsonPayload);\n}", "token() {\n return {\n _id: this._id,\n role: this.role\n }\n }", "function getUserIDFromBearerToken(bearerToken){\n return AccessToken.findOne({access_token: bearerToken},'user_id', {});\n}", "static async decode(token) {\n const cert = await this.readPublicKey();\n try {\n // @ts-ignore\n return (await util_1.promisify(jsonwebtoken_1.verify)(token, cert, { ignoreExpiration: true }));\n }\n catch (e) {\n Logger_1.default.debug(e);\n throw new ApiError_1.BadTokenError();\n }\n }", "function decodeToken(token, cb) {\n try {\n const payload = jwt.decode(token, config.secretkey);\n const now = moment().unix();\n\n if (now > payload.exp){\n console.log('Token has expired.');\n }\n return payload;\n } catch(err) {\n console.log(err);\n }\n}", "function tokenForUser(user) {\n\tconsole.log('tokenForUser fired');\n\tconsole.log('user id in tokenForUser is : ',user.id);\n\tvar timestamp = new Date().getTime();\n\treturn jwt.encode({ sub: user.id, iat: timestamp }, EnvConfig.secret);\n}", "function get_user_id( request, response ) {\n \n\n return request.headers['x-access-token'];\n}", "function getToken() {\n return token;\n }", "function getUserToken(){\n\t\treturn $cookies.get('user.token');\n\t}", "function getAuthInfo(){\n const token = localStorage.getItem('authToken');\n if (token) {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace('-', '+').replace('_', '/');\n const obj = JSON.parse(window.atob(base64));\n return obj.user; \n }\n}", "getToken() {\n let token = null;\n let userEmail = null;\n if (localStorage.getItem('id_token')) {\n token = localStorage.getItem('id_token');\n userEmail = jwt_decode(token).email;\n }\n return { authEmail: userEmail, auth: token };\n }", "getUserIdToken() {\n\t\treturn this.cognitoUser.getSignInUserSession().getIdToken().getJwtToken();\n\t}", "function userToken(payload) {\n return {\n type: _user.TOKEN,\n payload\n };\n}", "function receiveToken(userId, token, error) {\n return {\n type: SESSION_RECEIVE,\n userId,\n token,\n error,\n };\n}", "AUTH_USER (state, userData) {\n state.idToken = userData.token\n state.userId = userData.userId\n }", "async function verify(token) {\n\n const ticket = await client.verifyIdToken({\n idToken: token,\n audience: CLIENT_ID\n });\n\n const payload = ticket.getPayload();\n\n // Nuevo user\n return {\n username: payload.email.split('@')[0],\n email: payload.email,\n image: payload.picture,\n google: true\n }\n\n}", "static getUserToken(){\n let token = JSON.parse(localStorage.getItem('USER')).token;\n return token;\n }", "static getUserToken(){\n let token = JSON.parse(localStorage.getItem('USER')).token;\n return token;\n }", "getProfile() {\n\t\treturn decode(this.getToken());\n\t}", "function userId(token){\n\tif(token) return token.split('.')[0];\n\treturn false;\n}", "token() {\n return {\n id: this.id,\n role: this.role,\n };\n }", "verifyToken(req, res, next) {\n const token = req.get('Authorization');\n jsonwebtoken_1.default.verify(token, config_1.config.SEED, (err, decode) => {\n if (err) {\n return res.status(401).json({\n err: {\n message: 'Autorization (token) invalid'\n }\n });\n }\n req.user = decode.user;\n next();\n });\n }", "DecryptDataToken(token){\n let reponse = new Object()\n reponse.TokenValide = false\n reponse.TokenData = \"\"\n let DecryptReponse = this.Decrypt(token)\n if(DecryptReponse.decryptedValide){\n let jwt = require('jsonwebtoken')\n try {\n reponse.TokenData = jwt.verify(DecryptReponse.decryptedData, this._Secret)\n reponse.TokenValide = true\n } catch(err) {\n this.LogAppliError(\"jsonwebtoken non valide\", \"Server\", \"Server\")\n }\n }\n return reponse\n }", "function tokenForUser(user) {\n const timestamp = new Date().getTime();\n console.log(user);\n return jwt.encode({ sub: user.id, iat: timestamp }, process.env.AUTH_SECRET);\n}", "getIdToken() {\n return this.idToken;\n }", "async generateLoginToken(userInfo){\n let tokenPayload = _.pick(userInfo, ['_id', 'mobile_no', 'roles']);\n return jwtHelper.generateToken(tokenPayload)\n .then((token) => {\n // now store the generated token\n UserProfileDataManager.update({_id: userInfo._id}, {$set: {auth_token: token}});\n return token;\n });\n }", "getUserIdByToken(authKey) {\n const userData = this.app.readDataFile(userFilePath);\n const user = userData.find(item => item.token === authKey);\n\n return user ? user.id : false;\n }", "tokenForUser(user) {\n const timeStamp = new Date().getTime();\n return jwt.encode({ sub: user.id, iat: timeStamp }, config.secret);\n }", "_parseAuthInfo(){\n if(this.authInfo){\n const authCode = this.authInfo.split(/\\s+/)[1]\n const authDecode = new Buffer(authCode, 'base64').toString()\n const creds = authDecode.split(':')\n this.login = creds[0]\n this.password = creds[1]\n this.user = User.find_by_login(this.login)\n }\n if(!this.user){\n this.login = 'guest'\n this.password = ''\n this.user = User.find_by_login('guest')\n }\n // TODO: maintain log of user and actions\n // console.info(`authenticated as ${this.user.name}`)\n }", "function tokenForUser(user) {\n var timestamp = new Date().getTime();\n return _jwtSimple2.default.encode({ sub: user.id, iat: timestamp }, _config2.default.secret);\n}", "function token(user) {\n return getUserToken(buildUser(user));\n}", "static async _fromIdTokenResponse(auth, idTokenResponse, isAnonymous = false) {\r\n const stsTokenManager = new StsTokenManager();\r\n stsTokenManager.updateFromServerResponse(idTokenResponse);\r\n // Initialize the Firebase Auth user.\r\n const user = new UserImpl({\r\n uid: idTokenResponse.localId,\r\n auth,\r\n stsTokenManager,\r\n isAnonymous\r\n });\r\n // Updates the user info and data and resolves with a user instance.\r\n await _reloadWithoutSaving(user);\r\n return user;\r\n }", "static async _fromIdTokenResponse(auth, idTokenResponse, isAnonymous = false) {\r\n const stsTokenManager = new StsTokenManager();\r\n stsTokenManager.updateFromServerResponse(idTokenResponse);\r\n // Initialize the Firebase Auth user.\r\n const user = new UserImpl({\r\n uid: idTokenResponse.localId,\r\n auth,\r\n stsTokenManager,\r\n isAnonymous\r\n });\r\n // Updates the user info and data and resolves with a user instance.\r\n await _reloadWithoutSaving(user);\r\n return user;\r\n }", "function makeUserToken(json) {\n json = json || {};\n return {\n token: json.token,\n qrCode: json.qr_code,\n userName: json.user,\n accountId: json.account_id,\n isInvite: json.type === enums[\"q\" /* UserTokenTypeEnum */].INVITE,\n isReset: json.type === enums[\"q\" /* UserTokenTypeEnum */].RESET\n };\n}", "getToken() {\n return JSON.parse(localStorage.getItem(TOKEN_KEY));\n }", "function verifyToken(req, res, next){\n\tif(!req.headers.authorization){\n\t\treturn res.status(401).send(\"Unauthorized request\")\n\t}\n\tlet token = req.headers.authorization.split(' ')[1]\n\tif(token === 'null'){\n\t\treturn res.status(401).send(\"Unauthorized request\")\n\t}\n\ttry {\n\t\tlet payload = jwt.verify(token, 'secretKey');\n\t\treq.userId = payload.subject\n\t\tnext();\n\t} \n\tcatch (error) {\n\t\treturn res.status(401).send(\"Unothorized request\")\n\t}\n}", "function currentUserFromToken(req) {\n return decodedToken(req.headers.authorization.split('Bearer ')[1]);\n}", "function verifyToken(req,res,next){\n if(!req.headers.authorization){\n return res.status(401).send('Unauthorized request')\n }\n let token = req.headers.authorization.split(' ')[1]\n if(token==='null'){\n return res.status(401).send('Unauthorized request')\n }\n let payload = jwt.verify(token, 'hotel')\n if(!payload){\n return res.status(401).send('Unauthorized request')\n }\n req.userId = payload.subject\n next()\n}", "function getToken() {\n $.post(appServerUrl + \"/user\", null, (data, status) => {\n console.log(\"got response from /user\", data, status);\n token = data.token;\n initializeSession();\n });\n}", "function decodeToken(token, callback) {\n\n try {\n const payload = jwt.decode(token, settings.secretkey)\n\n // Check if the token has expired.\n const now = moment().unix()\n if (now > payload.exp) {\n // console.log('Token has expired.')\n callback('Token has expired!', null)\n } else {\n callback(null, payload)\n }\n } catch (err) {\n callback(err, null)\n }\n}", "function buildExternalAuthToken(ctx) {\n const header = getAuthHeader(ctx);\n ctx.swatchCtx.logger.warn(`LinkerD auth adapter configured: ${header}`);\n\n const decodedToken = deserializeHeader(ctx, header);\n\n const tokenBody = decodedToken.split(':')[0];\n const tokenInfo = jwt.decode(tokenBody, { complete: true });\n if (!tokenInfo) {\n ctx.swatchCtx.logger.warn('Failed to decode Authorization token. Trying internal auth token strategy.');\n return buildInternalAuthToken(ctx);\n }\n\n // Log the user ID from the valid user token payload\n const userId = getTokenUserId(tokenInfo.payload);\n const userToken = new common.auth.tokens.UserToken(header, userId);\n ctx.swatchCtx.logger.info(`Successfully validated user token: ${userId}`);\n\n return userToken;\n}", "function tokenForUser(id) {\n const ts = new Date().getTime();\n return jwt.encode({\n uid: id,\n ts: ts\n }, keys.secret);\n}", "decode(token) {\n return atob(token);\n }", "function getAuthTokenId() {\n\t return _store2.default.getState().login.getIn(['keystoneAccess', 'token', 'id']);\n\t}", "function decodeToken (token, jwtSecret, options) {\n return new Promise((resolve, reject) => {\n jwt.verify(token, jwtSecret, options, (err, decodedToken) => {\n if (err) {\n return reject(err);\n }\n return resolve(decodedToken);\n });\n });\n}", "function tokenForUser(user) {\n const timestamp = new Date().getTime();\n return jwt.encode({ sub: user.id, iat: timestamp }, process.env.AUTH_SECRET);\n}", "function fetchToken() {\n $.getJSON(buildTokenUrl(), {command: 'request'}, response => {\n token = response.token;\n console.log(`session token fetched: ${token}`);\n });\n}", "function getIdTokenFromRequest(req, res) {\n if (req.headers.authorization && req.headers.authorization.startsWith('Bearer ')) {\n console.log('Found \"Authorization\" header');\n // Read the ID Token from the Authorization header.\n return Promise.resolve(req.headers.authorization.split('Bearer ')[1]);\n }\n return new Promise(resolve => {\n cookieParser(req, res, () => {\n if (req.cookies && req.cookies['__session']) {\n console.log('Found \"__session\" cookie');\n // Read the ID Token from cookie.\n resolve(req.cookies['__session']);\n } else {\n resolve();\n }\n });\n });\n}", "function verifyToken(req, res, next) {\n // Checking for authorization property\n if (!req.headers.authorization){\n return res.status(401).send('Unauthorized request');\n }\n\n // Checking for non-empty token item within authorization property\n let token = req.headers.authorization.split(' ')[1];\n if (token === 'null'){\n return res.status(401).send('Unauthorized request');\n }\n\n // Checking if token's secret key matches\n let payload = jwt.verify(token, 'secretKey');\n if (!payload ){\n return res.status(401).send('Unauthorized request');\n }\n\n // Success Case:\n // - Set userId as payload subject\n userId = payload.subject;\n next();\n\n}", "getToken() {\n\t\treturn this._post(\"/api/user/token\");\n\t}", "async function verifyToken(req, res, next) {\n const authHeader = req.headers.authorization;\n if (authHeader) {\n const token = authHeader.split(' ')[1];\n //console.log(token);\n if (!token) return res.status(403).json({ error: 'Acceso denegado' })\n else {\n admin.auth().verifyIdToken(token)\n .then((decodedToken) => {\n const uid = decodedToken.uid;\n const email = decodedToken.email;\n req.uid = uid;\n // console.log(uid, email);\n next()\n })\n .catch((error) => {\n if (error.code == 'auth/id-token-expired') {\n console.log('expiro token');\n return res.status(401).json({ error: 'Token vencido' });\n }\n console.log(error);\n return res.status(401).json({ error: 'Token no es válido' });\n });\n }\n }\n}", "function decodeJwtComplete(token) {\n var decodedToken = jsonwebtoken_1.decode(token, { complete: true });\n if (decodedToken === null || typeof decodedToken === 'string') {\n throw new Error('JwtError: The given jwt payload does not encode valid JSON.');\n }\n return decodedToken;\n}", "function validateUser(req, res, next) {\n jwt.verify(req.headers['x-access-token'], req.app.get('secretKey'), function(err, decoded) {\n if (err) {\n res.json({status:\"error\", message: err.message, data:null});\n }else{\n // add user id to request\n req.body.userId = decoded.id;\n next();\n }\n });\n \n}", "function parseJwt (token) {\n const base64Url = token.split('.')[1]\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/')\n return JSON.parse(window.atob(base64))\n}", "function buildInternalAuthToken(ctx) {\n const tokenInfo = getInternalTokenInfo(ctx);\n const token = tokenInfo.token;\n\n try {\n // Verify token, which will throw if invalid or expired\n const metadata = jwt.verify(tokenInfo.body, jwtSecret.jwt_secret);\n\n // Getting here means token was verified and did not throw\n const userId = getTokenUserId(metadata);\n const userToken = new common.auth.tokens.UserToken(token, userId);\n ctx.swatchCtx.logger.info(`Successfully validated user token: ${userId}`);\n\n return userToken;\n } catch (error) {\n // Check if the thrown error was an authz error\n if (error === errors.codes.ERROR_CODE_INVALID_AUTHZ) {\n throw errors.codes.ERROR_CODE_INVALID_AUTHZ;\n }\n\n // Token that failed JWT decoding must be a service token\n const serviceId = tokenInfo.body;\n\n const serviceClientContent = `${serviceId}:`;\n const serviceClientSecret = hmhclients[serviceId] || '';\n const generatedHash = crypto.createHmac('sha256', serviceClientSecret)\n .update(serviceClientContent)\n .digest('base64');\n\n if (tokenInfo.hash !== generatedHash) {\n ctx.swatchCtx.logger.warn(`Invalid hash for service token: ${generatedHash}`);\n throw errors.codes.ERROR_CODE_AUTH_INVALID;\n }\n\n ctx.swatchCtx.logger.info(`Successfully validated service token: ${serviceId}`);\n return new common.auth.tokens.ServiceToken(token);\n }\n}", "token(payload, done) {\n User().setToken(payload, done)\n }", "async getToken(user){\n const token = await jwt.sign({id: user.getId(), name: user.getName()}, this.secretKey, {expiresIn: this.expiration});\n return token;\n }", "function tokenForUser(user) {\n const timestamp = new Date().getTime()\n return jwt.encode({ sub: user.id, iat: timestamp }, config.secret);\n}", "function validateUser(req, res, next){\n jwt.verify(req.headers[\"x-access-token\"], req.app.get(\"secretKey\"), function (err, decoded){\n if (err){\n res.json({message: err.message});\n }else{\n req.body.tokenData = decoded;\n next();\n }\n }); \n}", "parseToken(req, res, next){\n const authHeader = req.headers.authorization;\n if(authHeader){\n const token = authHeader.split(' ')[1];\n try{\n req.userToken = jwt.verify(token, jwtSecret);\n next();\n }\n catch(err){\n res.status(403).json({message: 'bad token'});\n }\n }\n else{\n res.status(401).send({message: 'unauthorized'});\n }\n }", "async getToken() {\n try {\n const token = await AsyncStorage.getItem('token');\n console.log(`DEBUG: token found: ${token}`);\n return token;\n } catch (e) {\n console.log(`DEBUG: Failed to get id: ${e}`);\n }\n }", "function getauth(req,res,next){\n const authToken = req.headers[\"authtoken\"];\n jwt.verify(authToken,SECRET_KEY,(err,user)=>{\n if(err){\n res.status(400).send(\"Un Authrised.\")\n }\n else{\n req.userid = user.id;\n next();\n }\n })\n}", "function verifyToken(req, res, next) {\n\n if (!req.headers.authorization) {\n\n return res.status(401).send(\"Unauthorization Request due to token not present\");\n\n }\n let token = req.headers.authorization.split(\" \")[1];\n\n if (token === \"null\") {\n return res.status(401).send(\"Unauthorization Request token is null\");\n }\n\n let payload = jwt.verify(token, 'secretKey');\n\n if (!payload) {\n return res.status(401).send(\"Unauthorization Request payload not there\");\n }\n req.userId = payload.subject\n next();\n}", "function tokenForUser(user) {\n const timestamp = new Date().getTime();\n return jwt.encode({sub: user.id, iat: timestamp}, config.secret)\n}", "obtainToken(context, payload) {\n // get tokens and update user information (payload is username and password)\n axios.post(this.state.endpoints.obtainJWT, payload)\n .then(response => {\n // update\n this.commit('updateToken', response.data);\n // set state information for logged in user\n const token = response.data.access\n if (token) {\n // use jwt_decode library to extract user_id from JWT\n const decoded = jwt_decode(token);\n const user_id = decoded.user_id\n // send user_id next axios call, to pull User info from API\n return axios({\n method: 'get',\n url: `${this.state.endpoints.baseURL}/users/${user_id}`,\n headers: {\n authorization: `Bearer ${response.data.access}`\n }\n })\n } else {\n alert(\"Trying to decode user from access token but no token found!\")\n }\n })\n // set user information\n .then(response => {\n this.commit('setAuthUser', {\n // in Vuex store, add user information retrieved from API\n authUser: {\n user_id: response.data.id,\n username: response.data.username,\n last_login: response.data.last_login,\n first_name: response.data.first_name,\n last_name: response.data.last_name,\n is_active: response.data.is_active,\n date_joined: response.data.date_joined,\n },\n isAuthenticated: true,\n })\n // redirect user to Dashboard\n router.push({name:'home'})\n }).catch((error) => {\n console.log(error);\n alert(\"Error obtaining token and user information\")\n })\n }", "function tokenForUser(user){\n const timestamp = new Date().getTime();\n return jwt.encode({\n sub: user._id,\n iat: timestamp\n }, config.secretString);\n}", "function decodeJwt(token) {\n if (!token) {\n return null;\n }\n const parts = token.split('.');\n const header = JSON.parse(atob(parts[0]));\n const payload = JSON.parse(atob(parts[1]));\n // const signature = atob(parts[2].replace(/_/g, '/').replace(/-/g, '+'));\n\n return {\n header: header,\n payload: payload,\n // signature: signature,\n // raw: { header: parts[0], payload: parts[1], signature: parts[2] },\n };\n}" ]
[ "0.79541045", "0.708371", "0.6994144", "0.695721", "0.67048854", "0.6647926", "0.65618944", "0.6538909", "0.648522", "0.642219", "0.64048713", "0.63971895", "0.63661623", "0.6244745", "0.623192", "0.6223631", "0.6220334", "0.6219588", "0.6217413", "0.6196416", "0.61935705", "0.6188249", "0.611875", "0.60982174", "0.6066056", "0.6064865", "0.6036766", "0.60367274", "0.60313165", "0.6029003", "0.6022044", "0.59742475", "0.595479", "0.5929447", "0.59260607", "0.5920272", "0.5903717", "0.5900372", "0.58921444", "0.5882596", "0.58646524", "0.58607006", "0.58429074", "0.5839742", "0.5833271", "0.58304745", "0.5814717", "0.58002305", "0.57999027", "0.5795854", "0.5795854", "0.5792722", "0.57866657", "0.5784116", "0.57789934", "0.57636374", "0.57475173", "0.57471067", "0.5723063", "0.5722523", "0.5700203", "0.5696808", "0.5696074", "0.56947714", "0.56853586", "0.56853586", "0.56806284", "0.5668563", "0.5660791", "0.5654358", "0.5653594", "0.565196", "0.56481636", "0.5642387", "0.56416273", "0.56242406", "0.5623386", "0.56183654", "0.56130487", "0.5607117", "0.55966586", "0.55865824", "0.5584071", "0.5581794", "0.55800563", "0.5567407", "0.55664176", "0.55611974", "0.55585945", "0.5558579", "0.55583185", "0.5558274", "0.5556371", "0.55554765", "0.55526716", "0.55450535", "0.5544355", "0.5544285", "0.5537747", "0.55367756" ]
0.6945972
4
Checks if we are login if there is a token in our local storage
loggedIn() { const token = this.getToken(); console.log("token:",token) return !(token == undefined); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isLogin() {\n if (localStorage.getItem('token')) {\n hasToken()\n }\n else {\n noToken()\n }\n}", "function checkAuth() {\n if (localStorage.access_token) {\n afterLogin();\n } else {\n loginMenu();\n }\n}", "function isLoggedIn() {\n\n return !!localStorage.getItem('token');\n }", "isLoggedIn() {\n if (typeof localStorage.jwt != 'undefined') {\n try {\n var decoded = jwt.verify(localStorage.jwt, LOGIN_SECRET_KEY);\n return true;\n } catch (err) {\n console.log(err);\n return false;\n }\n }\n return false;\n }", "function checkLogIn() {\n if (localStorage.getItem('token') === null) {\n window.location.href = './login.html';\n }\n}", "static isUserAuthenticated() {\n return localStorage.getItem('token') !== null;\n }", "isAuthenticatedInLocalStorage () {\n return !!localStorage[this.oauthAccessTokenName]\n }", "checkAuth() {\n let sessionJson = localStorage.getItem(SESSION_KEY);\n let session = JSON.parse(sessionJson);\n if (session && session.token) {\n this.authenticated = true;\n } else {\n this.authenticated = false;\n }\n this.updateSession(session);\n }", "function checkLoggedIn() {\n var loggedIn = !!TokenService.getToken();\n return loggedIn;\n }", "function checkToken() {\n chrome.storage.local.get(\"token\", result => {\n var token = result.token;\n if (token != undefined) getUserId(token);\n else window.oauth2.start();\n });\n}", "function checkLoggedIn(){\n\t//find the token\n\tvar tk = readCookie(\"tk\");\n\tif(tk)return true;\n\telse return false;\n}", "static isUserAuthenticated() {\n return localStorage.getItem('token') !== null;\n }", "isLogged(){\n try {\n if(this.token){ //si tiene un token\n //para actualizar el token\n let payload = this.token.split('.')[1]; \n let payloadDecodificado = window.atob(payload);\n let payloadJSON = JSON.parse(payloadDecodificado);\n if(payloadJSON.exp > new Date()/1000){\n return true; \n }else{ \n localStorage.removeItem('token'); \n return false \n } \n } else {\n return false\n } \n //error\n } catch(error){\n localStorage.removeItem('token');\n localStorage.removeItem('role')\n localStorage.removeItem('tokenTeacher');\n return false \n } \n }", "loggedIn () {\n return !!localStorage.token\n }", "loggedIn() {\n return !!localStorage.token;\n }", "loggedIn() {\n return !!localStorage.token;\n }", "function isAuthenticated() {\n return localStorage.getItem(\"token\");\n}", "async function checkIfLoggedIn() {\n // let's see if we're logged in\n const token = localStorage.getItem(\"token\");\n const username = localStorage.getItem(\"username\");\n\n // if there is a token in localStorage, call User.getLoggedInUser\n // to get an instance of User with the right details\n // this is designed to run once, on page load\n currentUser = await User.getLoggedInUser(token, username);\n if (currentUser) {\n await showNavForLoggedInUser();\n }\n await generateStories();\n }", "onLocalLogin() {\n let accessToken = localStorage.getItem('access_token');\n let refreshToken = localStorage.getItem('refresh_token');\n let user = JSON.parse(localStorage.getItem('user'));\n\n if (accessToken && refreshToken && user) {\n this.saveTokens({access_token: accessToken, refresh_token: refreshToken});\n this.loginSuccess(user, true);\n }\n }", "function isLoggedIn() {\n var token = localStorage.getItem('idToken')\n // Check for valid user token in localStorage\n if (!token) {\n return false;\n }\n // Extract jwt expiration from token; check validity\n var encodedPayload = token.split('.')[1];\n var decodedPayload = JSON.parse(atob(encodedPayload));\n var exp = decodedPayload.exp;\n var expirationDate = new Date(exp * 1000);\n\n return new Date() <= expirationDate;\n}", "hasToken() {\n if (\n !window.localStorage.token ||\n window.localStorage.token === 'undefined'\n ) {\n return false\n }\n let token = JSON.parse(window.localStorage.token)\n return token && token.hasOwnProperty('access_token') && token.access_token\n }", "function checkLogin(req,res,next){\n var myToken= localStorage.getItem('myToken');\n try {\n jwt.verify(myToken, 'loginToken');\n } catch(err) {\n res.send (\"you need login to access this page\");\n }\n next();\n}", "static isUserAuthenticated() {\n if (localStorage.getItem('token') === null || localStorage.getItem('token') === false) {\n return false;\n } else { return true }\n }", "async function checkIfLoggedIn() {\n // let's see if we're logged in\n const token = localStorage.getItem(\"token\");\n const username = localStorage.getItem(\"username\");\n\n // if there is a token in localStorage, call User.getLoggedInUser\n // to get an instance of User with the right details\n // this is designed to run once, on page load\n currentUser = await User.getLoggedInUser(token, username);\n await generateStories();\n\n if (currentUser) {\n showNavForLoggedInUser(currentUser);\n }\n }", "function checkIfLoggedIn() {\n if(ls.token && ls.user_id) {\n axios.get(`${process.env.REACT_APP_DB_URL}/users/${ls.user_id}`, {\n headers: {\n authorization: `Bearer ${ls.token}`\n }\n })\n .then((foundUser) => {\n setLoginStatus(true)\n })\n .catch((err) => {\n setLoginStatus(false)\n })\n }\n }", "isAuth() {\n //const t = localStorage.getItem('token');\n const t = sessionStorage.getItem('token')\n return t && t.length > 10;\n }", "async function checkIfLoggedIn() {\n // let's see if we're logged in\n const token = localStorage.getItem(\"token\");\n const username = localStorage.getItem(\"username\");\n\n // if there is a token in localStorage, call User.getLoggedInUser\n // to get an instance of User with the right details\n // this is designed to run once, on page load\n currentUser = await User.getLoggedInUser(token, username);\n await generateStories();\n\n if (currentUser) {\n showNavForLoggedInUser();\n fillUserInfo();\n $userProfile.show();\n }\n else{\n $userProfile.hide();\n }\n }", "function checkUserToken() {\n if (localStorage.getItem('user-token') == null) {\n window.location.replace('index.html');\n return true;\n }\n return false;\n}", "function checkExistingAuth() {\n // const userRecord = configstore.get('user');\n // const tokens = configstore.get('tokens');\n // console.log({ tokens });\n //\n // if (userRecord && tokens) throw new Error('You are alread logged in!');\n\n return true;\n}", "getAuth(){\n let accessToken = localStorage.getItem(\"accessToken\"); \n if(accessToken === '' || accessToken === null)\n return false;\n else\n return true;\n }", "loggedIn() {\n var user = localStorage.getItem('user');\n var isLogged = false;\n /*\n if (user) {\n user = JSON.parse(user);\n if (user.token !== '') {\n isLogged = true;\n }\n }*/\n if (user) {\n isLogged = true;\n }\n return isLogged;\n }", "check() {\n let isLoggedIn = this.Storage.getFromStore('isLoggedIn');\n\n if(isLoggedIn) {\n return true;\n }\n\n return false;\n }", "async function checkIfLoggedIn() {\n // let's see if we're logged in\n const token = localStorage.getItem(\"token\");\n const username = localStorage.getItem(\"username\");\n\n // if there is a token in localStorage, call User.getLoggedInUser\n // to get an instance of User with the right details\n // this is designed to run once, on page load\n currentUser = await User.getLoggedInUser(token, username);\n\n hideElements();\n\n $allStoriesList.removeClass(\"hidden\");\n $loadMore.removeClass(\"hidden\");\n\n await generateStories();\n\n if (currentUser) {\n showNavForLoggedInUser();\n }\n }", "function VerifyAuth() {\n const check_exist_data = JSON.parse(localStorage.getItem('todo_data'));\n if (check_exist_data === null) {\n \treturn false;\n }\n else {\n return check_exist_data.isLoggedIn === true;\n }\n}", "function checkLogin() {\n if (\"ActiveUser\" in localStorage) {\n return true\n } else {\n return false\n }\n}", "function isAuthorized () {\n return !!localStorage.getItem('token');\n}", "function checkLoginStorage() {\n if (localStorage.loginStorage) {\n login = JSON.parse(localStorage.loginStorage);\n }\n}", "loggedIn() {\n return (!!localStorage.uid && !!localStorage.accessToken && !!localStorage.client);\n }", "loggedIn() {\n const token = this.getToken();\n return token ? true : false;\n }", "isLoggedIn() {\n return localStorage.getItem('user') != null\n }", "loggedIn() {\n const token = this.getToken();\n return !!token && !this.isTokenExpired(token);\n }", "loggedIn(){\n console.debug(this.getToken());\n return !!this.getToken();\n //return false;\n }", "loggedIn() {\n\t\tconst token = this.getToken();\n\t\treturn token ? true : false;\n\t}", "function checkAuth() {\n let auth = $cookies.get('authToken');\n if (auth){\n } else {\n $state.go('home');\n }\n }", "function checkAuth() {\n let auth = $cookies.get('authToken');\n if (auth){\n } else {\n $state.go('home');\n }\n }", "isUserLoggedIn() {\n return null !== sessionStorage.getItem('username') && null !== sessionStorage.getItem('accessToken')\n }", "function IsIngelogd() {\n return (localStorage.getItem('user_id') !== null);\n}", "checkToken() {\n this.storage.get(REP_KEY).then(rep => {\n if (rep) {\n this.authenticationState.next(true);\n this.event.publish('repData', rep);\n }\n });\n }", "isTokenValid() {\n let lToken = this.state.token ? this.state.token : localStorage.token,\n expiresIn = this.state.expiresIn ? this.state.expiresIn : localStorage.expiresIn;\n\n //try fetching it from localStorage if empty\n if (!!lToken) {\n //check for expiry\n this.setState({token: localStorage.token, expiresIn: localStorage.expiresIn})\n let timeNow = new Date();\n let lExpiresInDate = new Date(expiresIn);\n //<= 1 minute gap is to fetch new token.\n return lExpiresInDate - timeNow > 60000;\n }\n\n else {\n return false;\n }\n\n }", "checkAuth() {\n let userLoggedIn = false;\n const token = localStorage.getItem('token');\n\n // check if there's a token in storage\n if(token) {\n const reqObj = {\n token: token\n };\n\n fetch(deploymentConfig().apiUrl + '/api/auth/check', {\n method: 'POST',\n body: JSON.stringify(reqObj)\n })\n .then((resp) => resp.json())\n .then(res => {\n if(res.auth) { // authentication is valid\n userLoggedIn = true;\n if(this.state.userLoggedIn !== userLoggedIn) {\n this.setState({userLoggedIn});\n }\n } else { // auth invalid\n localStorage.removeItem('token');\n window.location.hash = deploymentConfig().baseUrl + '#/login';\n }\n });\n } else { // no token = no auth\n if(!document.location.hash.includes('login')) {\n window.location.hash = deploymentConfig().baseUrl + '#/login';\n }\n }\n\n // return value doesn't matter, auth logic is handled within function\n return true;\n }", "userLoggedIn() {\n return !!this.getToken();\n }", "loggedIn() {\n return !!localStorage.auth;\n }", "function isLoggedIn(){\n const token = window.sessionStorage.getItem(\"jwt\");\n const claims = token ? JSON.parse(atob(token.split('.')[1])) : null;\n return (token && claims && moment().isBefore(moment.unix(claims.exp)))\n}", "function storeToken(token){\n try\n {\n LocalStorage.set(Constants.TOKEN,token);\n return true;\n }\n catch(err)\n {\n return false;\n }\n }", "checkSession ({dispatch, state}) {\n state.apiUrl = storeConfig.apiUrl\n\n //logout, force login\n if (state.logout) {\n return true\n }\n //no token, force login\n if (localStorage.getItem(\"token\") === null) {\n return true\n } else {\n dispatch('accountInfo').then((res) => {\n //if no proper response then \"log out\" and force new login\n if (res !== true) {\n localStorage.removeItem(\"token\");\n return true\n }\n })\n dispatch('walletInfo')\n }\n }", "isLoggedTeacher() {\n try {\n if(this.tokenTeacher){ //si tiene un token\n //para actualizar el token\n let payload = this.tokenTeacher.split('.')[1]; \n let payloadDecodificado = window.atob(payload);\n let payloadJSON = JSON.parse(payloadDecodificado);\n if(payloadJSON.exp > new Date()/1000){ \n return true; \n }else{\n localStorage.removeItem('tokenTeacher'); \n return false \n } \n }else {\n return false\n }\n //error \n } catch(err) {\n localStorage.removeItem('token');\n localStorage.removeItem('role')\n localStorage.removeItem('tokenTeacher');\n return false \n }\n }", "async tokenCheck() {\n let token = this.headers.token;\n if (token && this.restnio.options.auth.type == 'jwt') {\n await this.grantPermWithToken(token);\n }\n // Try cached token. On fail, clear the cached token.\n if (!token && this.restnio.options.auth.cookietoken && \n this.restnio.options.auth.type == 'jwt' && this.cookies.token) \n {\n try { // TODO make silent behaviour configurable?\n await this.grantPermWithToken(this.cookies.token);\n } catch (e) {\n // Silently fail and delete the wrong token.\n // Note that an application can override this behaviour\n // by resending a token in the same request.\n this.clearCookie('token');\n }\n }\n }", "isAuthenticated () {\n // Check whether the current time is past the\n // access token's expiry time\n let expiresAt = JSON.parse(localStorage.getItem('expires_at'))\n return console.log(new Date().getTime() < expiresAt)\n }", "isLoggedIn() {\n return !!(getUsername() && getToken());\n }", "checkToken() {\n const bufferTimeSec = 10 * 60 // 10 minutes\n , nowSec = (new Date()).getTime()/1000;\n if (this.accessToken && this.accountId && this.expires && \n (this.expires.getTime()/1000) > (nowSec + bufferTimeSec)) {\n return true\n } else {\n // No longer logged in, but we need the user to login:\n this.accessToken = false;\n this.meToken = false;\n this.appObject.loggedIn = false;\n return false\n }\n }", "async function checkIfLoggedIn() {\n // let's see if we're logged in\n const token = localStorage.getItem(\"token\");\n const username = localStorage.getItem(\"username\");\n\n // if there is a token in localStorage, call User.getLoggedInUser\n // to get an instance of User with the right details\n // this is designed to run once, on page load\n if (token && username){\n currentUser = await User.getLoggedInUser(token, username);\n }\n \n await generateStories(); // generate main story feed\n\n if (currentUser) {\n // if user logged in, show custom logged in components\n showNavForLoggedInUser();\n $submitForm.show();\n await generateFavorites();\n $favoriteArticles.show();\n // updated user information at the bottom of the page\n $(\"#profile-name\").append(currentUser.name);\n $(\"#profile-username\").append(currentUser.username);\n $(\"#profile-account-date\").append(currentUser.createdAt);\n }\n }", "isAuthed() {\n\t\tvar jwtToken = sessionStorage.getItem('jwtToken');\n\n\t\tif (jwtToken !== null) {\n\t\t\treturn wpApi.checkToken(jwtToken)\n\t\t\t.then( (json) => {\n\t\t\t\tif (json.code === 'jwt_auth_valid_token') {\n\t\t\t\t\tconsole.info('SUCCESS: user has a valid token');\n\n\t\t\t\t\tthis.__setAuthedFromSession(jwtToken);\n\n\t\t\t\t\treturn json;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tconsole.error('ERROR: user is NOT authed, token found but invalid');\n\n\t\t\t\t\tthis.logOut();\n\n\t\t\t\t\treturn Promise.reject('ERR user is NOT authed, token found but invalid');\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tthis.logOut();\n\n\t\t\treturn Promise.reject('No token found.');\n\t\t}\n\t}", "verifyLogin() {\n const obj = getFromStorage('the_main_app');\n console.log(\"Obj.token from storage \" + obj.token)\n if (obj && obj.token) {\n fetch('/api/account/verify?token=' + obj.token)\n .then(res => res.json())\n .then(json => {\n if (json.success) {\n this.setState({\n token: obj.token,\n });\n }\n /*This is where everything needed for the page is loaded when a user \n session is found or not found, so this is the time to render something*/\n this.setState({ isAuthenticating: false })\n });\n }\n }", "function alreadyLogged(){\r\n // Try to get another token from the refresh token\r\n if(window.sessionStorage.refreshToken){\r\n try{\r\n refreshToken().then(() => dealWithAlreadyLoggedUser());\r\n }catch(e){ }\r\n }\r\n }", "function isLoggedIn() {\n return (!can.isEmptyObject(userData) && !isEmpty(userData.access_token));\n}", "login(token, cb) {\n localStorage.setItem(\"safe-token\", token);\n cb();\n }", "get isLoggedIn() {\n const user = JSON.parse(localStorage.getItem('user'));\n return (user !== null && user.emailVerified !== false);\n }", "function checkCredentials () {\n var storage = window.localStorage;\n username = storage.getItem(\"username\");\n password = storage.getItem(\"password\");\n\n if (username === null || password === null) {\n showLogin();\n }\n}", "loginchk(){\n const loggedin = localStorage.getItem(\"admin\");\n if (loggedin!=null) {\n console.log(\"admin clocked\");\n pass=JSON.parse(loggedin)[\"pass\"];\n admin=true;\n }\n }", "isLogged()\n {\n if(SessionService.get('token') != null){\n this.authenticated = true;\n return true;\n }else{\n this.authenticated = false;\n return false;\n }\n }", "function security() {\n if(!localStorage.getItem('token')){\n console.log(\"El usuari intentava entrar a la pàgina sense prèviament haver-se registrar o loggejat\");\n window.location.replace(\"../html/index.html\");\n }\n}", "_storedLoginToken() {\n return Meteor._localStorage.getItem(this.LOGIN_TOKEN_KEY);\n }", "isTokenSentToServer() {\n return window.localStorage.getItem('sentToServer') === '1';\n }", "verifyLogin() {\n const obj = getFromStorage('the_main_app');\n console.log(\"Obj.token from storage \" + obj.token)\n if (obj && obj.token) {\n fetch('/api/account/verify?token=' + obj.token)\n .then(res => res.json())\n .then(json => {\n if (json.success) {\n this.setState({\n token: obj.token,\n });\n this.getUserID()\n }\n else {\n //if the user is not logged in, this is when a page should render\n this.setState({ isAuthenticating: false })\n }\n });\n }\n }", "function check() {\n\n // guradamos en una variable local el contenido del localstorage\n var storedName = localStorage.getItem('name');\n var storedPw = localStorage.getItem('pw');\n\n // guardamos los datos que nos proporciona el usuaio al momento del login(no registro)\n var userName = document.getElementById('userName');\n var userPw = document.getElementById('userPw');\n\n //comparamos valores de las variables y damos acceso o lo denegamos \n}", "static authenticateUser(token) {\n localStorage.setItem('token', token);\n }", "static authenticateUser(token) {\n localStorage.setItem('token', token);\n }", "static checkTokenExpiration() {\n var d = new Date();\n var timePassed = d.getTime() - localStorage.getItem('timestamp')\n //Removes token if more than 12 hours have passed since last login (token limit)\n if(timePassed > 12*60*60*1000){\n this.deauthenticateUser();\n }\n }", "function isLogin(setLogin) {\n let status = localStorage.getItem('dem2p5_status');\n if(typeof setLogin != 'function') {\n return false;\n }\n if(!status){\n setLogin(-1);\n }else if(status == 0) {\n setLogin(-1);\n }else if(status == 1) {\n let user = localStorage.getItem('dem2p5_user');\n let password = localStorage.getItem('dem2p5_pwd');\n let type = localStorage.getItem('dem2p5_type');\n if(user && password && type){\n $.ajax({\n type: 'get',\n url: 'http://localhost:3000/' + 'api/signIn',\n data: {\n user,\n password,\n type\n },\n success: function (res) {\n setLogin(res.msg_id)\n },\n error: function () {\n setLogin(-1);\n }\n })\n }else {\n setLogin(-1);\n }\n\n }\n}", "static authenticateUser(token) {\n localStorage.setItem('token', token);\n }", "function isAuthenticate() {\n if (typeof window === 'undefined') {\n return false\n }\n if (sessionStorage.getItem('jwt')) {\n return JSON.parse(sessionStorage.getItem('jwt'))\n }\n return false\n}", "function isUserLoggedIn() {\n let authToken = localStorage.getItem('authToken');\n let username = localStorage.getItem('username');\n if(authToken) {\n $('.not-logged-in').addClass('hidden');\n $('.logged-in').removeClass('hidden');\n $('#login-user').addClass('hidden');\n } else {\n $('.logged-in').addClass('hidden');\n $('.not-logged-in').removeClass('hidden')\n }\n}", "loggedIn() {\n return !!cookie.load('token');\n }", "function authorize() {\n let isAuthenticated = commonService.getFromStorage('token');\n if (!isAuthenticated) {\n commonService.redirect(\"login.html\");\n }\n}", "function tryLogFromStorage() {\n\t\t\tif(Storage.has('token')) {\n\t\t\t\ttoken = Storage.get('token');\n\t\t\t\tuserData = Storage.get('userData');\n\t\t\t}\n\t\t}", "function checkLoginUser(req,res,next){\n var userToken=localStorage.getItem('userToken');\n try {\n if(req.session.userName){\n var decoded = jwt.verify(userToken, 'loginToken');\n }else{\n res.redirect('/');\n }\n } catch(err) {\n res.redirect('/');\n }\n next();\n}", "isLoggedIn() {\n return sessionStorage.getItem('user') != null\n }", "function checkToken(){//checks for a valid token and refreshes if necessary, if one doesn't exist or is expired it will take user back to index.html\n\n if(state.token){//if there is a token, refresh it\n $.ajax({\n url:'/api/auth/refresh/',\n method: 'POST',\n headers:{\n 'Authorization':`Bearer ${state.token}`,\n }\n }).done((res) => {\n localStorage.setItem('authToken', res.authToken);\n state.token = res.authToken;\n })\n .fail(error => {//if we fail to refresh token, redirect to landing page\n window.location.href = \"index.html\";\n localStorage.removeItem('authToken');\n })\n }\n else{//else redirect to landing page\n window.location.href = \"index.html\";\n }\n}", "async function checkForRememberedUser() {\n console.debug(\"checkForRememberedUser\");\n const token = localStorage.getItem(\"token\");\n const username = localStorage.getItem(\"username\");\n if (!token || !username) return false;\n\n // try to log in with these credentials (will be null if login failed)\n currentUser = await User.loginViaStoredCredentials(token, username);\n}", "function requireVerification(nextState, replace) {\nvar userInfo = JSON.parse(localStorage.getItem(\"userInfo\"));\n\nif(userInfo){\nif(userInfo.id){\n console.log(\"This is token \",userInfo.id);\n} \n}else{\n replace({ pathname: \"/login\" });\n \n}\n\n}", "function loadUser(){\n\n let emailInput = document.querySelector(\"#username\").value\n let passwordInput = document.querySelector(\"#password\").value\n\n fetch(\"http://thesi.generalassemb.ly:8080/login\", {\n method : \"post\",\n headers: {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json'\n },\n body: JSON.stringify({\n email: emailInput,\n password : passwordInput\n })\n\n })\n .then(response => {\n return response.json()\n })\n .then((json) => {\n \n let token = json.token\n let username = json.username\n console.log('IM HERE')\n \n if(token!==undefined){\n \n console.log(token)\n localStorage.setItem(\"email\", emailInput)\n localStorage.setItem(\"sessionToken\", token)\n localStorage.setItem(\"username\", username)\n location.reload();\n }\n else{\n \n document.querySelector(\"#incorrect\").style.display = \"inline\"\n \n }\n }) \n\n}", "loggedIn() {\n return !!this.token;\n }", "function checkLogIn() {\n\tif (localStorage[\"mcsa_checkin_firstname\"] != null || localStorage[\"mcsa_checkin_userid\"] != null)\n\t\twindow.location = \"checkin.html\";\n}", "isTokenValid(authKey) {\n const userData = this.app.readDataFile(userFilePath);\n const user = userData.find(item => item.token === authKey);\n\n return !!user;\n }", "function isLoggedIn() {\n return ($localStorage.user) ? $localStorage.user : false;\n }", "function checkAuth(token) {\n // should be a salted hash...\n var tokenCheck = counters.findOne({ token: token}).then((key) => {\n if (!key) {\n return false\n } else {\n return true\n }\n });\n return tokenCheck;\n }", "function isAuthenticated(callback) {\n\n //find whether token exists\n let token = User.getToken();\n //token = undefined if not found\n if(token){\n //check if user data is already stored in session storage\n let user = User.getUser();\n\n //if user and token exists, we expect that the user is logged in\n console.log(User.getUser());\n\n if(user && user.user_id){\n return callback(null, user);\n }\n //if token exists but not user, we send a request to check for a valid token, and store returned user\n get(\"/api/user\", function (err, user) {\n console.log(\"User : \"+user);\n if(err || !user) {\n return callback(err, false);\n }\n User.setUser(user);\n console.log(User.getUser());\n return callback(null, user);\n });\n }\n return callback(null, false)\n}", "function checkLoggedIn() {\n // check if user info exists\n if (localStorage.length == 0) {\n // remove welcome with name\n welcomeArea.textContent = \"\";\n\n // hide logout button\n logoutBtn.style.display = \"none\";\n\n // show login button\n loginBtn.style.display = \"block\";\n } else {\n // get user name from local storage\n var storedName = JSON.parse(localStorage.getItem(\"user\")).name;\n\n // show welcome with name\n welcomeArea.textContent = \"Welcome, \" + storedName;\n\n // hide login button\n loginBtn.style.display = \"none\";\n \n // show logout button\n logoutBtn.style.display = \"block\";\n }\n}", "checkLogin() {\n\t\taxios(`${this.base}/isLoggedIn`, {\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${TokenService.read()}`\n\t\t\t}\n\t\t})\n\t\t\t.then(response => {\n\t\t\t\tconsole.log(`Response: ${JSON.stringify(response.data)}`);\n\t\t\t\tthis.setState({\n\t\t\t\t\tuser: response.data,\n\t\t\t\t\tisAuthed: true\n\t\t\t\t});\n\t\t\t})\n\t\t\t.catch(error => console.log(`Error: ${error}`));\n\t}", "function checkPreAuth() {\r\n console.log(\"checkPreAuth\");\r\n var $form = $(\"#loginForm\");\r\n\r\n if(window.localStorage[\"email\"] != undefined && window.localStorage[\"password\"] != undefined) {\r\n console.log(\"in local storage\");\r\n\r\n $(\"#email\", $form).val(window.localStorage[\"email\"]);\r\n $(\"#password\", $form).val(window.localStorage[\"password\"]);\r\n\r\n // process login\r\n handleLogin();\r\n }\r\n}" ]
[ "0.8702405", "0.7859341", "0.78513086", "0.77677006", "0.7663741", "0.76546997", "0.76365036", "0.7571831", "0.75487036", "0.7541886", "0.75232697", "0.75077194", "0.75023484", "0.7475239", "0.7453794", "0.7453794", "0.74311674", "0.7422961", "0.73715734", "0.73389304", "0.73388004", "0.73264176", "0.731395", "0.7311965", "0.72913", "0.72787106", "0.7277738", "0.72702974", "0.72525996", "0.7243243", "0.72405493", "0.72224617", "0.7204366", "0.7204242", "0.7191078", "0.71826655", "0.7181488", "0.71709335", "0.7149731", "0.7145426", "0.7142051", "0.71373904", "0.71145636", "0.7113278", "0.7113278", "0.7109506", "0.70850646", "0.707718", "0.70679754", "0.7064558", "0.7021181", "0.70143795", "0.70094377", "0.69681126", "0.6957976", "0.694607", "0.69460326", "0.6934592", "0.69235474", "0.6919793", "0.69155663", "0.6914472", "0.6874709", "0.6865402", "0.6865394", "0.685877", "0.68459153", "0.6842063", "0.6819087", "0.6810771", "0.6802444", "0.6786182", "0.6782177", "0.6755656", "0.6749318", "0.6746531", "0.6746531", "0.6743495", "0.6739345", "0.67348933", "0.67114806", "0.6709599", "0.6702486", "0.67010933", "0.66921794", "0.6680686", "0.6669605", "0.6664705", "0.66616416", "0.66610986", "0.6659624", "0.6658685", "0.6654389", "0.6653209", "0.6651232", "0.66457456", "0.6645709", "0.66435426", "0.6640915", "0.6629866" ]
0.76438695
6
properties : data members constructor delecration with properties initalization
constructor(firstName,lastName,age,gender) { this.firstName = firstName; this.lastName = lastName; this.gender = gender; this.age = age; this.showData = function () { console.log("Hello , "+this.firstName +" "+ this.lastName); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(data = {}) {\r\n //super(data);\r\n for (const prop in data) {\r\n this[prop] = data[prop];\r\n }\r\n }", "constructor(data = {}) {\n //super(data);\n for (const prop in data) {\n this[prop] = data[prop];\n }\n }", "constructor() {\n\t this.properties = [];\n\t }", "constructor() {\n // Data / properites / state\n // The difference between the properties and regular\n // variables is that the properies are encapsulated variables.\n this.name = null;\n this.age = null;\n }", "_initializeProperties() {}", "static get properties(){let props={};if(super.properties){props=Object.assign(props,super.properties)}return props}", "function MyConstructor(){\n\t\tthis.prop1 = \"Maxsuel\";\n\t\tthis.prop2 = \"Storch\";\n\t}", "constructor(data = {}) {\n super(data);\n \n this.init(data);\n }", "init (data = {}) {\n for(let key in data){\n this[key] = data[key];\n }\n }", "init (data = {}) {\n for(let key in data){\n this[key] = data[key];\n }\n }", "constructor(props) {\n this.name = props.name;\n this.nationality = props.nationality;\n }", "static get properties(){let props={items:{name:\"items\",type:\"Array\",value:\"[]\",reflectToAttribute:!1,observer:!1},source:{name:\"source\",type:\"String\",value:\"\",reflectToAttribute:!1,observer:!1}};if(super.properties){props=Object.assign(props,super.properties)}return props}", "constructor(props) { //Genero al constructor para inicializar propiedas y variables\n super(props); //Declaramos super para adaptar las propiedades en React\n this.state = { //Declaramos los estados de las propiedades\n prop1: 0,\n prop2: 0,\n prop3: 0\n }; \n }", "init(properties) {\n // basic properties\n this.setOrigin(0.5, 1); // center bottom\n this.setDepth(10);\n\n // physics properties\n this.setCollideWorldBounds(true);\n\n // import custom properties from Tiled\n this.preIngestData();\n this.ingestData(properties);\n this.postIngestData();\n }", "static get properties(){return{}}", "static get properties(){return{}}", "constructor(P_props)\n {\n super (P_props);\n }", "constructor(props) {\n // TODO: add pitch\n super(props);\n this.init();\n }", "init (data = {}) {\n for(let _key in data){\n this[_key] = data[_key];\n }\n }", "constructur() {}", "load(properties) {\n let p = Object.create(null);\n\n Object.keys(properties).forEach(function(v) {\n p[v] = properties[v];\n });\n\n this.properties = p;\n\n return this;\n }", "constructor( data ){\n this._emitter = new EventTarget();\n this._converters = new Map();\n this._dynamicProperties = false;\n this._data = data;\n }", "static get properties() {\n let props = {}\n;\n if (super.properties) {\n props = Object.assign(props, super.properties);\n }\n return props;\n }", "setProperties(data){\n Object.getOwnPropertyNames(this).forEach((property) => {\n if(property !== \"db\"){\n this[property] = data[property];\n }\n });\n }", "init(data) {\r\n this.object = data.object;\r\n }", "constructor(data = {}) {\n Object.assign(this, data)\n }", "constructor(object, property, computed = false, doubtful = false) {\n super();\n\n this.object = object;\n this.property = property;\n this.computed = computed;\n this.doubtful = doubtful;\n }", "constructor(_data = {}) {\n this._data = _data;\n }", "static initialize(obj, propertyId, contractAddress) { \n obj['propertyId'] = propertyId;\n obj['contractAddress'] = contractAddress;\n }", "constructor(x,y){\n this.a = x;\n this.b = y;\n this.#data = y;\n console.log(`Private data = ${this.#data}`);\n }", "constructor(data) {\n const dataKeys = Object.keys(data);\n for (let i = 0; i < dataKeys.length; i++) {\n this[dataKeys[i]] = data[dataKeys[i]];\n }\n }", "constructor() {\n\t\tproperties.set(this, Object.setPrototypeOf({}, null));\n\t}", "constructor() {\n super();\n this.data = new Data();\n }", "static get properties() {\n return { ...super.properties\n };\n }", "function MyCustom(){\nthis.property1 = \"something\";\n}", "static get props () {\n return assign({}, super.props, this[$ctorProps]);\n }", "_applyInstanceProperties() {\n for (const [p, v] of this._instanceProperties) {\n this[p] = v;\n }\n this._instanceProperties = undefined;\n }", "static get props () {\n return assign({}, super.props, this[ctorProps]);\n }", "static getNewProperties() {\n return {};\n }", "constructor(props) {\n\t\tsuper(props);\n\t}", "constructor(props) {\n\t\tsuper(props);\n\t}", "static get properties() {\n return {\n ...super.properties,\n };\n }", "static get properties() {\n return {\n ...super.properties,\n };\n }", "static get properties() {\n return {\n ...super.properties,\n };\n }", "constructor(props){\n\t\tsuper(props);\n\n\t}", "constructor(props) {\n // Call the parent constructor with the props object we automatically get\n super(props);\n }", "constructor(props) {\n super(props)\n this.cuisine = props.cuisine\n this.type = props.type\n }", "setProperties(properties) {\n Object.assign(this, properties);\n }", "setProperties(properties) {\n Object.assign(this, properties);\n }", "function init() {\n for (var k in PROPERTY) {\n var p = PROPERTY[k];\n PROPERTY_DECODE[p[0]] = [ k, p[1], p[2] ];\n }\n}", "constructor(props){\r\n\t\tsuper(props);\r\n\t}", "static get properties() {\n return {\n \"cityProp\": {\n \"name\": \"cityProp\",\n \"type\": \"String\",\n \"value\": \" \",\n \"reflect\": true,\n \"attribute\": true,\n \"observer\": false\n },\n \"inputId\": {\n \"name\": \"inputId\",\n \"type\": \"String\",\n \"value\": \" \",\n \"reflectToAttribute\": false,\n \"observer\": false\n },\n \"width\": {\n \"name\": \"width\",\n \"type\": \"String\",\n \"value\": \" \",\n \"reflectToAttribute\": false,\n \"observer\": false\n }\n}\n;\n }", "loadOwnProperties(){\r\n \t\t\r\n\t}", "constructor(props){\n\t super(props); //you have to add super \n\t console.log(\"[Person.js] Inside Constructor \", props);\n\t}", "_applyInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // tslint:disable-next-line:no-any\n this._instanceProperties.forEach((v, p) => this[p] = v);\n this._instanceProperties = undefined;\n }", "_applyInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // tslint:disable-next-line:no-any\n this._instanceProperties.forEach((v, p) => this[p] = v);\n this._instanceProperties = undefined;\n }", "_applyInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // tslint:disable-next-line:no-any\n this._instanceProperties.forEach((v, p) => this[p] = v);\n this._instanceProperties = undefined;\n }", "static get properties() {\n let props = {\n title: {\n name: \"title\",\n type: String,\n value: \"\",\n reflectToAttribute: false,\n observer: false\n },\n subtitle: {\n name: \"subtitle\",\n type: String,\n value: \"\",\n reflectToAttribute: false,\n observer: false\n },\n source: {\n name: \"source\",\n type: String,\n value: \"\",\n reflectToAttribute: false,\n observer: false\n }\n };\n if (super.properties) {\n props = Object.assign(props, super.properties);\n }\n return props;\n }", "constructor(data) {\n \n }", "constructor() {\n this.data = {};\n }", "constructor() {\n this.data = {};\n }", "constructor(props) {\n super(props);\n // TODO\n }", "constructor(props) {\n super(props);\n // TODO\n }", "__previnit(){}", "initialize(data) {\n this.$exists = false;\n this.$changed = {};\n this.$attributes = {};\n this.fill(data);\n this.$initialized = true;\n\n return this;\n }", "constructor(data) { }", "function Properties (prop) {\n this.prop = prop;\n this.addProp = function (name, value) {\n this[name] = value;\n }\n}", "constructor(props = {}) {\n super();\n this.props = props;\n }", "constructor(options, ...args){\n super(options, ...args);\n this.data = options ? options.data : undefined;\n }", "static get properties() {\n return { ...super.properties };\n }", "constructor(props) {\n super(props);\n //@TODO\n }", "constructor(props = {}) {\n this.props = props\n }", "constructor(name, nr, cost){ // call the properties\r\n super(name, nr) // now to use the properties\r\n this.cost = cost\r\n }", "constructor() {\n this.age = 0;\n this.color = 'pink';\n this.food = 'jelly';\n }", "loadOwnProperties(){\r\n//\t\tdebugger;\r\n\t\tvar self=this;\r\n//\t\tself.autoAddPostHtml=false;\r\n\t\tself.name=self.getAttrVal(\"name\");\r\n\t\tself.nameRest=self.getAttrVal(\"nameRest\");\r\n\t\tself.type=self.getAttrVal(\"type\");\r\n//\t\tself.where=self.getAttrVal(\"where\",undefined,false);\r\n\t\tself.innerVarName=self.getAttrVal(\"as\",undefined,false);\r\n\t\tself.resultVarName=self.getAttrVal(\"resultvarname\");\r\n\t\tself.restVarName=self.getAttrVal(\"restvarname\");\r\n\t\t\r\n\t\tself.bWithRest=false;\r\n\t\tself.hsResult;\r\n\t\tself.hsRest;\r\n\t\t\r\n\t\tself.recursiveField=self.getAttrVal(\"recursivefield\",undefined,false);\r\n\t\t\r\n\t\tself.source=self.getAttrVal(\"source\");\r\n\t\tself.sourceJson=self.getAttrVal(\"sourcejson\");\r\n\t\tself.sourceJS=self.getAttrVal(\"sourcejs\",undefined,false);\r\n\t\tself.sourceFormula=self.getAttrVal(\"sourceformula\",undefined,false);\r\n\t\t\r\n\t\tself.whereCondition=self.getAttrVal(\"where\",undefined,false);\r\n\t\tself.orderFormula=self.getAttrVal(\"order\",undefined,false);\r\n\t\tself.boundStartAt=self.getAttrVal(\"start\",undefined,false);\r\n\t\tself.boundLimit=self.getAttrVal(\"limit\",undefined,false);\r\n\t}", "constructor(props){\n //used to receive props and apply them to the appripriate location\n super(props)\n }", "function _construct()\n\t\t{;\n\t\t}", "constructor(props) {\n\t\t// when we define a method that's already defined on the parent class, we can call it by calling super\n\t\tsuper(props);\n\t\t// initialize state and pass the property we want to record changes on\n\t\tthis.state = { term: ''};\n\t}", "constructor(map:WeakMap):void {\n\n\t\tsuper(map);\n\n\t\t//this.constructor.properties.statistics = new this.constructor.properties.statistics();\n\n }", "constructor(data) {\n super(data);\n }", "static initialize(obj, unit, fast, slow, standard) { \n obj['unit'] = unit;\n obj['fast'] = fast;\n obj['slow'] = slow;\n obj['standard'] = standard;\n }", "constructor () {\n this.data = {}\n }", "constructor(props) {\n super(props);\n\n this.initFields = () => {return {username:'', fullname:'', password:'', password2:'', email:'', about:''}};\n this.state.fields = this.initFields();\n\n this.read();\n }", "constructor(title, author, text) {\n ///Prop for Title\n this.props = {};\n ///Prop for Author\n this.props.author = author;\n ///Prop for Text\n this.props.content = text;\n }", "static $new(data) {\n\t\tvar className = this;\n\t\tvar instance = new className();\n\t\tvar defaultProps = className.$properties();\n\t\t// bind data\n\t\tif(_.isPlainObject(defaultProps)){\n\t\t\tvar propNames = Object.getOwnPropertyNames(defaultProps);\n\t\t\tfor(let propName of propNames) {\n\t\t\t\tvar propVal\n\t\t\t\tif(_.isPlainObject(data) && data[propName] !== undefined){\n\t\t\t\t\tpropVal = data[propName];\n\t\t\t\t} else if(typeof defaultProps[propName] === 'function'){\n\t\t\t\t\tpropVal = defaultProps[propName].apply(instance, [data]);\n\t\t\t\t} else {\n\t\t\t\t\tpropVal = defaultProps[propName];\n\t\t\t\t}\n\t\t\t\tinstance[propName] = propVal;\n\t\t\t}\n\t\t}\n\t\t// Object.seal(instance)\n\t\treturn instance;\n\t}", "init() {\n this._super(...arguments);\n this._applyDefaults();\n }", "constructor(name = \"cat\", age = 1, color = 'mixed') {\n // whatever is left of the '.' at call time / when accessed\n this.name = name\n this.age = age\n this.color = color\n }", "bind(data){\n\t\tvar propNames = Object.getOwnPropertyNames(this);\n\t\tfor(let propName of propNames) {\n\t\t\tif(data[propName] !== undefined){\n\t\t\t\tthis[propName] = data[propName];\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}", "constructor() { //this literally makes shit\n super() //this will take then take the props from Car and allow the ability to add more props to be called \n // later on from the Ford class that are added onto the Car class in this instance of Car (Ford class)\n\n this.windows = 4; // this takes the props from Car and adds onto them \n }", "constructor(data){ \n this.data = data;\n }", "function _ctor() {\n\t}", "constructor(props)\n {\n super(props)\n\n }", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "constructor(){}", "initialize () {\n this.propsData = {\n campaignHandle: null,\n currentLevel: null,\n capstoneStage: null,\n courseId: null,\n courseInstanceId: null,\n goToNextDirectly: null,\n showShareModal: null,\n supermodel: null\n }\n }", "constructor() {\r\n this.id= 0;//though this is a constuctor and a constructor is a function, it's of Class, not of Object, thus use \";\", not using \",\" between the properties\r\n this.type = 'unknown';\r\n }" ]
[ "0.73879063", "0.736205", "0.7156407", "0.70146096", "0.6884535", "0.67686105", "0.67516774", "0.6685522", "0.6611033", "0.6611033", "0.65074795", "0.65044653", "0.64681613", "0.64402443", "0.6401385", "0.6401385", "0.63734305", "0.6346693", "0.6298682", "0.6292652", "0.62889445", "0.6254754", "0.6252205", "0.6247656", "0.62414086", "0.62384856", "0.62247485", "0.6215749", "0.6215686", "0.6189327", "0.6185398", "0.61813045", "0.6165771", "0.6156347", "0.6153646", "0.6134235", "0.61249024", "0.6124802", "0.6123861", "0.612131", "0.612131", "0.6117609", "0.6117609", "0.6117609", "0.61165047", "0.6114831", "0.6113019", "0.6102109", "0.6102109", "0.60945857", "0.6091446", "0.6081604", "0.6078081", "0.6072899", "0.6039767", "0.6039767", "0.6039767", "0.6038946", "0.6032595", "0.6029444", "0.6029444", "0.6028432", "0.6028432", "0.6023512", "0.60180116", "0.6009814", "0.59832317", "0.59710574", "0.5968254", "0.5967401", "0.59657925", "0.59535766", "0.59399533", "0.5936004", "0.5924015", "0.59238863", "0.5920635", "0.591553", "0.5907775", "0.5897504", "0.58915955", "0.5891345", "0.5889527", "0.5878018", "0.5875924", "0.5861503", "0.58605385", "0.58545977", "0.5842019", "0.58359796", "0.5834128", "0.58289254", "0.58226573", "0.58226573", "0.58226573", "0.58226573", "0.58226573", "0.58226573", "0.58226573", "0.5811322", "0.5807291" ]
0.0
-1
methods : logic : memmber function
calcRetirement(){ if(this.age > 40) { return "You are retired !"; } return `You have ${40-this.age} more year to get retired !` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function miFuncion (){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function Maisons(){\n \n }", "setFromMorph(morph) {\n//-----------\nthis.fourCCName = morph.getName();\nreturn this.amount = morph.getAmount();\n}", "function M(){}", "function MedFesEstimator() {\n}", "man() {\n console.log('Grammaire de la machine de Peano :');\n this.expression.man();\n this.definition.man();\n }", "private public function m246() {}", "function fm(){}", "static private internal function m121() {}", "function Mobilmodern(nama,tahun_keluar){\n let mobil = Object.create(methodMobil) //* Terbaca sebagai Prototype di console log, inilah yang akan jadi cikal bakal class pada javascript\n mobil.nama = nama, \n mobil.tahun_keluar = tahun_keluar,\n mobil.bensin = 100\n\n return mobil\n}", "function Manusia(nama,umur){\n let manusia = {}; //* inisiasi objek biar nanti diisi\n manusia.nama = nama; //* menambahkan properti objek manusia dengan simbol (.) dan assign (=) dari parameter\n manusia.umur = umur;\n manusia.energi = 0; //* menambahkan properti objek manusia bukan dari parameter\n\n manusia.makan = function(porsi){ //* membuat method makan untuk manusia\n this.energi += porsi \n return this.nama + \" telah makan sebanyak \" + porsi\n }\n\n return manusia //* mereturn objek yang sudah diisi\n}", "efficacitePompes(){\n\n }", "function mi(t,e){0}", "function calculate(){}", "function mostraNotas(){}", "function calculaMEdiana(lista){\n\n\nconst ordenarlist= ordenarListaMe1(lista);\nconst mitadLista1 = parseInt(ordenarlist.length/2);\n\n\nfunction esPar(numerito){\n if (numerito%2 === 0){\n return true;\n }else{\n return false;\n }\n}\n\nlet mediana;\n\n\nif (esPar(ordenarlist.length)){\n const elemento1 =lista1[mitadLista1-1] ;\n const elemento2 = lista1[mitadLista1];\n const promedio1y2 = calcularMediaAritmetica([elemento1,elemento2]);\n mediana = promedio1y2\n}else{\n mediana = lista1[mitadLista1];\n}\n\nreturn mediana;\n}", "function decideMineFunc(avid){\n\tvar mineVal = $(\"#paraMine\").val();\n\t\tif(mineVal==1){\n\t\t\tsubtractMine(avid);\n\t\t}else{\n\t\t\tplusMine(avid);\n\t\t}\n\t}", "function Maybach(){\n \n}", "calc(){\n this.fieldArr.forEach((element) => {\n this.score = this.score+element.score;\n element.score = 0;\n })\n let affected = this.affectedArr;\n this.affectedArr =[];\n affected.forEach((element) => {\n this.fieldArr[element].calcField(this.fieldArr, affected) \n })\n this.scoreTextVal.setText(\"\"+this.score) \n\n let startNew = true; \n this.fieldArr.forEach((element) => {\n (element.value==1)?(startNew=false):null\n \n })\n if(startNew){\n this.msgTextVal.setText(\"\"+this.score)\n this.add.tween({\n targets: [this.msgBckg, this.msgText, this.msgTextVal, this.msgButton],\n duration :1000,\n y : \"+=1000\",\n ease:\"Linear\",\n \n })\n }\n \n }", "evaluateMsg(msg, checkPrefix = true, check, mutator) {\n if (msg.author.username == this.client.user.username)\n return { value: null, reason: \"msg author is the same as bot\" };\n if (checkPrefix && !msg.content.includes(this.PREFIX))\n return { value: null, reason: \"msg does not include the set prefix\" };\n if (checkPrefix && !msg.content.startsWith(this.PREFIX))\n return { value: null, reason: \"msg does not start with correct prefix\" };\n if (check && typeof check == \"function\") {\n let c = check(msg);\n if (typeof check == \"undefined\" || c === false)\n return { value: undefined, reason: \"didnt pass given check\", extra: check };\n }\n if (mutator && typeof mutator == \"function\")\n msg.content = mutator(msg);\n const content = Machina.subCommandMiddleware(checkPrefix ? msg.content.substring(this.PREFIX.length) : msg.content);\n let reasons = [];\n let commands = this.commands.filter(mF => mF.monikers.includes(content.split(\" \")[0]));\n let available = commands.filter(c => { let r = Machina.isAuthorized(msg, c); if (!r.value)\n reasons.push(r.extra); return r.value; });\n let previousAvailable = available;\n available.filter(mF => { let y = !mF.selfPermissions || msg.guild.me.permissionsIn(msg.channel).has(mF.selfPermissions); if (!y)\n reasons.push(\"bot doesnt have permission\"); return y; });\n // console.log(content, commands, available)\n if (commands.length <= 0)\n return { value: undefined, reason: \"no commands available\", extra: content };\n else if (available.length <= 0 && reasons[reasons.length - 1] == \"bot doesnt have permission\")\n return { value: undefined, reason: \"bot permission check failed\", extra: previousAvailable[0].selfPermissions };\n else if (available.length <= 0)\n return { value: undefined, reason: \"permission check failed\", extra: reasons.sort((a, b) => a.length - b.length).pop() }; // sorry, you dont have permissions: here is the longest log \n else if (available.length == 1)\n return { value: available[0], reason: \"permission check passed\" };\n else\n return { value: available, reason: \"permission check passed multiple\" };\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 m(a,b,c){this.a=a;this.b=b||1;this.f=c||1}", "function comportement (){\n\t }", "static autoMorph ( meshName, fullAttribute ) { \n\n\t\tlet m, name, tName, target, id, g;\n\n\t\t// get mesh list\n\t\tlet meshs = Pool.getMesh( meshName );\n\n\t\t\n\t\tfor( let n in meshs ){\n\n\t\t\tm = meshs[n];\n\t\t\tname = m.name;\n\n\t\t\tif( name.search(\"__morph__\") !== -1 ) {\n\n\t\t\t\ttarget = meshs[ name.substring( 0, name.indexOf('__') ) ];\n\t\t\t\ttName = name.substring( name.lastIndexOf('__') + 2 );\n\n\t\t\t\t\n\n\t\t\t\t// apply Morph\n\n\t\t\t\tif( target ){\n\n\t\t\t\t\tif( !target.userData.morph ){\n\t\t\t\t\t\ttarget.userData['morph'] = {};\n\t\t\t\t\t\ttarget.material.morphTargets = true;\n\t\t\t\t\t}\n\n\t\t\t\t\tg = target.geometry;\n\n\t\t\t\t\t//console.log( g.attributes.position.count, m.geometry.attributes.position.count )\n\n\t\t\t\t\tif( g.attributes.position.count === m.geometry.attributes.position.count ){\n\n\t\t\t\t\t\tif( !g.morphAttributes.position ) g.morphAttributes.position = [];\n\t\t\t\t\t\tid = g.morphAttributes.position.length;\n\t\t\t\t\t\tg.morphAttributes.position.push( m.geometry.attributes.position );\n\n\t\t\t\t\t\t// extra attribute\n\n\t\t\t\t\t\tif( fullAttribute ){\n\n\t\t\t\t\t\t\tfor( let a in m.geometry.attributes ){\n\t\t\t\t\t\t\t\tif( a !== 'position' && g.attributes[a] ){\n\t\t\t\t\t\t\t\t\tif( !g.morphAttributes[a] ) g.morphAttributes[a] = [];\n\t\t\t\t\t\t\t\t\tg.morphAttributes[a][id] = m.geometry.attributes[a];\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}\n\n\t\t\t\t\t\t// clear morph mesh\n\t\t\t\t\t m.parent.remove( m );\n\t\t\t\t\t m.material.dispose();\n\t\t\t\t\t\tm.geometry.dispose();\n\n\t\t\t\t\t\t// update target\n\t\t\t\t\t\ttarget.updateMorphTargets();\n\n\t\t\t\t\t\t// add morph reference by name\n\t\t\t\t\t\ttarget.userData.morph[ tName ] = id;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn('this morph target is not good : ', tName)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\n\t}", "getMetresToInternal() {\nreturn this.scaleFromMetres;\n}", "function getvals(mot) {\n// let v = mot.call('stat',null, (data, opt) => { console.log(\"call: \",JSON.stringify(data),typeof opt==='undefined'?\"\":opt); });\nlet v1 = mot.stat((data) => { \n //console.log(\"stat: \",JSON.stringify(data)); \n});\nlet v2 = mot.pos((data) => { \n //console.log(\"stat: \",JSON.stringify(data)); \n});\n}", "private internal function m248() {}", "function runOnMOM() {\n return true;\n}", "function functPerim(){\n\n let longVal = parseFloat(long.value);\n const unitLongVal = unitLong.value;\n let largVal = parseFloat(larg.value);\n const unitLargVal = unitLarg.value;\n let def = false ;\n\n // const UNIT = {\"mm\":1000, \"cm\":100, \"dm\":10, \"m\":1};\n\n if (isNaN(longVal) || longVal <= 0 || isNaN(largVal) || largVal <= 0) {\n resultPerim.innerHTML = \"Veuillez rentrer une longueur et une largeur positive !\";\n } else {\n\n\n switch (unitLongVal) {\n case \"mm\":\n longVal /= 1000;\n break;\n case \"cm\":\n longVal /= 100;\n break;\n case \"dm\":\n longVal /= 10;\n break;\n case \"m\":\n longVal /= 1;\n break;\n default:\n def = true ;\n resultPerim.innerHTML = \"Veuillez rentrer une unité de longueur acceptable (\" + unitLongVal + \") !\";\n break;\n }\n\n switch (unitLargVal) {\n case \"mm\":\n largVal /= 1000;\n break;\n case \"cm\":\n largVal /= 100;\n break;\n case \"dm\":\n largVal /= 10;\n break;\n case \"m\":\n largVal /= 1;\n break;\n default:\n def = true ;\n resultPerim.innerHTML = \"Veuillez rentrer une unité de largeur acceptable (\" + unitLargVal + \") !\";\n break;\n } \n\n if( def === false){\n resultPerim.innerHTML = \"Le perimetre d'un surface de coté \" + longVal + unitLongVal + \" x \" + largVal + unitLargVal + \" est de \" + ((parseFloat(longVal) + parseFloat(largVal)) * 2).toFixed(2) + \" m \";\n }\n }\n\n}", "function m(e,n){this.fun=e,this.array=n}", "get mains() {}", "transient protected internal function m189() {}", "get m00(){ return this.data[ 0]; }", "function hasMutation(matriz) { // este debe de ir porque es un requerimiento, viene n las instrucciones\n // bandera que validara si detecta mutacion\n let flag = true;\n // Recorremos el arreglo de manera horizontal\n matriz.forEach(adn => {\n // aqui validamos la cadena y guardamos el resultado en el modelo \n flag = this.validateADN(adn); // si en algun momento regresa una cadena incorrecta regresara false\n console.log(adn);\n console.log(flag);\n });\n\n let vertical = this.getVert(matriz);\n vertical.forEach(adn => {\n // aqui validamos la cadena y guardamos el resultado en el modelo \n flag = this.validateADN(adn); // si en algun momento regresa una cadena incorrecta regresara false\n console.log(adn);\n console.log(flag);\n });\n return flag;\n}", "_uiPropertyMortgaged (data) {\n this.uiService.propertyMortgaged(data.squares);\n\n // mark each square as mortgaged\n data.squares.forEach(squareId => {\n this.mapData.squares[squareId].isMortgaged = true\n })\n\n // add funds from mortgaging to player\n\t\tthis.playersData[data.playerId].addFunds(data.cash);\n\n this.uiService.updatePlayerList({\n name: data.playerId,\n cash: this.playersData[data.playerId].getCurrentCash(),\n squares: this.playersData[data.playerId].getCurrentSquares()\n });\n }", "function MO(t){return t=Object(ro[\"c\"])(t,1),t>1?2:1}", "function bottomDischargeCalculations(){\r\n\t//1. Assign 0 if input left blank\r\n\tvar assign_zero = [$bottomSpoutDiameter, $bottomSpoutLength];\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[$bottomSpoutDiameter, $bottomSpoutLength];\r\n}", "function medicareCalc() {\n // Calculations for standard medicare tax.\n result.projected.fica.medicare = result.householdGross * federal.fica.medicareTax;\n\n // Calculationsfor additional medicare tax.\n var threshold = getVar(federal.fica.additionalMedicareLiability);\n if (result.householdGross > threshold) {\n result.projected.fica.addlMedicare = ( (result.householdGross - threshold) * federal.fica.additionalMedicareTax );\n } else {\n result.projected.fica.addlMedicare = 0;\n }\n }", "mercuryExpect() {\n if (this.sex === \"male\") {\n this.mercExpect = Math.round(this.male / this.mercNum);\n }\n if(this.sex === \"female\"){\n this.mercExpect = Math.round(this.female / this.mercNum);\n }\n }", "function Mosaic(){\n var self = this;\n self.name= ko.revertibleObservable().extend({ required: true });\n self.description= ko.revertibleObservable().extend({ required: true });\n self.target= {\n name : {\n givenName : ko.revertibleObservable().extend({ required: true }),\n familyName : ko.revertibleObservable().extend({ required: true })\n },\n emails: [{\n value:ko.revertibleObservable().extend({\n required: true,\n email: true\n })\n }]\n };\n self.errorMessage = ko.observable();\n self.commitAll = function() {\n self.name.commit();\n self.description.commit();\n self.target.name.givenName.commit();\n self.target.name.familyName.commit();\n self.target.emails[0].value.commit();\n };\n self.resetAll = function() {\n self.name.reset();\n self.description.reset();\n self.target.name.givenName.reset();\n self.target.name.familyName.reset();\n self.target.emails[0].value.reset();\n };\n\n self.isValid = function() {\n return self.name.isValid() &&\n self.description.isValid() &&\n self.target.name.givenName.isValid() &&\n self.target.name.familyName.isValid() &&\n self.target.emails[0].value.isValid();\n };\n\n }", "function b(M,e){0}", "function Macex() {\r\n}", "protected internal function m252() {}", "calculate() {\n let age = inputsRequired[0].elem.value;\n let height = inputsRequired[1].elem.value;\n let weight = inputsRequired[2].elem.value;\n let neckCircumference = inputsRequired[3].elem.value;\n let waistCircumference = inputsRequired[4].elem.value;\n let hipCircumference = inputsRequired[5].elem?.value;\n \n let person = new Person();\n \n let feetToCMFactor = 30.48; // *\n let poundsToKGFactor = 2.205; // /\n let inchesToCMFactor = 2.54; // *\n \n person.age = age;\n person.height = height;\n person.weight = weight;\n person.neckCircumference = neckCircumference;\n person.waistCircumference = waistCircumference;\n person.hipCircumference = hipCircumference;\n\n if(this.unit === 1) {\n person.height = height * feetToCMFactor;\n person.weight = weight / poundsToKGFactor;\n person.neckCircumference = neckCircumference * inchesToCMFactor;\n person.waistCircumference = waistCircumference * inchesToCMFactor;\n person.hipCircumference = hipCircumference * inchesToCMFactor;\n }\n \n if(this.gender === 'male') {\n person.gender = 0;\n } else if(this.gender === 'female') {\n person.gender = 1;\n }\n \n let bodyMassIndex = person.findBMI();\n let bodyFatPercentage = person.findBodyFatPercentage();\n let dailyCalorieIntake = person.findDailyCalorieIntake();\n let bmr = person.findBMR(dailyCalorieIntake);\n let activityLevelBmr = bmr * activityLevel.find(lvl => lvl.name === this.activityLevelDetails).value;\n \n function valueFromPercentage(v, p) {\n return ((v * p) / 100);\n }\n \n let calorieBasedOnGoal = activityLevelBmr - workoutGoal.find(goal => goal.name === this.workoutGoalChoosen).execute(activityLevelBmr);\n let macroValuesBasedOnGoal = macroForWorkoutGoal.find(goal => goal.name === this.workoutGoalChoosen);\n let carb = Math.round(valueFromPercentage(calorieBasedOnGoal, macroValuesBasedOnGoal.carb)/4);\n let protein = Math.round(valueFromPercentage(calorieBasedOnGoal, macroValuesBasedOnGoal.protein)/4);\n let fat = Math.round(valueFromPercentage(calorieBasedOnGoal, macroValuesBasedOnGoal.fat)/9);\n \n this.renderOutput(\n bodyMassIndex,\n bodyFatPercentage,\n dailyCalorieIntake,\n activityLevelBmr,\n carb,\n protein,\n fat\n );\n }", "getMall() {\n return this.mall;\n }", "function fun1(){} //toda a função de js retorna alguma coisa", "function m(e,t){this.fun=e,this.array=t}", "function verifMangerPomme() {\n if (xPomme == xSerp && yPomme == ySerp) {\n initPositionPomme();\n tempsPomme = 0;\n score += 10 + 3*bodySerp.length;\n niveau += Math.trunc(score/300);\n tailleBody +=5;\n afficheScore();\n }else if (tempsPomme++ > tempsMaxPomme) {\n initPositionPomme();\n tempsPomme = 0;\n }\n }", "function runOnMOM() \n{\n\treturn false;\n}", "switchIlumination() {\n\n if (!this.typeBasic)\n //colocamos o material (Phong ou Lambert) como sendo Basic\n this.material = this.materials[0];\n\n else\n //colocamos o material Basic como sendo o anterior a ser mudado para Basic\n this.material = this.materials[this.currMaterial];\n\n this.typeBasic = !this.typeBasic;\n }", "function reaction() {\n input(); // Aceptar valores ingresados ​​(posiblemente corregidos)\n calculation(); // cálculos\n}", "function calcularMejorEquipo() {\n const equipos = [\n new Equipo('Maria', [62, 34, 55]),\n new Equipo('Paula', [35, 60, 59]),\n new Equipo('Rebeca', [40, 39, 63])\n ];\n\n for (let i = 0; i < equipos.length; i++) {\n equipos[i].media = calcularMedia(equipos[i].resultados);\n }\n\n let mediaMasAlta = obtenerMediaMasAlta(equipos);\n console.log(\n `El equipo con la media más alta es el equipo ${obtenerEquipo(\n equipos,\n mediaMasAlta\n )} con una media de ${mediaMasAlta}`\n );\n}", "static transient private public function m56() {}", "static private protected internal function m118() {}", "static protected internal function m125() {}", "function behaviorFunction(){\n return \"MM_findObj,MM_validateForm\";\n}", "updateLogic(t) {}", "function MakeComplex() {\r\n}", "function Ma(e,t,n,i){Ca.call(this,e,t,n,i)}", "FindMeter(clave) {\n this.limpiar();\n let conteo = 0;\n this.initMedidor();\n this.initRegistro();\n if (this.medidores) {\n for (let index = 0; index < this.medidores.length; index++) {\n const element = this.medidores[index];\n console.log(clave, '==', element.clave);\n if (clave == element.clave) {\n this.medidor = element;\n this.meterId = element._id;\n this.registro.meter = element._id;\n // this.loadRegisters(this.medidor._id);\n this.tarifa = element.rate;\n if (this.tarifa.percent_cost == true) {\n let costo;\n costo = this.extras[0].rmuv * (this.tarifa.base / 100);\n this.registro.base = costo;\n }\n else if (this.tarifa.percent_cost == false) {\n this.registro.base = this.tarifa.base;\n }\n console.log('dentro de find meter, Registro: ', this.registro, '. tarifa: ', this.tarifa);\n this.initLimits(this.tarifa._id);\n this.clave_medidor = element.clave;\n conteo++;\n this.loadRegisters(this.medidor._id);\n }\n }\n if (conteo === 1) {\n this.encontrado = true;\n this.launchAlert('success', 'Medidor Encontrado', null, null, false, 1500, false, 'top-end', 'row', true);\n }\n else if (conteo === 0 && clave.length > 5) {\n this.encontrado = false;\n this.launchAlert('error', 'Medidor Incorrecto', null, null, false, 1500, false, 'top-end', 'row', true);\n }\n else if (conteo === 0 && clave.length < 6) {\n this.encontrado = null;\n }\n }\n }", "calculate(modify) {\n return this.total = [].slice.call(arguments, 1)\n .reduce((total, y) => modify(total, y), this.total);\n }", "_mining(){\n return false;\n }", "function calcMetaData(data,params,metaData)\n{\n for(var i=0; i < metaData.length; i++) {\n//\tconsole.log(\"Processing: \" + metaData[i].name);\n//\tconsole.log(metaData[i]);\n\tdata[metaData[i].name] = calcMetaDataField(data,params,metaData[i]);\n \n }\n\n return(data);\n}", "function genM() {\n \"use strict\";\n return function () {\n return this.field;\n };\n}", "makeMeme() {\n this.transformToMeme(this.state.preview);\n }", "function Atm() {\r\n }", "function Mg(a){this.cb=a}", "multiply() {\n\n let result=1;\n let digit;\n \n for (let i = 0; i < arguments.length; i++) \n \n if(arguments[i]===\"LAST\"){\n result *= parseInt(this.last());\n }\n else \n if(arguments[i]!==\"LAST\"&&typeof(arguments[i])=='string'){\n \n digit = arguments[i].match(this.regex)\n result *= this.memory[parseInt(digit) - 1]\n \n \n }else{\n result *= arguments[i];\n \n }\n this.total = result;\n return parseInt(this.total);\n }", "static test03() {\n let cal = new Calc();\n cal.receiveInput(2);\n cal.receiveInput(Calc.OP.MULT);\n cal.receiveInput(7);\n cal.receiveInput(Calc.OP.EQ);\n return cal.getDisplayedNumber() === 2 * 7;\n }", "switchIlumination() {\n if (this.typeBasic)\n //colocamos o material como sendo Basic\n this.material = this.materials[1];\n\n else\n //colocamos o material Basic como sendo Phong\n this.material = this.materials[0];\n\n this.typeBasic = !this.typeBasic;\n }", "mutate(func) {\n this.weights_ih.map(func);\n this.weights_ho.map(func);\n this.bias_h.map(func);\n this.bias_o.map(func);\n }", "function proximo_mes(){\n if(mes_actual!=10){\n mes_actual++;\n }else{\n mes_actual=0;\n año_actual++;\n }\n dibujar_fecha();\n escribir_mes();\n escogerdia1();\n escogerdia2();\n}", "function magaFriend() {\n \n}", "function isat_find_device_mobile(mob)\n{\n\n//just simply write your rules\n\n}", "validarInformacion(){\n /** valida la informacion de los txt */\n if(this.generaValidacionControles() === 0){\n /** Se valida si se realizara un guardado o una actualizacion */\n if(this.state.objetoCliente.id === 0){\n /** Se realizara un guardado */\n return true;\n }else{\n /** Se llama el metodo que se encargara de indicar si se modifico algo o no */\n if(validaStateVsPropObj(this.state.objetoCliente,this.props.objCliente,'clientes')){\n return true;\n }else{\n /** Se asignan los valores del mensaje */\n this.mostrarControlMensaje(\"Se debe modificar al menos un campo para poder actualizar.\", 'danger', 'showMensaje');\n /** Se regresa el valor de que no cumplio la condicion */\n return false;\n }\n }\n }else{\n this.mostrarControlMensaje(\"Debe proporcionar toda la información.\", 'danger', 'showMensaje');\n /** Se regresa el valor de que no cumplio la condicion */\n return false;\n }\n }", "function mixMemes()\n{\n\tvar rCoords;\n\tvar bckp_memes = $.extend(true,{},memes);\n\n\t//Seleccionar aleatoriamente solo BLOCKS memes\n\tfor(var i=0;i<blocks;i++)\n\t{\n\t\tvalidMemes.push(selectMeme());\n\t}\n\n\t//Recorrer memes\n\t$.each(bckp_memes,function(it,val)\n\t{\n\t\tvar memin = 0;\n\n\t\t//Si no esta el numero de iterador en los memes seleccionados segun BLOCKS (cantidad) continua\n\t\tif( $.inArray(parseInt(it),validMemes) < 0)\n\t\t\treturn true;\n\t\tvar valC = $.extend(true,{},val);\n\t\t//Para obtener relacion1 y relacion2 del meme. Pasa dos veces\n\t\twhile(memin<2)\n\t\t{\n\t\t\tmemin++;\n\t\t\t//Obtener coordenadas aleatorias no repetidas\n\t\t\trCoords = setCoords();\n\n\t\t\t//Si NO se ha usado el texto\n\t\t\tif(val.text)\n\t\t\t{\t\n\t\t\t\tgameLogic[rCoords.y][rCoords.x] = {rel1:val.text,rel2:valC.img};\n\t\t\t\tval.text = false;\n\t\t\t}\n\t\t\telse if(val.img) //Si ya se uso el texto pero la imagen no\n\t\t\t{\n\t\t\t\tgameLogic[rCoords.y][rCoords.x] = {rel1:val.img,rel2:valC.text};\n\t\t\t\tval.img = false;\n\t\t\t}\n\t\t}\n\t});\n\n\t//Mostrar elementos\n\tputView();\n\n}", "get m(){ return this.density * this.volume;}", "function generalmob(givenName, givenprice){\r\n this.name = givenName;\r\n this.price = givenprice;\r\n this.start = function(){\r\n console.log(\"new mobile is starting\");\r\n }\r\n this.analyze = function(){\r\n console.log(`This mobile price is ${20000 - this.price} less than Samsung`);\r\n }\r\n}", "function Man() {\r\n}", "formValidHandler (nom, prenom, naissance, adresse, email, telephone, classe){\r\n let result = {\r\n status : true,\r\n message : null,\r\n }\r\n if(!(nom && prenom && naissance && adresse && email && telephone && classe)){\r\n result.status = false;\r\n result.message = \"Veuillez bien renseigner tous les paramètres\";\r\n if(nom === false && prenom === true && adresse === true && email === true && telephone === true && classe === true){\r\n result.status = false;\r\n result.message = \"Veuillez bien renseigner la valeur du paramètre NOM.\";\r\n }else if(nom === true && prenom === false && adresse === true && email === true && telephone === true && classe === true){\r\n result.status = false;\r\n result.message = \"Veuillez bien renseigner la valeur du paramètre PRENOM.\";\r\n }else if(nom === true && prenom === true && adresse === false && email === true && telephone === true && classe === true){\r\n result.status = false;\r\n result.message = \"Veuillez bien renseigner la valeur du paramètre ADRESSE.\";\r\n }else if(nom === true && prenom === true && adresse === true && email === false && telephone === true && classe === true){\r\n result.status = false;\r\n result.message = \"La valeur du paramètre EMAIL.\";\r\n }else if(nom === true && prenom === true && adresse === true && email === true && telephone === false && classe === true){\r\n result.status = false;\r\n result.message = \"La valeur du TELEPHONE. Il est \\n\"+\r\n \" doit contenir 9 chiffre \";\r\n }else if(nom === true && prenom === true && adresse === true && email === true && telephone === true && classe === false){\r\n result.status = false;\r\n result.message = \"Veuillez choisir la classe \";\r\n }\r\n return result;\r\n }\r\n return result;\r\n }", "mutate(func) {\r\n this.weights_ih.map(func);\r\n this.weights_ho.map(func);\r\n this.bias_h.map(func);\r\n this.bias_o.map(func);\r\n }", "obtain(){}", "static transient private protected internal function m55() {}", "static Sum(a,b) {\n //create new object, good for data + actions\n let calculation = new Calculation(a,b,Sum);\n Calculator.Calculations.push(calculation);\n return calculation.GetResults();\n }", "function pm(t,e){0}", "marsExpectancy() {\n if (this.sex === \"male\") {\n this.marsExpect = Math.round(this.male / this.marsNum);\n }\n if(this.sex === \"female\"){\n this.marsExpect = Math.round(this.female / this.marsNum);\n }\n }", "mutate(func) {\n this.weights_ih.map(func);\n this.weights_ho.map(func);\n this.bias_h.map(func);\n this.bias_o.map(func);\n }", "function mortal() {\n Object.defineProperty(this,\"raza\",{value:\"\",writable:true});\n Object.defineProperty(this,\"origen\",{value:\"\",writable:true});\n Object.defineProperty(this,\"inteligencia\",{value:false,writable:true});\n\n Object.defineProperties(this,{\n \"obtenRaza\":{get: function(){return this.raza;}},\n \"obtenOrigen\":{get: function(){return this.origen;}},\n \"obtenInteligencia\":{get: function(){return this.inteligencia;}},\n \"setRaza\":{set: function(raza){this.raza = raza;}},\n \"setOrigen\":{set: function(origen){this.origen = origen;}},\n \"setInteligencia\":{set: function(intel){this.inteligencia = intel;}}\n });\n\n this.muerto = function(){\n if(this.obtenEdad == 0){\n return \"Muerto\";\n } else {\n return \"Vivo\";\n }\n };\n}", "function aggregateMyFunctions() {\n var validate = validateForm();\n var formValid = validate.valid;\n\n if (!formValid) {\n validateForm();\n return false;\n } else {\n //all other functions\n //update this functions af you write more functions\n //example \n calculateDayOfWk();\n get_and_Print_AkanName();\n return false;\n }\n}", "m() {}", "static test01() {\n let cal = new Calc();\n cal.receiveInput(1);\n cal.receiveInput(1);\n cal.receiveInput(Calc.OP.PLUS);\n cal.receiveInput(5);\n cal.receiveInput(Calc.OP.EQ);\n return cal.getDisplayedNumber() === 11 + 5;\n }", "function calculateM() {\n return d['T'] * (d['L'] / d['v'] + d['B']) / d['H']\n}", "function muunnos(point){\n for(let i=0; i<pipeline.length; i++){ \n point = pipeline[i](point);\n }\n return point;\n}", "getMwi() {\r\n kandy.Mwi();\r\n }", "function MathRecognitionData() {\n }", "function specialCasesRecalc(mission) {\n\t\n}", "get_add_infos(movie, five_actors){\r\n\r\n let new_id = movie.id;\r\n let new_genres = this.get_genres(movie.genre_ids);\r\n let new_actors = five_actors\r\n\r\n let add_info_obj ={\r\n id: new_id,\r\n genres: new_genres,\r\n main_actors: new_actors\r\n };\r\n\r\n return add_info_obj;\r\n }", "transient private internal function m185() {}" ]
[ "0.6202076", "0.60231537", "0.60231537", "0.60231537", "0.59536076", "0.5819242", "0.5804346", "0.5794958", "0.57574004", "0.57516783", "0.5648584", "0.5604006", "0.5466584", "0.545641", "0.542945", "0.5392069", "0.5356951", "0.53494775", "0.5308275", "0.5287893", "0.5283137", "0.5252444", "0.52504003", "0.5244711", "0.52369446", "0.5222203", "0.5211564", "0.51950914", "0.51912075", "0.51903653", "0.51665705", "0.51601493", "0.51600534", "0.5146748", "0.51373833", "0.5135914", "0.51332015", "0.51279515", "0.5107292", "0.5099571", "0.5092552", "0.50921774", "0.5089645", "0.5089524", "0.50795984", "0.5078134", "0.507174", "0.5066526", "0.50634277", "0.5061018", "0.50596595", "0.50350946", "0.5033708", "0.5033182", "0.5031027", "0.5028498", "0.5027893", "0.5023517", "0.5010718", "0.5010061", "0.5006433", "0.5006318", "0.5002646", "0.4988358", "0.4967752", "0.4957048", "0.49484986", "0.4937805", "0.49371615", "0.49310824", "0.4929284", "0.4928483", "0.49279675", "0.49228698", "0.491861", "0.49180967", "0.4915003", "0.49103186", "0.49009815", "0.48995474", "0.48923856", "0.4891167", "0.48902148", "0.4889719", "0.4888143", "0.48848742", "0.4877991", "0.48694968", "0.48676646", "0.4864001", "0.486198", "0.4860301", "0.48600128", "0.48573825", "0.48506433", "0.4846635", "0.48347685", "0.48318923", "0.48309395", "0.4829158", "0.48256513" ]
0.0
-1
es6 > getter & setter as properties
get _firstName(){ return this.firstName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(getter, setter) {\n this.getter = getter;\n this.setter = setter;\n }", "set(property, value) {\n return this[property] = value;\n }", "set property(){}", "static set property(){}", "get property(){}", "function defineProperty(target, name, getter, setter) {\n Object.defineProperty(target, name, {\n configurable:true,\n enumerable:true,\n get:getter,\n set:setter\n });\n }", "function setter() {\n throw new Error('vuex getter properties are read-only.');\n }", "function setter() {\n\t throw new Error('vuex getter properties are read-only.');\n\t }", "static createProperty(e,t=defaultPropertyDeclaration){// Do not generate an accessor if the prototype already has one, since\n// it would be lost otherwise and that would never be the user's intention;\n// Instead, we expect users to call `requestUpdate` themselves from\n// user-defined accessors. Note that if the super has an accessor we will\n// still overwrite it\nif(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n=\"symbol\"==typeof e?Symbol():`__${e}`;Object.defineProperty(this.prototype,e,{// tslint:disable-next-line:no-any no symbol in index\nget(){return this[n]},set(t){const r=this[e];this[n]=t,this._requestUpdate(e,r)},configurable:!0,enumerable:!0})}", "static get property(){}", "get foo () {\n return \"foo\";\n }", "function atr$(obj, name, get, set, metamodel,settermm) {\nObject.defineProperty(obj, name, {get: get, set: set, configurable: true, enumerable: true});\n//if (name[0]==='$')name=name.substring(1);//names matching reserved words are prefixed with $\nobj['$prop$get'+name[0].toUpperCase()+name.substring(1)] = {get:get, set:set, $crtmm$:metamodel};\nif (settermm)set.$crtmm$=settermm;\n}", "defineGetterPropertyValue(prop, instance, getterHandler) {\n if (prop && getterHandler) {\n if (prop.propertyName) {\n Object.defineProperty(instance, prop.propertyName, {\n get: () => { var _a; return getterHandler(prop.propertyName, (_a = prop.metadata) !== null && _a !== void 0 ? _a : {}, instance); },\n configurable: true,\n enumerable: true,\n });\n }\n }\n }", "static createProperty(name,options=defaultPropertyDeclaration){// Note, since this can be called by the `@property` decorator which\n// is called before `finalize`, we ensure storage exists for property\n// metadata.\nthis._ensureClassProperties();this._classProperties.set(name,options);// Do not generate an accessor if the prototype already has one, since\n// it would be lost otherwise and that would never be the user's intention;\n// Instead, we expect users to call `requestUpdate` themselves from\n// user-defined accessors. Note that if the super has an accessor we will\n// still overwrite it\nif(options.noAccessor||this.prototype.hasOwnProperty(name)){return}const key=\"symbol\"===typeof name?Symbol():`__${name}`;Object.defineProperty(this.prototype,name,{// tslint:disable-next-line:no-any no symbol in index\nget(){return this[key]},set(value){const oldValue=this[name];this[key]=value;this._requestUpdate(name,oldValue)},configurable:!0,enumerable:!0})}", "function InstallGetterSetter(object, name, getter, setter) {\n %CheckIsBootstrapping();\n SetFunctionName(getter, name, \"get\");\n SetFunctionName(setter, name, \"set\");\n %FunctionRemovePrototype(getter);\n %FunctionRemovePrototype(setter);\n %DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM);\n %SetNativeFlag(getter);\n %SetNativeFlag(setter);\n}", "function _createGettersSettersProperties(ClassObj) {\n\t\tvar i,\n\t\t\tj,\n\t\t\tfield,\n\t\t\titem,\n\t\t\tpropertyName,\n\t\t\tsetterFunction = function (setterFunctionName, value, inInit) {\n\t\t\t\tvar fn = this[setterFunctionName];\n\t\t\t\tAssert.requireFunction(fn, \"Dynamic setter function does not exist: \" + setterFunctionName);\n\t\t\t\tfn.call(this, value, inInit);\n\t\t\t},\n\t\t\tgetterFunction = function (getterFunctionName) {\n\t\t\t\tvar fn = this[getterFunctionName];\n\t\t\t\tAssert.requireFunction(fn, \"Dynamic getter function does not exist: \" + getterFunctionName);\n\t\t\t\treturn fn.apply(this);\n\t\t\t},\n\t\t\t// wrap this because this.privateAccessor will only be accessible when there is\n\t\t\t// an instance of this object.\n\t\t\taccessorWrapper = function (type, fieldName, subObj, value, inInit) {\n\t\t\t\tvar i,\n\t\t\t\t\tfetchedValue,\n\t\t\t\t\taccessor,\n\t\t\t\t\tconfigDataHash;\n\n\t\t\t\t// protect against setting a bad value on fields that are sub objects\n\t\t\t\tif (subObj && type === _CONST.ACCESSOR_SET && (typeof value !== \"object\" || typeof value === \"object\" && !(value instanceof subObj))) {\n\t\t\t\t\tthrow new Error(\"Calling setter of sub object: \" + fieldName + \" with a value that is the incorrect type\");\n\t\t\t\t}\n\n\t\t\t\t// multiple accessors will exist if there is a superclass\n\t\t\t\t// iterate backwards to start with the lowest subclass\n\t\t\t\tfor (i = this.privateAccessors.length - 1; i >= 0 ; i -= 1) {\n\t\t\t\t\taccessor = this.privateAccessors[i].accessor;\n\t\t\t\t\tconfigDataHash = this.privateAccessors[i].configDataHash;\n\n\t\t\t\t\t// make sure this field exists before trying to get/set via the accessor\n\t\t\t\t\t// don't bother checking parent classes\n\t\t\t\t\t// since the subclasses override\n\t\t\t\t\tif (configDataHash[fieldName]) {\n\t\t\t\t\t\treturn accessor(type, fieldName, value, inInit);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t};\n\n\n\t\tfor (i = 0; i < _configData.length; i = i + 1) {\n\t\t\tfield = _configData[i];\n\t\t\titem = {};\n\n\t\t\t///////////////////////////////////////////////////////\n\t\t\t// Add class configuration data for fields to a\n\t\t\t// static property this will be used in our unit tests\n\t\t\t//\n\t\t\t// TODO: might be a good idea to only do this when a\n\t\t\t// global \"TESTING\" flag is set\n\t\t\t///////////////////////////////////////////////////////\n\t\t\tfor (j in field) {\n\t\t\t\tif (field.hasOwnProperty(j)) {\n\t\t\t\t\t//if (!_.isFunction(field[j])) {\n\t\t\t\t\titem[j] = field[j];\n\t\t\t\t\t//}\n\t\t\t\t}\n\t\t\t}\n\t\t\tClassObj.__CLASS_CONFIG.push(item);\n\t\t\t///////////////////////////////////////////////////////\n\n\t\t\tClassObj.prototype[field.setterName] = Utils.curry(accessorWrapper, _CONST.ACCESSOR_SET, field.dbFieldName, field.classObject);\n\t\t\tClassObj.prototype[field.getterName] = Utils.curry(accessorWrapper, _CONST.ACCESSOR_GET, field.dbFieldName, field.classObject, undefined);\n\n\t\t\t// propertyName is optional. If not specified, set a name based on the dbFieldName\n\t\t\tClassObj.prototype.__defineSetter__(field.propertyName, Utils.curry(setterFunction, field.setterName));\n\t\t\tClassObj.prototype.__defineGetter__(field.propertyName, Utils.curry(getterFunction, field.getterName));\n\t\t}\n\t}", "function defineProperty(klass, propertyName, getter, setter) {\n var config = {\n enumerable: true,\n get: getter\n };\n if (setter) {\n config.set = setter;\n }\n Object.defineProperty(klass.prototype, propertyName, config);\n }", "get asSetter() {\n return setter(this.over)\n }", "function getterSetter(_ref9) {\n var get = _ref9.get;\n var set = _ref9.set;\n var setType = _ref9.setType;\n var asConstant = _ref9.asConstant;\n\n return function getSet(newValue) {\n // main setter if setType matches newValue type\n if (!setType && newValue != null || setType && (typeof newValue === 'undefined' ? 'undefined' : _typeof(newValue)) === setType) {\n set(newValue);\n return lineChunked;\n\n // setter to constant function if provided\n } else if (asConstant && newValue != null) {\n set(asConstant(newValue));\n return lineChunked;\n }\n\n // otherwise ignore value/no value provided, so use getter\n return get();\n };\n }", "function getter(obj, prop, fn) {\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: fn\n });\n}", "get(property) {\n return this[property];\n }", "static get properties(){return{}}", "static get properties(){return{}}", "get x() {}", "function proxyProperty( first, second ){\n\t return {\n\t get : function(){\n\t return this[ first ][ second ];\n\t },\n\t\n\t set : function( value ){\n\t this[ first ][ second ] = value;\n\t }\n\t }\n\t}", "function _prop(val) { return { value: val, enumerable: true }; }", "function _prop(val) { return { value: val, enumerable: true }; }", "_upgradeProperty(prop) {\n // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties\n // https://developers.google.com/web/fundamentals/web-components/examples/howto-checkbox\n /* eslint no-prototype-builtins: 0 */\n if (this.hasOwnProperty(prop)) {\n const value = this[prop];\n // get rid of the property that might shadow a setter/getter\n delete this[prop];\n // this time if a setter was defined it will be properly called\n this[prop] = value;\n // if a getter was defined, it will be called from now on\n }\n }", "function property(name, value) {\n // if functioning as a setter, set property in cache\n if (arguments.length > 1) {\n _propertyCache[name] = functor(value);\n return this;\n }\n\n // functioning as a getter, return property accessor\n return functor(_propertyCache[name]);\n }", "function property(value, isWritable, isEnumberable) {\n return {\n enumerable: isEnumberable || true,\n writable: isWritable || false,\n value: value\n };\n}", "function makeProperty( obj, name, predicate ) {\r\n\tvar value; // this is the property value, current goal in this application.\r\n\t\r\n\tobj[\"get\" + name] = function() {\r\n\t\treturn value; \r\n\t};\r\n\t\r\n\tobj[\"set\" + name] = function(v) {\r\n\t\tif ( predicate && !predicate(v))\r\n\t\t\tthrow \"set\" + name + \": invalid value \" + v;\r\n\t\telse\t\r\n\t\t\tvalue = v;\r\n\t};\r\n\t\t\r\n}", "set(options){\n for (var k in options) {\n if (options.hasOwnProperty(k) && this.hasOwnProperty(k) && k != 'get' && k != 'set') {\n this[k] = options[k];\n }\n }\n }", "set(target, prop, val) {\r\n target[prop] = val;\r\n return true;\r\n }", "set(target, prop, val) {\r\n target[prop] = val;\r\n return true;\r\n }", "set(target, prop, val) {\r\n target[prop] = val;\r\n return true;\r\n }", "static createProperty(name, options = defaultPropertyDeclaration) {\n // Note, since this can be called by the `@property` decorator which\n // is called before `finalize`, we ensure storage exists for property\n // metadata.\n this._ensureClassProperties();\n this._classProperties.set(name, options);\n // Do not generate an accessor if the prototype already has one, since\n // it would be lost otherwise and that would never be the user's intention;\n // Instead, we expect users to call `requestUpdate` themselves from\n // user-defined accessors. Note that if the super has an accessor we will\n // still overwrite it\n if (options.noAccessor || this.prototype.hasOwnProperty(name)) {\n return;\n }\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n Object.defineProperty(this.prototype, name, {\n // tslint:disable-next-line:no-any no symbol in index\n get() {\n return this[key];\n },\n set(value) {\n const oldValue = this[name];\n this[key] = value;\n this._requestUpdate(name, oldValue);\n },\n configurable: true,\n enumerable: true\n });\n }", "function createSpecificAccessors(propName, isWritable, objToCreateIn) {\r\n if (isWritable) {\r\n objToCreateIn[methodNames.setPrefix + propName] = function (propertyValue) {\r\n setValueInternal(propName, propertyValue);\r\n }\r\n\r\n objToCreateIn[methodNames.appendPrefix + propName] = function (propertyValue) {\r\n appendValueInternal(propName, propertyValue);\r\n }\r\n }\r\n\r\n objToCreateIn[methodNames.getPrefix + propName] = function () {\r\n return getValueInternal(propName);\r\n }\r\n }", "set( property ) { \n\n \n var currentClass = this,\n guard = this.guard();\n\n Object.keys(property).forEach(function(key) {\n if(!guard.includes(key))\n eval(`currentClass.${key} = property[[key]]`);\n }) \n }", "function property(options){// tslint:disable-next-line:no-any decorator\nreturn(protoOrDescriptor,name)=>name!==void 0?legacyProperty(options,protoOrDescriptor,name):standardProperty(options,protoOrDescriptor)}", "get _getter() {\n return descriptorForDecorator(this)._getter;\n }", "function studentSetterGetter(_name,_roll,_grade)\n{\n this.setName=function(name)\n {\n _name=name;\n }\n this.getName=function()\n {\n return _name;\n }\n this.setRoll=function(roll)\n {\n _roll=roll\n }\n this.getRoll=function()\n {\n return _roll;\n }\n this.setGrade=function(grade)\n {\n _grade=grade\n }\n this.getGrade=function()\n {\n return _grade\n }\n}", "function InstallGetter(object, name, getter, attributes) {\n %CheckIsBootstrapping();\n if (typeof attributes == \"undefined\") {\n attributes = DONT_ENUM;\n }\n SetFunctionName(getter, name, \"get\");\n %FunctionRemovePrototype(getter);\n %DefineAccessorPropertyUnchecked(object, name, getter, null, attributes);\n %SetNativeFlag(getter);\n}", "function accessor(property) {\n\t\tvar fn = function() {\n\t\t\treturn this[arguments.length ? \"set\" : \"get\"](property, arguments[0]);\n\t\t};\n\n\t\t// Set a flag to later prevent set() to call fn() indefinitely\n\t\tfn.accessor = true;\n\t\treturn fn;\n\t}", "static createProperty(name, options = defaultPropertyDeclaration) {\n // Note, since this can be called by the `@property` decorator which\n // is called before `_finalize`, we ensure storage exists for property\n // metadata.\n this._ensureClassProperties();\n this._classProperties.set(name, options);\n if (!options.noAccessor) {\n const superDesc = descriptorFromPrototype(name, this.prototype);\n let desc;\n // If there is a super accessor, capture it and \"super\" to it\n if (superDesc !== undefined && (superDesc.set && superDesc.get)) {\n const { set, get } = superDesc;\n desc = {\n get() { return get.call(this); },\n set(value) {\n const oldValue = this[name];\n set.call(this, value);\n this.requestUpdate(name, oldValue);\n },\n configurable: true,\n enumerable: true\n };\n }\n else {\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n desc = {\n get() { return this[key]; },\n set(value) {\n const oldValue = this[name];\n this[key] = value;\n this.requestUpdate(name, oldValue);\n },\n configurable: true,\n enumerable: true\n };\n }\n Object.defineProperty(this.prototype, name, desc);\n }\n }", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty (obj, prop, getter) {\n function get () {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty(obj, prop, getter) {\n function get() {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty(obj, prop, getter) {\n function get() {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "function lazyProperty(obj, prop, getter) {\n function get() {\n var val = getter()\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n })\n\n return val\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n })\n}", "static define(obj) {\n for (const [name, prop] of entries(isFunction(obj) ? obj(kinds) : obj)) {\n if (this.prototype._props[name] != null)\n throw new Error(`attempted to redefine property '${this.prototype.type}.${name}'`);\n if (this.prototype[name] != null)\n throw new Error(`attempted to redefine attribute '${this.prototype.type}.${name}'`);\n Object.defineProperty(this.prototype, name, {\n // XXX: don't use tail calls in getters/setters due to https://bugs.webkit.org/show_bug.cgi?id=164306\n get() {\n const value = this.properties[name].get_value();\n return value;\n },\n set(value) {\n this.setv({ [name]: value });\n return this;\n },\n configurable: false,\n enumerable: true,\n });\n const [type, default_value, options = {}] = prop;\n const refined_prop = {\n type,\n default_value: this._fix_default(default_value, name),\n options,\n };\n const props = { ...this.prototype._props };\n props[name] = refined_prop;\n this.prototype._props = props;\n }\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "get set () {\n\t\treturn this._set;\n\t}", "function set$1(obj,key,val){if(Array.isArray(obj)){obj.length=Math.max(obj.length,key);obj.splice(key,1,val);return val;}if(hasOwn(obj,key)){obj[key]=val;return;}var ob=obj.__ob__;if(obj._isVue||ob&&ob.vmCount){\"development\"!=='production'&&warn('Avoid adding reactive properties to a Vue instance or its root $data '+'at runtime - declare it upfront in the data option.');return;}if(!ob){obj[key]=val;return;}defineReactive$$1(ob.value,key,val);ob.dep.notify();return val;}", "set(target, prop, value) {\n base.update(store => Object.assign(store, { [prop]: value }));\n return true;\n }", "set(name, value, s, extra) {\n\t\tlet thiz = this;\n\t\textra = extra || {};\n\t\tif ( !Object.prototype.hasOwnProperty.call(this.properties, name) ) {\n\t\t\tif ( !this.extensable ) {\n\t\t\t\t//TODO: Should we throw here in strict mode?\n\t\t\t\treturn Value.undef.fastGen();\n\t\t\t}\n\t\t\tlet v = new PropertyDescriptor(value);\n\t\t\tv.enumerable = 'enumerable' in extra ? extra.enumerable : true;\n\t\t\tthis.properties[name] = v;\n\n\t\t\treturn v.setValue(this, value, s);\n\t\t}\n\n\t\treturn this.properties[name].setValue(this, value, s);\n\n\t}", "_createAccessors(accessors) {\n this._accessors = {};\n // add it to the prototype\n const proto = Object.getPrototypeOf(this);\n // create a getter / setter for each accessors\n // setter : `this.x = callback`\n // getter : `this.x(datum)`\n Object.keys(accessors).forEach((name) => {\n if (proto.hasOwnProperty(name)) { return; }\n\n Object.defineProperty(proto, name, {\n get: function() { return this._accessors[name]; },\n set: function(func) {\n this._accessors[name] = func;\n }\n });\n });\n }", "static get properties() {\n return { ...super.properties };\n }", "function lazyProperty(obj, prop, getter) {\n function get() {\n var val = getter();\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n value: val\n });\n return val;\n }\n\n Object.defineProperty(obj, prop, {\n configurable: true,\n enumerable: true,\n get: get\n });\n}", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n moment.updateOffset(this);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n moment.updateOffset(this);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n moment.updateOffset(this);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n moment.updateOffset(this);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n moment.updateOffset(this);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n moment.updateOffset(this);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n moment.updateOffset(this);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n moment.updateOffset(this);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n moment.updateOffset(this);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n moment.updateOffset(this);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n moment.updateOffset(this);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "function makeGetterAndSetter(name, key) {\n moment.fn[name] = moment.fn[name + 's'] = function (input) {\n var utc = this._isUTC ? 'UTC' : '';\n if (input != null) {\n this._d['set' + utc + key](input);\n moment.updateOffset(this);\n return this;\n } else {\n return this._d['get' + utc + key]();\n }\n };\n }", "static get properties() {}", "function defineProperty(key,handler,value){Object.defineProperty(ctrl,key,{get:function get(){return value;},set:function set(newValue){var oldValue=value;value=newValue;handler&&handler(newValue,oldValue);}});}", "get(name) {\n return getters[name]();\n }", "get property() {\n return super.property;\n }", "set(value) {\n this.value = value\n if (this.autoUpdate) {\n this.update()\n }\n return this // chain me up baby\n }", "function define(target, key, expose, getter, setter) {\n\t\t\tvar definition = {\n\t\t\t\t\tenumerable: expose\n\t\t\t\t};\n\n\t\t\t// if the setter is a boolean value, there will be no getter/setter function but a value\n\t\t\t// the boolean value in setter indicates whether the value is writable\n\t\t\tif (typeof setter === 'boolean') {\n\t\t\t\tdefinition.writable = setter;\n\t\t\t\tdefinition.value = getter;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdefinition.get = getter;\n\t\t\t\tdefinition.set = setter;\n\t\t\t}\n\n\t\t\tObject.defineProperty(target, key, definition);\n\t\t}", "function defineProperty(key,handler,value){Object.defineProperty(ctrl,key,{get:function get(){return value;},set:function set(newValue){var oldValue=value;value=newValue;handler(newValue,oldValue);}});}", "makeProp(prop, value) {\n\t\tObject.defineProperty(this, prop, {\n\t\t\tvalue,\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true\n\t\t});\n\t}", "setProp(obj, index, value) {\n return this._propSetters[index](obj, value);\n }", "static get properties() {\n return { ...super.properties\n };\n }" ]
[ "0.7231414", "0.70543134", "0.69122034", "0.69067824", "0.6903218", "0.6714992", "0.66771936", "0.661053", "0.66104156", "0.6568653", "0.65545654", "0.64884233", "0.6465203", "0.6459076", "0.64574397", "0.6427598", "0.64198065", "0.6404411", "0.6347456", "0.6331573", "0.6298028", "0.6271074", "0.6271074", "0.62484837", "0.6248242", "0.6227701", "0.6227701", "0.6214645", "0.6209464", "0.6209328", "0.6185375", "0.6184303", "0.6161693", "0.6161693", "0.6161693", "0.6147565", "0.6128797", "0.6125128", "0.60601145", "0.60495853", "0.6028143", "0.6005818", "0.60004157", "0.5999492", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5986299", "0.5955916", "0.5955916", "0.5955916", "0.5951293", "0.59456825", "0.59456825", "0.59456825", "0.59456825", "0.59456825", "0.5942165", "0.5939219", "0.59352505", "0.5934721", "0.59337664", "0.590029", "0.58807015", "0.58754086", "0.5867237", "0.5867237", "0.5867237", "0.5867237", "0.5867237", "0.5867237", "0.5867237", "0.5867237", "0.5867237", "0.5867237", "0.5867237", "0.5867237", "0.586386", "0.5858597", "0.5854527", "0.5854194", "0.58407974", "0.5837766", "0.5836901", "0.5834444", "0.5833897", "0.58234084" ]
0.0
-1
add handler function for 'share'
render() { const { id, title, label } = this.props; return ( <div className='Activity'> <h2 className='Activity__title'> <Link to={`/activity/${id}`}> {title} </Link> </h2> <article className='Activity__body group-row'> <div className='Activity__details item-triple'> <p className='Activity__label'> Label: {label} </p> </div> <div className='Activity__actions item group-column'> <button className='Activity__delete item' type='button' onClick={this.handleClickDelete} > {' '} Remove </button> </div> </article> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function facebookShare() {\n var s=s_gi(s_account);\n s.eVar2='fShare';\n s.events='event12';\n s.trackExternalLinks = false;\n s.linkTrackVars='eVar2,events';\n s.linkTrackEvents='event12';\n s.tl(this,'o','fShare');\n}", "sharePost() {\n this._qs(\"#share-post\").addEventListener(\"click\", async () => {\n this.setLoader();\n await import(\"/componets/universal/share/share.js\");\n try {\n this._qs(\"#share-post-box\").innerHTML = `\n <share-comp>\n </share-comp>`;\n this.stopLoader();\n } catch (err) {\n this.stopLoader();\n\n this.popup(err.message, \"error\", 3);\n }\n });\n }", "function handleSetShare(url){\n \n console.log('function handleSetShare() called.');\n \n //var url = document.getElementById(\"shareUrl\").value;\n \n app.setShareUrl(url);\n log('setShareUrl()', {message: 'Shared the following URL with the participant: ', url: url});\n \n}", "function earthnc_sharedsp(){\n // updateLinks();\n show('share_btn_on_id');\n hide('share_btn_id');\n show(\"share_dsp\");\n hide(\"link_share_open\");\n show(\"link_share_close\");\n }", "share () {\n this.resizePopup()\n\n // If a popup window already exist, we close it and trigger a change event.\n if (this.popup.window && this.popup.interval) {\n clearInterval(this.popup.interval)\n\n // Force close (for Facebook)\n this.popup.window.close()\n\n this.emit('change')\n }\n\n this.popup.window = $window.open(\n this.shareLink,\n 'sharer',\n ',height=' + this.popup.height +\n ',width=' + this.popup.width +\n ',left=' + this.popup.left +\n ',top=' + this.popup.top +\n ',screenX=' + this.popup.left +\n ',screenY=' + this.popup.top\n )\n\n this.popup.window.focus()\n\n // Create an interval to detect popup closing event\n this.popup.interval = setInterval(() => {\n if (!this.popup.window || this.popup.window.closed) {\n clearInterval(this.popup.interval)\n\n this.popup.window = null\n\n this.emit('close')\n }\n }, 500)\n\n this.emit('open')\n }", "function shareFunc() {\r\n if (shareswitch === 1) return;\r\n var t = 200; // time in milliconds\r\n var shareElems = doc.a('.share');\r\n switch (shareswitch) {\r\n case 0:\r\n shareswitch = 1;\r\n shareElems.forEach(function (e, i) {\r\n setTimeout(function () {\r\n fx(e.id).fadeIn(t);\r\n }, 40 * (i + 1));\r\n });\r\n setTimeout(function () {\r\n shareswitch = 2;\r\n queryClickListener('body', shareFunc);\r\n navState[1] = false;\r\n }, t + (shareElems.length * 40));\r\n break;\r\n case 2:\r\n shareswitch = 1;\r\n navState[0] = null;\r\n shareElems.forEach(function (e) {\r\n fx(e.id).fadeOut(t);\r\n });\r\n setTimeout(function () {\r\n shareswitch = 0;\r\n document.body.removeEventListener(\"click\", shareFunc);\r\n navState[1] = false;\r\n }, t);\r\n break;\r\n default:break;\r\n }\r\n}", "function display_share_panel() {\n\n }", "function doModalShare() {\n\tcustomModalBox.htmlBox('yt-ShareContent', '', 'Share'); \n\t$('mb_close_link').addEvent('click', function() {\n\t\t$('yt-ShareContent').injectInside($('yt-ShareContainer'));\n\t\tif($('yt-ShareError')) $('yt-ShareError').remove();\n\t});\n}", "share(){\n swal('Thanks for Sharing', \"Sorry the feature isn't ready yet but we are working on it :)\", \"success\");\n }", "function share(action){\n\tgtag('event','click',{'event_category':'share','event_label':action});\n\t\n\tvar loc = location.href\n\tloc = loc.substring(0, loc.lastIndexOf(\"/\") + 1);\n\t\n\tvar title = '';\n\tvar text = '';\n\t\n\ttitle = shareTitle.replace(\"[SCORE]\", addCommas(playerData.score));\n\ttitle = title.replace(\"[LEVEL]\", gameData.levelNum+1);\n\ttext = shareMessage.replace(\"[SCORE]\", addCommas(playerData.score));\n\ttext = text.replace(\"[LEVEL]\", gameData.levelNum+1);\n\tvar shareurl = '';\n\t\n\tif( action == 'twitter' ) {\n\t\tshareurl = 'https://twitter.com/intent/tweet?url='+loc+'&text='+text;\n\t}else if( action == 'facebook' ){\n\t\tshareurl = 'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(loc+'share.php?desc='+text+'&title='+title+'&url='+loc+'&thumb='+loc+'share.jpg&width=590&height=300');\n\t}else if( action == 'google' ){\n\t\tshareurl = 'https://plus.google.com/share?url='+loc;\n\t}else if( action == 'whatsapp' ){\n\t\tshareurl = \"whatsapp://send?text=\" + encodeURIComponent(text) + \" - \" + encodeURIComponent(loc);\n\t}\n\t\n\twindow.open(shareurl);\n}", "function shareUrl(urlToShare){\n window.plugins.socialsharing.shareWithOptions(\n {\n url:urlToShare\n }, \n function(){}, \n function(){}\n );\n}", "function SharingPlugin($window, $q, $log, PluginUtils){\n var pluginName = 'SocialSharing';\n var pluginTest = function(){ return $window.plugins && $window.plugins.socialsharing; };\n var service = {\n share: share,\n shareViaFacebook: shareViaFacebook,\n shareViaTwitter: shareViaTwitter,\n shareViaEmail: shareViaEmail\n };\n\n // _fileOrFileArray can be null, a string or an array of strings\n function share(message, _subject, _fileOrFileArray, _link){\n return PluginUtils.onReady(pluginName, pluginTest).then(function(){\n var defer = $q.defer();\n $window.plugins.socialsharing.share(message, _subject || null, _fileOrFileArray || null, _link || null, function(){\n defer.resolve();\n }, function(error){\n $log.error('pluginError:'+pluginName, error);\n defer.reject(error);\n });\n return defer.promise;\n });\n }\n\n function shareViaFacebook(message, _fileOrFileArray, _link){\n return PluginUtils.onReady(pluginName, pluginTest).then(function(){\n var defer = $q.defer();\n $window.plugins.socialsharing.shareViaFacebookWithPasteMessageHint(message, _fileOrFileArray || null, _link || null, 'Tu peux coller le message par défaut si tu veux...', function(){\n defer.resolve();\n }, function(error){\n $log.error('pluginError:'+pluginName, error);\n defer.reject(error);\n });\n return defer.promise;\n });\n }\n\n function shareViaTwitter(message, _file, _link){\n return PluginUtils.onReady(pluginName, pluginTest).then(function(){\n var defer = $q.defer();\n $window.plugins.socialsharing.shareViaTwitter(message, _file || null, _link || null, function(){\n defer.resolve();\n }, function(error){\n $log.error('pluginError:'+pluginName, error);\n defer.reject(error);\n });\n return defer.promise;\n });\n }\n\n function shareViaEmail(message, _subject, _fileOrFileArray){\n return PluginUtils.onReady(pluginName, pluginTest).then(function(){\n var defer = $q.defer();\n $window.plugins.socialsharing.shareViaEmail(message, _subject || null, null /*to*/, null /*cc*/, null /*bcc*/, _fileOrFileArray || null, function(){\n defer.resolve();\n }, function(error){\n $log.error('pluginError:'+pluginName, error);\n defer.reject(error);\n });\n return defer.promise;\n });\n }\n\n return service;\n }", "function screenshare (number, screenid)\n{\n if (typeof (webphone_api.plhandler) === 'undefined' || webphone_api.plhandler === null)\n webphone_api.addtoqueue('ScreenShare', [number, screenid]);\n else\n webphone_api.plhandler.ScreenShare(number, screenid);\n}", "onShareAppMessage() {\n\n }", "function sharePopup(width, height, net, sharefrom) {\r\n var leftPosition, topPosition;\r\n leftPosition = (window.screen.width / 2) - ((width / 2) + 10);\r\n topPosition = (window.screen.height / 2) - ((height / 2) + 50);\r\n\r\n var windowFeatures = \"status=no,height=\" + height + \",width=\" + width + \",resizable=yes,left=\" + leftPosition + \",top=\" + topPosition + \",screenX=\" + leftPosition + \",screenY=\" + topPosition + \",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no\";\r\n u = location.href;\r\n t = document.title;\r\n\r\n url = u.substring(0, u.indexOf('#'));\r\n\r\n switch(net){\r\n case 'fb':\r\n share = \"http://www.facebook.com/sharer.php?u=\";\r\n ga('send', 'event', 'Player', 'LastSlide-facebook', username + ', ' + presentationId);\r\n break;\r\n case 'tw':\r\n share = \"https://twitter.com/share?text=Check out this emazing presentation&via=emaze_tweets&url=\";\r\n ga('send', 'event', 'Player', 'LastSlide-twitter', username + ', ' + presentationId);\r\n break;\r\n case 'in':\r\n share = 'http://www.linkedin.com/shareArticle?mini=true&title=' + EM.scenemanager.presentation.core.name + '&summary=' + EM.scenemanager.presentation.core.description + '&source=emaze&url=';\r\n ga('send', 'event', 'Player', 'LastSlide-linkedin', username + ', ' + presentationId);\r\n break;\r\n case 'gp':\r\n share = \"https://plus.google.com/share?url=\";\r\n ga('send', 'event', 'Player', 'LastSlide-googleplus', username + ', ' + presentationId);\r\n break;\r\n }\r\n\r\n $.ajax({\r\n type: 'POST', url: '/NewShare/sendEvent', dataType: 'json',\r\n data: { presid: presentationId, sharefrom: ((sharefrom=='Player') ? 'lastslide' : sharefrom), sharetype: net }\r\n });\r\n\r\n window.open(share + encodeURIComponent(url) + '&t=' + encodeURIComponent(t),'sharer', windowFeatures);\r\n return false;\r\n }", "_shareMessage(){\n Share.share({\n message:'Hello,Get the COVID-19 Contact Tracing Expo Project at https://play.google.com/store/apps/details?id=com.TwiSDAHymn.twi_hymn'\n })\n }", "function share(message, _subject, _fileOrFileArray, _link){\n return PluginUtils.onReady(pluginName, pluginTest).then(function(){\n var defer = $q.defer();\n $window.plugins.socialsharing.share(message, _subject || null, _fileOrFileArray || null, _link || null, function(){\n defer.resolve();\n }, function(error){\n $log.error('pluginError:'+pluginName, error);\n defer.reject(error);\n });\n return defer.promise;\n });\n }", "function share(text, image, url, via) {\n\n if(image == '') {\n image = null;\n }\n\n if(url == '') {\n url = null;\n }\n\n if(typeof(via) == 'undefined') {\n via = 'generic';\n }\n\n switch(via) {\n case \"twitter\":\n return window.plugins.socialsharing.shareViaTwitter(text, image, url);\n break;\n\n case \"facebook\":\n return window.plugins.socialsharing.shareViaFacebook(text, image, url, function() {\n console.log('share ok');\n }, \n function(errormsg) {\n alert(errormsg);\n });\n break;\n\n case \"whatsapp\":\n return window.plugins.socialsharing.shareViaWhatsApp(text, image, url, function() {\n console.log('share ok');\n }, function(errormsg) {\n alert(errormsg);\n });\n break;\n\n default:\n return window.plugins.socialsharing.share(text, null, image, url);\n break;\n }\n \n}", "function shareToFacebook(){\n var url = window.location.host + vm.url;\n fb_publish(vm.title, vm.detail, url , vm.imgsrc);\n }", "function SectionSharing(){}", "function PageShare() {\r\n\t\t\r\n\t\tif( $('#share').length > 0 ){\r\n\t\t\r\n\t\t\t$(\"#share\").jsSocials({\r\n\t\t\t\tshowLabel: false,\r\n\t\t\t\tshowCount: false,\r\n\t\t\t\tshares: [\"facebook\", \"twitter\", \"googleplus\"]\r\n\t\t\t});\r\n\t\t\r\n\t\t}\r\n\t\t\r\n\t}", "function share_click(share_button){\n clickSound.play();\n\n var target = '_blank';\n if ($(this).hasClass('partage_email'))\n target = '_system';\n\n window.open($(this).data('sharelink'), target, 'location=no');\n\n e.stopPropagation();\n}", "function share() {\n // send the save snapshot to the share service as it has all we need already\n shareService.share(saveSnapShot).then(function() {\n // If already saved, edit with saved else mark as saved\n saveSnapShot.shared = true;\n if (vm.saved) {\n // save again\n workoutService.editOrCreate(saveSnapShot.date, saveSnapShot).then(function(res) {\n vm.shared = true;\n });\n } else {\n vm.shared = true;\n }\n\n });\n }", "function shareProcess(){\n file_id = $(this).attr(\"lookup\");\n fileName = $(this).attr(\"name\");\n var revocation_keys;\n\n\n downloadParams();\n\n $.when(dfdHeader.promise()).done(function(){\n var url = THIRD_SERVER + 'download_file_params_for_sharing/'+file_id+'/';\n var args = {\n url: url,\n crossDomain: true,\n crossOrigin: true,\n contentType: 'json',\n type: 'GET',\n success: function (data) {\n common.naclModule.postMessage({\n Cmd: 'Sharing',\n t: data.t,\n C1: data.C1,\n n_shared: data.n_shared,\n n_new: nNewShare,\n product: data.product,\n Headers: gbsHeader,\n });\n },\n };\n $.ajax(args);\n });\n}", "function facebookShare(type){ \r\n jQuery('#sonnyGif').attr('onclick', 'analytics(\"facebook_share\")').click();\r\n if(type == 'finished'){\r\n var msg = 'I finished the 10 day compassion challenge! That\\'s 5 acts of kindness in 5 days! Try it now';\r\n }\r\n else{\r\n msg = jQuery('.taskDetail'+ type +' .kindnessTxt').text();\r\n }\r\n FB.ui({\r\n quote: msg,\r\n hashtag: '#kindness',\r\n method: 'share',\r\n mobile_iframe: true,\r\n href: 'http://thekindnessapp.com',\r\n }, function(response){});\r\n }", "function share(action){\r\n\tvar loc = location.href\r\n\tloc = loc.substring(0, loc.lastIndexOf(\"/\") + 1);\r\n\tvar title = shareTitle.replace(\"[SCORE]\", playerData.newScore);\r\n\tvar text = shareTitle.replace(\"[SCORE]\", playerData.newScore);\r\n\tvar shareurl = '';\r\n\t\r\n\tif( action == 'twitter' ) {\r\n\t\tshareurl = 'https://twitter.com/intent/tweet?url='+loc+'&text='+text;\r\n\t}else if( action == 'facebook' ){\r\n\t\tshareurl = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(loc+'share.php?desc='+text+'&title='+title+'&url='+loc+'&thumb='+loc+'share.jpg');\r\n\t}else if( action == 'google' ){\r\n\t\tshareurl = 'https://plus.google.com/share?url='+loc;\r\n\t}\r\n\t\r\n\twindow.open(shareurl);\r\n}", "function recepieShare(){ // render the share recepie screen\n if ( !validateUser() ){ return; }\n let src = document.getElementById(\"recepieShare\").innerHTML;\n let template = Handlebars.compile(src);\n let context = {}; // {{ N/A }}\n let html = template(context);\n render(html);\n let shareButton = document.getElementById(\"shareButton\");\n\tshareButton.addEventListener(\"click\", (e) => {\n\t\te.preventDefault();\n\t\tshareRecepieClick();\n\t});\n}", "function onShareButtonTouched(e){\n\tvar Social = require(\"dk.napp.social\");\n\t\t\n\tSocial.activityView({\n\t text: media.link + \" via @getinstagrid\",\n\t\tview: $.shareButton,\n\t removeIcons:\"sms,copy\"\n\t});\n\t\n\t// The example below, shows how to add \"custom ones\"\n\t// Social.activityView({\n// \t text: media.link + \" via @getinstagrid\",\n// \t\tview: $.shareButton,\n// \t //removeIcons:\"print,sms,copy,contact,camera,mail\"\n// \t},[\n// \t {\n// \t title:\"Custom Share\",\n// \t type:\"hello.world\",\n// \t image:\"pin.png\"\n// \t },\n// \t {\n// \t title:\"Open in Safari\",\n// \t type:\"open.safari\",\n// \t image:\"safari.png\"\n// \t }\n// \t]);\n\t\n\tSocial.addEventListener(\"complete\", function(e){\n\t\tTi.API.info(\"complete: \" + e.success);\n\n\t\tif (e.platform == \"activityView\" || e.platform == \"activityPopover\") {\n\t\t\tswitch (e.activity) {\n\t\t\t\tcase Social.ACTIVITY_TWITTER:\n\t\t\t\t\tTi.API.info(\"User is shared on Twitter\");\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase Social.ACTIVITY_CUSTOM:\n\t\t\t\t\tTi.API.info(\"This is a customActivity: \" + JSON.stringify(e));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t});\n}", "function template_fb_share (urlObject) {\n\tFB.ui({\n\t\tmethod: 'share',\n\t\thref: 'http://www.explorainmuebles.com/'+urlObject\n\t}, function(response){});\n}", "async _shareFilm() {\n const { film } = this.state\n\n try {\n await Share.share({ title: film.title, message: film.overview })\n console.log('successfully opened a share');\n } catch (e) {\n console.log('some sort of problem sharing device info out: ', e);\n }\n }", "function share() {\n try {\n $(\"#shareable-url\")[0].value = window[race_view].generate_url();\n }\n catch(e) {\n displayError(e.message);\n $(\"#shareable-url\")[0].value = \"\";\n return;\n }\n $(\"#shorten-url\")[0].style.visibility = \"visible\";\n $('#share-dialog').dialog('open');\n}", "async share() {\n const talkUrl = `${window.location.origin}/talk/${this.talk.id}`;\n if (this.analytics && this.analytics.trackTalkEvent) {\n this.analytics.trackTalkEvent('share', this.talk);\n }\n try {\n await Share.share({\n title: this.talk.title,\n text: `${this.talk.title} by ${this.talk.speaker}`,\n url: talkUrl,\n dialogTitle: 'Share a Leeds Digital Festival Talk',\n });\n } catch (e) {\n try {\n await navigator.clipboard.writeText(talkUrl);\n this.snackbar.open();\n } catch (err) {\n if (this.analytics && this.analytics.trackException) {\n this.analytics.trackException(err);\n }\n }\n }\n }", "function shareSingleItem() {\n share([currentFrame.blob]);\n}", "function shareToFB() {\n\tFB.ui({\n\t\tmethod: 'feed',\n\t\tlink: 'http://weba.cegepsherbrooke.qc.ca/~tia16001/service.php',\n\t\tcaption: 'An example caption',\n\t\t}, function(response){});\n}", "async addShare({ state, dispatch }, shareData) {\n await fb.db\n .collection(\"users\")\n .doc(state.user.auth.uid)\n .collection(\"shares\")\n .doc()\n .set(shareData);\n dispatch(\"getUserShares\", state.user.auth);\n }", "function sipShareScreen() {\n if (SIPml.getWebRtcType() === 'w4a') {\n // Sharing using BFCP -> requires an active session\n if (!oSipSessionCall) {\n txtCallStatus.innerHTML = '<i>No active session</i>';\n return;\n }\n if (oSipSessionCall.bfcpSharing) {\n if (oSipSessionCall.stopBfcpShare(oConfigCall) != 0) {\n txtCallStatus.value = 'Failed to stop BFCP share';\n }\n else {\n oSipSessionCall.bfcpSharing = false;\n }\n }\n else {\n oConfigCall.screencast_window_id = 0x00000000;\n if (oSipSessionCall.startBfcpShare(oConfigCall) != 0) {\n txtCallStatus.value = 'Failed to start BFCP share';\n }\n else {\n oSipSessionCall.bfcpSharing = true;\n }\n }\n }\n else {\n sipCall('call-screenshare' ,StationD);\n }\n }", "function shareOhOnFaceBook (a_id,type)\n{\n var shareurl = 'http://www.facebook.com/sharer.php?u=';\n if(type == 'private')\n shareurl = shareurl + 'http://www.smashed.in/oh/'+a_id;\n else\n shareurl = shareurl + a_id;\n\tshareSocial(shareurl);\n}", "function shareLink(groupID) {\n share.setAttribute(\"value\", `https://jus-watch.web.app/invite.html?${groupID}`); // *** need to change to hosted link \n nominateBtn.addEventListener(\"click\", function (e) {\n e.preventDefault;\n window.location.href = `nominate.html?${groupID}`;\n })\n voteBtn.addEventListener(\"click\", function (e) {\n e.preventDefault;\n window.location.href = `vote.html?${groupID}`;\n })\n chatBtn.addEventListener(\"click\", function (e) {\n e.preventDefault;\n window.location.href = `group-msgs.html?${groupID}`;\n })\n}", "function _____SHARED_functions_____(){}", "fbShareButtonClick() {\n\n\t\tconst quoteMessage= \n\t\t\t(this.state.request) ?\n\t\t\t\t`Fuckinator fuckinated my fucking text from \"${this.state.request}\" to: \"${this.state.response}\"`: null;\n\n\t\twindow.FB.ui({\n\t\t\tmethod: 'share',\n\t\t\thref: 'http://fuckinator.herokuapp.com/',\n\t\t\thashtag: '#fuckinator',\n\t\t\tmobile_iframe: true,\n\t\t\tquote: quoteMessage,\n\t\t}, res => {});\n\t}", "function shareLink(req, res) {\n var link = req.query.link;\n var text = req.query.text || 'Check out this post. ';\n var via = req.query.via || 'dropshape';\n if (link) {\n res.apiMessage(Status.OK, 'redirect to', {redirect: createTwitterRedirect(req, link, text, via)});\n } else {\n res.apiMessage(Status.BAD_REQUEST, 'you must provide a link');\n }\n }", "function shareItem(){\r\n var current = getCurrentEntry();\r\n var currentEntry = current.getElementsByTagName(\"broadcast\")[0];\r\n // var currentEntry = $(\"#current-entry .entry-actions .broadcast\");\r\n simulateClick(currentEntry);\r\n }", "handleShareFieldChange(event) {\n this.shareField = event.detail;\n this.fireEventWithRule();\n }", "shareLinkWithShareDialog() {\n const shareLinkContent = {\n contentType: 'link',\n contentUrl: this.state.link,\n contentDescription: 'Check out this article!'\n };\n\n var tmp = this;\n ShareDialog.canShow(shareLinkContent).then(\n function (canShow) {\n if (canShow) {\n return ShareDialog.show(shareLinkContent);\n }\n }\n ).then(\n function (result) {\n console.log(result);\n if (result.isCancelled) {\n alert('Share operation was cancelled');\n } else {\n // Share operations was a sucess\n }\n },\n function (error) {\n alert('Share failed with error: ' + error.message);\n }\n );\n }", "function onShare(elForm, ev) {\n ev.preventDefault();\n document.getElementById('imgData').value = gCanvas.toDataURL(\"image/jpeg\");\n\n // A function to be called if request succeeds\n function onSuccess(uploadedImgUrl) {\n uploadedImgUrl = encodeURIComponent(uploadedImgUrl)\n document.querySelector('.share').hidden = false;\n document.querySelector('.share').innerHTML = `\n <a class=\"btn\" href=\"https://www.facebook.com/sharer/sharer.php?u=${uploadedImgUrl}&t=${uploadedImgUrl}\" data-trans=\"share\" target=\"_blank\" onclick=\"window.open('https://www.facebook.com/sharer/sharer.php?u=${uploadedImgUrl}&t=${uploadedImgUrl}'); return false;\">\n Share \n </a>`\n }\n\n doUploadImg(elForm, onSuccess);\n}", "function inhype_socialshare(type, post_url, post_title, post_image) {\n\n switch (type) {\n case 'facebook':\n window.open( 'https://www.facebook.com/sharer/sharer.php?u='+post_url, \"facebookWindow\", \"height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0\" );\n break;\n case 'twitter':\n window.open( 'http://twitter.com/intent/tweet?text='+post_title + ' ' + post_url, \"twitterWindow\", \"height=370,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0\" );\n break;\n case 'pinterest':\n window.open( 'http://pinterest.com/pin/create/button/?url='+post_url+'&media='+post_image+'&description='+post_title, \"pinterestWindow\", \"height=620,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0\" );\n break;\n case 'whatsapp':\n window.open( 'https://api.whatsapp.com/send?text='+post_title+' '+post_url, \"whatsupWindow\", \"height=620,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0\" );\n break;\n case 'vk':\n window.open( 'https://vk.com/share.php?url='+post_url+'&title='+post_title+'&description=&image='+post_image, \"vkWindow\", \"height=620,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0\" );\n break;\n case 'linkedin':\n window.open( 'https://www.linkedin.com/shareArticle?url='+post_url+'&title='+post_title, \"linkedinWindow\", \"height=620,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0\" );\n break;\n case 'reddit':\n window.open( 'https://reddit.com/submit?url='+post_url, \"linkedinWindow\", \"height=620,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0\" );\n break;\n default:\n window.location.href=post_url;\n\n break;\n\n }\n\n return false;\n }", "function share($id){\n\tvar arrData = {\"messageID\" : $id};\n\tsendRequest(\"ajaxShareMessage\", function(response,status,ajaxObj){\n\t\t\tdocument.location.reload();\n\t},arrData);\n}", "function handleShareButton() {\n // DOM references\n const button = document.querySelector('.share-cta');\n const appleIcon = button.querySelector('.apple-icon');\n const androidIcon = button.querySelector('.android-icon');\n const canonical = document.querySelector('link[rel=\"canonical\"]');\n\n // Feature detection to see if the Web Share API is supported.\n if (!('share' in navigator)) {\n return;\n }\n\n // Find out if the user is on a device made by Apple and, if so, switch the icon.\n if (/Mac|iPhone/.test(navigator.platform)) {\n appleIcon.classList.remove('hidden');\n androidIcon.classList.add('hidden');\n }\n\n button.addEventListener('click', async () => {\n // Title and text are identical, since the title may actually be ignored.\n const title = document.title;\n const text = document.title;\n // Use the canonical URL, if it exists, else, the current location.\n const url = canonical?.href || location.href;\n\n gtag('event', 'WebShare', {\n 'event_category': 'clicks',\n 'event_label': url,\n 'transport_type': 'beacon',\n 'value': 1\n })\n\n try {\n await navigator.share({\n url,\n text,\n title,\n });\n return;\n } catch (err) {\n // If the user cancels, an `AbortError` is thrown.\n if (err.name !== \"AbortError\") {\n console.error(err.name, err.message);\n gtag('event', 'error', {\n 'event_category': 'WebShare',\n 'event_label': err.message,\n 'transport_type': 'beacon',\n 'value': 1\n })\n }\n }\n });\n button.classList.remove('hidden');\n}", "function sesblogsendQuickShare(url){\n\tif(!url)\n\t\treturn;\n\tsesJqueryObject('.sesbasic_popup_slide_close').trigger('click');\n\t(new Request.HTML({\n method: 'post',\n 'url': url,\n 'data': {\n format: 'html',\n\t\t\t\tis_ajax : 1\n },\n onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) {\n //keep Silence\n\t\t\t\tshowTooltip('10','10','<i class=\"fa fa-envelope\"></i><span>'+(en4.core.language.translate(\"Blog shared successfully.\"))+'</span>','sesbasic_message_notification');\n }\n })).send();\n}", "function social_share(network)\n{\n var intent;\n switch (network)\n {\n case 'diaspora':\n intent = 'https://sharetodiaspora.github.io/?title=Look%20at%20this%20OpenBeerMap!&url=';\n break;\n case 'twitter':\n intent = 'https://twitter.com/intent/tweet?text=Look%20at%20this%20OpenBeerMap!&hashtags=openbeermap,beer,osm&url='\n break;\n case 'facebook':\n intent = 'https://www.facebook.com/sharer/sharer.php?p[url]=';\n break;\n default:\n return false;\n }\n window.location.assign(intent + document.URL);\n}", "function Share() {\n classCallCheck(this, Share);\n\n this.ClassName = {\n BASE: 'odo-share'\n };\n\n this.services = services;\n\n // An array of share data objects. These objects may contain information\n // regarding the root element, and beforeSend and afterSend functionality.\n this.shares = [];\n\n this._registerShareButtons();\n }", "static get tag() {\n return \"haxcms-share-dialog\";\n }", "function appendShareData (data, channel) {\n\n var detailUrl = data['detailUrl'];\n if(detailUrl && detailUrl.length) {\n if(detailUrl.indexOf('?') < 0) {\n detailUrl += ('?channel=' + channel);\n }\n else {\n detailUrl += ('&channel=' + channel);\n }\n\n data['detailUrl'] = detailUrl;\n }\n\n\n\n // 兼容以前客户端与江俊定义好的协议。\n if(data['detailUrl'] && data['detailUrl'].length) {\n data['shareUrl'] = data['detailUrl'];\n }\n // share in wx app.\n else if(data['link'] && data['link'].length) {\n data['shareUrl'] = data['link'];\n }\n\n if(data['desc'].length) {\n data['content'] = data['desc'];\n }\n else if(data['title'].length) {\n data['content'] = data['title'];\n }\n\n // 将分享URL添加到分享内容里面去。\n if(UP.W.Cordova.isIos && data.detailUrl && data.detailUrl.length) {\n data.content = data.content + data.detailUrl;\n }\n /****新浪分享添加url在分享内容中去-gaoyu***/\n var isAndroid=navigator.userAgent.indexOf('Android') > -1 || navigator.userAgent.indexOf('Linux') > -1;\n if(channel==1&&isAndroid){\n data.content = data.content + data.detailUrl;\n }\n /****新浪分享添加url在分享内容中去-gaoyu***/\n return data;\n}", "shareAllSocialData(share) {\r\n return this.clone(ProfileLoader_1, `getuserprofile/shareallsocialdata(${share})`).postCore();\r\n }", "function shareFile(){\n var filePath = $(this).closest('tr').attr('path');\n\n $(\"#emailModal\").modal({backdrop: 'static'});\n\n shared_list = []; //re-initialise the shared list of users\n\n $('#emailModal').one('hidden.bs.modal',function(event){\n if (shared_list.length>0)\n {\n var oReq = new XMLHttpRequest();\n oReq.open(\"POST\",CLOUD_SERVER+'get_share_params',true);\n oReq.responseType = \"json\";\n oReq.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n\n //removing duplicates\n uniqueSharedList = [];\n $.each(shared_list, function(i, el){\n if($.inArray(el, uniqueSharedList) === -1) uniqueSharedList.push(el);\n });\n\n var request_data = {\n 'owner':user_id,\n 'filePath':filePath,\n 'email':uniqueSharedList\n };\n\n oReq.onload = function(oEvent){\n //console.log(oReq.response);\n if(oReq.response.success)\n {\n if(oReq.response.shared_users.length>0)\n {\n get_share_link(filePath,function(url){\n get_pps_params(function(ppsParams)\n {\n common.naclModule.postMessage({\n action: 'share',\n ppsParams: ppsParams,\n metadata: oReq.response,\n shared_url: url\n });\n });\n });\n }\n else\n console.log(\"No valid crest users to share with\");\n }\n else\n console.log(oReq.response);\n };\n oReq.send(JSON.stringify(request_data));\n }\n else\n console.log(\"No users selected to share with\");\n });\n}", "function updateShareWithGallery(action) {\n var progName = $('#share-with-gallery').data('progName');\n PROGRAM.shareProgramWithGallery(progName, function(result) {\n if (result.rc === 'ok') {\n LOG.info(\"share program \" + progName + \" with Gallery\");\n $('#progList').find('button[name=\"refresh\"]').trigger('click');\n }\n MSG.displayInformation(result, result.message, result.message, progName);\n }); \n $('#share-with-gallery').modal(\"hide\");\n }", "function shareApp(){\n // this is the complete list of currently supported params you can pass to the plugin (all optional)\n //alert(share_text);\nvar options = {\n message: \"Download app ya Global Radio usikilize radio na upate habari na matukio kupitia simu yako ya mkononi. \" + app_link, // not supported on some apps (Facebook, Instagram)\n subject: '+255 Global Radio', // fi. for email\n files: ['', ''], // an array of filenames either locally or remotely\n url: '',\n chooserTitle: 'Share using' // Android only, you can override the default share sheet title,\n };\n\n var onSuccess = function(result) {\n console.log(\"Share completed? \" + result.completed); // On Android apps mostly return false even while it's true\n console.log(\"Shared to app: \" + result.app); // On Android result.app since plugin version 5.4.0 this is no longer empty. On iOS it's empty when sharing is cancelled (result.completed=false)\n };\n\n var onError = function(msg) {\n console.log(\"Sharing failed with message: \" + msg);\n };\n\n window.plugins.socialsharing.shareWithOptions(options, onSuccess, onError);\n}", "function updateShareOptions(evt) {\n\tlet presentationId = evt.target.parentNode.id;\n\tlet shareOption = document.getElementById('selectShare' + presentationId).value;\n\n\tlet data = JSON.stringify({\n\t\tpresentation_id: presentationId,\n\t\tuser_id: userid,\n\t\tshare_option: shareOption\n\t});\n\n\t// sending request to server to change the share option\n\tfetch(PRESENTATIONS_URL + `/${presentationId}/sharing`, {\n\t\tmethod: 'POST',\n\t\tbody: data,\n\t\theaders: {\n\t\t\t\"Content-Type\": \"application/json; charset=utf-8\",\n\t \"Authorization\": token\n\t\t}\n\t}).then(response => {\n\t\tif (response.status < 400) { // option updated\n\t\t\tif (shareOption == SHARE_INDIVIDUAL) {\n\t\t\t\t//let shareLink = 'http://localhost:8080/presentation.html?' + presentationId; <-- local link\n\t\t\t\tlet shareLink = 'https://once-upon-a-slide.herokuapp.com/presentation.html?' + presentationId;\n\t\t\t\tshowConfirmPopup(`The sharing option is updated to Individual. With sharing this link, other users can view and edit this presentation: <a href=\"${shareLink}\">${shareLink}</a>`);\n\t\t\t} else {\n\t\t\t\tshowConfirmPopup('The sharing option is updated to ' + getShareOption(shareOption));\n\t\t\t}\n\t\t} else if (response.status === 403) { \t// user not authorized\n\t\t\tshowErrorPopup('You are not authorized for setting this shareOption.');\n\t\t} else { // other (server) error\n\t\t\tshowErrorPopup('The share option could not be set, please try again later.');\n\t\t}\n\t}).catch(error => console.error(error));\n}", "function shareApp(){\n // this is the complete list of currently supported params you can pass to the plugin (all optional)\n //alert(share_text);\nvar options = {\n message: \"Download app ya Global Radio upate habari na matukio. \" + app_link, // not supported on some apps (Facebook, Instagram)\n subject: '+255 Global Radio', // fi. for email\n files: ['', ''], // an array of filenames either locally or remotely\n url: '',\n chooserTitle: 'Share using' // Android only, you can override the default share sheet title,\n };\n \n var onSuccess = function(result) {\n console.log(\"Share completed? \" + result.completed); // On Android apps mostly return false even while it's true\n console.log(\"Shared to app: \" + result.app); // On Android result.app since plugin version 5.4.0 this is no longer empty. On iOS it's empty when sharing is cancelled (result.completed=false)\n };\n \n var onError = function(msg) {\n console.log(\"Sharing failed with message: \" + msg);\n };\n \n window.plugins.socialsharing.shareWithOptions(options, onSuccess, onError);\n}", "function socialShare(s){\n console.log(s);\n // Twitter API\n twitterButton.addEventListener('click',function(){\n sharingText = {\n 'score' : `${s}`,\n 'text' : `I scored in TypeR test ! Check out typer and test your typing speed !`\n }\n tweet.setAttribute('href', `https://twitter.com/intent/tweet?text=Check%20out%20TypeR%20!%20My%20typing%20speed%20is%20${sharingText.score}WPM.`);\n })\n // Facebook API\n fbBtn.addEventListener('click',function(){\n fbPost.setAttribute('href', `https://www.facebook.com/sharer/sharer.php?u=&quote=Check out typer ! My typing speed is ${s} WPM`);\n })\n}", "function ajaxResultArticleShare(data){\n\t$Jq('#shareDiv').html(data);\n\timport_contacts_link = true;\n\tConfirmation('shareDiv', 'formEmailList', Array(), Array(), Array());\n}", "function share() {\n if (currentView) {\n return currentView.share();\n }\n return null;\n }", "async function share(itemID, expires, usages, callback) {\n const shareID = uuidv4();\n var date = new Date();\n date.setDate(date.getDate() + expires)\n expires = date.toISOString();\n\n db.createData(\"shared\", {\n shareID: shareID,\n sharedItem: itemID,\n usages: usages,\n expires: expires\n }, function () {\n if (typeof callback === 'function') {\n callback(null, shareID);\n }\n });\n\n}", "function shareConf() {\n saveSession()\n storeConfigBackend(getConfig(), (result) => {\n if (result.succeed) {\n var url = window.location.protocol + \"//\" + window.location.host + \"?conf=\" + result.hash\n $('#shareLinkModal').modal('show');\n $('#share-link-input').val(url);\n } else {\n toastr.error(\"Unable to share your session :(\", \"Error\")\n }\n })\n}", "function fbShareAsLike() {\n\t// nebo s obrazkem\n\tFB.ui({\n\t\tmethod: 'share_open_graph',\n\t\taction_type: 'og.likes',\n\t\taction_properties: JSON.stringify({\n//\t\tobject:'http://x51.cz',\n\t\tobject: url_share,\n\t})\n\t}, function(response){\n\t\tconsole.log(response);\n\t});\n}", "openSystemShare_() {\n const {navigator} = this.win_;\n const shareData = {\n url: Services.documentInfoForDoc(this.parentEl_).canonicalUrl,\n text: this.win_.document.title,\n };\n navigator.share(shareData).catch((e) => {\n user().warn(TAG, e.message, shareData);\n });\n }", "function generateShareBar() {\r\n\t\t\tvar jq = null;\r\n\t\t\tvar code = null;\r\n\t\t\t// twitter\r\n\t\t\tif (self.options.share.twitter.enabled) {\r\n\t\t\t\tcode = '<li><a href=\"https://mobile.twitter.com/compose/tweet?status=' + encodeURI(self.options.share.shareLink) + '\" target=\"_blank\" class=\"jp-twitter-share\"><i class=\"icon-twitter icon-2x\"></i></a></li>';\r\n\t\t\t\tjq = $(code).appendTo(self.bbgCss.jq.share);\r\n\t\t\t\tjq.children(\"a\").on(\"click\",function(e) {\r\n\t\t\t\t\ttrackTwitter(getMediaTitleForTracking());\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t// facebook\r\n\t\t\tif (self.options.share.facebook.enabled) {\r\n\t\t\t\tcode = '<li><a href=\"https://www.facebook.com/sharer/sharer.php?u=' + encodeURI(self.options.share.shareLink) + '\" target=\"_blank\" class=\"jp-facebook-share\"><i class=\"icon-facebook icon-2x\"></i></a></li>';\r\n\t\t\t\tjq = $(code).appendTo(self.bbgCss.jq.share);\r\n\t\t\t\tjq.children(\"a\").on(\"click\",function(e) {\r\n\t\t\t\t\ttrackFacebook(getMediaTitleForTracking());\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t// email\r\n\t\t\tif (self.options.share.email.enabled) {\r\n\t\t\t\tcode = '<a class=\"jp-email-share\" target=\"_blank\" href=\"mailto:?subject=' + self.options.share.email.subject + '&body=' + self.options.share.email.body + '%0A%0A' + self.options.share.shareLink + '\"><i class=\"icon-envelope icon-2x\"></i></a>';\r\n\t\t\t\tjq = $('<li>' + code + '</li>').appendTo(self.bbgCss.jq.share);\r\n\t\t\t\tjq.children(\"a\").on(\"click\",function(e) {\r\n\t\t\t\t\ttrackEmail(getMediaTitleForTracking());\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t// embed\r\n\t\t\tif (self.options.share.embed.enabled) {\r\n\t\t\t\tif (self.bbgCss.jq.sharePanel && self.bbgCss.jq.sharePanel.length > 0) {\r\n\t\t\t\t\t$(self.bbgCss.css.sharePanel + ' .instructions').html(self.options.share.embed.instructions);\r\n\t\t\t\t\t$(self.bbgCss.css.sharePanel + ' .share-hide').val(self.options.share.embed.hide);\r\n\t\t\t\t\t// use existing share panel\r\n\t\t\t\t\tif (!self.bbgCss.jq.share || self.bbgCss.jq.share.length == 0) {\r\n\t\t\t\t\t\t// add to share bar and save to bbgCss for usage later\r\n\t\t\t\t\t\tself.bbgCss.jq.shaare.append('<a href=\"javascript:;\" class=\"jp-share\">Share</a>');\r\n\t\t\t\t\t\tself.bbgCss.css.share = self.bbgCss.css.ancestor + ' .jp-share';\r\n\t\t\t\t\t\tself.bbgCss.jq.share = $(self.bbgCss.css.share);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// open share panel upon share link click\r\n\t\t\t\t\tself.bbgCss.jq.share.on('click',function(e) {\r\n\t\t\t\t\t\tdisplayShareOptions();\r\n\t\t\t\t\t});\r\n\t\t\t\t\tself.bbgCss.jq.share.show();\r\n\t\t\t\t\tself.bbgCss.jq.sharePanel.hide();\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// no share panel defined\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}", "function respondToShare(event) {\n event.respondWith(\n fetch('share-target-destination.template.html')\n .then(function (response) {\n return response.text()\n .then(function(page) {\n\n return event.request.formData()\n .then(function(formData) {\n const title = formData.get('received_title') || '';\n const text = formData.get('received_text') || '';\n const url = formData.get('received_url') || '';\n\n const init = {\n status: 200,\n statusText: \"OK\",\n headers: {'Content-Type': 'text/html'}\n };\n\n let body = page\n .replace('{{generation_location}}', 'client-side')\n .replace(\"{{received_title}}\", title)\n .replace(\"{{received_text}}\", text)\n .replace(\"{{received_url}}\", url);\n\n const file_fields = [\n \"received_html_files\",\n \"received_css_files\"\n ];\n\n let field_index = 0;\n\n let files = undefined;\n let file_contents = '';\n let index = 0;\n\n function prepareField() {\n files = formData.getAll(file_fields[field_index]); // sequence of File objects\n file_contents = '';\n index = 0;\n }\n\n prepareField();\n\n return new Promise(function(resolve, reject) {\n function progress() {\n while (index === files.length) {\n body = body\n .replace('{{' + file_fields[field_index] + '}}', file_contents);\n\n ++field_index;\n if (field_index === file_fields.length) {\n resolve(new Response(body, init));\n return;\n }\n prepareField();\n }\n\n const fileReader = new FileReader();\n fileReader.onload = function(fileLoadedEvent) {\n const textFromFileLoaded = fileLoadedEvent.target.result;\n if (index > 0) {\n file_contents += ', ';\n }\n file_contents += textFromFileLoaded;\n index += 1;\n progress();\n };\n fileReader.readAsText(files[index], \"UTF-8\");\n }\n\n progress();\n });\n })\n })\n })\n );\n }", "function presenterDeskshareHasStarted() {\n // references a functiion in the global namespace inside verto_extension.js\n // that we load dynamically\n vertoWatchVideo();\n}", "isSharing() {\n return this.data()[\"sharing\"]\n }", "function sharemyprofile()\n{\n\tif(window.localStorage['loggedin']=='1'){\n\t\tvar user_data = JSON.parse(window.localStorage['userdata']);\n\t\tvar typeUser = \"sitter\";\n\t\tif(window.localStorage['user_type']== \"user_parent\")\n\t\t\ttypeUser = \"parent\";\n\t\twindow.plugins.socialsharing.share(user_data.firstname+': Mon profil',\n\t null,\n\t null,\n\t 'http://codeuridea.net/kidssitter/'+typeUser+user_data.id)\n\t }\n}", "function shareOnWX () {\n\n console.log('shareOnWX');\n\n if(typeof wx === 'undefined') {\n seajs.use('https://res.wx.qq.com/open/js/jweixin-1.0.0.js', function(wx){\n fetchJsTicket(wx);\n });\n }\n else {\n fetchJsTicket(wx);\n }\n }", "touch () {\n window.open(this.shareLink, '_blank')\n\n this.emit('open')\n }", "function shareOne(type, fromReference, publicAccess, to, replaceFlag) {\n var from = getObject(type, fromReference);\n if (!from || !from.id) {\n log.error(\"dhis.shareOne can't find \" + type + \" to share \" + util.inspect(fromReference));\n return;\n }\n //log.trace(\"dhis.shareOne type \" + type + \" from \" + from.name + \" publicAccess \" + publicAccess + \" to \" + util.inspect(to) + \" replaceFlag=\" + replaceFlag);\n var sharing;\n var acl;\n if (from.userGroupAccesses) { // See if ACL is already in the \"from\" object.\n sharing = {meta: {allowPublicAccess: true, allowExternalAccess: false},\n object: {id: from.id, name: from.name, publicAccess: publicAccess, externalAccess: false, userGroupAccesses: []}};\n acl = sharing.object.userGroupAccesses;\n for (var i in from.userGroupAccesses) {\n var a = from.userGroupAccesses[i];\n acl.push({id: a.id, access: a.access});\n }\n }\n else {\n sharing = rest.get(\"/api/sharing?type=\" + type + \"&id=\" + from.id);\n acl = sharing.object.userGroupAccesses;\n if (acl == undefined) // No access control list yet for this object, create one\n {\n acl = [];\n sharing.object.userGroupAccesses = acl;\n }\n }\n var aclMap = {}; // Convert acl to a map by shared object id.\n for (var i in acl) {\n aclMap[acl[i].id] = {access: acl[i].access, displayName: acl[i].displayName};\n }\n var updateNeeded = false;\n var toArray = [].concat(to); // \"to\" could be either a single object or an array of objects.\n for (var i in toArray) {\n var id = getObject(\"userGroup\", toArray[i].group ? toArray[i].group : toArray[i]).id;\n if (id == undefined) {\n log.error(\"dhis.shareOne can't find shareTo userGroup \" + util.inspect(toArray[i]));\n return;\n }\n var access = toArray[i].groupAccess ? toArray[i].groupAccess : \"r-------\";\n if (aclMap[id] != access) {\n aclMap[id] = access;\n updateNeeded = true;\n }\n }\n if (replaceFlag) { // If replaceFlag, remove any ACL map entries that are not in the toArray:\n toMap = {}; // Convert toArray to a map by shared object id, so we can look up in it.\n for (var i in toArray) {\n var id = getObject(\"userGroup\", toArray[i].group ? toArray[i].group : toArray[i]).id;\n toMap[id] = true; // Value doesn't matter -- just indicate if present.\n }\n for (var i in acl) {\n if (!toMap[acl[i].id]) {\n log.trace(\"dhis.shareOne removing \" + acl[i].id)\n delete aclMap[acl[i].id];\n updateNeeded = true;\n }\n }\n }\n if (publicAccess && sharing.object.publicAccess != publicAccess) {\n updateNeeded = true;\n sharing.object.publicAccess = publicAccess;\n }\n if (updateNeeded) {\n acl = []; // Convert map back to acl.\n for (var property in aclMap) {\n if (aclMap.hasOwnProperty(property)) {\n acl.push({id: property, access: aclMap[property].access, displayName: aclMap[property].displayName});\n }\n }\n sharing.object.publicAccess = publicAccess;\n sharing.object.userGroupAccesses = acl;\n rest.post(\"/api/sharing?type=\" + type + \"&id=\" + from.id, sharing);\n var changedObject = rest.get(\"/api/\" + type.plural() + \"/\" + from.id + \"?fields=:all\");\n updateCache(type, changedObject);\n }\n}", "function Share_trip(Share_id)\n{\n console.log(\"share tour\");\n \n var link =\"http://wms-dev.com/xplore/index.php/site/Shared?Tour_Id=\";\n \n if(typeof Share_id !== 'undefined')\n {\n link =link + Share_id;\n }\n else\n {\n return;\n }\n \n link=encodeURI(link);\n //alert(link);\n facebookConnectPlugin.showDialog(\n {\n method: \"feed\",\n link: link,\n caption: 'Check This Out'\n },\n function (userData_2) {\n console.log(userData_2);\n },\n function (error) {\n swal(\"\" + error);\n });\n //alert(\"share\");\n}", "shareWith(loginNames, role = SharingRole.View, requireSignin = false, shareEverything = false, emailData) {\r\n const dependency = this.addBatchDependency();\r\n return this.getShareable().then(shareable => {\r\n dependency();\r\n return shareable.shareWith(loginNames, role, requireSignin, shareEverything, emailData);\r\n });\r\n }", "openShareUrlModal() {\n this.$store.commit(SELECT_BROWSER_ITEM, this.item);\n this.$store.commit(SHOW_SHARE_MODAL);\n }", "openShareUrlModal() {\n this.$store.commit(SELECT_BROWSER_ITEM, this.item);\n this.$store.commit(SHOW_SHARE_MODAL);\n }", "openShareUrlModal() {\n this.$store.commit(SELECT_BROWSER_ITEM, this.item);\n this.$store.commit(SHOW_SHARE_MODAL);\n }", "function akst_share(id, url, title) {\n\tvar form = $('akst_form');\n\tvar post_id = $('akst_post_id');\n\t\n\tif (form.style.display == 'block' && post_id.value == id) {\n\t\tform.style.display = 'none';\n\t\treturn;\n\t}\n\t\n\tvar link = $('akst_link_' + id);\n\tvar offset = Position.cumulativeOffset(link);\n\n\t$(\"akst_delicious\").href = akst_share_url(\"http://del.icio.us/post?url={url}&title={title}\", url, title);\n\t$(\"akst_digg\").href = akst_share_url(\"http://digg.com/submit?phase=2&url={url}&title={title}\", url, title);\n\t$(\"akst_furl\").href = akst_share_url(\"http://furl.net/storeIt.jsp?u={url}&t={title}\", url, title);\n\t$(\"akst_netscape\").href = akst_share_url(\" http://www.netscape.com/submit/?U={url}&T={title}\", url, title);\n\t$(\"akst_yahoo_myweb\").href = akst_share_url(\"http://myweb2.search.yahoo.com/myresults/bookmarklet?u={url}&t={title}\", url, title);\n\t$(\"akst_stumbleupon\").href = akst_share_url(\"http://www.stumbleupon.com/submit?url={url}&title={title}\", url, title);\n\t$(\"akst_google_bmarks\").href = akst_share_url(\" http://www.google.com/bookmarks/mark?op=edit&bkmk={url}&title={title}\", url, title);\n\t$(\"akst_technorati\").href = akst_share_url(\"http://www.technorati.com/faves?add={url}\", url, title);\n\t$(\"akst_blinklist\").href = akst_share_url(\"http://blinklist.com/index.php?Action=Blink/addblink.php&Url={url}&Title={title}\", url, title);\n\t$(\"akst_newsvine\").href = akst_share_url(\"http://www.newsvine.com/_wine/save?u={url}&h={title}\", url, title);\n\t$(\"akst_magnolia\").href = akst_share_url(\"http://ma.gnolia.com/bookmarklet/add?url={url}&title={title}\", url, title);\n\t$(\"akst_reddit\").href = akst_share_url(\"http://reddit.com/submit?url={url}&title={title}\", url, title);\n\t$(\"akst_windows_live\").href = akst_share_url(\"https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url={url}&title={title}&top=1\", url, title);\n\t$(\"akst_tailrank\").href = akst_share_url(\"http://tailrank.com/share/?link_href={url}&title={title}\", url, title);\n\t$(\"akst_slashdot\").href = akst_share_url(\"http://slashdot.org/bookmark.pl?url={url}&title={title}\", url, title);\n\t$(\"akst_spurl\").href = akst_share_url(\"http://spurl.net/spurl.php?url={url}&title={title}\", url, title);\n\n\tpost_id.value = id;\n\n\tform.style.left = offset[0] + 'px';\n\tform.style.top = (offset[1] + link.offsetHeight + 3) + 'px';\n\tform.style.display = 'block';\n}", "function shareProfile(){\n\t$(\"div#share\").fadeToggle();\n}", "share(path){\n const FACEBOOK_ICON = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAAAYFBMVEUAAAAAQIAAWpwAX5kAX5gAX5gAX5gAXJwAXpgAWZ8AX5gAXaIAX5gAXpkAVaoAX5gAXJsAX5gAX5gAYJkAYJkAXpoAX5gAX5gAX5kAXpcAX5kAX5gAX5gAX5YAXpoAYJijtTrqAAAAIHRSTlMABFis4vv/JL0o4QvSegbnQPx8UHWwj4OUgo7Px061qCrcMv8AAAB0SURBVEjH7dK3DoAwDEVRqum9BwL//5dIscQEEjFiCPhubziTbVkc98dsx/V8UGnbIIQjXRvFQMZJCnScAR3nxQNcIqrqRqWHW8Qd6cY94oGER8STMVioZsQLLnEXw1mMr5OqFdGGS378wxgzZvwO5jiz2wFnjxABOufdfQAAAABJRU5ErkJggg==\";\n let shareImageBase64 = {\n title: \"React Native\",\n message: \"Hola mundo\",\n url: FACEBOOK_ICON,\n subject: \"Share Link\" // for email\n };\n Share.open(shareImageBase64);\n }", "shareAllSocialData(share) {\r\n return this.profileLoader.shareAllSocialData(share);\r\n }", "function get_share_link(filePath,callback)\n{\n var url = \"https://api.dropbox.com/1/shares/auto\"+filePath+\"?short_url=false\";\n var args = {\n headers:{\n Authorization: 'Bearer '+getAccessToken()\n },\n url: url,\n crossDomain: true,\n crossOrigin: true,\n contentType: 'application/x-www-form-urlencoded',\n type: 'POST',\n dataType: 'json',\n success: function (data) {\n //console.log(data.url.replace('dl=0','raw=1'));\n callback(data.url.replace('dl=0','raw=1'));\n }\n };\n $.ajax(args);\n}", "function showShareModal() {\n \tcurrent_username = document.getElementsByClassName(\"username\")[0].textContent\n \tcurrent_modal = document.getElementsByClassName(\"modal\")[0];\n\t\tdocument.getElementsByClassName(\"modal__title\")[0].textContent = \"Share \" + current_username +\"'s post\";\n\t\tshare_text = document.getElementsByClassName(\"post__body\")[0].textContent\n\t\tdocument.getElementsByClassName(\"modal__body\")[0].textContent = share_text\n\t\tcurrent_modal.style.display = \"block\";\n\t\tcurrent_modal.nextElementSibling.style.display = \"block\";\n\t\tdocument.getElementsByClassName(\"modal__close\")[0].childNodes[0].addEventListener(\"click\", hideModalButton);\n\t\tdocument.getElementsByClassName(\"modal\")[0].addEventListener(\"click\", hideModalScreen);\n }", "function linkshare() {\r\n fx('pageUrl').fadeIn(250);\r\n fx('bg2').fadeIn(500);\r\n if (!channel.id || !location.hash.split('#!/')[1])changeText(doc.q('#pageUrl input'),'https://youcount.github.io/');\r\n}", "function shareRow(id) {\r\n\tajax('?raw=json&id='+id, shareCallback, true);\r\n\tdelClass(windowShare, 'hidden');\r\n}", "addShareButton(shareButtonEle) {\n shareButtonEle.addEventListener(\"click\", () => {\n let textareaEle = this.postcardEle.getElementsByTagName(\"textarea\")[0];\n this.postcardData.message = textareaEle.value;\n const xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"/share\", true);\n xhr.addEventListener('loadend', (e) => {\n console.log(xhr.responseText);\n window.location.href = \"heartbreaking-display\";\n });\n xhr.setRequestHeader(\"Content-Type\", \"application/json;charset=UTF-8\");\n xhr.send(JSON.stringify(this.postcardData));\n });\n }", "function share_link() {\n let postUrl = encodeURI(document.location.href)\n let postTitle = encodeURI('Hi, please click here to join the meeting: ')\n facebookBtn.setAttribute(\n 'href',\n `https://www.facebook.com/sharer.php?u=${postUrl}`\n )\n linkedinBtn.setAttribute(\n 'href',\n `https://www.linkedin.com/shareArticle?url=${postUrl}&title=${postTitle}`\n )\n whatsappBtn.setAttribute(\n 'href',\n `https://wa.me/?text=${postTitle} ${postUrl}`\n )\n}", "function showShareDialog() {\n BootstrapDialog.show({\n title: '<i class=\"fa fa-share-alt\"></i> Share',\n //size: BootstrapDialog.SIZE_WIDE,\n message: function (dialog) {\n var $message = ShareDialogContent();\n return $message;\n },\n onshown: function () {\n $('#linkUrl').val(document.URL);\n tabRelevantBtns();\n socialIcons();\n },\n buttons: [{\n id: 'send-mail-btn',\n icon: 'glyphicon glyphicon-envelope',\n label: 'Send email',\n cssClass: 'btn-primary tab-btns',\n action: function (dialogRef) {\n postShareForm();\n }\n },\n\n {\n id: 'copy-link-btn',\n icon: 'glyphicon glyphicon-copy',\n label: 'Copy this link',\n cssClass: 'btn-primary tab-btns',\n action: function (dialogRef) {\n copyToClipBoard();\n }\n },\n {\n id: 'share-opts-btn',\n icon: 'fa fa-share',\n label: 'More',\n cssClass: 'btn-primary tab-btns',\n action: function (dialogRef) {\n moreSocialIcons();\n }\n },\n {\n label: 'Cancel',\n action: function (dialogItself) {\n dialogItself.close();\n }\n }],\n onhidden: function (dialogRef) {\n printPagesCount = 0; // reset selected images to print\n $('#mag-container').focus().select();\n }\n });\n}", "shareObject(url, loginNames, role, emailData, group, propagateAcl = false, includeAnonymousLinkInEmail = false, useSimplifiedRoles = true) {\r\n return this.clone(SharePointQueryableShareable, null).shareObject({\r\n emailData: emailData,\r\n group: group,\r\n includeAnonymousLinkInEmail: includeAnonymousLinkInEmail,\r\n loginNames: loginNames,\r\n propagateAcl: propagateAcl,\r\n role: role,\r\n url: url,\r\n useSimplifiedRoles: useSimplifiedRoles,\r\n });\r\n }", "function sipShareScreen() {\n if (SIPml.getWebRtcType() === 'w4a') {\n // Sharing using BFCP -> requires an active session\n if (!oSipSessionCall) {\n return \"No active session\";\n }\n if (oSipSessionCall.bfcpSharing) {\n if (oSipSessionCall.stopBfcpShare(oConfigCall) != 0) {\n return 'Failed to stop BFCP share';\n }\n else {\n oSipSessionCall.bfcpSharing = false;\n }\n }\n else {\n oConfigCall.screencast_window_id = 0x00000000;\n if (oSipSessionCall.startBfcpShare(oConfigCall) != 0) {\n return 'Failed to start BFCP share';\n }\n else {\n oSipSessionCall.bfcpSharing = true;\n }\n }\n }\n else {\n sipCall('call-screenshare');\n }\n}", "function publishShareEvent (activity) {\n console.log('publishShareEvent()')\n return new Promise((resolve, reject) => {\n wolkenkit\n .then((eventStore) => {\n eventStore.activityPub.activity().share(activity)\n .failed(err => reject(err))\n .delivered(() => resolve(activity));\n }).catch((error) => {\n console.log(error);\n })\n });\n}", "function registerButtonHandlers() {\n // document.getElementById('shareMeTargetPicker').addEventListener('click', function () {\n // if (liff.isApiAvailable('shareTargetPicker')) {\n // liff.shareTargetPicker([{\n // 'type': 'text',\n // 'text': 'Hello, I am ' + PROFILE.displayName\n // }, {\n // 'type': 'image',\n // 'originalContentUrl': PROFILE.pictureUrl,\n // 'previewImageUrl': PROFILE.pictureUrl\n // }]).then(function (res) {\n // if (res) alert('Message sent!');\n // }).catch(function (res) {\n // console.error(res);\n // });\n // }\n // });\n\n // login call, only when external browser is used\n document.getElementById('liffLoginButton').addEventListener('click', function () {\n if (!liff.isLoggedIn()) {\n liff.login(); \n }\n });\n\n // logout call only when external browse\n document.getElementById('liffLogoutButton').addEventListener('click', function () {\n if (liff.isLoggedIn()) {\n liff.logout();\n window.location.reload();\n }\n });\n /*return random int */\n function getRandomInt(max) {\n return Math.floor(Math.random() * Math.floor(max));\n }\n function WhoAmI(username){\n user = player_arr[username];\n return user;\n }\n function get_cur_room_id(){\n username = player_name_arr[0];\n user = player_arr[username];\n return user.room_id;\n }\n /*update room id context*/\n document.getElementById('RoomId').addEventListener('keyup', function (event) {\t\n document.getElementById('RoomId').textContent = event.target.value;\t\n });\n /*update user name context*/\n document.getElementById('UserId').addEventListener('keyup', function (event) {\t\n document.getElementById('UserId').textContent = event.target.value;\t\n });\n /*update CustomCategory name context*/\n document.getElementById('CustomCategory').addEventListener('keyup', function (event) {\t\n document.getElementById('CustomCategory').textContent = event.target.value;\t\n });\n\n /*Show player name */\n function showName(player_arr){\n temp = \"Players In Room : \";\n output = temp.concat(player_arr);\n cls_e = document.getElementById('PlayerName');\n cls_e.innerHTML = output;\n return;\n };\n\n /*add new player */\n document.getElementById('AddBtn').addEventListener('click', function (event) {\t\n const username = document.getElementById('UserId').textContent || ' ';\n if(username == ' '){\n alert(\"Please input username!\");\n return;\n }\n var user = new Player(username);\n room = room_arr[current_id-1];\n if(room != undefined){\n user.main_pool = room.pool;\n }\n user.set_player(-1);\n player_arr[username] = user;\n player_name_arr.push(username);\n\n showName(player_name_arr);\n });\n\n /*drawing room number */\n function drawRoomnum(username){\n var user = WhoAmI(username);\n var roomNum = String(user.room_id);\n var room = room_arr[user.room_id];\n temp = \"Room ID : \";\n roomNum = temp.concat(roomNum);\n roomNum = roomNum.concat(\"<br/>\",\"Game Name :\");\n roomNum = roomNum.concat(\" \",room.game_name);\n cls_e = document.getElementById('UserRoomNum');\n cls_e.innerHTML = roomNum;\n return;\n };\n /*user enter play room */\n function attend_room(id){\n var room = room_arr[id];\n var totalnum = 0;\n if (room == undefined){\n alert(\"Please Add the Room !\");\n return;\n }\n for(var j = 0; j < room.cg_remain_num.length; j++){\n var num = parseInt(room.cg_remain_num[j]);\n totalnum += num;\n }\n // alert(totalnum);\n for(var i = 0; i < player_name_arr.length ; i++){\n var user = WhoAmI(player_name_arr[i]);\n if(i >= totalnum)\n return;\n if(i == 0)\n user.set_host(id);\n else\n user.set_player(id);\n user.main_pool = room.pool;\n }\n }\n /*drawing a player class */\n function drawclass(user){\n var playerclass = user.main_pool.map[user.username];\n while(playerclass == undefined && user.main_pool.num > 0){\n i = getRandomInt(user.main_pool.category.length)\n if(user.main_pool.cg_remain_num[i] != 0){\n user.main_pool.cg_remain_num[i] -= 1;\n user.main_pool.num -= 1;\n playerclass = user.main_pool.category[i];\n user.main_pool.map[user.username] = playerclass;\n }\n }\n return playerclass;\n }\n /*drawing all player class and print*/\n function drawAllclass(){\n var cls_e = document.getElementById('UserClass');\n var str = \"\";\n var roomid = get_cur_room_id();\n for(var i = 0; i < player_name_arr.length ; i++){\n var user = WhoAmI(player_name_arr[i]);\n if (user.room_id != roomid)\n continue;\n var playerclass = drawclass(user);\n var temp = player_name_arr[i].concat(\" : \");\n temp = temp.concat(playerclass);\n temp = temp.concat(\"</br>\");\n str = str.concat(temp);\n }\n cls_e.innerHTML = str;\n }\n /*print all undefined */\n function printAllud(){\n cls_e = document.getElementById('UserClass');\n str = \"\";\n for(var i = 0; i < player_name_arr.length ; i++){\n var user = WhoAmI(player_name_arr[i]);\n var playerclass = \"Undefined\";\n var temp = player_name_arr[i].concat(\" : \");\n temp = temp.concat(playerclass);\n temp = temp.concat(\"</br>\");\n str = str.concat(temp);\n }\n cls_e.innerHTML = str;\n }\n /*print customize category */\n function printCustomCategory(){\n cls_e = document.getElementById('Category');\n str = \"\";\n for(var i = 0; i < category3.length ; i++){\n var temp = category3[i].concat(\" : \");\n temp = temp.concat(String(cg_remain_num3[i]));\n temp = temp.concat(\"</br>\");\n str = str.concat(temp);\n }\n cls_e.innerHTML = str;\n }\n /*user enter play room event trigger*/\n document.getElementById('AttendBtn').addEventListener('click', function (event) {\n const id = document.getElementById('RoomId').textContent || ' ';\n if (id == ' '){\n alert(\"Please input room ID!\");\n return;\n }\n attend_room(id);\n drawAllclass();\n // print roomNum\n drawRoomnum(player_name_arr[0]);\n });\n /*create new room */\n document.getElementById('NewRoom').addEventListener('click', function (event) {\n var user = WhoAmI(player_name_arr[0]);\n var new_room = new Room(current_id,category,cg_remain_num,\"Werewolf\");\n room_arr[current_id] = new_room;\n room = room_arr[current_id];\n user.main_pool = room.pool;\n user.set_host(current_id);\n current_id += 1;\n drawRoomnum(player_name_arr[0]);\n });\n document.getElementById('NewRoom2').addEventListener('click', function (event) {\n var user = WhoAmI(player_name_arr[0]);\n var new_room = new Room(current_id,category2,cg_remain_num2,\"Avalon\");\n room_arr[current_id] = new_room;\n room = room_arr[current_id];\n user.main_pool = room.pool;\n user.set_host(current_id);\n current_id += 1;\n drawRoomnum(player_name_arr[0]);\n });\n document.getElementById('NewRoom3').addEventListener('click', function (event) {\n if(category3.length == 0){\n alert(\"You don't add any element of game!\")\n return;\n }\n var user = WhoAmI(player_name_arr[0]);\n var new_room = new Room(current_id,category3,cg_remain_num3,\"Custom\");\n room_arr[current_id] = new_room;\n room = room_arr[current_id];\n user.main_pool = room.pool;\n user.set_host(current_id);\n current_id += 1;\n drawRoomnum(player_name_arr[0]);\n });\n /*reset game */\n document.getElementById('ResetBtn').addEventListener('click', function (event){\n var room_id = get_cur_room_id();\n var room = room_arr[room_id];\n room.reset(); \n printAllud();\n });\n /*drawing player class event trigger */\n document.getElementById('drawCard').addEventListener('click', function (event) {\n attend_room(get_cur_room_id());\n drawAllclass();\n });\n /*customize game */\n document.getElementById('AddCategoryBtn').addEventListener('click', function (event) {\n var elem_cg = document.getElementById('CustomCategory');\n var elem_cg_n = document.getElementById('customCategoryNum');\n if(elem_cg_n.value == \"\" || elem_cg.textContent == \"\"){\n alert(\"Data Missing!\");\n return;\n }\n category3.push(elem_cg.textContent);\n cg_remain_num3.push(parseInt(elem_cg_n.value));\n printCustomCategory();\n });\n /*clear customize game */\n document.getElementById('ClearCategoryBtn').addEventListener('click', function (event) {\n category3.length = 0;\n cg_remain_num3.length = 0;\n printCustomCategory();\n });\n\n // function drawRoomnum(username){\n // var user = WhoAmI(username);\n // var roomNum = String(user.room_id);\n // var room = room_arr[user.room_id];\n // return room.game_name;\n // temp = \"Room ID : \";\n // roomNum = temp.concat(roomNum);\n // roomNum = roomNum.concat(\" \",room.game_name);\n // cls_e = document.getElementById('UserRoomNum');\n // cls_e.innerHTML = roomNum;\n // return;\n // };\n\n /* Get */\n document.getElementById('shareMeme').addEventListener('click', function (event) {\n if (!liff.isLoggedIn()) alert('please login in LINE');\n // console.log(location.href);\n var user = WhoAmI(username);\n var imgUrl = \n [\"https://cdn1-manfashion.techbang.com/system/excerpt_images/8442/mobile_inpage/04934a6594a13f437a01f8cb88f37d75.jpg?1562911218\",\n \"https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRh0hwGY7AkYbMExfJnN0WotTwjFBoh0LGE_Q&usqp=CAU\", \n \"https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSbMvSfMm0XR2d8QClEqq4pMpxgWQi2_3rrcw&usqp=CAU\"];\n // JSON parameters\n var imageUrl = \"\";\n var gameName = \"\";\n var playerCharacter = \"\";\n var gameTime = \"\";\n var gameRate = \"\";\n var tiffUrl = \"\";\n playerCharacter = user.main_pool.map[user.username];\n tiffUrl = location.href;\n if (room_arr[user.room_id].game_name == \"Werewolf\") {\n imageUrl = imgUrl[0];\n gameName = \"狼人殺\";\n gameTime = \"45分鐘\";\n gameRate = [\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png\"\n },\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png\"\n },\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png\"\n },\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png\"\n },\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gray_star_28.png\"\n },\n {\n \"type\": \"text\",\n \"text\": \"4.0\",\n \"size\": \"sm\",\n \"color\": \"#999999\",\n \"margin\": \"md\",\n \"flex\": 0\n }\n ];\n } else if (room_arr[user.room_id].game_name == \"Avalon\"){\n imageUrl = imgUrl[1];\n gameName = \"阿瓦隆\";\n gameTime = \"90分鐘\";\n gameRate = [\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png\"\n },\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png\"\n },\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png\"\n },\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gray_star_28.png\"\n },\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gray_star_28.png\"\n },\n {\n \"type\": \"text\",\n \"text\": \"3.0\",\n \"size\": \"sm\",\n \"color\": \"#999999\",\n \"margin\": \"md\",\n \"flex\": 0\n }\n ];\n } else {\n imageUrl = imgUrl[2];\n gameName = \"客制化遊戲\";\n gameTime = \"???分鐘\";\n gameRate = [\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gray_star_28.png\"\n },\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gray_star_28.png\"\n },\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gray_star_28.png\"\n },\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gray_star_28.png\"\n },\n {\n \"type\": \"icon\",\n \"size\": \"sm\",\n \"url\": \"https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gray_star_28.png\"\n },\n {\n \"type\": \"text\",\n \"text\": \"???\",\n \"size\": \"sm\",\n \"color\": \"#999999\",\n \"margin\": \"md\",\n \"flex\": 0\n }\n ];\n }\n // const imageUrl = document.getElementById('memeImage').src;\n // const topText = document.getElementById('memeTopCaption').textContent || ' ';\n // const bottomText = document.getElementById('memeBottomCaption').textContent || ' ';\n const url = window.location.href;\n liff.shareTargetPicker([{\n 'type': 'flex',\n 'altText': \" \",\n 'contents': {\n \"type\": \"bubble\",\n \"hero\": {\n \"type\": \"image\",\n \"url\": imageUrl,\n \"size\": \"full\",\n \"aspectRatio\": \"20:13\",\n \"aspectMode\": \"cover\",\n \"action\": {\n \"type\": \"uri\",\n \"uri\": tiffUrl\n }\n },\n \"body\": {\n \"type\": \"box\",\n \"layout\": \"vertical\",\n \"contents\": [\n {\n \"type\": \"text\",\n \"text\": gameName,\n \"weight\": \"bold\",\n \"size\": \"xl\"\n },\n {\n \"type\": \"text\",\n \"text\": \"刺激度\",\n \"margin\": \"md\"\n },\n {\n \"type\": \"box\",\n \"layout\": \"baseline\",\n \"contents\": gameRate\n },\n {\n \"type\": \"box\",\n \"layout\": \"vertical\",\n \"margin\": \"lg\",\n \"spacing\": \"sm\",\n \"contents\": [\n {\n \"type\": \"box\",\n \"layout\": \"baseline\",\n \"spacing\": \"sm\",\n \"contents\": [\n {\n \"type\": \"text\",\n \"text\": \"預估遊戲時間\",\n \"color\": \"#aaaaaa\",\n \"size\": \"sm\",\n \"flex\": 1\n },\n {\n \"type\": \"text\",\n \"text\": gameTime,\n \"wrap\": true,\n \"color\": \"#666666\",\n \"size\": \"sm\",\n \"flex\": 1\n }\n ]\n },\n {\n \"type\": \"box\",\n \"layout\": \"baseline\",\n \"spacing\": \"sm\",\n \"contents\": [\n {\n \"type\": \"text\",\n \"text\": \"你這場的角色\",\n \"color\": \"#aaaaaa\",\n \"size\": \"sm\",\n \"flex\": 1\n },\n {\n \"type\": \"text\",\n \"text\": playerCharacter,\n \"wrap\": true,\n \"color\": \"#EF5350\",\n \"size\": \"sm\",\n \"flex\": 1\n }\n ]\n }\n ]\n }\n ]\n },\n \"footer\": {\n \"type\": \"box\",\n \"layout\": \"vertical\",\n \"spacing\": \"sm\",\n \"contents\": [\n {\n \"type\": \"button\",\n \"style\": \"link\",\n \"height\": \"sm\",\n \"action\": {\n \"type\": \"uri\",\n \"label\": \"GAME END\",\n \"uri\": tiffUrl\n }\n },\n {\n \"type\": \"spacer\",\n \"size\": \"sm\"\n }\n ],\n \"flex\": 0\n }\n }\n }]).then(function (res) {\n if (res) alert('Message sent!');\n }).catch(function (res) {\n console.error(res);\n });\n });\n}", "async function screen_share() {\n if (!localScreenShare) {\n localScreenShare = await navigator.mediaDevices.getDisplayMedia({ video: true });\n }\n\n //adds the screen share stream to video_list \n //to be able to be displayed in place of user video.\n video_list.find(sender => sender.track.kind === 'video').replaceTrack(localScreenShare.getTracks()[0]);\n document.querySelector('#localVideo').srcObject = localScreenShare;\n stopShare.disabled = false;\n startShare.disabled = true;\n}", "function onShare(args) {\n if (app.android) {\n socialShare.shareText(\"Download the official TSS Announcements App. Available now at: https://play.google.com/store/apps/details?id=ca.tssappclub.tssannouncements&hl=en and https://itunes.apple.com/ca/app/tss-announcements/id1271411385?mt=8\");\n } else if (app.ios) {\n socialShare.shareText(\"Download the official TSS Announcements App. Available now at: https://play.google.com/store/apps/details?id=ca.tssappclub.tssannouncements&hl=en and https://itunes.apple.com/ca/app/tss-announcements/id1271411385?mt=8\");\n }\n}", "shareWith(loginNames, role = SharingRole.View, emailData) {\r\n const dependency = this.addBatchDependency();\r\n // remove need to reference Web here, which created a circular build issue\r\n const web = new SharePointQueryableInstance(extractWebUrl(this.toUrl()), \"/_api/web/url\");\r\n return web.get().then((url) => {\r\n dependency();\r\n return this.shareObject(combine(url, \"/_layouts/15/aclinv.aspx?forSharing=1&mbypass=1\"), loginNames, role, emailData);\r\n });\r\n }", "function action_shareImgToUser() {\n var timeID = (new Date()).getTime();\n var msgObj;\n\n if(shareFlag == 0) {\n // Find selected user from the contact list..\n var contactUser = contactList.find(function(oneContactUser) {\n return oneContactUser.email === userToShare;\n });\n\n if(!contactUser) return;\n\n // Create data to send..\n msgObj = {\n id: timeID,\n state: \"ND\",\n type: \"ONE\",\n contact_id: contactUser.contact_id,\n from: userSelf.email,\n to: userToShare,\n filePath: sharePath,\n img: shareContent\n };\n sendImageToOne(msgObj);\n\n if(selectFlag == \"ONE\" && userSelected.email == userToShare) {\n addImgFromUser(msgObj, true, false);\n }\n }\n else if(shareFlag == 1) {\n // Find selected group from the grp list..\n var contactGrp = grpList.find(function(oneGrp) {\n return oneGrp.grpID === userToShare;\n });\n\n if(!contactGrp) return;\n\n msgObj = {\n id: timeID,\n state: \"ND\",\n type : \"GRP\",\n grpID : contactGrp.grpID,\n from : userSelf.email,\n to : contactGrp.grpUsers,\n filePath: sharePath,\n img : shareContent\n };\n // Send data..\n sendImageToGrp(msgObj);\n\n if(selectFlag == \"GRP\" && grpSelected.grpID == contactGrp.grpID) {\n addImgFromUser(msgObj, true, false);\n }\n }\n else if(shareFlag == 2) {\n // // Add to contact..\n // var newUser = {\n // username:\n // }\n //\n // // Create data to send..\n // msgObj = {\n // id: timeID,\n // state: \"ND\",\n // type: \"ONE\",\n // contact_id: \"\",\n // from: userSelf.email,\n // to: userToShare,\n // filePath: sharePath,\n // img: shareContent,\n // flag: \"false\"\n // };\n // sendImageToOne(msgObj);\n //\n // if(selectFlag == \"ONE\" && userSelected.email == userToShare) {\n // addImgFromUser(msgObj, true, false);\n // }\n }\n\n $('#modal-shareImg').modal('hide');\n}", "function takeShurikenHandler() {\n \ttakeShurikens(1);\n }", "function initSocialSharingWidget() {\n var widget = $('#tesla-social-widget');\n var type = null;\n var url = null;\n var message = null;\n var page = document.URL;\n var width = 550\n var height = 450;\n if (widget.length !== 0) {\n widget.find('a').each(function() {\n type = $(this).attr('class');\n switch (type) {\n case 'facebook':\n url = 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(page);\n break;\n case 'twitter':\n message = $(this).find('span').text();\n url = 'https://twitter.com/intent/tweet?text=' + encodeURIComponent(message) + '&url=' + encodeURIComponent(page) + '&via=' + encodeURIComponent('TeslaMotors') + '&related=' + encodeURIComponent('TeslaMotors,elonmusk');\n break;\n case 'google':\n url = 'https://plus.google.com/share?url=' + encodeURIComponent(page);\n break;\n }\n if (url !== null) {\n $(this).attr('href', url);\n }\n });\n widget.on('click', 'a', function(e) {\n e.preventDefault();\n window.open($(this).attr('href'), '_blank', 'width=' + width + ', height=' + height);\n });\n }\n}", "function share ( remoteID, initiator, config, callback ) {\n\n if ( MEDIAS[remoteID] || remoteID === PLAYER.id ) return;\n\n var transport = CONNECTIONS[remoteID];\n\n if ( !transport.ready ) return;\n\n MEDIAS[ remoteID ] = new MediaConnection( PLAYER.id, remoteID, initiator, transport, config, callback );\n }" ]
[ "0.68397206", "0.66849166", "0.6583566", "0.6463173", "0.644539", "0.64029604", "0.63970745", "0.63856465", "0.63848144", "0.6310953", "0.63060176", "0.6295506", "0.62695825", "0.6268571", "0.62677747", "0.6251741", "0.6233815", "0.6231797", "0.62148815", "0.6174795", "0.6136947", "0.6134827", "0.6115314", "0.60380733", "0.6022365", "0.6021568", "0.59988886", "0.59672576", "0.59584415", "0.5956446", "0.59522706", "0.5926415", "0.59253764", "0.59144", "0.58566266", "0.5854905", "0.58527106", "0.5849811", "0.58459103", "0.58334017", "0.5828305", "0.5822556", "0.5819372", "0.5814183", "0.5813179", "0.5790672", "0.57892346", "0.5785026", "0.5778406", "0.5762266", "0.5757143", "0.57433176", "0.57255465", "0.5722483", "0.5718168", "0.5706535", "0.5681253", "0.56696075", "0.566435", "0.5661246", "0.56179637", "0.5616925", "0.5613268", "0.559282", "0.5588641", "0.55807614", "0.5577387", "0.55520755", "0.55285484", "0.55207384", "0.5514634", "0.5503137", "0.55028594", "0.5500564", "0.5486726", "0.5478476", "0.547428", "0.547428", "0.547428", "0.54710186", "0.5466396", "0.5449804", "0.54491615", "0.5444787", "0.5440149", "0.5437848", "0.54281133", "0.54276747", "0.5420027", "0.541991", "0.5409754", "0.5404877", "0.540364", "0.53822523", "0.53799844", "0.53671294", "0.5353612", "0.5350936", "0.53505385", "0.53469056", "0.5343394" ]
0.0
-1
Operate in Strict mode such that variables must be declared before used!
function ArmSegment(shader, name, xPivot, yPivot) { SceneNode.call(this, shader, name, true); // calling super class constructor var xf = this.getXform(); xf.setPosition(xPivot, yPivot); // now create the children shapes var obj = new CircleRenderable(shader); // The purple circle base this.addToSet(obj); obj.setColor([0.75, 0.5, 1, 1]); xf = obj.getXform(); xf.setSize(1, 2); // xf.setPosition(xPivot, 1 + yPivot); xf.setPosition(0, 0); obj = new SquareRenderable(shader); // The right green this.addToSet(obj); obj.setColor([0, 1, 0, 1]); xf = obj.getXform(); xf.setSize(0.25, 0.25); // so that we can see the connecting point // xf.setPosition(xPivot, 1.75 + yPivot); xf.setPosition(0.375, 0); obj = new SquareRenderable(shader); // The left green this.addToSet(obj); obj.setColor([0, 1, 0, 1]); xf = obj.getXform(); xf.setSize(0.25, 0.25); // so that we can see the connecting point // xf.setPosition(xPivot, 1.75 + yPivot); xf.setPosition(-0.375, 0); obj = new SquareRenderable(shader); // The top green this.addToSet(obj); obj.setColor([0, 0.85, 0.15, 1]); xf = obj.getXform(); xf.setSize(0.25, 0.25); // so that we can see the connecting point // xf.setPosition(xPivot+0.5-0.125, yPivot+0.125); xf.setPosition(0, 0.375); obj = new SquareRenderable(shader); // The bottom green this.addToSet(obj); obj.setColor([0, 0.85, 0.15, 1]); xf = obj.getXform(); xf.setSize(0.25, 0.25); // so that we can see the connecting point // xf.setPosition(xPivot-0.5+0.125, yPivot+0.125); xf.setPosition(0, -0.375); obj = new CircleRenderable(shader); // The middle red circle this.addToSet(obj); obj.setColor([1, 0.75, 1, 1]); xf = obj.getXform(); xf.setSize(0.5, 0.5); // so that we can see the connecting point xf.setPosition(0, 0); this.mPulseRate = 0.005; this.mRotateRate = -2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function forgettingDeclaringVariablesBeforeUseingDeclaresThemOnTheGlobalObject(){\n i = 1;//ReferenceError in strict mode.\n}", "function nonStrictMode() {\n let x = 34;\n\n //..\n 'use strict';\n //..\n }", "function strictly() {\n 'use strict';\n\n}", "function bar() {\n // this code is also strict mode.\n }", "function foo(){\n 'use strict';\n var undefined = 2;\n console.log( undefined ); // 2\n}", "function forUseStrict() {\n \"use strict\";\n // start coding from here\n console.log(\"hello world\");\n}", "function strictMode() {\n 'use strict';\n\n //..\n //..\n }", "function foo() {\n \"use strict\";\n}", "function withStrict() {\n 'use strict';\n bar = 'bar'; // throws a ReferenceError, bar not defined\n return bar;\n}", "function doSomething(val) {\n \"use strict\";\n x = val + 10; // let x = val + 10;\n}", "function myLocalScope() {\n 'use strict'; // you shouldn't need to edit this line\n var myVar = 7;\n console.log(myVar);\n}", "function __strict(x) {return x}", "function __strict(x) {return x}", "function doWork(){\n myCat={name:\"mimi\",age:5}; //should never do undeclared variables AND if we are in Strict Mode it will crash: myCat is not defined\n console.log(myCat);\n}", "function myLocalScope() {\n 'use strict'; // you shouldn't need to edit this line\n var myVar = \"foo\";\n console.log(myVar);\n}", "function func1(){\n var hey = 10;\n var hey = 20; // BAD PRACTICE!\n console.log(hey);\n }", "function exaqmple5() {\n var b = 1;\n // b = 10 // * Error:e b is read-only\n}", "function myLocalScope() {\n 'use strict'; // you shouldn't need to edit this line\n var myVar = \"test\";\n console.log(myVar);\n}", "function strictModeInsideFunction()\n{\n\t\"use strict\";\n\td = 8; // This will cause an error (d is not defined).\n\tdocument.getElementById(\"strictModeInsideFunction\").innerHTML = \"c Is \" + c + \" \" + \"d Is \" + d;\n}", "function myLocalScope() {\n 'use strict'; // you shouldn't need to edit this line\n var myVar;\n console.log(myVar);\n}", "function foo() {\n kaz = 1; // 'var' missing, ReferenceError.\n}", "function sum() {\n // \"use strict\"\n var number = 5;\n console.log(number);\n}", "function myFunction() {\n y = 3.14;\n return y\n // will throw an error if it does not have var, let, or const declared first\n // declare \"y\" variable with let or const AND/OR uncomment \"use strict\" at the beginning to see differences.\n}", "function strict() {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n\n innerOk.apply(void 0, [strict, args.length].concat(args));\n}", "function strict() {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n\n innerOk.apply(void 0, [strict, args.length].concat(args));\n}", "function foo() {\n\ta = 1;\t// `a` not formally declared\n}", "function doSomething(a, b) {\n \"use strict\";\n return a * b;\n}", "function use_strict() {\n\t\"use strict\";\n\ttry {\n\t\ttxt1 = window.document.getElementById(\"text1\").value;\n\t\twindow.document.getElementById(\"using_strict\").innerHTML = \"Square root of\"\n\t\t\t\t+ txt1 + \" = \" + Math.sqrt(txt1);\n\t} catch (e) {\n\t\twindow.document.getElementById(\"using_strict\").innerHTML = \"<span style='color:red'>Error:</span> \"\n\t\t\t\t+ e.toString();\n\t}\n}", "function isUseStrict(stmt) {\n return options.ecmaVersion >= 6 && stmt.type === \"ExpressionStatement\" &&\n stmt.expression.type === \"Literal\" && stmt.expression.value === \"use strict\";\n }", "function func2() {\n var b = 10;\n //var b = 20; error: can't have both declarations of 'b'\n }", "function teste() {\n \"use strict\"\n let testando = 'teste';\n}", "function cleanContextForImports () {\n __define = global.define\n try {\n global.define = undefined\n } catch (_) {\n console.warn('IXO Keysafe - global.define could not be deleted.')\n }\n}", "function sum (x, y, z){\n \"use strict\";\n\n}", "function sum (){\n //\"use strict\"\n number = 23;\n console.log(number + 1);\n}", "function foo() {\n expect(a).be.undefined;\n a = 3;\n expect(a).to.eql(3);\n var a; // declaration is \"hoisted\" to the top of `foo()`\n expect(a).to.eql(3);\n }", "function foo() {\n\t\"use strict\";\n\n\tconsole.log( this.a );\n}", "function foo(){\n undefined = 2; // really bad idea;\n}", "function catTalk() {\n \"use strict\"\n\n}", "function sum(a, a, c) { // !!! syntax error\n  'use strict';\n  return a + b + c; // wrong if this code ran\n}", "function TempVars() {\n}", "function checkStrictModeIdentifier(node) {\n if (inStrictMode &&\n node.originalKeywordKind >= 106 /* FirstFutureReservedWord */ &&\n node.originalKeywordKind <= 114 /* LastFutureReservedWord */ &&\n !ts.isIdentifierName(node) &&\n !ts.isInAmbientContext(node)) {\n // Report error only if there are no parse errors in file\n if (!file.parseDiagnostics.length) {\n file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node)));\n }\n }\n }", "function isStrictModeReservedWord(id) {\n switch (id) {\n case 'implements':\n case 'interface':\n case 'package':\n case 'private':\n case 'protected':\n case 'public':\n case 'static':\n case 'yield':\n case 'let':\n return true;\n default:\n return false;\n }\n }", "function isStrictModeReservedWord(id) {\n switch (id) {\n case 'implements':\n case 'interface':\n case 'package':\n case 'private':\n case 'protected':\n case 'public':\n case 'static':\n case 'yield':\n case 'let':\n return true;\n default:\n return false;\n }\n }", "function hooks() {\n \"use strict\";\n}", "function linear_pre_init() {\n let x:number;\n let y:?number = x; // ok\n let z:number = x; // error\n x = 0;\n let w:number = x; // ok\n}", "function duplicatepropertynamesinstrictmode() {\n 'use strict';\n return this === undefined && ({ a:1, a:1 }).a === 1;\n}", "function bar(){\n if(!foo){\n var foo = 10;\n }\n console.log(foo);\n}", "function SafeStyle() { }", "function SafeStyle() { }", "function SafeStyle() { }", "function StupidBug() {}", "function useStrictToBeginning (code) {\n if (!code.match(/['\"]use strict['\"]/)) {\n return code\n }\n return \"'use strict';\" + code\n}", "transient final private protected internal function m167() {}", "function if_partial_post_init(b) {\n let x:number;\n if (b) {\n x = 0;\n }\n var y:number = x; // error, possibly uninitialized\n}", "static final private protected internal function m103() {}", "function tryEnsureSanity()\n{\n // The script might have set up oomAfterAllocations or oomAtAllocation.\n // Turn it off so we can test only generated code with it.\n try {\n if (typeof resetOOMFailure == \"function\")\n resetOOMFailure();\n } catch(e) { }\n\n try {\n // The script might have turned on gczeal.\n // Turn it off to avoid slowness.\n if (typeof gczeal == \"function\")\n gczeal(0);\n } catch(e) { }\n\n // At least one bug in the past has put exceptions in strange places. This also catches \"eval getter\" issues.\n try { eval(\"\"); } catch(e) { dumpln(\"That really shouldn't have thrown: \" + errorToString(e)); }\n\n if (!this) {\n // Strict mode. Great.\n return;\n }\n\n try {\n // Try to get rid of any fake 'unwatch' functions.\n delete this.unwatch;\n\n // Restore important stuff that might have been broken as soon as possible :)\n if ('unwatch' in this) {\n this.unwatch(\"eval\");\n this.unwatch(\"Function\");\n this.unwatch(\"gc\");\n this.unwatch(\"uneval\");\n this.unwatch(\"toSource\");\n this.unwatch(\"toString\");\n }\n\n if ('__defineSetter__' in this) {\n // The only way to get rid of getters/setters is to delete the property.\n if (!jsStrictMode)\n delete this.eval;\n delete this.Math;\n delete this.Function;\n delete this.gc;\n delete this.uneval;\n delete this.toSource;\n delete this.toString;\n }\n\n this.Math = realMath;\n this.eval = realEval;\n this.Function = realFunction;\n this.gc = realGC;\n this.uneval = realUneval;\n this.toSource = realToSource;\n this.toString = realToString;\n } catch(e) {\n confused(\"tryEnsureSanity failed: \" + errorToString(e));\n }\n\n // These can fail if the page creates a getter for \"eval\", for example.\n if (this.eval != realEval)\n confused(\"Fuzz script replaced |eval|\");\n if (Function != realFunction)\n confused(\"Fuzz script replaced |Function|\");\n}", "function tryEnsureSanity()\n{\n // The script might have set up oomAfterAllocations or oomAtAllocation.\n // Turn it off so we can test only generated code with it.\n try {\n if (typeof resetOOMFailure == \"function\")\n resetOOMFailure();\n } catch(e) { }\n\n try {\n // The script might have turned on gczeal.\n // Turn it off to avoid slowness.\n if (typeof gczeal == \"function\")\n gczeal(0);\n } catch(e) { }\n\n // At least one bug in the past has put exceptions in strange places. This also catches \"eval getter\" issues.\n try { eval(\"\"); } catch(e) { dumpln(\"That really shouldn't have thrown: \" + errorToString(e)); }\n\n if (!this) {\n // Strict mode. Great.\n return;\n }\n\n try {\n // Try to get rid of any fake 'unwatch' functions.\n delete this.unwatch;\n\n // Restore important stuff that might have been broken as soon as possible :)\n if ('unwatch' in this) {\n this.unwatch(\"eval\");\n this.unwatch(\"Function\");\n this.unwatch(\"gc\");\n this.unwatch(\"uneval\");\n this.unwatch(\"toSource\");\n this.unwatch(\"toString\");\n }\n\n if ('__defineSetter__' in this) {\n // The only way to get rid of getters/setters is to delete the property.\n if (!jsStrictMode)\n delete this.eval;\n delete this.Math;\n delete this.Function;\n delete this.gc;\n delete this.uneval;\n delete this.toSource;\n delete this.toString;\n }\n\n this.Math = realMath;\n this.eval = realEval;\n this.Function = realFunction;\n this.gc = realGC;\n this.uneval = realUneval;\n this.toSource = realToSource;\n this.toString = realToString;\n } catch(e) {\n confused(\"tryEnsureSanity failed: \" + errorToString(e));\n }\n\n // These can fail if the page creates a getter for \"eval\", for example.\n if (this.eval != realEval)\n confused(\"Fuzz script replaced |eval|\");\n if (Function != realFunction)\n confused(\"Fuzz script replaced |Function|\");\n}", "function tryEnsureSanity()\n{\n // The script might have set up oomAfterAllocations or oomAtAllocation.\n // Turn it off so we can test only generated code with it.\n try {\n if (typeof resetOOMFailure == \"function\")\n resetOOMFailure();\n } catch(e) { }\n\n try {\n // The script might have turned on gczeal.\n // Turn it off to avoid slowness.\n if (typeof gczeal == \"function\")\n gczeal(0);\n } catch(e) { }\n\n // At least one bug in the past has put exceptions in strange places. This also catches \"eval getter\" issues.\n try { eval(\"\"); } catch(e) { dumpln(\"That really shouldn't have thrown: \" + errorToString(e)); }\n\n if (!this) {\n // Strict mode. Great.\n return;\n }\n\n try {\n // Try to get rid of any fake 'unwatch' functions.\n delete this.unwatch;\n\n // Restore important stuff that might have been broken as soon as possible :)\n if ('unwatch' in this) {\n this.unwatch(\"eval\");\n this.unwatch(\"Function\");\n this.unwatch(\"gc\");\n this.unwatch(\"uneval\");\n this.unwatch(\"toSource\");\n this.unwatch(\"toString\");\n }\n\n if ('__defineSetter__' in this) {\n // The only way to get rid of getters/setters is to delete the property.\n if (!jsStrictMode)\n delete this.eval;\n delete this.Math;\n delete this.Function;\n delete this.gc;\n delete this.uneval;\n delete this.toSource;\n delete this.toString;\n }\n\n this.Math = realMath;\n this.eval = realEval;\n this.Function = realFunction;\n this.gc = realGC;\n this.uneval = realUneval;\n this.toSource = realToSource;\n this.toString = realToString;\n } catch(e) {\n confused(\"tryEnsureSanity failed: \" + errorToString(e));\n }\n\n // These can fail if the page creates a getter for \"eval\", for example.\n if (this.eval != realEval)\n confused(\"Fuzz script replaced |eval|\");\n if (Function != realFunction)\n confused(\"Fuzz script replaced |Function|\");\n}", "function tryEnsureSanity()\n{\n // The script might have set up oomAfterAllocations or oomAtAllocation.\n // Turn it off so we can test only generated code with it.\n try {\n if (typeof resetOOMFailure == \"function\")\n resetOOMFailure();\n } catch(e) { }\n\n try {\n // The script might have turned on gczeal.\n // Turn it off to avoid slowness.\n if (typeof gczeal == \"function\")\n gczeal(0);\n } catch(e) { }\n\n // At least one bug in the past has put exceptions in strange places. This also catches \"eval getter\" issues.\n try { eval(\"\"); } catch(e) { dumpln(\"That really shouldn't have thrown: \" + errorToString(e)); }\n\n if (!this) {\n // Strict mode. Great.\n return;\n }\n\n try {\n // Try to get rid of any fake 'unwatch' functions.\n delete this.unwatch;\n\n // Restore important stuff that might have been broken as soon as possible :)\n if ('unwatch' in this) {\n this.unwatch(\"eval\");\n this.unwatch(\"Function\");\n this.unwatch(\"gc\");\n this.unwatch(\"uneval\");\n this.unwatch(\"toSource\");\n this.unwatch(\"toString\");\n }\n\n if ('__defineSetter__' in this) {\n // The only way to get rid of getters/setters is to delete the property.\n if (!jsStrictMode)\n delete this.eval;\n delete this.Math;\n delete this.Function;\n delete this.gc;\n delete this.uneval;\n delete this.toSource;\n delete this.toString;\n }\n\n this.Math = realMath;\n this.eval = realEval;\n this.Function = realFunction;\n this.gc = realGC;\n this.uneval = realUneval;\n this.toSource = realToSource;\n this.toString = realToString;\n } catch(e) {\n confused(\"tryEnsureSanity failed: \" + errorToString(e));\n }\n\n // These can fail if the page creates a getter for \"eval\", for example.\n if (this.eval != realEval)\n confused(\"Fuzz script replaced |eval|\");\n if (Function != realFunction)\n confused(\"Fuzz script replaced |Function|\");\n}", "function tryEnsureSanity()\n{\n // The script might have set up oomAfterAllocations or oomAtAllocation.\n // Turn it off so we can test only generated code with it.\n try {\n if (typeof resetOOMFailure == \"function\")\n resetOOMFailure();\n } catch(e) { }\n\n try {\n // The script might have turned on gczeal.\n // Turn it off to avoid slowness.\n if (typeof gczeal == \"function\")\n gczeal(0);\n } catch(e) { }\n\n // At least one bug in the past has put exceptions in strange places. This also catches \"eval getter\" issues.\n try { eval(\"\"); } catch(e) { dumpln(\"That really shouldn't have thrown: \" + errorToString(e)); }\n\n if (!this) {\n // Strict mode. Great.\n return;\n }\n\n try {\n // Try to get rid of any fake 'unwatch' functions.\n delete this.unwatch;\n\n // Restore important stuff that might have been broken as soon as possible :)\n if ('unwatch' in this) {\n this.unwatch(\"eval\");\n this.unwatch(\"Function\");\n this.unwatch(\"gc\");\n this.unwatch(\"uneval\");\n this.unwatch(\"toSource\");\n this.unwatch(\"toString\");\n }\n\n if ('__defineSetter__' in this) {\n // The only way to get rid of getters/setters is to delete the property.\n if (!jsStrictMode)\n delete this.eval;\n delete this.Math;\n delete this.Function;\n delete this.gc;\n delete this.uneval;\n delete this.toSource;\n delete this.toString;\n }\n\n this.Math = realMath;\n this.eval = realEval;\n this.Function = realFunction;\n this.gc = realGC;\n this.uneval = realUneval;\n this.toSource = realToSource;\n this.toString = realToString;\n } catch(e) {\n confused(\"tryEnsureSanity failed: \" + errorToString(e));\n }\n\n // These can fail if the page creates a getter for \"eval\", for example.\n if (this.eval != realEval)\n confused(\"Fuzz script replaced |eval|\");\n if (Function != realFunction)\n confused(\"Fuzz script replaced |Function|\");\n}", "function foo() {\n a = 1; // no declaration\n}", "function foo() {\n\ta = 3;\n\n\t//console.log( a );\t// 3\n\n\tvar a;\t\t\t\t// declaration is \"hoisted\"\n // to the top of `foo()`\n}", "function restoreContextAfterImports () {\n try {\n global.define = __define\n } catch (_) {\n console.warn('IXO Keysafe - global.define could not be overwritten.')\n }\n}", "function _checkForUnused() {\n // function params are handled specially\n // assume that parameters are the only thing declared in the param scope\n if (_current[\"(type)\"] === \"functionparams\") {\n _checkParams();\n return;\n }\n var curentLabels = _current[\"(labels)\"];\n for (var labelName in curentLabels) {\n if (curentLabels[labelName][\"(type)\"] !== \"exception\" &&\n curentLabels[labelName][\"(unused)\"]) {\n _warnUnused(labelName, curentLabels[labelName][\"(token)\"], \"var\");\n }\n }\n }", "function foo() {\n a = 3;\n console.log(a); // 3\n var a; // declaration is \"hoisted\"\n // to the top of `foo()`\n }", "function foo() {\n bar = 4; // ASSIGN_BEFORE_DECL alarm\n var bar;\n console.log(bar);\n}", "function foo() {\n var a = b = 0;\n}", "function foo() {\n var a = b = 0;\n}", "function testVariables () {\n var thisIsNotAvailableOutside = true;\n console.log(thisIsAVariable);\n}", "function run() {\n 'use strict';\n}", "function foo() {\n //\"use strict\"\n console.log(this.bar);\n}", "function maybeDoSomething(p1, p1) {\n // \"use strict\"; // comment this back in to test;\n console.log(p1);\n return p1;\n}", "function foo() {\n\ta = 3;\n\n\tconsole.log( a );\t// 3\n\n\tvar a;\t\t\t\t// declaration is \"hoisted\"\n\t\t\t\t\t\t // to the top of `foo()`\n}", "function safeEval(code) {\n let safeContextStr = \"\";\n if (typeof window !== \"undefined\") {\n const windowContextAttr = Object.getOwnPropertyNames(window).filter(isValidVariableName);\n for (let i = 0, len = windowContextAttr.length; i < len; i++) {\n safeContextStr += `var ${windowContextAttr[i]} = undefined;`;\n }\n }\n return new Function(`${safeContextStr} \"use strict\"; ${code}`)();\n}", "function strict() {\n // Function-level strict mode syntax\n 'use strict';\n function nested() { return 'And so am I!'; }\n return \"Hi! I'm a strict mode function! \" + nested();\n}", "static final private internal function m106() {}", "function sayHi1() {\n if (true) {\n var phrase = \"Hello\";\n var phrase = \"Goodbye\"; // This is not an error\n }\n \n alert(phrase); // works\n }", "function varTest(){\r\n\tvar x=1;\r\n\tif (true){\r\n\t\tvar x=2;\r\n\t\tconsole.log(x);\t\t//2\r\n\t}\r\n\tconsole.log(x);\t\t//2\r\n}", "function example3() {\n var a = 1;\n // let a = 2 // * Error\n}", "function f22(x) {\n var v1 = x;\n var v2 = x;\n var v3 = x; // Error\n var v4 = x; // Error\n var v5 = x; // Error\n var v6 = x; // Error\n var v7 = x; // Error\n}", "function example2() {\n\n console.log(a); // return undefined (no error)\n var a = 1;\n\n console.log(b); // * Error: variable isn't defined\n var b = 2;\n}", "transient private protected internal function m182() {}", "function varScope(permit) {\n var a = 50;\n if (permit) {\n var a = 90;\n }\n return a;\n}", "function f23(x) {\n var y = x; // Error\n}", "function greet() {\n 'use strict';\n console.log('hi');\n}", "function f21(pAny, pNever, pT) {\n var x;\n x = 123;\n x = \"hello\";\n x = [\n 1,\n 2,\n 3\n ];\n x = new Error();\n x = x;\n x = pAny;\n x = pNever;\n x = pT;\n}", "function SafeStyle() {}", "function SafeStyle() {}", "function SafeStyle() {}", "function SafeStyle() {}", "function SafeStyle() {}", "function testData() {\n var height = 10; // use strict won't allow this without var, const or let for variable declaration\n console.log(height);\n}", "transient final protected internal function m174() {}", "function f1() {\n var n = 5;\n if (true) {\n var _n = 10;\n }\n console.log(n); // 5\n}", "static transient final protected function m44() {}", "static transient final private internal function m43() {}", "function no_strict() {\n\ttry {\n\t\ttxt2 = window.document.getElementById(\"text2\").value;\n\t\twindow.document.getElementById(\"not_strict\").innerHTML = \"Square root of \"\n\t\t\t\t+ txt2 + \" = \" + Math.sqrt(txt2);\n\t} catch (e) {\n\t\twindow.document.getElementById(\"not_strict\").innerHTML = \"<span style='color:red'>Error:</span> \"\n\t\t\t\t+ e.toString();\n\t}\n}", "function foo(){\n\ta = 3;\n\n\tconsole.log( a );\n\n\tvar a;\t\t\t\t// declaration is \"hoisted\" to top of foo.\n\n}", "function sample() {\r\n var a = 5;\r\n \r\n if (true) {\r\n let a = 10; // Legal Shadowing\r\n console.log(\"var with let : \"+ a); // Output: var with let : 10\r\n }\r\n}", "function uneFonction() {\n var uneFonctionVar1 = 1; //locale\n let uneFonctionVar2 = 2; //locale\n uneFonctionVar3 = 3; //globale car declaree sans mot clef !!!\n}", "function printVar() {\n let localVar = 18;\n console.log('localVar inside the function ' + localVar); // localVar inside the function 18\n console.log('A variable in the global scope can be accessed inside a function ' + z); // A variable in the global scope can be accessed inside a function Foo\n\n if(true){\n let ifVar = 'I am avilable only in the current code.'\n }\n //console.log(ifVar)// Trowes an error.\n}" ]
[ "0.7439366", "0.72830224", "0.67325795", "0.6653799", "0.66243833", "0.65988535", "0.6545069", "0.6464953", "0.64430505", "0.6431269", "0.62640107", "0.6212427", "0.6212427", "0.6107064", "0.60788345", "0.607138", "0.60205173", "0.60132337", "0.60086274", "0.5973908", "0.59617835", "0.59437484", "0.5941492", "0.5926482", "0.5926482", "0.5923237", "0.5893733", "0.58318365", "0.5730493", "0.5705788", "0.562191", "0.56129926", "0.55955136", "0.55867714", "0.5568473", "0.5548156", "0.5540763", "0.55381256", "0.5512681", "0.54633445", "0.5457994", "0.544306", "0.544306", "0.5433445", "0.54164505", "0.5407963", "0.5407217", "0.5405434", "0.5405434", "0.5405434", "0.540081", "0.5389207", "0.53830737", "0.5376231", "0.5375312", "0.53749937", "0.53749937", "0.53749937", "0.53749937", "0.53749937", "0.53684974", "0.53683543", "0.53517103", "0.5346378", "0.5334211", "0.5317589", "0.53111523", "0.53111523", "0.53100187", "0.528327", "0.5280339", "0.52612686", "0.52604014", "0.5256588", "0.5252368", "0.5248838", "0.5234921", "0.52313435", "0.5230413", "0.52242094", "0.52240443", "0.52221096", "0.5216857", "0.52084875", "0.5207707", "0.52010584", "0.51968205", "0.51968205", "0.51968205", "0.51968205", "0.51968205", "0.5195088", "0.5192673", "0.51869845", "0.51806724", "0.51779217", "0.51724833", "0.5166611", "0.51562726", "0.5150927", "0.5137371" ]
0.0
-1
Nothing more, Nothing less. ONLY that EXACT amount. Write a function that will return all the combinations of items that you can get with that exact amount. youre given a number as a total variable and have access to the menu with the name and price. you can arrange the given information in any data structure you'd like to access it return all the total possible combinations in an array items: Fruit Fries Salad Wings Stick Plate prices: 2.15 2.75 3.35 3.55 4.20 5.80 ex. total = 4.30 return ["Fruit, Fruit"]
function appetize(total){ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPrices(){\n\n\t\t//cost of shop items\n\t\tprice1=75.00; price2=116; price3=44; price4=5.25; price5=3.75; price6=12.75; price7=4.10;\n\n\t\t//ammount of items chosen\n\t\titem_1=0; item2=0; item3=0; item4=0; item5=0; item6=0; item6=0; item7=0;\n\n\t\t//sub-total for each item\n\t\tsubTot_1 = 0; subTot_2=0; subTot_3=0; subTot_4=0; subTot_5=0; subTot_6=0; subTot_7=0;\n\n\t\t//get number of items\n\t\titem_1 = document.getElementById(\"item_1\").value;\n\t\titem_2 = document.getElementById(\"item_2\").value;\n\t\titem_3 = document.getElementById(\"item_3\").value;\n\t\titem_4 = document.getElementById(\"item_4\").value;\n\t\titem_5 = document.getElementById(\"item_5\").value;\n\t\titem_6 = document.getElementById(\"item_6\").value;\n\t\titem_7 = document.getElementById(\"item_7\").value;\n\n\n\t\t//subtotal for item\n\t\tsubTot_1 = eval(item_1) * eval(price1);\n\t\tsubTot_1 = subTot_1.toFixed(2);\n\t\tdocument.getElementById(\"subTot_1\").value = subTot_1;\n\n\t\t//subtotal for item 2\n\t\tsubTot_2 = eval(item_2) * eval(price2);\n\t\tsubTot_2 = subTot_2.toFixed(2);\n\t\tdocument.getElementById(\"subTot_2\").value = subTot_2;\n\n\t\t//subtotal for item 3\n\t\tsubTot_3 = eval(item_3) * eval(price3);\n\t\tsubTot_3 = subTot_3.toFixed(2);\n\t\tdocument.getElementById(\"subTot_3\").value = subTot_3;\n\n\t\t//subtotal for item 4\n\t\tsubTot_4 = eval(item_4) * eval(price4);\n\t\tsubTot_4 = subTot_4.toFixed(2);\n\t\tdocument.getElementById(\"subTot_4\").value = subTot_4;\n\n\t\t//subtotal for item 5\n\t\tsubTot_5 = eval(item_5) * eval(price5);\n\t\tsubTot_5 = subTot_5.toFixed(2);\n\t\tdocument.getElementById(\"subTot_5\").value = subTot_5;\n\n\t\t//subtotal for item 6\n\t\tsubTot_6 = eval(item_6) * eval(price6);\n\t\tsubTot_6 = subTot_6.toFixed(2);\n\t\tdocument.getElementById(\"subTot_6\").value = subTot_6;\n\n\t\t//subtotal for item 7\n\t\tsubTot_7 = eval(item_7) * eval(price7);\n\t\tsubTot_7 = subTot_7.toFixed(2);\n\t\tdocument.getElementById(\"subTot_7\").value = subTot_7;\n\n\t\t//work out total for all items\n\t\tTotamt = eval(subTot_1)+eval(subTot_2)+eval(subTot_3)+eval(subTot_4)+eval(subTot_5)+eval(subTot_6)+eval(subTot_7);\n\t\tTotamt = Totamt.toFixed(2);\n\t\tdocument.getElementById(\"GrandTotal\").value = Totamt;\n\n}//end getPrices", "function findTotalPrice () {\n \n var totalPrice = 0\n \n // Find pizza size\n var sizeId = $('input[name=pizzaSize]:checked').attr('id').slice(-1);\n var crustId = $('input[name=pizzaCrust]:checked').attr('id').slice(-1);\n var cheeseId = $('input[name=pizzaCheese]:checked').attr('id').slice(-1);\n var sauceId = $('input[name=pizzaSauce]:checked').attr('id').slice(-1);\n var meatIds = $('input[name=pizzaMeats]:checked');\n var veggieIds = $('input[name=pizzaVeggies]:checked');\n \n // Determine pizza size line item\n generateOptionElem(optionStrings.pizzaSize[sizeId - 1],\"$\" + prices.pizzaSize[sizeId - 1]);\n totalPrice += prices.pizzaSize[sizeId - 1];\n // Determine crust type line item\n generateOptionElem(optionStrings.pizzaCrust[crustId - 1], \"$\" + prices.pizzaCrust[crustId - 1]);\n totalPrice += prices.pizzaCrust[crustId - 1];\n // Determine extra cheese line item\n generateOptionElem(optionStrings.pizzaCheese[cheeseId - 1], \"$\" + prices.pizzaCheese[cheeseId - 1]);\n totalPrice += prices.pizzaCheese[cheeseId - 1];\n // Determine sauce line item\n generateOptionElem(optionStrings.pizzaSauce[sauceId - 1], \"$\" + prices.pizzaSauce[sauceId - 1]);\n totalPrice += prices.pizzaSauce[sauceId -1];\n // Determine meat toppings\n for (var i = 0; i < meatIds.length; i++) {\n if (meatIds[i].checked == true) {\n numMeats++;\n if (numMeats <= 1) { // First meat free\n generateOptionElem(toppingsMeat[(meatIds[i].id.slice(-1)) - 1], \"$0\");\n } else {\n generateOptionElem(toppingsMeat[(meatIds[i].id.slice(-1)) - 1], \"$1\");\n }\n }\n }\n \n for (var i = 0; i < veggieIds.length; i++) {\n if (veggieIds[i].checked == true) {\n numVeggies++;\n if (numVeggies <= 1) { // First veggie free\n generateOptionElem(toppingsVeggie[(veggieIds[i].id.slice(-1)) - 1], \"$0\");\n } else {\n generateOptionElem(toppingsVeggie[(veggieIds[i].id.slice(-1)) - 1], \"$1\");\n }\n }\n }\n // Add topping prices to total price\n if (numMeats - 1 >= 1) {\n totalPrice += (numMeats - 1);\n }\n if (numVeggies -1 >= 1) {\n totalPrice += (numVeggies - 1);\n }\n \n generateOptionElem(\"\", \"\");\n generateOptionElem(\"<strong>Total</strong>\", \"$\" + totalPrice)\n}", "function findCombinations(amount, denominations) {\n\n let combinations = []\n\n for (let i = 0; i <= amount; i++) {\n combinations[i] = 0\n }\n\n combinations[0] = 1\n\n denominations.forEach((coin) => {\n\n for (let higherAmount = coin; higherAmount <= amount; higherAmount++) {\n let higherAmountRemainder = higherAmount - coin\n combinations[higherAmount] += combinations[higherAmountRemainder]\n }\n })\n return combinations\n}", "function generateMenu (){\n return [{\n name:'Steak',\n time:5,\n price:40\n },{\n name:'Burger',\n time:4,\n price:15\n },{\n name:'Shawarma',\n time:4,\n price:20\n },{\n name:'Pizza',\n time:3,\n price:10\n },{\n name:'Sushi',\n time:3,\n price:15\n },{\n name:'Lobster',\n time:5,\n price:50\n },{\n name:'Carpaccio',\n time:5,\n price:25\n },{\n name:'Chicken',\n time:4,\n price:10\n },{\n name:'Wild Rice',\n time:2,\n price:5\n },{\n name:'Fries',\n time:1,\n price:5\n },{\n name:'Baked Potato',\n time:1,\n price:5\n },{\n name:'Salad',\n time:1,\n price:5\n },{\n name:'Coffee',\n time:1,\n price:0\n },{\n name:'Tea',\n time:1,\n price:0\n },{\n name:'Pop',\n time:1,\n price:0\n },{\n name:'Beer',\n time:1,\n price:5\n },{\n name:'Wine',\n time:1,\n price:10\n }]\n}", "function calculatePossibleCoinCombinations(value) {\n if (isNaN(value) || +value <= 0) {\n console.log('Invalid input');\n return;\n } else {\n console.log('Possible combinations are:')\n value = +value;\n }\n\n coins = [1, 5, 10, 25];\n while (coins.length) {\n let largestPossibleCoin = calculateCoins(value) || 0;\n let outputString = '';\n coins = coins.filter((x) => x < largestPossibleCoin);\n Object.keys(output).forEach((key) => {\n outputString += `${output[key]} - ${key} cents; `;\n })\n console.log(outputString);\n output = {};\n }\n}", "function calculateSubTotal(foodChoices) {\n let subTotal = 0;\n let length = foodChoices.length\n for (let i = 0; i < length; i++) {\n subTotal += Number(foodChoices[i].price)\n }\n return subTotal;\n}", "function getTotalPrice(chosenProducts) {\r\n\ttotalPrice = 0;\r\n\tfor (let i=0; i<products.length; i+=1) {\r\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\r\n\t\t\ttotalPrice += products[i].price;\r\n\t\t}\r\n\t}\r\n\treturn totalPrice;\r\n}", "function getTotalPrice(chosenProducts) {\r\n\ttotalPrice = 0;\r\n\tfor (let i=0; i<products.length; i+=1) {\r\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\r\n\t\t\ttotalPrice += products[i].price;\r\n\t\t}\r\n\t}\r\n\treturn totalPrice;\r\n}", "function getTotalPrice(chosenProducts) {\r\n\ttotalPrice = 0;\r\n\tfor (let i=0; i<products.length; i+=1) {\r\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\r\n\t\t\ttotalPrice += products[i].price;\r\n\t\t}\r\n\t}\r\n\treturn totalPrice;\r\n}", "function getTotalPrice(chosenProducts) {\r\n\ttotalPrice = 0;\r\n\tfor (let i=0; i<products.length; i+=1) {\r\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\r\n\t\t\ttotalPrice += products[i].price;\r\n\t\t}\r\n\t}\r\n\treturn totalPrice;\r\n}", "function getTotals(){\n \n var totals = []; \n var totalCalories =0; \n var totalProtein= 0; \n var totalFat=0 ; \n var totalCarbs= 0; \n var totalFiber=0 ; \n \n //searching through the loop \n for(var i = 0 ; i < menu.length; i++){\n \n var foodObj = menu[i]; \n \n for(var info in foodObj){\n \n var array = foodObj[info]; \n \n switch(info){\n \n case 'Calories':\n totalCalories+=array[0];\n break;\n case 'Protein':\n totalProtein+=array[0];\n break;\n case 'Fat':\n totalFat+=array[0]; \n break;\n case 'Carbs':\n totalCarbs+=array[0];\n break;\n case 'Fiber':\n totalFiber+=array[0]; \n break; \n \n }\n }\n }\n \n totals.push(totalCalories, totalProtein, totalFat, totalCarbs, totalFiber);\n \n calcStats(totals); \n}", "function getVeggies(runningTotal,text1,text2) {\n\tvar veggieTotal = 0;\n\tvar selectedVeggie = [];\n\tvar veggieSubtotal = [];\n\tvar veggieArray = document.getElementsByClassName(\"veggies\");\n\tfor (var v = 0; v < veggieArray.length; v++) {\n\t\tif (veggieArray[v].checked) {\n\t\t\tselectedVeggie.push(veggieArray[v].value);\n\t\t\tveggieSubtotal.push(veggieArray[v].length);\n\t\t\tconsole.log(\"selected veggie item: (\"+veggieArray[v].value+\")\");\n\t\t\tconsole.log(\"selected veggie price: (\"+veggieArray[v].length+\")\");\n\t\t\ttext1 = text1+veggieArray[v].value+\"<br>\";\n\t\t\n\t\t\tif (veggieSubtotal.length <=1) {\n\t\t\t\ttext2 = text2+0+\"<br>\";\n\t\t\t} else {\n\t\t\t\ttext2 = text2+1+\"<br>\";\n\t\t\t}\n\t\t}\n\t}\n\n\t//This statement sets a value for confirmOrder and subTotal if no boxes are checked\n\t\tif (selectedVeggie.length === 0) {\n\t\t\ttext1 = text1+\"No Vegetables\"+\"<br>\";\n\t\t\ttext2 = text2+0+\"<br>\";\n\t\t}\t\t\t\n\t\n\t\t\n\tvar veggieCount = selectedVeggie.length;\n\tif (veggieCount > 1) {\n\t\tveggieTotal = (veggieCount - 1);\n\t\t\n\t} else {\n\t\tveggieTotal = 0;\n\t}\n\t\n\t\n\trunningTotal = (runningTotal + veggieTotal);\n\tconsole.log(\"total selected veggie items: \"+veggieCount);\n\tconsole.log(veggieCount+\" veggie - 1 free veggie = \"+\"$\"+veggieTotal+\".00\");\n\tconsole.log(\"veggie text1: \"+text1);\n\tconsole.log(\"veggie text2: \"+text2);\n\tconsole.log(\"Purchase Total: \"+\"$\"+runningTotal+\".00\");\n\tdocument.getElementById(\"confirmOrder\").innerHTML = text1;\n\tdocument.getElementById(\"subTotal\").innerHTML = text2;\n\tdocument.getElementById(\"totalPrice\").innerHTML = \"<h3>Total: <strong>$\"+runningTotal+\".00\"+\"</strong></h3>\";\n}", "function calculatePriceRange(menu) {\n\tlet priceRange = \"\";\n\n\t//aey - get max, starting at 0\n\tlet max = 0;\n\tif (menu === undefined) return \"N/A\";\n\n\tlet n = menu.length;\n\tfor (let i = 0; i < n; i++) { //loop through every item in the menu\n\t\tlet currentPrice = parseFloat(menu[i].price); //get the price of the item\n\t\tif (currentPrice > max) { //if the current price is more than the current maximum\n\t\t\tmax = currentPrice; //then set a new maximum\n\t\t}\n\t}\n\n\t//aey - get min, starting from max\n\tlet min = max;\n\tfor (let i = 0; i < n; i++) { //loop through every item in the menu\n\t\tlet currentPrice = parseFloat(menu[i].price); //get the price of the item\n\t\tif (currentPrice < min) { //if current is less than current min\n\t\t\tmin = currentPrice; //set a new minimum\n\t\t}\n\t}\n\treturn \"$\" + min.toFixed(2) + \" to $\" + max.toFixed(2) + \"\";\n}", "function getItems() {\n // Example One - getItemsInPriceRange() (doesn't use quantity)\n var lowPrice = 0.4;\n var highPrice = 3.5;\n var outStr = `<h3>Low: ${lowPrice}, High: ${highPrice}</h3>`\n + \"<code>\";\n var items = getItemsInPriceRange(shoppingCart, lowPrice, highPrice);\n\n for (const item of items) {\n outStr += JSON.stringify(item) + \"<br>\";\n }\n outStr += \"</code>\";\n document.getElementById('js-output1').innerHTML = outStr;\n \n // Example Two - getItemsInItemRange() with quantity set to false\n outStr = `<h3>Low: ${lowPrice}, High: ${highPrice}, Quantity: false</h3>`\n + \"<code>\";\n var items = getItemsInItemRange(shoppingCart, lowPrice, highPrice, false);\n\n for (const item of items) {\n outStr += JSON.stringify(item) + \"<br>\";\n }\n outStr += \"</code>\";\n document.getElementById('js-output2').innerHTML = outStr;\n \n // Example Three - getItemsInItemRange() with quantity set to true\n outStr = `<h3>Low: ${lowPrice}, High: ${highPrice}, Quantity: true</h3>`\n + \"<code>\";\n var items = getItemsInItemRange(shoppingCart, lowPrice, highPrice, true);\n\n for (const item of items) {\n outStr += JSON.stringify(item) + \"<br>\";\n }\n outStr += \"</code>\";\n document.getElementById('js-output3').innerHTML = outStr;\n\n}", "function buildOrderListString(inputItems, allItems) {\n let selectedFoods = [];\n let itemsStr = [];\n prePromotionTotalPrice = 0;\n //console.log('============= 订餐明细 =============\\n');\n let orderStr = '============= 订餐明细 =============\\n';\n\n inputItems.forEach(inputItem => {\n let foodInfos = inputItem.split('x', 2);\n let foodId = foodInfos[0].trim();\n let foodCount = foodInfos[1].trim();\n\n allItems.forEach(allItem => {\n\n if (allItem.id === foodId) {\n\n let price = allItem.price;\n let itemTotalPrice = (price * foodCount);\n let str = `${allItem.name} x ${foodCount} = ${itemTotalPrice}元\\n`;\n orderStr += str;\n //console.log(str);\n prePromotionTotalPrice += itemTotalPrice;\n }\n })\n\n });\n console.log(orderStr);\n return orderStr;\n}", "function shop(shoppers,item){\n var person = [];\n var profit = 0;\n var stok = item[2];\n for (var i = 0; i < shoppers.length; i++){\n if(shoppers[i].product === item[0] && shoppers[i].amount <= stok){\n stok -= shoppers[i].amount;\n profit += item[1]*shoppers[i].amount;\n person.push(shoppers[i].name);\n }\n }\n return [person,profit,stok];\n }", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){ \n var productName = \n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn totalPrice;\n}", "function getTotalPrice(chosen_products){\n let total_price = 0;\n for (let i=0; i<products.length;i+=1){\n if (chosen_products.indexOf(products[i].name+\" $\"+products[i].price)> -1){\n total_price += products[i].price;\n }\n }\n return total_price.toFixed(2);\n}", "function calcLoot (level, size, modifier){\n\n\n\tvar gold = calcAmount(level, size, modifier) * 10;\n\tvar items = calcAmount(level, size, modifier);\n\tvar itemsRare = Math.round(calcAmount(level, size, modifier) * 0.05);\n\n \tvar loot = [gold, items, itemsRare];\n\n\treturn loot;\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<products.length; i+=1) {\n\t\tif (chosenProducts.indexOf(products[i].name) > -1){\n\t\t\ttotalPrice += products[i].price;\n\t\t}\n\t}\n\treturn Math.round((totalPrice * 100)) /100;\n}", "function getMeat(runningTotal,text1,text2) {\n\tvar meatTotal = 0;\n\tvar selectedMeat = [];\n\tvar meatSubtotal = [];\n\tvar meatArray = document.getElementsByClassName(\"meats\");\n\tfor (var j = 0; j < meatArray.length; j++) {\n\t\tif (meatArray[j].checked) {\n\t\t\tselectedMeat.push(meatArray[j].value);\n\t\t\tmeatSubtotal.push(meatArray[j].length);\n\t\t\tconsole.log(\"selected meat item: (\"+meatArray[j].value+\")\");\n\t\t\tconsole.log(\"selected meat price: (\"+meatArray[j].length+\")\");\n\t\t\ttext1 = text1+meatArray[j].value+\"<br>\";\n\t\t\t\n\t\t\tif (meatSubtotal.length <=1) {\n\t\t\t\ttext2 = text2+0+\"<br>\";\n\t\t\t} else {\n\t\t\t\ttext2 = text2+1+\"<br>\";\n\t\t\t}\n\t\t}\n\t}\n\t\t//This statement sets a value for confirmOrder and subTotal if no boxes are checked\n\t\tif (selectedMeat.length === 0) {\n\t\ttext1 = text1+\"No Meats\"+\"<br>\";\n\t\ttext2 = text2+0+\"<br>\";\n\t\t}\t\t\n\t\n\t\n\tvar meatCount = selectedMeat.length;\n\tif (meatCount > 1) {\n\t\tmeatTotal = (meatCount - 1);\n\t} else {\n\t\tmeatTotal = 0;\n\t}\n\t\n\t\n\trunningTotal = (runningTotal + meatTotal);\n\tconsole.log(\"total selected meat items: \"+meatCount);\n\tconsole.log(meatCount+\" meat - 1 free meat = \"+\"$\"+meatTotal+\".00\");\n\tconsole.log(\"meat text1: \"+text1);\n\tconsole.log(\"meat text2: \"+text2);\n\tconsole.log(\"Purchase Total: \"+\"$\"+runningTotal+\".00\");\n\tgetVeggies(runningTotal, text1,text2);\n}", "function calculateTotal(arr){\n \n //Command won't work if no items are in list\n if (nameAndPrice.length == 0){\n println(\"Invalid Command\");\n } else {\n var taxed = [];\n var final = 0;\n \n for (var i = 0; i < arr.length; i++){\n if (arr.indexOf(arr[i]) % 2 == 0){\n //Excludes product names from final price\n } else if (arr.indexOf(arr[i]) % 2 != 0){\n var temp = arr[i]*1.1; //Finds the taxed price of the item and stores it in a temporary variable\n taxed.push(temp); //Stores that in a new array consisting of taxed prices\n } \n }\n \n for (var i = 0; i < taxed.length; i++){\n final += taxed[i]; //Adds every taxed price to a single integer (final price)\n }\n \n //Applies any available discount to the final price\n var discount = readInt('How much discount did you recieve on your final purchase? If none, enter zero. %')\n final *= ((100 - discount)*0.01);\n \n return final;\n }\n}", "function getCoins(amount) {\n if (amount == 0) {\n coinDisplayParent.innerHTML = \"\";\n }\n // define total as amount that can be manipulated\n let total = amount;\n\n //create empty array\n const coinArr = [];\n\n Object.values(coins).forEach((coin, i) => {\n while (total >= coin) {\n // add coin to array if coin value is less than total\n coinArr.push(Object.keys(coins)[i]);\n //displayCoinImage(coinArr)\n // subtract coin value from given amount\n total -= coin;\n }\n });\n\n displayCoinImage(coinArr);\n //coinDisplayParent.innerHTML = coinArr.join(', ')\n return coinArr;\n}", "function choose_list_items(amount, list) {\n\tif (!Array.isArray(list)) throw list + \" must be an array\";\n\tif (amount > list.length) throw \"amount must be less than or equal list length\";\n\tvar used_indicies = [];\n\tvar chosen_items = [];\n\tfor (var i = 0; i < amount; i++) {\n\t\tvar index = Math.floor((Math.random() * list.length));\n\t\twhile (used_indicies.indexOf(index) != -1) index = Math.floor((Math.random() * list.length));\n\t\tused_indicies.push(index);\n\t\tchosen_items.push(list[index]);\n\t}\n\tif (amount == 1) {\n\t\treturn chosen_items[0];\n\t}\n\treturn chosen_items;\n}", "function getCheese(runningTotal,text1,text2) {\n\tvar cheeseTotal = 0;\n\tvar selectedCheese = [];\n\tvar cheeseArray = document.getElementsByClassName(\"cheese\");\n\tfor (var j = 0; j < cheeseArray.length; j++) {\n\t\tif (cheeseArray[j].checked) {\n\t\t\tselectedCheese = cheeseArray[j].value;\n\t\t}\n\t\tif (selectedCheese === \"Extra cheese\") {\n\t\t\tcheeseTotal = 3;\n\t\t}\n\t}\n\ttext2 = text2 +cheeseTotal + \"<br>\";\n\ttext1 = text1 + selectedCheese + \"<br>\";\n\trunningTotal = (runningTotal + cheeseTotal);\n\tgetSauce(runningTotal,text1,text2);\n}", "function getOrder(input) {\n // split into individual characters\n const splitOrder = input.split(\"\");\n // unsorted order array\n const orderArr = [];\n // temp variable for each order item\n let orderItem = \"\";\n // loop through characters to create order items\n for (let i = 0; i < splitOrder.length; i++) {\n // if the string is equal to a menu item\n if (orderItem === \"Burger\" || orderItem === \"Fries\" || orderItem === \"Chicken\" || orderItem === \"Pizza\" || orderItem === \"Sandwich\" || orderItem === \"Onionrings\" || orderItem === \"Milkshake\" || orderItem === \"Coke\") {\n // add to order array\n orderArr.push(orderItem);\n // clear the order item string\n orderItem = \"\";\n } \n // if the order item string is empty\n if (orderItem.length < 1) {\n // capitalize and add to order item string\n orderItem = splitOrder[i].toUpperCase();\n } else {\n // just add to order item string\n orderItem += splitOrder[i];\n }\n }\n orderArr.push(orderItem);\n // create an object to keep a tally of how many times an item appears in the order array\n const orderObj = {};\n for (let i = 0; i < orderArr.length; i++) {\n if (orderObj[orderArr[i]]) {\n orderObj[orderArr[i]]++;\n } else {\n orderObj[orderArr[i]] = 1;\n }\n }\n // create a set of the order array\n const orderSet = new Set(orderArr);\n // template for the specified order of the menu items\n const order = [\"Burger\",\n \"Fries\",\n \"Chicken\",\n \"Pizza\",\n \"Sandwich\",\n \"Onionrings\",\n \"Milkshake\",\n \"Coke\"];\n // sort the set and store in a new array\n const sortedArr = order.filter(item => orderSet.has(item));\n const completeOrderArr = [];\n // iterate over the array\n for (let i = 0; i < sortedArr.length; i++) {\n // for however many times the item appears in the order object\n for (let j = 0; j < orderObj[sortedArr[i]]; j++) {\n // add to the complete order array\n completeOrderArr.push(sortedArr[i]);\n }\n }\n return completeOrderArr.join(\" \");\n}", "function getCheese(runningTotal,text1,text2) {\n\tvar cheeseTotal = 0;\n\tvar cheeseArray = document.getElementsByClassName(\"cheese\");\n\tfor (var h = 0; h < cheeseArray.length; h++) {\n\t\tif (cheeseArray[h].checked) {\n\t\t\tvar selectedCheese = cheeseArray[h].value;\n\t\t\ttext1 = text1+selectedCheese+\"<br>\";\n\t\t}\n\t}\n\tif (selectedCheese === \"Extra Cheese\") {\n\t\tcheeseTotal = 3;\n\t} else {\n\t\tcheeseTotal = 0;\n\t}\n\t\n\t\n\trunningTotal = (runningTotal + cheeseTotal);\n\ttext2 = (text2 + cheeseTotal)+\"<br>\";\n\tconsole.log(selectedCheese+\" = $\"+cheeseTotal+\".00\");\n\tconsole.log(\"cheese text1: \"+text1);\n\tconsole.log(\"cheese text2: \"+text2);\n\tconsole.log(\"subtotal: $\"+runningTotal+\".00\");\n\tgetMeat(runningTotal,text1,text2);\n}", "function fn(n, src, got, all, subsets_total) \n{\t\n\tif (n == 0) \n\t{\n\t\tif (got.length > 0) \n\t\t{\n\t\t\tall[all.length] = got;\n\t\t}\n\t\treturn;\n\t}\n\t\n\tfor (var j = 0; j < src.length; j++) \n\t{\t\n\t\tvar curr_price = Number(src[j][\"price\"].replace(\"$\", \"\"));\n\t\tsubsets_total += curr_price;\t\n\t\tif(subsets_total <= total){\n\t\t\tfn(n - 1, src.slice(j + 1), got.concat([src[j]]), all, subsets_total);\t\t//different products with lesser difference is cost are considered\n\t\t} else {\n\t\t\tsubsets_total = 0;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn;\n}", "function buyInShop(money,price){\n\t\t\tvar amount=Math.floor(money/price);\n\t\t\t\n\t\t\treturn [amount,amount]\n\t\t}", "function countProfit(shoppers) {\n let listBarang = [ ['Sepatu Stacattu', 1500000, 10],\n ['Baju Zoro', 500000, 2],\n ['Sweater Uniklooh', 175000, 1]\n ];\n // you can only write your code here!\n if (shoppers.length == 0) {\n return []\n }\n let pot = {}\n // {\n // Sepatu: { \n // price: 15000000\n // stock: 10\n // } \n // }\n\n for (let i = 0; i < listBarang.length; i++) {\n pot[listBarang[i][0]] = {\n price: listBarang[i][1],\n stock: listBarang[i][2]\n }\n }\n \n // let namaShopper = countProfit[0]['name']\n let result = []\n for (let i = 0; i < listBarang.length; i++) {\n let shop = {\n product: listBarang[i][0],\n shoppers: [],\n leftOver: listBarang[i][2],\n totalProfit: 0,\n } \n result.push(shop)\n }\n \n for (let i = 0; i < shoppers.length; i++) {\n if (shoppers[i].product == 'Sepatu Stacattu' && result[0].leftOver >= shoppers[i].amount) {\n result[0].shoppers.push(shoppers[i].name)\n result[0].leftOver -= shoppers[i].amount\n result[0].totalProfit += shoppers[i].amount * listBarang[0][1] \n } else if (shoppers[i].product == 'Baju Zoro' && result[1].leftOver >= shoppers[i].amount) {\n result[1].shoppers.push(shoppers[i].name)\n result[1].leftOver -= shoppers[i].amount\n result[1].totalProfit += shoppers[i].amount * listBarang[1][1]\n } else if (shoppers[i].product == 'Sweater Uniklooh' && result[2].leftOver >= shoppers[i].amount) {\n result[2].shoppers.push(shoppers[i].name)\n result[2].leftOver -= shoppers[i].amount\n result[2].totalProfit += shoppers[i].amount * listBarang[2][1]\n }\n }\n \n \n return result\n}", "function budgetCalculator(watch, phone, laptop) {\n let allPrice = watch * 50 + phone * 100 + laptop * 500;\n return allPrice;\n}", "function PricePerUnit() { \r\n // The PricePer function grabs all the prices and does calculations on them when Auction House pages load.\r\n var pricePer = function(descending)\r\n {\r\n // Get the listed sales.\r\n var sales = $('div[id^=\"sale\"]');\r\n var isFood = $($('#search_food')[0]).attr('style').indexOf('font-weight: bold') > -1;\r\n \r\n var pricesPer = [];\r\n \r\n for (var i = 0; i < sales.length; i++)\r\n {\r\n // For each sale, get the item counts and pricing - then divide!\r\n var sale = $(sales[i]);\r\n var count = $(sale.find('div span span')[0]).text().trim();\r\n if (isFood)\r\n {\r\n var id = $(sales.find('div > span > span')[0]).text();\r\n \r\n var foodRate = getFoodPointsById(id);\r\n if (foodRate)\r\n count *= foodRate;\r\n }\r\n var priceEl = $(sale.find('div[id^=\"buy_button\"]')[0]);\r\n var price = priceEl.text().trim();\r\n \r\n // Convert the treasure totals into friendly values (k, Mil, and various decimal counts)\r\n if (count > 1)\r\n {\r\n var pricePer = price/count;\r\n pricesPer.push(pricePer);\r\n \r\n if (pricePer > 1000000)\r\n {\r\n pricePer = Math.round(pricePer / 100000) / 10 + ' Mil';\r\n }\r\n else if (pricePer > 1000)\r\n {\r\n pricePer = Math.round(pricePer / 100) / 10 + 'k';\r\n }\r\n else if (pricePer > 10)\r\n {\r\n pricePer = Math.round(pricePer);\r\n }\r\n else if (pricePer > 3)\r\n {\r\n pricePer = Math.round((price/count) * 10) / 10;\r\n }\r\n else {\r\n pricePer = Math.round((price/count) * 100) / 100;\r\n }\r\n priceEl.html(priceEl.html().replace(price + '<br>', pricePer + ' <span style=\"color: #008000;\">x' + count + (isFood ? ' pt' : '') + '</span><br>'));\r\n }\r\n else\r\n {\r\n pricesPer.push(parseInt(price));\r\n }\r\n }\r\n \r\n // Sort the listings by price per (can't sort all items at once, but no reason not to sort each page).\r\n // This is basically an insertion sort - I don't know if this is poor or not, but I really don't care about performance when sorting ~10 items.\r\n for (var i = 0; i < sales.length; i++)\r\n {\r\n for (var j = i + 1; j < sales.length; j++)\r\n {\r\n if (!descending && pricesPer[j] < pricesPer[i] || descending && pricesPer[j] > pricesPer[i])\r\n {\r\n $(sales[i]).before($(sales[j]));\r\n \r\n // Reload my query since things moved.\r\n sales = $('div[id^=\"sale\"]');\r\n \r\n var pricePerToMove = pricesPer.splice(j, 1)[0];\r\n pricesPer.splice(i, 0, pricePerToMove);\r\n }\r\n }\r\n }\r\n }\r\n \r\n // Actually call the price per item function when the Auction House pages stop loading.\r\n $(document).ajaxSuccess(function(e, xhr, options) {\r\n if (options.url.indexOf('ah_buy_') > -1)\r\n {\r\n if (options.data.order == 'DESC')\r\n {\r\n pricePer(true);\r\n }\r\n else\r\n {\r\n pricePer(false);\r\n }\r\n }\r\n });\r\n}", "function getTotalPrice(chosenProducts) {\n\ttotalPrice = 0;\n\tfor (let i=0; i<chosenProducts.length; i+=1) {\n\t\ttotalPrice+=chosenProducts[i].price;\n\t}\n\treturn totalPrice;\n}", "function budgetCalculator(ghori, phone, laptop) {\n var ghoriPrice = 50;\n var phonePrice = 100;\n var laptopPrice = 500;\n var totalGhori = ghori * 50;\n var totalPhone = phone * 100;\n var totalLaptop = laptop * 500;\n var totalcost = totalGhori + totalPhone + totalLaptop;\n\n return totalcost;\n}", "function loadSelection(level) {\n //level 1&2 have 1/2 choices, afterwards give 3\n if (level <= 1) choiceAmt = level+1;\n else choiceAmt = 2;\n let selection = [];\n //for loop makes 2 items\n for(let i= 0; i<choiceAmt; i++) {\n let randomChg = Math.max(1, levelNeed[level] + Math.floor(Math.random()*4) - 2);\n let itemChoice = createItem(\"rand\", randomChg);\n selection.push(itemChoice);\n if(selection.length == 2){\n if(selection[0].type == selection[1].type){\n console.log(\"both items type \" + selection[0].type + \". rerolling!\");\n selection = [];\n i = -1;\n }\n }\n }\n // and a charge\n if(selection.length == 2){\n // if( (Items[0]==0 || Items[0].depleted) && (Items[1]==0 || Items[1].depleted) && (Items[2]==0 || Items[0].depleted) ) {\n let generatedChg = Math.max( Math.min( (levelNeed[level]+Math.floor(Math.random()*4)-2), 6) ,1);\n console.log(generatedChg);\n if (level>=2) selection.push(generatedChg)\n // }\n }\n return selection;\n}", "function allItems(){\n for(let i = 1; i <= 20; i++) {\n const ing = `strIngredient${i}`;\n const mes = `strMeasure${i}`;\n \n const ingredient = data.meals[0][ing];\n const measure = data.meals[0][mes];\n const itemArray = [measure + \" \" + ingredient];\n \n if(ingredient === \"\") {\n break;\n }\n \n return itemArray;\n } \n }", "function generateCombinations(vialCombinations, targetDose) {\n let combinations = []; // declare empty array to hold combinations for output\n\n // sort vialcombinations according to size in descending order\n const sortedVials = vialCombinations.sort((vial1, vial2) => {\n return vial1.size - vial2.size;\n }).reverse();\n\n // for each of the vials, start with that vial size and try to fill\n sortedVials.forEach((startVial, idx, arr) => {\n //console.log('CURRENT STARTVIAL: ', startVial.size);\n if (idx === arr.length - 1) {\n //console.log('YOU HAVE HIT THE LAST STARTVIAL, ENDING COMBINATIONS...');\n return;\n }\n\n if (startVial.waste === 0) { // if the vial does not produce waste on it's own then skip it\n //console.log('START VIAL DOES NOT PRODUCE WASTE, GOING TO NEXT START VIAL...');\n return;\n }\n\n // otherwise\n let vialCounts = {}; //create counts object\n vialCounts[startVial.size] = Math.floor(targetDose / startVial.size); // try to fill up as much as we can\n let amountFilled = startVial.size * vialCounts[startVial.size]; // start filled amount with total filled by startVial\n //console.log('STARTING AMOUNT LEFT:', amountFilled);\n // NOTE: WHAT ABOUT IF THE START VIAL DIVIDES EVENLY, SHOULD I STILL LOOK AT MORE OPTIONS just go on to the next one?\n // NOTE: Currently will just skip to next one\n\n for (let i = idx + 1; i < arr.length; i++) { // iterate through rest of sizes;\n let currVial = arr[i]; // curr vial ref\n\n let currCount = 0; // declar startCount for current vial\n\n while (amountFilled < targetDose) { // keep trying to fill the vial with next size down until you hit/exceed target\n amountFilled += currVial.size; // add the the vial and increase the count\n currCount += 1;\n }\n\n if (amountFilled === targetDose) { // if amount filled is equal to target Dose\n // create a combination object and push to combinations and continue\n // console.log('FILLED WITHOUT WASTE WITH COMBINATION');\n vialCounts[currVial.size] = currCount; // add count to object\n // console.log('FINAL COUNTS FOR COMBO:', vialCounts);\n combinations.push(vialCounts);\n return; // go on to next startVial size\n } else if (amountFilled > targetDose && i === arr.length - 1) { // more amount filled is more than target, and adding final size end\n // console.log('FILLED WITH WASTE AND REACHED SMALLEST VIAL SIZE TOTAL: ' + amountFilled);\n vialCounts[currVial.size] = currCount; // add count to object\n // console.log('FINAL COUNTS FOR COMBO:', vialCounts);\n // create a vialcombo object and and add to the array\n combinations.push(vialCounts);\n return;// skip to next startVial\n // move on and try to fill thingswill next smallest vial\n } else { // else if there are still vials left to check\n // console.log('FILLED WITH WASTE BUT CAN SWAP FOR SMALLER VIAL SIZES');\n // console.log('AMOUNT FILLED BEFORE BACKTRACK FOR SIZE ' + currVial.size , amountFilled);\n // console.log('NUMBER OF VIALS USED FOR SIZE ' + currVial.size + ' TO EXCEED AMOUNT FILLED: ', currCount);\n\n amountFilled -= currVial.size; // subtract one bottle of the most recently used vials\n currCount -= 1; // take away one of the bottles from the count\n vialCounts[currVial.size] = currCount; // set current count\n // console.log('MOVING ON TO NEXT VIAl...');\n // console.log('CURRENT COUNTS:', vialCounts);\n }\n }\n });\n // make sure to delete all vials not used in combo\n combinations.forEach((combo) => {\n for (key in combo) {\n if (combo[key] === 0) {\n delete combo[key]\n }\n }\n });\n\n // console.log('~~~~~FINAL VIAL COUNTS~~~~~');\n // combinations.forEach((combo) => {\n // console.log(combo);\n // });\n return combinations; // returns array of combinations to be parsed\n}", "function budgetCalculator(watch, phone, laptop){\n // cost every single item\n var watchCost = watch * 50;\n var phoneCost = phone * 100;\n var laptopCost = laptop * 500;\n //total cost of all item.\n var totalCost = watchCost + phoneCost + laptopCost;\n return totalCost;\n\n}", "function restrictList(product, restriction, is_organic, type){\n let temp;\n for (let i = 0; i < product.length; i++) {\n for (let j = 0; j < product.length; j++) {\n if (product[i].price < product[j].price) {\n temp = product[i]\n product[i] = product[j]\n product[j] = temp\n }\n }\n }\n let product_names = [];\n if (type==\"all\") {\n if (is_organic == true) {\n for (let i = 0; i < product.length; i += 1) {\n if ((restriction == \"Vegetarian\") && (product[i].vegetarian == true) && (product[i].organic == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"GlutenFree\") && (product[i].glutenFree == true) && (product[i].organic == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"VegAGlu\") && (product[i].glutenFree == true) && (product[i].vegetarian == true) && (product[i].organic == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"None\") && (product[i].organic == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n }\n }\n } else {\n for (let i = 0; i < product.length; i += 1) {\n if ((restriction == \"Vegetarian\") && (product[i].vegetarian == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"GlutenFree\") && (product[i].glutenFree == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"VegAGlu\") && (product[i].glutenFree == true) && (product[i].vegetarian == true)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if (restriction == \"None\") {\n product_names.push(product[i].name + \" $\" + product[i].price);\n }\n }\n }\n }\n else{\n if (is_organic == true) {\n for (let i = 0; i < product.length; i += 1) {\n if ((restriction == \"Vegetarian\") && (product[i].vegetarian == true) && (product[i].organic == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"GlutenFree\") && (product[i].glutenFree == true) && (product[i].organic == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"VegAGlu\") && (product[i].glutenFree == true) && (product[i].vegetarian == true) && (product[i].organic == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"None\") && (product[i].organic == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n }\n }\n } else {\n for (let i = 0; i < product.length; i += 1) {\n if ((restriction == \"Vegetarian\") && (product[i].vegetarian == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"GlutenFree\") && (product[i].glutenFree == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if ((restriction == \"VegAGlu\") && (product[i].glutenFree == true) && (product[i].vegetarian == true) &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n } else if (restriction == \"None\" &&(product[i].type==type)) {\n product_names.push(product[i].name + \" $\" + product[i].price);\n }\n }\n }\n }\n return product_names;\n}", "function carrito(item, add) {\n if (item == 0 && add == 0 && aItem > 0) {\n aItem--;\n aStr = \"\" + aItem;\n document.getElementById(\"cantidad1\").innerHTML = \"Cantidad: \" + aStr;\n }\n if (item == 0 && add == 1) {\n aItem++;\n aStr = \"\" + aItem;\n document.getElementById(\"cantidad1\").innerHTML = \"Cantidad: \" + aStr;\n }\n if (item == 1 && add == 0 && bItem > 0) {\n bItem--;\n bStr = \"\" + bItem;\n document.getElementById(\"cantidad2\").innerHTML = \"Cantidad: \" + bStr;\n }\n if (item == 1 && add == 1) {\n bItem++;\n bStr = \"\" + bItem;\n document.getElementById(\"cantidad2\").innerHTML = \"Cantidad: \" + bStr;\n }\n if (item == 2 && add == 0 && cItem > 0) {\n cItem--;\n cStr = \"\" + cItem;\n document.getElementById(\"cantidad3\").innerHTML = \"Cantidad: \" + cStr;\n }\n if (item == 2 && add == 1) {\n cItem++;\n cStr = \"\" + cItem;\n document.getElementById(\"cantidad3\").innerHTML = \"Cantidad: \" + cStr;\n }\n if (item == 3 && add == 0) {\n resultado = (aItem * 5000 + bItem * 2000 + cItem * 500) * 1.16;\n rStr = \"\" + resultado;\n document.getElementById(\"checkout\").innerHTML = \"Total: \" + \"$\" + rStr;\n }\n return 0;\n}", "function customerChoices() {\n var query = \"SELECT * FROM products\";\n connection.query(query, function (err, res) {\n if (err) throw err;\n for (i = 0; i < res.length; i++) {\n console.log(clc.cyanBright(\"Product ID: \" + res[i].item_id + \" | Item: \" + res[i].product_name + \" | Today's Price: $\" + res[i].price +'\\n'));\n }\n runSearch();\n });\n}", "function retrievePrices(){\r\n if ((ticket.noOfAdults>0) || (ticket.noOfChildren>0)){\r\n switch (ticket.passChoice){\r\n case \"Day Pass\":\r\n ticket.costCurrent += ((adultDayPass*ticket.noOfAdults) + (childDayPass*ticket.noOfChildren));\r\n break;\r\n case \"Student Pass\":\r\n ticket.costCurrent += ((adultStudentPass*ticket.noOfAdults) + (childStudentPass*ticket.noOfChildren));\r\n break;\r\n case \"Foreigner Pass\":\r\n ticket.costCurrent += ((adultForeignerPass*ticket.noOfAdults) + (childForeignerPass*ticket.noOfChildren));\r\n break;\r\n }\r\n switch (ticket.duration){\r\n case \"Three Hours\":\r\n break;\r\n case \"Half Day\":\r\n ticket.costCurrent += (halfDayPrice*(ticket.noOfAdults + ticket.noOfChildren));\r\n break;\r\n case \"Full Day\":\r\n ticket.costCurrent += (fullDayPrice*(ticket.noOfAdults + ticket.noOfChildren));\r\n break;\r\n case \"Two Days\":\r\n ticket.costCurrent += (twoDaysPrice*(ticket.noOfAdults + ticket.noOfChildren));\r\n break;\r\n }\r\n ticket.costCurrent += (ticket.annualPass*annualPassPrice) + (ticket.foodToken*foodTokenPrice); //add the number of yearly passes and food tokens at the end\r\n }\r\n showCurrentOrder();\r\n}", "function deliveryCost( product){\nconst costPerProduct =100;\nconst costSecondPerProduct=80;\nconst costThirdPerProduct =50;\nif(product<=100){\nvar totalProducts=product*costPerProduct;\nreturn totalProducts;\n}\nelse if(product<=200){\nconst first100 =100*costPerProduct;\nconst restProducts = product-100;\nconst secondProduct = restProducts*costSecondPerProduct;\nconst totalProducts=first100+secondProduct;\nreturn totalProducts;\n}\nelse{\nconst first100 =100*costPerProduct;\nconst secondProduct = 100*costSecondPerProduct;\nconst restProducts = product-200;\nconst thirdProducts= restProducts*costThirdPerProduct;\nconst totalProducts= first100+secondProduct+thirdProducts;\nreturn totalProducts;\n}\n}", "function selectedItems(){\n\t\n\tvar ele = document.getElementsByName(\"product\");\n\tvar chosenProducts = [];\n\t\n\tvar c = document.getElementById('displayCart');\n\tc.innerHTML = \"\";\n\t\n\t// build list of selected item\n\tvar para = document.createElement(\"P\");\n\tpara.innerHTML = \"You selected : \";\n\tpara.appendChild(document.createElement(\"br\"));\n\tpara.appendChild(document.createElement(\"br\"));\n\tfor (let i = 0; i < ele.length; i++) { \n\t\tif (ele[i].checked) {\n\t\t\tpara.appendChild(document.createTextNode(ele[i].value));\n\t\t\tpara.appendChild(document.createElement(\"br\"));\n\t\t\tpara.appendChild(document.createElement(\"br\"));\n\t\t\tchosenProducts.push(ele[i].value);\n\t\t}\n\t}\n\t\t\n\t// add paragraph and total price\n\tc.appendChild(para);\n\tc.appendChild(document.createTextNode(\"Total Price is $\" + getTotalPrice(chosenProducts)));\n\t\t\n}", "function getPriceGroups(){\n\tlet result = _.groupBy(pizzaToppingPrices, (item) => {\n\t\t//this will return based on item passes in and value\n return Math.floor(item.price / 1.0) \n })\n\treturn result;\n}", "function budgetCalculator(numberOfWatch, numberOfMobile, numberOfLaptop) {\n\n //when the quantity is negative\n if (numberOfWatch < 0) {\n return \"Number of watch is invalid\";\n }\n\n if (numberOfMobile < 0) {\n return \"Number of mobile is invalid\";\n }\n if (numberOfLaptop < 0) {\n return \"Number of laptop is invalid\";\n }\n\n\n\n var singleWatchPrice = 50;//price of a watch is given 50 tk\n var singleMobilePrice = 100;// price of a mobile is given 100tk\n var singleLaptopPrice = 500;// price of a laptop is given 500 tk\n\n\n\n var totalPriceOfWatch = singleWatchPrice * numberOfWatch;//total price of watch\n\n\n var totalPriceOfMobile = singleMobilePrice * numberOfMobile;//total price of mobile\n\n var totalPriceOfLaptop = singleLaptopPrice * numberOfLaptop;//total price of laptop\n\n //Total cost calculation\n var totalCost = totalPriceOfWatch + totalPriceOfMobile + totalPriceOfLaptop;\n\n\n return (totalCost);\n\n\n}", "createShoppingList(mealNames, database) {\n let shoppingList = [];\n if (mealNames != undefined) {\n for (let mealNameIndex = 0; mealNameIndex < mealNames.length; mealNameIndex++) {\n for (let recipeIndex = 0; recipeIndex < database.length; recipeIndex++) {\n if (database[recipeIndex].name == mealNames[mealNameIndex]) {\n // let tempname = \"Ingredients for \" + mealNames[mealNameIndex];\n // shoppingList.push({ingredient:tempname});\n for (ingredientIndex = 0; ingredientIndex < database[recipeIndex].ingredients.length; ingredientIndex++) {\n let temp = \"\";\n if (database[recipeIndex].ingredients[ingredientIndex].amount == 0) {\n temp += database[recipeIndex].ingredients[ingredientIndex].name;\n }\n else if (database[recipeIndex].ingredients[ingredientIndex].measurement == \"\") {\n temp += database[recipeIndex].ingredients[ingredientIndex].amount + \" \" + database[recipeIndex].ingredients[ingredientIndex].name;\n } else {\n temp += database[recipeIndex].ingredients[ingredientIndex].amount + \" \" + database[recipeIndex].ingredients[ingredientIndex].measurement + \" \" + database[recipeIndex].ingredients[ingredientIndex].name;\n }\n shoppingList.push({ ingredient: temp, isChecked: false, index: shoppingList.length, mealName: mealNames[mealNameIndex] });\n }\n shoppingList.push(\"\");\n break;\n }\n }\n }\n }\n shoppingList.pop();\n return shoppingList;\n }", "function purchase(choice){\n if (choice == 0 && balance >= 75){\n console.log(\"You have purchased Dr Pepper\");\n }\n if (choice == 1 && balance >= 75){\n console.log(\"You have purchased Coke\");\n }\n if (choice == 2 && balance >= 75){\n console.log(\"You have purchased Pepsi\");\n }\n if (choice == 3 && balance >= 150){\n console.log(\"You have purchased Flake\");\n }\n if (choice == 4 && balance >= 150){\n console.log(\"You have purchased KitKat\");\n }\n if (choice == 5 && balance >= 150){\n console.log(\"You have purchased Daim\");\n }\n if (choice == 6 && balance >= 100){\n console.log(\"You have purchased Skips\");\n }\n if (choice == 7 && balance >= 100){\n console.log(\"You have purchased Monster Munch\");\n }\n if (choice == 8 && balance >= 100){\n console.log(\"You have purchased McCoys\");\n }\n\n}", "function calculateGrandTotal( prices ) {\n\n\t// Create a variable to hold the grand total\n\tvar grandTotal = 0\n\n\t// Loop over all the prices\n\tfor( var i = 0; i < prices.length; i++) {\n\t\tgrandTotal = grandTotal + prices[i]; \n\t}\n\n\t//Display the grand total\n\tconsole.log( grandTotal );\n\n}", "function budgetCalculator(watch, phone, laptop) {\n // watch total prise\n var price1 = watch * 50;\n\n // phone total prise\n var price2 = phone * 100;\n\n // laptop total prise\n var price3 = laptop * 500;\n\n // all over prise\n var price = price1 + price2 + price3;\n return price;\n\n}", "function printReceipt(arr){\n \n //Command won't work if no items are in list\n if (nameAndPrice.length == 0){\n println(\"Invalid Command\");\n } else {\n var print = readBoolean(\"Would you still like to waste precious materials?\"); //Rechecks if they want to proceed\n \n //Assorts the list into names and prices, then prints them out accordingly\n if(print == true){\n for(var i = 0; i < arr.length; i++){\n if (arr.indexOf(arr[i]) % 2 == 0){\n println(arr[i] + \": \");\n } else if (arr.indexOf(arr[i]) % 2 != 0){\n println('$' + arr[i]); \n }\n }\n \n var total = calculateTotal(arr); //Passes the list to a new function intended to find the list\n println(\"Subtotal: \" + total/1.1); //Removes tax from total price\n println(\"Tax: $\" + (total - (total/1.1))) //Removes subtotal price from total to get tax\n return 'Total: ' + '$' + total; //Gives the total price including total and tax\n println('Thanks for giving our online shopping experience a try!');\n \n // If they do not proceed with printing, they are given an option to view the total only\n } else {\n var total = readBoolean(\"Would you just like to view the program total?\"); \n if(total == true){\n return 'Total' + '$' + calculateTotal(arr);\n println('Thanks for giving our online shopping experience a try!');\n \n //If they don't want to view the total, they can provide feedback!\n } else if (total == false){\n println('Thanks for giving our online shopping experience a try!');\n var discard = readLine('Please provide us with any valuable feedback, so that we can further enhance our services! ');\n }\n }\n }\n}", "function budgetCalculator(watch, phone, laptop){\n var watchPrice = 50 * watch;\n var phonePrice = 100 * phone;\n var laptopPrice = 500 * laptop;\n var totalPrice = watchPrice + phonePrice + laptopPrice;\n return totalPrice;\n}", "function displayOrder(order) {\n\n console.log(\"\\n\\n\");\n console.log(` # | Product | Qty | Price | SubTotal `);\n console.log(`==============================================================================`);\n\n var grandTotal = 0;\n for (var q = 0; q < order.length; q++) {\n var p_item = new PaddedWord(order[q].item, 2, \" \", \"left\");\n var p_prod = new PaddedWord(order[q].product, 35, \" \");\n var p_quan = new PaddedWord(order[q].quantity, 3, \" \", \"left\");\n var p_pric = new PaddedWord(order[q].price, 6, \" \", \"left\");\n var p_subt = new PaddedWord(order[q].subtotal, 7, \" \", \"left\");\n grandTotal += parseFloat(order[q].subtotal);\n\n console.log(` ${p_item.padded()} | ${p_prod.padded()} | ${p_quan.padded()} | ${p_pric.padded()} | ${p_subt.padded()} `);\n console.log(`-----------------------------------------------------------------------------`);\n }\n var gtot = grandTotal.toFixed(2);\n console.log(` ${gtot} `);\n console.log(`-----------------------------------------------------------------------------`);\n\n inquirer.prompt([{\n type: 'confirm',\n name: 'continue',\n message: 'Would you like continue shopping? ',\n default: true \n }\n ]).then(function(response) {\n if (response.continue === true) {\n listProducts();\n } else {\n closeOrder(grandTotal);\n }\n });\n}", "function billTotal(food,drinks){\n var price = food + drinks;\n return price + price*(15/100) + price*((9.5)/100) ;\n}", "function billProcess(bill){\n // bill total\n var billTotal = 0;\n for (var i = 0; i < bill.length; i++) {\n for(var key in menuObject){\n if(menuObject.hasOwnProperty(key)){\n if(menuObject[key].index === bill[i]){\n // add cost to total bill amount\n billTotal += menuObject[key].price;\n }\n }\n }\n }\n // calc totals\n var gratuity = parseInt(0.2 * billTotal);\n var tax = parseInt(.071 * billTotal);\n var grandTotal = parseInt(billTotal) + parseInt(gratuity) + parseInt(tax);\n console.log(\"Your bill total before 7.1% tax and 20% gratuity is: $\" + billTotal.toFixed(2) + \"\\n\")\n console.log(\"Gratuity: $\" + gratuity.toFixed(2) + \"\\n\")\n console.log(\"Taxes: $\" + tax.toFixed(2) + \"\\n\")\n console.log(\"Grand Total: $\" + grandTotal.toFixed(2) + \"\\n\")\n console.log(\"Thanks for you business! Come again soon!\");\n}", "function addItems(nameAndPrice){\n \n //Initial Run:\n var initial = readLine(\"What was your first item? \");\n nameAndPrice.push(initial);\n var initial1 = readFloat(\"How much did your first item cost? $\");\n nameAndPrice.push(initial1);\n var moreItems = readBoolean(\"Did you purchase another item? Please reply with 'yes' or 'no'. \"); \n \n //If only one item was purchased, print a special line\n if (moreItems == false && nameAndPrice.length == 2){\n println('Have fun with the one item you purchased!');\n }\n \n //Keeps running in a loop until user doesn't have any more items to add\n while (moreItems == true){\n var next = readLine(\"What was this item's name? \");\n nameAndPrice.push(next);\n var next1 = readFloat(\"How much did this item cost? $\");\n nameAndPrice.push(next1);\n moreItems = readBoolean(\"Did you purchase another item? Please reply with 'yes' or 'no'. \");\n }\n \n //Outputs different commands depending on how many items the user purchased\n if (moreItems == false && nameAndPrice.length <= 16 && nameAndPrice.length > 2){ //Less than 8 & More than 2\n println('Well, that was a short one, you are welcome back anytime!');\n } else if (moreItems == 'no' && nameAndPrice.length > 16){ //More than 8\n println('Well, that was a long one, you are welcome back anytime you would like!');\n }\n \n}", "function totalNumberOfruit(totalOrange, TotalBanana, TotalApple) {\n totalCalories = totalOrange*orange + TotalBanana*banana + TotalApple*apple;\n return totalCalories; \n \n}", "function makeShoppingList(item1 = 'milk', item2 = 'bread', item3 = 'eggs'){\r\n console.log(`Remember to buy ${item1}`);\r\n console.log(`Remember to buy ${item2}`);\r\n console.log(`Remember to buy ${item3}`);\r\n }", "function totalSales(shirtQuantity,pantQuantity,shoesQuantity){\n if (typeof shirtQuantity != 'number' || typeof pantQuantity != 'number' || typeof shoesQuantity != 'number' ){\n return 'Please give a number'; \n }\n let perShirtPrice = 100;\n let perPantPrice = 200;\n let perShoesPrice = 500;\n // Price calculation\n let shirtPrice = shirtQuantity * perShirtPrice;\n let pantPrice = pantQuantity * perPantPrice;\n let shoesPrice = shoesQuantity * perShoesPrice;\n let totalCost = shirtPrice + pantPrice + shoesPrice;\n return totalCost;\n}", "function masterPizza(rad,cost,slices){\n var pizzaArea= pizzaArea1(rad);\n\n var sqInchCost= pizzaSqInchCost(cost,pizzaArea);\n\n var slicePrice=costPerSlice(slices,cost);\n\n return[sqInchCost,slicePrice]\n }", "function calculateTotal() {\n\t if(validQuantities == false)\n\t\t\treturn; \n\t var totalPrice = 0;\n\t\tfor (var i = 0; i< items.length; i++){\n\t\t\tvar size = document.forms[formName][sizeName[i]].value;\n\t\t\tvar quantity= parseInt(document.forms[formName][numberName[i]].value, 10);\n\t\t\tvar itemPrice = 0;\n\t\t\tconsole.log(size + \",\" + quantity.toString() +\",\" + i.toString());\n\t\t\tif(size==\"small\") {\n\t\t\t\titemPrice = quantity * smallPrices[i];\n\t\t\t}\n\t\t\tif(size == \"medium\") {\n\t\t\t\titemPrice = quantity * mediumPrices[i];\n\t\t\t}\n\t\t\tif(size == \"large\") {\n\t\t\t\titemPrice = quantity * largePrices[i];\n\t\t\t}\n\t\t\ttotalPrice += itemPrice;\n\t\t}\n\t\ttotalPrice += mayoCost + seasoningCost + ketchupCost;\n\t\tdocument.getElementById(\"total\").innerHTML = \"<strong><u>Your Total is $\" + totalPrice.toString() + \"</strong></u>\";\n\t\treturn totalPrice;\n}", "function toppingPrice() {\n \"use strict\";\n var toppings = 0;\n\tvar arr = [];\n \n var theForm = document.forms[\"myDIV\"];\n var pepperoni = theForm.elements[\"pep\"];\n var sasauge = theForm.elements[\"sa\"];\n var ham = theForm.elements[\"ham\"];\n var bacon = theForm.elements[\"bacon\"];\n var salami = theForm.elements[\"salami\"];\n var peppers = theForm.elements[\"peppers\"];\n var olives = theForm.elements[\"olives\"];\n var jala = theForm.elements[\"jala\"];\n var mushroom = theForm.elements[\"mush\"];\n var pineapple = theForm.elements[\"pine\"];\n var onions = theForm.elements[\"onions\"];\n \n if (pepperoni.checked === true) {\n toppings += parseFloat(\"0.99\");\n\t\tarr.push(\"Pepperoni\");\n }\n if (sasauge.checked === true) {\n toppings += parseFloat(\"0.99\");\n\t\tarr.push(\"Sasauge\");\n }\n if (ham.checked === true) {\n toppings += parseFloat(\"0.99\");\n\t\tarr.push(\"Ham\");\n }\n if (bacon.checked === true) {\n toppings += parseFloat(\"0.99\");\n\t\tarr.push(\"Bacon\");\n }\n if (salami.checked === true) {\n toppings += parseFloat(\"0.99\");\n\t\tarr.push(\"Salami\");\n }\n if (peppers.checked === true) {\n toppings += parseFloat(\"0.99\");\n\t\tarr.push(\"Peppers\");\n }\n if (olives.checked === true) {\n toppings += parseFloat(\"0.99\");\n\t\tarr.push(\"Olives\");\n }\n if (jala.checked === true) {\n toppings += parseFloat(\"0.99\");\n\t\tarr.push(\"Jalapeno\");\n }\n if (mushroom.checked === true) {\n toppings += parseFloat(\"0.99\");\n\t\tarr.push(\"Mushroom\");\n }\n if (pineapple.checked === true) {\n toppings += parseFloat(\"0.99\");\n\t\tarr.push(\"Pineapple\");\n }\n if (onions.checked === true) {\n toppings += parseFloat(\"0.99\");\n\t\tarr.push(\"Onions\");\n }\n\t$(\"added\").innerHTML = arr.join(\",\");\n return toppings;\n}", "function coffeeShop(inputArr) {\n let orders = inputArr.shift();\n let result = 0;\n let i = 0;\n let price = inputArr[i];\n let days = inputArr[i + 1];\n let capsules = inputArr[i + 2];\n\n while (orders != 0) {\n let sum = (days * capsules) * price;\n result += sum;\n console.log(`The price for the coffee is: $${sum.toFixed(2)}`);\n i += 3\n price = inputArr[i];\n days = inputArr[i + 1];\n capsules = inputArr[i + 2];\n orders--;\n }\n\n // for(let i = 0; i < inputArr.length; i += 3) {\n // let price = inputArr[i];\n // let days = inputArr[i + 1];\n // let capsules = inputArr[i + 2];\n // let sum = (days * capsules) * price;\n // result += sum;\n // console.log(`The price for the coffee is: $${sum.toFixed(2)}`);\n // }\n console.log(`Total: $${result.toFixed(2)}`);\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 getTopping(runningTotal, text1) {\n let toppingTotal = 0;\n let selectedTopping = [];\n let toppingArray = document.getElementsByClassName(\"toppings\");\n \n // Add all selected toppings to selectedToppings array\n for (let i = 0; i < toppingArray.length; i++) {\n if (toppingArray[i].checked) {\n selectedTopping.push(toppingArray[i].value);\n console.log(\"selected topping item: (\" + toppingArray[i].value + \")\");\n text1 = text1 + toppingArray[i].value + \"<br>\";\n }\n }\n\n // Subtract 1 free topping from topping total if > 1 selected\n let toppingCount = selectedTopping.length;\n if (toppingCount > 1) {\n toppingTotal = (toppingCount - 1);\n } else {\n toppingTotal = 0;\n }\n\n runningTotal = (runningTotal + toppingTotal);\n console.log(\"total selected topping items: \" + toppingCount);\n console.log(toppingCount + \"topping - 1 free topping = \" + \"$\" + toppingTotal + \".00\");\n console.log(\"topping text1:\" + text1);\n console.log(\"Purchase total: \" + \"$\" + runningTotal + \".00\");\n document.getElementById(\"showText\").innerHTML = text1;\n document.getElementById(\"totalPrice\").innerHTML = \"<h3>Total: <strong>$\" +\n runningTotal + \".00</strong><h3>\";\n\n}", "function getTopping(runningTotal, text1) {\n var toppingTotal=0;\n var selectedTopping=[];\n var toppingArray=document.getElementsByClassName(\"toppings\");\n for (var j=0; j< toppingArray.length; j++) {\n if (toppingArray[j].checked) {\n selectedTopping.push(toppingArray[j].value)\n console.log(\"selected topping item: (\"+toppingArray[j].value+\")\");\n text1= text1+toppingArray[j].value+\"<br>\";\n }\n }\n var toppingCount=selectedTopping.length;\n if (toppingCount >1) {\n toppingTotal= (toppingCount-1);\n } else {\n toppingTotal=0;\n }\n runningTotal=(runningTotal + toppingTotal);\n console.log(\"total selected topping items: \"+ toppingCount);\n console.log(toppingCount+\" topping - 1 free topping = \" + \"$\" + toppingTotal+\".00\");\n console.log(\"topping text1: \"+text1);\n console.log(\"Purchase total: \"+\"$\"+runningTotal+\".00\");\n document.getElementById(\"showText\").innerHTML=text1;\n document.getElementById(\"totalPrice\").innerHTML=\"<h3> Total: <strong>$\"+ runningTotal+\".00\"+\"</strong></h3>\";\n}", "function haveEnough(money, apples, bread, applePrice, breadPrice) {\n var totalPrice = applePrice * apples + breadPrice * bread;\n var total = money >= totalPrice;\n\n return total;\n}", "function haveEnough(money, apples, bread, applePrice, breadPrice) {\n var totalPrice = applePrice * apples + breadPrice * bread;\n var total = money >= totalPrice;\n\n return total;\n}", "function numberOfItemsBasedOnCashAmount(itemPrice,money) {\n\tvar quotient = Math.floor(money/itemPrice);\n\tvar remainder = money%itemPrice;\n\tvar temp = quotient*remainder;\n\tif (isNaN(remainder)) {\n\t\talert(\"You should type only numbers!\")\n\t} else {\n\t\treturn (\"You will purchase \" + quotient + \" items, and you will have \" + remainder + \" change left.\");\n\t\t}\t\n}", "function totalPizza() {\n\t\tvar numPizza = 0;\n\t\tif (selectedValue == \"all\" && selectedValue2 == \"all\") {\n\t\t\tfor (var i = 0; i < deliveryDataCopy.length; i++) {\n\t\t\t\tnumPizza = numPizza + deliveryDataCopy[i].count;\n\t\t\t}\n\t\t\treturn numPizza;\n\t\t} else if (selectedValue == \"all\" && selectedValue2 == \"web\") {\n\t\t\tfor (var i = 0; i < allWebData.length; i++) {\n\t\t\t\tnumPizza = numPizza + allWebData[i].count;\n\t\t\t}\n\t\t\treturn numPizza;\n\t\t} else if (selectedValue == \"all\" && selectedValue2 == \"phone\") {\n\t\t\tfor (var i = 0; i < allPhoneData.length; i++) {\n\t\t\t\tnumPizza = numPizza + allPhoneData[i].count;\n\t\t\t}\n\t\t\treturn numPizza;\n\t\t} else if (selectedValue == \"Boston\" && selectedValue2 == \"all\") {\n\t\t\tfor (var i = 0; i < bostonAllData.length; i++) {\n\t\t\t\tnumPizza = numPizza + bostonAllData[i].count;\n\t\t\t}\n\t\t\treturn numPizza;\n\t\t} else if (selectedValue == \"Boston\" && selectedValue2 == \"web\") {\n\t\t\tfor (var i = 0; i < bostonWebData.length; i++) {\n\t\t\t\tnumPizza = numPizza + bostonWebData[i].count;\n\t\t\t}\n\t\t\treturn numPizza;\n\t\t} else if (selectedValue == \"Boston\" && selectedValue2 == \"phone\") {\n\t\t\tfor (var i = 0; i < bostonPhoneData.length; i++) {\n\t\t\t\tnumPizza = numPizza + bostonPhoneData[i].count;\n\t\t\t}\n\t\t\treturn numPizza;\n\t\t} else if (selectedValue == \"Cambridge\" && selectedValue2 == \"all\") {\n\t\t\tfor (var i = 0; i < cambridgeAllData.length; i++) {\n\t\t\t\tnumPizza = numPizza + cambridgeAllData[i].count;\n\t\t\t}\n\t\t\treturn numPizza;\n\t\t} else if (selectedValue == \"Cambridge\" && selectedValue2 == \"web\") {\n\t\t\tfor (var i = 0; i < cambridgeWebData.length; i++) {\n\t\t\t\tnumPizza = numPizza + cambridgeWebData[i].count;\n\t\t\t}\n\t\t\treturn numPizza;\n\t\t} else if (selectedValue == \"Cambridge\" && selectedValue2 == \"phone\") {\n\t\t\tfor (var i = 0; i < cambridgePhoneData.length; i++) {\n\t\t\t\tnumPizza = numPizza + cambridgePhoneData[i].count;\n\t\t\t}\n\t\t\treturn numPizza;\n\t\t} else if (selectedValue == \"Somerville\" && selectedValue2 == \"all\") {\n\t\t\tfor (var i = 0; i < somervilleAllData.length; i++) {\n\t\t\t\tnumPizza = numPizza + somervilleAllData[i].count;\n\t\t\t}\n\t\t\treturn numPizza;\n\t\t} else if (selectedValue == \"Somerville\" && selectedValue2 == \"web\") {\n\t\t\tfor (var i = 0; i < somervilleWebData.length; i++) {\n\t\t\t\tnumPizza = numPizza + somervilleWebData[i].count;\n\t\t\t}\n\t\t\treturn numPizza;\n\t\t} else {\n\t\t\tfor (var i = 0; i < somervillePhoneData.length; i++) {\n\t\t\t\tnumPizza = numPizza + somervillePhoneData[i].count;\n\t\t\t}\n\t\t\treturn numPizza;\n\t\t}\n\t}", "function budgetFilter (price , ls) {\n\n const result = [];\n let count = 0;\n\n for (let i = 0; i < ls.length; i++) {\n if (price >= ls[i]) {\n result[count] = ls[i];\n count++\n }\n }\n\n return result\n}", "function selectedItems(){\n\t\n\tvar ele = document.getElementsByName(\"product\");\n\tvar chosenProducts = [];\n\t\n\tvar c = document.getElementById('displayCart');\n\tc.innerHTML = \"\";\n\t\n\t// build list of selected item\n\tvar para = document.createElement(\"P\");\n\tpara.innerHTML = \"You selected: \";\n\tpara.appendChild(document.createElement(\"br\"));\n\tpara.appendChild(document.createElement(\"br\"));\n\tfor (i = 0; i < ele.length; i++) { \n\t\tif (ele[i].checked) {\n\t\t\tpara.appendChild(document.createTextNode(ele[i].value));\n\t\t\tpara.appendChild(document.createElement(\"br\"));\n\t\t\tpara.appendChild(document.createElement(\"br\"));\n\t\t\tchosenProducts.push(ele[i].value);\n\t\t}\n\t}\n\t\t\n\t// add paragraph and total price\n\tc.appendChild(para);\n\tc.appendChild(document.createTextNode(\"Total Price: $\" + getTotalPrice(chosenProducts).toFixed(2)));\n\t\t\n}", "function calculateSubtotal(){\n\tsubtotal = 0;\n\tfor (var i=0;i<numItems.length;i++){\n\t\titemPrices[i]=0;\n\t\tvar p = i+1;\n\t\tfor (var j=0;j<numItems[i];j++){\n\t\t\tn = j+1;\n\t\t\tvar currItem = \"per\" + p + \"item\" + n;\n\t\t\tvar currItemValue = parseFloat(document.getElementById(currItem).value.substr(1));\n\n\t\t\tsubtotal = subtotal + currItemValue;\n\t\t\titemPrices[i] = itemPrices[i]+currItemValue;\n\t\t\tif (j==numItems[i]-1){\n\t\t\t\tif (currItemValue == 0){\n\t\t\t\t\t$(\"#addItemButton\"+p).attr(\"disabled\", \"disabled\");\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t$(\"#addItemButton\"+p).removeAttr(\"disabled\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tsubtotal += shareditems_price;\n\t$('#runningSubtotalNum').html(displayDollar(subtotal));\n}", "function getNumItemsPerCategory() {\n // Get items per farming season\n const perSeason = [];\n farmSeasonFilters.forEach((season) => {\n const currentSeasonItems = produceListings.filter(\n (listing) => listing.season === season,\n );\n perSeason.push(currentSeasonItems.length);\n });\n setSeasonItems(perSeason);\n\n // Get items per item type (agency or standard)\n const numAgencyItems = produceListings.filter((listing) => listing.hasAgencyPrice).length;\n const numStandardItems = produceListings.length - numAgencyItems;\n setItemsPerItemType([numAgencyItems, numStandardItems]);\n\n // Get items per produce type\n const perProdType = [];\n produceTypeFilters.forEach((prodType) => {\n const currentProdItems = produceListings.filter(\n (listing) => listing.produceType === prodType,\n );\n perProdType.push(currentProdItems.length);\n });\n setProdItems(perProdType);\n\n // Get items per price range (0-15, 15-30, 30-45, 45-60, 60-75)\n const perPrice = [0, 0, 0, 0, 0];\n produceListings.forEach((listing) => {\n const thisPrice = listing.palletPrice;\n if (thisPrice >= priceOptions[0] && thisPrice <= priceOptions[1]) {\n perPrice[0] += 1;\n }\n if (thisPrice >= priceOptions[1] && thisPrice <= priceOptions[2]) {\n perPrice[1] += 1;\n }\n if (thisPrice >= priceOptions[2] && thisPrice <= priceOptions[3]) {\n perPrice[2] += 1;\n }\n if (thisPrice >= priceOptions[3] && thisPrice <= priceOptions[4]) {\n perPrice[3] += 1;\n }\n if (thisPrice >= priceOptions[4] && thisPrice <= priceOptions[5]) {\n perPrice[4] += 1;\n }\n });\n setPriceItems(perPrice);\n }", "formPackage(allItems) {\n var items = '',totalWeight = 0,totalPrice = 0,courierPrice = 0;\n allItems.forEach((val, index) => {\n if(items == '') items = val.Name;\n else items += ', '+val.Name;\n\n totalWeight += parseInt(val.Weight);\n totalPrice += parseInt(val.Price);\n })\n courierPrice = this.findCourierCharge(totalWeight);\n totalWeight = totalWeight+'g';\n totalPrice = '$'+totalPrice;\n\n return {'items': items, 'tw': totalWeight, 'tp': totalPrice, 'cp': courierPrice};\n }", "function coinCombo(cents) {\n const coinValues = [25, 10, 5, 1];\n // array for the output filled with zeros\n const coins = Array(coinValues.length).fill(0);\n \n let currentCents = cents;\n\n // loop over the coins\n for (const coin of coinValues) {\n // this will run if there are coins left\n while (currentCents >= coin) {\n // find out how many cents are left\n const remainder = currentCents % coin;\n // find how many times the current coins fit into the current cents\n const increaseBy = (currentCents - remainder) / coin;\n currentCents = currentCents % coin;\n const index = coinValues.length - 1 - coinValues.indexOf(coin);\n coins[index] += increaseBy;\n }\n }\n return coins;\n}", "function getTotal(price, quantity){\n const total = price * quantity;\n return total;\n}", "function getMoneySpent(keyboards, drives, budget) {\n\tlet totalPrice = -1;\n\n\tfor (let i = 0; i < keyboards.length; i++) {\n\t\tfor (let j = 0; j < drives.length; j++) {\n\t\t\tlet sum = keyboards[i] + drives[j];\n\n\t\t\tif (sum <= budget && sum > totalPrice) {\n\t\t\t\ttotalPrice = sum;\n\t\t\t}\n\t\t}\n\t}\n\n\tconsole.log(totalPrice);\n\treturn totalPrice;\n}", "function showAllItemsCost() {\n\tshowCost(healthKitShopItemEl, healingCost);\n\tshowCost(improveMagazineShopItemEl, magazineIncreaseCost);\n\tshowCost(fasterReloadShopItemEl, decreaseReloadingTimeCost);\n\tshowCost(increasePowerUpDurationShopItemEl, powerUpDurationIncreaseCost);\n}", "function dinersChoice(comments, main, side) {\n \n randa.makeComment(comments);\n \n console.log(\"check: \" + main[\"Hamburger\"]);\n \n let entrees = [];\n let sides = [];\n let runningTotal1 = 0;\n let runningTotal2 = 0;\n \n\n let mealChoices = document.getElementsByTagName('input');\n let mainOptions = [...mealChoices].filter(vetMainOptions);\n let sideOptions = [...mealChoices].filter(vetSideOptions);\n console.log(mainOptions);\n console.log(sideOptions)\n\n randa.itemCost(mainOptions, sideOptions, main);\n \n \n\n //create array of diner objects chosen by user\n\n \n function vetMainOptions(entreeChoice){\n if (entreeChoice.checked) {\n if (entreeChoice.name.includes(\"Entree\")) {\n // let mainSelection = entreeChoice.id;\n //entrees.push(mainSelection); \n console.log(entreeChoice.id);\n return entreeChoice; \n }\n // console.log(\"new \" + entrees)\n // return entrees;\n }\n } \n\n function vetSideOptions(sideChoice){\n if (sideChoice.checked) {\n if (sideChoice.name.includes(\"Side\")) {\n // let mainSelection = entreeChoice.id;\n //entrees.push(mainSelection); \n console.log(sideChoice.id);\n return sideChoice; \n }\n }\n }\n}", "function change(amount, coins) {\n \n if (amount == 0) return 1;\n let currentValue = coins[coins.length - 1];\n let totalCombinations = 0;\n for(let i = 0; i * currentValue <= amount; i++){\n totalCombinations += change(amount - i * currentValue, coins.slice(0, -1)) \n };\n return totalCombinations\n}", "function buyFruit(fruitPairs) {\n let items = [];\n\n fruitPairs.forEach(el => {\n for (let times = 0; times < el[1]; times += 1) {\n items.push(el[0]);\n }\n })\n\n return items;\n}", "function budgetCalculator(numberOfWatch, numberOfPhone, numberOfLaptop) {\n // checking validation\n if (numberOfWatch < 0 || numberOfPhone < 0 || numberOfLaptop <\n 0) {\n return \" Input valid quantity\";\n } else if (numberOfWatch == (null || undefined) || numberOfPhone == (null || undefined) || numberOfLaptop == (null || undefined)) {\n return \"This product is not free\";\n }\n\n // Price of Items\n var watchPrice = 50;\n var phonePrice = 100;\n var laptopPrice = 500;\n var total = (watchPrice * numberOfWatch) + (phonePrice * numberOfPhone) + (laptopPrice * numberOfLaptop);\n return total;\n}", "function getBreakdownFromFundingMatrix(fundingMatrix, purchasePrice) {\n //fundingOptions: [{ name: \"Cash on hand\", amortizationPeriod: \"\", interest: 0, amount: 100, amountType: AmountTypes.Percent, isCash: true }],\n let results = {\n purchasePrice,\n debtService: 0,\n amountCash: 0,\n optionUsages: [],\n };\n\n let priceRemaining = purchasePrice;\n let success = fundingMatrix.some(fundingOption => {\n let cashValue = fundingOption.amount;\n if (fundingOption.amountType === AmountTypes.Percent) {\n cashValue = (fundingOption.amount / 100) * purchasePrice;\n }\n\n let percentage = Math.min(priceRemaining / cashValue, 1);\n let optionUsage = Object.assign({}, fundingOption, { amount: cashValue * percentage, amountType: AmountTypes.Dollars });\n results.optionUsages.push(optionUsage);\n results.amountCash += optionUsage.isCash ? optionUsage.amount : 0;\n if (optionUsage.amortizationPeriod) {\n let moRate = optionUsage.interest / 12;\n let somePiece = Math.pow(1 + moRate, optionUsage.amortizationPeriod);\n let paymentAmount = cashValue * (moRate * somePiece) / (somePiece - 1);\n results.debtService += paymentAmount;\n } else if (optionUsage.interest) {\n // Interest only payments\n let paymentAmount = (cashValue * optionUsage.interest) / 12;\n results.debtService += paymentAmount;\n }\n results.push(optionUsage);\n priceRemaining -= optionUsage.amount;\n\n return priceRemaining <= 0;\n });\n\n return success ? results : undefined;\n}", "function reasonable_products(products){\n let res=[];\n products.forEach((product, i) => {\n if(product.price<=100){\n res.push(product);\n }\n });\n return res;\n}", "function calculateItemsAndTotal(){\n var li_perCopy = {};\n var li_perSubmission = {};\n var perCopyDescription = '';\n var perCopyCostFinal = 0;\n//This function builds the final items[] and total to be displayed from global variables itemsPerCopy[],perCopyTotal, itemsPerSubmission [], & perSubmissionTotal\n//the functions above set an items array for perCopy vs perSubmission costs.\n //the code below adds a summary line item for each type and then adds both to items[]\n\n //perCopy\n perCopyDescription += '$' + perCopyTotal + ' per copy x ' + copyCount + (copyCount == 1 ? ' copy' : ' copies');\n perCopyCostFinal += perCopyTotal * copyCount;\n\n li_perCopy = {\n name: 'Total Per Copy Cost',\n description: perCopyDescription,\n cost: perCopyCostFinal,\n style: 'OPTION_1'\n };\n\n itemsPerCopy.push(li_perCopy);\n total += perCopyCostFinal;\n\n for (var i=0; i < itemsPerCopy.length; i++){\n items.push(itemsPerCopy[i]);\n }\n\n for (var c=0; c < itemsPerSubmission.length; c++){\n items.push(itemsPerSubmission[c]);\n }\n\n //perSubmission Summary line item\n\n li_perSubmission = {\n name: 'Total Per Submission Cost',\n description: '',\n cost: perSubmissionTotal,\n style: 'OPTION_1'\n };\n\n items.push(li_perSubmission);\n total += perSubmissionTotal;\n}", "function allPossibilities (input, memo = {}) {\n const key = input.join(',')\n // by having this memo as a look up, you don't have to calculate\n // possibilities that have already been calculated previsouly\n if (key in memo) {\n return memo[key]\n }\n\n let result = 1\n\n // can't remove starting outlet (0) or ending outlet\n for (let i = 1; i < input.length - 1; i++) {\n const previous = input[i - 1]\n const next = input[i + 1]\n if (next - previous <= 3) {\n // remove the current number in the array if within 3 jolts\n // and get all possible combinations of the rest of the array\n const combination = [previous].concat(input.slice(i + 1))\n result += allPossibilities(combination, memo)\n }\n }\n // on completed recursion save result (a number of combinations)\n // the key is the possible items in the array and result is the number combinations for that array\n memo[key] = result\n // console.log(memo)\n return result\n}", "function FoodDistribution(arr) {\n\t// get our helper functions\n\tconst helpers = createHelpers();\n\t// get the number of meals as a separate item;\n\tlet treats = arr.shift();\n\t// get the hunger numbers as a separate item;\n\tconst myArray = arr.slice(0);\n\tconst len = myArray.length;\n\t// get the hunger index of the least hungry individual;\n\tconst arrMin = Math.min(...myArray);\n\n\t// check to see if we have enough treats to get everybody to the current best level\n\t// this is the easy case\n\tconst testCount = myArray.reduce((val1, val2) => val1 + (val2 - arrMin), 0);\n\tif (testCount <= treats) {\n\t\treturn 0;\n\t}\n\t// get an array of the values in order, paired with a count of how many of them in a row\n\tlet valQuantArr = helpers.objectify(myArray);\n\n\tfor (let i = 1; i < len; i++) {\n\t\tlet arrayLen = valQuantArr.length;\n\t\tconst resp = helpers.flattenMid(valQuantArr, treats, i);\n\t\tvalQuantArr = resp[0];\n\t\tarrayLen = valQuantArr.length;\n\t\ttreats = resp[1];\n\t\twhile (valQuantArr[0].quant <= i && valQuantArr[0].value > valQuantArr[1].value &&\n\t\t\ttreats >= i) {\n\t\t\tif (valQuantArr[0].quant <= treats) {\n\t\t\t\tvalQuantArr[0].value -= 1;\n\t\t\t\ttreats -= valQuantArr[0].quant;\n\t\t\t\tvalQuantArr = helpers.objectify(valQuantArr);\n\t\t\t\tarrayLen = valQuantArr.length;\n\t\t\t}\n\t\t}\n\n\t\twhile (valQuantArr[arrayLen - 1].quant <= i &&\n\t\t\tvalQuantArr[arrayLen - 1].value > valQuantArr[arrayLen - 2].value && treats >= i) {\n\t\t\tif (valQuantArr[arrayLen - 1].quant <= treats) {\n\t\t\t\tvalQuantArr[arrayLen - 1].value -= 1;\n\t\t\t\ttreats -= valQuantArr[arrayLen - 1].quant;\n\t\t\t\tvalQuantArr = helpers.objectify(valQuantArr);\n\t\t\t\tarrayLen = valQuantArr.length;\n\t\t\t}\n\t\t}\n\t}\n\n\tlet count = 0;\n\tfor (let i = 0, leng = valQuantArr.length; i < leng - 1; i++) {\n\t\tcount += Math.abs(valQuantArr[i].value - valQuantArr[i + 1].value);\n\t}\n\treturn count;\n}", "function makeOrder() {\n let total = 0;\n var order = getStorage();\n for (o in order) {\n if (o != \"custom\") {\n document.getElementById(\"pizzas\").innerHTML += (\n `<li class=\"item\" onclick=\"deleteItem('${o}')\">${sToL[o]} x${order[o]}</li>`);\n total += (11 * order[o]);\n }\n }\n for (c in order[\"custom\"]) {\n document.getElementById(\"pizzas\").innerHTML += (\n `<li class=\"item\" onclick=\"deleteItem(${c})\"> ${order[\"custom\"][c][\"size\"]}, ${order[\"custom\"][c][\"crust\"]} crust with: <ul id=${c}><li>${order[\"custom\"][c][\"sauce\"]}</li><li>${order[\"custom\"][c][\"cheese\"]}</li></ul>`\n );\n\n total += priceSize[order[\"custom\"][c][\"size\"]]\n\n let toppings = order[\"custom\"][c][\"toppings\"];\n for (t in toppings) {\n document.getElementById(c).innerHTML += (\n `<li> ${toppings[t]} </li>`\n );\n total += 0.5;\n }\n }\n document.getElementById(\"total\").innerHTML = (\n `<p>Total: $${total}</p>`\n );\n}", "function listExpensiveItems() {\n connection.query(\"SELECT max(price*stock_quantity) max_price from products\", function (err, maximum_price) {\n if (err) throw err;\n\n // Log all products of the SELECT statement\n console.log(\"Inside List Expensive - \"+maximum_price[0].max_price);\n connection.query(\"select product_name, sum(price * stock_quantity) stockPrice from products group by product_name having sum(price * stock_quantity) >= ?\", [parseFloat(maximum_price[0].max_price)], function (err, res) {\n if (err) throw err;\n for (var i = 0; i < res.length; i++) {\n console.log(\n \" Product Name: \" +\n res[i].product_name +\n \" || price * stock_quantity: $\" +\n res[i].stockPrice \n );\n }\n console.log(\"==========================================================================\")\n repeat();\n });\n });\n}", "function getSalePrices(cart = [price1, price2, price3]) {\n //var cart = [15, 25, 50];\n var price1 = getSalePrice(cart[0]);\n var price2 = getSalePrice(cart[1]);\n var price3 = getSalePrice(cart[2]);\n var totals = [price1, price2, price3];\n return totals;\n // TODO: given an array of prices for three items in a cart,\n // return a new array with the saleAmount discount applied to each.\n // TIP: see if you can reuse the getSalePrice function that you just wrote!\n // NOTE: inputs should be an array with exactly three items\n}" ]
[ "0.6401013", "0.63365066", "0.6183652", "0.6176914", "0.6049594", "0.5983058", "0.5919147", "0.5919147", "0.5919147", "0.5919147", "0.5868054", "0.58497393", "0.58272326", "0.57852566", "0.57798654", "0.577321", "0.5754901", "0.5754901", "0.5754901", "0.5754901", "0.5754901", "0.5754901", "0.5754901", "0.5754901", "0.5754901", "0.5754901", "0.5743512", "0.57372606", "0.573672", "0.5705771", "0.5705669", "0.5686062", "0.56728977", "0.56712085", "0.5648115", "0.5647236", "0.5622996", "0.56001866", "0.55989677", "0.55836403", "0.5582075", "0.55753297", "0.5574127", "0.55093473", "0.54872805", "0.54793066", "0.5473971", "0.54706526", "0.54500383", "0.5448077", "0.5432895", "0.5423547", "0.54144406", "0.5413175", "0.54062754", "0.5402326", "0.53967726", "0.5379013", "0.53768265", "0.53713125", "0.5365374", "0.53630984", "0.53475535", "0.5346424", "0.5338692", "0.53382254", "0.5335585", "0.5333743", "0.5332975", "0.5322108", "0.5319093", "0.5317716", "0.5305473", "0.53040963", "0.5302531", "0.5298618", "0.5296362", "0.5296362", "0.5287161", "0.52843463", "0.5262377", "0.5258636", "0.5257494", "0.52571476", "0.52560633", "0.5255894", "0.52548105", "0.52517635", "0.5246172", "0.5244116", "0.5243639", "0.52425534", "0.52376807", "0.5236921", "0.5232439", "0.5232167", "0.523109", "0.5230962", "0.5230826", "0.52298176", "0.5223427" ]
0.0
-1
align modifiers like time signature for vertical staves with different key signatures / time signature xs This method should be static, but that makes using it with `any` usage more difficult.
formatBegModifiers(staves) { let maxX = 0; // align note start staves.forEach((stave) => { if (stave.getNoteStartX() > maxX) maxX = stave.getNoteStartX(); }); staves.forEach((stave) => { stave.setNoteStartX(maxX); }); maxX = 0; // align REPEAT_BEGIN staves.forEach((stave) => { const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, Barline.CATEGORY); modifiers.forEach((modifier) => { if (modifier.getType() == Barline.type.REPEAT_BEGIN) if (modifier.getX() > maxX) maxX = modifier.getX(); }); }); staves.forEach((stave) => { const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, Barline.CATEGORY); modifiers.forEach((modifier) => { if (modifier.getType() == Barline.type.REPEAT_BEGIN) modifier.setX(maxX); }); }); maxX = 0; // Align time signatures staves.forEach((stave) => { const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, TimeSignature.CATEGORY); modifiers.forEach((modifier) => { if (modifier.getX() > maxX) maxX = modifier.getX(); }); }); staves.forEach((stave) => { const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, TimeSignature.CATEGORY); modifiers.forEach((modifier) => { modifier.setX(maxX); }); }); // Align key signatures // staves.forEach((stave) => { // const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, KeySignature.CATEGORY); // modifiers.forEach((modifier) => { // if (modifier.getX() > maxX) maxX = modifier.getX(); // }); // }); // staves.forEach((stave) => { // const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, KeySignature.CATEGORY); // modifiers.forEach((modifier) => { // modifier.setX(maxX); // }); // }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set alignment(value) {}", "get alignment() {}", "function parseAlign(alignSpec) {\n const parts = alignSpecRe.exec(alignSpec),\n myOffset = parseInt(parts[2] || 50),\n targetOffset = parseInt(parts[4] || 50); // Comments assume the Menu's alignSpec of l0-r0 is used.\n\n return {\n myAlignmentPoint: parts[1] + myOffset,\n // l0\n myEdge: parts[1],\n // l\n myOffset,\n // 0\n targetAlignmentPoint: parts[3] + targetOffset,\n // r0\n targetEdge: parts[3],\n // r\n targetOffset,\n // 0\n startZone: edgeIndices[parts[3]] // 1 - start trying zone 1 in TRBL order\n\n };\n} // Takes a result from the above function and flips edges for the axisLock config", "_getExpectedAlign() {\n const align = this.isRtl ? this._replaceAlignDir(this.align, /l|r/g, { l: 'r', r: 'l' }) : this.align;\n const expectedAlign = [align];\n if (this.needAdjust) {\n if (/t|b/g.test(align)) {\n expectedAlign.push(this._replaceAlignDir(align, /t|b/g, { t: 'b', b: 't' }));\n }\n if (/l|r/g.test(align)) {\n expectedAlign.push(this._replaceAlignDir(align, /l|r/g, { l: 'r', r: 'l' }));\n }\n if (/c/g.test(align)) {\n expectedAlign.push(this._replaceAlignDir(align, /c(?= |$)/g, { c: 'l' }));\n expectedAlign.push(this._replaceAlignDir(align, /c(?= |$)/g, { c: 'r' }));\n }\n expectedAlign.push(\n this._replaceAlignDir(align, /l|r|t|b/g, {\n l: 'r',\n r: 'l',\n t: 'b',\n b: 't',\n })\n );\n }\n return expectedAlign;\n }", "function posAlign(thisNumArms) {\n switch (thisNumArms) { // position numbers setting\n case 2:\n // | screen | Stage(left) - a - | Door1 - b - | background - x - | ...\n leftMar = (document.body.clientWidth - thisWidth) / 2;\n a = thisWidth / 4;\n b = thisWidth / 9;\n hm = b * 1.25;\n x = (thisWidth - 2 * a - 2 * b);\n h = [thisHeight * 0.5];\n\n posLeft = [leftMar + a, leftMar + a + b + x];\n posTop = [h[0], h[0]];\n break;\n\n case 4:\n // | screen | Stage(left) - a - | Door1 - b - | background - x - | ...\n leftMar = (document.body.clientWidth - thisWidth) / 2;\n a = thisWidth / 6;\n b = thisWidth / 9;\n hm = b * 1.25;\n x = (thisWidth - 2 * a - 4 * b) / 3;\n h = [thisHeight * 0.5];\n\n posLeft = [leftMar + a, leftMar + a + b + x, leftMar + a + 2 * (b + x), leftMar + a + 3 * (b + x)];\n posTop = [h[0], h[0], h[0], h[0]];\n break;\n\n case 8:\n // | screen | Stage(left) - a - | Door1 - b - | background - x - | ...\n leftMar = (document.body.clientWidth - thisWidth) / 2;\n a = thisWidth / 6;\n b = thisWidth / 9;\n hm = b * 1.25;\n x = (thisWidth - 2 * a - 4 * b) / 3;\n h = [thisHeight * 0.35, thisHeight * 0.7];\n\n posLeft = [leftMar + a, leftMar + a + b + x, leftMar + a + 2 * (b + x), leftMar + a + 3 * (b + x),\n leftMar + a, leftMar + a + b + x, leftMar + a + 2 * (b + x), leftMar + a + 3 * (b + x)];\n posTop = [h[0], h[0], h[0], h[0], h[1], h[1], h[1], h[1]];\n break;\n };\n }", "function alignStream(lastFrag,lastLevel,details){alignDiscontinuities(lastFrag,details,lastLevel);if(!details.PTSKnown&&lastLevel){// If the PTS wasn't figured out via discontinuity sequence that means there was no CC increase within the level.\n// Aligning via Program Date Time should therefore be reliable, since PDT should be the same within the same\n// discontinuity sequence.\nalignPDT(details,lastLevel.details);}}", "function fixAlignment(value) {\n return (2 * value) - 1;\n}", "addAlign(tag) {\n return this.onChange(RichUtils.toggleBlockType(this.state.editorState, tag))\n }", "_justify() {\n let hIx = 0;\n let left = 0;\n let minx = 0;\n let maxx = 0;\n let lvl = 0;\n let maxwidth = 0;\n let runningWidth = 0;\n let runningHeight = 0;\n if (!this.inlineBlocks.length) {\n return;\n }\n minx = this.inlineBlocks[0].text.startX;\n // We justify relative to first block x/y.\n const initialX = this.inlineBlocks[0].text.startX;\n const initialY = this.inlineBlocks[0].text.startY;\n const vert = {};\n this.inlineBlocks.forEach((inlineBlock) => {\n const block = inlineBlock.text;\n const blockBox = block.getLogicalBox();\n // If this is a horizontal positioning, reset to first blokc position\n //\n if (hIx > 0) {\n block.startX = initialX;\n block.startY = initialY;\n }\n minx = block.startX < minx ? block.startX : minx;\n maxx = (block.startX + blockBox.width) > maxx ? block.startX + blockBox.width : maxx;\n\n lvl = inlineBlock.position === SmoTextGroup.relativePositions.ABOVE ? lvl + 1 : lvl;\n lvl = inlineBlock.position === SmoTextGroup.relativePositions.BELOW ? lvl - 1 : lvl;\n if (inlineBlock.position === SmoTextGroup.relativePositions.RIGHT) {\n block.startX += runningWidth;\n if (hIx > 0) {\n block.startX += this.spacing;\n }\n }\n if (inlineBlock.position === SmoTextGroup.relativePositions.LEFT) {\n if (hIx > 0) {\n block.startX = minx - blockBox.width;\n minx = block.startX;\n block.startX -= this.spacing;\n }\n }\n if (inlineBlock.position === SmoTextGroup.relativePositions.BELOW) {\n block.startY += runningHeight;\n if (hIx > 0) {\n block.startY += this.spacing;\n }\n }\n if (inlineBlock.position === SmoTextGroup.relativePositions.ABOVE) {\n block.startY -= runningHeight;\n if (hIx > 0) {\n block.startY -= this.spacing;\n }\n }\n if (!vert[lvl]) {\n vert[lvl] = {};\n vert[lvl].blocks = [block];\n vert[lvl].minx = block.startX;\n vert[lvl].maxx = block.startX + blockBox.width;\n maxwidth = vert[lvl].width = blockBox.width;\n } else {\n vert[lvl].blocks.push(block);\n vert[lvl].minx = vert[lvl].minx < block.startX ? vert[lvl].minx : block.startX;\n vert[lvl].maxx = vert[lvl].maxx > (block.startX + blockBox.width) ?\n vert[lvl].maxx : (block.startX + blockBox.width);\n vert[lvl].width += blockBox.width;\n maxwidth = maxwidth > vert[lvl].width ? maxwidth : vert[lvl].width;\n }\n runningWidth += blockBox.width;\n runningHeight += blockBox.height;\n hIx += 1;\n block.updatedMetrics = false;\n });\n\n const levels = Object.keys(vert);\n\n // Horizontal justify the vertical blocks\n levels.forEach((level) => {\n const vobj = vert[level];\n if (this.justification === SmoTextGroup.justifications.LEFT) {\n left = minx - vobj.minx;\n } else if (this.justification === SmoTextGroup.justifications.RIGHT) {\n left = maxx - vobj.maxx;\n } else {\n left = (maxwidth / 2) - (vobj.width / 2);\n left += minx - vobj.minx;\n }\n vobj.blocks.forEach((block) => {\n block.offsetStartX(left);\n });\n });\n }", "function alignStream(lastFrag, lastLevel, details) {\n alignDiscontinuities(lastFrag, details, lastLevel);\n if (!details.PTSKnown && lastLevel) {\n // If the PTS wasn't figured out via discontinuity sequence that means there was no CC increase within the level.\n // Aligning via Program Date Time should therefore be reliable, since PDT should be the same within the same\n // discontinuity sequence.\n alignPDT(details, lastLevel.details);\n }\n}", "function updateAlignment(v) {\n xss[alignment][v] += shift[alignment];\n }", "function $AvaN$var$_tr_align(s) {\n $AvaN$var$send_bits(s, $AvaN$var$STATIC_TREES << 1, 3);\n $AvaN$var$send_code(s, $AvaN$var$END_BLOCK, $AvaN$var$static_ltree);\n $AvaN$var$bi_flush(s);\n}", "alignText(alignment) {\n this.context.textAlign = alignment;\n }", "emitModifiers(modifiers, implicitModifiers = []) {\n if (modifiers.length === 0) {\n return;\n }\n Modifier_1.ModifierOrder.forEach(m => {\n if (modifiers.includes(m) && !implicitModifiers.includes(m)) {\n this.emit(m).emit(' ');\n }\n });\n }", "function alignCoordinates(xss,alignTo){var alignToVals=_.values(alignTo),alignToMin=_.min(alignToVals),alignToMax=_.max(alignToVals);_.forEach([\"u\",\"d\"],function(vert){_.forEach([\"l\",\"r\"],function(horiz){var alignment=vert+horiz,xs=xss[alignment],delta;if(xs===alignTo)return;var xsVals=_.values(xs);delta=horiz===\"l\"?alignToMin-_.min(xsVals):alignToMax-_.max(xsVals);if(delta){xss[alignment]=_.mapValues(xs,function(x){return x+delta})}})})}", "function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}", "function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}", "function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}", "function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}", "function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}", "function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}", "function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}", "function _tr_align(s) {\n\t send_bits(s, STATIC_TREES << 1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t }", "function alignmentFromString(custom, align) {\n align.split(separator).forEach(function (str) {\n var value = str.trim();\n switch (value) {\n case 'left':\n case 'center':\n case 'right':\n custom.hAlign = value;\n break;\n case 'top':\n case 'middle':\n case 'bottom':\n custom.vAlign = value;\n break;\n case 'slice':\n case 'crop':\n custom.slice = true;\n break;\n case 'meet':\n custom.slice = false;\n }\n });\n}", "function calculateModifiers() {\n\tfor(let i = 0; i < 6; i++){\n\t\tlet mod = Math.floor((abilityScore[i]-10)/2);\n\t\tmodArray.splice(i, 1, mod);\n\t\tif (mod > 0) {\n\t\t\tmodVArray.splice(i, 1, \"+\");\n\t\t\tmodVArray2.splice(i, 1, \"+\");\n\t\t}\n\t\telse if (mod < 0) {\n\t\t\tmodVArray.splice(i, 1, \"&nbsp;\");\n\t\t\tmodVArray2.splice(i, 1, \"\");\n\t\t}\n\t\telse {\n\t\t\tmodVArray.splice(i, 1, \"&nbsp;&nbsp;\");\n\t\t\tmodVArray2.splice(i, 1, \"&nbsp;\");\n\t\t}\t\n\t}\n}", "function alignmentFromString(custom, align) {\n align.split(separator).forEach((str) => {\n const value = str.trim();\n switch (value) {\n case 'left':\n case 'center':\n case 'right':\n custom.hAlign = value;\n break;\n case 'top':\n case 'middle':\n case 'bottom':\n custom.vAlign = value;\n break;\n case 'slice':\n case 'crop':\n custom.slice = true;\n break;\n case 'meet':\n custom.slice = false;\n }\n });\n}", "function switchAlignment()\n{\n\t//Get array of all elements\n\tvar allElements = document.getElementsByTagName(\"P\");\n\tvar arrayOfElements = Array.prototype.slice.call(allElements);\n\t//Go through all elements, altering alignments\n\tfor(var i = 0; i < arrayOfElements.length; i++)\n\t{\n\t\t//If no textAlign property exists, set it to be explicitly left justified\n\t\tif(!arrayOfElements[i].style.textAlign)\n\t\t\tarrayOfElements[i].style.textAlign = 'left';\n\n\t\t//Make everything right justified, except for things already right justified,\n\t\t//which we will make left justified.\n\t\tswitch(arrayOfElements[i].style.textAlign)\n\t\t{\n\t\t\tcase 'left':\n\t\t\t\tarrayOfElements[i].style.textAlign = 'right';\n\t\t\t\tbreak;\n\t\t\tcase 'center':\n\t\t\t\tarrayOfElements[i].style.textAlign = 'right';\n\t\t\t\tbreak;\n\t\t\tcase 'right':\n\t\t\t\tarrayOfElements[i].style.textAlign = 'left';\n\t\t\t\tbreak;\n\t\t\tcase 'justify':\n\t\t\t\tarrayOfElements[i].style.textAlign = 'right';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tarrayOfElements[i].style.textAlign = 'right';\n\t\t\t\tbreak;\n\t\t}\n\n\n\t}\n}", "function _tr_align(s) {\n\t send_bits(s, STATIC_TREES<<1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}", "function _tr_align(s) {\n\t send_bits(s, STATIC_TREES<<1, 3);\n\t send_code(s, END_BLOCK, static_ltree);\n\t bi_flush(s);\n\t}", "function _tr_align(s){send_bits(s,STATIC_TREES<<1,3);send_code(s,END_BLOCK,static_ltree);bi_flush(s);}", "function alignPDT(details,lastDetails){if(lastDetails&&lastDetails.fragments.length){if(!details.hasProgramDateTime||!lastDetails.hasProgramDateTime){return;}// if last level sliding is 1000 and its first frag PROGRAM-DATE-TIME is 2017-08-20 1:10:00 AM\n// and if new details first frag PROGRAM DATE-TIME is 2017-08-20 1:10:08 AM\n// then we can deduce that playlist B sliding is 1000+8 = 1008s\nvar lastPDT=lastDetails.fragments[0].programDateTime;var newPDT=details.fragments[0].programDateTime;// date diff is in ms. frag.start is in seconds\nvar sliding=(newPDT-lastPDT)/1000+lastDetails.fragments[0].start;if(Number.isFinite(sliding)){logger_1.logger.log(\"adjusting PTS using programDateTime delta, sliding:\"+sliding.toFixed(3));adjustPts(sliding,details);}}}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n }", "function alignPDT(details, lastDetails) {\n if (lastDetails && lastDetails.fragments.length) {\n if (!details.hasProgramDateTime || !lastDetails.hasProgramDateTime) {\n return;\n }\n // if last level sliding is 1000 and its first frag PROGRAM-DATE-TIME is 2017-08-20 1:10:00 AM\n // and if new details first frag PROGRAM DATE-TIME is 2017-08-20 1:10:08 AM\n // then we can deduce that playlist B sliding is 1000+8 = 1008s\n var lastPDT = lastDetails.fragments[0].programDateTime;\n var newPDT = details.fragments[0].programDateTime;\n // date diff is in ms. frag.start is in seconds\n var sliding = (newPDT - lastPDT) / 1000 + lastDetails.fragments[0].start;\n if (Object(number_isFinite[\"a\" /* isFiniteNumber */])(sliding)) {\n logger[\"b\" /* logger */].log('adjusting PTS using programDateTime delta, sliding:' + sliding.toFixed(3));\n adjustPts(sliding, details);\n }\n }\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n }", "function alignLayersByContent( alignMethod )\n{\n\tvar desc = new ActionDescriptor();\n\tvar ref = new ActionReference();\n\t\n\talignMethod = stringToAlignmentKey( alignMethod );\n\tif (! alignMethod)\n\t\talignMethod = keyPerspectiveIndex;\n\n\tref.putEnumerated( classLayer, typeOrdinal, enumTarget );\n\tdesc.putReference( typeNULL, ref );\n\tdesc.putEnumerated( keyUsing, typeAlignDistributeSelector, kADSContentStr );\n\tdesc.putEnumerated( keyApply, kprojectionStr, alignMethod );\n\t\t\n\texecuteAction( keyAlignment, desc, DialogModes.NO );\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "addAlignmentTo(target) {\n if (target.species === this.species)\n // Align more to same species\n this._sum.add(target.velocity);\n else {\n // Align less to other species\n this._targetVelocity = target.velocity.copy();\n this._sum.add(this._targetVelocity.div(10));\n }\n\n return this._sum;\n }", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n }", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}", "function _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}" ]
[ "0.58732045", "0.53072876", "0.51479733", "0.5048906", "0.5013621", "0.49928164", "0.49863285", "0.4961542", "0.49455246", "0.49009168", "0.48984364", "0.48505536", "0.4820889", "0.48134044", "0.47912028", "0.47906253", "0.47906253", "0.47906253", "0.47906253", "0.47906253", "0.47906253", "0.47906253", "0.47883165", "0.47711566", "0.47682273", "0.47628015", "0.4754695", "0.4754521", "0.4754521", "0.47492284", "0.4731391", "0.47240463", "0.47163326", "0.47122535", "0.47003087", "0.46998766", "0.4682774", "0.46769658", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047", "0.46725047" ]
0.68977565
0
Coda & Segno Symbol functions
setRepetitionTypeLeft(type, y) { this.modifiers.push(new Repetition(type, this.x, y)); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Symbol() {\n}", "function SimpleSymbols(str) { \n}", "function sc_char2symbol(c) { return sc_SYMBOL_PREFIX + c.val; }", "function Symbol(alph_index, scale, alphabet) {\n //variable prototype\n this.symbol = alphabet.get_letter(alph_index);\n this.scale = scale;\n this.colour = alphabet.get_colour(alph_index);\n //function prototype\n this.get_symbol = Symbol_get_symbol;\n this.get_scale = Symbol_get_scale;\n this.get_colour = Symbol_get_colour;\n this.toString = Symbol_to_string;\n}", "function Symbol(){ return Literal.apply(this,arguments) }", "function LexSym() {\r\n}", "function getSymbol() {return symbolField().value}", "function StackSymbol() {\r\n}", "function SimpleSymbols(str) {\n\n // code goes here\n return str;\n\n}", "function StackSym() {\r\n}", "function sc_string2symbol(s) {\n return sc_SYMBOL_PREFIX + s;\n}", "function symbol(s, p) {\n var x = syntax[s];\n if (!x || typeof x !== 'object') {\n syntax[s] = x = {\n id: s,\n lbp: p,\n value: s\n };\n }\n return x;\n }", "function FreeSym() {\r\n}", "function buscarSymbol (nodo, cte) {\n if(nodo != null)\n buscarSymbolEnSi (nodo, cte);\n symbolTable = nodo.symbolTable.FATHER_SYMBOLTABLE;\n buscar = true;\n while (buscar) {\n if (symbolTable == null) {\n buscar = false;\n } else {\n encontrado = false;\n symbolTable.CONSTANTS.forEach ( (c) => {\n if(c.indexOf (cte[0]) != -1) { encontrado = true; };\n });\n if (encontrado) {\n $('#error').html('<div><pre>\\n' + \" > > > > > > Error: Constante \" + cte[0] + \" redeclarada. Bloque: \" + nodo.symbolTable.NAME + \" < < < < < < \" + '\\n</pre></div>');\n console.log(\" > > > > > > Error: Constante \" + cte[0] + \" redeclarada. Bloque: \" + nodo.symbolTable.NAME + \" < < < < < < \");\n buscar = false;\n } else {\n symbolTable = symbolTable.FATHER_SYMBOLTABLE;\n }\n }\n }\n}", "function j(e) {\n var s = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;\n var r = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;\n var l = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !0;\n if (!e) return {\n symbol: null\n };\n var t;\n if (x(e) || e instanceof _symbols_WebStyleSymbol_js__WEBPACK_IMPORTED_MODULE_32__[\"default\"]) t = e.clone();else if (\"cim\" === e.type) t = _symbols_PointSymbol3D_js__WEBPACK_IMPORTED_MODULE_27__[\"default\"].fromCIMSymbol(e);else if (e instanceof _symbols_SimpleLineSymbol_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]) t = _symbols_LineSymbol3D_js__WEBPACK_IMPORTED_MODULE_22__[\"default\"].fromSimpleLineSymbol(e);else if (e instanceof _symbols_SimpleMarkerSymbol_js__WEBPACK_IMPORTED_MODULE_30__[\"default\"]) t = _symbols_PointSymbol3D_js__WEBPACK_IMPORTED_MODULE_27__[\"default\"].fromSimpleMarkerSymbol(e);else if (e instanceof _symbols_PictureMarkerSymbol_js__WEBPACK_IMPORTED_MODULE_26__[\"default\"]) t = _symbols_PointSymbol3D_js__WEBPACK_IMPORTED_MODULE_27__[\"default\"].fromPictureMarkerSymbol(e);else if (e instanceof _symbols_SimpleFillSymbol_js__WEBPACK_IMPORTED_MODULE_29__[\"default\"]) t = _symbols_PolygonSymbol3D_js__WEBPACK_IMPORTED_MODULE_28__[\"default\"].fromSimpleFillSymbol(e);else {\n if (!(e instanceof _symbols_TextSymbol_js__WEBPACK_IMPORTED_MODULE_31__[\"default\"])) return {\n error: new _core_Error_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](\"symbol-conversion:unsupported-2d-symbol\", \"2D symbol of type '\".concat(e.type || e.declaredClass, \"' is unsupported in 3D\"), {\n symbol: e\n })\n };\n t = l ? _symbols_LabelSymbol3D_js__WEBPACK_IMPORTED_MODULE_21__[\"default\"].fromTextSymbol(e) : _symbols_PointSymbol3D_js__WEBPACK_IMPORTED_MODULE_27__[\"default\"].fromTextSymbol(e);\n }\n if (s && (t.id = e.id), r && x(t)) for (var _e246 = 0; _e246 < t.symbolLayers.length; ++_e246) {\n t.symbolLayers.getItemAt(_e246)._ignoreDrivers = !0;\n }\n return {\n symbol: t\n };\n }", "function Symbol(identifier, name, step) {\n this.identifier = identifier;\n this.orientation = 0; //DEG, clockwise\n this.name = name;\n this.step = step;\n this.classes = \"\";\n \n //get a starting position\n var position = {};\n position.posX = \"0px\"; //px from left\n position.posY = \"0px\"; //px from top\n this.positions = new Array();\n this.positions[0] = position; \n}", "function symbol(name){\r\n return lexeme(string(name));\r\n}", "function buscarSymbolEnSi (nodo, cte) {\n contador = 0;\n nodo.symbolTable.CONSTANTS.forEach ( (c) => {\n if(c.indexOf (cte[0]) != -1) { contador++; };\n });\n if (contador > 1) {\n $('#error').html('<div><pre>\\n' + \"> Error: Constante \" + cte[0] + \" redeclarada. Bloque: \" + nodo.symbolTable.NAME + '\\n</pre></div>');\n\n console.log(\"> Error: Constante \" + cte[0] + \" redeclarada. Bloque: \" + nodo.symbolTable.NAME);\n }\n}", "function tinf_decode_symbol(d, t) {\r\n\t while (d.bitcount < 24) {\r\n\t d.tag |= d.source[d.sourceIndex++] << d.bitcount;\r\n\t d.bitcount += 8;\r\n\t }\r\n\t \r\n\t var sum = 0, cur = 0, len = 0;\r\n\t var tag = d.tag;\r\n\r\n\t /* get more bits while code value is above sum */\r\n\t do {\r\n\t cur = 2 * cur + (tag & 1);\r\n\t tag >>>= 1;\r\n\t ++len;\r\n\r\n\t sum += t.table[len];\r\n\t cur -= t.table[len];\r\n\t } while (cur >= 0);\r\n\t \r\n\t d.tag = tag;\r\n\t d.bitcount -= len;\r\n\r\n\t return t.trans[sum + cur];\r\n\t}", "function tinf_decode_symbol(d, t) {\n\t while (d.bitcount < 24) {\n\t d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n\t d.bitcount += 8;\n\t }\n\t \n\t var sum = 0, cur = 0, len = 0;\n\t var tag = d.tag;\n\n\t /* get more bits while code value is above sum */\n\t do {\n\t cur = 2 * cur + (tag & 1);\n\t tag >>>= 1;\n\t ++len;\n\n\t sum += t.table[len];\n\t cur -= t.table[len];\n\t } while (cur >= 0);\n\t \n\t d.tag = tag;\n\t d.bitcount -= len;\n\n\t return t.trans[sum + cur];\n\t}", "function tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n\n var sum = 0,\n cur = 0,\n len = 0;\n var tag = d.tag;\n\n /* get more bits while code value is above sum */\n do {\n cur = 2 * cur + (tag & 1);\n tag >>>= 1;\n ++len;\n\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n\n d.tag = tag;\n d.bitcount -= len;\n\n return t.trans[sum + cur];\n }", "function symbol(s, p) {\n var x = state.syntax[s];\n if (!x || typeof x !== \"object\") {\n state.syntax[s] = x = {\n id: s,\n lbp: p,\n value: s\n };\n }\n return x;\n }", "function sc_jsstring2symbol(s) {\n return sc_SYMBOL_PREFIX + s;\n}", "function tinf_decode_symbol(d, t) {\r\n while (d.bitcount < 24) {\r\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\r\n d.bitcount += 8;\r\n }\r\n \r\n var sum = 0, cur = 0, len = 0;\r\n var tag = d.tag;\r\n\r\n /* get more bits while code value is above sum */\r\n do {\r\n cur = 2 * cur + (tag & 1);\r\n tag >>>= 1;\r\n ++len;\r\n\r\n sum += t.table[len];\r\n cur -= t.table[len];\r\n } while (cur >= 0);\r\n \r\n d.tag = tag;\r\n d.bitcount -= len;\r\n\r\n return t.trans[sum + cur];\r\n}", "function getSymbol(sym) {\n switch (sym) {\n case \"$\":\n return \"USD\";\n break;\n case \"£\":\n return \"GBP\";\n break;\n case \"€\":\n return \"EUR\";\n break;\n default:\n return \"USD\";\n break;\n }\n\n}", "function tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n\n var sum = 0,\n cur = 0,\n len = 0;\n var tag = d.tag;\n /* get more bits while code value is above sum */\n\n do {\n cur = 2 * cur + (tag & 1);\n tag >>>= 1;\n ++len;\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n\n d.tag = tag;\n d.bitcount -= len;\n return t.trans[sum + cur];\n}", "function tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n\n var sum = 0, cur = 0, len = 0;\n var tag = d.tag;\n\n /* get more bits while code value is above sum */\n do {\n cur = 2 * cur + (tag & 1);\n tag >>>= 1;\n ++len;\n\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n\n d.tag = tag;\n d.bitcount -= len;\n\n return t.trans[sum + cur];\n}", "function tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n \n var sum = 0, cur = 0, len = 0;\n var tag = d.tag;\n\n /* get more bits while code value is above sum */\n do {\n cur = 2 * cur + (tag & 1);\n tag >>>= 1;\n ++len;\n\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n \n d.tag = tag;\n d.bitcount -= len;\n\n return t.trans[sum + cur];\n}", "function tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n \n var sum = 0, cur = 0, len = 0;\n var tag = d.tag;\n\n /* get more bits while code value is above sum */\n do {\n cur = 2 * cur + (tag & 1);\n tag >>>= 1;\n ++len;\n\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n \n d.tag = tag;\n d.bitcount -= len;\n\n return t.trans[sum + cur];\n}", "function tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n \n var sum = 0, cur = 0, len = 0;\n var tag = d.tag;\n\n /* get more bits while code value is above sum */\n do {\n cur = 2 * cur + (tag & 1);\n tag >>>= 1;\n ++len;\n\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n \n d.tag = tag;\n d.bitcount -= len;\n\n return t.trans[sum + cur];\n}", "function tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n \n var sum = 0, cur = 0, len = 0;\n var tag = d.tag;\n\n /* get more bits while code value is above sum */\n do {\n cur = 2 * cur + (tag & 1);\n tag >>>= 1;\n ++len;\n\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n \n d.tag = tag;\n d.bitcount -= len;\n\n return t.trans[sum + cur];\n}", "function tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n \n var sum = 0, cur = 0, len = 0;\n var tag = d.tag;\n\n /* get more bits while code value is above sum */\n do {\n cur = 2 * cur + (tag & 1);\n tag >>>= 1;\n ++len;\n\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n \n d.tag = tag;\n d.bitcount -= len;\n\n return t.trans[sum + cur];\n}", "function tinf_decode_symbol(d, t) {\n while (d.bitcount < 24) {\n d.tag |= d.source[d.sourceIndex++] << d.bitcount;\n d.bitcount += 8;\n }\n \n var sum = 0, cur = 0, len = 0;\n var tag = d.tag;\n\n /* get more bits while code value is above sum */\n do {\n cur = 2 * cur + (tag & 1);\n tag >>>= 1;\n ++len;\n\n sum += t.table[len];\n cur -= t.table[len];\n } while (cur >= 0);\n \n d.tag = tag;\n d.bitcount -= len;\n\n return t.trans[sum + cur];\n}", "function symbol(s, bp) {\n var x = syntax[s];\n if (!x) {\n x = Object.create(protosymbol);\n x.id = x.string = s;\n x.lbp = bp || 0;\n syntax[s] = x;\n }\n return x;\n }", "function _decode_symbol(d, t) {\n while (d.bitcount < 16) {\n d.tag = d.tag | (d.source[d.sourceIndex++]) << d.bitcount;\n d.bitcount += 8;\n }\n\n var sum = 0, cur = 0, len = 0;\n do {\n cur = 2 * cur + ((d.tag & (1 << len)) >> len);\n\n ++len;\n\n sum += t.table[len];\n cur -= t.table[len];\n\n } while (cur >= 0);\n\n d.tag >>= len;\n d.bitcount -= len;\n\n return t.trans[sum + cur];\n }", "function handleSymbol(value) {\n switch(value) {\n case 'C':\n buffer = \"0\";\n runningTotal = 0;\n previousOperator = null;\n break;\n case \"=\":\n if(previousOperator === null) {\n return;\n }\n flushOperation(parseInt(buffer));\n previousOperator = null;\n buffer = \"\" + runningTotal;\n runningTotal = 0;\n break; \n case \"←\":\n if (buffer.length === 1) {\n buffer = \"0\";\n } else {\n buffer = buffer.substring(0, buffer.length - 1)\n }\n break;\n default:\n handleMath(value);\n break;\n }\n}", "function _symbolCoerce() {\n return exports.PREFIX.symbol;\n}", "getCodeValue() {\n let symbolTable = [['0', 0, ['111331311']], ['1', 1, ['311311113']], ['2', 2, ['113311113']], ['3', 3, ['313311111']],\n ['4', 4, ['111331113']], ['5', 5, ['311331111']], ['6', 6, ['113331111']], ['7', 7, ['111311313']], ['8', 8, ['311311311']],\n ['9', 9, ['113311311']], ['A', 10, ['113113113']], ['B', 11, ['113113113']], ['C', 12, ['313113111']], ['D', 13, ['111133113']],\n ['E', 14, ['221211']], ['F', 15, ['113133111']], ['G', 0x10, ['111113313']], ['H', 0x11, ['311113311']], ['I', 0x12, ['112311']],\n ['J', 0x13, ['111133311']], ['K', 20, ['311111133']], ['L', 0x15, ['113111133']], ['M', 0x16, ['313111131']],\n ['N', 0x17, ['111131133']],\n ['O', 0x18, ['121122']], ['P', 0x19, ['113131131']], ['Q', 0x1a, ['111111333']], ['R', 0x1b, ['311111331']],\n ['S', 0x1c, ['113111331']],\n ['T', 0x1d, ['111131331']], ['U', 30, ['331111113']], ['V', 0x1f, ['133111113']], ['W', 0x20, ['333111111']],\n ['X', 0x21, ['131131113']], ['Y', 0x22, ['331131111']], ['Z', 0x23, ['133131111']], ['*', 0, ['131131311']]\n ];\n return symbolTable;\n }", "mapSyllableRomajiUnicode() {\n return {\n mapping: [\n {syllable: {alphabet: \"h\", consonant: \"\", vowel: \"a\"}, romaji: \"a\", unicode: \"\\u3042\"},\n {syllable: {alphabet: \"h\", consonant: \"\", vowel: \"i\"}, romaji: \"i\", unicode: \"\\u3044\"},\n {syllable: {alphabet: \"h\", consonant: \"\", vowel: \"u\"}, romaji: \"u\", unicode: \"\\u3046\"},\n {syllable: {alphabet: \"h\", consonant: \"\", vowel: \"e\"}, romaji: \"e\", unicode: \"\\u3048\"},\n {syllable: {alphabet: \"h\", consonant: \"\", vowel: \"o\"}, romaji: \"o\", unicode: \"\\u304A\"},\n {syllable: {alphabet: \"h\", consonant: \"k\", vowel: \"a\"}, romaji: \"ka\", unicode: \"\\u304B\"},\n {syllable: {alphabet: \"h\", consonant: \"k\", vowel: \"i\"}, romaji: \"ki\", unicode: \"\\u304D\"},\n {syllable: {alphabet: \"h\", consonant: \"k\", vowel: \"u\"}, romaji: \"ku\", unicode: \"\\u304F\"},\n {syllable: {alphabet: \"h\", consonant: \"k\", vowel: \"e\"}, romaji: \"ke\", unicode: \"\\u3051\"},\n {syllable: {alphabet: \"h\", consonant: \"k\", vowel: \"o\"}, romaji: \"ko\", unicode: \"\\u3053\"},\n {syllable: {alphabet: \"h\", consonant: \"s\", vowel: \"a\"}, romaji: \"sa\", unicode: \"\\u3055\"},\n {syllable: {alphabet: \"h\", consonant: \"s\", vowel: \"i\"}, romaji: \"shi\", unicode: \"\\u3057\"},\n {syllable: {alphabet: \"h\", consonant: \"s\", vowel: \"u\"}, romaji: \"su\", unicode: \"\\u3059\"},\n {syllable: {alphabet: \"h\", consonant: \"s\", vowel: \"e\"}, romaji: \"se\", unicode: \"\\u305B\"},\n {syllable: {alphabet: \"h\", consonant: \"s\", vowel: \"o\"}, romaji: \"so\", unicode: \"\\u305D\"},\n {syllable: {alphabet: \"h\", consonant: \"t\", vowel: \"a\"}, romaji: \"ta\", unicode: \"\\u305F\"},\n {syllable: {alphabet: \"h\", consonant: \"t\", vowel: \"i\"}, romaji: \"chi\", unicode: \"\\u3061\"},\n {syllable: {alphabet: \"h\", consonant: \"t\", vowel: \"u\"}, romaji: \"tsu\", unicode: \"\\u3064\"},\n {syllable: {alphabet: \"h\", consonant: \"t\", vowel: \"e\"}, romaji: \"te\", unicode: \"\\u3066\"},\n {syllable: {alphabet: \"h\", consonant: \"t\", vowel: \"o\"}, romaji: \"to\", unicode: \"\\u3068\"},\n {syllable: {alphabet: \"h\", consonant: \"n\", vowel: \"a\"}, romaji: \"na\", unicode: \"\\u306A\"},\n {syllable: {alphabet: \"h\", consonant: \"n\", vowel: \"i\"}, romaji: \"ni\", unicode: \"\\u306B\"},\n {syllable: {alphabet: \"h\", consonant: \"n\", vowel: \"u\"}, romaji: \"nu\", unicode: \"\\u306C\"},\n {syllable: {alphabet: \"h\", consonant: \"n\", vowel: \"e\"}, romaji: \"ne\", unicode: \"\\u306D\"},\n {syllable: {alphabet: \"h\", consonant: \"n\", vowel: \"o\"}, romaji: \"no\", unicode: \"\\u306E\"},\n {syllable: {alphabet: \"h\", consonant: \"h\", vowel: \"a\"}, romaji: \"ha\", unicode: \"\\u306F\"},\n {syllable: {alphabet: \"h\", consonant: \"h\", vowel: \"i\"}, romaji: \"hi\", unicode: \"\\u3072\"},\n {syllable: {alphabet: \"h\", consonant: \"h\", vowel: \"u\"}, romaji: \"fu\", unicode: \"\\u3075\"},\n {syllable: {alphabet: \"h\", consonant: \"h\", vowel: \"e\"}, romaji: \"he\", unicode: \"\\u3078\"},\n {syllable: {alphabet: \"h\", consonant: \"h\", vowel: \"o\"}, romaji: \"ho\", unicode: \"\\u307B\"},\n {syllable: {alphabet: \"h\", consonant: \"m\", vowel: \"a\"}, romaji: \"ma\", unicode: \"\\u307E\"},\n {syllable: {alphabet: \"h\", consonant: \"m\", vowel: \"i\"}, romaji: \"mi\", unicode: \"\\u307F\"},\n {syllable: {alphabet: \"h\", consonant: \"m\", vowel: \"u\"}, romaji: \"mu\", unicode: \"\\u3080\"},\n {syllable: {alphabet: \"h\", consonant: \"m\", vowel: \"e\"}, romaji: \"me\", unicode: \"\\u3081\"},\n {syllable: {alphabet: \"h\", consonant: \"m\", vowel: \"o\"}, romaji: \"mo\", unicode: \"\\u3082\"},\n {syllable: {alphabet: \"h\", consonant: \"y\", vowel: \"a\"}, romaji: \"ya\", unicode: \"\\u3084\"},\n {syllable: {alphabet: \"h\", consonant: \"y\", vowel: \"u\"}, romaji: \"yu\", unicode: \"\\u3086\"},\n {syllable: {alphabet: \"h\", consonant: \"y\", vowel: \"o\"}, romaji: \"yo\", unicode: \"\\u3088\"},\n {syllable: {alphabet: \"h\", consonant: \"r\", vowel: \"a\"}, romaji: \"ra\", unicode: \"\\u3089\"},\n {syllable: {alphabet: \"h\", consonant: \"r\", vowel: \"i\"}, romaji: \"ri\", unicode: \"\\u308A\"},\n {syllable: {alphabet: \"h\", consonant: \"r\", vowel: \"u\"}, romaji: \"ru\", unicode: \"\\u308B\"},\n {syllable: {alphabet: \"h\", consonant: \"r\", vowel: \"e\"}, romaji: \"re\", unicode: \"\\u308C\"},\n {syllable: {alphabet: \"h\", consonant: \"r\", vowel: \"o\"}, romaji: \"ro\", unicode: \"\\u308D\"},\n {syllable: {alphabet: \"h\", consonant: \"w\", vowel: \"a\"}, romaji: \"wa\", unicode: \"\\u308F\"},\n {syllable: {alphabet: \"h\", consonant: \"w\", vowel: \"o\"}, romaji: \"wo\", unicode: \"\\u3092\"},\n {syllable: {alphabet: \"h\", consonant: \"\", vowel: \"n\"}, romaji: \"n\", unicode: \"\\u3093\"},\n {syllable: {alphabet: \"h\", consonant: \"g\", vowel: \"a\"}, romaji: \"ga\", unicode: \"\\u304C\"},\n {syllable: {alphabet: \"h\", consonant: \"g\", vowel: \"i\"}, romaji: \"gi\", unicode: \"\\u304E\"},\n {syllable: {alphabet: \"h\", consonant: \"g\", vowel: \"u\"}, romaji: \"gu\", unicode: \"\\u3050\"},\n {syllable: {alphabet: \"h\", consonant: \"g\", vowel: \"e\"}, romaji: \"ge\", unicode: \"\\u3052\"},\n {syllable: {alphabet: \"h\", consonant: \"g\", vowel: \"o\"}, romaji: \"go\", unicode: \"\\u3054\"},\n {syllable: {alphabet: \"h\", consonant: \"z\", vowel: \"a\"}, romaji: \"za\", unicode: \"\\u3056\"},\n {syllable: {alphabet: \"h\", consonant: \"z\", vowel: \"i\"}, romaji: \"ji\", unicode: \"\\u3058\"},\n {syllable: {alphabet: \"h\", consonant: \"z\", vowel: \"u\"}, romaji: \"zu\", unicode: \"\\u305A\"},\n {syllable: {alphabet: \"h\", consonant: \"z\", vowel: \"e\"}, romaji: \"ze\", unicode: \"\\u305C\"},\n {syllable: {alphabet: \"h\", consonant: \"z\", vowel: \"o\"}, romaji: \"zo\", unicode: \"\\u305E\"},\n {syllable: {alphabet: \"h\", consonant: \"d\", vowel: \"a\"}, romaji: \"da\", unicode: \"\\u3060\"},\n {syllable: {alphabet: \"h\", consonant: \"d\", vowel: \"i\"}, romaji: \"ji\", unicode: \"\\u3062\"},\n {syllable: {alphabet: \"h\", consonant: \"d\", vowel: \"u\"}, romaji: \"zu\", unicode: \"\\u3065\"},\n {syllable: {alphabet: \"h\", consonant: \"d\", vowel: \"e\"}, romaji: \"de\", unicode: \"\\u3067\"},\n {syllable: {alphabet: \"h\", consonant: \"d\", vowel: \"o\"}, romaji: \"do\", unicode: \"\\u3069\"},\n {syllable: {alphabet: \"h\", consonant: \"b\", vowel: \"a\"}, romaji: \"ba\", unicode: \"\\u3070\"},\n {syllable: {alphabet: \"h\", consonant: \"b\", vowel: \"i\"}, romaji: \"bi\", unicode: \"\\u3073\"},\n {syllable: {alphabet: \"h\", consonant: \"b\", vowel: \"u\"}, romaji: \"bu\", unicode: \"\\u3076\"},\n {syllable: {alphabet: \"h\", consonant: \"b\", vowel: \"e\"}, romaji: \"be\", unicode: \"\\u3079\"},\n {syllable: {alphabet: \"h\", consonant: \"b\", vowel: \"o\"}, romaji: \"bo\", unicode: \"\\u307C\"},\n {syllable: {alphabet: \"h\", consonant: \"p\", vowel: \"a\"}, romaji: \"pa\", unicode: \"\\u3071\"},\n {syllable: {alphabet: \"h\", consonant: \"p\", vowel: \"i\"}, romaji: \"pi\", unicode: \"\\u3074\"},\n {syllable: {alphabet: \"h\", consonant: \"p\", vowel: \"u\"}, romaji: \"pu\", unicode: \"\\u3077\"},\n {syllable: {alphabet: \"h\", consonant: \"p\", vowel: \"e\"}, romaji: \"pe\", unicode: \"\\u307A\"},\n {syllable: {alphabet: \"h\", consonant: \"p\", vowel: \"o\"}, romaji: \"po\", unicode: \"\\u307D\"},\n\n {syllable: {alphabet: \"k\", consonant: \"\", vowel: \"a\"}, romaji: \"a\", unicode: \"\\u30A2\"},\n {syllable: {alphabet: \"k\", consonant: \"\", vowel: \"i\"}, romaji: \"i\", unicode: \"\\u30A4\"},\n {syllable: {alphabet: \"k\", consonant: \"\", vowel: \"u\"}, romaji: \"u\", unicode: \"\\u30A6\"},\n {syllable: {alphabet: \"k\", consonant: \"\", vowel: \"e\"}, romaji: \"e\", unicode: \"\\u30A8\"},\n {syllable: {alphabet: \"k\", consonant: \"\", vowel: \"o\"}, romaji: \"o\", unicode: \"\\u30AA\"},\n {syllable: {alphabet: \"k\", consonant: \"k\", vowel: \"a\"}, romaji: \"ka\", unicode: \"\\u30AB\"},\n {syllable: {alphabet: \"k\", consonant: \"k\", vowel: \"i\"}, romaji: \"ki\", unicode: \"\\u30AD\"},\n {syllable: {alphabet: \"k\", consonant: \"k\", vowel: \"u\"}, romaji: \"ku\", unicode: \"\\u30AF\"},\n {syllable: {alphabet: \"k\", consonant: \"k\", vowel: \"e\"}, romaji: \"ke\", unicode: \"\\u30B1\"},\n {syllable: {alphabet: \"k\", consonant: \"k\", vowel: \"o\"}, romaji: \"ko\", unicode: \"\\u30B3\"},\n {syllable: {alphabet: \"k\", consonant: \"s\", vowel: \"a\"}, romaji: \"sa\", unicode: \"\\u30B5\"},\n {syllable: {alphabet: \"k\", consonant: \"s\", vowel: \"i\"}, romaji: \"shi\", unicode: \"\\u30B7\"},\n {syllable: {alphabet: \"k\", consonant: \"s\", vowel: \"u\"}, romaji: \"su\", unicode: \"\\u30B9\"},\n {syllable: {alphabet: \"k\", consonant: \"s\", vowel: \"e\"}, romaji: \"se\", unicode: \"\\u30BB\"},\n {syllable: {alphabet: \"k\", consonant: \"s\", vowel: \"o\"}, romaji: \"so\", unicode: \"\\u30BD\"},\n {syllable: {alphabet: \"k\", consonant: \"t\", vowel: \"a\"}, romaji: \"ta\", unicode: \"\\u30BF\"},\n {syllable: {alphabet: \"k\", consonant: \"t\", vowel: \"i\"}, romaji: \"chi\", unicode: \"\\u30C1\"},\n {syllable: {alphabet: \"k\", consonant: \"t\", vowel: \"u\"}, romaji: \"tsu\", unicode: \"\\u30C4\"},\n {syllable: {alphabet: \"k\", consonant: \"t\", vowel: \"e\"}, romaji: \"te\", unicode: \"\\u30C6\"},\n {syllable: {alphabet: \"k\", consonant: \"t\", vowel: \"o\"}, romaji: \"to\", unicode: \"\\u30C8\"},\n {syllable: {alphabet: \"k\", consonant: \"n\", vowel: \"a\"}, romaji: \"na\", unicode: \"\\u30CA\"},\n {syllable: {alphabet: \"k\", consonant: \"n\", vowel: \"i\"}, romaji: \"ni\", unicode: \"\\u30CB\"},\n {syllable: {alphabet: \"k\", consonant: \"n\", vowel: \"u\"}, romaji: \"nu\", unicode: \"\\u30CC\"},\n {syllable: {alphabet: \"k\", consonant: \"n\", vowel: \"e\"}, romaji: \"ne\", unicode: \"\\u30CD\"},\n {syllable: {alphabet: \"k\", consonant: \"n\", vowel: \"o\"}, romaji: \"no\", unicode: \"\\u30CE\"},\n {syllable: {alphabet: \"k\", consonant: \"h\", vowel: \"a\"}, romaji: \"ha\", unicode: \"\\u30CF\"},\n {syllable: {alphabet: \"k\", consonant: \"h\", vowel: \"i\"}, romaji: \"hi\", unicode: \"\\u30D2\"},\n {syllable: {alphabet: \"k\", consonant: \"h\", vowel: \"u\"}, romaji: \"fu\", unicode: \"\\u30D5\"},\n {syllable: {alphabet: \"k\", consonant: \"h\", vowel: \"e\"}, romaji: \"he\", unicode: \"\\u30D8\"},\n {syllable: {alphabet: \"k\", consonant: \"h\", vowel: \"o\"}, romaji: \"ho\", unicode: \"\\u30DB\"},\n {syllable: {alphabet: \"k\", consonant: \"m\", vowel: \"a\"}, romaji: \"ma\", unicode: \"\\u30DE\"},\n {syllable: {alphabet: \"k\", consonant: \"m\", vowel: \"i\"}, romaji: \"mi\", unicode: \"\\u30DF\"},\n {syllable: {alphabet: \"k\", consonant: \"m\", vowel: \"u\"}, romaji: \"mu\", unicode: \"\\u30E0\"},\n {syllable: {alphabet: \"k\", consonant: \"m\", vowel: \"e\"}, romaji: \"me\", unicode: \"\\u30E1\"},\n {syllable: {alphabet: \"k\", consonant: \"m\", vowel: \"o\"}, romaji: \"mo\", unicode: \"\\u30E2\"},\n {syllable: {alphabet: \"k\", consonant: \"y\", vowel: \"a\"}, romaji: \"ya\", unicode: \"\\u30E4\"},\n {syllable: {alphabet: \"k\", consonant: \"y\", vowel: \"u\"}, romaji: \"yu\", unicode: \"\\u30E6\"},\n {syllable: {alphabet: \"k\", consonant: \"y\", vowel: \"o\"}, romaji: \"yo\", unicode: \"\\u30E8\"},\n {syllable: {alphabet: \"k\", consonant: \"r\", vowel: \"a\"}, romaji: \"ra\", unicode: \"\\u30E9\"},\n {syllable: {alphabet: \"k\", consonant: \"r\", vowel: \"i\"}, romaji: \"ri\", unicode: \"\\u30EA\"},\n {syllable: {alphabet: \"k\", consonant: \"r\", vowel: \"u\"}, romaji: \"ru\", unicode: \"\\u30EB\"},\n {syllable: {alphabet: \"k\", consonant: \"r\", vowel: \"e\"}, romaji: \"re\", unicode: \"\\u30EC\"},\n {syllable: {alphabet: \"k\", consonant: \"r\", vowel: \"o\"}, romaji: \"ro\", unicode: \"\\u30ED\"},\n {syllable: {alphabet: \"k\", consonant: \"w\", vowel: \"a\"}, romaji: \"wa\", unicode: \"\\u30EF\"},\n {syllable: {alphabet: \"k\", consonant: \"w\", vowel: \"o\"}, romaji: \"wo\", unicode: \"\\u30F2\"},\n {syllable: {alphabet: \"k\", consonant: \"\", vowel: \"n\"}, romaji: \"n\", unicode: \"\\u30F3\"},\n {syllable: {alphabet: \"k\", consonant: \"g\", vowel: \"a\"}, romaji: \"ga\", unicode: \"\\u30AC\"},\n {syllable: {alphabet: \"k\", consonant: \"g\", vowel: \"i\"}, romaji: \"gi\", unicode: \"\\u30AE\"},\n {syllable: {alphabet: \"k\", consonant: \"g\", vowel: \"u\"}, romaji: \"gu\", unicode: \"\\u30B0\"},\n {syllable: {alphabet: \"k\", consonant: \"g\", vowel: \"e\"}, romaji: \"ge\", unicode: \"\\u30B2\"},\n {syllable: {alphabet: \"k\", consonant: \"g\", vowel: \"o\"}, romaji: \"go\", unicode: \"\\u30B4\"},\n {syllable: {alphabet: \"k\", consonant: \"z\", vowel: \"a\"}, romaji: \"za\", unicode: \"\\u30B6\"},\n {syllable: {alphabet: \"k\", consonant: \"z\", vowel: \"i\"}, romaji: \"ji\", unicode: \"\\u30B8\"},\n {syllable: {alphabet: \"k\", consonant: \"z\", vowel: \"u\"}, romaji: \"zu\", unicode: \"\\u30BA\"},\n {syllable: {alphabet: \"k\", consonant: \"z\", vowel: \"e\"}, romaji: \"ze\", unicode: \"\\u30BC\"},\n {syllable: {alphabet: \"k\", consonant: \"z\", vowel: \"o\"}, romaji: \"zo\", unicode: \"\\u30BE\"},\n {syllable: {alphabet: \"k\", consonant: \"d\", vowel: \"a\"}, romaji: \"da\", unicode: \"\\u30C0\"},\n {syllable: {alphabet: \"k\", consonant: \"d\", vowel: \"i\"}, romaji: \"ji\", unicode: \"\\u30C2\"},\n {syllable: {alphabet: \"k\", consonant: \"d\", vowel: \"u\"}, romaji: \"zu\", unicode: \"\\u30C5\"},\n {syllable: {alphabet: \"k\", consonant: \"d\", vowel: \"e\"}, romaji: \"de\", unicode: \"\\u30C7\"},\n {syllable: {alphabet: \"k\", consonant: \"d\", vowel: \"o\"}, romaji: \"do\", unicode: \"\\u30C9\"},\n {syllable: {alphabet: \"k\", consonant: \"b\", vowel: \"a\"}, romaji: \"ba\", unicode: \"\\u30D0\"},\n {syllable: {alphabet: \"k\", consonant: \"b\", vowel: \"i\"}, romaji: \"bi\", unicode: \"\\u30D3\"},\n {syllable: {alphabet: \"k\", consonant: \"b\", vowel: \"u\"}, romaji: \"bu\", unicode: \"\\u30D6\"},\n {syllable: {alphabet: \"k\", consonant: \"b\", vowel: \"e\"}, romaji: \"be\", unicode: \"\\u30D9\"},\n {syllable: {alphabet: \"k\", consonant: \"b\", vowel: \"o\"}, romaji: \"bo\", unicode: \"\\u30DC\"},\n {syllable: {alphabet: \"k\", consonant: \"p\", vowel: \"a\"}, romaji: \"pa\", unicode: \"\\u30D1\"},\n {syllable: {alphabet: \"k\", consonant: \"p\", vowel: \"i\"}, romaji: \"pi\", unicode: \"\\u30D4\"},\n {syllable: {alphabet: \"k\", consonant: \"p\", vowel: \"u\"}, romaji: \"pu\", unicode: \"\\u30D7\"},\n {syllable: {alphabet: \"k\", consonant: \"p\", vowel: \"e\"}, romaji: \"pe\", unicode: \"\\u30DA\"},\n {syllable: {alphabet: \"k\", consonant: \"p\", vowel: \"o\"}, romaji: \"po\", unicode: \"\\u30DD\"},\n ]\n }\n }", "function findSym(comp){\n\tif(this == comp.n){\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function PlcGeral(){\r\n}", "function IsSymbol(x) {\n\t return typeof x === \"symbol\";\n\t }", "function IsSymbol(x) {\r\n return typeof x === \"symbol\";\r\n }", "function symbolClick() {\n var symbol = $(this).text();\n updateFormula(function(text) {\n return text + symbol;\n });\n }", "function sVal(symbol){\n if(symbol == '+' || symbol == '-'){\n return 0;\n }else if (symbol == '*' || symbol == '/'){\n return 1;\n }\n}", "function symbol() {\n return document.createElementNS(Svg.svgNS, \"symbol\");\n }", "renderSymbol(symbolNode) {\n var func = this.renderGrammar[symbolNode.symbol];\n if (func) { \n func();\n } \n }", "function setYourSymbol() {\n document.getElementById('yourSymbol').innerHTML = yourSymbol;\n}", "function Cn(){}", "function SAT () { }", "function readInp(){\n\tvar inp = document.getElementById(\"cfg\").value;\n\tvar without = interpret(inp);\n\tvar SymSet = new SymbolSet(without);\n\tvar startSym = SymSet.findSym(\"S\");\n\tvar sentence = SymSet.writeSymbol(startSym);\n\t//console.log(sentence);\n\tdocument.getElementById(\"output\").innerHTML += \"<li>\" + sentence + \"</li>\";\n}", "function IsSymbol(x) {\r\n return typeof x === \"symbol\";\r\n }", "function drawSymbol( ctx, symbol, fc, cx, cy, cw, ch ) {\n\tctx.beginPath();\n\tswitch ( symbol ) {\n\t\tcase \"0\":\n\t\t\tctx.moveTo(cx+fc,cy+(ch*0.333333));\n\t\t\tctx.arc(cx+(cw/2),cy+(cw/2),(cw/2)-fc,deg2rad(180),0, false);\n\t\t\tctx.arc(cx+(cw/2),(cy+ch)-(cw/2),(cw/2)-fc,0,deg2rad(180), false);\n\t\t\tctx.closePath();\n\t\tbreak;\n\t\tcase \"1\":\n\t\t\tctx.moveTo(cx+(cw*0.1)+fc,cy+ch-fc);\n\t\t\tctx.lineTo(cx+cw-fc,cy+ch-fc);\n\t\t\tctx.moveTo(cx+(cw*0.666666),cy+ch-fc);\n\t\t\tctx.lineTo(cx+(cw*0.666666),cy+fc);\n\t\t\tctx.lineTo(cx+(cw*0.25),cy+(ch*0.25));\n\t\tbreak;\n\t\tcase \"2\":\n\t\t\tctx.moveTo(cx+cw-fc,cy+(ch*0.8));\n\t\t\tctx.lineTo(cx+cw-fc,cy+ch-fc);\n\t\t\tctx.lineTo(cx+fc,cy+ch-fc);\n\t\t\tctx.arc(cx+(cw/2),cy+(cw*0.425),(cw*0.425)-fc,deg2rad(45),deg2rad(-180), true);\n\t\tbreak;\n\t\tcase \"3\":\n\t\t\tctx.moveTo(cx+(cw*0.1)+fc,cy+fc);\n\t\t\tctx.lineTo(cx+(cw*0.9)-fc,cy+fc);\n\t\t\tctx.arc(cx+(cw/2),cy+ch-(cw*0.5),(cw*0.5)-fc,deg2rad(-90),deg2rad(180), false);\n\t\tbreak;\n\t\tcase \"4\":\n\t\t\tctx.moveTo(cx+(cw*0.75),cy+ch-fc);\n\t\t\tctx.lineTo(cx+(cw*0.75),cy+fc);\n\t\t\tctx.moveTo(cx+cw-fc,cy+(ch*0.666666));\n\t\t\tctx.lineTo(cx+fc,cy+(ch*0.666666));\n\t\t\tctx.lineTo(cx+(cw*0.75),cy+fc);\n\t\t\tctx.moveTo(cx+cw-fc,cy+ch-fc);\n\t\t\tctx.lineTo(cx+(cw*0.5),cy+ch-fc);\n\t\tbreak;\n\t\tcase \"5\":\n\t\t\tctx.moveTo(cx+(cw*0.9)-fc,cy+fc);\n\t\t\tctx.lineTo(cx+(cw*0.1)+fc,cy+fc);\n\t\t\tctx.lineTo(cx+(cw*0.1)+fc,cy+(ch*0.333333));\n\t\t\tctx.arc(cx+(cw/2),cy+ch-(cw*0.5),(cw*0.5)-fc,deg2rad(-80),deg2rad(180), false);\n\t\tbreak;\n\t\tcase \"6\":\n\t\t\tctx.moveTo(cx+fc,cy+ch-(cw*0.5)-fc);\n\t\t\tctx.arc(cx+(cw/2),cy+ch-(cw*0.5),(cw*0.5)-fc,deg2rad(-180),deg2rad(180), false);\n\t\t\tctx.bezierCurveTo(cx+fc,cy+fc,cx+fc,cy+fc,cx+(cw*0.9)-fc,cy+fc);\n\t\t\tctx.moveTo(cx+(cw*0.9)-fc,cy+fc);\n\t\tbreak;\n\t\tcase \"7\":\n\t\t\tctx.moveTo(cx+(cw*0.5),cy+ch-fc);\n\t\t\tctx.lineTo(cx+cw-fc,cy+fc);\n\t\t\tctx.lineTo(cx+(cw*0.1)+fc,cy+fc);\n\t\t\tctx.lineTo(cx+(cw*0.1)+fc,cy+(ch*0.25)-fc);\n\t\tbreak;\n\t\tcase \"8\":\n\t\t\tctx.moveTo(cx+(cw*0.92)-fc,cy+(cw*0.59));\n\t\t\tctx.arc(cx+(cw/2),cy+(cw*0.45),(cw*0.45)-fc,deg2rad(25),deg2rad(-205), true);\n\t\t\tctx.arc(cx+(cw/2),cy+ch-(cw*0.5),(cw*0.5)-fc,deg2rad(-135),deg2rad(-45), true);\n\t\t\tctx.closePath();\n\t\t\tctx.moveTo(cx+(cw*0.79),cy+(ch*0.47));\n\t\t\tctx.lineTo(cx+(cw*0.21),cy+(ch*0.47));\n\t\tbreak;\n\t\tcase \"9\":\n\t\t\tctx.moveTo(cx+cw-fc,cy+(cw*0.5));\n\t\t\tctx.arc(cx+(cw/2),cy+(cw*0.5),(cw*0.5)-fc,deg2rad(0),deg2rad(360), false);\n\t\t\tctx.bezierCurveTo(cx+cw-fc,cy+ch-fc,cx+cw-fc,cy+ch-fc,cx+(cw*0.1)+fc,cy+ch-fc);\n\t\tbreak;\n\t\tcase \"%\":\n\t\t\tctx.moveTo(cx+fc,cy+(ch*0.75));\n\t\t\tctx.lineTo(cx+cw-fc,cy+(ch*0.25));\n\t\t\tctx.moveTo(cx+(cw*0.505),cy+(cw*0.3));\n\t\t\tctx.arc(cx+(cw*0.3),cy+(cw*0.3),(cw*0.3)-fc,deg2rad(0),deg2rad(360), false);\n\t\t\tctx.moveTo(cx+(cw*0.905),cy+ch-(cw*0.3));\n\t\t\tctx.arc(cx+(cw*0.7),cy+ch-(cw*0.3),(cw*0.3)-fc,deg2rad(0),deg2rad(360), false);\n\t\tbreak;\n\t\tcase \".\":\n\t\t\tctx.moveTo(cx+(cw*0.25),cy+ch-fc-fc);\n\t\t\tctx.arc(cx+(cw*0.25),cy+ch-fc-fc,fc,deg2rad(0),deg2rad(360), false);\n\t\t\tctx.closePath();\n\t\tbreak;\n\t\tcase \"M\":\n\t\t\tctx.moveTo(cx+(cw*0.083),cy+ch-fc);\n\t\t\tctx.lineTo(cx+(cw*0.083),cy+fc);\t\n ctx.moveTo(cx+(cw*0.083),cy+fc);\t\n ctx.lineTo(cx+(cw*0.4167),cy+ch-fc);\n ctx.moveTo(cx+(cw*0.4167),cy+ch-fc);\n ctx.lineTo(cx+(cw*0.75),cy+fc);\t\n\t\t\tctx.moveTo(cx+(cw*0.75),cy+ch-fc);\n\t\t\tctx.lineTo(cx+(cw*0.75),cy+fc);\t\t\n\t\tbreak;\n\t\tcase \"G\":\n ctx.moveTo(cx+fc,cy+(ch*0.333333));\n\t\t\tctx.arc(cx+(cw/2),cy+ch-(cw*0.5),(cw*0.5)-fc,deg2rad(180),deg2rad(-15), true);\n\t\t\tctx.moveTo(cx+fc,cy+(ch*0.333333));\n\t\t\tctx.bezierCurveTo(cx+fc,cy+fc,cx+fc,cy+fc,cx+(cw*0.9)-fc,cy+fc);\n\t\t\tctx.moveTo(cx+(cw*1.00),cy+(ch*0.5));\n\t\t\tctx.lineTo(cx+(cw*0.60),cy+(ch*0.5));\n\t\tbreak;\n\t\tcase \"b\":\n\t\t\tctx.moveTo(cx+fc,cy+ch-(cw*0.5)-fc);\n\t\t\tctx.arc(cx+(cw/2),cy+ch-(cw*0.5),(cw*0.5)-fc,deg2rad(-180),deg2rad(180), false);\n\t\t\tctx.bezierCurveTo(cx+fc,cy+fc,cx+fc,cy+fc,cx+(cw*0.2)-fc,cy+fc);\n\t\t\tctx.moveTo(cx+(cw*0.9)-fc,cy+fc);\n\t\tbreak;\n\t\tcase \"B\":\n\t\t\tctx.moveTo(cx+(cw*0.92)-fc,cy+(cw*0.59));\n\t\t\tctx.arc(cx+(cw/2),cy+(cw*0.45),(cw*0.45)-fc,deg2rad(25),deg2rad(-165), true);\t\t\t\n\t\t\tctx.arc(cx+(cw/2),cy+ch-(cw*0.5),(cw*0.5)-fc,deg2rad(-215),deg2rad(-45), true);\n\t\t\tctx.closePath();\n\t\t\tctx.moveTo(cx+(cw*0.79),cy+(ch*0.47));\n\t\t\tctx.lineTo(cx+(cw*0.21),cy+(ch*0.47));\n\t\tbreak;\n\t\tdefault:\n\t\tbreak;\n\t}\t\n\tctx.stroke();\n}", "function SymbolTable () {\n // add the default table\n let table = {}\n}", "function c(e,c,t,n){var o={s:[\"थोडया सॅकंडांनी\",\"थोडे सॅकंड\"],ss:[e+\" सॅकंडांनी\",e+\" सॅकंड\"],m:[\"एका मिणटान\",\"एक मिनूट\"],mm:[e+\" मिणटांनी\",e+\" मिणटां\"],h:[\"एका वरान\",\"एक वर\"],hh:[e+\" वरांनी\",e+\" वरां\"],d:[\"एका दिसान\",\"एक दीस\"],dd:[e+\" दिसांनी\",e+\" दीस\"],M:[\"एका म्हयन्यान\",\"एक म्हयनो\"],MM:[e+\" म्हयन्यानी\",e+\" म्हयने\"],y:[\"एका वर्सान\",\"एक वर्स\"],yy:[e+\" वर्सांनी\",e+\" वर्सां\"]};return n?o[t][0]:o[t][1]}", "function simbl() {\n symbol = confirm(\"do you want to include symbol case option\\n ok = yes cancel = no\");\n return symbol; \n}", "function IsSymbol(x) {\n return typeof x === \"symbol\";\n }", "function IsSymbol(x) {\n return typeof x === \"symbol\";\n }", "function IsSymbol(x) {\n return typeof x === \"symbol\";\n }", "function IsSymbol(x) {\n return typeof x === \"symbol\";\n }", "function IsSymbol(x) {\n return typeof x === \"symbol\";\n }", "function IsSymbol(x) {\n return typeof x === \"symbol\";\n }", "function IsSymbol(x) {\n return typeof x === \"symbol\";\n }", "function sc_symbol2string(s) {\n return s.slice(1);\n}", "function symbol(val, norm_fn) {\n norm_fn = def(norm_fn, normalizeSymbol);\n\n var value = norm_fn(val);\n require(typeof value !== 'undefined',\n \"Cannot create symbol from \" + repr(value));\n\n return new Symbol(value);\n}", "function getSymbol(symbol) { \n var value = symbolElem.value;\n return value;\n}", "function Cosine() {\r\n}", "function test() {\n var s;\n\n s = Symbol('x\\ucafe'.repeat(1e7));\n print(String(s).length);\n\n s = Symbol.for('x\\ucafe'.repeat(1e7));\n print(String(s).length);\n}", "function P(a){return Ca[a]||(Ca[a]=\"&#\"+a.charCodeAt(0)+\";\")}", "function create_usecodes_map() {\n return {\n Z: '2'\n , G: '3'\n , TAXABLE: '1'\n };\n }", "function comprobarLexema(codigo) {\n if (codigo == 86 || codigo == 69 || codigo == 68 || codigo == 79 || codigo == 82 || codigo == 65) {\n return (\"verdadero\");\n } else if (codigo == 118 || codigo == 97 || codigo == 114 || codigo == 105 || codigo == 98 || codigo == 108 || codigo == 101) {\n return (\"variable\");\n\n } else if (codigo == 70 || codigo == 65 || codigo == 76 || codigo == 79 || codigo == 83) {\n return (\"falso\");\n }\n else if ((codigo >= 97 && codigo <= 122) || (codigo >= 65 && codigo <= 69) || (codigo >= 71 && codigo <= 90)) {\n return (\"letra\");\n } else if (codigo >= 48 && codigo <= 57) {\n return (\"digito\");\n } else if (codigo == 58 || codigo == 59 || codigo == 44 || codigo == 46) {//codigo 46 es el punto .\n return (\"Puntuacion\");\n\n } else if (codigo == 37 || codigo == 42 || codigo == 43 || codigo == 45 || codigo == 47 || codigo == 60 || codigo == 61 || codigo == 62) {\n return (\"Aritmeticos\");\n } else if (codigo == 40 || codigo == 41 || codigo == 91 || codigo == 93 || codigo == 123 || codigo == 125) {\n return (\"agrupacion\");\n } else if (codigo == 34 || codigo == 59) {\n return (\"Signo\");\n }\n else if (codigo == 65 || codigo == 70 || codigo == 76 || codigo == 79 || codigo == 83) {\n return (\"falso\");\n }\n\n}", "toString() {\n return this.symbol + \"_\" + this.subscript;\n }", "function Conversions_getSymbolPriority(symbol){\r\n switch(symbol){\r\n case \"(\":return 5;\r\n case \"|\":return 4;\r\n case \"^\":return 3;\r\n case \"*\":return 2;\r\n case \"/\":return 2;\r\n case \"+\":return 1;\r\n case \"-\":return 1;\r\n }\r\n return 0;\r\n}", "function symbol(value) {\n\tif($.isArray(value)) {\n\t\tfor(var i=0;i<value.length;i++) {\n\t\t\tif(symbols.indexOf(value[i])==-1)\n\t\t\t\tsymbols.push(value[i]);\n\t\t}\n\t}else {\n\t\tif(symbols.indexOf(value)==-1)\n\t\t\tsymbols.push(value.toString());\n\t}\n}", "function test1() {\n var date = new Date(2011, 10, 30);\n var sym = Symbol(\"FAZ\");\n\n var name0 = function () {\n var a = 1;\n var b = 2;\n var c = 3;\n return a + c + b;\n };\n\n var name1 = function () {\n var a = 1;\n var b = \"1\";\n var c = \"b\";\n return a + b + c;\n };\n\n var name2 = function () {\n var a = {};\n var b = date;\n var c = {};\n return a + b + c;\n };\n\n var name3 = function () {\n return NaN;\n };\n\n var name4 = function () {\n return undefined;\n };\n\n var name5 = function () {\n return null;\n };\n\n var name6 = function () {\n return true;\n };\n\n var name7 = function () {\n return false;\n };\n\n var name8 = function () {\n return sym;\n };\n\n var name9 = function () {\n return date;\n };\n\n var qux = class {\n [name0()]() {\n ;\n }\n\n [name1()]() {\n ;\n }\n\n [name2()]() {\n ;\n }\n\n [name3()]() {\n ;\n }\n\n [name4()]() {\n ;\n }\n\n [name5()]() {\n ;\n }\n\n [name6()]() {\n ;\n }\n\n [name7()]() {\n ;\n }\n\n [name8()]() {\n ;\n }\n\n [name9()]() {\n ;\n }\n\n };\n var quxObj = new qux();\n quxObj[name0()].name;\n quxObj[name1()].name;\n quxObj[name2()].name;\n quxObj[name3()].name;\n quxObj[name4()].name;\n quxObj[name5()].name;\n quxObj[name6()].name;\n quxObj[name7()].name;\n quxObj[name8()].name;\n quxObj[name9()].name;\n quxObj[name0()].toString();\n quxObj[name1()].toString();\n quxObj[name2()].toString();\n quxObj[name3()].toString();\n quxObj[name4()].toString();\n quxObj[name5()].toString();\n quxObj[name6()].toString();\n quxObj[name7()].toString();\n quxObj[name8()].toString();\n quxObj[name9()].toString();\n}", "function Acos() {\r\n}", "function displaySymbol (){\n this.classList.toggle(\"open\");\n this.classList.toggle(\"show\");\n this.classList.toggle(\"disabled\");\n }", "constructor(type, symbols){\n super(type)\n this.table = {}\n for( var i=0; i<symbols.length; i++ ) this.table[symbols.charAt(i)] = symbols.charAt(i)\n }", "function gas(code) {\n return String.fromCharCode(code);\n}", "function gas(code) {\n return String.fromCharCode(code);\n}", "function a(e,a,c,n){var t={s:[\"थोडया सॅकंडांनी\",\"थोडे सॅकंड\"],ss:[e+\" सॅकंडांनी\",e+\" सॅकंड\"],m:[\"एका मिणटान\",\"एक मिनूट\"],mm:[e+\" मिणटांनी\",e+\" मिणटां\"],h:[\"एका वरान\",\"एक वर\"],hh:[e+\" वरांनी\",e+\" वरां\"],d:[\"एका दिसान\",\"एक दीस\"],dd:[e+\" दिसांनी\",e+\" दीस\"],M:[\"एका म्हयन्यान\",\"एक म्हयनो\"],MM:[e+\" म्हयन्यानी\",e+\" म्हयने\"],y:[\"एका वर्सान\",\"एक वर्स\"],yy:[e+\" वर्सांनी\",e+\" वर्सां\"]};return n?t[c][0]:t[c][1]}", "function IsSymbol(x) {\r\n return typeof x === \"symbol\";\r\n }", "function IsSymbol(x) {\r\n return typeof x === \"symbol\";\r\n }", "function IsSymbol(x) {\r\n return typeof x === \"symbol\";\r\n }", "function computeCode (seq) {\n var keys = seq.split('+');\n var res = 0;\n \n for (var i = 0; i < keys.length; i++) {\n if (special_keys[keys[i]])\n res += special_keys[keys[i]];\n else\n res += keys[i].charCodeAt(0);\n }\n \n return res;\n }", "function sc_isSymbol(s) {\n return (typeof s === \"string\") &&\n\t(s.charAt(0) === sc_SYMBOL_PREFIX);\n}", "GetSymbol (symbol) {\n if (symbol === undefined) {\n return 0;\n }\n let imgsrc = ''\n switch(symbol) {\n case 'partly-cloudy-day':\n imgsrc = partlycloudyday;\n break;\n case 'clear-day':\n imgsrc = clearday;\n break;\n case 'clear-night':\n imgsrc = clearnight;\n break;\n case 'rain':\n imgsrc = rain;\n break;\n case 'snow': \n imgsrc = snow;\n break;\n case 'mist': \n imgsrc = mist;\n break;\n case 'sleet': \n imgsrc = sleet;\n break;\n case 'wind': \n imgsrc = wind;\n break;\n case 'fog': \n imgsrc = fog;\n break;\n case 'cloudy':\n imgsrc = cloudy;\n break; \n case 'partly-cloudy-night':\n imgsrc = partlycloudynight;\n break;\n case 'tornado':\n imgsrc = tornado;\n break;\n case 'thunderstorm':\n imgsrc = thunderstorm;\n break;\n default: \n imgsrc = def;\n }\n return imgsrc;\n }", "function translateToKa() {\n /**\n * Original idea by Irakli Nadareishvili\n * http://www.sapikhvno.org/viewtopic.php?t=47&postdays=0&postorder=asc&start=10\n */\n var index, chr, text = [], symbols = \"abgdevzTiklmnopJrstufqRySCcZwWxjh\";\n \n for (var i = 0; i < this.length; i++) {\n chr = this.substr(i, 1);\n if ((index = symbols.indexOf(chr)) >= 0) {\n text.push(String.fromCharCode(index + 4304));\n } else {\n text.push(chr);\n }\n }\n return text.join('');\n }", "function getSymbol(currency) {\n\n switch (currency) {\n case \"GBP\":\n return \"£\"\n case \"EUR\":\n return \"€\"\n case \"USD\":\n return \"$\"\n case \"AUD\":\n return \"A$\"\n default:\n return currency;\n }\n\n}", "function getCode(hex) {\r\n\tfor (key in immed_instr) \r\n\t\tif (hex == immed_instr[key]) \r\n\t\t\treturn key;\r\n\tfor (key in base_instr) \r\n\t\tif (hex == base_instr[key]) \r\n\t\t\treturn key;\r\n\tfor (key in pcrel_instr) \r\n\t\tif (hex == pcrel_instr[key]) \r\n\t\t\treturn key;\r\n\tfor (key in pseudodir_instr) \r\n\t\tif (hex == pseudodir_instr[key]) \r\n\t\t\treturn key;\r\n\treturn null;\r\n}", "function getSymbol(volume) {\n if (volume >= 0.5) return '🔊';//0.5 - 1.0\n if (volume >= 0.1) return '🔉';//0.1 - 0.49\n if (volume > 0) return '🔈';//0.01 - 0.09\n return '🔇';//0\n}", "function AMinitSymbols() {\n var texsymbols = [], i;\n for (i = 0; i < AMsymbols.length; i++)\n if (AMsymbols[i].tex)\n texsymbols[texsymbols.length] = {\n input: AMsymbols[i].tex,\n tag: AMsymbols[i].tag, output: AMsymbols[i].output, ttype: AMsymbols[i].ttype\n };\n AMsymbols = AMsymbols.concat(texsymbols);\n AMsymbols.sort(compareNames);\n for (i = 0; i < AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;\n }", "function greek() {\n\treturn [\n\t\t// Space\n\t\t[32, \"normal\", function(){PD.selected.print('\\u2022')}],\n\t\n\t\t// Alpha\n\t\t[65, \"normal\", function(){PD.selected.print('\\u03b1')}],\n\t\t[65, \"shift\", function(){PD.selected.print('\\u0391')}],\n\t\t\n\t\t// Beta\n\t\t[66, \"normal\", function(){PD.selected.print('\\u03b2')}],\n\t\t[66, \"shift\", function(){PD.selected.print('\\u0392')}],\n\t\t\n\t\t// Psi\n\t\t[67, \"normal\", function(){PD.selected.print('\\u03c7')}],\n\t\t[67, \"shift\", function(){PD.selected.print('\\u03a7')}],\n\t\t\n\t\t// Delta\n\t\t[68, \"normal\", function(){PD.selected.print('\\u03b4')}],\n\t\t[68, \"shift\", function(){PD.selected.print('\\u0394')}],\n\t\t\n\t\t// Epsilon\n\t\t[69, \"normal\", function(){PD.selected.print('\\u03b5')}],\n\t\t[69, \"shift\", function(){PD.selected.print('\\u0395')}],\n\t\t\n\t\t// Phi\n\t\t[70, \"normal\", function(){PD.selected.print('\\u03c5')}],\n\t\t[70, \"shift\", function(){PD.selected.print('\\u03a5')}],\n\t\t\n\t\t// Gammma\n\t\t[71, \"normal\", function(){PD.selected.print('\\u03b3')}],\n\t\t[71, \"shift\", function(){PD.selected.print('\\u0393')}],\n\t\t\n\t\t// Eta\n\t\t[72, \"normal\", function(){PD.selected.print('\\u03b7')}],\n\t\t[72, \"shift\", function(){PD.selected.print('\\u0397')}],\n\t\t\n\t\t// Iota\n\t\t[73, \"normal\", function(){PD.selected.print('\\u03b9')}],\n\t\t[73, \"shift\", function(){PD.selected.print('\\u0399')}],\n\t\t\n\t\t// Xi\n\t\t[74, \"normal\", function(){PD.selected.print('\\u03be')}],\n\t\t[74, \"shift\", function(){PD.selected.print('\\u039e')}],\n\t\t\n\t\t// Kappa\n\t\t[75, \"normal\", function(){PD.selected.print('\\u03ba')}],\n\t\t[75, \"shift\", function(){PD.selected.print('\\u039a')}],\n\t\t\n\t\t// Lambda\n\t\t[76, \"normal\", function(){PD.selected.print('\\u03bb')}],\n\t\t[76, \"shift\", function(){PD.selected.print('\\u039b')}],\n\t\t\n\t\t// Mu\n\t\t[77, \"normal\", function(){PD.selected.print('\\u03bc')}],\n\t\t[77, \"shift\", function(){PD.selected.print('\\u039c')}],\n\t\t\n\t\t// Nu\n\t\t[78, \"normal\", function(){PD.selected.print('\\u03bd')}],\n\t\t[78, \"shift\", function(){PD.selected.print('\\u039d')}],\n\t\t\n\t\t// Omicron\n\t\t[79, \"normal\", function(){PD.selected.print('\\u03bf')}],\n\t\t[79, \"shift\", function(){PD.selected.print('\\u039f')}],\n\t\t\n\t\t// Pi\n\t\t[80, \"normal\", function(){PD.selected.print('\\u03c0')}],\n\t\t[80, \"shift\", function(){PD.selected.print('\\u03a0')}],\n\t\t\n\t\t[81, \"normal\", function(){doNothing()}],\n\t\t[81, \"shift\", function(){doNothing()}],\n\t\t\n\t\t// Rho\n\t\t[82, \"normal\", function(){PD.selected.print('\\u03c1')}],\n\t\t[82, \"shift\", function(){PD.selected.print('\\u03a1')}],\n\t\t\n\t\t// Sigma\n\t\t[83, \"normal\", function(){PD.selected.print('\\u03c2')}],\n\t\t[83, \"shift\", function(){PD.selected.print('\\u03a3')}],\n\t\t\n\t\t// Tau\n\t\t[84, \"normal\", function(){PD.selected.print('\\u03c3')}],\n\t\t[84, \"shift\", function(){PD.selected.print('\\u0393')}],\n\t\t\n\t\t// Theta\n\t\t[85, \"normal\", function(){PD.selected.print('\\u03b8')}],\n\t\t[85, \"shift\", function(){PD.selected.print('\\u0398')}],\n\t\t\n\t\t// Omega\n\t\t[86, \"normal\", function(){PD.selected.print('\\u03c8')}],\n\t\t[86, \"shift\", function(){PD.selected.print('\\u03a8')}],\n\t\t\n\t\t[87, \"normal\", function(){doNothing()}],\n\t\t[87, \"shift\", function(){doNothing()}],\n\t\t\n\t\t// Chi\n\t\t[88, \"normal\", function(){PD.selected.print('\\u03c6')}],\n\t\t[88, \"shift\", function(){PD.selected.print('\\u03a6')}],\n\t\t\n\t\t// Upsilon\n\t\t[89, \"normal\", function(){PD.selected.print('\\u03c4')}],\n\t\t[89, \"shift\", function(){PD.selected.print('\\u03a4')}],\n\t\t\n\t\t// Zeta\n\t\t[90, \"normal\", function(){PD.selected.print('\\u03b6')}],\n\t\t[90, \"shift\", function(){PD.selected.print('\\u0396')}]\n\t];\n}", "function AMinitSymbols() {\n var i;\n var symlen = AMsymbols.length;\n for (i = 0; i < symlen; i++) {\n if (AMsymbols[i].tex && !(typeof AMsymbols[i].notexcopy == 'boolean' && AMsymbols[i].notexcopy)) {\n AMsymbols.push({\n input: AMsymbols[i].tex,\n tag: AMsymbols[i].tag,\n output: AMsymbols[i].output,\n ttype: AMsymbols[i].ttype,\n acc: AMsymbols[i].acc || false\n });\n }\n }\n refreshSymbols();\n}", "getCodeValue() {\n let codes = {\n '0': '100010100',\n '1': '101001000',\n '2': '101000100',\n '3': '101000010',\n '4': '100101000',\n '5': '100100100',\n '6': '100100010',\n '7': '101010000',\n '8': '100010010',\n '9': '100001010',\n 'A': '110101000',\n 'B': '110100100',\n 'C': '110100010',\n 'D': '110010100',\n 'E': '110010010',\n 'F': '110001010',\n 'G': '101101000',\n 'H': '101100100',\n 'I': '101100010',\n 'J': '100110100',\n 'K': '100011010',\n 'L': '101011000',\n 'M': '101001100',\n 'N': '101000110',\n 'O': '100101100',\n 'P': '100010110',\n 'Q': '110110100',\n 'R': '110110010',\n 'S': '110101100',\n 'T': '110100110',\n 'U': '110010110',\n 'V': '110011010',\n 'W': '101101100',\n 'X': '101100110',\n 'Y': '100110110',\n 'Z': '100111010',\n '-': '100101110',\n '.': '111010100',\n ' ': '111010010',\n '$': '111001010',\n '/': '101101110',\n '+': '101110110',\n '%': '110101110',\n '($)': '100100110',\n '(/)': '111010110',\n '(+)': '100110010',\n '(%)': '111011010',\n };\n return codes;\n }", "function Ha(){}", "static get [Symbol.species]() {\n\n //alert(\"get\");\n try {\no4.o11 = o10[1];\n}catch(e){}\n try {\nreturn o2;\n}catch(e){}\n }", "function IsSymbol(x) {\n return typeof x === \"symbol\";\n }", "function IsSymbol(x) {\n return typeof x === \"symbol\";\n }", "function get_dec_name()\n{\n\treturn \"SSI\";\n}", "function sc_symbolAppend() {\n var res = sc_SYMBOL_PREFIX;\n for (var i = 0; i < arguments.length; i++)\n\tres += arguments[i].slice(1);\n return res;\n}" ]
[ "0.6914385", "0.66739875", "0.65223515", "0.6520163", "0.64238113", "0.637195", "0.63079673", "0.6276075", "0.6205184", "0.6166091", "0.5978645", "0.5918355", "0.5857415", "0.585101", "0.5819994", "0.5801621", "0.57970124", "0.57946384", "0.5787929", "0.5775692", "0.57667786", "0.57356644", "0.5714504", "0.57047725", "0.5659545", "0.56206244", "0.56191474", "0.5597731", "0.5597731", "0.5597731", "0.5597731", "0.5597731", "0.5597731", "0.5594316", "0.55867434", "0.55776507", "0.55752766", "0.5512144", "0.5480133", "0.54732263", "0.54639965", "0.54508823", "0.54419416", "0.54311574", "0.5416164", "0.541546", "0.5400558", "0.53804576", "0.5370334", "0.5368325", "0.53655684", "0.53553617", "0.53435874", "0.5333981", "0.53219086", "0.5316972", "0.53144234", "0.53144234", "0.53144234", "0.53144234", "0.53144234", "0.53144234", "0.53144234", "0.5312381", "0.5312076", "0.53093624", "0.5293951", "0.52803504", "0.52801305", "0.5279661", "0.5264507", "0.5258264", "0.52558494", "0.5250071", "0.52479064", "0.5238895", "0.52371633", "0.5232956", "0.52321386", "0.52321386", "0.5230233", "0.5228909", "0.5228909", "0.5228909", "0.52210337", "0.5216629", "0.5213183", "0.52027005", "0.5201662", "0.5200843", "0.5189251", "0.5184667", "0.5184451", "0.5176088", "0.51569045", "0.51564884", "0.51555926", "0.5149905", "0.5149905", "0.5148731", "0.51444167" ]
0.0
-1
This returns the y for the center of a staff line
getYForLine(line) { const options = this.options; const spacing = options.spacing_between_lines_px; const headroom = options.space_above_staff_ln; const y = this.y + (line * spacing) + (headroom * spacing); return y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_line_y(c) {\n\treturn 94 + c * 75;\n}", "function getCenterY()/*:Number*/ {\n return this.getUpperY() + this.getMyHeight() / 2;\n }", "function get_point_y(c) {\n\treturn 94 + c * 75;\n}", "function getOriginY() {\n\t\treturn Math.min(this.originY, this.finalY);\n\t}", "function d4_svg_lineY(d) {\n return d[1];\n}", "function findTrueYCoord(y){\n var yCoord = firstDotYPos + (y * yDistBetweenDots);\n return yCoord;\n}", "function obtenerPosInicialY(){\n return (parseFloat(ball.style.top)*tablero.clientHeight/100);\n}", "function d3_svg_lineY(d) {\n return d[1];\n}", "function d3_svg_lineY(d) {\n return d[1];\n}", "function d3_svg_lineY(d) {\n return d[1];\n}", "function d3_v3_svg_lineY(d) {\n return d[1];\n}", "function lastY() { return (segments.length == 0) ? 0 : segments[segments.length-1].p2.w.y; }", "yFromScreenBasis(y) {\n return y / this.params.sy * this.smallestScreenEdge() - this.canvas.centre[1]\n }", "function findYCoord(y){\n var yCoord;\n var yAdjustment = y - firstDotYPos;\n \n //if y touch coord is equal to or less than firstDotYPos y coord is 0\n if(yAdjustment <= 0){\n yCoord = 0;\n }\n //else if y coord is equal to or greater than last row y coord is the last row\n else if(yAdjustment / yDistBetweenDots >= (numOfRows - 1) ){\n yCoord = numOfRows -1;\n }\n //else work out the value for the y coord based on the touch coord given\n else {\n yCoord = yAdjustment / yDistBetweenDots;\n }\n \n //return the xCoord value\n return yCoord;\n}", "function labelY() {\n const l = d3.select(this.parentNode).select('line');\n return parseInt(l.attr('y1')) - 20;\n}", "getSliderCentreY() {\n return this.sliderBoundingRect.current.getBoundingClientRect().top + (this.sliderBoundingRect.current.getBoundingClientRect().height / 2);\n }", "function lineMidpoint(line){\n return [(line[0][0] + line[1][0]) / 2, (line[0][1] + line[1][1]) / 2];\n }", "getY() {\n\t\treturn ( 800 - this.ty ) * 32 + terrain.getYOffset( game.tyoff );\n\t}", "function lastY() { return (segments.length == 0) ? 0 : segments[segments.length-1].p2.world.y; }", "function get_text_y(c) {\n\treturn 119 + 75 * c;\n}", "getLineLengthBetweenPoints (x, y, x0, y0){\n return Math.sqrt((x -= x0) * x + (y -= y0) * y);\n }", "function computeY (y) {\n const mag = me.magnification / 100\n return decimalRound((-y + me.element.el.offsetTop + (me.height / 2)) / mag, 2)\n }", "get Center() { return [this.x1 + (0.5 * this.x2 - this.x1), this.y1 + (0.5 * this.y2 - this.y1)]; }", "get Center() { return [this.x1 + (0.5 * this.x2 - this.x1), this.y1 + (0.5 * this.y2 - this.y1)]; }", "get startY() {\n if(!this._startY) {\n if(this.isVertical)\n this._startY = UNIT_PIXELS_V_START_Y;\n else\n this._startY = UNIT_PIXELS_H_START_Y;\n this._startY *= this.scale;\n }\n return this._startY;\n }", "function yOnCanvas(y){\r\n\treturn sciMonk.CanvasHeight - (sciMonk.CanvasHeight/sciMonk.Height)*y;\r\n}", "function lineLength(x, y, x0, y0){\n return Math.sqrt((x -= x0) * x + (y -= y0) * y);\n}", "horzLineAt (y) { return this._horz[this.horzIdxAt(y)] }", "private_getChipYStart()\n\t{\n\t\tlet y = this.coords.y - this.radius;\n\t\treturn y;\n\t}", "y() {\n\t\t\treturn this.data.y;\n\t\t}", "function calcYInt(pt, m) {\n return (pt.y - (m * pt.x));\n}", "function yPosition(d,i){\n return Math.floor(i/100)*11+60\n }", "function getFinalY() {\n\t\treturn Math.abs(this.finalY - this.originY);\n\t}", "function lastY() {\n return (segments.length === 0) ? 0 : segments[segments.length - 1].p2.world.y;\n}", "function calcY(i)\n\t{\n\t\tif (Math.abs(i) > drawLines.magnitude)\n\t\t\tdrawLines.magnitude = Math.abs(i);\n\t\treturn ((i * canvas.height) / (drawLines.magnitude * 2)) + (canvas.height / 2);\n\t}", "yToScreenBasis(y) {\n //return y + this.canvas.centre[1]\n return (y + this.canvas.centre[1]) / this.smallestScreenEdge() * this.params.sy\n }", "getY() { return this.y; }", "cellCenterY(row) {\n return this.cellHeight * 1/2 + this.cellHeight * row\n }", "function setMiddleY() {\r\n self.middleY = (self.top + self.bottom) / 2;\r\n }", "get adjustedY() { return this.y - this.originY }", "function getYOffset() {\n return container.offsetHeight + containerBottomMargin + containerTopMargin + canvasBorderTop + canvasBorderBottom;\n}", "function getSlopeY(x) {\n return first_y_px + ((x - first_x_px) * slope);\n }", "get positionCentre()\n {\n return new Vector2D(\n this.position.x + this.#width/2,\n this.position.y + this.#height/2\n );\n }", "function getyDistBetweenDots(){\n var yDistBetweenDots = distBetweenDots / 2;\n\n return yDistBetweenDots\n}", "getCenterPoint() {\n return this.getIntermediatePoint(0.5);\n }", "function getSublaneCenterOffset(sublane,maxDepth){\n\tif(sublane){\n\t\tvar _sublane = getSublaneByNameNEW(sublane,maxDepth);\n\t\tif (_sublane){\n\t\t\tvar _height = _sublane.yt2-_sublane.yt1;\n\t\t\treturn -(_height/2);\n\t\t}\n\t}\n}", "_yPx( yLogical ) {\n var val = yLogical*this.scale.y+this.transform.y;\n return !isFinite(val) ? 0+this.transform.y : val;\n }", "function linePos(area) { return lineBefore(area).length; }", "function virtical_location(y, sizey){\n\t \tif(((y+sizey)/tileHeight)%1 >= 0.5){\n\t \t\treturn Math.ceil((y+sizey)/tileHeight)+1\n\t \t} else {\n\t \t\treturn Math.floor((y+sizey)/tileHeight)+1;\n\t \t}\n\t }", "function getY() {\n\n\t\treturn this.y;\n\n\t}", "get cursorY() {\n\t\treturn this._cursorPos[1];\n\t}", "function calcDiagramY(value)\n\t{\n\t\t// Return Y coordinate for this value.\n\t\t/*var diagramY =\n\t\t\t((value * canvas.height) / 2)\n\t\t\t+ (canvas.height / 2);\n\t\t*/\n\t\tvar diagramY = (canvas.height / 2) - value + 30;\n\t\t//console.log(diagramY);\n\t\treturn diagramY;\n\t}", "function position(line_r, line_s, point){\n\treturn Math.sign((line_s.x - line_r.x)*(point.y - line_r.y) - (line_s.y - line_r.y)*(point.x - line_r.x));\t\n}", "function sectionYcoord (pair, legHeight){\n const elOnTop = findPosition(pair, \"y\");\n const sectionY = elOnTop[0].yCoord + elOnTop[0].height+legHeight;\n return sectionY;\n}", "getYOffset (pageIndex, anchor)\n {\n let pidx = (typeof(pageIndex) === \"undefined\" ? this.settings.currentPageIndex : pageIndex);\n\n if (anchor === \"center\" || anchor === \"centre\") //how you can tell an American coded this\n {\n return parseInt(this.getPageData(pidx, \"h\") / 2, 10);\n }\n else if (anchor === \"bottom\")\n {\n return parseInt(this.getPageData(pidx, \"h\") - this.settings.panelHeight / 2, 10);\n }\n else\n {\n return parseInt(this.settings.panelHeight / 2, 10);\n }\n }", "function getY(p, x, sweeplineY) {\n var dp = 2 * (p[1] - sweeplineY);\n var b1 = -2 * p[0] / dp;\n var c1 = sweeplineY + dp / 4 + p[0] * p[0] / dp;\n return x * x / dp + b1 * x + c1;\n }", "get mid_x() { //center of x position\n return this.x + this.w / 2;\n }", "getY() {\r\n return this.y;\r\n }", "function getLinePos() {\n let linesPos = [];\n\n gMeme[getMemeIdxInGMeme(gCurrMeme)].lines.forEach((line) => {\n\n // Handle y\n const y1 = line.pos.y - (line.font.size + line.stroke.size);\n const y2 = line.pos.y + 10\n\n // Handle x\n gCtx.font = `${line.font.size}px ${line.font.family}`;\n let x1;\n let x2;\n\n switch (line.font.align) {\n case 'right':\n x1 = line.pos.x + 10;\n x2 = line.pos.x - gCtx.measureText(line.txt).width - 10;\n break;\n case 'center':\n x1 = line.pos.x - gCtx.measureText(line.txt).width / 2 - 10;\n x2 = line.pos.x + gCtx.measureText(line.txt).width / 2 + 10;\n break;\n case 'left':\n x1 = line.pos.x - 10;\n x2 = line.pos.x + gCtx.measureText(line.txt).width + 10;\n break;\n }\n\n linesPos.push({\n lId: line.lineId,\n pos: { x1, x2, y1, y2 }\n })\n });\n\n return linesPos;\n}", "getY() {\n return this.getLocation().y;\n }", "center(x, y) {\n return this.cx(x).cy(y);\n }", "get getBodyY(){\n\t\treturn this.body.y;\n\t}", "function getCanvasCentrePosition() {\n\tvar canvas = document.getElementById(\"myCanvas\");\n\n\treturn {\n\t\tx: canvas.width / 2,\n\t\ty: canvas.height / 2\n\t};\n}", "function annot_offset(range_end){\n var lines = editor.getSession().getDocument().getLines(0, range_end.row);\n var total_off = 0;\n var num_char;\n\n for(var i = 0; i < lines.length; i++){\n num_char = lines[i].length;\n total_off += parseInt((num_char - 1) / 80, 10);\n }\n\n return total_off;\n}", "get TopCenter() {}", "getEndPosition(widget) {\n let left = widget.x;\n let top = widget.y;\n let lineWidget = undefined;\n if (widget.childWidgets.length > 0) {\n lineWidget = widget.childWidgets[widget.childWidgets.length - 1];\n left += this.getWidth(lineWidget, false);\n }\n if (!isNullOrUndefined(lineWidget)) {\n top = this.getTop(lineWidget);\n }\n let topMargin = 0;\n let bottomMargin = 0;\n let size = this.getParagraphMarkSize(widget, topMargin, bottomMargin);\n return new Point(left, top + size.topMargin);\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 line_positions() {\n\n line_one_x = win_width * .7;\n line_one_y = win_height * .8;\n\n line_two_x = win_width * .75;\n line_two_y = -(line_two.getBBox().height / 2);\n\n line_three_x = win_width * .65;\n line_three_y = win_height * .6;\n\n line_one.attr({\n transform: 't' + line_one_x + ' ' + line_one_y\n });\n line_two.attr({\n transform: 't' + line_two_x + ' ' + line_two_y\n });\n line_three.attr({\n transform: 't' + line_three_x + ' ' + line_three_y\n })\n }", "get getHeadY(){\n\t\treturn this.head.y = Math.round(document.querySelector('#snake_head').offsetTop);\t\n\t}", "offset() {\n if (this.overlap) return this.dot ? 8 : 12;\n return this.dot ? 2 : 4;\n }", "function getCenterCoordinates() {\n return {\n x: getXAverage(),\n y: getYAverage()\n }\n }", "getCenter(){\n\t\treturn {\n\t\t\tx: 2,\n\t\t\ty: 2\n\t\t};\n\t}", "_getCenter(o, dimension, axis) {\n if (o.anchor !== undefined) {\n if (o.anchor[axis] !== 0) {\n return 0;\n }\n else {\n //console.log(o.anchor[axis])\n return dimension / 2;\n }\n }\n else {\n return dimension;\n }\n }", "function drawCenterLine() {\r\n ctx.strokeStyle = \"white\"; //Line color\r\n ctx.beginPath(); //Start path\r\n ctx.lineWidth = 2; //Line width\r\n ctx.moveTo(canvas.width / 2, 0); //Start point\r\n ctx.lineTo(canvas.width / 2, canvas.height); //End point\r\n ctx.stroke(); //Draw the line\r\n}", "function estimateCoords(cm, pos) {\r\n var left = 0, pos = clipPos(cm.doc, pos);\r\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\r\n var lineObj = getLine(cm.doc, pos.line);\r\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\r\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\r\n }", "get center() {\r\n return {\r\n x: this.x + this.width / 2,\r\n y: this.y + this.height / 2\r\n }\r\n }", "get Center() {}", "get center(): _Point {\n return Point(\n this.position.x + this.width / 2,\n this.position.y + this.height / 2\n )\n }", "getCenterX() {\n return this.x + this.width/2\n }", "gety()\n\t{\n\t\treturn this.y;\n\t}", "getPoint1Y() {\n\n return this.point1.getY();\n }", "get yPosition() { return this._yPosition; }", "function center(iv) {\n return Math.floor((iv.stop + iv.start) / 2);\n }", "cy(y) {\n return y == null ? this.y() + this.height() / 2 : this.y(y - this.height() / 2);\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 estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }", "function estimateCoords(cm, pos) {\n\t var left = 0, pos = clipPos(cm.doc, pos);\n\t if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n\t var lineObj = getLine(cm.doc, pos.line);\n\t var top = heightAtLine(lineObj) + paddingTop(cm.display);\n\t return {left: left, right: left, top: top, bottom: top + lineObj.height};\n\t }", "function estimateCoords(cm, pos) {\n\t var left = 0, pos = clipPos(cm.doc, pos);\n\t if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n\t var lineObj = getLine(cm.doc, pos.line);\n\t var top = heightAtLine(lineObj) + paddingTop(cm.display);\n\t return {left: left, right: left, top: top, bottom: top + lineObj.height};\n\t }", "function estimateCoords(cm, pos) {\n\t var left = 0, pos = clipPos(cm.doc, pos);\n\t if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n\t var lineObj = getLine(cm.doc, pos.line);\n\t var top = heightAtLine(lineObj) + paddingTop(cm.display);\n\t return {left: left, right: left, top: top, bottom: top + lineObj.height};\n\t }", "function estimateCoords(cm, pos) {\n\t\t var left = 0, pos = clipPos(cm.doc, pos);\n\t\t if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n\t\t var lineObj = getLine(cm.doc, pos.line);\n\t\t var top = heightAtLine(lineObj) + paddingTop(cm.display);\n\t\t return {left: left, right: left, top: top, bottom: top + lineObj.height};\n\t\t }", "sPos (x, y) {\n\t\treturn y * this.w + x;\n\t}", "getCenterPosition() {\n\t\tlet center = this.getCenter();\n\t\treturn {\n\t\t\tx: this.x + center.x,\n\t\t\ty: this.y + center.y\n\t\t};\n\t}", "get center() {\n return {\n x: this.width / 2,\n y: this.height / 2\n };\n }" ]
[ "0.73848116", "0.72168785", "0.700793", "0.6577882", "0.6486009", "0.6479815", "0.6423857", "0.6405464", "0.6405464", "0.6405464", "0.63861865", "0.63235414", "0.63163394", "0.6313648", "0.62426716", "0.6235886", "0.62303513", "0.62129", "0.6207007", "0.6193924", "0.61735964", "0.61698407", "0.61534274", "0.61534274", "0.6135418", "0.6131234", "0.61274546", "0.61212486", "0.6107168", "0.6092947", "0.6090087", "0.6079023", "0.60655814", "0.60625076", "0.60341734", "0.5999049", "0.59785753", "0.5972207", "0.5965745", "0.5962661", "0.59498936", "0.5936301", "0.5917345", "0.58950454", "0.5881759", "0.5851029", "0.58299", "0.5827615", "0.5820132", "0.5816195", "0.5812506", "0.5807668", "0.58068734", "0.5805465", "0.5795307", "0.57881194", "0.57721883", "0.5763156", "0.57482934", "0.5726828", "0.5719486", "0.5716712", "0.5705442", "0.5702547", "0.56993496", "0.56981224", "0.56908435", "0.568793", "0.5675119", "0.5658479", "0.56559175", "0.56330734", "0.56272066", "0.5625187", "0.5617982", "0.56177557", "0.5611864", "0.56084687", "0.56073517", "0.5606803", "0.5606389", "0.56010807", "0.5596013", "0.5588377", "0.55801845", "0.5575164", "0.5575164", "0.5575164", "0.5575164", "0.5575164", "0.5575164", "0.5575164", "0.5575164", "0.55698115", "0.55698115", "0.55698115", "0.5569809", "0.55654424", "0.55565476", "0.5553285" ]
0.7668172
0
This method adds a stave modifier to the stave. Note that the first two modifiers (BarLines) are automatically added upon construction.
addModifier(modifier, position) { if (position !== undefined) { modifier.setPosition(position); } modifier.setStave(this); this.formatted = false; this.modifiers.push(modifier); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setStave(stave) {\n const line = this.getLine();\n\n this.stave = stave;\n this.setY(stave.getYForNote(line));\n this.context = this.stave.context;\n return this;\n }", "formatBegModifiers(staves) {\n let maxX = 0;\n // align note start\n staves.forEach((stave) => {\n if (stave.getNoteStartX() > maxX) maxX = stave.getNoteStartX();\n });\n staves.forEach((stave) => {\n stave.setNoteStartX(maxX);\n });\n\n maxX = 0;\n // align REPEAT_BEGIN\n staves.forEach((stave) => {\n const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, Barline.CATEGORY);\n modifiers.forEach((modifier) => {\n if (modifier.getType() == Barline.type.REPEAT_BEGIN)\n if (modifier.getX() > maxX) maxX = modifier.getX();\n });\n });\n staves.forEach((stave) => {\n const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, Barline.CATEGORY);\n modifiers.forEach((modifier) => {\n if (modifier.getType() == Barline.type.REPEAT_BEGIN) modifier.setX(maxX);\n });\n });\n\n maxX = 0;\n // Align time signatures\n staves.forEach((stave) => {\n const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, TimeSignature.CATEGORY);\n modifiers.forEach((modifier) => {\n if (modifier.getX() > maxX) maxX = modifier.getX();\n });\n });\n staves.forEach((stave) => {\n const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, TimeSignature.CATEGORY);\n modifiers.forEach((modifier) => {\n modifier.setX(maxX);\n });\n });\n // Align key signatures\n // staves.forEach((stave) => {\n // const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, KeySignature.CATEGORY);\n // modifiers.forEach((modifier) => {\n // if (modifier.getX() > maxX) maxX = modifier.getX();\n // });\n // });\n // staves.forEach((stave) => {\n // const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, KeySignature.CATEGORY);\n // modifiers.forEach((modifier) => {\n // modifier.setX(maxX);\n // });\n // });\n }", "function Stave(x,y,length,gap){\n this.x = x;\n this.y = y;\n this.yTrebleFirstHelpLine = this.y - (gap/2)*5;\n this.yTrebleLastHelpLine = this.y + gap* 13;\n this.yBassFirstHelpLine = this.y + gap*15;\n this.yBassLastHelpLine = this.y + (gap/2)*38;\n this.trebleNotes = [\"D\",\"C\",\"H\",\"A\",\"G\",\"F\",\"E\",\"D\",\"C\",\"H\",\"A\",\"G\",\"F\",\"E\",\"D\",\"C\",\"H\",\"A\",\"G\"];\n this.bassNotes = [\"F\",\"E\",\"D\",\"C\",\"H\",\"A\",\"G\",\"F\",\"E\",\"D\",\"C\",\"H\",\"A\",\"G\",\"F\",\"E\",\"D\",\"C\",\"H\"];\n this.gap = gap;\n this.note = new Note((gap/2), (this.x +(length/2)));\n this.length = length;\n this.addedNotes = [];\n\n\n //rename to drawStaveLines\n this.drawStave = function(){\n //draw treble Lines\n c.strokeStyle = \"black\";\n drawLine(this.x,this.y,this.x+this.length);\n drawLine(this.x,this.y+this.gap,this.x+this.length);\n drawLine(this.x,this.y+(this.gap*2),this.x+this.length);\n drawLine(this.x,this.y+(this.gap*3),this.x+this.length);\n drawLine(this.x,this.y+(this.gap*4),this.x+this.length);\n\n //draw Bass Lines\n drawLine(this.x,this.y+(this.gap*10),this.x+this.length);\n drawLine(this.x,this.y+(this.gap*11),this.x+this.length);\n drawLine(this.x,this.y+(this.gap*12),this.x+this.length);\n drawLine(this.x,this.y+(this.gap*13),this.x+this.length);\n drawLine(this.x,this.y+(this.gap*14),this.x+this.length);\n\n }\n\n\n//problem we do have more than 10\n this.addNoteToStave = function(){\n\n noteToAdd = new Note((gap/2), (this.x +(length/2)));\n noteToAdd.setLinePosition(this.note.getLinePosition());\n noteToAdd.setLineNumber(this.note.getLineNumber());\n noteToAdd.setNoteValue(this.returnSelectedNote());\n this.addedNotes.push(noteToAdd);\n console.log(noteToAdd.getNoteValue());\n\n }\n\n //rename to calculateSelectedNote()\n this.returnSelectedNote = function(){\n var currentLine = this.note.getLineNumber();\n if(this.note.getLineNumber() < 15 ){\n return this.trebleNotes[currentLine + 5];\n } else{\n return this.bassNotes[currentLine - 15];\n }\n }\n //checks if notes have been added to the stav\n //can be deleted\n this.containsNotes = function(){\n if(addedNotes.length > 0){\n return true;\n } else{\n return false;\n }\n }\n\n\n\n //checks on which line (+- gap between the lines/4) the MousePointer is located.\n this.isOnLine = function(lineNumber){\n var linePosition = this.y + (lineNumber * (this.gap/2));\n if(mouse.y >= (linePosition) - (this.gap/4) && mouse.y <= (linePosition) + (this.gap/4)){\n return true;\n } return false;\n }\n\n\n\n //returns the closestLine relative to the current mouse position in the canvas\n\n this.closestLine = function(){\n var distanceToFirstLine = mouse.y - this.yTrebleFirstHelpLine;\n var numberOfFirstLine = Math.floor(distanceToFirstLine/(this.gap/2));\n var numberOfSecondLine = numberOfFirstLine + 1;\n if(distanceToFirstLine < 0){\n return -5;\n }\n else if(mouse.y > this.yBassLastHelpLine){\n return 38-5;\n }\n else if(mouse.y - numberOfFirstLine*(this.gap/2) > (numberOfSecondLine*(this.gap/2) - mouse.y)){\n return numberOfFirstLine -5;\n } else\n return numberOfSecondLine -5 ;\n\n }\n\n //returns the y position of a selected line\n //not working\n this.returnLinePosition = function(lineNumber){\n return this.y + (lineNumber * (this.gap/2));\n }\n\n //draws a Note on the line and\n this.drawOnLine = function(lineNumber){\n var yLinePosition = this.y + (lineNumber * (this.gap/2));\n //why do i check for -1\n if(linenumber = -1 || lineNumber){\n this.note.setLinePosition(yLinePosition);\n this.note.setLineNumber(lineNumber);\n this.note.drawNote();\n }\n }\n\n this.drawHelpLine = function(lineNumber){\n var yLinePosition = this.y + (lineNumber * (this.gap/2));\n //drawLine(x,y,x2)\n drawLine(this.x +(this.length/2)-30, yLinePosition, this.x +(this.length/2)+30);\n }\n\n this.drawAddedNotes = function(){\n for (const n of this.addedNotes){\n if(n.isInChord() === \"notAssigned\"){\n n.drawNote(\"grey\");\n }\n else if(n.isInChord()){\n n.drawNote(\"green\");\n } else{\n n.drawNote(\"red\");\n }\n\n }\n }\n\n this.checkAnswers = function(chord){\n\n for(const n of this.addedNotes){\n noteValue = n.getNoteValue();\n if(chord.includes(noteValue)){\n n.isCorrect();\n console.log(noteValue +\" is part of the Chord\");\n }else{\n n.isFalse();\n console.log(noteValue+\" is not part of the Chord\");\n }\n }\n }\n\n this.update = function(){\n this.drawOnLine((this.closestLine()));\n }\n}", "_drawStave() { // function to draw the stave, 5 lines of 12 bars - equaling 4 minutes per track\n var barLength = 80;\n this.numOfStaves = 0;\n this.canvasCtx.canvas.height = 360;\n for (var x = 0; x < 5; x++) {\n for (var i = 0; i < 12; i++) {\n this.canvasCtx.beginPath();\n this._drawLine(30 + (i * barLength), 10 + (this.numOfStaves * this.staveOffset), 110 + (i * barLength), 10 + (this.numOfStaves * this.staveOffset))\n this._drawLine(30 + (i * barLength), 20 + (this.numOfStaves * this.staveOffset), 110 + (i * barLength), 20 + (this.numOfStaves * this.staveOffset))\n this._drawLine(30 + (i * barLength), 30 + (this.numOfStaves * this.staveOffset), 110 + (i * barLength), 30 + (this.numOfStaves * this.staveOffset))\n this._drawLine(30 + (i * barLength), 40 + (this.numOfStaves * this.staveOffset), 110 + (i * barLength), 40 + (this.numOfStaves * this.staveOffset))\n this._drawLine(30 + (i * barLength), 50 + (this.numOfStaves * this.staveOffset), 110 + (i * barLength), 50 + (this.numOfStaves * this.staveOffset))\n this._drawLine(110 + (i * barLength), 10 + (this.numOfStaves * this.staveOffset), 110 + (i * barLength), 50 + (this.numOfStaves * this.staveOffset))\n this._drawLine(30 + (i * barLength), 10 + (this.numOfStaves * this.staveOffset), 30 + (i * barLength), 50 + (this.numOfStaves * this.staveOffset))\n }\n this.numberOfTracks++;\n this.numOfStaves++;\n }\n }", "function splitStaves(notes) {\n // Ensure the notes end with a BAR, as needed by the split algorithm.\n if (notes[notes.length - 1] != BAR) {\n notes.push(BAR);\n }\n const MAX_NOTES_PER_STAVE = 24;\n const staves = [];\n let measure = [];\n let stave = [];\n for (const note of notes) {\n if (note == BAR) {\n if (measure.length + stave.length > MAX_NOTES_PER_STAVE) {\n // This measure should start a new stave\n staves.push(stave);\n stave = measure;\n if (measure.length > MAX_NOTES_PER_STAVE) {\n // This measure should also end its stave\n staves.push(stave);\n stave = [];\n }\n } else {\n // This measure should continue current stave.\n if (stave.length > 0) {\n stave.push(new VF.BarNote());\n }\n stave = stave.concat(measure);\n }\n measure = [];\n } else {\n measure.push(note);\n }\n }\n // Include the final stave if it's not empty.\n if (stave.length > 0) {\n staves.push(stave);\n }\n return staves;\n}", "enableStencil() {\n this.stencil = true;\n this.dirtyId++;\n this.dirtyFormat++;\n return this;\n }", "get drawStarsLine() { return this._drawStarsLine }", "draw() {\n this.checkContext();\n this.setRendered();\n\n if (!this.formatted) this.format();\n\n const num_lines = this.options.num_lines;\n const width = this.width;\n const x = this.x;\n let y;\n\n // Render lines\n for (let line = 0; line < num_lines; line++) {\n y = this.getYForLine(line);\n\n this.applyStyle();\n if (this.options.line_config[line].visible) {\n this.context.beginPath();\n this.context.moveTo(x, y);\n this.context.lineTo(x + width, y);\n this.context.stroke();\n }\n this.restoreStyle();\n }\n\n // Draw the modifiers (bar lines, coda, segno, repeat brackets, etc.)\n for (let i = 0; i < this.modifiers.length; i++) {\n // Only draw modifier if it has a draw function\n if (typeof this.modifiers[i].draw === 'function') {\n this.modifiers[i].applyStyle(this.context);\n this.modifiers[i].draw(this, this.getModifierXShift(i));\n this.modifiers[i].restoreStyle(this.context);\n }\n }\n\n // Render measure numbers\n if (this.measure > 0) {\n this.context.save();\n this.context.setFont(this.font.family, this.font.size, this.font.weight);\n const text_width = this.context.measureText('' + this.measure).width;\n y = this.getYForTopText(0) + 3;\n this.context.fillText('' + this.measure, this.x - text_width / 2, y);\n this.context.restore();\n }\n\n return this;\n }", "addVertLine(){\n\t\t// start in center of the x-range\n\t\tlet pos = Math.floor(this.getCenter().x * 10) / 10.;\t// round to nearest .1\n\t\tlet to_shape = {\n\t\t\tid: this.cur_annotation_id,\n\t\t\tname: 'Spike ('+pos+')',\n\t\t\ttype: 'rect',\n\t\t\txref: 'x',\n\t\t\tyref: 'paper',\n\t\t\tx0: pos,\n\t\t\tx1: pos,\n\t\t\ty0: 0,\n\t\t\ty1: 1,\t// go from bottom to top of plot part of window\n\t\t\tline: {\n\t\t\t\tcolor: '#4227ff',\n\t\t\t\topacity: 1.,\n\t\t\t\twidth: 1,\n\t\t\t},\n\t\t}\n\t\tthis.cur_annotation_id ++;\n\t\tPlotly.relayout(this.getElement(), {'shapes[0]': to_shape});\n\t\tthis.refreshAnnotationMarkup();\n\t\tthis.annotations_list_target.last().click();\n\t}", "applyStemExtensions() {\n const {\n notes, slope, y_shift, stem_direction, beam_count,\n render_options: {\n show_stemlets,\n stemlet_extension,\n beam_width,\n },\n } = this;\n\n const firstNote = notes[0];\n const firstStemTipY = this.getBeamYToDraw();\n const firstStemX = firstNote.getStemX();\n\n for (let i = 0; i < notes.length; ++i) {\n const note = notes[i];\n const stemX = note.getStemX();\n const { topY: stemTipY } = note.getStemExtents();\n const beamedStemTipY = this.getSlopeY(stemX, firstStemX, firstStemTipY, slope) + y_shift;\n const preBeamExtension = note.getStem().getExtension();\n const beamExtension = stem_direction === Stem.UP\n ? stemTipY - beamedStemTipY\n : beamedStemTipY - stemTipY;\n\n note.stem.setExtension(preBeamExtension + beamExtension);\n note.stem.renderHeightAdjustment = -Stem.WIDTH / 2;\n\n if (note.isRest() && show_stemlets) {\n const beamWidth = beam_width;\n const totalBeamWidth = ((beam_count - 1) * beamWidth * 1.5) + beamWidth;\n note.stem\n .setVisibility(true)\n .setStemlet(true, totalBeamWidth + stemlet_extension);\n }\n }\n }", "function wrapFxStrokeSetter() {\n this.elem.attr('stroke', color(this.start).tweenTo(color(this.end), this.pos), void 0, true);\n }", "function addStroke(shape,strokeWidthValue){\n var stroke = shape.content.addProperty(\"ADBE Vector Graphic - Stroke\");\n var strokeWidth = stroke.property(\"ADBE Vector Stroke Width\");\n strokeWidth.setValue(strokeWidthValue);}", "drawStems() {\n this.notes.forEach(note => {\n if (note.getStem()) {\n this.context.openGroup('stem', note.getAttribute('id') + '-stem');\n note.getStem().setContext(this.context).draw();\n this.context.closeGroup();\n }\n }, this);\n }", "function makeSwordMark (swordLength, swordWidth, swordThickness) {\n\tvar frame = new THREE.Object3D();\n\n\t//the hilt is to the right of the tip\n\tvar sword1 = new THREE.Object3D();\n\tvar sword = new Sword(swordLength, swordWidth, swordThickness, 0xFFD700, 1);\n\tsword.frame.position.set(0, sword.bladeLength, 0);\n\tsword.frame.rotateX(Math.PI);\n\tsword1.add(sword.frame);\n\n\t//the hilt is to the left of the tip\n\tvar sword2 = sword1.clone();\n\n\tsword1.rotateZ(-Math.PI/6);\n\tsword2.rotateZ(Math.PI/6);\n\n\tsword1.position.set(-0.25*swordLength, 0, swordThickness);\n\tframe.add(sword1);\n\n\tsword2.position.set(0.25*swordLength, 0, 0);\n\tframe.add(sword2);\n\n\treturn frame;\n}", "function save() {\n\tlet lastStrokeNumber = 0;\n\tlet actualStrokeNumber = 0;\n\treturn `\n\t${drawing.size.x}, ${drawing.size.y} |\n\t${drawing.history.map(function(h) {\n\t\tif(h.strokeNumber !== lastStrokeNumber){\n\t\t\tactualStrokeNumber++;\n\t\t\tlastStrokeNumber = h.strokeNumber;\n\t\t}\n\t\treturn `\n\t\t${h.coords.x}, ${h.coords.y},\n\t\t${h.color}, ${actualStrokeNumber}\n\t\t`\n\t}).join('|')}\n\t`.replace(/\\s+/g, '');\n}", "function specialBar(bar, count) {\n if (count === 1) {\n bar.setAttribute(\"style\", \"width: 33%\");\n } else if (count === 2) {\n bar.setAttribute(\"style\", \"width: 66%\");\n } else if (count === 3) {\n bar.setAttribute(\"style\", \"width: 100%\");\n bar.className += \" glow\";\n } else if (count === 0) {\n bar.setAttribute(\"style\", \"width: 0%\");\n bar.classList.remove(\"glow\");\n }\n}", "function addShovel() { ////////////////////////////////// //////////////////////////////////添加植物\n\t\t\tvar shavel_ = new lib.shovel(); // constructs a new plant\n\t\t\toverlayContainer.addChild(shavel_); // adds the plant\n\t\t\tshavel_.buttonMode = true; // makes the mouse change shape when over the plant//////////////////////////////////////改变鼠标样式\n\t\t\tshavel_.x = 224;\n\t\t\tshavel_.y = 39;\n\t\t\tshavel_.addEventListener(\"click\", onShovelClicked); // listener to be triggered once the plant is clicked\n\t\t}", "function drawStamina() {\n fill(staminaColor, 255, 100);\n noStroke();\n textAlign(LEFT);\n textSize(22);\n text(\"<--STAMINA\", width / 10, height - 20);\n rect(0, height, 50, -playerStamina);\n //if player health is getting low, turn health bar red\n if (playerStamina < playerMaxStamina / 3) {\n staminaColor = 0;\n } else {\n staminaColor = 120;\n }\n}", "set striped(value) {\n this._striped = value;\n this.bars.forEach((b) => {\n b.striped = value;\n });\n }", "function addMarksToLine(tr, state, node, pos, boldSentence) {\n const markType = state.schema.marks[MARK_STRONG];\n let textContent = getNodeText(node);\n const endPos = textContent.length;\n let content = '';\n let counter = 0;\n if (boldSentence) {\n content = textContent.split('.');\n } else {\n content = textContent.split(' ');\n }\n if ('' !== content[0]) {\n textContent = content[0];\n } else {\n if (content.length > 1) {\n for (let index = 0; index < content.length; index++) {\n if ('' === content[index]) {\n counter++;\n } else {\n textContent = content[index];\n index = content.length;\n }\n }\n }\n }\n tr = tr.addMark(\n pos,\n pos + textContent.length + 1 + counter,\n markType.create(null)\n );\n if (content.length > 1) {\n tr = tr.removeMark(\n pos + textContent.length + 1 + counter,\n pos + endPos + 1,\n markType\n );\n }\n return tr;\n}", "function drawSeperationLine(weights){\n var canvas = document.getElementById(\"2d-plane\");\n var context = canvas.getContext(\"2d\");\n context.strokeStyle = '#ADFF2F';\n context.beginPath();\n context.lineWidth = 4;\n context.moveTo(0, -(weights.bias_weight/weights.weight_2));\n context.lineTo(400, -(weights.bias_weight/weights.weight_2)-(weights.weight_1/weights.weight_2)*400);\n context.stroke(); \n}", "flower(x,w,h,r,g,b){\n stroke(0,168,0)\n strokeWeight(3)\n //stem\n let vol = amp.getLevel()\n \n line(x, height, x, 1090 - vol * g)\n //leaves\n fill(0, 168, 0)\n stroke(100, 168, 0)\n ellipse(x - 8, height, 10, 120 - vol * 200)\n ellipse(x + 8, height, 8, 100)\n //flower bulb\n noStroke()\n strokeWeight(1)\n fill(r, g, b)\n arc(x, 1090 - vol * g, w, h,-QUARTER_PI,HALF_PI * 2)\n ellipse(x, 1090 - vol * g, w-15, h-30)\n }", "function lineStyle(feature) {\n return {\n weight: 2,\n color: \"orange\",\n opacity: 0.5\n };\n }", "function addStrokes(point, delta) {\n var step = delta.rotate(90);\n var strokePoints = strokeEnds;\n point -= step / 2;\n step /= strokePoints - 1;\n for(var i = 0; i < strokePoints; i++) {\n var strokePoint = point + step * i;\n var offset = delta * (Math.random() * 0.3 + 0.1);\n if(i % 2) {\n offset *= -1;\n }\n strokePoint += offset;\n path.insert(0, strokePoint);\n }\n}", "function addSBP(opts,sb) \n{\n sb = sb || statusBar;\n var ele = document.createElement(\"statusbarpanel\");\n setAttributes( ele, opts);\n sb.appendChild( ele );\n}", "set x(x){ this.spine.x = x; }", "function addBarLines(event){\n if (event.target && event.keyCode == 84){\n areLines = !areLines;\n if (areLines){\n for (let i = 0; i < arr.length; i++){\n data.children[i].style.setProperty('transition-duration', '0s');\n data.children[i].style.boxSizing = 'border-box';\n data.children[i].style.borderStyle = 'solid';\n data.children[i].style.borderWidth = '0px 1px 0px 1px';\n data.children[i].style.borderColor = '#B0B0B0';\n }\n }else{\n for (let i = 0; i < arr.length; i++){\n data.children[i].style.setProperty('transition-duration', '0s');\n data.children[i].style.setProperty('box-sizing', 'initial');\n data.children[i].style.setProperty('border-style', 'initial');\n data.children[i].style.setProperty('border-width', 'initial');\n data.children[i].style.setProperty('border-color', 'initial');\n }\n }\n }else{\n if (areLines){\n event.style.boxSizing = 'border-box';\n event.style.borderStyle = 'solid';\n event.style.borderWidth = '0px 1px 0px 1px';\n event.style.borderColor = '#B0B0B0';\n }\n }\n\n}", "setDashed(newStyle) {\n dashed = newStyle // solid or dashed\n }", "function D3PedalMap_brake_svelte_add_css() {\n\tvar style = (0,internal/* element */.bG)(\"style\");\n\tstyle.id = \"svelte-xp8anw-style\";\n\tstyle.textContent = \".svelte-xp8anw .line{stroke-width:2;fill:none}.svelte-xp8anw .axis path{stroke:black}.svelte-xp8anw .text{font-size:12px}.svelte-xp8anw .title-text{font-size:12px}.svelte-xp8anw .grid line{stroke:lightgrey;stroke-opacity:0.7;shape-rendering:crispEdges}\";\n\t(0,internal/* append */.R3)(document.head, style);\n}", "set lineSpacing(value) {}", "applyStyle(context) {\n // Apply style for the octave bracket\n context.setFont(this.font.family, this.font.size, this.font.weight);\n context.setStrokeStyle(this.render_options.color);\n context.setFillStyle(this.render_options.color);\n context.setLineWidth(this.render_options.line_width);\n\n return this;\n }", "AddClip() {}", "toggleSubscript() {\n if (!this.owner.isReadOnlyMode) {\n let value = this.selection.characterFormat.baselineAlignment === 'Subscript' ? 'Normal' : 'Subscript';\n this.selection.characterFormat.baselineAlignment = value;\n }\n }", "draw() {\n s.globalCompositeOperation = \"lighter\";\n s.lineWidth = 2;\n s.strokeStyle = `hsla(${this.hue}, 100%, 50%, ${this.a})`;\n s.strokeRect(\n this.x - this.size / 2,\n this.y - this.size / 2,\n this.size,\n this.size\n );\n this.update();\n }", "function drawBoldDoubleLine(ctx, type, topX, topY, botY) {\n if (type !== StaveConnector.type.BOLD_DOUBLE_LEFT && type !== StaveConnector.type.BOLD_DOUBLE_RIGHT) {\n throw new _vex__WEBPACK_IMPORTED_MODULE_0__[\"Vex\"].RERR('InvalidConnector', 'A REPEAT_BEGIN or REPEAT_END type must be provided.');\n }\n\n var x_shift = 3;\n var variableWidth = 3.5; // Width for avoiding anti-aliasing width issues\n\n var thickLineOffset = 2; // For aesthetics\n\n if (type === StaveConnector.type.BOLD_DOUBLE_RIGHT) {\n x_shift = -5; // Flips the side of the thin line\n\n variableWidth = 3;\n } // Thin line\n\n\n ctx.fillRect(topX + x_shift, topY, 1, botY - topY); // Thick line\n\n ctx.fillRect(topX - thickLineOffset, topY, variableWidth, botY - topY);\n}", "function addGlobalSavingBonusEffect(modifiers, name) {\n const type = \"saving-throws\";\n const key = \"data.bonuses.abilities.save\";\n let changes = [];\n const regularBonuses = modifiers.filter((mod) => !mod.bonusTypes?.includes(2));\n const customBonuses = modifiers.filter((mod) => mod.bonusTypes?.includes(2));\n\n if (customBonuses.length > 0) {\n let customEffects = addCustomBonusEffect(customBonuses, name, type, key);\n changes = changes.concat(customEffects);\n }\n\n const regularModifiers = utils.filterModifiers(regularBonuses, \"bonus\", type);\n\n if (regularModifiers.length > 0) {\n logger.debug(`Generating ${type} bonus for ${name}`);\n let bonuses = \"\";\n regularModifiers.forEach((modifier) => {\n let bonusParse = extractModifierValue(modifier);\n if (bonuses !== \"\") bonuses += \" + \";\n bonuses += bonusParse;\n });\n if (bonuses === \"\") bonuses = 0;\n changes.push(generateAddChange(`+ ${bonuses}`, 20, key));\n logger.debug(`Changes for ${type} bonus for ${name}`, changes);\n }\n\n return changes;\n}", "function addStyles() {\n var style = document.createElement('style');\n\n style.type = 'text/css';\n\n style.innerHTML = \".line { fill: none; stroke: steelblue; stroke-width: 1.5px; }\";\n\n document.getElementsByTagName('head')[0].appendChild(style);\n\n }", "function Stark(){}", "static mark(spec) {\n return new MarkDecoration(spec);\n }", "addStrokeGuide(){\n var id = guid();\n var that = this;\n \n var firstPoint = JSON.parse(JSON.stringify(this.tempArrayStroke[0]))\n var arrayPoints = JSON.parse(JSON.stringify(this.tempArrayStroke));\n arrayPoints.forEach((d)=>{\n d[0] = d[0] - firstPoint[0];\n d[1] = d[1] - firstPoint[1]\n })\n\n\n arrayPoints = simplify(arrayPoints, 2)\n\n // var data = {\n // 'points': arrayPoints, \n // 'id': id,\n // 'paddingBetweenLines': 50, \n // 'width':100,\n // 'height':100,\n // 'placeHolder': [\n // {'id':'background', 'data': {'method': 'repeat'}, 'lines':[]}, \n // {'id':'topbackground', 'data': {'method': 'repeat'}, 'lines':[]}, \n // {'id':'leftbackground', 'data': {'method': 'repeat'}, 'lines':[]}, \n // {'id':'rightbackground', 'data': {'method': 'repeat'}, 'lines':[]}, \n // {'id':'bottombackground', 'data': {'method': 'repeat'}, 'lines':[]}, \n\n // {'id':'topLeftCorner', 'data': {}, 'lines':[]}, \n // {'id':'topRightCorner', 'data': {}, 'lines':[]}, \n // {'id':'bottomLeftCorner', 'data': {}, 'lines':[]}, \n // {'id':'bottomRightCorner', 'data': {}, 'lines':[]}, \n \n // {'id':'left', 'data': {}, 'lines':[]}, \n // {'id':'right', 'data': {}, 'lines':[]}, \n // {'id':'middle', 'data': {}, 'lines':[]}],\n // 'position': [firstPoint[0],firstPoint[1]],\n // 'textPosition': {'where': 'right', 'position': [25,20]},\n \n // }\n\n var data = {\n 'points': arrayPoints, \n 'id': id,\n 'paddingBetweenLines': 50, \n 'width':200,\n 'height':150,\n 'placeHolder': [\n {'id':'outerBackground', 'position':[0,0], 'lines':[]},\n {'id':'backgroundLine', 'position':[0,0], 'lines':[]},\n {'id':'backgroundText', 'position':[0,0], 'lines':[]}\n ],\n 'position': [firstPoint[0],firstPoint[1]]\n \n }\n\n this.props.addStickyLines(data);\n\n // console.log({'idLines':that.objectIn, 'class':['item-'+id]})\n //Add class to element\n \n // this.props.addLinesClass({'idLines':that.objectIn, 'class':['item-'+id]})\n // for (var i in this.objectIn){\n // d3.select('#item-'+that.objectIn[i]).classed('sticky-'+id, true);\n // }\n }", "addMark(editor, key, value) {\n editor.addMark(key, value);\n }", "addMark(editor, key, value) {\n editor.addMark(key, value);\n }", "addSatelite(satelite) {\n satelite.astroGroup.add(satelite.astro)\n satelite.astroGroup.position.set(this.x, this.y, this.z)\n satelite.astro.position.set(satelite.x, satelite.y, satelite.z)\n\n this.astroGroup.add(satelite.astroGroup)\n this.satelites.push(satelite)\n satelite.astroGroup.updateMatrixWorld();\n }", "function penCap(cap) {\n $._lineCap(cap);\n}", "addNewStage() {\n let currentStages = this.props.stages,\n newStage = [{\n backgroundColor: \"#FFC107\",\n name: \"Applied\",\n textColor: \"black\"\n }];\n\n this.props.onStagesChange(currentStages.concat(newStage));\n }", "function SIDE$static_(){ToolbarSkin.SIDE=( new ToolbarSkin(\"side\"));}", "function addToStrike(line, strikeHolder){\n sortCallsAndPuts(line)\n }", "function addTwo(dash){\n ctx.beginPath();\n if (dash){\n ctx.setLineDash([5]);\n }\n single();\n ctx.lineTo(0, height-(rows*step)-(step/2));\n ctx.stroke();\n ctx.setLineDash([]);\n }", "setColorByBars()\n{\n this.color_bars_flag = true;\n}", "function volumeChangeBar() {\n let voloffsets = volumefg.getBoundingClientRect();\n let volwidth = voloffsets.right-voloffsets.left;\n volumefg.style.clip = 'rect(0, '+((video.volume*volwidth)/16)+'rem, '+(volwidth/16)+'rem, 0)';\n }", "function addStyles() {\n var style = document.createElement('style');\n\n style.type = 'text/css';\n\n // Insert custom styles here\n style.innerHTML = \".line { fill: none; stroke: steelblue; stroke-width: 1.5px; }\";\n\n document.getElementsByTagName('head')[0].appendChild(style);\n\n }", "setStrokeStyle(strokeStyle) {\n this.strokeStyle = strokeStyle\n }", "function updateStyles() {\n\tconsole.log('updateStyles');\n\tvar zoom = rkGlobal.leafletMap.getZoom();\n\tfor(const key of Object.keys(rkGlobal.segments)) {\n\t\tconsole.log(key);\n\t\tvar properties = JSON.parse(key);\n\t\tvar showFull = zoom >= rkGlobal.priorityFullVisibleFromZoom[properties.priority];\n\t\tvar showMinimal = zoom < rkGlobal.priorityFullVisibleFromZoom[properties.priority] && zoom >= rkGlobal.priorityReducedVisibilityFromZoom[properties.priority];\n\n\t\tvar lineStyle;\n\t\tif(showFull) {\n\t\t\tlineStyle = getLineStyle(zoom, properties);\n\t\t} else if(showMinimal) {\n\t\t\tlineStyle = getLineStyleMinimal(properties);\n\t\t}\n\n\t\tvar lines = rkGlobal.segments[key].lines;\n\t\tif(showFull || showMinimal) {\n\t\t\tlines.setStyle(lineStyle);\n\t\t\trkGlobal.leafletMap.addLayer(lines);\n\t\t} else {\n\t\t\trkGlobal.leafletMap.removeLayer(lines);\n\t\t}\n\n\t\t// steep lines are drawn twice, once regular,\n\t\t// a second time as bristles (that's what this copy is for)\n\t\tvar steepLines = rkGlobal.segments[key].steepLines;\n\t\tif(steepLines !== undefined) {\n\t\t\tif(showFull || showMinimal) {\n\t\t\t\tvar steepLineStyle;\n\t\t\t\tif(showFull) {\n\t\t\t\t\tsteepLineStyle = getSteepLineStyle(zoom, properties);\n\t\t\t\t} else {\n\t\t\t\t\tsteepLineStyle = getSteepLineStyleMinimal(properties);\n\t\t\t\t}\n\t\t\t\tsteepLines.setStyle(steepLineStyle);\n\t\t\t\trkGlobal.leafletMap.addLayer(steepLines);\n\t\t\t} else {\n\t\t\t\trkGlobal.leafletMap.removeLayer(steepLines);\n\t\t\t}\n\t\t}\n\n\t\tvar decorators = rkGlobal.segments[key].decorators;\n\t\tif((showFull || showMinimal) && zoom >= rkGlobal.onewayIconThreshold && properties.oneway === 'yes') {\n\t\t\tdecorators.setPatterns(getOnewayArrowPatterns(zoom, properties, lineStyle.weight));\n\t\t\trkGlobal.leafletMap.addLayer(decorators);\n\t\t} else {\n\t\t\trkGlobal.leafletMap.removeLayer(decorators);\n\t\t}\n\t}\n\n\tif(zoom >= rkGlobal.iconZoomThresholds[1]) {\n\t\trkGlobal.leafletMap.removeLayer(rkGlobal.markerLayerLowZoom);\n\t\trkGlobal.leafletMap.addLayer(rkGlobal.markerLayerHighZoom);\n\t} else if(zoom >= rkGlobal.iconZoomThresholds[0]) {\n\t\trkGlobal.leafletMap.removeLayer(rkGlobal.markerLayerHighZoom);\n\t\trkGlobal.leafletMap.addLayer(rkGlobal.markerLayerLowZoom);\n\t} else {\n\t\trkGlobal.leafletMap.removeLayer(rkGlobal.markerLayerHighZoom);\n\t\trkGlobal.leafletMap.removeLayer(rkGlobal.markerLayerLowZoom);\n\t}\n}", "biggerLine() {\n this.ctx.lineWidth++\n }", "function addOnePlus(dash){\n ctx.beginPath();\n if ( dash ) ctx.setLineDash([5]);\n single();\n ctx.lineTo((width/2)+(width/10), height-(rows*step)+step*0.75);\n ctx.stroke();\n if ( dash ) ctx.setLineDash([]);\n }", "function addBarsTwoSided(select, data, x, addClass) {\r\n\r\n // select correct section\r\n var svgChangeTwoSidedData = svgTwoSided.selectAll(select)\r\n .data(data);\r\n \r\n // initialize rectangles\r\n svgChangeTwoSidedData.enter().append(\"rect\");\r\n\r\n // add bars\r\n svgChangeTwoSidedData.transition()\r\n .attr(\"x\", x)\r\n .attr(\"y\", yPosition)\r\n .attr(\"width\", xT)\r\n .attr(\"height\", yT.rangeBand())\r\n .attr(\"class\", addClass);\r\n \r\n // add tooltip to bars of two sided barchart\r\n addTooltipToBars(\"rect.left\");\r\n addTooltipToBars(\"rect.right\");\r\n}", "formatSpan() {\n let span = document.createElement('span')\n span.id = `span${this.id}`\n\n let p = document.createElement('p')\n p.id = `name${this.id}`\n p.innerText = this.name\n\n span.appendChild(p)\n dogBar().appendChild(span)\n }", "averaging(val) {\n this._averaging = val;\n return this;\n }", "initBeforeStroke(param) {\n\t\tsuper.initBeforeStroke(param);\n\t\t//LOGGING&&console.log(this.brush);\n\t\t// pre-render the brushtip data\n\t\tthis.lastCircleFromPrevStroke=null;\n\t}", "function shiftTrackOctave() {\n\tcancelPlayback();\n\ttracks[selectedTrack].octaveShift = parseInt(document.getElementById('octaveShift').value, 10);\n\ttracks[selectedTrack].semitoneShift = parseInt(document.getElementById('semitones').value, 10);\n\tlevel.noteGroups[selectedTrack].ofsY = tracks[selectedTrack].octaveShift * 12 + tracks[selectedTrack].semitoneShift;\n\tcalculateNoteRange();\n\tadjustZoom();\n\tsoftRefresh();\n\tupdateInstrumentContainer();\n}", "toggleSuperscript() {\n if (!this.owner.isReadOnlyMode) {\n let value = this.selection.characterFormat.baselineAlignment === 'Superscript' ? 'Normal' : 'Superscript';\n this.selection.characterFormat.baselineAlignment = value;\n }\n }", "static line(spec) {\n return new LineDecoration(spec);\n }", "function addBold(transcriptLineLiElement) {\n transcriptLineLiElement.classList.add(BOLD_FONT_WEIGHT);\n transcriptLineLiElement.classList.remove(DEFAULT_FONT_WEIGHT);\n}", "function drawMusicLine(beatType) {\n\n // default values\n var spaceNo = -30;\n var lengthOfOneMeasure = 250;\n\n // get the array of selected rhythm items\n var rhyFragArray = rhythmFragArray(beatType); \n \n //get stave information\n var keyAndTime = keyAndTimeSignature(); \n \n // set clef\n var clef = \"percussion\";\n\n if (beatType == 1) {var beatValue = 2;}\n else if (beatType == 2) {var beatValue = 2;}\n else {var beatValue = 4;}\n\n //create time signature \n if (beatType == 2) {\n var time = `${keyAndTime[0]*3}/8`;\n } else {\n var time = `${keyAndTime[0]}/${beatValue}`;\n }\n \n\n var barLocation = keyAndTime[0];\n\n // Get the number of Measures\n var numOfMeasuresTotal = keyAndTime[1];\n \n // determine the number of rhythm fragments to place\n var numOfMeasures = numOfMeasuresTotal - 1; \n\n var numberOfRhythmFragments = keyAndTime[0] * numOfMeasures; \n\n if (numOfMeasuresTotal < 5) {\n var lengthOfOneMeasure = 350;\n var rhythmLineLength = lengthOfOneMeasure * numOfMeasures; \n //var lengthOfOneMeasure = 350;\n } else{\n var lengthOfOneMeasure = 263;\n var rhythmLineLength = lengthOfOneMeasure * 4;\n //\n } \n\n\n // determine the number of elements in the taskArray array\n var numberOfElements = rhyFragArray.length;\n \n var musicLine = `options space=${spaceNo}\\n`;\n musicLine = `${musicLine}tabstave notation=true tablature=false clef=${clef} time=${time}\\nnotes`;\n\n //create empty array\n var midiDrumString = [];\n \n // create the output\n for (let i = 0; i < numberOfRhythmFragments; i++) {\n\n // get the random number\n var solo = Math.floor(Math.random() * numberOfElements);\n\n var rhythmFragOutput = rhyFragArray[solo];\n\n // get the number out of the taskArray\n musicLine = `${musicLine} ${rhythmFragOutput[0]}`;\n\n var midiDrumStringAdd = rhythmFragOutput[1];\n Array.prototype.push.apply(midiDrumString, midiDrumStringAdd); \n\n var barLine = (i + 1) % barLocation;\n if (barLine == 0) {\n musicLine = `${musicLine}|`;\n }\n\n if (i == (keyAndTime[0]*4)-1 || i == (keyAndTime[0]*8)-1 || i == (keyAndTime[0]*12)-1) {\n musicLine = `${musicLine}\\noptions space=20\\n`;\n musicLine = `${musicLine}tabstave notation=true tablature=false clef=${clef} time=${time}\\nnotes`;\n } \n }\n\n //ending note, based on the beats per measure\n if (beatType == 1) {\n if (keyAndTime[0] == 4) {\n musicLine = `${musicLine} ${rhythmFragments.rhythmHalf[9].fragment}|`\n } else if (keyAndTime[0] == 3){\n musicLine = `${musicLine} ${rhythmFragments.rhythmHalf[10].fragment}|`\n }else{\n musicLine = `${musicLine} ${rhythmFragments.rhythmHalf[11].fragment}|`\n }\n } else if (beatType == 2) {\n if (keyAndTime[0] == 4) {\n musicLine = `${musicLine} ${rhythmFragments.rhythmComplex[26].fragment}|`\n } else if (keyAndTime[0] == 3){\n musicLine = `${musicLine} ${rhythmFragments.rhythmComplex[27].fragment}|`\n }else{\n musicLine = `${musicLine} ${rhythmFragments.rhythmComplex[28].fragment}|`\n }\n } else { \n if (keyAndTime[0] == 4) {\n musicLine = `${musicLine} ${rhythmFragments.rhythmQuarter[9].fragment}|`\n } else if (keyAndTime[0] == 3){\n musicLine = `${musicLine} ${rhythmFragments.rhythmQuarter[10].fragment}|`\n }else{\n musicLine = `${musicLine} ${rhythmFragments.rhythmQuarter[11].fragment}|`\n }\n }\n \n\n var leadInBeats = [];\n //add the preceeding and trailing beats\n for (let i = 0; i < keyAndTime[0]; i++) { \n var leadInBeatsAdd = rhythmFragments.soloBaseBeats;\n Array.prototype.push.apply(leadInBeats,leadInBeatsAdd);\n }\n\n var midiDrumStringPlusLeadIn = leadInBeats.concat(midiDrumString);\n\n //add the ending snare beats\n var midiDrumStringAddEnding = midiDrumStringPlusLeadIn.concat(rhythmFragments.endBeats);\n\n var endingBeats = [];\n //add the rest of the ending base beats\n for (let i = 0; i < keyAndTime[0]-1; i++) { \n var endingBeatsAdd = rhythmFragments.soloBaseBeats;\n Array.prototype.push.apply(endingBeats,endingBeatsAdd);\n }\n\n //final midiRhythmArray\n var midiRhythmOutput = midiDrumStringAddEnding.concat(endingBeats);\n\n var returnValues = [musicLine , rhythmLineLength, midiRhythmOutput, numberOfRhythmFragments, barLocation];\n console.log(\"the return Values\", returnValues);\n return returnValues;\n}", "consumeTreeSitterSyntaxBeta(ts) {\n ts.onMarkersCreated(({editor, markers}) => {\n if (!this.isActive()) return;\n\n const minimap = this.minimapPackage.minimapForEditor(editor);\n if (!minimap) return;\n\n const decorations = markers.map(marker => minimap.decorateMarker(\n marker,\n {\n type: \"highlight\",\n class: \"tree-sitter-syntax\"\n })\n );\n\n this.decorations.push(...decorations);\n });\n }", "function drawWaves(data){\n var x=10;\n var y=160;\n var half=canvas.height/2;\n var length=5+(canvas.width/data.length);\n \n //wave visual\n ctx.save();\n \n ctx.shadowColor= \"white\";\n ctx.shadowBlur=10;\n \n //purple line\n ctx.strokeStyle= \"purple\";\n ctx.lineWidth = 5;\n ctx.beginPath();\n for(var j=0; j<data.length; j++){\n ctx.lineTo(j*length, half+data[j]-y);\n }\n ctx.stroke();\n //black line\n ctx.strokeStyle= \"black\";\n ctx.lineWidth = 3;\n ctx.stroke();\n \n \n //purple line reverse\n ctx.strokeStyle= \"purple\";\n ctx.lineWidth = 5;\n \n ctx.beginPath();\n for(var j=0; j<data.length; j++){\n ctx.lineTo(canvas.width-(j*length), half+data[j]-y);\n }\n ctx.stroke();\n //black line\n ctx.strokeStyle= \"black\";\n ctx.lineWidth = 3;\n ctx.stroke();\n ctx.restore();\n }", "function draw(){\n for (var i=0; i<creepWords.length ; i++){\n creepWords[i].creep();\n creepWords[i].display();\n var volume = analyzer.getLevel();\n volume*='.8';\n strokeWeight(volume);\n }\n}", "function LineBasicPass() {\n _super.call(this);\n }", "function Sine() {\r\n}", "function line(x1, y1, x2, y2, lW, sS) {\n window.ctx.save();\n window.ctx.lineWidth = lW + 2;\n window.ctx.beginPath();\n window.ctx.moveTo(x1, y1);\n window.ctx.lineTo(x2, y2);\n window.ctx.strokeStyle = \"rgba(0, 0, 0, 0.25)\";\n window.ctx.stroke();\n window.ctx.lineWidth = lW;\n window.ctx.strokeStyle = sS;\n window.ctx.stroke();\n window.ctx.restore();\n}", "function writeStage()\r\n{\r\n\tvar tml = document.getTimeline();\r\n writeString (\"<Component>\\n\");\r\n for(var i=0; i< tml.layers.length ; i++)\r\n {\r\n\t\twriteLayer(tml.layers[i]);\r\n }\r\n writeString (\"</Component>\\n\");\r\n}", "addNewScene(scene) {\n this.scenes.push(scene)\n this.saveToFile()\n }", "add_stdev_series(chart, vol) {\n vol /= 100;\n\n const stdev_up_series = chart.ref.addLineSeries(this.line_settings);\n const stdev_down_series = chart.ref.addLineSeries(this.line_settings);\n const stdev_up_data = [];\n const stdev_down_data = [];\n const start_date = Date.parse(chart.start_date);\n const start_price = chart.start_price;\n\n for (var i = 1; i < this.look_ahead; i++) {\n const next = new Date(start_date);\n next.setDate(next.getDate() + i);\n const next_str = next.toISOString();\n const next_price_up = start_price * Math.exp(vol * Math.sqrt(i / 365));\n const next_price_down = start_price * Math.exp(-vol * Math.sqrt(i / 365));\n stdev_up_data.push({ time: next_str, value: next_price_up });\n stdev_down_data.push({ time: next_str, value: next_price_down });\n }\n\n stdev_up_series.setData(stdev_up_data);\n stdev_down_series.setData(stdev_down_data);\n chart.stdev_up_series = stdev_up_series;\n chart.stdev_down_series = stdev_down_series;\n }", "function addMarkedSpan(line, span) {\n\t\t line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n\t\t span.marker.attachLine(line);\n\t\t }", "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 animateShavings()\n\t{\n\t\tvar topDistance = window.scrollY; //Detecting and storing the distance the user has scrolled from the top of the page\n\t\t//console.log(topDistance);\n\n\t\t//Modifying the margin-top property of the chisel and shaving in congruence with the value of topDistance\n\t\tshave.style.marginTop = topDistance+\"px\";\n\t\tchisel.style.marginTop = \"-\"+topDistance+\"px\";\n\t}", "function shiftLine(gl, a_Position, lineShifter) {\n var shiftedArray = [];\n gl.clear(gl.COLOR_BUFFER_BIT);\n lineShifter.addEventListener('click', function() {\n for (var i = 0; i < g_points.length; i++) {\n shiftedArray[i] = g_points[i][0] + .3;\n g_points[i][0] = shiftedArray[i];\n gl.vertexAttrib3f(a_Position, g_points[i][0], g_points[i][1], 0.0);\n gl.drawArrays(gl.POINTS, 0, g_points.length);\n }\n gl.drawArrays(gl.LINE_STRIP, 0, n);\n });\n}", "function InventoryItemFeetSpreaderVibratingDildoBarSetIntensity(Modifier) {\n\tvar C = (Player.FocusGroup != null) ? Player : CurrentCharacter;\n\tDialogFocusItem.Property.Intensity = DialogFocusItem.Property.Intensity + Modifier;\n\tif (DialogFocusItem.Property.Intensity == -1) DialogFocusItem.Property.Effect = [\"Egged\"];\n\tif (DialogFocusItem.Property.Intensity >= 0) DialogFocusItem.Property.Effect = [\"Egged\", \"Vibrating\"];\n\tCharacterLoadEffect(C);\n\tif (C.ID == 0) ServerPlayerAppearanceSync();\n\n\tChatRoomPublishCustomAction(\"SpreaderVibratingDildoBar\" + ((Modifier > 0) ? \"Increase\" : \"Decrease\") + \"To\" + DialogFocusItem.Property.Intensity, true, [{Tag: \"DestinationCharacterName\", Text: C.Name, MemberNumber: C.MemberNumber}]);\n}", "function createSynth() {\n synth = new Tone.PolySynth(6, Tone.SimpleSynth)\n .set({\n oscillator: {\n type: 'sine'\n },\n envelope: {\n attack: 0.6,\n decay: 0.1,\n sustain: 0.9,\n release: 0.2\n }\n }).toMaster()\n}", "function editor_tools_handle_s() {\n editor_tools_add_tags('[s]', '[/s]');\n editor_tools_focus_textarea();\n}", "function moveBurger() {\n const tl = new gsap.timeline({ repeat: 1, yoyo: true });\n tl.staggerTo(\n '.burger_rect',\n 0.2,\n {\n scaleX: 1.25,\n },\n 0.1,\n );\n }", "postFormat() {\n if (this.postFormatted) return;\n\n // Calculate a smart slope if we're not forcing the beams to be flat.\n if (this.notes[0].getCategory() === 'tabnotes' || this.render_options.flat_beams) {\n this.calculateFlatSlope();\n } else {\n this.calculateSlope();\n }\n this.applyStemExtensions();\n\n this.postFormatted = true;\n }", "function shapeSettings(){\n rectMode(CENTER);\n noStroke();\n waveWidth = width;\n increment = (TWO_PI / period) * xSpacing;\n periodYValues = new Array( floor(waveWidth / xSpacing) );\n}", "function Sl(a,b){var c;if(b){var d=this;c=function(a){a=Tl.call(d,a);null!==a&&b.call(d,a);return a}}else c=Tl;this.mi=D(\"tspan\",{},null);this.mi.appendChild(document.createTextNode(\"\\u00b0\"));Sl.i.constructor.call(this,a,c)}", "serializeIndentation(writer, paragraphFormat) {\n writer.writeStartElement(undefined, 'ind', this.wNamespace);\n if (!isNullOrUndefined(paragraphFormat.leftIndent)) {\n // tslint:disable-next-line:max-line-length\n writer.writeAttributeString(undefined, 'left', this.wNamespace, this.roundToTwoDecimal(paragraphFormat.leftIndent * this.twipsInOnePoint).toString());\n }\n if (!isNullOrUndefined(paragraphFormat.rightIndent)) {\n // tslint:disable-next-line:max-line-length\n writer.writeAttributeString(undefined, 'right', this.wNamespace, this.roundToTwoDecimal(paragraphFormat.rightIndent * this.twipsInOnePoint).toString());\n }\n if (!isNullOrUndefined(paragraphFormat.firstLineIndent)) {\n if (paragraphFormat.firstLineIndent < 0) {\n // tslint:disable-next-line:max-line-length\n writer.writeAttributeString(undefined, 'hanging', this.wNamespace, this.roundToTwoDecimal(-1 * paragraphFormat.firstLineIndent * this.twipsInOnePoint).toString());\n }\n else {\n // tslint:disable-next-line:max-line-length\n writer.writeAttributeString(undefined, 'firstLine', this.wNamespace, this.roundToTwoDecimal(paragraphFormat.firstLineIndent * this.twipsInOnePoint).toString());\n }\n }\n writer.writeEndElement();\n }", "function LineStyle() {\n\tthis.thickness=1.5;\n\tthis.endCap = 'round';\n\tthis.setThickness = function(thickness) {\n\t\tthis.thickness = thickness;\n\t\treturn this;\n\t};\n\tthis.setEndCap = function(endCap) {\n\t\tthis.endCap = endCap;\n\t\treturn this;\n\t};\n}", "function add_markX() {\n\t\t// Creates html through our javascript.\n\t\tthis.innerHTML = turnOdd;\n\t\tthis.style.background = \"lightred\";\n\t}", "function RopeWriter() {\n this.blocks = [];\n}", "grow() {\n const tail = this.segments[this.segments.length-1];\n const newTail = new SnakeSegment(this.getTail().gridPosition, null, this.color);\n\n tail.el.classList.remove('tail'); \n newTail.el.classList.add('tail');\n\n this.segments.push(newTail);\n }", "function PatchLine() { }", "function addline() {\n line(0,sz,sz*3,sz);\n line(0,sz*2,sz*3,sz*2);\n line(sz,0,sz,sz*3);\n line(sz*2,0,sz*2,sz*3);\n}", "function addStroke(track, stroke) {\n\tif (track === \"undefined\" || stroke === \"undefined\") {\n\t\tconsole.log(\"track/stroke undefined\");\n\t} else {\n\t\ttrack.strokeList[track.nextFreeIndex] = stroke;\n\t\ttrack.nextFreeIndex++;\n\t}\n}", "setBold (bold=true) {\n let levels = Object.keys(LEVELS);\n for (let severity of levels) {\n if (severity === 'level') continue;\n this.levels[severity].bold = bold;\n }\n }", "function SnakeSegment() {\n\tthis.draw = function(bIsHead) { // implement the earlier absctract function\n\t\t//this.context.rect(this.x, this.y, 25, 25);\n\t\tif (bIsHead == true){\n\t\t\tthis.context.fillStyle=HEADCOLOUR;\n\t\t} else {\n\t\t\tthis.context.fillStyle=BODYCOLOUR;\n\t\t}\n\t\t\n\t\tthis.context.fillRect((this.x * game.grid.blockSize) + 1 , (this.y * game.grid.blockSize) + 1, game.grid.blockSize - 2, game.grid.blockSize - 2);\n\t}\n\n\tthis.clear = function () {\n\t\tthis.context.clearRect(this.x * game.grid.blockSize, this.y * game.grid.blockSize, game.grid.blockSize, game.grid.blockSize);\n\t}\n}", "addStrokeTag(ev){\n console.log(ev)\n var id = guid();\n var firstPoint = [ev['x'], ev['y']];\n var data = {\n 'id': id,\n 'width': 100,\n 'height': 100,\n 'placeHolder': [\n {'id':'left', 'data': {}, 'lines':[]}\n ],\n 'tagSnapped': [],\n 'position': [firstPoint[0],firstPoint[1]]\n \n }\n this.props.addTag(data)\n }", "function overlay() {\n sketch.strokeWeight(1);\n sketch.stroke(0, 0, 255, 75);\n sketch.fill(0, 0, 255, 75);\n sketch.rectMode(sketch.CENTER);\n sketch.rect(sketch.mouseX, sketch.mouseY, 100, 100);\n }", "function add_shed_label(item) {\n ctx.fillText(\"SHED\", item[0], item[1]);\n }", "increaseBar(amount){\n\t\tthis.status += amount;\n\t\tthis.clampScale();\n\t\tthis.blueBar.scale.setTo(this.status, .617);\n\t}", "shiftView() {\n const stime = (configRepo.get(currentConfig).scenarioStartTime);\n const levent = scenarioRepo.getLastEventOf(currentScenario);\n const etime = levent == null ? stime : stime + levent.pointInTime;\n this.line.setWindow(stime, etime, null, function () {\n timeline.line.zoomOut(0.3)\n });\n }", "function Attacked(dmg){\n\tthis.lifetime = fps*0.1\n\tthis.draw = function(){\n\t\tctx.strokeStyle = \"red\"\n\t\tctx.lineWidth = dmg/10+5;\n\t\tctx.strokeRect(0,0,800,600)\n\t\tthis.lifetime--\n\t\tif(this.lifetime<0){\n\t\t\tthis.draw = function(){}\n\t\t}\n\t}\n}" ]
[ "0.68293375", "0.67875737", "0.6204283", "0.57987946", "0.5123566", "0.50214446", "0.49740985", "0.49626213", "0.49213332", "0.49162588", "0.49009582", "0.48623002", "0.4857693", "0.48015428", "0.4789123", "0.47206426", "0.46857688", "0.4668362", "0.4666836", "0.46518686", "0.46512377", "0.4647304", "0.46458858", "0.4642943", "0.4629806", "0.46237794", "0.46188456", "0.46131608", "0.4606299", "0.4601579", "0.45989075", "0.45836693", "0.4569912", "0.45477855", "0.45161408", "0.44963014", "0.44852296", "0.4463551", "0.44555008", "0.4455334", "0.44528887", "0.44528887", "0.44327345", "0.44324407", "0.44143143", "0.44126338", "0.44008207", "0.4391039", "0.43873367", "0.43861642", "0.43838993", "0.4375643", "0.43570897", "0.43476066", "0.4346725", "0.43462598", "0.434306", "0.43410814", "0.43407768", "0.4339994", "0.43378755", "0.43372154", "0.43369377", "0.43358812", "0.43338934", "0.43234664", "0.43195468", "0.43189323", "0.4313164", "0.43077153", "0.42992532", "0.42983153", "0.42982966", "0.4295507", "0.42901134", "0.42894801", "0.42760074", "0.4275111", "0.4274266", "0.4271978", "0.42716628", "0.42693394", "0.42693177", "0.42633748", "0.4258671", "0.4257148", "0.42562896", "0.42509463", "0.42488745", "0.42480195", "0.42475292", "0.42465976", "0.42442808", "0.42439008", "0.42415565", "0.42382675", "0.42367226", "0.4233893", "0.42298517", "0.42297858" ]
0.49203157
9
All drawing functions below need the context to be set.
draw() { this.checkContext(); this.setRendered(); if (!this.formatted) this.format(); const num_lines = this.options.num_lines; const width = this.width; const x = this.x; let y; // Render lines for (let line = 0; line < num_lines; line++) { y = this.getYForLine(line); this.applyStyle(); if (this.options.line_config[line].visible) { this.context.beginPath(); this.context.moveTo(x, y); this.context.lineTo(x + width, y); this.context.stroke(); } this.restoreStyle(); } // Draw the modifiers (bar lines, coda, segno, repeat brackets, etc.) for (let i = 0; i < this.modifiers.length; i++) { // Only draw modifier if it has a draw function if (typeof this.modifiers[i].draw === 'function') { this.modifiers[i].applyStyle(this.context); this.modifiers[i].draw(this, this.getModifierXShift(i)); this.modifiers[i].restoreStyle(this.context); } } // Render measure numbers if (this.measure > 0) { this.context.save(); this.context.setFont(this.font.family, this.font.size, this.font.weight); const text_width = this.context.measureText('' + this.measure).width; y = this.getYForTopText(0) + 3; this.context.fillText('' + this.measure, this.x - text_width / 2, y); this.context.restore(); } return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "draw(context) {\n //TO-DO\n }", "draw(context){\n context.fillStyle = this.color;\n context.globalAlpha = 0.3;\n context.fillRect(this.x,this.y,this.width,this.height);\n\n if(this.selected){\n context.strokeStyle = '#CC0000';\n context.lineWidth = 2;\n context.strokeRect(this.x,this.y,this.width,this.height);\n\n this.selectionHandles = [];\n this.selectionHandles.push(new ResizeHandle(this,Positions.TOP_LEFT));\n this.selectionHandles.push(new ResizeHandle(this,Positions.TOP_MIDDLE));\n this.selectionHandles.push(new ResizeHandle(this,Positions.TOP_RIGHT));\n this.selectionHandles.push(new ResizeHandle(this,Positions.MIDDLE_LEFT));\n this.selectionHandles.push(new ResizeHandle(this,Positions.MIDDLE_RIGHT));\n this.selectionHandles.push(new ResizeHandle(this,Positions.BOTTOM_LEFT));\n this.selectionHandles.push(new ResizeHandle(this,Positions.BOTTOM_MIDDLE));\n this.selectionHandles.push(new ResizeHandle(this,Positions.BOTTOM_RIGHT));\n\n this.selectionHandles.forEach(function(handle) {\n handle.draw(context);\n });\n } else {\n this.selectionHandles = [];\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 }", "function draw(){\n\t\t// Needed to comply with Tool Delegate design pattern\n\t}", "drawCanvas() {\n\n\t}", "draw(context) {\n context.fillStyle = '#414048';\n context.beginPath();\n for (let i = 0; i < this.length; ++i) {\n context.fillRect(this.units[i].x, this.units[i].y, this.size, this.size);\n }\n context.closePath();\n }", "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 }", "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 }", "draw(context, gctx) {\n if (context === gctx) {\n // context.fillStyle = \"black\"; // always want black for the ghost canvas\n } else {\n context.fillStyle = this.shape.fill;\n }\n\n // We can skip the drawing of elements that have moved off the screen:\n if (this.shape.x > this.WIDTH || this.shape.y > this.HEIGHT) return;\n if (this.shape.x + this.shape.w < 0 || this.shape.y + this.shape.h < 0)\n return;\n\n if (this.shape.type === \"line\") {\n context.lineWidth = 2;\n context.strokeStyle = \"black\";\n context.beginPath();\n context.moveTo(this.shape.x, this.shape.y);\n context.lineTo(this.shape.x2, this.shape.y2);\n context.stroke();\n this.drawArrowhead(context,this.shape.x, this.shape.y,this.shape.x2, this.shape.y2);\n } else if (this.shape.type === \"rect\") {\n //task background point start\n context.fillStyle = \"black\";\n let height = this.shape.task === \"main\" ? this.shape.h +10 :this.shape.h + 20;\n let calcY= this.shape.task === \"main\" ? this.shape.y : this.shape.y - 10;\n let width = 18;\n let rds = 10;\n context.beginPath();\n context.moveTo(this.shape.x + this.shape.w / 2 + rds, calcY);\n context.lineTo(\n this.shape.x + this.shape.w / 2 + width - rds,\n calcY\n );\n context.quadraticCurveTo(\n this.shape.x + this.shape.w / 2 + width,\n calcY,\n this.shape.x + this.shape.w / 2 + width,\n calcY + rds\n );\n context.lineTo(\n this.shape.x + this.shape.w / 2 + width,\n calcY + height - rds\n );\n context.quadraticCurveTo(\n this.shape.x + this.shape.w / 2 + width,\n calcY + height,\n this.shape.x + this.shape.w / 2 + width - rds,\n calcY + height\n );\n context.lineTo(\n this.shape.x + this.shape.w / 2 + rds,\n calcY + height\n );\n context.quadraticCurveTo(\n this.shape.x + this.shape.w / 2,\n calcY + height,\n this.shape.x + this.shape.w / 2,\n calcY + height - rds\n );\n context.lineTo(this.shape.x + this.shape.w / 2, calcY + rds);\n context.quadraticCurveTo(\n this.shape.x + this.shape.w / 2,\n calcY,\n this.shape.x + this.shape.w / 2 + rds,\n calcY\n );\n context.closePath();\n context.fill();\n //task background point end\n\n //task start\n let radius =\n this.shape.task === \"main\"\n ? { tl: 25, tr: 25, br: 25, bl: 25 }\n : { tl: 5, tr: 5, br: 5, bl: 5 };\n\n context.fillStyle = this.shape.fill;\n context.shadowBlur = 5;\n context.shadowColor = this.shape.task === \"main\" ? \"#8590a1\" : \"#a5c7f1\";\n context.strokeStyle = this.shape.task === \"main\" ? \"#8590a1\" : \"#d9dddd\";\n\n context.beginPath();\n context.moveTo(this.shape.x + radius.tl, this.shape.y);\n context.lineTo(this.shape.x + this.shape.w - radius.tr, this.shape.y);\n context.quadraticCurveTo(\n this.shape.x + this.shape.w,\n this.shape.y,\n this.shape.x + this.shape.w,\n this.shape.y + radius.tr\n );\n context.lineTo(\n this.shape.x + this.shape.w,\n this.shape.y + this.shape.h - radius.br\n );\n context.quadraticCurveTo(\n this.shape.x + this.shape.w,\n this.shape.y + this.shape.h,\n this.shape.x + this.shape.w - radius.br,\n this.shape.y + this.shape.h\n );\n context.lineTo(this.shape.x + radius.bl, this.shape.y + this.shape.h);\n context.quadraticCurveTo(\n this.shape.x,\n this.shape.y + this.shape.h,\n this.shape.x,\n this.shape.y + this.shape.h - radius.bl\n );\n context.lineTo(this.shape.x, this.shape.y + radius.tl);\n context.quadraticCurveTo(\n this.shape.x,\n this.shape.y,\n this.shape.x + radius.tl,\n this.shape.y\n );\n context.closePath();\n context.fill();\n //task end\n\n context.shadowBlur = 0;\n // context.textAlign = \"center\";\n context.textBaseline = \"middle\";\n if (this.shape.task === \"main\") {\n context.font = \"15px Tahoma, Geneva, sans-serif\";\n context.fillStyle = \"#fbfcfc\";\n context.fillText(\n this.fittingString(context,this.shape.text),\n this.shape.x + 20,\n this.shape.y + this.shape.h / 2\n );\n context.font = \"10px Tahoma, Geneva, sans-serif\";\n context.fillStyle = \"#cdd4df\";\n context.fillText(\n this.shape.subText,\n this.shape.x + this.shape.w - context.measureText(this.shape.subText).width- 20,\n this.shape.y + this.shape.h / 2\n );\n } else {\n context.font = \"14px Tahoma, Geneva, sans-serif\";\n context.fillStyle = \"#5a5a5a\";\n context.fillText(\n \"->\",\n this.shape.x + 20,\n this.shape.y + 20\n );\n context.fillText(\n this.shape.text,\n this.shape.x + 40,\n this.shape.y + 20\n );\n context.font = \"11px Tahoma, Geneva, sans-serif\";\n context.fillStyle = \"#b3bbbc\";\n context.fillText(\n \"#\" + this.shape.subText,\n this.shape.x + 20,\n this.shape.y + 60\n );\n context.fillText(\n \"Delete\",\n this.shape.x +\n this.shape.w -\n context.measureText(\"delete\").width -\n 10,\n this.shape.y + 20\n );\n context.fillText(\n \"Copy\",\n this.shape.x +\n this.shape.w -\n context.measureText(\"Copy\").width -\n 10,\n this.shape.y + 40\n );\n context.fillText(\n \"Preview\",\n this.shape.x +\n this.shape.w -\n context.measureText(\"Preview\").width -\n context.measureText(\"Edit\").width - 20,\n this.shape.y + 60\n );\n context.fillText(\n \"Edit\",\n this.shape.x +\n this.shape.w -\n context.measureText(\"Edit\").width -\n 10,\n this.shape.y + 60\n );\n }\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 fillContext() {\r\n\t\tcontext.lineWidth = lineWidth;\r\n\t\tcontext.fillStyle = color;\r\n\t\tcontext.fill();\r\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 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 }", "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(ctx){\n ctx.save();\n ctx.fillStyle = \"green\";\n ctx.fillRect(this.x-this.width/2,this.y-this.height/2,this.width,this.height);\n ctx.restore();\n }", "function draw() {}", "function draw() {}", "draw(context) {\n context.fillStyle = '#f8333c';\n context.beginPath();\n for (let i = 0; i < this.quantity; ++i) {\n context.fillRect(this.units[i].x, this.units[i].y, this.size, this.size);\n }\n // context.closePath();\n }", "doDraw() {\n draw_context.fillStyle = \"#00007777\";\n draw_context.fillRect(0,0, canvas_element.width,canvas_element.height);\n draw_context.lineWidth = 40;\n draw_context.lineJoin = \"round\";\n draw_context.textAlign = \"center\";\n draw_context.font = \"70px Lemon\";\n draw_context.strokeStyle = this.grad1;\n draw_context.strokeText(\"The Bane of\", canvas_element.width/2, 150);\n draw_context.font = \"160px Lemon\";\n draw_context.strokeText(\"Gurnok\", canvas_element.width/2, 260);\n \n draw_context.fillStyle = \"#FA5\";\n draw_context.font = \"70px Lemon\";\n draw_context.fillText(\"The Bane of\", canvas_element.width/2, 150);\n draw_context.fillStyle = this.grad2;\n draw_context.font = \"160px Lemon\";\n draw_context.fillText(\"Gurnok\", canvas_element.width/2, 260);\n }", "draw(context) {\n context.beginPath();\n context.fillStyle = this.color;\n context.arc(this.x, this.y, this.size, 0, 2 * Math.PI);\n context.fill();\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 }", "updateDrawing(context) {\n if(!this.ded){\n context.drawImage(this.img, this.width * this.frameX, this.height * this.frameY, this.width, this.height, this.x, this.y, 50, 50)\n }\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 }", "draw(ctx) {\n\t\t\n\t\tctx.beginPath();\n\t\t\n\t\tctx.fillStyle = this.fillStyle;\n\t ctx.fillRect(this.x, this.y, this.w, this.h);\n\t\t\n\t\tif (this.lineWidth && this.strokeStyle) {\n\t\t\tctx.lineWidth = this.lineWidth;\n\t\t\tctx.strokeStyle = this.strokeStyle;\n\t\t ctx.strokeRect(this.x, this.y, this.w, this.h);\n\t\t\tctx.stroke();\n\t\t}\n\n\t\tctx.closePath();\n\t}", "function drawCanvas() {\n\t\tdrawing(context, drawer, colours, solver, selectedSpacesGrid);\n\t\tsolver.callStateForItem(spanState);\n\t}", "draw() { }", "draw() { }", "draw() { }", "function strokeContext() {\r\n\t\tcontext.lineWidth = lineWidth;\r\n\t\tcontext.strokeStyle = color;\r\n\t\tcontext.stroke();\r\n\t}", "draw(context){\n if(this.depth < this.maxDepth){\n context.drawImage(this.buffer, 0, Math.ceil(this.depth));\n if(this.creature){\n this.drawSprite(context);\n //context.strokeStyle = this.creature.type === \"plant\" ? '#008000':'#f00'; // some color/style\n //context.lineWidth = 2; // thickness\n //context.strokeRect(x, y, 32, 32);\n }\n }\n //context.fillText(this.name, this.center.x - 20, this.center.y + 10);\n }", "drawRect({x, y, width, height, options}){ \n options = options || {}\n Object.assign(this.#context, options)\n this.#context.rect(x, y, width, height)\n options.fillStyle && this.#context.fill()\n options.strokeStyle && this.#context.stroke()\n }", "function initializeContext(ctx) {\n ctx.lineWidth = 10;\n ctx.lineJoin = \"round\";\n ctx.lineCap = \"round\";\n \n $(\"#mainCanvas\").mousemove(function(event) {\n if (canvasPressed) {\n pointsArray.push({x: event.clientX - canvasPos.left, y: event.clientY - canvasPos.top});\n \n ctx.beginPath();\n ctx.moveTo(pointsArray[0].x, pointsArray[0].y);\n for (var i = 1; i < pointsArray.length; i++) {\n ctx.lineTo(pointsArray[i].x, pointsArray[i].y);\n }\n ctx.stroke();\n }\n });\n \n}", "function drawCanvas() {\n\t\tdraw(context, drawer, colours, solver);\n\t\tsolver.callStateForItem(spanState);\n\t}", "function draw(){\r\n // We define the background color, the sky\r\n context.fillStyle = \"#c0e5f1\";\r\n // We define the x- and y-Position (top-left corner) of the background\r\n context.fillRect(0, 0, canvas.width, canvas.height);\r\n // Call the \"Draw Background\" function\r\n background.draw();\r\n // Call the \"Draw Woods\" function\r\n woods.draw();\r\n // Call the \"Draw Foreground\" function\r\n foreground.draw();\r\n // Call the \"Draw Critter\" function\r\n critter.draw();\r\n // Call the \"Draw Menu\" function\r\n menu.draw();\r\n // Call the \"Draw gameOver\" function\r\n gameOver.draw();\r\n // Call the \"Draw Score\" function\r\n score.draw();\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 }", "function canvas_mouseDown(){\r\n drawing = true;\r\n context.moveTo(event.pageX, event.pageY);\r\n context.beginPath();\r\n}", "doDraw() {\n draw_context.strokeStyle = \"#000\";\n draw_context.fillStyle = \"#eee\";\n draw_context.font = \"40px Times\";\n draw_context.lineWidth = 10;\n draw_context.strokeText(this.text, canvas_element.width/2, this.vertical);\n draw_context.fillText(this.text, canvas_element.width/2, this.vertical);\n }", "paint () {\n // Clearing canvas first\n this.clear()\n this.root.__paint(this.canvasContext)\n }", "context() {\n return this._canvas.getContext('2d');\n }", "draw(ctx) {\n const { x, y, height, width, color } = this;\n\n ctx.fillStyle = color;\n ctx.fillRect(x, y, width, height);\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() {\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 }", "draw(context)\n\t{\n\t\tif ( !this.visible )\n\t\t\treturn;\n\n\t\tcontext.font = this.fontSize + \"px \" + this.fontName;\n\t\tcontext.fillStyle = this.fontColor;\n\t\tcontext.textAlign = this.alignment;\n\t\t\n\t\tcontext.setTransform(1,0, 0,1, 0,0); \n\t\tcontext.globalAlpha = this.opacity;\n\n\t\t// shadow draw settings\n\t\tif (this.drawShadow)\n\t\t{\n\t\t\tcontext.shadowColor = this.shadowColor;\n\t\t\tcontext.shadowBlur = this.shadowSize;\n\t\t}\n\n\t\t// add support for multiline text (line breaks indicated by \"\\n\")\n\t\tlet textArray = this.text.split(\"\\n\");\n\t\tlet lineSkip = this.fontSize * this.lineHeight;\n\n\t\t// draw filled in text (multiple times to increase drop shadow intensity)\n\t\tfor (let i = 0; i < textArray.length; i++)\n\t\t{\n\t\t\tcontext.fillText( textArray[i], this.position.x, this.position.y + i * lineSkip);\n\t\t\tcontext.fillText( textArray[i], this.position.x, this.position.y + i * lineSkip);\n\t\t}\n\n\t\t// disable shadowBlur, otherwise all sprites drawn later will have shadows\n\t\tcontext.shadowBlur = 0;\n\t\t// draw filled text again, to fill over interior shadow blur, that may be a different color\n\t\tfor (let i = 0; i < textArray.length; i++)\n\t\t{\n\t\t\tcontext.fillText( textArray[i], this.position.x, this.position.y + i * lineSkip);\n\t\t}\n\n\t\t// draw border last, so not hidden by filled text\n\t\tif (this.drawBorder)\n\t\t{\n\t\t\tcontext.strokeStyle = this.borderColor;\n\t\t\tcontext.lineWidth = this.borderSize;\n\t\t\tfor (let i = 0; i < textArray.length; i++)\n\t\t\t{\n\t\t\t\tcontext.strokeText( textArray[i], this.position.x, this.position.y + i * lineSkip);\n\t\t\t}\n\t\t}\t\t\n\t}", "draw() {}", "draw() {}", "draw() {}", "draw() {}", "function drawFrame() {\n context.fillRect(0, 0, canvas.width, canvas.height);\n context.fillStyle = \"#e8eaec\";\n }", "set canvas (context) {\n\t\tthis._ctx = context\n\t}", "draw(context)\n\t{\n\t\tif ( !this.visible )\n\t\t\treturn;\n\t\t\n\t\tcontext.setTransform(1,0, 0,1, this.position.x, this.position.y);\n\n\t\t// image, 4 source parameters, 4 destination parameters\n context.drawImage(this.texture.image, \n this.texture.region.position.x, this.texture.region.position.y, \n this.texture.region.width, this.texture.region.height,\n -this.rectangle.width/2, -this.rectangle.height/2, \n this.rectangle.width, this.rectangle.height);\n\t}", "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\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 }", "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 }", "drawCanvas() {\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\n this.ctx.fillStyle = '#18121e';\n this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);\n this.moveDots();\n }", "draw(ctx){\n ctx.save()\n ctx.beginPath()\n ctx.strokeStyle = this.strokeColor\n ctx.lineWidth = this.strokeWidth\n\n const MAX_HEAD = 80\n let new_y = (this.pesanteur) ? window.innerHeight - this.height - MAX_HEAD : this.y\n ctx.rect(this.x, new_y, this.width, this.height)\n\n ctx.fillStyle = this.fillColor\n\n ctx.closePath()\n ctx.fill()\n ctx.stroke()\n ctx.restore() \n \n\n }", "draw() {\n\t\tlet width = 30;\n\n\t\tinfo.context.beginPath();\n\t\tinfo.context.rect(this.position.x - width/2, this.position.y - width/2, width, width);\n\t\tinfo.context.fillStyle = this.color;\n\t\tinfo.context.fill();\n\t}", "draw() {\n // destructuring\n const {\n x,\n y,\n width,\n height,\n fillColor,\n strokeColor,\n strokeWidth\n } = this\n\n // saves the current styles set elsewhere\n // to avoid overwriting them\n ctx.save()\n\n // set the styles for this shape\n ctx.fillStyle = fillColor\n ctx.lineWidth = strokeWidth\n\n // create the *path*\n ctx.beginPath()\n ctx.strokeStyle = strokeColor\n ctx.rect(x, y, width, height)\n\n // draw the path to screen\n ctx.fill()\n ctx.stroke()\n\n // restores the styles from earlier\n // preventing the colors used here\n // from polluting other drawings\n ctx.restore()\n }", "begin() {\n this.ctx.beginPath();\n this.ctx.moveTo(this.position[0], this.position[1]);\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 }", "draw() {\n this.state.ctx.beginPath();\n this.state.ctx.moveTo(this.state.prevX, this.state.prevY);\n this.state.ctx.lineTo(this.state.currX, this.state.currY);\n this.state.ctx.strokeStyle = this.state.x;\n this.state.ctx.lineWidth = this.state.y;\n this.state.ctx.stroke();\n this.setState({ctx: this.state.ctx});\n }", "draw(ctx){\r\n ctx.save()\r\n ctx.beginPath()\r\n ctx.strokeStyle = this.strokeColor\r\n ctx.lineWidth = this.strokeWidth\r\n\r\n const MAX_HEAD = 80\r\n let new_y = (this.pesanteur) ? window.innerHeight - this.height - MAX_HEAD : this.y\r\n ctx.rect(this.x, new_y, this.width, this.height)\r\n\r\n ctx.fillStyle = this.fillColor\r\n\r\n ctx.closePath()\r\n ctx.fill()\r\n ctx.stroke()\r\n ctx.restore()\r\n }", "function draw() {\n\n var ctx = getContext();\n\n // Log.group(\"A draw started\");\n //alert('Paint 1')\n reset(getCanvas());\n\n //if grid visible paint it\n//\tif(gridVisible){ //paint grid\n addBackground(getCanvas());\n//\t}\n\n //alert('Paint 2')\n STACK.paint(ctx);\n\n minimap.updateMinimap();\n// Log.groupEnd();\n//alert('Paint 3')\n\n refCabecera();\n}", "function doDrawOnCanvas(canvasX, canvasY)\n{\n //This works like a drawing pencil which tracks the mouse / touch \n //movements. We start drawing a path made up of lines.\n if(!global_startedDrawing) //first time\n {\n global_canvas.beginPath();\n global_canvas.moveTo(canvasX, canvasY);\n global_startedDrawing = true;\n }\n \n else\n {\n global_canvas.lineTo(canvasX, canvasY);\n global_canvas.stroke();\n }\n}", "draw(){\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 var realFunctionPoints = [];\r\n for (var i = 0; i <= numberOfPoints; i++) {\r\n var x = 2*i / numberOfPoints-1;\r\n var y = samplingFunction(x);\r\n realFunctionPoints.push({x: x, y: y});\r\n }\r\n\r\n var numberOfSamples = parseInt(document.getElementById('numberOfSamples').value) || 0;\r\n var controlPoints = [];\r\n for (var i = 0; i <= numberOfSamples; i++) {\r\n var x = 2*i / numberOfSamples-1;\r\n var y = samplingFunction(x);\r\n controlPoints.push({x: x, y: y});\r\n }\r\n\r\n drawCurve(context1, styleForRealFunction, realFunctionPoints); // Draw the given function, f\r\n drawCurve(context1, styleForInterpolatedCurve, computeUniformInterpolation(numberOfPoints, controlPoints)); // Draw uniform parametrization of interpolated curve\r\n\r\n drawVertices(context1, style, controlPoints); // Draw vertices as circles\r\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 }", "componentDidMount() {\n this.ctx = this.canvas.current.getContext(\"2d\");\n this.draw();\n }", "draw(x, y) {\n ctx.clearRect(0, 0, this.$canvas.width, this.$canvas.height);\n ctx.beginPath();\n ctx.fillStyle = \"skyblue\";\n ctx.strokeStyle = \"gray\";\n ctx.rect(x, y, 10, 10);\n ctx.fill();\n ctx.stroke();\n }", "drawPath() {\n this.ctx.stroke();\n this.begin();\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\n // only display the dirt if it is visible... \n if (this.visible){\n\n ctxDATA.fillStyle = this.color; \n ctxDATA.fillRect(this.x, this.y, this.w, this.h);\n \n // end of visibility check \n }\n\n // end of the draw method for the Dirt \n }", "draw(){\r\n ctx.beginPath();\r\n ctx.rect(this.x, this.y, this.width, this.height);\r\n //console.log(this.x)\r\n ctx.fillStyle = D_color;\r\n ctx.fill();\r\n ctx.closePath();\r\n }", "draw() {\n\n }", "draw(context) {\n // NOTE: context variable/parameter is equal to canvas.getContext(\"2d\");\n // TODO: draw a circle on the context:\n // 1] position horizontally should be equal to this.x\n // 2] position vertically should be equal to this.y\n // 3] diameter should be equal to this.size\n // 4] Make it a full circle\n context.beginPath();\n context.arc(this.x, this.y, this.size / 2, 0, Math.PI*2, false);\n context.closePath();\n context.fillStyle = this.color[0]; // take the first color from our field\n context.fill();\n\n // TODO: draw another circle inside the first circle\n // Make radius 5 pixels LESS\n // Set color to the second color in our FIELD\n // Use the approach above\n context.beginPath();\n context.arc(this.x, this.y, this.size / 2 - 5, 0, Math.PI*2, false);\n context.closePath();\n context.fillStyle = this.color[1];\n context.fill();\n }", "fill() {\n this.movePen(this.bpenx, this.bpeny);\n this.context.fill.apply(this.context, arguments);\n }", "function draw()\r\n\t{\r\n\t\t// set the draw fill style colour to black\r\n\t\tcontext.fillStyle = \"#000000\";\r\n\t\t// fill the canvas with black\r\n\t\tcontext.fillRect(0,0,canvas.width,canvas.height);\r\n\t\t// choose a font for our message\r\n\t\tcontext.font = \"40pt Calibri\";\r\n\t\t// set the draw fill colour to white\r\n\t\tcontext.fillStyle = \"#ffffff\";\r\n\t\t// draw the text at the specified position\r\n\t\tcontext.fillText(\"Hello World!\", 150, canvas.height);\r\n\t}", "function drawStage(context, mouse) {\n\n // Clearing canvas\n context.clearRect(0, 0, innerWidth, innerHeight);\n\n // Drawing active line\n if(draw_active) {\n current_line.drawActive(context, mouse);\n }\n // Drawing all previous lines\n for(var i = 0; i < lines.length; i++) {\n lines[i].draw(context);\n }\n}", "function CanvasInit(){\n context.fillStyle = 'white';\n context.fillRect(0,0,canvas.width, canvas.height);\n context.fillStyle = 'black';\n context.strokeStyle = 'black'\n setUpCanvas();\n clear();\n}", "startDrawing() {\n var canvas = this.context.getContext(\"2d\");\n canvas.save();\n this.updateAnimation = true;\n var infographic = this;\n window.requestAnimationFrame(function () { infographic.drawLoading(); });\n }", "draw(context) {\n\t\t\tcontext.textAlign = 'center';\n\t\t\tcontext.fillStyle = 'rgba(57, 228, 57,' + this.opacity + ')';\n\t\t\tcontext.fillText(this.name, this.x, this.y);\n\t\t}", "draw() {\n this.context.beginPath();\n this.context.arc(this.x, this.y, this.size, 0, 2 * Math.PI, false)\n this.context.fillStyle = this.color\n this.context.fill()\n this.context.stroke()\n }", "function draw() {\r\n \r\n}", "draw(ctx) {\n ctx.fillStyle = this.color;\n ctx.moveTo(this.position.X, this.position.Y);\n if (this.icon) {\n ctx.drawImage(this.icon, this.position.X, this.position.Y);\n } else {\n ctx.fillRect(this.position.X, this.position.Y, this.size.WIDTH, this.size.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 // Don't draw if shape has have moved off the canvas\n if (this.x > this.canvas.width || this.y > this.canvas.height ||\n this.x + this.width < 0 || this.y + this.height < 0) {\n return;\n }\n this.canvas.context.fillStyle = this.fill;\n this.canvas.context.fillRect(this.x, this.y, this.width, this.height);\n // Highlight after fill so it is on top\n if (this.selected) {\n this.highlightSelected();\n this.drawResizeHandles();\n }\n }", "function InitThis() {\n ctx = document.getElementById('myCanvas').getContext(\"2d\");\n\n $('#myCanvas').mousedown(function (e) {\n mousePressed = true;\n Draw(e.pageX - $(this).offset().left, e.pageY - $(this).offset().top, false);\n });\n\n $('#myCanvas').mousemove(function (e) {\n if (mousePressed) {\n Draw(e.pageX - $(this).offset().left, e.pageY - $(this).offset().top, true);\n }\n });\n\n $('#myCanvas').mouseup(function (e) {\n mousePressed = false;\n });\n\t $('#myCanvas').mouseleave(function (e) {\n mousePressed = false;\n });\n}", "function draw(canvas)\n{\t\n\thelper.clear(canvas) // Clear canvas and set size\n \tvar ctx=canvas[0].getContext(\"2d\");\t\n\tctx.fillStyle=\"green\";\n\tctx.fillRect(0, 0, canvas.width(), canvas.height());\n}", "function draw() {\nvar canvas = document.getElementById('myCanvas'); // canvas with id=\"myCanvas\"\nif (canvas.getContext) {\n\tvar ctx = canvas.getContext('2d');\n\n\n\tctx.fillRect(0,0,600,400); // draw a filled rectangle\n\n\n\n} // close if\n} // close draw() function", "function drawCanvas() {\n\tif (imageId != null) {\n\t\tdrawJointJS(imageId);\n\t\timageId = null;\n\t}\n}", "function set_drawing_context() {\n\t\tif(isAndroid || isIDevice|| isPlaybook|| isTouchPad){\n\t\t\theight = 650;\n\t\t\twidth = 750;\n\t\t\tif( (window.innerWidth < 750) &&(window.innerWidth > 300)&&\n\t\t\t\t(window.innerHeight < 650) &&(window.innerHeight > 300) &&(window.innerWidth > window.innerHeight * 1.2 ))\n\t\t\t{\n\t\t\t\t\n\t\t\t\t\n\t\t\t\theight = window.innerHeight ;\n\t\t\t\twidth = height * fixwidth /fixheight ;\t\n\n\t\t\t}\n\t\t\telse{\n\t\t\t\theight = 650;\n\t\t\t\twidth = 750;\n\t\t\t}\n\t\t\ttblwidth = orign_table_width* height / fixheight\n\t\t\t\n\t\t\ttblheight = orign_table_height * height / fixheight\n\t\n\t\t\ttblleft = orign_table_left * height / fixheight\n\t\t\ttbltop = orign_table_top * height / fixheight\n\t\t\n\t\t\tball_scale = table_scale/17;\n\t\t\t\n\t\t\tfontscale = (tblheight / tblwidth)* 40;\n\t\t\t\n\t\t}\n\t\telse{\n\t\t\theight = 650;\n\t\t\twidth = 750;\n\t\t\tif( (window.innerWidth < 750) &&(window.innerWidth > 300)&&\n\t\t\t\t(window.innerHeight < 650) &&(window.innerHeight > 300) &&(window.innerWidth > window.innerHeight * 1.2 ))\n\t\t\t{\n\t\t\t\t\n\n\t\t\t\theight = window.innerHeight ;\n\t\t\t\twidth = height * fixwidth /fixheight ;\t\n\n\t\t\t}\n\t\t\telse{\n\t\t\t\theight = 650;\n\t\t\t\twidth = 750;\n\t\t\t}\n\t\t\ttblwidth = orign_table_width* height / fixheight\n\t\t\ttblheight = orign_table_height * height / fixheight\n\t\n\t\t\ttblleft = orign_table_left * height / fixheight\n\t\t\ttbltop = orign_table_top * height / fixheight\n\t\t\n\t\t\tball_scale = table_scale/17;\n\t\t\t\n\t\t\tfontscale = (tblheight / tblwidth)* 40;\n\t\t}\n\t\tcanvas_left = -(width/2)/(tblheight);canvas_right = -canvas_left;canvas_top = -(height/2)/(tblheight);canvas_bottom = -canvas_top;\n\t\ttable_left = ( tblleft - width/2 )/tblheight;table_top = ( tbltop - height/2 )/tblheight;\ttable_right = (tblwidth + tblleft - width/2 )/tblheight;\n\t\ttable_bottom_end = (tblheight + tbltop - height/2 )/tblheight;\ttable_bottom = 0.85 *table_bottom_end ;\n\t\t\n\t\t\n\t\tcueball_limit = table_left /2;\n\t\tblackpostion = {x:table_left /2,y:table_bottom/2 }\n\t\t\n\t\tstartimg_width = canvas_right * 0.46;startimg_height = canvas_bottom * 0.2;startimg_first_x = canvas_left;startimg_first_y = canvas_bottom - startimg_height;\t\n\t\t\n\t\ttiltle_width = canvas_right * 0.6;title_left = canvas_left * 0.3;title_top = canvas_top * 0.81;\ttitle_height = canvas_bottom * 0.13;\t\n\t\t pool_width = canvas_right * 0.6 ; pool_left = canvas_left * 0.3 ; pool_height = canvas_bottom * 0.1; pool_top = canvas_bottom * 0.7;\t\n\t\n\t\talertimg_left = table_left * 0.5;\talertimg_top = table_top * 0.5 ;alertimg_width = table_right ;alertimg_height = (table_bottom_end ) ;\n\t\t \n\t\tokimg_left = alertimg_left * 0.4 ;okimg_top = -alertimg_top * 0.5;okimg_width = alertimg_width * 0.4;okimg_height = alertimg_height * 0.2;\n\t\t\n\t\t\n\t\tscoreimg_width = canvas_right * 0.42;\tscoreimg_height = canvas_bottom * 0.2;scoreimg_first_x = canvas_right * 0.96 - scoreimg_width\n\t\tscoreimg_first_y = canvas_bottom - startimg_height;\n\t\t\n\t\tstateshowimg_width = scoreimg_first_x - startimg_width - startimg_first_x;\tstateshowimg_height = canvas_bottom * 0.12\n\t\tstateshowimg_first_x =startimg_width + startimg_first_x;\tstateshowimg_first_y = canvas_bottom - stateshowimg_height;\n\t\t\n\t\thelpimg_width = canvas_right * 0.25;helpimg_height = canvas_bottom * 0.1;helpimg_first_x = canvas_left * 0.95 ;helpimg_first_y = canvas_top * 0.98 ;\n\n\t\t timeleft_x = canvas_right * 0.86;\t timeleft_y = canvas_top * 0.93;\n\t\n\t\t outer = ball_scale * pocket_scale * Math.SQRT2 ;\n\n\t\t\tdiv = document.getElementById(name);\n\t\tcanvas_name = name + \"_canvas\";\n\t\t div.innerHTML = \"\";\n canvas_html = \"<canvas\";\n canvas_html += \" id=\" + canvas_name;\n canvas_html += \" width=\" + width;\n canvas_html += \" height=\" + height;\n canvas_html += \">Sorry, your browser doesn't appear to support the HTML-5 Canvas</canvas>\";\n div.innerHTML = canvas_html;\n\n canvas = document.getElementById(\"pool_table_canvas\");\n\t\t\n if (!canvas) return;\n\t\t\n ctx = canvas.getContext(\"2d\");\n if (!ctx) return;\n//\t\t\tcanvas.width = width;\n//\t\tcanvas.height = height;\n\n\n\t\tctx.drawImage(loadimage, loadimg_left, loadimg_top, loadimg_width, loadimg_height);\n\t\t\t\t\n\t\tctx.fillStyle = \"#fff\";\n\t\tctx.fillRect(loadimg_left + loadimg_width * 0.1,loadimg_top + loadimg_height * 0.7 ,loadimg_width * 0.8,loadimg_height * 0.1);\n\t\tctx.strokeStyle = \"#fff\";\n\t\tctx.fillRect(loadimg_left + loadimg_width * 0.1,loadimg_top + loadimg_height * 0.7 ,loadimg_width * 0.8,loadimg_height * 0.1);\n\n\t\tctx.fillStyle = \"blue\";\n\t\tctx.fillRect(loadimg_left + loadimg_width * 0.1,loadimg_top + loadimg_height * 0.7 , loadimg_width * 0.75 ,loadimg_height * 0.1);\n\n\t ctx.translate( width/2 , height/2 );\n ctx.scale(tblheight, tblheight );\n\n if (!table) {\n table = new Table();\n table.initialize( game );\n }\n\n \n table.ctx = ctx;\n var canvas_offset = new Vector(canvas.offsetLeft + width/2,canvas.offsetTop + height/2 );\n\n function mouse_vec(evt) {\n\t\t\t\n\t\t\tvar touchObj ;\n\t\t\tif((evt.type == 'touchstart')||(evt.type == 'touchend')||(evt.type == 'touchmove')){\n\t\t\t\t\ttouchObj= evt.touches[0];\n\t\t\t\t\tif(evt.type == 'touchend'){\n\t\t\t\t\t\t\n\t\t\t\t\t\t touchObj = evt.changedTouches[0];\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\tvar vec = new Vector( touchObj.pageX + window.scrollX, touchObj.pageY + window.scrollY );\n\t\t\t}\n\t\t\telse if((evt.type == 'mousedown')||(evt.type == 'mouseup')||(evt.type == 'mousemove')){\n\t\t\t\tvar vec = new Vector( evt.clientX + window.scrollX, evt.clientY + window.scrollY );\n\t\t\t}\n\t\t\t\n \n vec.subtract( canvas_offset );\n vec.scale_down( tblheight );\n\n return vec;\n }\n\n function mouse_down(evt) {\n\t\t//\tif(gamestate == \"ready\")return;\n \n\t\t\t\n\t\t\tevt.stopPropagation();\n\t\t\tevt.preventDefault();\n }\n\n function mouse_up(evt) {\n\t\t\tvar vec = mouse_vec(evt);\n\t\t\t\n\t\t\tcheckinput(vec); \n\t\t\tif(gamestate == \"start\"){\n\t\t\t\t if (table.ball_in_hand) {\t\t\t\t\t\n\t\t\t\t\tvar cue_ball = table.cue_ball;\n\t\t\t\t\tcue_ball.position = vec;\n\t\t\t\t\t\n\t\t\t\t\tif(vec. x > cueball_limit + cue_ball.radius ){\n\t\t\t\t\t\tcue_ball.position.x = cueball_limit + cue_ball.radius;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\tif ( cue_ball.is_valid_location(table) ){\n\t\t\t\t\t\t if(!show_targetting_line){\n\t\t\t\t\t\t\t\tshow_targetimg = true;\n\t\t\t\t\t\t }\n\t\t\t\t\t\ttable.ball_in_hand = 0;\n\t\t\t\t\t\tshot_enable = true;\n\t\t\t\t\t\ttable.begin_shot( mouse_vec(evt) );\t\t\t\t\n\t\t\t\t\t }\t\t\t\t\t\n\t\t\t\t }\n\t\t\t\t else{\n\t\t\t\t\t if(show_whitline != show_targetting_line){\n\t\t\t\t\t\tshow_whitline = show_targetting_line\n\t\t\t\t\t }\n\t\t\t\t\t else{\n\t\t\t\t\t\tif(shot_enable){\n\t\t\t\t\t\t\ttable.commit_shot( vec );\n\t\t\t\t\t\t\tshot_enable = false;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tif(table.begin_shot( mouse_vec(evt) )){\tshot_enable = true;}\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t }\n\t\t\t\t}\n\t\t\t}\n\t\t\t \n\t\t\tevt.stopPropagation();\n\t\t\tevt.preventDefault();\n }\n\n function mouse_move(evt) {\n\t\t\tif(gamestate != \"start\")return;\n var vec = mouse_vec(evt);\n if (table.ball_in_hand) {\n\t\t\t\twhiteball_move = true;\n\n\t\t\t\t table.cue_ball.cueball_location(vec);\n }\n else {\n\t\t\t\twhiteball_move = false;\n table.adjust_shot( vec );\n }\n\t\t\tevt.stopPropagation();\n\t\t\tevt.preventDefault();\n }\n\n\t\tif(isAndroid || isIDevice|| isPlaybook|| isTouchPad){\n\t\t\tcanvas.addEventListener( 'touchstart', mouse_down, false );\n\t\t\tcanvas.addEventListener( 'touchend', mouse_up, false );\n\t\t\tcanvas.addEventListener( 'touchmove', mouse_move, false );\n\t\t\n\t\t}\n\t\telse{\n\t\t\tcanvas.addEventListener( 'mousedown', mouse_down, false );\n\t\t\tcanvas.addEventListener( 'mouseup', mouse_up, false );\n\t\t\tcanvas.addEventListener( 'mousemove', mouse_move, false );\n\t\t}\n }", "function redraw(){\n// context.clearRect(0, 0, context.canvas.width, context.canvas.height); // Clears the canvas\n \n \n context.lineJoin = \"round\";\n context.lineWidth = 5;\n \n for(var i=0; i < clickXY[0].length; i++) {\t\t\n context.beginPath();\n if(clickDrag[i] && i){\n context.moveTo(clickXY[0][i-1], clickXY[1][i-1]);\n }else{\n context.moveTo(clickXY[0][i]-1, clickXY[1][i]);\n }\n context.lineTo(clickXY[0][i], clickXY[1][i]);\n context.closePath();\n context.strokeStyle = clickColor[i];\n context.stroke();\n }\n }", "function draw(ctx) {\n grid.draw();\n}", "get context () {\n\t\treturn {\n\t\t\tbase: this.element.base.getContext('2d'),\n\t\t\tline: this.element.line.getContext('2d'),\n\t\t\tshadow: this.element.shadow.getContext('2d'),\n\t\t\tglow: this.element.glow.getContext('2d'),\n\t\t\tblur: this.element.blur.getContext('2d'),\n\t\t\tcomposite: this.element.composite.getContext('2d')\n\t\t}\n\t}", "function startDraw(e) {\n ctx.beginPath();\n draw(e);\n}", "function draw() {\n}" ]
[ "0.8246711", "0.7399165", "0.71979636", "0.71395373", "0.7087667", "0.7036976", "0.7030962", "0.6951352", "0.6930964", "0.6918537", "0.6918537", "0.6918537", "0.6918537", "0.68930364", "0.68846", "0.6862648", "0.6862026", "0.6833648", "0.6831657", "0.6820405", "0.6820405", "0.6818206", "0.6790222", "0.67849934", "0.6762336", "0.67496836", "0.6716637", "0.66818523", "0.6634281", "0.66322297", "0.66322297", "0.66322297", "0.66246235", "0.6621527", "0.66007864", "0.65981054", "0.65948075", "0.6587497", "0.6586147", "0.6584244", "0.65836006", "0.655924", "0.65454566", "0.65433085", "0.6538065", "0.65355724", "0.65259576", "0.65187454", "0.651023", "0.651023", "0.651023", "0.651023", "0.64908826", "0.6486753", "0.6458532", "0.6454574", "0.64407974", "0.64334446", "0.6433379", "0.64201957", "0.6418416", "0.64177364", "0.64027697", "0.63999546", "0.6398635", "0.63967", "0.6396375", "0.6391149", "0.63882303", "0.63864106", "0.63795114", "0.6378316", "0.63727665", "0.6369205", "0.63625395", "0.63556683", "0.63547486", "0.63501763", "0.63465494", "0.6345221", "0.6339737", "0.6338468", "0.63319856", "0.63297284", "0.6324786", "0.631944", "0.6311816", "0.6310643", "0.63086563", "0.63066673", "0.6301259", "0.62899536", "0.6287499", "0.6282362", "0.6280944", "0.62797344", "0.62793446", "0.6274774", "0.6265467", "0.62608314", "0.62605864" ]
0.0
-1
Draw Simple barlines for backward compatability Do not delete draws the beginning bar of the stave
drawVertical(x, isDouble) { this.drawVerticalFixed(this.x + x, isDouble); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawBarVis(type) {\r\n const BINS = canvas.width / 3;\r\n const BAR_WIDTH = canvas.width / BINS;\r\n const HALF_CANVAS_HEIGHT = canvas.height / 2;\r\n\r\n let x_coord = 0;\r\n\r\n // Draw bars\r\n for (var i = 0; i < BINS; i++) {\r\n let barLength = Math.pow(frequencyData[i + Math.ceil(i / 90)], 3) / Math.pow(255, 3);\r\n\r\n switch(type) {\r\n // === Spaced Mirrored Bars ===\r\n case \"spacedMirrored\":\r\n canvasContext.beginPath();\r\n canvasContext.moveTo(0, HALF_CANVAS_HEIGHT);\r\n canvasContext.lineTo(canvas.width, HALF_CANVAS_HEIGHT);\r\n canvasContext.stroke();\r\n // Top Half\r\n canvasContext.fillRect(\r\n x_coord,\r\n HALF_CANVAS_HEIGHT * (1 - barLength * SPACING),\r\n BAR_WIDTH,\r\n -HALF_CANVAS_HEIGHT * barLength * SPACE_MIRR_SIZE\r\n );\r\n // Bottom Half\r\n canvasContext.fillRect(\r\n x_coord,\r\n HALF_CANVAS_HEIGHT * (1 + barLength * SPACING),\r\n BAR_WIDTH,\r\n HALF_CANVAS_HEIGHT * barLength * SPACE_MIRR_SIZE\r\n );\r\n break; \r\n // === Full Bars === \r\n case \"full\":\r\n canvasContext.fillRect(\r\n x_coord,\r\n HALF_CANVAS_HEIGHT,\r\n BAR_WIDTH,\r\n -HALF_CANVAS_HEIGHT * barLength\r\n );\r\n break;\r\n // === Mirrored Bars ===\r\n default:\r\n canvasContext.beginPath();\r\n canvasContext.moveTo(0, HALF_CANVAS_HEIGHT);\r\n canvasContext.lineTo(canvas.width, HALF_CANVAS_HEIGHT);\r\n canvasContext.stroke();\r\n canvasContext.fillRect(\r\n x_coord,\r\n HALF_CANVAS_HEIGHT * (1 - barLength * MIRR_SIZE),\r\n BAR_WIDTH,\r\n canvas.height * barLength * MIRR_SIZE\r\n ); \r\n }\r\n //Set new starting x-coordinate for next bar\r\n x_coord += BAR_WIDTH + 1;\r\n }\r\n }", "function draw() {\r\n for (var index = 0; index < bar.length; index++) {\r\n\r\n ctx.fillStyle = barColor;\r\n ctx.clearRect(bar[index].x, bar[index].y, barWidth, bar[index].height);\r\n bar[index].y = getHeight(bar[index].height);\r\n bar[index].x = (index + index) * barPadding + (barWidth * index);\r\n\r\n if (mousePos.x >= bar[index].x - barWidth * 10 &&\r\n mousePos.x < bar[index].x + barWidth * 10 &&\r\n Math.abs(mousePos.y - maxBarHeight / 2) < 100) {\r\n bar[index].direction = -1;\r\n\r\n }\r\n\r\n if (bar[index].height < bar[index].buffHeight && bar[index].direction > 0) {\r\n bar[index].height += speed.grow;\r\n } else if (bar[index].direction > 0) {\r\n bar[index].direction = -1;\r\n }\r\n\r\n // If increasing grow it \r\n if (bar[index].height > bar[index].buffHeight / 1.25 && bar[index].direction < 0) {\r\n bar[index].height -= speed.shrink;\r\n } else if (bar[index].direction < 0) {\r\n bar[index].buffHeight = randomizeHeight(bar[index].x);\r\n bar[index].direction = 1;\r\n }\r\n\r\n ctx.fillRect(bar[index].x, bar[index].y, barWidth, bar[index].height);\r\n }\r\n\r\n var grd = ctx.createLinearGradient(146.000, 0.000, 154.000, 4000.000);\r\n /* var grd = ctx.createLinearGradient(146.000, 0.000, 154.000, 600.000);*/\r\n\r\n // Add colors\r\n grd.addColorStop(0.000, 'rgba(255, 255, 255, 0.000)');\r\n grd.addColorStop(1.000, 'rgba(0, 0, 0, 1.000)');\r\n\r\n // Fill with gradient\r\n ctx.fillStyle = grd;\r\n ctx.fillRect(0, 400, width, 400);\r\n\r\n }", "checkIfNeedsLastBar() {\n\t\tif (this.cell !== 15)\n\t\t\treturn;\n\t\tif (!this.closebar)\n\t\t\treturn;\n\t\tlet curCell = this.cells[this.cell];\n\t\tvar bar = document.createElement(\"irr-rbar\");\n\t\tbar.classList.add(\"Single-Barline\");\n\t\tcurCell.insertBefore(bar, curCell.firstChild);\t// must insert, not append, for correct positioning\n\t}", "update(\n widthMultiplier = 1,//width of the bar\n barNumber = 1,//count of total bas to be drawn\n invert = false,//in case you want to draw on the other side of the screen\n audioData,\n canvasX = 0,//used when the screen resizes to keep relative position \n canvasY = 0//same as above\n ) {\n this.offsetY = 0;//increase to go to the next line\n for (let i = 0; i < barNumber; i++) {\n this.drawRef.newL(this.originX, this.originY + this.offsetY);\n if (invert) {\n this.drawRef.toVertex(\n canvasX - (5 + widthMultiplier) - audioData[i],\n this.originY + this.offsetY\n );\n this.drawRef.toVertex(\n canvasX - (12 + widthMultiplier) - audioData[i],\n this.originY + 5 + this.offsetY\n );\n this.drawRef.toVertex(\n canvasX - (5 + widthMultiplier) - audioData[i],\n this.originY + 10 + this.offsetY\n );\n this.drawRef.toVertex(canvasX, this.originY + 10 + this.offsetY);\n } else {\n this.drawRef.toVertex(\n this.originX + 5 + widthMultiplier + audioData[i],\n this.originY + this.offsetY\n );\n this.drawRef.toVertex(\n this.originX + 12 + widthMultiplier + audioData[i],\n this.originY + 5 + this.offsetY\n );\n this.drawRef.toVertex(\n this.originX + 5 + widthMultiplier + audioData[i],\n this.originY + 10 + this.offsetY\n );\n this.drawRef.toVertex(this.originX, this.originY + 10 + this.offsetY);\n }\n this.drawRef.save();\n //each side has it's own color (left is red, right is blue)\n if (!invert) this.drawRef.fillColor(makeColor(255, 0, 0, 1));\n else this.drawRef.fillColor(makeColor(0, 0, 255, 1));\n this.drawRef.close();\n this.offsetY += 25;\n }\n }", "function dessineBarre() {\n\n ctx.beginPath();\n ctx.rect(barreX, canvas.height - barreHeight - 2, barreWidth, barreHeight);\n ctx.fillStyle = '#333';\n ctx.fill();\n ctx.closePath();\n}", "function BarDrawUtil() {\n var me = this;\n /****Constants****/\n var BAR_COLOR = /*\"#4A87F8\"*/\"#178FB7\";\n //Layout\n var MAX_BAR_WIDTH = 24;\n var NICE_BAR_WIDTH = 12;\n var MIN_BAR_WIDTH = 2;\n var BEST_PAD_BETWEEN_BARS = 1;\n\n /****Externally set****/\n //Data\n var dataList;\n //Utils\n var yAxis;\n var xAxis;\n //Structure\n var barGroup;\n var concealerGroup;\n //Layout\n var bottomExtraPadding;\n\n /**Internally Set**/\n //Data\n var barCount;\n //Layout\n var barWidth;\n\n\n /**Public Functions***/\n this.setLayoutParams = function (bottomExtraPaddingInput) {\n bottomExtraPadding = bottomExtraPaddingInput;\n };\n\n this.setData = function (dataListInput, xAxisInput, yAxisInput) {\n dataList = dataListInput;\n xAxis = xAxisInput;\n yAxis = yAxisInput;\n };\n\n this.setPapaGroups = function (barGroupInput, concealerGroupInput) {\n barGroup = barGroupInput;\n concealerGroup = concealerGroupInput;\n };\n\n this.drawComponent = function () {\n createAllBars();\n };\n\n /**Construct***/\n function createAllBars() {\n calculateBarWidth();\n for (var i = 0; i < dataList.length; i++) {\n createBar(i);\n }\n }\n\n function createBar(index) {\n var dataPoint = dataList[index];\n var value = dataPoint.close;\n var x = xAxis.scale(index) - barWidth / 2;\n var baseY = yAxis.scale(0);\n var y = yAxis.scale(value);\n var height;\n\n\n\n if (value > 0) {\n height = baseY - y;\n } else {\n height = y - baseY;\n y = baseY;\n }\n\n x = trimToTwoDecimalDigits(x);\n height = trimToTwoDecimalDigits(height);\n y = trimToTwoDecimalDigits(y);\n var bar = barGroup.append(\"rect\")\n .attr({\n x: x,\n y: y,\n height: height,\n width: barWidth\n })\n .style({\n fill: BAR_COLOR\n });\n }\n\n /**Calculate***/\n function calculateBarWidth() {\n var barWithPadWidth = xAxis.scale(1) - xAxis.scale(0);\n barWidth = barWithPadWidth * 0.9;\n barCount = dataList.length;\n\n\n barWidth = trimToTwoDecimalDigits(barWidth);\n }\n}", "function drawScaleBar(layer, current) {\n layer[\"scaleCanvas\"].width = 60*window.devicePixelRatio;\n layer[\"scaleCanvas\"].height = 200*window.devicePixelRatio;\n\n let context = layer[\"scaleCanvasContext\"];\n\n context.setTransform(window.devicePixelRatio, 0, 0, window.devicePixelRatio, 0, 0);\n\n context.clearRect(0,0,60,200);\n context.fillStyle = \"rgba(255,255,255,0.6)\";\n context.fillRect(0, 0, 60, 200);\n if (layer[\"reverseBar\"]) {\n for (let i = 0; i < 185; i++) {\n context.fillStyle = getColorPoint(layer[\"colorRange\"], 1-(i/185));\n if (i === 184)\n context.fillRect(0, i, 20, 1);\n else\n context.fillRect(0, i, 20, 2);\n }\n }\n else {\n for (let i = 0; i < 185; i++) {\n context.fillStyle = getColorPoint(layer[\"colorRange\"], i/185);\n if (i === 184)\n context.fillRect(0, i, 20, 1);\n else\n context.fillRect(0, i, 20, 2);\n }\n }\n let currentAdjusted;\n if (typeof current !== 'undefined') {\n currentAdjusted = (current-layer[\"colorBounds\"][0])/(layer[\"colorBounds\"][1]-layer[\"colorBounds\"][0]);\n if (layer[\"reverseBar\"])\n currentAdjusted = 1-currentAdjusted;\n context.fillStyle = \"rgba(0,0,0,0.8)\";\n context.fillRect(0, Math.floor(currentAdjusted*185), 20, 1);\n }\n context.fillStyle = \"#000000\";\n context.font = \"12px Mukta\";\n context.textAlign = \"left\";\n if (layer[\"reverseBar\"]) {\n if (typeof current === 'undefined' || currentAdjusted > 0.08)\n context.fillText(layer[\"colorBounds\"][1].toString(), 22, 10);\n if (typeof current === 'undefined' || currentAdjusted < 0.92)\n context.fillText(layer[\"colorBounds\"][0].toString(), 22, 183);\n }\n else {\n if (typeof current === 'undefined' || currentAdjusted > 0.08)\n context.fillText(layer[\"colorBounds\"][0].toString(), 22, 10);\n if (typeof current === 'undefined' || currentAdjusted < 0.92)\n context.fillText(layer[\"colorBounds\"][1].toString(), 22, 183);\n }\n if (typeof current !== 'undefined') {\n context.font = \"bold 12px Mukta\";\n context.fillText(current.toString(), 22, Math.floor(Math.min(Math.max(currentAdjusted, 0.03), 0.96) * 185)+5);\n }\n\n context.fillStyle = \"rgba(255,255,255,0.6)\";\n context.fillRect(0, 185, 60, 15);\n context.fillStyle = \"#000000\";\n context.font = \"14px Mukta\";\n context.textAlign = \"center\";\n context.fillText(layer[\"unit\"].toString(),30,196);\n}", "function drawBars(start, end) {\r\n\r\n\t// Clear pervious unsorted bars\r\n\tctrl.clearRect(0, 0, 1000, 1500)\r\n\r\n\t// Styling of bars\r\n\tfor (let i = 0; i < len_of_arr; i++) {\r\n\r\n\t\t// Changing styles of bars\r\n\t\tctrl.fillStyle = \"blue\"\r\n\t\tctrl.shadowOffsetX = 2\r\n\t\t// ctrl.shadowColor = \"chocolate\";\r\n\t\t// ctrl.shadowBlur = 3;\r\n\t\t// ctrl.shadowOffsetY =5;\r\n\t\t\r\n\t\t\r\n\t\t// Size of rectangle of bars\r\n\t\tctrl.fillRect(25 * i, 300 - arr[i], 20, arr[i])\r\n\t\t\r\n\t\tif (visited[i]) {\r\n\t\t\tctrl.fillStyle = \"#006d13\"\r\n\t\t\tctrl.fillRect(25 * i, 300 - arr[i], 20, arr[i])\r\n\t\t\tctrl.shadowOffsetX = 2;\r\n\t\t}\r\n\t}\r\n\r\n\tfor (let i = start; i <= end; i++) {\r\n\t\tctrl.fillStyle = \"#e51e2a\";\r\n\t\tctrl.fillRect(25 * i, 300 - arr[i], 18, arr[i])\r\n\t\t// ctrl.fillStyle = \"#cdff6c\"\r\n\t\t// ctrl.fillRect(25 * i,300, 18, arr[i])\r\n\t\tvisited[i] = 1\r\n\t}\r\n}", "function drawVisualiser(bufferLength, x, barWidth, barHeight, dataArray){ //\n for (let i = 0; i < bufferLength; i++){\n barHeight = dataArray[i];\n ctx.save();\n ctx.translate(canvas.width/2, canvas.height/2);\n ctx.rotate(i * Math.PI * 2 / bufferLength);\n const red = i * barHeight/30 ;\n const green = i/2 ;\n const blue = barHeight ;\n ctx.fillStyle = 'white'; //Couleur des barre qui réagisse au son\n ctx.fillRect( 0, 0, barWidth, 15);\n ctx.fillStyle = 'rgb('+ red + ',' + green + ',' + blue + ')';\n ctx.fillRect(0, 0, barWidth, barHeight);\n x += barWidth;\n ctx.restore();\n }\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 addBarLines(event){\n if (event.target && event.keyCode == 84){\n areLines = !areLines;\n if (areLines){\n for (let i = 0; i < arr.length; i++){\n data.children[i].style.setProperty('transition-duration', '0s');\n data.children[i].style.boxSizing = 'border-box';\n data.children[i].style.borderStyle = 'solid';\n data.children[i].style.borderWidth = '0px 1px 0px 1px';\n data.children[i].style.borderColor = '#B0B0B0';\n }\n }else{\n for (let i = 0; i < arr.length; i++){\n data.children[i].style.setProperty('transition-duration', '0s');\n data.children[i].style.setProperty('box-sizing', 'initial');\n data.children[i].style.setProperty('border-style', 'initial');\n data.children[i].style.setProperty('border-width', 'initial');\n data.children[i].style.setProperty('border-color', 'initial');\n }\n }\n }else{\n if (areLines){\n event.style.boxSizing = 'border-box';\n event.style.borderStyle = 'solid';\n event.style.borderWidth = '0px 1px 0px 1px';\n event.style.borderColor = '#B0B0B0';\n }\n }\n\n}", "_drawStave() { // function to draw the stave, 5 lines of 12 bars - equaling 4 minutes per track\n var barLength = 80;\n this.numOfStaves = 0;\n this.canvasCtx.canvas.height = 360;\n for (var x = 0; x < 5; x++) {\n for (var i = 0; i < 12; i++) {\n this.canvasCtx.beginPath();\n this._drawLine(30 + (i * barLength), 10 + (this.numOfStaves * this.staveOffset), 110 + (i * barLength), 10 + (this.numOfStaves * this.staveOffset))\n this._drawLine(30 + (i * barLength), 20 + (this.numOfStaves * this.staveOffset), 110 + (i * barLength), 20 + (this.numOfStaves * this.staveOffset))\n this._drawLine(30 + (i * barLength), 30 + (this.numOfStaves * this.staveOffset), 110 + (i * barLength), 30 + (this.numOfStaves * this.staveOffset))\n this._drawLine(30 + (i * barLength), 40 + (this.numOfStaves * this.staveOffset), 110 + (i * barLength), 40 + (this.numOfStaves * this.staveOffset))\n this._drawLine(30 + (i * barLength), 50 + (this.numOfStaves * this.staveOffset), 110 + (i * barLength), 50 + (this.numOfStaves * this.staveOffset))\n this._drawLine(110 + (i * barLength), 10 + (this.numOfStaves * this.staveOffset), 110 + (i * barLength), 50 + (this.numOfStaves * this.staveOffset))\n this._drawLine(30 + (i * barLength), 10 + (this.numOfStaves * this.staveOffset), 30 + (i * barLength), 50 + (this.numOfStaves * this.staveOffset))\n }\n this.numberOfTracks++;\n this.numOfStaves++;\n }\n }", "function drawBarGraph() {\n var xAxisDots = chartValues.length,\n xAxisDotsWidth = width / xAxisDots,\n xPos = xAxisDotsWidth / 2,\n yAxisDotsWidth = height / (maxChartValue + 2),\n yPos = height - xAxisDotsWidth / 2,\n graphHeight = height - xAxisDotsWidth / 3,\n lineStroke = (xAxisDotsWidth / 3) * 2;\n\n console.log(xAxisDots,\n xAxisDotsWidth,\n xPos,\n yAxisDotsWidth,\n yPos,\n graphHeight,\n lineStroke);\n\n var lineGroup, lineArray = [];\n for (var i = 0; i < chartValues.length; i++) {\n\n var line, t = graphHeight;\n\n var y2Pos = graphHeight - (chartValues[i] * yAxisDotsWidth);\n // console.log(typeof chartValues[i], i)\n\n console.log('Inside For loop....');\n // two.bind('update', function(frameCount) {\n var currValue = 0;\n if (t > y2Pos) {\n line = two.makeLine(\n xPos,\n yPos,\n xPos,\n /*t*/\n y2Pos\n );\n line.linewidth = lineStroke;\n line.cap = 'round';\n line.stroke = '#FF8000';\n t = t - 10;\n }\n // }).play();\n lineArray.push(line);\n xPos = xPos + xAxisDotsWidth;\n }\n lineGroup = two.makeGroup(lineArray);\n // console.log(lineGroup);\n // lineGroup.opacity = 0.5; \n\n // animation is done here -- tranlating whole svg graph\n\n // lineGroup.translation.y = height;\n // two.bind('update', function(frameCount) {\n // if (lineGroup.translation.y > 0) {\n // lineGroup.translation.y = lineGroup.translation.y - 10;\n // } else {\n // console.log(lineGroup.translation.y);\n // }\n // }).play();\n\n\n\n two.update();\n animateGraph();\n }", "function drawBarTwo(x, y, width, data, color) {\n ctx.beginPath();\n ctx.rect(x, y, width, data, color);\n ctx.fillStyle = \"#0099ff\";\n ctx.fill();\n }", "function showBarClick() {\n fill(currentColor);\n noStroke();\n translate(-25,0);\n for (var i = 0; i < spectrum.length; i++) {\n var x = map(i, 0, spectrum.length, 0, width);\n var h = -height + map(spectrum[i], 0, 255, height, 0);\n rect(x + w, height, width / spectrum.length - 3, h);\n }\n}", "function renderBarChart() {\n drawAxisCalibrations();\n var i, j, p, a, x, y, w, h, len;\n\n if (opts.orient === \"horiz\") {\n rotate();\n }\n\n drawAxis();\n\n ctx.lineWidth = opts.stroke || 1;\n ctx.lineJoin = \"miter\";\n\n len = sets[0].length;\n\n // TODO fix right pad\n for (i = 0; i < sets.length; i++) {\n for (j = 0; j < len; j++) {\n p = 1;\n a = rotated ? height : width;\n w = ((a / len) / sets.length) - ((p / sets.length) * i) - 1;\n x = (p / 2) + getXForIndex(j, len + 1) + (w * i) + 1;\n y = getYForValue(sets[i][j]);\n h = y - getYForValue(0) || !isNaN(opts.mapZeroValueTo) && +opts.mapZeroValueTo || 0;\n\n if (isStacked()) {\n // TODO account for negative and positive values in same stack\n w = (a / len) - 2;\n x = getXForIndex(j, len + 1);\n //y = getYForValue(sumY(sets.slice(0, i + 1), j));\n \n // Accounting for negative and positive values in same stack\n y = getYForValue(sumYSigned(sets, i, j));\n }\n\n drawRect(colorOf(i), x, y, w, h);\n }\n }\n }", "drawAxes() {\n this.drawLabels([\n { label: LightTypes.A, column: 9 },\n { label: LightTypes.B, column: 10 },\n ])\n\n let colLabels = new Array(8).fill(null).map((_, i) => ({ label: `${i + 1}`, column: i }))\n this.drawLabels(colLabels)\n\n this.ctx.beginPath()\n this.ctx.strokeStyle = \"black\"\n this.ctx.moveTo(0, this.maxDrawH * 1.01)\n this.ctx.lineTo(this.w, this.maxDrawH * 1.01)\n this.ctx.moveTo(8 * this.barColumnW + this.barColumnW / 2, this.h)\n this.ctx.lineTo(8 * this.barColumnW + this.barColumnW / 2, 0)\n this.ctx.stroke()\n }", "function drawBar(item) {\r\n\tif (item != null) {\r\n\t\t// scale then rotate a cube to form a bar\r\n\t\tmvMatrix = mult(mvMatrix, translate(0, -1.1, item.distance / 2))\r\n\t\tmvMatrix = mult(mvMatrix, scalem(0.1, 0.1, item.distance,))\r\n\t\tgl.uniformMatrix4fv(modelView, false, flatten(mvMatrix));\r\n\t\tdrawCube(vec4(0.2, 0.2, 0.2, 1.0));\r\n\r\n\t\t// Restore model view matrix\r\n\t\tmvMatrix = stack.pop();\r\n\t\tstack.push(mvMatrix);\r\n\t}\r\n}", "drawAllLinesAndBars(select){\n // Draws bar under currently executing line\n if(this.activeLine !== null){\n if(this.executable)\n ctx.fillStyle = ACTIVE_EXEC;\n else\n ctx.fillStyle = WAIT_EXEC;\n this.drawBar(\n this.activeLine, 0, this.lineW, ctx.fillStyle,\n CHAR_GAP, CHAR_GAP-2\n );\n }\n\n // Draws bars under selected text, as well as the text itself\n for(let i=0; i<this.maxLines; i++){\n if(!this.lines.strGet(i)) continue; // String is empty\n\n let selectStart = -1;\n let selectEnd = -1;\n // Draws bar under selected text\n if(select !== null && select.lineSelected(i)){\n if(select.range.lowerLineI < i)\n selectStart = 0;\n else\n selectStart = select.range.lowerCharI;\n\n if(select.range.upperLineI > i)\n selectEnd = this.lines.strLen(i);\n else\n selectEnd = select.range.upperCharI;\n\n this.drawBar(i, selectStart, selectEnd, SELECT_GRAY);\n }\n\n let commentStart = this.lines.strGet(i).indexOf(\"#\");\n if(this.activeLine === i){\n this.drawLine(i, BLACK);\n }else if(commentStart === -1 && selectStart === -1){\n this.drawLine(i, DIM_WHITE);\n }else{\n this.drawSplitLine(i, commentStart, selectStart, selectEnd);\n }\n }\n\n // Blinking thingy\n if(select !== null){\n let blinkTime = (Date.now() - select.cursorBlink) % 800;\n if(blinkTime < 400){ // Blink every 0.8s\n this.drawBar(\n select.cursor.lineI, select.cursor.charI,\n select.cursor.charI+1, CURSOR_WHITE\n );\n }\n }\n }", "depleteBar(amount){\n\t\tthis.status -= amount;\n\t\tthis.clampScale();\n\t\tthis.blueBar.scale.setTo(this.status, .617);\n\t}", "function drawSeriesBars(series) {\n\t\t\tfunction plotBars(data, barWidth, offset, fill){\n\t\t\t\tif(data.length < 2)\n\t\t\t\t\treturn;\n\t\n\t\t\t\tfor(var i = 0; i < data.length; i++){\n\t\t\t\t\tvar x = data[i][0], y = data[i][1];\n\t\t\t\t\tvar drawLeft = true, drawTop = true, drawRight = true;\n\t\t\t\t\tvar left = x, right = x + barWidth, bottom = 0, top = y;\n\t\n\t\t\t\t\tif(right < xaxis.min || left > xaxis.max || top < yaxis.min || bottom > yaxis.max)\n\t\t\t\t\t\tcontinue;\n\t\n\t\t\t\t\tif(left < xaxis.min){\n\t\t\t\t\t\tleft = xaxis.min;\n\t\t\t\t\t\tdrawLeft = false;\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif(right > xaxis.max){\n\t\t\t\t\t\tright = xaxis.max;\n\t\t\t\t\t\tdrawRight = false;\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif(bottom < yaxis.min)\n\t\t\t\t\t\tbottom = yaxis.min;\n\t\n\t\t\t\t\tif(top > yaxis.max){\n\t\t\t\t\t\ttop = yaxis.max;\n\t\t\t\t\t\tdrawTop = false;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t/**\n\t\t\t\t\t * Fill the bar.\n\t\t\t\t\t */\n\t\t\t\t\tif(fill){\n\t\t\t\t\t\tctx.beginPath();\n\t\t\t\t\t\tctx.moveTo(tHoz(left), tVert(bottom) + offset);\n\t\t\t\t\t\tctx.lineTo(tHoz(left), tVert(top) + offset);\n\t\t\t\t\t\tctx.lineTo(tHoz(right), tVert(top) + offset);\n\t\t\t\t\t\tctx.lineTo(tHoz(right), tVert(bottom) + offset);\n\t\t\t\t\t\tctx.fill();\n\t\t\t\t\t}\n\t\n\t\t\t\t\t/**\n\t\t\t\t\t * Draw bar outline/border.\n\t\t\t\t\t */\n\t\t\t\t\tif(drawLeft || drawRight || drawTop){\n\t\t\t\t\t\tctx.beginPath();\n\t\t\t\t\t\tctx.moveTo(tHoz(left), tVert(bottom) + offset);\n\t\t\t\t\t\tif(drawLeft) ctx.lineTo(tHoz(left), tVert(top) + offset);\n\t\t\t\t\t\telse ctx.moveTo(tHoz(left), tVert(top) + offset);\n\t\t\t\t\t\tif(drawTop) ctx.lineTo(tHoz(right), tVert(top) + offset);\n\t\t\t\t\t\telse ctx.moveTo(tHoz(right), tVert(top) + offset);\n\t\t\t\t\t\tif(drawRight) ctx.lineTo(tHoz(right), tVert(bottom) + offset);\n\t\t\t\t\t\telse ctx.moveTo(tHoz(right), tVert(bottom) + offset);\n\t\t\t\t\t\tctx.stroke();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tctx.save();\n\t\t\tctx.translate(plotOffset.left, plotOffset.top);\n\t\t\tctx.lineJoin = 'round';\n\t\n\t\t\tvar bw = series.bars.barWidth;\n\t\t\t/**\n\t\t\t * @todo linewidth not interpreted the right way.\n\t\t\t */\n\t\t\tvar lw = Math.min(series.bars.lineWidth, bw);\n\t\t\t/**\n\t\t\t * @todo figure out a way to add shadows.\n\t\t\t */\n\t\t\t/*\n\t\t\tvar sw = series.shadowSize;\n\t\t\tif (sw > 0) {\n\t\t\t\t// draw shadow in two steps\n\t\t\t\tctx.lineWidth = sw / 2;\n\t\t\t\tctx.strokeStyle = \"rgba(0,0,0,0.1)\";\n\t\t\t\tplotBars(series.data, bw, lw/2 + sw/2 + ctx.lineWidth/2, false);\n\t\n\t\t\t\tctx.lineWidth = sw / 2;\n\t\t\t\tctx.strokeStyle = \"rgba(0,0,0,0.2)\";\n\t\t\t\tplotBars(series.data, bw, lw/2 + ctx.lineWidth/2, false);\n\t\t\t}*/\n\t\n\t\t\tctx.lineWidth = lw;\n\t\t\tctx.strokeStyle = series.color;\n\t\t\tif(series.bars.fill){\n\t\t\t\tctx.fillStyle = series.bars.fillColor != null ? series.bars.fillColor : parseColor(series.color).scale(null, null, null, 0.4).toString();\n\t\t\t}\n\t\n\t\t\tplotBars(series.data, bw, 0, series.bars.fill);\n\t\t\tctx.restore();\n\t\t}", "function drawBar(x, y, width, data, color) {\n ctx.beginPath();\n ctx.rect(x, y, width, data, color);\n ctx.fillStyle = \"#ff3300\";\n ctx.fill();\n }", "function drawBar(data){\nvar svg = d3.select(\"#chart2\").append(\"svg\")\n\t\t\t.attr(\"width\", width)\n\t\t\t.attr(\"height\", height)\n\t\t\t.attr(\"transform\", \"translate(0,0)\"),\n margin = {top: 20, right: 20, bottom: 30, left: 40},\n width = +svg.attr(\"width\") - margin.left - margin.right,\n height = +svg.attr(\"height\") - margin.top - margin.bottom,\n g = svg.append(\"g\").attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\n\nvar x0 = d3.scaleBand()\n .rangeRound([0, width])\n .paddingInner(0.1);\n\nvar x1 = d3.scaleBand()\n .padding(0.05);\n\nvar y = d3.scaleLinear()\n .rangeRound([height, 0]);\n\nvar z = d3.scaleOrdinal(d3.schemeCategory10);\ndata.forEach(function(d, i){\n\n x0.domain(d.value.race.keys());\n x1.domain(d.value.race.keys()).rangeRound([0, x0.bandwidth()]);\n y.domain([0, 10]).nice();\n\n g.append(\"g\")\n .selectAll(\"g\")\n .data(data)\n .enter().append(\"g\")\n .attr(\"transform\", function(d) { \n\t \n\t return \"translate(\" + x0(d.State) + \",0)\"; })\n .selectAll(\"s3_rect\")\n .data(function(d) { return 10;})\n .enter().append(\"s3_rect\")\n .attr(\"x\", function(d) { return x1(d.key); })\n .attr(\"y\", function(d) { return y(d.value); })\n .attr(\"width\", x1.bandwidth())\n .attr(\"height\", function(d) { return height - y(d.value); })\n .attr(\"fill\", function(d) { return z(d.key); });\n\n g.append(\"g\")\n .attr(\"class\", \"s3_axis\")\n .attr(\"transform\", \"translate(0,\" + height + \")\")\n .call(d3.axisBottom(x0));\n\n g.append(\"g\")\n .attr(\"class\", \"s3_axis\")\n .call(d3.axisLeft(y).ticks(null, \"s\"))\n .append(\"text\")\n .attr(\"x\", 2)\n .attr(\"y\", y(y.ticks().pop()) + 0.5)\n .attr(\"dy\", \"0.32em\")\n .attr(\"fill\", \"#000\")\n .attr(\"font-weight\", \"bold\")\n .attr(\"text-anchor\", \"start\")\n .text(\"Population\");\n\n var legend = g.append(\"g\")\n .attr(\"font-family\", \"sans-serif\")\n .attr(\"font-size\", 10)\n .attr(\"text-anchor\", \"end\")\n .selectAll(\"g\")\n .data(d.value.race.keys())\n .enter().append(\"g\")\n .attr(\"transform\", function(d, i) { return \"translate(0,\" + i * 20 + \")\"; });\n\n legend.append(\"rect\")\n .attr(\"x\", width - 19)\n .attr(\"width\", 19)\n .attr(\"height\", 19)\n .attr(\"fill\", z);\n\n legend.append(\"text\")\n .attr(\"x\", width - 24)\n .attr(\"y\", 9.5)\n .attr(\"dy\", \"0.32em\")\n .text(function(d) { return d; });\n});\n}", "function drawBars() {\n var isStacked = graph.allSeries[seriesIndex].options.type ==='stackedBar',\n seriesSum = [],\n color,\n i=0,\n j = 0;\n\n if(isStacked) {\n for (j = 0; j < graph.numPoints; j++) {\n seriesSum.push(0);\n }\n for (j = 0; j < series.length; j++) {\n color = graph.options.colors[j];\n seriesSum = drawStackedBar(series[j], seriesSum, j+1, graph.yTicks[seriesIndex], color);\n }\n } else {\n barWidth = barWidth/series.length;\n\n for (i = 0; i < graph.numPoints; i++) {\n for(j=0; j < series.length; j++) {\n color = graph.options.colors[j];\n drawBar(series[j][i], i, j, graph.yTicks[seriesIndex], color);\n }\n }\n }\n\n graph.$el.bind('barDrawn', function(){$('.point-flag').fadeIn();});\n for (j = 0; j < series.length; j++) {\n drawPointFlags(series[j], seriesSum, j+1, graph.yTicks[seriesIndex]);\n }\n\n if (graph.tooltips && graph.tooltips.length) {\n for (j = 0; j < graph.numPoints; j++) {\n if (graph.tooltips[j] || graph.tooltips[j] === 0) {\n barHover(series, graph.yTicks[seriesIndex], j, isStacked);\n }\n }\n }\n\n }", "drawFrame(lineStyle, title, frame, fillStyle) { //hor: # of hor lines; ver: # of ver lines.\n /*Relative value for diff resolution*/\n let ver = lineStyle[1];\n /*Draw frame*/\n this.chart.fillStyle = fillStyle;\n this.chart.fillRect(this.space, this.space, this.len, this.hei);\n this.chart.fill();\n if (frame[0] == \"frame\"){\n this.chart.clearRect(this.space+frame[1],this.space+frame[1],this.len-frame[1]*2,this.hei-frame[1]*2);\n }else if(frame[0] == \"none\"){\n this.chart.clearRect(0, 0, this.ctx.width, this.ctx.height);\n }else{\n this.chart.clearRect(this.space + frame[1], this.space, this.len, this.hei - frame[1]);\n }\n\n /*Draw Ver line*/\n this.chart.strokeStyle = lineStyle[3];\n this.chart.lineWidth = 1;\n this.chart.beginPath();\n for(let i = 1; i < ver; i++){\n this.chart.moveTo(i * this.len/ver + this.space - 1, this.space + frame[1] + 26);\n this.chart.lineTo(i * this.len/ver + this.space - 1, this.space - frame[1] + this.hei);\n }\n this.chart.stroke();\n\n /*Draw Hor line & label*/\n var chartTop = this.findTop(this.max);\n var chartBom = (this.min > 0)? 0: this.min;\n var grids = lineStyle[0];//default value\n\n this.chart.font = \"10px Calibri\";\n this.chart.fillStyle =\"#373838\";\n this.chart.strokeStyle = lineStyle[2];\n this.chart.lineWidth = 1;\n this.chart.beginPath();\n\n for(let i = 0; i <= grids; i++){\n var txt = ( ((chartTop-chartBom)/ grids + chartBom) % 1 === 0)? i*((chartTop-chartBom)/ grids)+chartBom : (i*((chartTop-chartBom)/ grids)+chartBom).toFixed(2);\n this.chart.fillText(txt, this.space-25, this.hei+this.space - i*(this.hei-30)/grids - frame[1] + 2);\n if(lineStyle[4] && i>0){\n this.chart.moveTo(this.space+frame[1],Math.round(this.hei+this.space - i*(this.hei-30)/grids - frame[1]));\n this.chart.lineTo(this.space-frame[1]+this.len,Math.round(this.hei+this.space - i*(this.hei-30)/grids - frame[1]));\n }\n }\n this.chart.stroke();\n\n // draw chart title\n var fp = (isNaN(parseInt(this.dataSet.title[1])))?6:Math.round(parseInt(this.dataSet.title[1]) *0.3);//default font size is 20px\n var titleX = Math.round(this.ctx.width/2) - this.dataSet.title[0].length * fp;\n this.chart.fillStyle = fillStyle;\n this.chart.font = this.dataSet.title[1];\n this.chart.fillText(this.dataSet.title[0], titleX, this.space+22);\n this.chart.fill;\n\n // draw vertical label, rotate needed\n this.chart.rotate(270 * Math.PI / 180);\n this.chart.font = \"18px Calibri\";\n\n // default font size is \"18px Calibri\", make sure label is print in the middle\n this.chart.fillText(this.dataSet.dataLabel[0],-1 * Math.floor((this.hei + this.dataSet.dataLabel[0].length * 9 * 1.5) / 2), 15);\n this.chart.fill;\n this.chart.rotate( - 270 * Math.PI / 180);\n\n // draw horizontal label, rotate needed\n this.chart.font = \"18px Calibri\";\n\n // default font size is \"18px Calibri\" (lenth * 9 pixels), make sure label is print in the middle\n this.chart.fillText(this.dataSet.dataLabel[1], Math.floor((this.len - this.dataSet.dataLabel[1].length * 9) / 2) + this.space, this.hei + this.space + 30);// 30 pixels under the base line\n this.chart.fill;\n }", "function simpleViz(canvas) {\n var self = this\n this.canvas = document.getElementById('canvas')\n this.ctx = this.canvas.getContext(\"2d\")\n this.copyCtx = document.getElementById('canvas-copy').getContext(\"2d\")\n this.ctx.fillStyle = '#fff' \n this.barWidth = 10\n this.barGap = 4\n // We get the total number of bars to display\n this.bars = Math.floor(this.canvas.width / (this.barWidth + this.barGap))\n // This function is launched for each frame, together with the byte frequency data.\n this.update = function(byteFreq) {\n self.ctx.clearRect(0, 0, self.canvas.width, self.canvas.height)\n // We take an element from the byteFreq array for each of the bars.\n // Let's pretend our byteFreq contains 20 elements, and we have five bars...\n var step = Math.floor(byteFreq.length / self.bars)\n // `||||||||||||||||||||` elements\n // `| | | | | ` elements we'll use for our bars\n for (var i = 0; i < self.bars; i ++) {\n // Draw each bar\n var barHeight = byteFreq[i*step]\n self.ctx.fillRect(\n i * (self.barWidth + self.barGap), \n self.canvas.height - barHeight, \n self.barWidth, \n barHeight)\n self.copyCtx.clearRect(0, 0, self.canvas.width, self.canvas.height)\n self.copyCtx.drawImage(self.canvas, 0, 0)\n }\n }\n}", "drawPlot(ctx, curr_set, num_sets)\n{\n var xpt;\n var y1, y2;\n var bar_width;\n\n var max_bars = this.calcMaxBars();\n var set_width = this.calcBarWidth(max_bars);\n\n var color = this.colors[curr_set % 8];\n if ( color != null )\n ctx.strokeStyle = color;\n else\n ctx.strokeStyle = this.BLACK;\n\n var barData = new Array();\n barData = this.plotData[curr_set];\n\n // Draw each bar set\n for ( var indx=0; indx<barData.length; indx++ )\n {\n xpt = this.xScale*indx + this.xOrg + this.xScale/2.0;\n\n switch ( this.plotType )\n {\n case this.ADJACENT:\n default:\n bar_width = set_width/num_sets;\n xpt -= (set_width/2);\n xpt += (bar_width*curr_set);\n y1 = this.yOrg;\n y2 = this.yOrg - (barData[indx]-this.plotYMin)*this.yScale;\n break;\n\n case this.INLAID:\n bar_width = set_width - ((set_width/num_sets)*curr_set);\n xpt -= bar_width/2;\n y1 = this.yOrg;\n y2 = this.yOrg - (barData[indx]-this.plotYMin)*this.yScale;\n break;\n\n case this.STACKED:\n bar_width = set_width;\n xpt -= bar_width/2;\n\n // Sum up previous data points\n if ( curr_set > 0 )\n {\n var tmpData = new Array();\n var ytmp = 0;\n for ( var jndx=0; jndx<=curr_set; jndx++ )\n {\n tmpData = this.plotData[jndx];\n ytmp += tmpData[indx];\n }\n\n y1 = this.yOrg - ((ytmp-barData[indx])-this.plotYMin)*this.yScale;\n y2 = this.yOrg - (ytmp-this.plotYMin)*this.yScale;\n }\n else\n {\n y1 = this.yOrg;\n y2 = this.yOrg - (barData[indx]-this.plotYMin)*this.yScale;\n }\n break;\n\n case this.PERCENT:\n bar_width = set_width;\n xpt -= bar_width/2;\n\n // Sum up previous data points\n if ( curr_set > 0 )\n {\n var tmpData = new Array();\n var ytmp = 0;\n for ( var jndx=0; jndx<=curr_set; jndx++ )\n {\n tmpData = this.plotData[jndx];\n ytmp += tmpData[indx];\n }\n\n var yp1 = ((ytmp - barData[indx]) / this.percentData[indx]) * 100.0;\n var yp2 = (ytmp / this.percentData[indx]) * 100.0;\n\n y1 = this.yOrg - yp1*this.yScale;\n y2 = this.yOrg - yp2*this.yScale;\n }\n else\n {\n y1 = this.yOrg;\n y2 = this.yOrg - ((barData[indx] / this.percentData[indx]) * 100.0) * this.yScale;\n }\n break;\n }\n\n try\n {\n var lineargradient = ctx.createLinearGradient(xpt, y2, (xpt+bar_width), y1);\n lineargradient.addColorStop(0, this.WHITE);\n }\n catch ( ex )\n {\n }\n\n var bar_color;\n if ( this.color_bars_flag == true ) // Force color of bar to given values\n {\n if ( lineargradient )\n lineargradient.addColorStop(1, this.color_bars[indx]);\n bar_color = this.color_bars[indx];\n }\n else // Use standard color for this particular data set\n {\n if ( lineargradient )\n lineargradient.addColorStop(1, color);\n bar_color = color;\n }\n\n if ( lineargradient )\n ctx.fillStyle = lineargradient;\n\nvar xpp = xpt;\nvar bwidth = bar_width;\nif ( curr_set == this.highlightSet ) // What if highlite = 0 or last\n{\n xpp = xpt - 2;\n bwidth = bar_width + 4;\n}\nelse if ( curr_set == this.highlightSet - 1 )\n{\n xpp = xpt;\n bwidth = bar_width - 2;\n}\nelse if ( curr_set == this.highlightSet + 1 ) // What about the rest of the bars\n{\n xpp = xpt + 2;\n bwidth = bar_width - 2;\n}\n\n var bar_height = y1 - y2;\n //ctx.fillRect(xpt, y2, bar_width, bar_height);\n ctx.fillRect(xpp, y2, bwidth, bar_height);\n\n//Highlite: increase stroke width?\n//if ( this.highlightSet == curr_set )\n// ctx.lineWidth = 3;\n//else\n ctx.lineWidth = 1;\n\n ctx.strokeStyle = this.BLACK;\n //ctx.strokeRect(xpt, y2, bar_width, bar_height);\n ctx.strokeRect(xpp, y2, bwidth, bar_height);\n\n if ( this.threeD == true && barData[indx] != 0 &&\n (this.plotType == this.ADJACENT ||\n this.plotType == this.STACKED ||\n this.plotType == this.PERCENT ||\n (this.plotType == this.INLAID && curr_set == 0)) )\n {\n //this.drawShadows(ctx, bar_width, xpt, y2, bar_height, bar_color);\n this.drawShadows(ctx, bwidth, xpp, y2, bar_height, bar_color);\n }\n\n//ZZZZ\nif ( this.labelBars == true )\n ctx.drawTextCenter(this.xLabelsFont, this.xLabelsFontSize,\n xpp+bwidth/2, y2+30, barData[indx].toFixed(0));\n\n if ( this.plotType == this.PERCENT && barData[indx] != 0 )\n {\n ctx.strokeStyle = this.BLACK;\n ctx.drawTextCenter(this.xLabelsFont, this.xLabelsFontSize,\n xpp+bwidth/2, y2+bar_height/2, barData[indx] + \"\");\n //xpt+bar_width/2, y2+bar_height/2, barData[indx] + \"\");\n }\n }\n}", "function drawBar(obj) {\n\t// CREATE OBJECT IF NOT SPECIFIED\n\tobj = obj == undefined ? {} : obj;\n\t// DEFAULTS\n\tobj.width = obj.width == undefined ? 30 : obj.width;\n\tobj.height = obj.height == undefined ? 6 : obj.height;\n\tobj.color = obj.color == undefined ? '#555555' : obj.color;\n\tobj.fillColor = obj.fillColor == undefined ? '#88e281' : obj.fillColor;\n\tobj.filled = obj.filled == undefined ? 0.5 : obj.filled;\n\tobj.renderOnFull = obj.renderOnFull == undefined ? true : obj.renderOnFull;\n\tobj.label = obj.label == undefined ? '' : obj.label;\n\tobj.x = obj.x == undefined ? 30 : obj.x - (obj.width / 2);\n\tobj.y = obj.y == undefined ? 30 : obj.y - (obj.height / 2);\n\tif (obj.filled < 1 || obj.renderOnFull) {\n\t\tctx.lineJoin = 'round';\n\t\tctx.fillStyle = obj.color;\n\t\tctx.fillRect(obj.x - (obj.width / 2), obj.y - (obj.height / 2), obj.width,\n\t\t\tobj.height);\n\t\tctx.fillStyle = obj.fillColor;\n\t\tctx.fillRect(obj.x - (obj.width / 2) + 1, (obj.y - (obj.height / 2)) + 1,\n\t\t\tobj.filled * (obj.width - 2), obj.height - 2);\n\n\t\tdrawText({\n\t\t\ttext: obj.label,\n\t\t\tx: obj.x,\n\t\t\ty: obj.y + 3,\n\t\t\tfont: `${obj.height - 5}px Ubuntu`\n\t\t})\n\t}\n}", "function barShow(){\n let barX = bgLeft + 800;\n fill(127);\n noStroke();\n rectMode(CORNER);\n\n for(let i = 0; i < 9; i++){\n rect(barX, bar.y, bar.sizeX, bar.sizeY);\n barTouch(barX,bar.sizeY,bar.y);\n barX += 600;\n\n }\n if(bar.sizeY <= bottom && bar.sizeY > cieling){\n shouldGrow();\n }\n\n else if(bar.sizeY <= cieling && bar.sizeY < bottom){\n shouldShrink();\n }\n else if(bar.sizeY == 0){\n cieling = -496;\n }\n}", "function drawBars() {\n\n xScale.domain(d3.range(actividades_jaca.length));\n yScale.domain([0, d3.max(actividades_jaca, function(d) {\n return +d.value;\n })]);\n\n bar_color.domain(d3.range(function(d) {\n return d.act_descripcion;\n }));\n var myBars = svgBar.selectAll('svgBar').data(actividades_jaca);\n\n myBars.enter()\n .append('rect')\n .attr('class', 'addon')\n .attr('x', function(d, i) {\n return xScale(i);\n })\n .attr('y', function(d) {\n return height - yScale(d.value);\n })\n .attr('width', xScale.rangeBand())\n .attr('height', function(d) {\n return yScale(d.value);\n })\n .attr('fill', function(d) {\n return bar_color(d.act_descripcion);\n })\n .on('mouseover', function(d) {\n d3.select(this)\n .style('stroke-width', 0.5)\n .style('stroke', 'red');\n tooltipTitle.html(d.act_descripcion);\n tooltipTotal.html(d.value);\n })\n .on('mouseout', function() {\n d3.select(this)\n .style('stroke-width', 0);\n tooltipTitle.html('Número de empresas');\n tooltipTotal.html(totalActividades);\n });\n }", "function drawGreyedBars(_block) {\n var womenPick = _block[0];\n var malePick = _block[1];\n console.log(womenPick);\n console.log(malePick);\n\n //Percentage Label\n var wSal = getSalaryForSexRace(womenPick.sex, womenPick.race);\n var mSal = getSalaryForSexRace(malePick.sex, malePick.race);\n\n var percentageToDisplay = Math.round((wSal / mSal) * 100);\n\n document.getElementById(\"percentSalary\").innerHTML = percentageToDisplay + \"%\";\n\n //Bars\n function greyOut(point) {\n var greyedOut = !(womenPick.sex == point.sex && womenPick.race == point.race) && !(malePick.sex == point.sex && malePick.race == point.race);\n return greyedOut;\n }\n\n //remove the ones no longer being used\n rects.exit()\n .transition()\n .duration(1000)\n .style(\"opacity\", 1)\n .remove();\n\n //update the bars\n rects\n .transition()\n .duration(1000)\n .attr('fill', function (d) {\n if (d.sex === 'Female') {\n return '#007F75'\n } else return '#FF7B5C';\n })\n .attr('opacity', function (d) {\n if (greyOut(d)) {\n return 0.4;\n } else {\n return 1.0;\n }\n });\n\n labelsContainerSex.selectAll('text')\n .transition()\n .duration(1000)\n .attr('opacity', function (d) {\n if (greyOut(d)) {\n return 0.4;\n } else {\n return 1.0;\n }\n });\n\n labelsContainerRace.selectAll('text')\n .transition()\n .duration(1000)\n .attr('opacity', function (d) {\n if (greyOut(d)) {\n return 0.4;\n } else {\n return 1.0;\n }\n });\n\n }", "function Scrollbar(x,y,length,orientation,color)\n{\n\tthis.index;\n\tthis.bar;\n\tthis.x=x;\n\tthis.y=y;\n\tthis.orientation=orientation;\n\tthis.length=length-2;\n\tthis.color=color?color:'';\n\n\tthis.draw=function(index, range)\n\t{\n\t\tif(index>range)\n\t\t\treturn;\n\t\tif((isNaN(index) || isNaN(range)) &&\n\t\t\t(!this.index || !this.bar))\n\t\t\treturn;\n\n\t\tthis.index=Math.ceil(((index+1)/range)*this.length);\n\t\tthis.bar=Math.ceil((this.length/range)*this.length);\n\n\n\t\tif(this.orientation == \"vertical\")\n\t\t\tthis.drawVert(this.index,this.index+this.bar);\n\t\telse\n\t\t\tthis.drawHoriz(this.index,this.index+this.bar);\n\t}\n\tthis.drawVert=function(s,f)\n\t{\n\t\tconsole.gotoxy(this);\n\t\tconsole.putmsg('\\1n' + this.color + ascii(30),P_SAVEATR);\n\t\tvar ch='\\xB0';\n\t\tfor(var i=1;i<=this.length;i++)\t{\n\t\t\tconsole.gotoxy(this.x,this.y+i);\n\t\t\tif(i == s) \n\t\t\t\tch='\\1h\\xDB';\n\t\t\telse if(i > f) \n\t\t\t\tch='\\xB0';\n\t\t\tconsole.putmsg(ch,P_SAVEATR);\n\t\t}\n\t\tconsole.gotoxy(this.x,this.y+this.length+1);\n\t\tconsole.putmsg(ascii(31),P_SAVEATR);\n\t}\n\tthis.drawHoriz=function(s,f)\n\t{\n\t\tif(f > this.length) {\n\t\t\ts--;\n\t\t\tf--;\n\t\t}\n\t\tconsole.gotoxy(this);\n\t\tconsole.putmsg('\\1n' + this.color + ascii(17),P_SAVEATR);\n\t\tfor(i=1;i<=this.length;i++)\t{\n\t\t\tif(i == s) \n\t\t\t\tch='\\1h\\xDB';\n\t\t\telse if(i == f+1)\n\t\t\t\tch='\\xB0';\n\t\t\tconsole.putmsg(ch,P_SAVEATR);\n\t\t}\n\t\tconsole.putmsg(ascii(16),P_SAVEATR);\n\t}\n}", "function barChartPlotter(e) {\n\tvar stacked = e.dygraph.getOption(\"stackedGraph\");\n\t\n\tconsole.log(e.color);\n\t \n\tvar ctx = e.drawingContext;\n\tvar points = e.points;\n\tvar y_bottom = e.dygraph.toDomYCoord(0);\n\n\t//if (stacked)ctx.fillStyle = darkenColor(e.color);\n\tif (stacked)ctx.fillStyle = e.color;\n\telse\t\t{\n\t\tctx.beginPath();\n\t\tctx.strokeStyle = e.color;\n\t}\n\t\n\t// Find the minimum separation between x-values.\n\t// This determines the bar width.\n\t/*var min_sep = Infinity;\n\tfor (var i = 1; i < points.length; i++) {\n\t\tvar sep = points[i].canvasx - points[i - 1].canvasx;\n\t\tif (sep < min_sep) min_sep = sep;\n\t}\n\tvar bar_width = min_sep;*/\n\tvar bar_width = points[1].canvasx - points[0].canvasx;\n\t\n\t// Do the actual plotting.\n\tfor (var i = 0; i < points.length; i++) {\n\t\tvar p = points[i];\n\t\tvar center_x = p.canvasx;\n\n\t\tif (stacked)ctx.fillRect(center_x - bar_width / 2, p.canvasy, bar_width + 1, y_bottom - p.canvasy);\n\t\telse {\n\t\t\tif (i > 0) {\n\t\t\t\tctx.moveTo(center_x - bar_width / 2, points[i-1].canvasy);\n\t\t\t\tctx.lineTo(center_x - bar_width / 2, p.canvasy);\n\t\t\t}\n\t\t\t\n\t\t\tctx.lineTo(center_x + bar_width / 2, p.canvasy);\n\t\t\t\n\t\t\tif (i < points.length - 1) {\n\t\t\t\tctx.lineTo(center_x + bar_width / 2, points[i+1].canvasy);\n\t\t\t\tctx.stroke();\n\t\t\t}\n\t\t}\n\t}\n }", "function drawBasic() {\n // Create our data table.\n var data = google.visualization.arrayToDataTable([\n [\n \"Features\",\n \"# of participants\",\n { role: \"style\" },\n { role: \"annotation\" },\n ],\n [\"Focus Toggle\", 4, \"fill-color:111111;\", \"4\"],\n [\"Focus Timer\", 3, \"fill-color:111111;\", \"3\"],\n [\"Task Breaker\", 1, \"fill-color:111111;\", \"1\"],\n ]);\n\n // Set chart options\n var options = {\n animation: {\n duration: 1000,\n easing: \"in\",\n startup: true, //This is the new option\n },\n chart: {\n title: \"Most Helpful Feature\",\n subtitle: \"Sales, Expenses, and Profit: 2014-2017\",\n },\n bars: \"horizontal\",\n\n backgroundColor: \"#FAFAFA\",\n\n fontSize: 14,\n fontName: \"Open Sans\",\n titleTextStyle: {\n color: \"#666\",\n fontName: \"Open Sans\",\n fontSize: 18,\n bold: 1,\n italic: 0,\n },\n legend: { position: \"none\" },\n annotations: {\n textStyle: {\n fontName: \"Open Sans\",\n fontSize: 14,\n bold: 0,\n italic: false,\n // The color of the text.\n color: \"white\",\n\n // The transparency of the text.\n opacity: 1,\n },\n },\n\n hAxis: {\n title: \"# of participants\",\n\n minValue: 0,\n maxValue: 10,\n \n },\n vAxis: {\n title: \"Features\",\n \n },\n };\n\n // Instantiate and draw our chart, passing in some options.\n var chart = new google.charts.Bar(\n document.getElementById(\"chart_div_fav\")\n );\n\n chart.draw(data, google.charts.Bar.convertOptions(options));\n }", "function createBars(barHeight, barColor, skipLatestSlides, bottomPosition) {\n deleteBars(); \n \n var slides = presentation.getSlides();\n var numSlides = slides.length - skipLatestSlides;\n \n for (var i = 0; i < numSlides; ++i) {\n var ratioComplete = (i / (numSlides - 1));\n var x = 0;\n var y = bottomPosition==\"true\"? presentation.getPageHeight() - barHeight : 0;\n var barWidth = presentation.getPageWidth() * ratioComplete;\n \n if (barWidth > 2) {\n var bar = slides[i].insertShape(SlidesApp.ShapeType.RECTANGLE, x, y, barWidth, barHeight);\n bar.getFill().setSolidFill(barColor);\n bar.getBorder().setTransparent();\n bar.setLinkUrl(BAR_ID);\n }\n }\n}", "function makeBarGraph(penPos, penNeg, strPos, strNeg, neoPos, neoNeg) {\n \n var posTotal = 0;\n var posCount = 0;\n for (var i = 0; i < penPos.length; i++) { \n var pos = penPos[i];\n posTotal += pos;\n posCount++;\n }\n var posPenMean = posTotal / posCount;\n \n var negTotal = 0;\n var negCount = 0; \n for (var i = 0; i < penNeg.length; i++) {\n var neg = penNeg[i];\n negTotal += neg;\n negCount++;\n }\n var negPenMean = negTotal / negCount; \n\n var posStrTotal = 0;\n var posStrCount = 0;\n for (var i = 0; i < strPos.length; i++) { \n var pos = strPos[i];\n posStrTotal += pos;\n posStrCount++;\n }\n var posStrMean = posStrTotal / posCount;\n\n var negStrTotal = 0;\n var negStrCount = 0; \n for (var i = 0; i < strNeg.length; i++) {\n var neg = strNeg[i];\n negStrTotal += neg;\n negStrCount++;\n }\n var negStrMean = negStrTotal / negStrCount; \n\n\n var posNeoTotal = 0;\n var posNeoCount = 0;\n for (var i = 0; i < neoPos.length; i++) { \n var pos = strPos[i];\n posNeoTotal += pos;\n posNeoCount++;\n }\n var posNeoMean = posNeoTotal / posNeoCount;\n\n var negNeoTotal = 0;\n var negNeoCount = 0; \n for (var i = 0; i < strNeg.length; i++) {\n var neg = strNeg[i];\n negNeoTotal += neg;\n negNeoCount++;\n }\n var negNeoMean = negNeoTotal / negNeoCount;\n\n // plotting the positive means of the MIC levels for each treatment on left column (bar) \n // of each grouped bar\n\n var column1 = {\n x: ['Penicilin', 'Streptomycin', 'Neomycin'],\n y: [posPenMean, posStrMean, posNeoMean],\n name: 'Positive',\n type: 'bar'\n };\n\n // plotting the negative means of the MIC levels for each treatment on right column (bar)\n // of each grouped bar\n var column2 = {\n x: ['Penicilin' , 'Streptomycin', 'Neomycin'],\n y: [negPenMean, negStrMean, negNeoMean],\n name: 'Negative',\n type: 'bar'\n };\n \n // grouping the left and right column together for each group\n var data = [column1, column2];\n var layout = {barmode: 'group'};\n Plotly.newPlot('graph1', data, layout, {staticPlot: true});\n\n}", "function draw() {\n background(0);\n strokeWeight(1);\n\n if (drawArr) {\n for (let i = 0; i < width; ++i) {\n const col = drawMark[i];\n if (col) {\n stroke(col.r, col.g, col.b);\n } else {\n stroke(150);\n }\n line(i + 1, height, i + 1, height - drawArr[i]);\n }\n }\n}", "function drawBarChart(evt) {\n //this prevents from touch and click working simultaneously \n evt.preventDefault();\n context.clearRect(0, 0, WIDTH, HEIGHT);\n barChart();\n}", "function drawBar(key, value) {\n\n // outer div \"lane\" of the bar\n let divLine = document.createElement(\"div\");\n divLine.className = \"ganttLine Line\" + (key + 1);\n divLine.id = \"demo-tooltip-mouse\" + key;\n divLine.style.top = 18 * key + \"px\";\n\n // Title of the Massnahme\n let titleSpan = document.createElement(\"span\");\n titleSpan.className = \"ganttTitle gTitle\" + (key + 1) + \" unselectable\";\n titleSpan.innerHTML = \"\" + value.title;\n\n // the actual bar\n let div = document.createElement(\"div\");\n let startdate = new Date(value.Startdatum);\n let enddate = new Date(value.Enddatum);\n let startofyear = new Date(2020, 0, 0);\n\n div.className = \"barElement bar\" + (key + 1);\n div.id = \"bar\" + (key + 1);\n\n // use widthFromDate function to calculate the with and the starting point of bar & text\n div.style.width = \"\" + widthFromDate(startdate, enddate) + \"px\";\n div.style.left = \"\" + widthFromDate(startofyear, startdate) + \"px\";\n titleSpan.style.left = widthFromDate(startofyear, startdate) - (12) + \"px\";\n\n document.getElementById(\"ganttContainer\").appendChild(divLine);\n document.getElementById(\"demo-tooltip-mouse\" + key).appendChild(titleSpan);\n document.getElementById(\"demo-tooltip-mouse\" + key).appendChild(div);\n\n // Tooltipp divs\n $(\"#demo-tooltip-above\").jBox(\"Tooltip\", {\n theme: \"TooltipDark\",\n });\n\n $(\"#demo-tooltip-mouse\" + key).jBox(\"Mouse\", {\n theme: \"TooltipDark\",\n content:\n \"<b> Zeitraum: \" +\n value.Startdatum +\n \"-\" +\n value.Enddatum +\n \"<br> Massnahmen: \" +\n value.massnahme +\n \"</b>\",\n });\n}", "function simpleViz(canvas) {\n var self = this;\n this.canvas = document.getElementById(\"canvas\");\n this.ctx = this.canvas.getContext(\"2d\");\n this.copyCtx = document.getElementById(\"canvas-copy\").getContext(\"2d\");\n this.ctx.fillStyle = \"#fff\";\n this.barWidth = 4;\n this.barGap = 2;\n // We get the total number of bars to display\n this.bars = Math.floor(this.canvas.width / (this.barWidth + this.barGap));\n // This function is launched for each frame, together with the byte frequency data.\n this.update = function (byteFreq) {\n self.ctx.clearRect(0, 0, self.canvas.width, self.canvas.height);\n // We take an element from the byteFreq array for each of the bars.\n // Let's pretend our byteFreq contains 20 elements, and we have five bars...\n var step = Math.floor(byteFreq.length / self.bars);\n // `||||||||||||||||||||` elements\n // `| | | | | ` elements we'll use for our bars\n for (var i = 0; i < self.bars; i++) {\n // Draw each bar\n var barHeight = byteFreq[i * step];\n self.ctx.fillRect(\n i * (self.barWidth + self.barGap),\n self.canvas.height - barHeight,\n self.barWidth,\n barHeight\n );\n self.copyCtx.clearRect(0, 0, self.canvas.width, self.canvas.height);\n self.copyCtx.drawImage(self.canvas, 0, 0);\n }\n };\n}", "function updateBars() {\n const chartBars = document.querySelectorAll(\"#chart-bars g\");\n // Wykonanie na duzych slupkach\n for (let i = 0; i < chartBars.length; i++) {\n const bar = chartBars[i].children;\n // Wykonanie na malych slupkach w duzym slupku\n let yStartingPoint = 79.834364;\n let separation = 0; // Pierwszy odstep jest rowny 0, pozniej 1.1\n for (let rect = 0; rect < bar.length; rect++) {\n const e = bar[rect];\n const numOf = Number(e.getAttribute(\"data-value\")); // Odczytanie ilosci, np. numOfNumbers = 5\n const smallBarHeight = (gridMaxHeight / highestYLable) * numOf; // Wyliczenie jaka powinien miec maly slupek wysokosc\n yStartingPoint -= smallBarHeight; // Dostosowanie poczatkowego punktu w odniesieniu do wysokosci\n const x = parseFloat(e.getAttribute(\"x\"));\n e.setAttribute(\"x\", x + 26); // Przesuiecie starego slupka (o jeden w prawo)\n e.setAttribute(\n \"height\",\n smallBarHeight === 0 ? 0 : smallBarHeight - separation\n );\n e.setAttribute(\"y\", yStartingPoint);\n separation = numOf === 0 && separation === 0 ? 0 : 1.1;\n }\n }\n}", "function draw_rasterBar() {\n \tif ( defaultFalse( currentPart.rasterBar ) ) {\t\t\t// If we're showing the copper pipes...\n \t\trasterBar1Screen.show();\n \t\trasterBar2Screen.show();\n \t\trasterBar3Screen.show();\n \t\trasterBar1Y = 330 - Math.abs(Math.sin(rasterBar1Pos) * 200);\t// Calculate their y-pos in the sinewave\n \t\trasterBar2Y = 330 - Math.abs(Math.sin(rasterBar2Pos) * 200);\n \t\trasterBar3Y = 330 - Math.abs(Math.sin(rasterBar3Pos) * 200);\n \t\tif ( currentPart.rasterBar.wobble ) {\t\t\t\t\t\t\t// If we're wobbling....\n \t\t\trasterBar1Y += rasterWobbler1.h();\t\t\t\t\t\t\t// ... Add in the wobble\n \t\t\trasterBar2Y += rasterWobbler2.h();\n \t\t\trasterBar3Y += rasterWobbler3.h();\n \t\t}\n \t\trasterBar1Pos += rasterBarSpeed;\t\t\t\t\t\t// Move sinewave along a bit for next frame\n \t\trasterBar2Pos += rasterBarSpeed;\n \t\trasterBar3Pos += rasterBarSpeed;\n \t\trasterBar1Screen.y = rasterBar1Y;\t\t\t\t\t\t// Now position the pipes!\n \t\trasterBar2Screen.y = rasterBar2Y;\n \t\trasterBar3Screen.y = rasterBar3Y;\n \t\t}\n \telse {\n \t\trasterBar1Screen.hide();\n \t\trasterBar2Screen.hide();\n \t\trasterBar3Screen.hide();\n \t}\n }", "function bar(d) {\r\n\t\t var bar = svg.insert(\"svg:g\", \".y.barHierAxis\")\r\n\t\t .attr(\"class\", \"enter\")\r\n\t\t .attr(\"transform\",function(){if($.browser.msie){\t\t \t \t\t\t\t\t\t\t\t\t\r\n\t\t \t \t\t\t\t\t\t\t\tif(d.children.length * y*1.6 < h){\r\n\t\t \t \t\t\t\t\t\t\t\t\treturn \"translate(-10,5)\";\r\n\t\t \t \t\t\t\t\t\t\t\t}\r\n\t\t \t \t\t\t\t\t\t\t\telse{\r\n\t\t \t \t\t\t\t\t\t\t\t\t//show scroll, need re-adjust the position in IE9\r\n\t\t \t \t\t\t\t\t\t\t\t\treturn \"translate(-2,5)\";\r\n\t\t \t \t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t\t else{\r\n\t\t\t\t\t\t\t\t\t\t\t return \"translate(0,5)\"; \r\n\t\t\t\t\t\t\t\t\t\t }})\r\n\t\t .selectAll(\"g\")\r\n\t\t .data(d.children)\r\n\t\t .enter().append(\"svg:g\")\r\n\t\t .style(\"cursor\", function(d) { return !d.children ? null : \"pointer\"; })\t\t \r\n\t\t .on(\"click\", showDetail);\r\n\t\r\n\t\t bar.append(\"svg:text\")\r\n\t\t .attr(\"x\", -6)\r\n\t\t .attr(\"y\", y/2+1)\r\n\t\t .attr(\"dy\", \".35em\")\r\n\t\t .attr(\"text-anchor\", \"end\")\r\n\t\t .text(function(d) { \r\n\t\t \t \t /*for current font size and the whole txt width, the max character number is 20*/\r\n\t\t\t \t if(d.Name.length > 20){\r\n\t\t\t \t\t return d.Name.substr(0,18) + \"...\";\r\n\t\t\t \t }\r\n\t\t\t \t else{\r\n\t\t\t \t\t return d.Name; \r\n\t\t\t \t }\r\n\t\t \t\t});\r\n\t\r\n\t\t bar.append(\"svg:rect\")\r\n\t\t .attr(\"width\", function(d) { return x(value(d)); })\r\n\t\t .style(\"fill\", function(d) { return rs.view.getColorByVariancePercentage(d.VariancePercentage,d.Total); })\r\n\t\t .attr(\"height\", y);\r\n\r\n\t\t \t\r\n\t\t return bar;\r\n\t\t}", "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 makeBars(data) {\n\n\t// a bit of data processing here:\n\t// basically just a dictionary for the tvars and their data\n\tvar tvars = d3.map(data[0]);\n\ttvars.remove(\"readings\");\n\tvar tkeys = tvars.keys();\n\tvar datamap = makeMap(data, tkeys);\n\tdatamap = d3.map(datamap);\n\n\t// Add an svg for each element\n\tvar svgs = d3.select(\"#bars\")\n\t\t\t\t.selectAll(\"svg\")\n\t\t\t\t\t.data(datamap.values())\n\n\t\tsvgs.enter()\n\t\t\t.append(\"svg\")\n\t\t\t\t.attr(\"class\", \"bsvgs\")\n\t\t\t\t.attr(\"width\", barcodeWidth)\n\t\t\t\t.attr(\"height\", barcodeHeight)\n\t\t\t\t.style(\"background-color\", \"#e8e8e8\")\n\n\t\tsvgs.exit().remove();\n\n\t//Add little barcode marks per respective svg\n\tvar blips = d3.selectAll(\".bsvgs\").selectAll(\"rect\")\n\t\t\t\t.data(function(d) {\n\t\t\t\t\treturn d;\n\t\t\t\t})\n\n\t\tblips.enter()\n\t\t\t.append(\"rect\")\n\t\t\t\t.attr(\"id\", function(d, i) {\n\t\t\t\t\treturn i;\n\t\t\t\t})\n\t\t\t\t.attr(\"width\", \"3px\")\n\t\t\t\t.attr(\"height\", barcodeHeight)\t\n\t\t\t\t.attr(\"x\", function(d) {\n\t\t\t\t\treturn chartScale(d);\n\t\t\t\t})\n\t\t\t\t.style(\"fill\", function(d) { // fill based on slider vals\n\t\t\t\t\tvar values = stdSlider.noUiSlider.get();\n\t\t\t\t\tleft = values[0];\n\t\t\t\t\tright = values[1];\n\t\t\t\t\tif (((+d) <=left) || ((+d)>=right)) {\n\t\t\t\t\t\treturn \"orange\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn \"#969696\";\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.style(\"stroke-width\", \"1px\")\n\t\t\t\t.style(\"stroke\", \"#ededed\")\n\t\t\t\t.on(\"mouseover\", function(d) {\n\n\t\t\t\t\tvar currid = this.id;\n\t\t\t\t\td3.selectAll(\"rect\").style(\"fill\", function(d) {\n\t\t\t\t\t\tif (this.id == currid) {\n\t\t\t\t\t\t\treturn \"blue\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn colorUp(d);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.on(\"mouseout\", function() {\n\t\t\t\t\td3.selectAll(\"rect\").style(\"fill\", function(d) {\n\t\t\t\t\t\treturn colorUp(d);\n\t\t\t\t\t});\n\n\t\t\t\t\td3.selectAll(\"circle\").style(\"fill\", \"gray\");\n\t\t\t\t})\n\t\t\t\t.on(\"click\", function() {\n\t\t\t\t\tvar currid = this.id;\n\t\t\t\t\t// interaction for isolating the connected marks\n\t\t\t\t\td3.selectAll(\"rect\").style(\"fill\", function(d) {\n\t\t\t\t\t\tif (this.id == currid) {\n\t\t\t\t\t\t\tif(colorUp(d) == \"orange\") {\n\t\t\t\t\t\t\t\treturn \"orange\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn \"gray\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\treturn \"blue\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn \"#e8e8e8\";\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\t// interaction for hilighting the respective data point circle\n\t\t\t\t\td3.selectAll(\"circle\").style(\"fill\", function(d) {\n\t\t\t\t\t\tif (this.id == currid) {\n\t\t\t\t\t\t\treturn \"gray\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn \"white\";\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t})\n\n}", "function progressBar(progress) {\r\n ctx.save(); // save the unclipped state\r\n\r\n ctx.beginPath(); // create the clip path\r\n ctx.rect(0,0, width * progress, height);\r\n ctx.clip();\r\n\r\n ctx.fillStyle = progressColor(startColor, endColor, progress);\r\n\r\n ctx.beginPath(); // draw all bars as one\r\n var x = 0;\r\n while (x < width * progress) {\r\n ctx.rect(x, 0, barWidth, height);\r\n x += barSpacing;\r\n }\r\n ctx.fill(); // draw that bars\r\n\r\n ctx.restore(); // restore unclipped state\r\n}", "function drawData(withFill, withClick, mousePos) {\n\tvar font = c.font;\n\t \n\t//draw data \n\tc.lineWidth = 1.0;\n\tvar stop = true;\n\tvar acc = new Array();\n\tfor(var i=0; i<data.length; i++) { \n\t\tacc[i] = realHeight-step;\n\t}\t\n\t\t\t \n\tvar barTooltip = \"\";\n\tvar barValue;\n\tvar abort = false;\n\tvar cursorStyle = 'default';\n\tfor(var k=0; k<series && !abort; k++) { \n\t for(var i=0; i<data.length && !abort; i++) { \t\t \n\t var dp = obj.data[k][i];\n\t if (isStacked(chartType)) {\t \n\t \tif (k > 0) {\n\t \t\tfor (var m=0; m<k; m++) {\n\t \t\t\tdp += obj.data[m][i];\n\t \t\t}\n\t \t}\n\t }\n\t var rectX = hStep + i*(realWidth-hStep-hStep2)/data.length; \n\t var Yheight = realHeight-step-(dp-minValY)*tickStep/yStep; \n\t if (obj.dualYaxis && (y2Count > 0) && (k >= series-y2Count) && (obj.lineData === undefined)) {\n\t \tYheight = realHeight-step-(dp-minValY2)*tickStep/y2Step; \n\t }\n\t \n\t var rectY;\n\t var nH;\n\t if (isN(chartType) && (max == 0)) {\n\t \t// all values are negative\n\t \trectY = getXAxisYForNegativeValues(); \t\n\t \t\n\t \tnH = getXAxisYForNegativeValues() + H;\n\t\t\tvar yn = getYPosForNegativeValues(k, i, 0);\n\t\t\tif (nH > yn) {\n\t\t\t\tnH = yn;\n\t\t\t} else {\n\t\t\t\tstop = false;\n\t\t\t}\n\t } else {\n\t\t rectY = realHeight-step-H; \t\t \n\t\t\tif (rectY <= Yheight) {\n\t\t\t rectY = Yheight;\n\t\t\t} else {\n\t\t\t stop = false;\n\t\t\t} \n\t }\n\t \n\t if (rectY+2 > xaxisY) {\n\t rectY = xaxisY-1;\n\t cornerRadius = 1;\n\t } else {\n\t cornerRadius = 6;\n\t }\t \n\t \t \n\t var rectWidth;\n\t if (isStacked(chartType)) {\t \t\t \t \t \n\t rectWidth = (realWidth - hStep - gap*(1+Math.sqrt(series)))/data.length; \t \n\t } else { \n\t rectWidth = (realWidth - hStep -hStep2 - gap*(1+Math.sqrt(series)))/data.length/series;\n\t rectX = rectX + k*rectWidth; \n\t } \t \n\t \n\t var lColor = highlightColor(seriesColor[k],1.3);\n\t var grad = c.createLinearGradient(rectX, realWidth-hStep-hStep2 , rectX + rectWidth , realWidth-hStep-hStep2); \n\t grad.addColorStop(0,lColor); // light color \n\t grad.addColorStop(1,seriesColor[k]); \n\t \n\t var inverseGrad = c.createLinearGradient(rectX, realWidth-hStep-hStep2 , rectX + rectWidth , realWidth-hStep-hStep2); \t\t \n\t inverseGrad.addColorStop(0,seriesColor[k]);\n\t inverseGrad.addColorStop(1,lColor); // light color\n\t \t \t \t\t \n\t if (chartStyle == \"glass\") {\t \t \t\t \n\t \tacc[i] = drawGlass(k, i, rectX, rectY, rectWidth, grad, acc[i], nH, withFill);\n\t } else if (chartStyle == \"cylinder\") {\t \n\t \tacc[i] = drawCylinder(k, i, rectX, rectY, rectWidth, grad, inverseGrad, stop, acc[i], withFill);\n\t } else if (chartStyle == \"dome\") {\t\t\t \t\n\t \tacc[i] = drawDome(k, i, rectX, rectY, rectWidth, inverseGrad, stop, acc[i], withFill);\n\t } else if (chartStyle == \"parallelepiped\") {\t\t\t \t\n\t \tacc[i] = drawParallelipiped(k, i, rectX, rectY, rectWidth, grad, inverseGrad, stop, acc[i], withFill);\n\t } else {\t \t\n\t \t// normal style\n\t \tacc[i] = drawRectangle(k, i, rectX, rectY, rectWidth, acc[i], nH, withFill);\n\t } \n\t \n\t var found;\n\t \n\t if (!withFill) {\n\t \tif (c.isPointInPath(mousePos.x, mousePos.y)) {\n\t \t\thighlighterSerie = k;\t \t\t\n\t \t\thighlighterSerieIndex = i;\t \t\t\n\t \t\tvar tValue = obj.data[k][i];\n\t \t\tif (obj.tooltipPattern !== undefined) {\n\t \t\t\ttValue = formatNumber(tValue, obj.tooltipPattern.decimals, obj.tooltipPattern.decimalSeparator, obj.tooltipPattern.thousandSeparator);\n\t \t\t}\t \t\t\t \t\t\n\t \t\tvar returnValue = labels[i]; // returnValue = tValue;\n\t \t\tif (withClick) {\n\t \t\t\tbarValue = tValue;\n\t \t\t\t// if there is a combo line we test first to see if point for line was clicked\n\t \t\t\t// that's why we do not return the bar clicked value\n\t \t\t\tif (obj.lineData !== undefined) {\n\t\t\t \tabort = true;\n\t\t\t } else {\t\n\t\t\t \tif (found === undefined) {\n\t\t\t \t\tfound = returnValue;\n\t\t\t \t}\n\t\t\t }\n\t \t\t} else {\n\t\t\t \tvar mes = String(message).replace('#val', tValue);\n\t\t\t \tmes = mes.replace('#x', returnValue);\n\t\t\t\t mes = mes.replace('#total', maxSum[i]);\n\t\t\t\t if (obj.onClick !== undefined) {\n\t\t\t\t \tcursorStyle = 'pointer';\n\t\t\t\t \tcanvas.style.cursor = cursorStyle;\n\t\t\t\t }\n\t\t\t barTooltip = mes;\n \t\t\t // if there is a combo line we test first to see if point for line was clicked\n\t \t\t\t// that's why we do not return the bar tooltip\n\t\t\t if (obj.lineData !== undefined) {\n\t\t\t \tabort = true;\n\t\t\t } else {\t\n\t\t\t \tif (found === undefined) {\n\t\t\t \t\tfound = mes;\n\t\t\t \t}\n\t\t\t }\n\t \t\t}\n\t\t } else {\t\n\t\t \tif (cursorStyle != 'pointer') {\n\t\t \t\tcanvas.style.cursor = 'default';\n\t\t \t}\n\t\t } \t\t\t\t\t \n\t }\n\t } \n\t \n\t} \n\tif (found !== undefined) {\t\t \n\t\treturn found;\n\t}\t\n\t\n\t// combo line chart\n\tif (obj.lineData !== undefined) {\n\t\tfor(var k=0; k<obj.lineData.length; k++) { \n\t\t\t dotsK[k] = [];\t\n\t\t\t for(var i=0; i<obj.lineData[0].length; i++) { \t\t \n\t\t\t var dp = obj.lineData[k][i];\t\n\t\t\t var width = (realWidth - hStep -hStep2 - gap*(1+Math.sqrt(obj.lineData.length)))/obj.lineData[0].length;\n\t\t\t var dotX = hStep + i*(realWidth-hStep-hStep2)/obj.lineData[0].length + width/2; \n\t\t\t var Yheight = realHeight-step-(dp-minValY)*tickStep/yStep; \n\t\t\t if (obj.dualYaxis && (y2Count > 0) && (k >= obj.lineData.length-y2Count)) {\n\t\t\t \tYheight = realHeight-step-(dp-minValY2)*tickStep/y2Step; \n\t\t\t }\n\t\t\t var dotY = realHeight-step-H;\n\t\t\t var dotX2 = dotX;\n\t\t\t var dotY2 = dotY;\n\t\t\t var Yheight2 = Yheight;\n\t\t\t if (i < obj.lineData[0].length-1) {\n\t\t\t \tdotX2 = hStep + (i+1)*(realWidth-hStep-hStep2)/obj.lineData[0].length + width/2;\n\t\t\t \tdotY2 = realHeight-step-H;\n\t\t\t \tYheight2 = realHeight-step-(obj.lineData[k][i+1]-minValY)*tickStep/yStep;\n\t\t\t \tif (obj.dualYaxis && (y2Count > 0) && (k >= obj.lineData.length-y2Count)) {\n\t\t\t \t\tYheight2 = realHeight-step-(obj.lineData[k][i+1]-minValY2)*tickStep/y2Step;\n\t\t\t \t}\n\t\t\t }\n\t\t\t \t \t \n\t\t\t if (dotY <= Yheight) {\n\t\t\t dotY = Yheight;\n\t\t\t } else {\n\t\t\t stop = false;\n\t\t\t } \n\t\t\t if (dotY+2 > xaxisY) {\n\t\t\t dotY = xaxisY-1;\t \n\t\t\t } \t\n\t\t\t if (i < obj.lineData[0].length-1) {\n\t\t\t\t if (dotY2 <= Yheight2) {\n\t\t\t\t dotY2 = Yheight2;\n\t\t\t\t } else {\n\t\t\t\t stop = false;\n\t\t\t\t } \n\t\t\t\t if (dotY2+2 > xaxisY) {\n\t\t\t\t dotY2 = xaxisY-1;\t \n\t\t\t\t } \t \n\t\t\t }\n\t\t\t \t \t \n\t\t\t dotsK[k].push({x:dotX, y:dotY});\n\t\t\t \n\t\t\t var lineSeriesColor = obj.lineColor;\n\t\t\t\tif (obj.lineColor === undefined) {\n\t\t\t\t\tlineSeriesColor = distinctHexColors(obj.lineData[0].length);\n\t\t\t } \n\t\t\t \n\t\t\t var savedStroke = c.strokeStyle;\t\t\t \n\t\t\t drawLineElements(c, \"normal\", \"line\", 4, lineSeriesColor, dotsK, obj.lineData[0].length, xaxisY, globalAlpha, k, i, dotX, dotY, dotX2, dotY2, withFill);\n\t\t\t if (stop) {\n\t\t\t \tdrawLineElements(tempLineCtx, \"normal\", \"line\", 4, lineSeriesColor, dotsK, obj.lineData[0].length, xaxisY, globalAlpha, k, i, dotX, dotY, dotX2, dotY2, withFill);\n\t\t\t }\n\t\t\t c.strokeStyle = savedStroke;\n\t\t\t \n\t\t\t if (!withFill) {\n\t\t\t \t\n\t\t\t \t// highlight selection\n\t\t\t\t\tif ((k == lineHighlighterSerie) && (i == lineHighlighterSerieIndex)) {\n\t\t\t\t\t\thighlightLine(k, 0.5);\t\t\n\t\t\t\t\t}\n\t\t\t \t\n\t\t\t \tif (c.isPointInPath(mousePos.x, mousePos.y)) { \n\t\t\t \t\tlineHighlighterSerie = k;\t \t\t\n\t\t\t \t\tlineHighlighterSerieIndex = i;\t \t\t\n\t\t\t \t\tvar tValue = obj.lineData[k][i];\t\t\t \t\t\n\t\t\t \t\tif (obj.tooltipPattern !== undefined) {\n\t\t\t \t\t\ttValue = formatNumber(tValue, obj.tooltipPattern.decimals, obj.tooltipPattern.decimalSeparator, obj.tooltipPattern.thousandSeparator);\n\t\t\t \t\t}\t \n\t\t\t \t\tvar returnValue = labels[k]; // returnValue = tValue;\n\t\t\t \t\tif (withClick) {\n\t\t\t \t\t\tif (found === undefined) {\n\t\t\t \t\t\t\tfound = returnValue;\n\t\t\t \t\t\t}\n\t\t\t \t\t} else {\n\t\t\t \t\t\tvar lineMessage = \"#val\";\n\t\t\t\t\t \tvar mes = String(lineMessage).replace('#val', tValue);\n\t\t\t\t\t \tmes = mes.replace('#x', returnValue);\n\t\t\t\t\t \tif (obj.onClick !== undefined) {\n\t\t\t\t\t \t\tcursorStyle = 'pointer';\n\t\t\t\t\t \t\tcanvas.style.cursor = cursorStyle;\n\t\t\t\t\t \t}\n\t\t\t\t\t \tif (found === undefined) {\n\t\t\t\t\t \t\tfound = mes;\n\t\t\t\t\t \t}\t\n\t\t\t \t\t}\n\t\t\t\t } else {\t\n\t\t\t\t \tif (abort == true) {\n\t\t\t\t \t\tif (obj.onClick !== undefined) {\n\t\t\t\t \t\t\tcursorStyle = 'pointer';\n\t\t\t\t \t\t\tcanvas.style.cursor = cursorStyle;\n\t\t\t\t \t\t}\n\t\t\t\t \t} else {\n\t\t\t\t \t\tif (cursorStyle != 'pointer') {\n\t\t\t\t \t\t\tcanvas.style.cursor = 'default';\n\t\t\t\t \t\t}\n\t\t\t\t \t}\n\t\t\t\t } \t\t\t\t\t \n\t\t\t }\n\t\t\t }\n\t\t}\t \n }\n\tif (found !== undefined) {\t\t \n\t\treturn found;\n\t}\n\t\t\n\tif (withFill) {\n\t\treturn stop;\n\t} else {\t\t\n\t\tif (withClick) {\n \t\tif (barValue !== undefined) {\n \t\t\treturn barValue;\n \t\t}\n \t}\n\t\t// empty tooltip message if click outside dot line and bar\n\t\treturn barTooltip;\n\t}\n}", "function drawBar(x1, y1, x2, y2, width,frequency){\n \n var lineColor = \"rgb(\" + frequency + \", \" + frequency + \", \" + 205 + \")\";\n if (state.color == \"\") {\n ctx.strokeStyle = lineColor;\n } else {\n ctx.strokeStyle = state.color;\n }\n ctx.lineWidth = width;\n ctx.beginPath();\n ctx.moveTo(x1,y1);\n ctx.lineTo(x2,y2);\n ctx.stroke();\n }", "update(){\n this.graphics.clear();\n for(let bar of this.healthBars){\n if(!bar.visible){\n continue;\n }\n bar.updatePos();\n bar.outerWidth = bar.barWidth * (bar.track.health/100);\n this.draw(bar);\n }\n for(let bar of this.progressBars){\n if(bar.track.state === \"closed\"){\n bar.visible = true;\n }\n else{\n bar.visible = false;\n }\n if(bar.visible){\n bar.updatePos();\n bar.outerWidth = bar.barWidth * (bar.track.tapCount/bar.track.maxTap);\n this.draw(bar);\n }\n }\n }", "function drawBuckets() {\n for (i = 0; i < buckets.length; i++) {\n text(i, 10 + 20 * i, height - 10);\n\n var barLeft = 10 + 20 * i;\n var barBottom = height - 30;\n var barHeight = buckets[i] * 15;\n\n rect(barLeft, barBottom, 15, -barHeight);\n }\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}", "drawBar(lineI, startChar, endChar, barColor, extraStart=0, extraEnd=0){\n let offsetX = 0;\n if(this.centered){ // Centers text within box's width\n offsetX = (CHAR_WIDTH/2)*(this.lineW - (endChar - startChar));\n }\n ctx.fillStyle = barColor;\n ctx.fillRect(\n this.x+CHAR_GAP + offsetX + startChar*CHAR_WIDTH - extraStart,\n this.y + lineI*LINE_HEIGHT + 2*CHAR_GAP - Math.floor(CHAR_GAP/2)\n + this.offsetY,\n (endChar-startChar)*CHAR_WIDTH + extraStart+extraEnd,\n LINE_HEIGHT\n );\n }", "function DrawUI(){\n\n // Apply the change per frame to each variable bar.\n StudyPercent.percent -= RateDecresePerFrameS * RateOfDecreaseMult;\n HungerPercent.percent -= RateDecresePerFrameH * RateOfDecreaseMult;\n EnergyPercent.percent -= RateDecresePerFrameE * RateOfDecreaseMult;\n\n // For each that has run out, start reducing sanity.\n if (StudyPercent.percent == 0){ SanityPercent.percent -= RateDecresePerFrameSY}\n if (HungerPercent.percent == 0){ SanityPercent.percent -= RateDecresePerFrameSY}\n if (EnergyPercent.percent == 0){ SanityPercent.percent -= RateDecresePerFrameSY}\n\n // First draw the bars of colour depending on their values\n noStroke(); textSize(20); (CENTER);\n //fill(18,130,84); rect(width / 2 + 70 , 22, StudyPercent.percent, 12); // Study\n //fill(147,10,10); rect(width / 2 - 50 , 22, HungerPercent.percent, 12); // Hunger\n //fill(10,104,147); rect(width / 2 - 170, 22, EnergyPercent.percent, 12); // Energy\n fill(107,13,156); rect(width / 2 - 240, 30, (SanityPercent.percent / 100) * 480 , 40); // Sanity\n\n /// Now overlay the image of the outline over the top, this allows for \n // interesting designs.\n stroke(255); fill(255); textSize(20); textAlign(CENTER);\n // image(Images[12] , width/2 , 28); \n // image(Images[12] , width/2 - 120 , 28);\n // image(Images[12] , width/2 + 120 , 28);\n image(Images[13] , width/2 , 46); \n\n\n // New images instead\n // Base colour\n image(Images[28] , 100 , 46); // Hunger\n image(Images[30] , 175 , 46); // Energy\n image(Images[32] , 250 , 46); // Study\n\n image(Images[34] , 925 , 46); // PiggyBlank\n image(Images[35] , 1005 , 46); // Calander\n image(Images[36] , 1082 , 46); // Watch\n\n // Block out\n fill(0); stroke(0); rect(70 , 18, 60 , (55/100) * (100 - HungerPercent.percent)); // Hunger\n fill(0); stroke(0); rect(145 , 18, 60 , (55/100) * (100 - EnergyPercent.percent)); // Energy\n fill(0); stroke(0); rect(220 , 18, 60 , (55/100) * (100 - StudyPercent.percent)); // Study\n \n // Outline\n image(Images[29] , 100 , 46); // Hunger\n image(Images[31] , 175 , 46); // Energy\n image(Images[33] , 250 , 46); // Study\n\n \n // Finally add the text\n noStroke(); fill(255); textSize(15); textAlign(CENTER);\n\n text(\"Hunger\", 100, 94);\n text(\"Energy\", 175, 94);\n text(\"Study\", 250, 94);\n text(\"Cash\", 925, 94);\n text(\"Date\", 1005, 94);\n text(\"Time\", 1082, 94);\n\n //textFont(fontBold);\n \n // Add later\n text(\"£\" + Cash, 923, 55);\n textSize(23);text(ScaledDay, 1005, 66);textSize(20);\n\n //text(\"Sanity\", width/2 + 200, 51);\n //text(\"Sanity\", width/2 - 200, 51);\n textSize(18);\n text(\"- - - - ]|I{•------» ⓢΔ几𝕚Ⓣy «------•}I|[ - - - -\", width/2 , 94);\n\n // Time is precalculated in time script soo no worries ;) \n textAlign(LEFT);\n\n //text(\"CurFrame: \" + CurFrame + \" RealtimeSecs: \" + RealTimeSeconds + \"\\n RealtimeSecsRounded: \" + RealTimeSecRounded + \" Scaled Secs: \" + ScaledSeconds, 98 , 578);\n //text(\"[ ]\",1100,55);\n textSize(11); text(\"\" + ScaledHourToDisplay + \" : \" + ScaledMinToDisplay + \"\", 1065 , 52); textSize(18);\n // text(\"[ \" + ScaledDayToDisplay + \"/03/2020 ]\" , 1100 , 80 );\n\n /*\n textAlign(LEFT);\n text(\"Time [ \" + ScaledHours + \" : \" + ScaledMinutes + \" ]\", 98 , 578);\n text(\"[\" + ScaledDay + \"/03/2020] \", 100 , 600);\n */\n\n\n //textSize(12);\n //text(\"Sanity\", width/2 - 130 , 50);\n \n}", "function updateLoaderBar() {\n loaderBar.graphics.clear();\n loaderBar.graphics.beginFill('#FF530D');\n loaderBar.graphics.drawRect(0, 0, constants.LOADER_WIDTH * percentLoaded, 40);\n loaderBar.graphics.endFill();\n loaderBar.graphics.setStrokeStyle(2);\n loaderBar.graphics.beginStroke(\"#000\");\n loaderBar.graphics.drawRect(0, 0, constants.LOADER_WIDTH, 40);\n loaderBar.graphics.endStroke();\n}", "drawNoTrace() {\n\t/* Increment the canvas (x-axis) index */\n\tHomePage.i += 2;\n\t/* Populate the array before overwriting anything in it (and draw) */\n\tif (HomePage.points.length < 50) {\n\t HomePage.ctx.lineTo(HomePage.i, data);\n\t HomePage.points.push([HomePage.i,data]);\n\t HomePage.ctx.stroke();\n\t}\n\t\n\t/* After it's populated, start the erasing algorithm */\n\telse {\n\t \n\t /* Change the stroke color to green */\n\t HomePage.ctx.strokeStyle = \"#00FF00\";\n\t /* Draw to newest point */\n\t HomePage.ctx.lineTo(HomePage.i, data);\n\t /* Move to the tail of the line*/\n\t HomePage.ctx.moveTo(HomePage.points[HomePage.head][0], HomePage.points[HomePage.head][1]);\n\t HomePage.ctx.stroke();\n\t \n\t \n\t /* Change to black */\n\t HomePage.ctx.strokeStyle = \"#000000\";\n\t /* Erase up to second to last point */\n\t var tmp = (HomePage.head + 1) % 50;\n\t HomePage.ctx.lineTo(HomePage.points[tmp][0], HomePage.points[tmp][1]);\n\t \n\t /* Update last point to newest point */\n\t HomePage.points[HomePage.head] = [HomePage.i, data];\n\t /* Move to newest point */\n\t HomePage.ctx.moveTo(HomePage.points[HomePage.head][0], HomePage.points[HomePage.head][1]);\n\t HomePage.ctx.stroke();\n\t \n\t \n\t /* Increment head */\n\t HomePage.head++;\n\t HomePage.head %= 50;\n\t}\n }", "makeBar() {\r\n const percentage = this.timeLeft / this.MAX_TIME;\r\n const progress = Math.round((this.BAR_SIZE * percentage));\r\n const emptyProgress = this.BAR_SIZE - progress;\r\n const progressText = '▇'.repeat(progress);\r\n const emptyProgressText = ' '.repeat(emptyProgress);\r\n const bar = '```' + this.DISP_TEXT + '\\n' + progressText + emptyProgressText + '```';\r\n return bar;\r\n }", "function drawBarChart(data, ctx, can) {\n if (clear) ctx.clearRect(0, 0, can.width, can.height);\n var y, tx, ty, metrics, words, line, testLine, testWidth;\n var dataName = data.name;\n var dataValue = data.value;\n var colHead = 50;\n var rowHead = 30;\n var margin = 10;\n var maxVal = Math.ceil(Math.max.apply(Math, dataValue)/5) * 5;\n var stepSize = 5;\n var yScalar = (can.height - colHead - margin) / (maxVal);\n var xScalar = (can.width - rowHead) / (dataName.length + 1);\n ctx.lineWidth = 0.5;\n ctx.strokeStyle = \"rgba(128,128,255, 0.5)\"; // light blue line\n ctx.beginPath();\n // print row header and draw horizontal grid lines\n ctx.font = \"10pt Open Sans\"\n var count = 0;\n for (scale = maxVal; scale >= 0; scale -= stepSize) {\n y = colHead + (yScalar * count * stepSize);\n ctx.fillText(scale, margin,y + margin);\n ctx.moveTo(rowHead, y + margin - 1)\n ctx.lineTo(can.width, y + margin -1)\n count++;\n }\n ctx.stroke();\n ctx.save();\n // set a color\n ctx.fillStyle = \"rgba(151,187,205,1)\";\n // translate to bottom of graph and scale x,y to match data\n ctx.translate(0, can.height - margin);\n ctx.scale(xScalar, -1 * yScalar);\n // draw bars\n for (i = 0; i < dataName.length; i++) {\n ctx.fillRect(i + 1, -2, 0.5, dataValue[i]);\n }\n ctx.restore();\n \n // label samples\n ctx.font = \"8pt Open Sans\";\n ctx.textAlign = \"center\";\n for (i = 0; i < dataName.length; i++) {\n calcY(dataValue[i]);\n ty = y - margin - 5;\n tx = xScalar * (i + 1) + 14;\n words = dataName[i].split(' ');\n line = '';\n for(var n = 0; n < words.length; n++) {\n testLine = line + words[n] + ' ';\n metrics = ctx.measureText(testLine);\n testWidth = metrics.width;\n if (testWidth > 20 && n > 0) {\n ctx.fillText(line, tx, ty - 8);\n line = words[n] + ' ';\n }\n else {\n line = testLine;\n }\n }\n ctx.fillText(line, tx, ty + 8);\n }\n function calcY(value) {\n y = can.height - value * yScalar;\n } \n}", "drawDashes() {\n this.diff = 0;\n for (let i = 0; i < 8; i++) {\n this.ctx.beginPath();\n this.ctx.rect(this.diff, this.canvas.height / 2, 40, 8);\n this.ctx.fillStyle = '#333';\n this.ctx.fill();\n this.ctx.closePath();\n this.diff += 60;\n }\n }", "function drawAxisLableAndMarkers(skillArr) {\n\t\t//console.log(\"draw the bar axis labell and markers....\");\n\t //Y-Axis\n\t // remove Y-Axis -- drawXYAxis(svgcMarginSpace, svgcMarginHeight, svgcMarginSpace, svgcMargin);\n\t //X-Axis\n\t drawXYAxis(svgcMarginSpace, svgcMarginHeight, svgcMarginSpace + bcWidth+500, svgcMarginHeight);\n\t drawAxisMarkers(skillArr);\n\t}", "function brickLineBottom() {\n ctx.fillStyle = '#000';\n ctx.save();\n ctx.fillRect(0, canvas.height - 2, canvas.width, 2);\n ctx.fillRect(0, canvas.height - 8, canvas.width, 2);\n ctx.fillRect(0, canvas.height - 14, canvas.width, 2);\n ctx.fillRect(0, canvas.height - 20, canvas.width, 2);\n }", "function setupBars(number,chartDims){\n\tvar i;\n\tvar padding=0.1; //percentage of white space around bars\n\t\n\tvar texture = new PIXI.RenderTexture(renderer, 10, 10);\n\tvar graphics = new PIXI.Graphics();\n\tgraphics.beginFill(0xFF3000);\n\tgraphics.drawRect(0, 0, 10, 10);\n\tgraphics.endFill();\n\ttexture.render(graphics);\n\t\n\tfor (i=0;i<number;i++){\n\t\tbars[i]= new PIXI.Sprite(texture); \n\t\tbardet[i]=new PIXI.Text(' ');\n\t\tstage.addChild(bars[i]);\n\t\tstage.addChild(bardet[i]);\n\t\t//console.log(i);\t\n\t\tbars[i].position.set(chartDims[0]+chartDims[2]*(i/number+1/number*padding),(chartDims[3]*0.9+chartDims[1]))\n\t\tbars[i].width=(chartDims[2]/number*(1.0-2.0*padding))\n\t\tbars[i].height=(chartDims[3]*0.1);\n\t}\n\n\t\n}", "function bar50(){\n self.svg.append(\"rect\")\n .attr(\"x\", (self.svgWidth * 0.5) + 35)\n .attr(\"y\", 30)\n .attr(\"width\", 3)\n .attr(\"height\", 46)\n .attr(\"class\", \"middlePoint\");\n }", "function drawBarThree(x, y, width, data, color) {\n ctx.beginPath();\n ctx.rect(x, y, width, data, color);\n ctx.fillStyle = \"#cc33ff\";\n ctx.fill();\n }", "drawAxes(ctx, num_pts, width, height, ymin, ymax, num_tics)\n{\n var indx;\n var x, y, x1, x2, y1, y2;\n var fm;\n var max_bars = this.calcMaxBars();\n\n var offset3D = 0;\n if ( this.threeDAxes == true )\n {\n offset3D = this.calcBarWidth(max_bars)/this.plotData.length;\n if ( offset3D > this.YTOP_OFFSET )\n offset3D = this.YTOP_OFFSET - 1.0;\n }\n\n ctx.strokeStyle = this.axesColor;\n ctx.lineWidth = 1;\n\n//ZZZZ Set stroke width!!!\n ctx.beginPath();\n ctx.moveTo(this.xTop, this.yOrg);\n ctx.lineTo(this.xOrg, this.yOrg);\n ctx.lineTo(this.xOrg, this.yTop);\n ctx.stroke();\n\n if ( this.threeDAxes == true )\n {\n var xf, yf;\n\n // Draw left corner...\n var x1Points = new Array(this.xOrg, this.xOrg+offset3D,\n this.xOrg+offset3D, this.xOrg, this.xOrg);\n var y1Points = new Array(this.yOrg, this.yOrg-offset3D,\n this.yTop-offset3D, this.yTop, this.yOrg);\n\n ctx.beginPath();\n xf = x1Points[0];\n yf = y1Points[0];\n ctx.moveTo(xf, yf);\n\n for ( var index=1; index<x1Points.length; index++ )\n {\n xf = x1Points[index];\n yf = y1Points[index];\n ctx.lineTo(xf, yf);\n }\n\n ctx.fillStyle = this.GRAY;\n ctx.fill();\n\n ctx.strokeStyle = this.axesColor;\n ctx.stroke();\n\n // Draw bottom plate rect...\n var x2Points = new Array(this.xOrg, this.xOrg+offset3D, this.xTop+offset3D, this.xTop, this.xOrg);\n var y2Points = new Array(this.yOrg, this.yOrg-offset3D, this.yOrg-offset3D, this.yOrg, this.yOrg);\n\n ctx.beginPath();\n xf = x2Points[0];\n yf = y2Points[0];\n ctx.moveTo(xf, yf);\n\n for ( var index=1; index<x2Points.length; index++ )\n {\n xf = x2Points[index];\n yf = y2Points[index];\n ctx.lineTo(xf, yf);\n }\n\n ctx.fillStyle = this.GRAY;\n ctx.fill();\n\n ctx.strokeStyle = this.axesColor;\n ctx.stroke();\n\n // Draw plot background\n var x2Points = new Array(this.xOrg+offset3D, this.xOrg+offset3D,\n this.xTop+offset3D, this.xTop+offset3D, this.xOrg+offset3D);\n var y2Points = new Array(this.yOrg-offset3D, this.yTop-offset3D,\n this.yTop-offset3D, this.yOrg-offset3D, this.yOrg-offset3D);\n\n ctx.beginPath();\n xf = x2Points[0];\n yf = y2Points[0];\n ctx.moveTo(xf, yf);\n\n for ( var index=1; index<x2Points.length; index++ )\n {\n xf = x2Points[index];\n yf = y2Points[index];\n ctx.lineTo(xf, yf);\n }\n\n ctx.fillStyle = this.GRAY;\n ctx.fill();\n\n ctx.strokeStyle = this.axesColor;\n ctx.stroke();\n }\n\n ctx.strokeStyle = this.BLACK;\n\n // Draw the X axis labels\n var xval = this.xAxisStartValue;\n for ( indx=0; indx<num_pts; indx++ )\n {\n x = this.xScale*indx + this.xOrg + this.xScale/2.0;\n ctx.beginPath();\n ctx.moveTo(x, this.yOrg);\n ctx.lineTo(x, this.yOrg + 10.0);\n ctx.stroke();\n\n if ( this.vertGrid == true )\n {\n ctx.beginPath();\n ctx.moveTo(x + offset3D, this.yOrg - offset3D);\n ctx.lineTo(x + offset3D, this.yTop - offset3D);\n ctx.stroke();\n }\n\n if ( this.xAxisLabels == null || this.xAxisLabels.length == 0 ) // Draw the index number \n {\n ctx.drawTextCenter(this.xLabelsFont, this.xLabelsFontSize,\n x, this.yOrg+12+this.xLabelsFontSize, xval + \"\");\n\n xval += this.xAxisIncrement;\n }\n else // User passed long string based labels\n {\n try\n {\n var label = this.xAxisLabels[indx];\n\n if ( this.rotate_xflag == true && label != null )\n {\n ctx.save();\n ctx.translate(x-3, this.yOrg+12);\n ctx.rotate(Math.PI/2);\n var font_size = this.xLabelsFontSize;\n ctx.drawText(this.xLabelsFont, font_size, 0, 0, label);\n ctx.restore();\n }\n else if ( label != null )\n {\n//ZZZ TODO, See if label longer than width, cut/reduce/etc...\n//ZZZ Move every other label down? Use more space?\n//ZZZ Or if more than one word, do a breakline, draw second below it...\n var nlab;\n var nlab2 = \"\";\n if ( label.length > 7 )\n {\n if ( label.indexOf(\" \") == 5 )\n {\n nlab = label.substring(0, 5);\n nlab2 = label.substring(5);\n }\n else\n {\n nlab = label.substring(0, 7);\n nlab2 = label.substring(7);\n }\n }\n else\n nlab = label;\n\n var font_size = this.xLabelsFontSize;\n var llen = ctx.measureText(this.xLabelsFont, font_size, nlab);\n while ( ctx.measureText(this.xLabelsFont, font_size, nlab) > this.xScale &&\n font_size > 4 )\n font_size--;\n\n ctx.drawTextCenter(this.xLabelsFont, font_size,\n x, this.yOrg+12+font_size, nlab);\n\n if ( nlab2 != \"\" )\n {\n ctx.drawTextCenter(this.xLabelsFont, font_size,\n x, this.yOrg+12+font_size+font_size, nlab2);\n }\n }\n }\n catch ( ex )\n {\n if ( this.DEBUG == true )\n alert(\"Error: Label at \" + indx + \" -> \" + ex);\n }\n }\n }\n\n // Calc the Y axis labels\n var yoff = (this.yOrg-this.yTop)/num_tics;\n var yval = (ymax-ymin)/num_tics;\n\n var ytxt, label, ynum;\n\n // Draw Y Axis tics && labels\n for ( indx=0; indx<=num_tics; indx++ )\n {\n y = this.yOrg - yoff*indx;\n\n ctx.beginPath();\n ctx.moveTo(this.xOrg, y);\n ctx.lineTo(this.xOrg - 10.0, y);\n ctx.stroke();\n\n if ( this.horzGrid == true )\n {\n ctx.beginPath();\n ctx.moveTo(this.xOrg + offset3D, y - offset3D);\n ctx.lineTo(this.xTop + offset3D, y - offset3D);\n ctx.stroke();\n }\n\n var xpos = this.xOrg - 12;\n var ypos = y + ctx.fontHeight(this.yLabelsFont, this.yLabelsFontSize)/2 - 2;\n\n if ( this.yAxisLabels == null || this.yAxisLabels.length == 0 ) // Draw the index number \n {\n ytxt = yval*indx + ymin;\n\n//ZZZZ rotate_yflag?\n\n if ( this.plotType == this.PERCENT )\n {\n ynum = ytxt.toFixed(0);\n ctx.drawTextRight(this.yLabelsFont, this.yLabelsFontSize, xpos, ypos, ynum + \" %\");\n }\n else\n {\n if ( ytxt >= 1.0 )\n ynum = ytxt.toFixed(1);\n else\n ynum = ytxt.toFixed(2);\n ctx.drawTextRight(this.yLabelsFont, this.yLabelsFontSize, xpos, ypos, ynum + \" \");\n }\n }\n else\n {\n label = this.yAxisLabels[indx];\n ctx.drawTextRight(this.yLabelsFont, this.yLabelsFontSize, xpos, ypos, label);\n }\n }\n\n if ( this.threeDAxes == false )\n {\n if ( this.horzGrid == true ) // Add border to right side\n {\n ctx.beginPath();\n ctx.moveTo(this.xTop, this.yOrg);\n ctx.lineTo(this.xTop, this.yTop);\n ctx.stroke();\n }\n else if ( this.vertGrid == true ) // Add border to top\n {\n ctx.beginPath();\n ctx.moveTo(this.xOrg, this.yTop);\n ctx.lineTo(this.xTop, this.yTop);\n ctx.stroke();\n }\n }\n\n // Draw plot titles\n if ( this.plotTitle != null && this.plotTitle.length > 0 )\n {\n var title_strs = this.plotTitle.split(\"|\");\n var ypos = ctx.fontHeight(this.titleFont, this.titleFontSize) + 4;\n\n for ( var indx=0; indx<title_strs.length; indx++ )\n {\n//ZZZ if 3D bars subtract 3D offset from ypos\n ctx.drawTextCenter(this.titleFont, this.titleFontSize,\n width/2, ypos, title_strs[indx]);\n ypos += (ctx.fontHeight(this.titleFont, this.titleFontSize) + 4);\n }\n }\n\n // Draw X axis title\n if ( this.xAxisTitle != null && this.xAxisTitle.length > 0 )\n {\n var xpos = this.xOrg + this.plotWidth/2;\n var ypos = height - 4;\n\n ctx.drawTextCenter(this.xAxisFont, this.xAxisFontSize, xpos, ypos, this.xAxisTitle);\n }\n\n // Draw Y axis title\n if ( this.yAxisTitle != null && this.yAxisTitle.length > 0 )\n {\n //ZZZZctx.save();\n //ZZZZvar tr = ctx.getTransform();\n //ZZZZ//ctx.translate(fm.getHeight()+2 ,\n //ZZZZctx.translate(fm.getAscent()+2, this.yOrg-(this.plotHeight/2) +\n //ZZZZ fm.stringWidth(this.yAxisTitle)/2);\n //ZZZZctx.rotate(3*Math.PI/2);\n //ZZZZctx.drawText(this.yAxisFont, this.yAxisFontSize, 0, 0, yAxisTitle);\n //ZZZZctx.rotate(-3*Math.PI/2);\n //ZZZZctx.setTransform(tr);\n //ZZZZctx.restore();\n }\n}", "function drawEmpty() {\n\t\tdrawChart([[0,0]], \"none\");\n\t}", "function renderBarLineChart() {\n var elem = ctx.canvas;\n \n // Retrieving and calculating height ratio of Line Chart to the Bar Chart\n var heightRatio = parseFloat(elem.getAttribute(\"data-height-ratio\") || 1);\n var heightProportions = height / (heightRatio + 1);\n height = Math.round(heightProportions * heightRatio);\n var barChartHeight = Math.round(heightProportions);\n\n var defaultOpts = parseOptsWithStrings(elem, \"data-opts\") || {};\n \n // Line Chart Definition Override's\n sets = elem.getAttribute(\"data-line-sets\") !== null ? parseSets(elem.getAttribute(\"data-line-sets\")) : sets;\n opts = parseAttr(elem, \"data-line-opts\") !== null ? parseOptsPairs(parseAttr(elem, \"data-line-opts\") || []) : opts;\n colors = themes[opts.theme] || parseAttr(elem, \"data-line-colors\") || parseAttr(elem, \"data-colors\") || themes[defaultOpts.theme] || themes.basic;\n range = parseAttr(elem, \"data-line-range\") || parseAttr(elem, \"data-range\") || getRange(sets, isStacked());\n rotated = false;\n \n renderLineChart();\n \n // Drawing separator, line chart portion\n if(defaultOpts.separator && defaultOpts.separator || false)\n drawRect(defaultOpts.separatorStyle || '#000', 0, height, width, defaultOpts.separatorWidth && defaultOpts.separatorWidth/2 || 0.5);\n\n // Requesting separate context for Bar Portion\n ctx = ctx.canvas.getContext(\"2d\");\n ctx.translate(0, height);\n \n height = barChartHeight;\n\n // Line Chart Definition Override's\n sets = elem.getAttribute(\"data-bar-sets\") !== null ? parseSets(elem.getAttribute(\"data-bar-sets\")) : parseSets(elem.getAttribute(\"data-sets\"));\n opts = parseAttr(elem, \"data-bar-opts\") !== null ? parseOptsPairs(parseAttr(elem, \"data-bar-opts\") || []) : parseOpts(elem);\n colors = themes[opts.theme] || parseAttr(elem, \"data-bar-colors\") || parseAttr(elem, \"data-colors\") || themes[defaultOpts.theme] || themes.basic;\n range = parseAttr(elem, \"data-bar-range\") || parseAttr(elem, \"data-range\") || getRange(sets, isStacked());\n rotated = false;\n\n renderBarChart();\n\n // Drawing separator, line chart portion\n if(defaultOpts.separator && defaultOpts.separator || false)\n drawRect(defaultOpts.separatorStyle || '#000', 0, defaultOpts.separatorWidth && defaultOpts.separatorWidth/2 || 0.5, width, defaultOpts.separatorWidth && defaultOpts.separatorWidth/2);\n }", "function cypherTokenDrawAttributeBars() {\r\n const bars = new PIXI.Container();\r\n bars.bar1 = bars.addChild(new PIXI.Graphics());\r\n bars.bar2 = bars.addChild(new PIXI.Graphics());\r\n bars.bar3 = bars.addChild(new PIXI.Graphics());\r\n return bars;\r\n}", "function drawVisualization() {\r\n var style = \"bar-color\";//document.getElementById(\"style\").value;\r\n var showPerspective = true;//document.getElementById(\"perspective\").checked;\r\n // var withValue = [\"bar-color\", \"bar-size\", \"dot-size\", \"dot-color\"].indexOf(style) != -1;\r\n\r\n // Create and populate a data table.\r\n data = [];\r\n\r\n var color = 0;\r\n var steps = 3; // number of datapoints will be steps*steps\r\n var axisMax = 8;\r\n var axisStep = axisMax / steps;\r\n for (var x = 0; x <= axisMax; x += axisStep+1) {\r\n for (var y = 0; y <= axisMax; y += axisStep) {\r\n var z = Math.random();\r\n if (true) {\r\n data.push({\r\n x: x,\r\n y: y,\r\n z: z,\r\n style: {\r\n fill: colors[color],\r\n stroke: colors[color+1]\r\n }\r\n });\r\n }\r\n else {\r\n data.push({ x: x, y: y, z: z });\r\n }\r\n }\r\n color+=1;\r\n }\r\n\r\nvar category = [\"A\",\"B\",\"C\",\"D\"];\r\nvar cat_count = 0;\r\n // specify options\r\n var options = {\r\n width:'100%',\r\n style: style,\r\n xBarWidth: 2,\r\n yBarWidth: 2,\r\n showPerspective: showPerspective,\r\n showShadow: false,\r\n keepAspectRatio: true,\r\n verticalRatio: 0.5,\r\n xCenter:'55%',\r\n yStep:2.5,\r\n xStep:3.5,\r\n animationAutoStart:true,\r\n animationPreload:true,\r\n showShadow:true,\r\n \r\n yLabel: \"Categories (of Abuse)\",\r\n xLabel: \"Groups\",\r\n zLabel: \"Reports\",\r\n yValueLabel: function (y) {\r\n if(y == 0){\r\n return \"Category \" + category[y];\r\n }else{\r\n return \"Category \" +category[Math.ceil(y/3)];\r\n }\r\n },\r\n \r\n xValueLabel: function(x) {\r\n if(x == 0){\r\n return \"Group 1\";\r\n }else{\r\n return \"Group \" + (Math.ceil(x/3));\r\n }\r\n },\r\n tooltip: function(data){\r\n var res = \"\";\r\n if(data.x == 0){\r\n res += \"<strong>Group 1</strong>\";\r\n }else{\r\n res += \"<strong>Group</strong> \" + (Math.ceil(data.x/3));\r\n }\r\n\r\n if(data.y == 0){\r\n res+= \"<br><strong>Category</strong> \" + category[data.y];\r\n }else{\r\n res+= \"<br><strong>Category</strong> \" +category[Math.ceil(data.y/3)];\r\n }\r\n\r\n res+= \"<br><strong>Reports</strong> \" + data.z;\r\n return res;\r\n }\r\n };\r\n\r\n\r\n var camera = graph ? graph.getCameraPosition() : null;\r\n\r\n // create our graph\r\n var container = document.getElementById(\"mygraph\");\r\n graph = new vis.Graph3d(container, data, options);\r\n\r\n if (camera) graph.setCameraPosition(camera); // restore camera position\r\n/*\r\n document.getElementById(\"style\").onchange = drawVisualization;\r\n document.getElementById(\"perspective\").onchange = drawVisualization;\r\n document.getElementById(\"xBarWidth\").onchange = drawVisualization;\r\n document.getElementById(\"yBarWidth\").onchange = drawVisualization;*/\r\n}", "makeBar(x, y, i)\n {\n this.svg.append(\"rect\")\n .attr(\"x\", x(this.features[i]))\n .attr(\"y\", y(this.data[i]))\n .attr(\"height\", this.height - y(this.data[i]))\n .attr(\"width\", x.bandwidth())\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", \"black\")\n .attr(\"stroke-width\", 2.5)\n .attr(\"opacity\", 0.8);\n\n if((i === this.pointsOfInterest[0]) || (i === this.pointsOfInterest[1]))\n {\n this.svg.append(\"circle\")\n .attr(\"cx\", x(this.features[i]) + x.bandwidth() / 2)\n .attr(\"cy\", this.height - 15)\n .attr(\"r\", 8)\n .attr(\"fill\", \"black\");\n }\n }", "function drawChart() {\n\t\n\t// Create the data table.\n\t// 테이블 column, row 생성 및 설정\n\tvar data = new google.visualization.arrayToDataTable([\n\t\t['', 'stars', 'remain', {role: 'none'}],\n\t\t['', stars, remain, '']\n\t]);\n\t\n\t// chart 옵션 설정\n\tvar options = {\n\t\tlegend: 'none',\n\t hAxis: {\n\t \tbaseline: 0,\n\t \tbaselineColor: 'white',\n\t minValue: 0,\n\t maxValue: maxValue,\n\t viewWindow: {\n\t \tmin: 0,\n\t \tmax: maxValue,\n\t },\n\t ticks: [0],\n\t textPosition: 'none',\n },\n\t vAxis:{\n\t \tgridlines: {\n\t \t\tcolor: '#ffffff'\n\t \t},\n\t },\n\t chartArea:{left:0,top:0,width:'100%',height:'100%'},\n\t colors: [color, '#dddcdc'],\n\t fontSize: 0,\n\t isStacked: true,\n\t tooltip: {\n\t \ttrigger: 'none'\n\t },\n\t enableInteractivity: false,\n\t animation: {\n\t \tduration: 1000,\n\t \teasing: 'out',\n\t \tstartup: true\n\t }\n\t};\n\t\n\t// 테이블 생성 -> 화면\n\tvar table = new google.visualization.BarChart(document.getElementById('chart'));\n table.draw(data, options);\n}", "function drawHungerBar () {\r\n // Hunger bar Background\r\n rect(0, 550, cnv.width, 50, \"black\", \"fill\");\r\n // Hunger bar Border\r\n rect(8, 558, 784, 34, \"white\", \"fill\");\r\n // Hunger bar Border Background\r\n rect(10, 561, 195, 28, \"maroon\", \"fill\"); // 1/4\r\n rect(195, 561, 195, 28, \"darkred\", \"fill\"); // 1/2\r\n rect(390, 561, 195, 28, \"red\", \"fill\"); // 3/4\r\n rect(585, 561, 205, 28, \"tomato\", \"fill\"); // 4/4\r\n\r\n // Hunger Bar\r\n rect(hungerBar.x, hungerBar.y, hungerBar.w, hungerBar.h, hungerBar.col, \"fill\");\r\n}", "function drawBuckets(){\n //Draw dashed lines\n console.log(\"yeah\");\n console.log(emptySpots);\n for (var spot in emptySpots) {\n var x = emptySpots[spot][0];\n var y = emptySpots[spot][1];\n var w = emptySpots[spot][2];\n var h = emptySpots[spot][3];\n ex.graphics.ctx.setLineDash([6]);\n ex.graphics.ctx.strokeRect(x,y,w,h);\n }\n var bucketColor = \"#CEE8F0\";\n //Draw buckets\n for (var spot in bucketSpots) {\n ex.graphics.ctx.strokeStyle = \"black\";\n ex.graphics.ctx.fillStyle = bucketColor;\n var x = bucketSpots[spot][0];\n var y = bucketSpots[spot][1];\n var w = bucketSpots[spot][2];\n var h = bucketSpots[spot][3];\n ex.graphics.ctx.fillRect(x, y, w, h);\n ex.graphics.ctx.setLineDash([]);\n ex.graphics.ctx.strokeRect(x, y, w, h);\n ex.graphics.ctx.fillStyle = \"black\";\n ex.graphics.ctx.font = fontSize + \"px Arial\";\n ex.graphics.ctx.textAlign = \"center\";\n ex.graphics.ctx.textBaseline=\"middle\";\n ex.graphics.ctx.fillText(spot,x+w/2,y+h/2); \n }\n }", "function drawBar() {\n\n var data = new google.visualization.DataTable();\n data.addColumn('number', 'Date');\n data.addColumn('number', 'Issues');\n\n data.addRows(self.charts.bars.rows);\n\n var options = self.charts.bars.options;\n\n var chart2 = new google.visualization.ColumnChart(\n document.getElementById('chart_div2'));\n\n chart2.draw(data, options);\n }", "function drawBarChart(chart1, chart2, sArr) {\n\t\t//svg = document.getElementsByTagName('svg')[0];\n\t\t//svg =document.getElementById(\"svgcont\");\n\t\tsvg =document.getElementById(chart2);\n\t\tsvgContainer = document.getElementById(chart1);\n\t\t//var rdbarchart = document.getElementById('rdbarchart');\n\t\t//rdbarchart.addEventListener('click', function () {\n\t clearGraph(svg);\n\t barChartSettings(sArr);\n\t drawAxisLableAndMarkers(sArr);\n\t drawChartWithCalculation(sArr);\n\t\t//}, false);\n\t}", "function drawRectangleForChart(x,y,wd,ht,index) {\n\t var rect = document.createElementNS(\"http://www.w3.org/2000/svg\", 'rect');\n\t //rect.className = \"bc-tooltip\";\n\t rect.setAttributeNS(null, 'x', x);\n\t rect.setAttributeNS(null, 'y', y);\n\t rect.setAttributeNS(null, 'width', wd);\n\t rect.setAttributeNS(null, 'height', ht);\n\t // switch color on new rectangle bar chart\n\t switch (true) {\n\t case (index == 1):\n\t rect.setAttributeNS(null, 'fill', \"red\");\n\t break;\t\n\t case (index == 2):\n\t rect.setAttributeNS(null, 'fill', \"blue\");\n\t break; \n\t case (index == 3):\n\t rect.setAttributeNS(null, 'fill', \"green\");\n\t break; \n\t case (index == 4):\n\t rect.setAttributeNS(null, 'fill', \"yellow\");\n\t break; \n\t case (index == 5):\n\t rect.setAttributeNS(null, 'fill', \"orange\");\n\t break; \n\t }\n\t svg.appendChild(rect);\n\t}", "function brickLineTop() {\n ctx.fillStyle = '#000';\n ctx.save();\n ctx.fillRect(0, 0, canvas.width, 2);\n ctx.fillRect(0, 6, canvas.width, 2);\n ctx.fillRect(0, 12, canvas.width, 2);\n ctx.fillRect(0, 18, canvas.width, 2);\n }", "function draw() {\n background(0);\n b1.display();\n b2.display();\n b3.display();\n b4.display();\n b5.display();\n b6.display();\n b7.display();\n b8.display();\n b9.display();\n b10.display();\n}", "function drawLine(obj, dd, color) {\n if (dd.length == 0 || G.barB == G.barE) {\n return;\n }\n let ctx = obj.ctx;\n let j = 0;\n let x1, y1;\n let x2, y2;\n let start;\n ctx.beginPath();\n for (let i = G.barB; i < G.barE; i++) {\n if (dd[i] != 0) {\n start = i;\n break;\n }\n }\n let v = R(obj.mn[0] * dd[start] + obj.mn[1]);\n x1 = P[start - G.barB] + 0.5;\n y1 = v + 0.5;\n ctx.moveTo(x1, y1);\n for (let i = start + 1; i < G.barE; i++) {\n /* \n while (P[i - G.barB] == P[start - G.barB]) {\n i++;\n }\n */\n\n v = R(obj.mn[0] * dd[i] + obj.mn[1]);\n x2 = P[i - G.barB] + 0.5;\n y2 = v + 0.5;\n\n ctx.lineTo(x2, y2);\n x1 = x2;\n y1 = y2;\n\n }\n ctx.strokeStyle = color;\n ctx.stroke();\n ctx.closePath();\n }", "function bottom_bar_exit() { \n document.getElementById(\"bottom_bar\").style.zIndex = \"-3\"\n document.getElementById(\"legend1\").style.zIndex = \"0\"\n document.getElementById(\"third_bar\").style.zIndex = \"0\"\n document.getElementById(\"title_line2\").style.zIndex = \"0\"\n document.getElementById(\"credit\").style.zIndex = \"0\"\n\n if (document.getElementById(\"full_rect\") != null)\n {\n document.getElementById(\"full_rect\").remove()\n }\n\n d3.select(\"#fillgauge1\").remove()\n\n document.getElementById(\"bottom_bar\").style.background = \"rgba(0,0,0,0.5)\"\n}", "function drawBasic() {\n let options = {\n title: 'Stock Prices',\n chartArea: {width: '50%'},\n hAxis: {title: 'Price',minValue: 0},\n legend: { position: \"none\" }\n };\n \n let chart = new google.visualization.BarChart(document.getElementById(\"barchartValues\"));\n chart.draw(dataTable, options);\n}", "function uc1_addBars(g, groupId, bins, alreadyAddedMutations, color, normalize, avg) {\n\n // Bars representing the amount of mutations in a bin, independently on the type of mutation\n var selection = g.svg.selectAll(\"rect[rect-type='\"+color+\"']\").data(bins) // update selection\n\n\n // Get the vertical position of each bar, depending on the already stacked bars for a given bin (alreadyAddedMutations)\n yPos = function(bin, i) { \n if(alreadyAddedMutations!=null) {\n return g.yAxisScale(uc1_yVal(bin, normalize, avg)+alreadyAddedMutations[i]);\n } else\n return g.yAxisScale(uc1_yVal(bin, normalize, avg));\n }\n\n selection\n .enter()\n .append(\"rect\") // Add a new rect for each new element\n //.merge(total) // merge the new elements added with enter() with elements already existing in the selection and apply changes to all of them\n //.transition().duration(1) // transition effect lasting 1 seond\n .attr(\"rect-type\", \"group-\"+groupId)\n .attr(\"x\", 1) // starting distance of each element from y-axis (then will be translated...)\n .attr(\"transform\", function(d,i) { return \"translate(\" + g.xAxisScale(d.x0) + \",\" + yPos(d,i) + \")\"; }) // we move each rectangle depending on where the associated bin starts, and \n .attr(\"width\", function(d) { return g.xAxisScale(d.x1) - g.xAxisScale(d.x0) -1 ; }) // width of the rect\n .attr(\"height\", function(d) { return g.height - g.yAxisScale(uc1_yVal(d,normalize,avg)) }) // height of the rect\n\n .style(\"fill\", color)\n\n if(alreadyAddedMutations!=null)\n for(i in alreadyAddedMutations) {\n alreadyAddedMutations[i] += uc1_yVal(bins[i],normalize,avg);\n }\n\n return alreadyAddedMutations;\n\n\n // selection.exit().remove()\n}", "function reOrderBars(plot, serie, datapoints){\n var shiftedPoints = null;\n \n if(serieNeedToBeReordered(serie)){ \n checkIfGraphIsHorizontal(serie);\n calculPixel2XWidthConvert(plot);\n retrieveBarSeries(plot);\n calculBorderAndBarWidth(serie);\n \n if(nbOfBarsToOrder >= 2){ \n var position = findPosition(serie);\n var decallage = 0;\n \n var centerBarShift = calculCenterBarShift();\n\n if (isBarAtLeftOfCenter(position)){\n decallage = -1*(sumWidth(orderedBarSeries,position-1,Math.floor(nbOfBarsToOrder / 2)-1)) - centerBarShift;\n }else{\n decallage = sumWidth(orderedBarSeries,Math.ceil(nbOfBarsToOrder / 2),position-2) + centerBarShift + borderWidthInXabsWidth*2;\n }\n\n shiftedPoints = shiftPoints(datapoints,serie,decallage);\n datapoints.points = shiftedPoints;\n }\n }\n return shiftedPoints;\n }", "function createBars(data, options) {\n // Calculating bar width given the spacing of the bars\n var numberOfBars = data.length;\n var xAxisLength = $(\"#chartarea\").width();\n var barWidth = (xAxisLength - ((numberOfBars + 1) * parseInt(options.barspacing)))/numberOfBars;\n barWidth = Math.floor(barWidth);\n var yScale = yAxis(data, options)[1];\n var barHeight;\n var barColour;\n var barStartPosition;\n\n //for loop that creates the bars for each of the data\n for (var i = 0; i < data.length; i++) {\n barStartPosition = 0;\n //Calculate x offset from y axis\n var xOffset = (i * barWidth) + ((i + 1) * parseInt(options.barspacing));\n var barId = \"bar\" + i;\n for ( var j = 0; j < data[i].length; j++) {\n barId = barId + j;\n barHeight = data[i][j] * yScale;\n drawBar(data, options, barId, xOffset, barHeight, barWidth, options.barcolour[j], barStartPosition, i, j);\n barStartPosition += barHeight;\n if(j === 0) {\n xAxisLabels(options.datalabels[i], barId);\n }\n }\n\n }\n\n // sets CSS formatting options for all bars, data and labels\n $(\".bar\").css({\n \"width\": barWidth,\n \"margin\": 0,\n \"padding\": 0,\n \"border\": 0\n });\n\n // formats the x labels in the color defined in options\n $(\".xaxislabels\").css({\"color\": options.datalabelcolor,\n \"top\": \"100%\",\n \"padding\": \"5%\"\n });\n\n $(\".xaxislabels, .xaxisdata\").css({ \"border\": \"0\",\n \"margin-bottom\": \"2%\",\n \"margin-top\": \"2%\",\n \"padding\": \"0\",\n \"position\": \"absolute\",\n \"text-align\": \"center\",\n \"width\": \"100%\",\n \"font-size\": \"small\"\n })\n}", "function anim1(){\n var margin, space, barWidth, rects, nb, g, data;\n\n ( function(){\n margin = 50;\n space = 10;\n barWidth = 30;\n\n nb = Math.floor( ( w - margin * 2 ) / ( barWidth + space ) );\n margin = ( w - ( nb * ( barWidth + space ) ) ) / 2;\n\n g = svg.append( 'g' )\n .attr( 'id', 'bars' );\n\n data = d3.range( nb ).map( function( d ){\n var pos = Math.random() < .5 ? -1 : 1,\n height = 20 + Math.random() * ( h / 2 - 20 - 20 ),\n h1 = 5 + Math.random() * ( height / 2 - 10),\n h2 = 5 + Math.random() * ( height / 2 - 10),\n h3 = height - h1 - h2;\n\n return {\n pos: pos,\n height: height,\n cumul: [ h1, h2, h3 ]\n };\n } );\n\n rects = g.selectAll( 'rect' )\n .remove()\n .data( d3.range( nb * 3 ) )\n .enter()\n .append( 'rect' )\n .datum( function( d, i ){\n var opacity = 1.0;\n if( data[ ~~( i / 3 ) ].pos < 0 ){\n if( i % 3 === 1 ){\n opacity = .6;\n }\n else if( i % 3 === 2 ){\n opacity = .3;\n }\n }\n else{\n if( i % 3 === 1 ){\n opacity = .6;\n }\n else if( i % 3 === 0 ){\n opacity = .3;\n }\n }\n return {\n opacity: opacity,\n pos: data[ ~~( i / 3 ) ].pos,\n height: data[ ~~( i / 3 ) ].height\n };\n } );\n\n step1();\n } )();\n\n // small bars graph\n function step1(){\n var count = 0;\n\n rects\n .attrs( {\n opacity: 1.0,\n fill: 'rgb( 251, 53, 80 )',\n y: h / 2,\n width: 8,\n height: 0\n } )\n .attr( 'x', function( d, i ){\n return margin + space / 2 + ( barWidth + space ) * ~~( i / 3 ) + ( i % 3) * 11;\n } )\n .transition()\n .delay( function( d, i ){\n return i * 10;\n } )\n .attr( 'height', function( d, i ){\n return data[ ~~( i / 3 ) ].cumul[ i % 3 ];\n } )\n .attr( 'y', function( d, i ){\n return d.pos < 0 ? h / 2 - ( data[ ~~( i / 3 ) ].cumul[ i % 3 ] ) : h / 2 ;\n } )\n .transition()\n .duration( 300 )\n .on( 'end', function(){\n count ++;\n if( count === nb *3 ) step2();\n } );\n }\n\n // stack bars\n function step2(){\n var count = 0;\n\n rects\n .transition()\n .attr( 'y', function( d, i ){\n var y;\n if( d.pos < 0 ){\n y = h / 2 - d.height;\n }\n else{\n y = h / 2;\n }\n for( var n = 0; n < i % 3; n++ ){\n y += data[ ~~( i / 3 ) ].cumul[ n ];\n }\n return y;\n } )\n .transition()\n .attr( 'x', function( d, i ){\n return margin + space / 2 + ( barWidth + space ) * ~~( i / 3 );\n } )\n .attr( 'opacity', function( d ){\n return d.opacity;\n } )\n .attr( 'width', barWidth )\n .transition()\n .duration( 300 )\n .on( 'end', function(){\n count ++;\n if( count === nb *3 ) step3();\n } )\n }\n\n // large bars graph\n function step3(){\n var count = 0;\n\n rects\n .transition()\n .duration( 300 )\n .attr( 'height', function( d, i ){\n var _h = 0;\n if( d.pos < 0 ){\n if( i % 3 === 0 ){\n _h = Math.abs( d.height );\n }\n }\n else{\n if( i % 3 === 2 ){\n _h = Math.abs( d.height );\n }\n }\n\n return _h;\n } )\n .attr( 'y', function( d, i ){\n var _y = h / 2;\n if( d.pos < 0 ){\n if( i % 3 === 0 ){\n _y = h / 2 - d.height;\n }\n }\n return _y ;\n } )\n .on( 'end', function(){\n count ++;\n if( count === nb *3 ) step4();\n } );\n }\n\n function step4(){\n var last = 0, count = 0;\n\n var sortedHeights = data.map( function( d ){\n return d.height * d.pos;\n } ).sort( function( a, b ){\n return -( a - b );\n } );\n\n rects\n .datum( function( d, i ){\n var index = sortedHeights.indexOf( d.height * d.pos );\n if( index == last ){\n index++;\n }\n last = index;\n return {\n orderedIndex: index\n }\n } )\n .transition()\n .duration( 500 )\n .attr( 'x', function( d ){\n return margin + space / 2 + ( barWidth + space ) * d.orderedIndex;\n } )\n .transition()\n .duration( 300 )\n .on( 'end', function(){\n count ++;\n if( count === data.length ) step5();\n } );\n }\n\n // disapperaing large bars\n function step5(){\n var count = 0;\n\n rects\n .transition()\n .duration( 300 )\n .attrs( {\n y: h / 2,\n height: 0\n } )\n .on( 'end', function(){\n count ++;\n if( count === nb *3 ) endStep();\n } );\n }\n\n function endStep(){\n rects.remove();\n g.remove();\n\n anim2();\n }\n }", "function drawB(sz, cl, id){\n cnt.lineWidth = sz;\n cnt.strokeStyle = cl;\n cnt.strokeRect(tl_p[id].tx +1, tl_p[id].ty +1, tl_size.w -2, tl_size.h -2);\n }", "function drawBarChart($scope){\n\tif(!$scope.chartTypeToggle.bar){\n\t\treturn;\n\t}\n\tvar svg = $scope.svg;\n\tvar $barChartProvider = $scope.$injector.get(\"$barChartProvider\");\n\t$scope.$barChartProvider = $barChartProvider;\n\t$barChartProvider.axisProvider = $scope.$axisProvider;\n\t$barChartProvider.svg = svg;\n\t$barChartProvider.effect = $scope.chartEffect;\n\t$barChartProvider.dataX = $scope.chartX;\n\t$barChartProvider.dataY = $scope.chartY;\n\t$barChartProvider.animate = $scope.chartAnimate;\n \n\t$barChartProvider.data = getDataFromScope($scope);\n\t\n\t$barChartProvider.draw();\n\t\n\t$scope.$watch('chartAnimate',function(newValue,oldValue){\n\t\t$barChartProvider.animate = newValue;\n\t\t//redraw only when animate was turned on from off.\n\t\tif(!oldValue && newValue && $scope.chartTypeToggle.bar){\n\t\t\t$barChartProvider.draw();\n\t\t}\n\t});\n\t$scope.$watch('chartEffect',function(newValue,oldValue){\n\t\t$barChartProvider.effect = newValue;\n\t\tif(oldValue!=newValue && $scope.chartTypeToggle.bar){\n\t\t\t$barChartProvider.draw();\n\t\t}\n\t});\n\t\n}", "function removeBarsTwoSided(select, data) {\r\n\r\n // select correct section\r\n var svgChangeTwoSidedData = svgTwoSided.selectAll(select)\r\n .data(data);\r\n\r\n // remove bars\r\n svgChangeTwoSidedData.exit()\r\n .transition()\r\n .duration(100)\r\n .style('fill-opacity', 1e-6)\r\n .remove();\r\n}", "function create_bars()\n{\n // Make the array empty\n arr=[];\n // Make the visible bars empty\n bar.innerHTML=\"\";\n // Take the no of bars from range\n var no_of_bar=arr_size.value;\n var arr_width_size =(500/no_of_bar);\n \n // Set the height\n // we will sort the bars on the basis of height\n for(var i=0;i<no_of_bar;i++)\n arr.push(Math.floor(Math.random()*100));\n\n\n //Set the height and width of visible bars \n for(var i=0;i<no_of_bar;i++)\n {\n \n var div = document.createElement(\"DIV\");\n var margin_size=0.1;\n div.classList.add(\"special\");\n div.style=\"margin:0%\" + margin_size + \"%; width:\" + (100/no_of_bar-(2*margin_size)) + \"%;\";\n var height = (arr[i]*5+10).toString();\n height = height+'px';\n div.style.height=height;\n bar.appendChild(div);\n }\n}", "function drawStressChart() {\n var data = google.visualization.arrayToDataTable([\n [\"Days\", \"Entry 1\", \"Entry 2\", \"Entry 3\"],\n [days[0], stress[18], stress[19], stress[20]],\n [days[1], stress[15], stress[16], stress[17]],\n [days[2], stress[12], stress[13], stress[14]],\n [days[3], stress[9], stress[10], stress[11]],\n [days[4], stress[6], stress[7], stress[8]],\n [days[5], stress[3], stress[4], stress[5]],\n [days[6], stress[0], stress[1], stress[2]],\n ]);\n\n var options = {\n width: 230,\n height: 200,\n vAxis: {\n viewWindow: {\n min: 0,\n },\n },\n colors: [\"#f3b49f\", \"#ec8f6e\", \"#e6693e\"],\n chart: {\n title: \"Weekly Stress Level\",\n title: { position: \"none\" },\n },\n legend: { position: \"none\" },\n };\n\n var chart = new google.charts.Bar(document.getElementById(\"stressChart\"));\n\n chart.draw(data, google.charts.Bar.convertOptions(options));\n}", "draw() {\n const bars = 200;\n this.canvasCtx.fillStyle = 'white';\n this.canvasCtx.fillRect(0, 0, this.canvas.width, this.canvas.height);\n if (!this.stream) {\n return;\n }\n this.analyser.getByteFrequencyData(this.freqs);\n let isInversed = true;\n for (let i = 0; i < bars; i++) {\n const radians = (Math.PI * 2) / this.canvas.width;\n const barHeight = this.freqs[i] * 0.25;\n const xStart = i * 2;\n const yStart = this.canvas.height / 2;\n const xEnd = i * 2;\n let yEnd;\n if (isInversed) {\n isInversed = false;\n yEnd =\n this.canvas.height / 2 + Math.sin(radians * i) * barHeight;\n } else {\n isInversed = true;\n yEnd =\n this.canvas.height / 2 - Math.sin(radians * i) * barHeight;\n }\n const color = `rgb(${237}, ${73}, ${62})`;\n this.canvasCtx.strokeStyle = color;\n this.canvasCtx.lineWidth = 1;\n this.canvasCtx.beginPath();\n this.canvasCtx.moveTo(xStart, yStart);\n this.canvasCtx.lineTo(xEnd, yEnd);\n this.canvasCtx.stroke();\n }\n requestAnimationFrame(() => this.draw());\n }", "function drawBuckets(){\n for (var spot in bucketSpots) {\n ex.graphics.ctx.strokeStyle = \"black\";\n ex.graphics.ctx.fillStyle = bucketColor;\n var x = bucketSpots[spot][0];\n var y = bucketSpots[spot][1];\n var w = bucketSpots[spot][2];\n var h = bucketSpots[spot][3];\n ex.graphics.ctx.fillRect(x, y, w, h);\n ex.graphics.ctx.setLineDash([]);\n ex.graphics.ctx.strokeRect(x, y, w, h);\n ex.graphics.ctx.fillStyle = \"black\";\n ex.graphics.ctx.font = fontSize + \"px Arial\";\n ex.graphics.ctx.textAlign = \"center\";\n ex.graphics.ctx.textBaseline=\"middle\";\n ex.graphics.ctx.fillText(spot,x+w/2,y+h/2); \n }\n for (var spot in emptySpots) {\n var x = emptySpots[spot][0];\n var y = emptySpots[spot][1];\n var w = emptySpots[spot][2];\n var h = emptySpots[spot][3];\n ex.graphics.ctx.setLineDash([6]);\n ex.graphics.ctx.strokeRect(x,y,w,h);\n }\n }", "function drawBuckets(){\n for (var spot in bucketSpots) {\n ex.graphics.ctx.strokeStyle = \"black\";\n ex.graphics.ctx.fillStyle = bucketColor;\n var x = bucketSpots[spot][0];\n var y = bucketSpots[spot][1];\n var w = bucketSpots[spot][2];\n var h = bucketSpots[spot][3];\n ex.graphics.ctx.fillRect(x, y, w, h);\n ex.graphics.ctx.setLineDash([]);\n ex.graphics.ctx.strokeRect(x, y, w, h);\n ex.graphics.ctx.fillStyle = \"black\";\n ex.graphics.ctx.font = fontSize + \"px Arial\";\n ex.graphics.ctx.textAlign = \"center\";\n ex.graphics.ctx.textBaseline=\"middle\";\n ex.graphics.ctx.fillText(spot,x+w/2,y+h/2); \n }\n for (var spot in emptySpots) {\n var x = emptySpots[spot][0];\n var y = emptySpots[spot][1];\n var w = emptySpots[spot][2];\n var h = emptySpots[spot][3];\n ex.graphics.ctx.setLineDash([6]);\n ex.graphics.ctx.strokeRect(x,y,w,h);\n }\n }", "function cypherTokenDrawBars() {\r\n if (!this.actor || this.data.displayBars === CONST.TOKEN_DISPLAY_MODES.NONE)\r\n return;\r\n\r\n [\"bar1\", \"bar2\", \"bar3\"].forEach((b, i) => {\r\n //0.8: when creating a new tokens, the bars property does not exist...\r\n if (!this.hasOwnProperty(\"bars\"))\r\n return;\r\n\r\n const bar = this.bars[b];\r\n const attr = this.getBarAttribute(b);\r\n\r\n if (!attr || attr.type !== \"bar\")\r\n return bar.visible = false;\r\n\r\n this._drawBar(i, bar, attr);\r\n bar.visible = true;\r\n });\r\n}", "function retourneBarres() {\n\n requestAnimationFrame(retourneBarres)\n\n x = 0\n // \"getByteFrequencyData\" va nous retourner une valeur entre 0 et 255 par rapport à une fréquence de notre tableaud de fréquence\n // Il nous permettre de gérer la couleur (255 en rgb) mais également la hauteur de nos barre\n analyser.getByteFrequencyData(tableaufrequence)\n ctx.fillStyle = \"#000\";\n ctx.fillRect(0,0,WIDTH,HEIGHT)\n\n //Pour chaque fréquence, on déssinera un petit rectangle\n for(let i = 0; i < frequencesAudio; i++){\n\n hauteurBarre = tableaufrequence[i]\n\n // Gérance des couleurs en rgb\n\n let r = 250\n let g = 50\n let b = i\n\n ctx.fillStyle = `rgb(${r}, ${g}, ${b})`\n ctx.fillRect(x, HEIGHT, largeurBarre, -hauteurBarre)\n\n // A chaque création de rectangle,\n // Pour que les barres se crée les unes à coté des autres\n x += largeurBarre + 1\n }\n\n\n }", "function display() {\n wrapEdges();\n background(255);\n textSize(12);\n textStyle(NORMAL);\n\n if (showarrows) {\n textSize(20);\n strokeWeight(0);\n fill(255, 0, 0);\n text(\"Velocity\", 0.8 * width, 0.8 * height + 75);\n /*\n fill(0,0,255);\n text(\"Force\",0.8*width,0.8*height+50);\n fill(204,0,204);\n text(\"Acceleration\",0.8*width,0.8*height+75);\n */\n }\n\n strokeWeight(10);\n var tri_width = 7;\n if (showarrows) {\n var x_line = 5;\n var y_line = 5;\n var line_len = 100;\n drawLine(x_line, y_line, x_line, y_line + line_len);\n drawLine(x_line, y_line, x_line + line_len, y_line);\n fill(0);\n drawTriangle(x_line - tri_width / 2, y_line + line_len, x_line + tri_width / 2, y_line + line_len, x_line, y_line + line_len + 10);\n drawTriangle(x_line + line_len, y_line - tri_width / 2, x_line + line_len, y_line + tri_width / 2, x_line + line_len + 10, y_line);\n strokeWeight(0);\n drawText(\"+x\", x_line + line_len + 15, y_line);\n drawText(\"+y\", x_line, y_line + line_len + 15);\n }\n\n\n if (iterations % 5 == 1) {\n append(xhistory, x);\n append(yhistory, y);\n }\n\n iterations += 1;\n\n if (keyIsPressed) {\n isrunning = true;\n }\n\n MaxLength = 50;\n if (xhistory.length > MaxLength) {\n xhistory = subset(xhistory, xhistory.length - MaxLength, xhistory.length);\n yhistory = subset(yhistory, yhistory.length - MaxLength, yhistory.length);\n }\n\n fill(0, 0, 0); //If more text is written elsewhere make sure the default is black\n stroke(0, 0, 0); // If more lines are drawn elsewhere make sure the default is black\n strokeWeight(0);\n\n textSize(20);\n strokeWeight(1);\n drawText(\"Click this screen first!\", 0.35 * width, 0.8 * height);\n drawText(\"then move the arrow keys!\", 0.32 * width, 0.75 * height);\n}", "function drawChart() {\n stroke(0);\n yAxis();\n xAxis();\n}", "function draw_graph_tow_bar(svg,data,height,valeur_coleur_histo1,valeur_coleur_histo2,xScale, yScale,yScale_2,div_,path_,id_path)\r\n\t{\r\n\t\t//histo 1\r\n\t\tsvg.selectAll(\".bar\")\r\n\t\t\t.data(data)\r\n\t\t\t.enter()\r\n\t\t\t.append(\"rect\")\r\n\t\t\t.attr(\"height\",0)\r\n\t\t\t.attr(\"y\", height)\r\n\t\t\t.attr(\"id\",function(d,i) {return 'rect1'+(i+100);})\r\n\t\t\t.on(\"mouseover\", function(d,i) { \r\n\t\t\t\t\tdocument.getElementById('rect1'+(i+100)).style.stroke=\"white\";\r\n\t\t\t\t\tdocument.getElementById('rect2'+(i+100)).style.stroke=\"white\";\r\n\t\t\t\t\tif(valeur_coleur_histo1==\"url(#highcharts-32)\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.setAttribute(\"fill\", \"\trgb(155,206,0)\");\t//\tmodifier la coleur du rectangle en survolant\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(valeur_coleur_histo2==\"url(#highcharts-33)\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdocument.getElementById('rect2'+(i+100)).setAttribute(\"fill\",\"rgb(255,126,40)\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdiv_.transition() \r\n\t\t\t\t\t\t.duration(200) \r\n\t\t\t\t\t\t.style(\"opacity\", .9); \r\n\t\t\t\t\tdiv_.html(\"CA en France pour l'année:\"+d.annee + \"<br/><span class='vert'>Dettes :</span>\"+ d.gdp\r\n\t\t\t\t\t\t\t+ \"<br/><span class='orange'>CA :</span>\"+ d.chiffre_af) \r\n\t\t\t\t\t\t.style(\"left\",(d3.event.pageX + 10) + \"px\") \r\n\t\t\t\t\t\t.style(\"top\", (d3.event.pageY - 28) + \"px\");\r\n\t\t\t\t\tdocument.getElementById(id_path).style.visibility=\"visible\";\r\n\t\t\t\t\tpath_.attr(\"d\",\"M \"+(xScale(d.annee)+30)+\" \"+height+\" L \"+(xScale(d.annee)+30)+\" 0\");\t\r\n\t\t\t\t}) \r\n\t\t\t.on(\"mouseout\", function(d,i) { \r\n\t\t\t\t\tdocument.getElementById('rect1'+(i+100)).style.stroke=\"#FFFFFF\";\r\n\t\t\t\t\tdocument.getElementById('rect2'+(i+100)).style.stroke=\"#FFFFFF\";\r\n\t\t\t\t\tthis.setAttribute(\"fill\", valeur_coleur_histo1);\t//\tmodifier la coleur du rectangle en survolant\r\n\t\t\t\t\tdocument.getElementById('rect2'+(i+100)).setAttribute(\"fill\",valeur_coleur_histo2);\r\n\t\t\t\t\tdiv_.transition() \r\n\t\t\t\t\t\t.duration(200) \r\n\t\t\t\t\t\t.style(\"opacity\", 0);\r\n\t\t\t\t\tdocument.getElementById(id_path).style.visibility=\"hidden\";\r\n\t\t\t\t})\r\n\t\t\t.transition().duration(3008)\r\n\t\t\t.attr({\r\n\t\t\t\t\"x\":function(d){return xScale(d.annee)+8;},\r\n\t\t\t\t\"y\":function(d){return yScale(d.gdp);},\r\n\t\t\t\t\"width\":xScale.rangeBand()/3,\r\n\t\t\t\t\"height\":function(d){return height - yScale(d.gdp);}\r\n\t\t\t\t})\r\n\t\t\t .attr(\"fill\",valeur_coleur_histo1)\r\n\t\t\t;\r\n\t\t\t\r\n\t\t//histo 2\r\n\t\tsvg.selectAll(\".bar\")\r\n\t\t\t.data(data)\r\n\t\t\t.enter()\r\n\t\t\t.append(\"rect\")\r\n\t\t\t.attr(\"id\",function(d,i) {return 'rect2'+(i+100);})\r\n\t\t\t.on(\"mouseover\", function(d,i) { \r\n\t\t\t\t\tdocument.getElementById('rect1'+(i+100)).style.stroke=\"white\";\r\n\t\t\t\t\tdocument.getElementById('rect2'+(i+100)).style.stroke=\"white\";\r\n\t\t\t\t\tif(valeur_coleur_histo2==\"url(#highcharts-33)\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.setAttribute(\"fill\", \"\trgb(255,126,40)\");\t//\tmodifier la coleur du rectangle en survolant\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif(valeur_coleur_histo1==\"url(#highcharts-32)\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdocument.getElementById('rect1'+(i+100)).setAttribute(\"fill\",\"rgb(155,206,0)\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdiv_.transition() \r\n\t\t\t\t\t\t.duration(200) \r\n\t\t\t\t\t\t.style(\"opacity\", .9); \r\n\t\t\t\t\tdiv_.html(\"CA en France pour l'année:\"+d.annee + \"<br/><span class='vert'>Dettes :</span>\"+ d.gdp\r\n\t\t\t\t\t\t\t+ \"<br/><span class='orange'>CA :</span>\"+ d.chiffre_af) \r\n\t\t\t\t\t\t.style(\"left\",(d3.event.pageX + 10) + \"px\") \r\n\t\t\t\t\t\t.style(\"top\", (d3.event.pageY - 28) + \"px\");\r\n\t\t\t\t\tdocument.getElementById(id_path).style.visibility=\"visible\";\r\n\t\t\t\t\tpath_.attr(\"d\",\"M \"+(xScale(d.annee)+30)+\" \"+height+\" L \"+(xScale(d.annee)+30)+\" 0\");\t\r\n\t\t\t\t}) \r\n\t\t\t.on(\"mouseout\", function(d,i) { \r\n\t\t\t\t\tdocument.getElementById('rect1'+(i+100)).style.stroke=\"#FFFFFF\";\r\n\t\t\t\t\tdocument.getElementById('rect2'+(i+100)).style.stroke=\"#FFFFFF\";\r\n\t\t\t\t\tthis.setAttribute(\"fill\",valeur_coleur_histo2);\t//\tmodifier la coleur du rectangle en survolant\r\n\t\t\t\t\tdocument.getElementById('rect1'+(i+100)).setAttribute(\"fill\",valeur_coleur_histo1);\r\n\t\t\t\t\tdiv_.transition() \r\n\t\t\t\t\t\t.duration(200) \r\n\t\t\t\t\t\t.style(\"opacity\", 0);\r\n\t\t\t\t\tdocument.getElementById(id_path).style.visibility=\"hidden\";\r\n\t\t\t\t})\r\n\t\t\t.transition().duration(3008)\r\n\t\t\t.attr({\r\n\t\t\t\t\"x\":function(d){return xScale(d.annee)+(xScale.rangeBand()/2.5)+8;},\r\n\t\t\t\t\"y\":function(d){return yScale_2(d.chiffre_af);},\r\n\t\t\t\t\"width\":xScale.rangeBand()/3,\r\n\t\t\t\t\"height\":function(d){return height - yScale_2(d.chiffre_af);}\r\n\t\t\t\t})\r\n\t\t\t .attr(\"fill\",valeur_coleur_histo2);\r\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 }", "_calcWidthBar(d, i) {\n if (d.indexData !== -1) {\n return this.model.barScale(this.model.data.children.data[this._vOrder[d.indexData]].edge.values[i]);\n }\n else\n return 0; // Do not draw the rectangle\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 }", "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}" ]
[ "0.64597493", "0.6372491", "0.6320486", "0.6312355", "0.63011384", "0.6283512", "0.6268852", "0.62001646", "0.6173345", "0.6172641", "0.61577135", "0.6131841", "0.6113987", "0.60873556", "0.6084845", "0.60604733", "0.60337156", "0.6032944", "0.5973234", "0.5948438", "0.5945598", "0.5923654", "0.5888558", "0.58836097", "0.5881195", "0.58663374", "0.58465815", "0.58358675", "0.58321345", "0.58128744", "0.58081335", "0.5803215", "0.57861096", "0.5781924", "0.5779252", "0.5774066", "0.5764123", "0.57634664", "0.57449365", "0.57387894", "0.57226825", "0.57150304", "0.5708333", "0.57059383", "0.5705156", "0.5702692", "0.5694353", "0.56941736", "0.5691911", "0.56916666", "0.5687447", "0.56844395", "0.5681561", "0.56669873", "0.56260276", "0.56232935", "0.5621098", "0.56140715", "0.561079", "0.5607726", "0.56031936", "0.55976725", "0.55966276", "0.55959886", "0.5592704", "0.55868775", "0.55767936", "0.5576554", "0.55715764", "0.5562054", "0.55561984", "0.5555877", "0.5538807", "0.55366856", "0.55353594", "0.5533504", "0.55281454", "0.5525549", "0.5524053", "0.55225986", "0.5520739", "0.55199105", "0.5516817", "0.5514999", "0.55144846", "0.5509737", "0.55081445", "0.55074716", "0.55060273", "0.5497968", "0.54898715", "0.54898715", "0.54885095", "0.54846436", "0.5467575", "0.54669476", "0.54625624", "0.5460205", "0.5458029", "0.54518265", "0.5451316" ]
0.0
-1
Create a new transaction
function saveTransactionAsync(transaction) { return transaction.save(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createTransaction(companyName, companyId, invoiceNum, vendorId, total, sheetId) {\n\tdb.Transaction.create({\n\t\tcompanyName: companyName,\n\t\tcompanyId: companyId,\n\t\tinvoiceNumber: invoiceNum,\n\t\tvendorId: vendorId,\n\t\ttotal: total,\n\t\tSheetId: sheetId\n\t}).then(function(result) {\n\t\tconsole.log('new transaction created for sheet ' + sheetId);\n\t}).catch(function (err) {\n\t\tconsole.log(err);\n\t});\n}", "static newTransaction(props) {\n const transactionId = `TRX::${(0, idGenerator_1.generateId)()}`;\n const createdAt = luxon_1.DateTime.utc().toString();\n const newTransactionProps = {\n transactionId,\n createdAt,\n transactionStatus: 'new',\n inputs: props.inputs,\n outputs: props.outputs,\n };\n if (props.tags) {\n newTransactionProps.tags = Object.assign({}, props.tags);\n }\n if (props.xids) {\n newTransactionProps.xids = Object.assign({}, props.xids);\n }\n const newEntity = new Transaction(newTransactionProps);\n return newEntity;\n }", "createTransaction(date, account, amount, title, description)\n {\n let transaction = new Transaction(\n this.getNewTransactionId(),\n date,\n this.getAccount(account),\n amount,\n title,\n description\n )\n\n this.insertTransaction(transaction)\n\n return transaction\n }", "function createTransaction() {\n const sql = `INSERT INTO ${table} VALUES ('1')`;\n\n const request = new Request(sql, (err, rowCount) => {\n if (err) {\n console.log('Insert failed');\n throw err;\n }\n\n console.log('new Request cb');\n\n // Call connection.beginTransaction() method in this 'new Request' call back function\n beginTransaction();\n });\n\n connection.execSql(request);\n}", "function newTransaction () {\n\t\t\t\t//create a new transaction\n\t\t\t\tvar Transaction = Parse.Object.extend(\"Transaction\");\n\t\t\t\tvar transaction = new Transaction();\n\t\t\t\t \n\t\t\t\ttransaction.set(\"credits\", credits);\n\t\t\t\ttransaction.set(\"dollars\", chargeAmount);\n\t\t\t\ttransaction.set(\"type\", \"purchase\");\n\t\t\t\ttransaction.set(\"status\", \"processed\");\n\t\t\t\ttransaction.set(\"user\", currentUser);\n\t\t\t\t \n\t\t\t\ttransaction.save(null, {\n\t\t\t\t success: function(transaction) {\n\t\t\t\t updateBalance();\n\t\t\t\t growl.addSuccessMessage('You have added ' + credits + ' new credits!');\n\t\t\t\t },\n\t\t\t\t error: function(transaction, error) {\n\t\t\t\t // Execute any logic that should take place if the save fails.\n\t\t\t\t // error is a Parse.Error with an error code and description.\n\t\t\t\t alert('Failed to create new object, with error code: ' + error.message);\n\t\t\t\t }\n\t\t\t\t});\n\t\t\t\t\n\t\t\t}", "createTransaction(transaction){\n\t\tthis.pendingTransactions.push(transaction);\n\t}", "addNewItemTransaction() {\n let transaction = new AddNewItem_Transaction(this);\n this.tps.addTransaction(transaction);\n }", "createTransaction(transaction){\n this.pendingTransactions.push(transaction);\n }", "createTx(utxos, amount, fee, toAddress) {\n const amountPlusFee = parseFloat(new BigNumber(amount).plus(fee).toString(10));\n\n return signer.createTransaction(utxos, toAddress, amountPlusFee, fee, this.getSecret(), this.getAddress());\n }", "addTransaction (params){\r\n return Api().post('/savetransaction', params)\r\n }", "function makeTransaction(params, callback) {\n params.amount = parseFloat(params.amount);\n\n if (!params.amount || params.amount < 0) {\n return callback({ error: 'A valid amount must be specified.' });\n }\n\n if (!params.transaction_id) {\n return callback({ error: 'A valid TBC transaction ID must be specified.' });\n }\n\n if (!params.client_ip_address || !SIMPLE_IPv4_REGEX.test(params.client_ip_address)) {\n return callback({ error: 'A valid client IP address must be specified.' });\n }\n\n var tbcFields = {\n command: COMMAND.MAKE_DMS_TRANSACTION,\n trans_id: params.transaction_id,\n amount: convertAmountToTetri(params.amount),\n currency: CURRENCY.GEL,\n client_ip_addr: params.client_ip_address,\n description: params.description || 'Executing CARD API Transaction',\n language: 'GE',\n msg_type: 'DMS'\n };\n\n tbcAPICall(tbcFields, function(err, tbcResponse) {\n if (err) {\n return callback(err);\n }\n return callback(null, tbcResponse);\n });\n}", "async beginTransaction() {\n }", "function transact(){\n const tid = transactions.length;\n const transaction = {\n tid: tid,\n timestamp: new Date(),\n user: 0\n };\n\n transactions.push(transaction);\n return transaction;\n }", "function createTransaction() {\n // Create an object and gather the information for the transaction.\n\n // To generate a unique id, get all the transactions and add one to the id of the last one.\n\n var allTransactions = getStorage();\n\n // Read the first ID in each array and get highest ID.\n\n var first =\n allTransactions.logs.incomes[0] !== undefined\n ? allTransactions.logs.incomes[0].id\n : 0;\n\n var second =\n allTransactions.logs.expenses[0] !== undefined\n ? allTransactions.logs.expenses[0].id\n : 0;\n\n var highest = Math.max(first, second);\n\n var generatedId = highest + 1;\n if (document.getElementById(\"checkbox\").checked === false) {\n typeEntered = \"income\";\n } else {\n typeEntered = \"expense\";\n }\n descriptionEntered = document.getElementById(\"note\").value;\n valueEntered = document.getElementById(\"value\").value;\n\n var transaction = {\n id: generatedId,\n type: typeEntered,\n description: descriptionEntered,\n value: valueEntered\n };\n\n return transaction;\n}", "function makeTransaction(name, previous, recipients) {\n const directory = `wallets/${name}`;\n const publicKey = readPubKey(name);\n const type = \"normal\";\n const data = {publicKey, previous, fee: FEE, recipients, type}\n const args = {\n data, \n isNew: true,\n passphrase: name,\n directory\n }\n const transaction = new Transaction(args);\n return transaction;\n}", "newTransaction(publicKey, nonce, recipient, amount = 0.0, data = null, signature) {\n var sender_addr = utils.getAddress(publicKey);\n var txn_str = utils.transactionToString(sender_addr, nonce, recipient, amount, data);\n var txn_id = utils.hash(txn_str);\n var transaction = this.currentTransactionById(txn_id);\n if(!transaction) {\n if(utils.verifySign(publicKey, txn_str, signature)) {\n transaction = {\n sender: sender_addr,\n nonce: nonce,\n recipient: recipient,\n amount: amount,\n data: data,\n timestamp: utils.timestamp(),\n publicKey: publicKey,\n signature: signature,\n id: txn_id\n };\n this.currentTransactions.push(transaction);\n } else {\n throw('Signature invalid');\n }\n }\n return transaction;\n }", "function Transaction() {\n\n function typeTranslate(type) {\n switch (type) {\n case 'in':\n return 'Incoming';\n case 'out':\n return 'Spent';\n case 'pending':\n return 'pending';\n case 'pool':\n return 'Pool';\n case 'failed':\n return 'Failed';\n default:\n throw new Error('Unknown transaction type: ' + type);\n }\n }\n\n function format(val) {\n return val < 10 ? '0' + val.toString() : val.toString();\n }\n\n function toTime(dt) {\n return [dt.getHours(), dt.getMinutes(), dt.getSeconds()].map(format).join(':');\n }\n\n function toDate(dt) {\n return [dt.getDate(), dt.getMonth() + 1, dt.getFullYear()].map(format).join('.');\n }\n\n this.generateTableRow = function (tx, price_usd) {\n\n var type = typeTranslate(tx.type);\n var dt = new Date(tx.timestamp * 1000);\n var date = toDate(dt);\n var time = toTime(dt);\n var amount = Math.round(tx.amount / 1000000000) / 1000;\n var usd = Math.round(amount * price_usd);\n var template = '\\n <td>' + type + '</td>\\n <td>\\n <div class=\"transactions-table__xmr bold\">' + amount + ' XMR</div>\\n <div class=\"transactions-table__usd\">' + usd + ' USD</div>\\n </td>\\n <td>' + tx.payment_id + '</td>\\n <td>' + date + '</td>\\n <td data-transaction-id=\"' + tx.txid + '\">\\n <div class=\"transactions-table__time\">' + time + '</div>\\n <div class=\"transactions-table__details\">details</div>\\n </td>\\n ';\n var tr = document.createElement('tr');\n tr.innerHTML = template;\n tr.className = \"tr-generated\";\n return tr;\n };\n\n this.compare = function (tx1, tx2) {\n return tx1.txid === tx2.txid;\n };\n\n this.datetime = function (tx) {\n var dt = new Date(tx.timestamp * 1000);\n return { date: toDate(dt), time: toTime(dt) };\n };\n\n // this.findRestorHeight = function(txs){\n // let out = txs\n // .filter((tx)=>{\n // return tx.type === 'out';\n // }).sort((tx1,tx2)=>{\n // return tx1.timestamp - tx2.timestamp;\n // });\n // };\n}", "function Transaction() {\n if (!(this instanceof Transaction)) {\n return new Transaction();\n }\n this.Type = DEFAULT_TYPE;\n this.PayloadVer = PAYLOAD_VERSION;\n this.LockTime = DEFAULT_NLOCKTIME;\n this.Attributes = [];\n this.UTXOInputs = [];\n this.Outputs = [];\n this.CrossChainAsset = [];\n this.Programs = [];\n this.Amount = undefined;\n this.Memo = undefined;\n this.Fee = undefined;\n this.json = undefined;\n this.rawTx = undefined;\n}", "function prepareTransaction() {\r\n let amountInt=0;\r\n if (amount.value == \"\") {\r\n amount.focus();\r\n return false;\r\n }\r\n amountInt = parseInt(amount.value);\r\n \r\n if (recipient == \"\") {\r\n recipient.focus();\r\n return false;\r\n }\r\n let recipientAdr = recipient.value;\r\n\r\n let pubkey = publickey.value;\r\n if (pubkey == \"\") {\r\n publickey.focus();\r\n return false;\r\n }\r\n let prvkey = privatekey.value;\r\n if (prvkey == \"\") {\r\n privatekey.focus();\r\n return false;\r\n }\r\n\r\n let ts = _getTimestamp();\r\n let due = network.value === 'T' ? 60 : 24 * 60;\r\n let deadline = ts + due * 60;\r\n const payload = \"4e454d20415049204578616d706c657320666f72206c6561726e696e67\"; //NEM API Examples for learning \r\n const fee = 500000;\r\n const typeTx = 257;\r\n let data = {\r\n \"transaction\": {\r\n \"timeStamp\": _getTimestamp(),\r\n \"amount\": amountInt,\r\n \"fee\": fee,\r\n \"recipient\": recipientAdr,\r\n \"type\": typeTx,\r\n \"deadline\": deadline,\r\n \"message\": {\r\n \"payload\": payload,\r\n \"type\": 1\r\n },\r\n \"version\": _getVersion(1),\r\n \"signer\": pubkey,\r\n \"mosaics\": []\r\n },\r\n \"privateKey\": prvkey\r\n };\r\n\r\n _doPost('/transaction/prepare-announce', data);\r\n }", "function beginTransaction(client, errorCallback) {\n var tx = new Transaction(client);\n tx.on('error', errorCallback);\n tx.begin();\n return tx;\n}", "function newTransaction() {\n inquirer.prompt([{\n type: 'confirm',\n name: 'choice',\n message: 'Would you like to perform another transaction?'\n }]).then(function (answer) {\n if (answer.choice) {\n start();\n }\n else {\n console.log(chalk.redBright(\"===============================================\"));\n console.log(chalk.greenBright(\"Thank You So Much! \") + chalk.yellowBright(\"Wishing You \") + chalk.blueBright(\"A Wonderful Day!\"));\n console.log(chalk.magentaBright(\"===============================================\"));\n console.log(\"\");\n console.log(\"\");\n console.log(\"\");\n connection.end();\n }\n });\n }", "static createTransaction(cid, id, mId, amount, driverPayout) {\n const gateway = BraintreeHelper.getBraintreeRef();\n\n return new Promise((resolve, reject) => {\n\n gateway.transaction.sale({\n customerId: id,\n amount: amount.toString(),\n serviceFeeAmount: driverPayout.toString(),\n merchantAccountId: mId,\n options: {\n submitForSettlement: true\n }\n }, function (err, result) {\n if (result && result.success) {\n resolve(result);\n // return cb({ success: true, result: result });\n } else {\n reject(err)\n }\n // if (result && result.success) {\n // resolve(result);\n // return cb({ success: true, result: result });\n // } else if (result.success == false) {\n // err ? reject(err) : resolve(result);\n // return cb({ success: false, result: result });\n // } else {\n // err ? reject(err) : resolve(result);\n // return cb({ success: false, result: err });\n // }\n });\n\n\n // gateway.paymentMethod.delete(token, function (err, deleted) {\n // err ? reject(err) : resolve(result);\n // });\n })\n\n\n }", "transaction(fun, transaction) {\n const tx = { transaction: transaction };\n if (transaction) {\n return sequelize.transaction(tx, fun)\n .catch(err => Promise.reject(err));\n } else {\n return sequelize.transaction(fun)\n .catch(err => Promise.reject(err));\n }\n }", "addNewUserTransaction(data) {\n return Api().post(`/transactions`, data);\n }", "createTransaction(recipient, amount,blockchain, transactionPool){\n\n this.balance = this.calculateBalance(blockchain);\n\n if(amount > this.balance){\n console.log(`Amount: ${amount} exceeds the current balance: ${this.balance}`);\n return;\n }\n\n let transaction = transactionPool.existingTransaction(this.publicKey);\n\n if(transaction){\n // creates more outputs\n transaction.update(this,recipient,amount)\n }\n else{\n // creates a new transaction and updates the transaction pool\n transaction = Transaction.newTransaction(this,recipient,amount);\n transactionPool.updateOrAddTransaction(transaction);\n }\n\n return transaction;\n\n }", "executeOP(blockchain,transaction){\n switch (transaction.type) {\n case TRANSACTION_SYNTAX.createAccount.type:\n blockchain.accounts.initialize(transaction);\n break;\n }\n }", "function addTransaction(tx) {\n\n\t // Get user's secret key\n\t keychain.requestSecret(id.account, id.username, function (err, secret) {\n\t if (err) {\n\t console.log(\"client: txQueue: error while unlocking wallet: \", err);\n\n\t return;\n\t }\n\n\t var transaction = ripple.Transaction.from_json(tx.tx_json);\n\n\t transaction.remote = network.remote;\n\t transaction.secret(secret);\n\n\t // If account is funded submit the transaction right away\n\t if ($scope.account.Balance) {\n\t transaction.submit();\n\t }\n\n\t // If not, add it to the queue.\n\t // (Will be submitted as soon as account gets funding)\n\t else {\n\t var item = {\n\t tx_json: tx.tx_json,\n\t type: tx.tx_json.TransactionType\n\t };\n\n\t // Additional details depending on a transaction type\n\t if ('TrustSet' === item.type) {\n\t item.details = tx.tx_json.LimitAmount;\n\t }\n\n\t $scope.userBlob.unshift(\"/txQueue\", item);\n\t }\n\t });\n\t }", "push(action, params, callback) {\n if (process.env.NODE_ENV !== 'production' && typeof action !== 'function') {\n throw TypeError(`Tried to create Transaction for ${ action }, but it is not a function.`)\n }\n\n let transaction = Transaction.create(tag(action).toString())\n let body = action.apply(null, flatten(params))\n\n this.transactions.push(transaction)\n\n return Transaction.run(transaction, body, this.reconcile, this.release, callback, this)\n }", "async function createTransaction() {\n // Get a fee estimate from Smart Fee:\n const smartFeeResponse = await request({\n url: `https://api.smartfee.live/latest`,\n headers: {\n 'X-API-KEY': smartFeeApiKey\n }\n })\n const smartFeeResponseObject = JSON.parse(smartFeeResponse)\n // Use the 2-block target.\n const twoBlockFeeRateSatsPerKb = smartFeeResponseObject.feeByBlockTarget[\"2\"]\n\n\n // Send a BitGo transaction with a custom fee rate:\n const wallet = await bitgo.coin('tbtc').wallets().get({ id: WALLET_ID })\n const sendParams = {\n feeRate: twoBlockFeeRateSatsPerKb,\n // TODO: replace below with your transaction info:\n /*\n recipients: [{\n amount: 0.01 * 1e8,\n address: '2NFfxvXpAWjKng7enFougtvtxxCJ2hQEMo4',\n }, {\n amount: 0.01 * 1e8,\n address: '2MsMFw75RKRiMb548q6W4jrJ63jwvvDdR2w',\n }],\n walletPassphrase: 'secretpassphrase1a5df8380e0e30'\n */\n }\n const result = await wallet.sendMany(sendParams)\n console.dir(result)\n}", "createTransaction({recipient, amount, chain}) {\n\t\tif (chain) {\n\t\t\tthis.balance = Wallet.calculateBalance({\n\t\t\t\tchain,\n\t\t\t\taddress: this.publicKey\n\t\t\t});\n\t\t}\n\t\tif(amount > this.balance) {\n\t\t\tthrow new Error('Amount exceeds balance');\n\t\t}\n\n\t\treturn new Transaction({ senderWallet: this, recipient, amount })\n\t}", "addWalletTransaction(payload) {\n return this.request.post('transaction', payload);\n }", "static newTransaction(sendersWallet, recipientAddress, amount){\n //check balance\n if(amount > sendersWallet){\n console.log(`The amount ${amountToSend} is exceeding the current balance`);\n return;\n }\n //creating the two outputs of the transaction\n\n //Every time the user sends the whole amount he has\n //pushing two objects\n return Transaction.transactionWithOutputs(sendersWallet,[ //first object output has the amount that must be left to the sender wwallet\n {amount : sendersWallet.balance - amount, address: sendersWallet.publicKey},\n {amount, address: recipientAddress}]);\n\n return transaction;\n }", "function createFirstBlankTransaction(self) {\n\t\tlet transParams = self.generateTransParams(self.wallet.publicKey, 0, 'The blank transaction to register address!');\n\t\tself.iota.api.sendTransfer(self.wallet.publicKey, 3, 9, transParams, (error, response) => {\n\t if (error) {\n\t \tconsole.log(error);\n\t } else {\n\t \tconsole.log('Register address transaction details:');\n\t console.log(response);\n\t }\n\t\t});\n\t}", "function create_transaction(){\n\n var data_sent = {\n input_address: bitcoin_address,\n output_address:$(\"[name='recipient-bitcoin-address']\").val(),\n value: parseInt($(\"[name='amount']\").val())\n };\n\n unsigned_transaction={}\n ajaxPost('/blockcypher/create_transaction',JSON.stringify(data_sent), function(response){\n unsigned_transaction = response;\n $(\"#tosign-data\").text(unsigned_transaction.tosign[0]);\n $(\"#step-2\").removeAttr('hidden');\n\n\n },function(error){\n showError(error);\n });\n}", "function createTransaction(dbInfo, mode, callback) {\n try {\n var tx = dbInfo.db.transaction(dbInfo.storeName, mode);\n callback(null, tx);\n } catch (err) {\n if (!dbInfo.db || err.name === 'InvalidStateError') {\n return _tryReconnect(dbInfo).then(function () {\n\n var tx = dbInfo.db.transaction(dbInfo.storeName, mode);\n callback(null, tx);\n });\n }\n\n callback(err);\n }\n}", "async function transaction (username, amount, description = '') {\n await db('transactions').insert({\n username: username.toLowerCase(),\n amount: amount,\n description: description\n })\n\n debug(`Added ${amount} florins to ${username}`)\n }", "static constructTransaction (params, files) {\n // return an array of UTXOs for this user\n networkManager.findUTXOsByAddress(window.config.userAddress).then((allUTXOs) => {\n var transaction = new bch.Transaction()\n // pay the parent address the amount provided\n transaction.to(bchaddr.toLegacyAddress(params.parentAddress), params.amount)\n // if there is a parent transaction, encode the OP_RETURN data to save\n // as much blockchain space (and cost in fees) as possible\n if (typeof params.parentTXID === 'undefined') { // if no parent TXID\n log (\n 'builder',\n 'PostBuilder.build:',\n 'Adding (ascii) data to transaction:',\n window.Utilities.hex2a(params.type) + params.content\n )\n transaction.addData(window.Utilities.hex2a(params.type) + params.content)\n } else { // if there is a parent TXID\n var txData = window.Utilities.hex2buf(params.type)\n txData = txData.concat(window.Utilities.hex2buf(params.parentTXID))\n txData = txData.concat(window.Utilities.ascii2buf(params.content))\n log (\n 'builder',\n 'PostBuilder.build:',\n 'Adding (buffer) data to transaction:',\n txData\n )\n transaction.addData(new Buffer(txData))\n }\n\n // add UTXOs to transaction until we reach the required amount\n var success = false\n var totalAdded = 0\n for (var i = 0; i < allUTXOs.length && (success === false); i++) {\n var utxo = {\n txId: allUTXOs[i].txid,\n outputIndex: allUTXOs[i].vout,\n address: bchaddr.toLegacyAddress(allUTXOs[i].address),\n script: allUTXOs[i].scriptPubKey,\n satoshis: allUTXOs[i].satoshis\n }\n transaction.from(utxo)\n totalAdded += allUTXOs[i].satoshis\n if (totalAdded >= params.amount + (1000 * params.fee)) { // approximate fee amount\n success = true\n }\n }\n if (success) { // set fee, change address, sign, broadcast\n transaction.change(bchaddr.toLegacyAddress(window.config.userAddress))\n transaction.feePerKb(parseInt(params.fee * 512)) // hacky.\n transaction.sign(window.config.userPrivateKey)\n networkManager.broadcastTransaction(transaction.toString()).then((result) => {\n if (result === true) {\n if (params.type === '5502' || params.type === '5505') {\n // TODO tell user things are uploading so they don't close window.\n // we should now upload things to the Unite publishing endpoint.\n if (typeof files !== 'undefined') { // Feeble.\n PostBuilder.publishContent(\n params,\n files,\n transaction.toString()\n )\n }\n } else {\n new SuccessBanner('Your post has been sent!').show()\n }\n } // else { the broadcast function shows a broadcast failure message }\n })\n } else {\n Messages.notEnoughFunds()\n return false\n }\n })\n }", "function setTransaction(transactObj,callback) {\n\tconsole.log(\"in sf set trans &&&&& \");\n\tvar transaction = nforce.createSObject('dapps__Transactions__c');\n\ttransaction.set('dapps__Smart_Contract__c', transactObj.Smart_Contract__c);\n\ttransaction.set('dapps__Block__c', transactObj.Block__c);\n\ttransaction.set('dapps__Gas__c', transactObj.Gas__c);\n\ttransaction.set('dapps__Gas_Price__c', transactObj.Gas_Price__c);\n\ttransaction.set('dapps__Gas_Used__c', transactObj.Gas_Used__c);\n\ttransaction.set('dapps__Blockchain__c', transactObj.Blockchain__c);\n\t//transaction.set('TimeStamp__c', transactObj.TimeStamp__c);\n\ttransaction.set('dapps__TxHash__c', transactObj.TxHash__c);\n\ttransaction.set('dapps__Address__c', transactObj.Address__c);\n\ttransaction.set('Name', 'Eth Txn');\n\n\tconsole.log(\"#######%%%%%%%%%% \", transaction);\n\n\n\torg.insert({ sobject: transaction, oauth: oauth }, function(err, resp){\n\t\tif(!err) {\n\t\t\tconsole.log('transaction posted');\n\t\t\ttransactionId = resp.id;\n\t\t\tcallback(transactionId);\n\t\t}\n\t});\n\n}", "static createNormalTransaction(cid, id, amount, description = '') {\n const gateway = BraintreeHelper.getBraintreeRef();\n\n return new Promise((resolve, reject) => {\n gateway.transaction.sale({\n customerId: id,\n amount: amount.toString(),\n options: {\n submitForSettlement: true\n }\n }, function (err, result) {\n if (result && result.success) {\n // resolve(result)\n resolve({ success: true, transaction: result, message: 'Payment succeeded' });\n } else if (result.success == false) {\n resolve({ success: false, transaction: result, message: 'Payment did not succeed' });\n } else {\n reject(err)\n // return cb({ success: false, result: err });\n }\n });\n });\n }", "function registerTransaction(params, callback) {\n params.amount = parseFloat(params.amount);\n\n if (!params.amount || params.amount < 0) {\n return callback({ error: 'A valid amount must be specified.' });\n }\n\n if (!params.client_ip_address || !SIMPLE_IPv4_REGEX.test(params.client_ip_address)) {\n return callback({ error: 'A valid client IP address must be specified.' });\n }\n\n var tbcFields = {\n command: COMMAND.REQUEST_DMS_TRANSACTION,\n amount: convertAmountToTetri(params.amount), \n currency: CURRENCY.GEL,\n client_ip_addr: params.client_ip_address,\n description: params.description || 'Registering TBC CARD API Transaction',\n language: 'GE',\n msg_type: 'DMS'\n };\n\n tbcAPICall(tbcFields, function (err, tbcResponse) {\n if (err) { \n return callback(err); \n }\n callback(null, tbcResponse);\n });\n}", "function methodCreateReturnedTransaction() {\n const tx = miniERC20.transfer(addressBob, 1); // No, await !!!\n console.log(tx instanceof Transaction); // true\n console.log(tx); // bind `address` from miniERC20 contract, encode and bind `data` from arguments by abi\n /*\n MethodTransaction {\n from: undefined,\n nonce: undefined,\n gasPrice: undefined,\n gas: undefined,\n to: 'cfxtest:ach45bc5p7kwebfcbtmykarjdh9g4dtuf2xt5gdnap',\n value: undefined,\n storageLimit: undefined,\n epochHeight: undefined,\n chainId: undefined,\n data: '0xa9059cbb0000000000000000000000001ead8630345121d19ee3604128e5dc54b36e8ea60000000000000000000000000000000000000000000000000000000000000001',\n v: undefined,\n r: undefined,\n s: undefined\n }\n */\n\n const { data } = miniERC20.transfer(addressBob, 1);\n console.log(data); // use method to gen encoded data only\n // 0xa9059cbb0000000000000000000000001ead8630345121d19ee3604128e5dc54b36e8ea60000000000000000000000000000000000000000000000000000000000000001\n}", "addTransaction(transaction){\n if (!transaction.fromAddress || !transaction.toAddress) {\n throw new Error('Transaction must include from and to address');\n }\n // Verify the transactiion\n if (!transaction.isValid()) {\n throw new Error('Cannot add invalid transaction to chain');\n }\n\n this.pendingTransactions.push(transaction);\n }", "function Transaction(trans){\n this.type = trans.type;\n this.pin = parseInt(trans.pin);\n this.amount = parseFloat(trans.amount);\n this.date = new Date();\n}", "async create({\n orderType,\n amount,\n priceType,\n pricePerEos,\n priceVar,\n paymentMethods,\n minTrx,\n }) {\n\n let actions = [];\n amount = amount.toString();\n actions.push(\n await this._formatAction({\n account: Contracts.EOSIO_TOKEN,\n name: 'transfer',\n data: {\n from: await this.getAccountName(),\n to: Contracts.TRADA,\n quantity: amount,\n memo: 'Offer creation',\n }\n }),\n );\n\n actions.push(\n await this._formatAction({\n name: 'create',\n data: {\n account: await this.getAccountName(),\n order_type: orderType,\n amount,\n price_type: priceType,\n price_per_eos: priceType === PriceTypes.EXACT_PRICE ? pricePerEos.toString() : new FiatAsset(),\n price_var: priceType === PriceTypes.MARKET_VAR ? priceVar : 0,\n payment_methods: paymentMethods,\n allow_partial: minTrx ? 1 : 0,\n }\n }),\n );\n\n await this.transactFull(actions);\n }", "function TransactionBuilder() {\n _classCallCheck(this, TransactionBuilder);\n\n this.actions = [];\n\n /**\n * If true, build the transaction as a partial tranaction.\n * @type {Boolean}\n */\n this.allowAdditionalActions = false;\n\n /**\n * Base transation provided by a third party\n * @type {Object}\n */\n this.baseTransaction = null;\n }", "async add_transaction_to_blockchain(key, data) {\n if(global.localhost) {\n return \"Stop wasting credit!\";\n }\n var [error, pendingResponse, response_data] = await this.blockchain.invoke(\"add_transaction\", {}, { args: [key, data] });\n\n return {error: false, response: response_data};\n }", "async beginTransaction () {\n await this._db.beginTransaction()\n await this._yarnlockStore.beginTransaction()\n }", "function beginTransaction (callback) {\n workQueue.enqueue(driverCommandEnum.BEGIN_TRANSACTION, () => {\n cppDriver.beginTransaction(err => {\n callback(err || null, false)\n workQueue.nextOp()\n })\n }, [])\n }", "function makeTx(params) {\n switch (params.type) {\n case transactions_1.TRANSACTION_TYPE.ISSUE:\n return issue_1.issue(params);\n case transactions_1.TRANSACTION_TYPE.TRANSFER:\n return transfer_1.transfer(params);\n case transactions_1.TRANSACTION_TYPE.REISSUE:\n return reissue_1.reissue(params);\n case transactions_1.TRANSACTION_TYPE.BURN:\n return burn_1.burn(params);\n case transactions_1.TRANSACTION_TYPE.LEASE:\n return lease_1.lease(params);\n case transactions_1.TRANSACTION_TYPE.CANCEL_LEASE:\n return cancel_lease_1.cancelLease(params);\n case transactions_1.TRANSACTION_TYPE.ALIAS:\n return alias_1.alias(params);\n case transactions_1.TRANSACTION_TYPE.MASS_TRANSFER:\n return mass_transfer_1.massTransfer(params);\n case transactions_1.TRANSACTION_TYPE.DATA:\n return data_1.data(params);\n case transactions_1.TRANSACTION_TYPE.SET_SCRIPT:\n return set_script_1.setScript(params);\n case transactions_1.TRANSACTION_TYPE.SET_ASSET_SCRIPT:\n return set_asset_script_1.setAssetScript(params);\n case transactions_1.TRANSACTION_TYPE.SPONSORSHIP:\n return sponsorship_1.sponsorship(params);\n case transactions_1.TRANSACTION_TYPE.EXCHANGE:\n return exchange_1.exchange(params);\n case transactions_1.TRANSACTION_TYPE.INVOKE_SCRIPT:\n return invoke_script_1.invokeScript(params);\n case transactions_1.TRANSACTION_TYPE.UPDATE_ASSET_INFO:\n return update_asset_info_1.updateAssetInfo(params);\n default:\n throw new Error(`Unknown tx type: ${params.type}`);\n }\n}", "function createTransaction (wif, utxos, receiver, amount, network) {\n if (!validateNetwork(network)) {\n throw new Error('Invalid network choice')\n }\n\n if (!validateWIF(wif)) {\n throw new Error('Invalid WIF key')\n }\n\n var key = new zcash.PrivateKey(wif, network)\n\n var transaction = new zcash.Transaction()\n utxos.forEach(function (utxo) {\n transaction = transaction.from(utxo)\n })\n\n return transaction.to(receiver, amount).sign(key)\n}", "function createTransactionItem(database, transaction, item) {\n // Handle cross reference items\n const realItem = item.realItem;\n const transactionItem = database.create('TransactionItem', {\n id: generateUUID(),\n item: realItem,\n transaction: transaction,\n });\n transaction.addItem(transactionItem);\n database.save('Transaction', transaction);\n return transactionItem;\n}", "function createContractFromTx(arweave, wallet, srcTxId, state, tags = [], target = '', winstonQty = '') {\n return __awaiter(this, void 0, void 0, function* () {\n let contractTX = yield arweave.createTransaction({ data: state }, wallet);\n if (target && winstonQty && target.length && +winstonQty > 0) {\n contractTX = yield arweave.createTransaction({\n data: state,\n target: target.toString(),\n quantity: winstonQty.toString(),\n }, wallet);\n }\n if (tags && tags.length) {\n for (const tag of tags) {\n contractTX.addTag(tag.name.toString(), tag.value.toString());\n }\n }\n contractTX.addTag('App-Name', 'SmartWeaveContract');\n contractTX.addTag('App-Version', '0.3.0');\n contractTX.addTag('Contract-Src', srcTxId);\n contractTX.addTag('Content-Type', 'application/json');\n yield arweave.transactions.sign(contractTX, wallet);\n const response = yield arweave.transactions.post(contractTX);\n if (response.status === 200 || response.status === 208) {\n return contractTX.id;\n }\n else {\n throw new Error('Unable to write Contract Initial State');\n }\n });\n}", "function Transaction(effects) {\n // TODO\n // add features\n // set of write effects\n this.effects=effects;\n }", "function invokeTransaction(namespace, type, attributes, bnc) {\n logger.debug('issueTransaction() called with ' + namespace + ' ' + type + ' ' + JSON.stringify(attributes));\n return new Promise((resolve, reject) => {\n\n // Make the transaction\n let newTransaction;\n try {\n newTransaction = factory.newTransaction(namespace, type);\n } catch (error) {\n logger.error(error.message);\n reject(error);\n }\n\n Object.keys(attributes).forEach((key) => {\n if(Array.isArray(attributes[key])) {\n if(attributes[key].length && typeof(attributes[key]) === 'object') {\n newTransaction[key] = [];\n attributes[key].forEach((element) => {\n let relationship = factory.newRelationship(element.namespace, element.type, element.id);\n newTransaction[key].push(relationship);\n });\n } else {\n newTransaction[key] = attributes[key];\n }\n logger.debug('Adding array to ' + key);\n\n } else if(typeof(attributes[key]) === 'object') {\n let relationship = factory.newRelationship(attributes[key].namespace, attributes[key].type, attributes[key].id);\n newTransaction[key] = relationship;\n logger.debug('Adding attribute ' + key + ' with relationship to ' + attributes[key].namespace + '.' + attributes[key].type + '#' + attributes[key].id + ' to new ' + type);\n\n } else if(typeof(attributes[key]) === 'string' && attributes[key].search(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z/i) === 0) {\n newTransaction[key] = new Date(attributes[key]);\n logger.debug('Adding attribute ' + key + ' with date value ' + attributes[key] + ' to new ' + type);\n\n } else {\n newTransaction[key] = attributes[key];\n logger.debug('Adding attribute ' + key + ' with value ' + attributes[key] + ' to new ' + type);\n }\n });\n\n // Submit the transaction\n logger.debug('Submitting new ' + type + ' transaction');\n return bnc.submitTransaction(newTransaction).then(() => {\n logger.debug('Successfully issued ' + type + ' with ' + JSON.stringify(attributes));\n resolve();\n }).catch((error) => {\n logger.error(error.message);\n reject(error);\n });\n });\n}", "createTransaction(sender, receiver, amount) {\n\t\tthis.mempool.push({\n\t\t\tsender: sender,\n\t\t\treveiver: receiver,\n\t\t\tamount: amount\n\t\t});\n\t\treturn this.lastBlock.index + 1;\n\t}", "createTrabajador ({\n commit\n }, trabajador) {\n ApiService.postTrabajador(trabajador).then((response) => {\n trabajador.idTrabajador = response.data.idTrabajador // retorna el nuevo identificador creado por el servidor\n\n commit('ADD_TRABAJADOR', trabajador)\n }).catch(error => {\n console.log('ERROR:', error.message)\n })\n }", "static create(deadline, mosaic, duration, signedTransaction, networkType) {\n return new LockFundsTransaction(networkType, 3, deadline, UInt64_1.UInt64.fromUint(0), mosaic, duration, signedTransaction);\n }", "function Transactions() {\n _classCallCheck(this, Transactions);\n\n Transactions.initialize(this);\n }", "async commitTransaction() {\n }", "function addtransaction(money){\n dispach({\n type: 'addtran', payload:money\n })\n }", "newTransaction(sender, receiver, amount) {\n this.current_transactions.push({\n sender,\n receiver,\n amount,\n });\n return this.lastBlock()[\"index\"] + 1;\n }", "function addTransaction(tx) {\n if (!$scope.account.Balance) {\n // if account is unfunded, then there is no need to ask user for a key\n // Add transaction to the queue.\n // (Will be submitted as soon as account gets funding)\n var item = {\n tx_json: tx.tx_json,\n type: tx.tx_json.TransactionType\n };\n\n // Additional details depending on a transaction type\n if ('TrustSet' === item.type) {\n item.details = tx.tx_json.LimitAmount;\n }\n\n var saveTx = function(e1, r1) {\n if (e1) {\n console.warn(e1);\n return;\n }\n $scope.userBlob.unshift('/clients/rippletradecom/txQueue', item);\n };\n\n if ($scope.userBlob.data && !$scope.userBlob.data.clients) {\n // there is bug in RippleLib with unshift operation - if \n // there is empty nodes in the path, it tries to create array node,\n // and nothing gets created under it, so create '/clients' explicitly\n $scope.userBlob.set('/clients', { rippletradecom: {} }, saveTx);\n } else if ($scope.userBlob.data && $scope.userBlob.data.clients && _.isArray($scope.userBlob.data.clients)) {\n // if '/clients' already set to array, clear it\n $scope.userBlob.unset('/clients', function(e, r) {\n if (e) return;\n $scope.userBlob.set('/clients', { rippletradecom: {} }, saveTx);\n });\n } else {\n saveTx();\n }\n } else {\n // Get user's secret key\n keychain.requestSecret(id.account, id.username, function(err, secret) {\n if (err) {\n console.log('client: txQueue: error while unlocking wallet: ', err);\n return;\n }\n\n var transaction = ripple.Transaction.from_json(tx.tx_json);\n\n transaction.remote = network.remote;\n transaction.secret(secret);\n\n api.getUserAccess().then(function(res) {\n // If account is funded submit the transaction right away\n transaction.submit();\n }, function(err2) {\n // err\n });\n\n });\n }\n }", "transactionAdd(form_data, success_callback, failure_callback) {\n let url = \"/global/str/order/transaction/add\";\n return WebClient.basicPost(form_data, url, success_callback, failure_callback);\n }", "deposit(amt){\n\n if(amt > 0) { //only allows deposits that are greater then zero\n\n //1. create a transaction instance using amount passed in\n let newTransaction = new Transaction(amt, \"Deposit\");\n //2. add this newly created transaction to the transaction array\n this.transactions.push(newTransaction);\n\n }\n}", "function createOrder(order_id, tradingsymbol, transaction_type, quantity, trigger_price, price, target){\n let order = {\n order_id,\n tradingsymbol,\n transaction_type,\n quantity,\n trigger_price,\n price,\n target\n }\n return order;\n}", "createTransactionFromDTO(dto, common){\n let configTransaction = nem.model.objects.create(\"transferTransaction\")(this.getOptinConfig().NIS.configAddress, 0, dto.toMessage());\n // Prepare with Signer and Network\n configTransaction = nem.model.transactions.prepare(\"transferTransaction\")(\n common,\n configTransaction,\n this._Wallet.network\n );\n return new Promise( (resolve) => {\n nem.com.requests.chain.time(this._Wallet.node).then( time => {\n configTransaction.timeStamp = Math.floor(time.receiveTimeStamp / 1000);\n configTransaction.deadline = configTransaction.timeStamp + 60 * 60;\n resolve(configTransaction);\n });\n });\n }", "async pay (rawtx, parents) {\n console.log('paying')\n\n const options = {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ rawtx, parents })\n }\n\n const { rawtx: paid } = await fetch('/pay', options).then(r => r.json())\n\n return new bsv.Transaction(paid)\n }", "function push_tx(tx) {\n request({\n url: pushTxEndpoint,\n method: 'POST',\n json: {\"hex\": tx},\n }, \n function (error, response, body) {\n // if (!error && response.statusCode == 200) {\n // console.log(body.id) // Print the shortened url.\n // }\n if (error || response.statusCode != 200) {\n io.emit('error','Transaction couldn\\'t be pushed to network.');\n }\n else {\n io.emit('success','Payment successful! Waiting for data...');\n }\n console.log(Date.now()+': Publishing transaction...\\n'+\n 'Status code: '+response.statusCode+'\\n'+ \n ' Body: '+JSON.stringify(body)+'\\n'+\n ' Error: '+JSON.stringify(error)+'\\n');\n\n }\n )\n}", "doTransaction() {\n this.f(this.oldDes,this.oldAss,this.oldDue,this.oldCom,this.des,this.ass,this.due,this.com,this.whetherCreate);\n }", "function simulateCreateContractFromTx(arweave, wallet, srcTxId, state, tags = [], target = '', winstonQty = '') {\n return __awaiter(this, void 0, void 0, function* () {\n let contractTX = yield arweave.createTransaction({ data: state }, wallet);\n if (target && winstonQty && target.length && +winstonQty > 0) {\n contractTX = yield arweave.createTransaction({\n data: state,\n target: target.toString(),\n quantity: winstonQty.toString(),\n }, wallet);\n }\n if (tags && tags.length) {\n for (const tag of tags) {\n contractTX.addTag(tag.name.toString(), tag.value.toString());\n }\n }\n contractTX.addTag('App-Name', 'SmartWeaveContract');\n contractTX.addTag('App-Version', '0.3.0');\n contractTX.addTag('Contract-Src', srcTxId);\n contractTX.addTag('Content-Type', 'application/json');\n yield arweave.transactions.sign(contractTX, wallet);\n return contractTX;\n });\n}", "TEMPaddfaketransaction() {\n let faketrans = {\n transactionnumber:\n this.props.walletitems != undefined ? this.props.walletitems.length : 0,\n confirmations: 1000,\n time: new Date(),\n category: '',\n amount: Math.random() * 100,\n txid: '00000000000000000000000000000000000000000',\n account: 'Random',\n address: '1111111111111111111111111111111',\n value: {\n USD: 1.9,\n BTC: 0.0003222,\n },\n coin: 'Nexus',\n fee: 0,\n };\n let tempTransactionRandomCategory = function() {\n let temp = Math.ceil(Math.random() * 4);\n if (temp == 4) {\n return 'debit';\n } else if (temp == 1) {\n return 'receive';\n } else if (temp == 2) {\n return 'stake';\n } else {\n return 'genesis';\n }\n };\n\n let tempTransactionRandomTime = function() {\n let start = new Date(new Date().getFullYear() - 1, 1, 1);\n let end = new Date();\n let randomtime = new Date(\n start.getTime() + Math.random() * (end.getTime() - start.getTime())\n );\n return randomtime;\n };\n\n faketrans.category = tempTransactionRandomCategory();\n faketrans.time = tempTransactionRandomTime();\n //faketrans.time = Math.round(faketrans.time);\n\n if (faketrans.category == 'debit') {\n faketrans.amount = faketrans.amount * -1;\n }\n\n return faketrans;\n }", "createCommit(prepare, wallet) {\n let commit = {};\n commit.blockHash = prepare.blockHash;\n commit.publicKey = wallet.getPublicKey();\n commit.signature = wallet.sign(prepare.blockHash);\n return commit;\n }", "create(data, params) {}", "function createTableRecord(tx) {\n\t\n\t console.log(\"Entering createTableRecord\");\n\t \n\t var sqlStr = 'CREATE TABLE IF NOT EXISTS records (type TEXT, date DATE)';\n\t console.log(sqlStr);\n\t \n\t tx.executeSql(sqlStr, [], onSqlSuccess, onSqlError);\n\t console.log(\"Leaving createTableRecord\");\n\t}", "function createTransaction(dbInfo, mode, callback, retries) {\n\t if (retries === undefined) {\n\t retries = 1;\n\t }\n\n\t try {\n\t var tx = dbInfo.db.transaction(dbInfo.storeName, mode);\n\t callback(null, tx);\n\t } catch (err) {\n\t if (retries > 0 && (!dbInfo.db || err.name === 'InvalidStateError' || err.name === 'NotFoundError')) {\n\t return Promise$1.resolve().then(function () {\n\t if (!dbInfo.db || err.name === 'NotFoundError' && !dbInfo.db.objectStoreNames.contains(dbInfo.storeName) && dbInfo.version <= dbInfo.db.version) {\n\t // increase the db version, to create the new ObjectStore\n\t if (dbInfo.db) {\n\t dbInfo.version = dbInfo.db.version + 1;\n\t }\n\t // Reopen the database for upgrading.\n\t return _getUpgradedConnection(dbInfo);\n\t }\n\t }).then(function () {\n\t return _tryReconnect(dbInfo).then(function () {\n\t createTransaction(dbInfo, mode, callback, retries - 1);\n\t });\n\t })[\"catch\"](callback);\n\t }\n\n\t callback(err);\n\t }\n\t}", "async create(attributes) {\r\n if (_.isNil(attributes)) {\r\n throw new Exception('attributes should not empty', 1000);\r\n }\r\n\r\n const result = await this.Models().sequelize.transaction(\r\n function(t) {\r\n return this.Models().create(attributes, { transaction: t });\r\n }.bind(this)\r\n );\r\n if (_.isNil(result)) {\r\n throw new Exception('Can not create resource', 1004);\r\n }\r\n\r\n return result;\r\n }", "async beginTransaction() {\n await this.executeSQL(sqlBeginTransaction,[]);\n }", "function generateTransaction(callFunction, args) {\n\n //callback: NebPay.config.testnetUrl,\n gNebPaySerialNumber = nebPay.call(gdAppContractAddress, gNasValue, callFunction, args, {\n\n listener: callbackSaveFunction\n });\n\n nebPayCallIntervalCheckTx();\n gNebPayIntervalQuery = setInterval(function () {\n nebPayCallIntervalCheckTx();\n }, 12000);\n\n}", "getTransaction(transactionId) {\n return rxjs_1.from(this.transactionRoutesApi.getTransaction(transactionId)).pipe(operators_1.map(({ body }) => CreateTransactionFromDTO_1.CreateTransactionFromDTO(body)), operators_1.catchError((error) => rxjs_1.throwError(this.errorHandling(error))));\n }", "addTransaction({ transactionData, cashCommissionFees }) {\n const newTransaction = new Transaction(transactionData);\n newTransaction.calculateCommission({\n userType: this.type,\n transactionsHistory: this.getTransactionsByCurrentWeek(newTransaction),\n cashCommissionFees,\n });\n this.transactionsHistory.push(newTransaction);\n }", "async function initTransaction(data) {\n const { sender, receiver } = data;\n let base58publicKey = new PublicKey(\n \"9Ayh2hS3k5fTn6V9Ks7NishUp5Jz19iosK3tYPAcNhsp\"\n );\n const senderaddress = new PublicKey(sender); \n const recepientaddress = new PublicKey(data.receiver);\n let validProgramAddress_pub = await PublicKey.findProgramAddress(\n [senderaddress.toBuffer()],\n base58publicKey\n );\n const validProgramAddress = validProgramAddress_pub[0].toBase58();\n\n //sender and receiver address\n\n let sender_recipient_pub = await PublicKey.findProgramAddress(\n [senderaddress.toBuffer(), recepientaddress.toBuffer()],\n base58publicKey\n );\n\n const senderPda = sender_recipient_pub[0].toBase58();\n\n const PROGRAM_ID = \"9Ayh2hS3k5fTn6V9Ks7NishUp5Jz19iosK3tYPAcNhsp\"; // Zebec program id\n const instruction = new TransactionInstruction({\n keys: [\n {\n pubkey: new PublicKey(sender),\n isSigner: true,\n isWritable: true,\n },\n {\n pubkey: new PublicKey(receiver), //recipient\n isSigner: false,\n isWritable: true,\n },\n {\n // master pda to store fund\n pubkey: validProgramAddress,\n isSigner: false,\n isWritable: true,\n },\n // pda to store data //sender and recepient\n {\n pubkey: senderPda,\n isSigner: false,\n isWritable: true,\n },\n {\n pubkey: SystemProgram.programId, //system program required to make a transfer\n isSigner: false,\n isWritable: false,\n },\n ],\n programId: new PublicKey(PROGRAM_ID),\n data: encodeInstructionData(data),\n });\n const transaction = new Transaction().add(instruction);\n const connection = new Connection(clusterApiUrl(\"devnet\"));\n const signerTransac = async () => {\n try {\n transaction.recentBlockhash = (\n await connection.getRecentBlockhash()\n ).blockhash;\n transaction.feePayer = window.solana.publicKey;\n const signed = await window.solana.signTransaction(transaction);\n const signature = await connection.sendRawTransaction(signed.serialize());\n const finality = \"confirmed\";\n await connection.confirmTransaction(signature, finality);\n const explorerhash = {\n transactionhash: signature,\n };\n return explorerhash;\n } catch (e) {\n console.warn(e);\n return false;\n }\n };\n signerTransac();\n}", "constructor(db: DB, txnData: Object, existsInDb: ?boolean) {\n super()\n\n this.db = db;\n this.data = txnData;\n this.date = DB.parseDate(txnData.date);\n\n if (!this.db.transactionIsValid(txnData)) {\n throw \"invalid transaction\";\n }\n\n if (txnData.guid) {\n if (this.db.transactionsByGuid.get(txnData.guid)) {\n throw \"Tried to duplicate existing transaction.\";\n }\n } else {\n txnData.guid = guid();\n }\n\n Object.freeze(txnData);\n\n this.db.transactionsByGuid.set(txnData.guid, this);\n this.db.transactionsByTime.add(this._byTimeKey(), this);\n\n this.db.atomic(() => {\n this._createEntries(!existsInDb);\n this.dbUpdater = new DbUpdater(db, \"transactions\", this, existsInDb);\n });\n }", "async createRequest() {\n try {\n const result = await this.rn.requestEthereumService.createRequestAsPayee(\n this.payerAddress,\n this.amountRequired,\n `{\"reason\": \"${ this.reason }\"}`,\n '',\n [],\n { from: this.payeeAddress }\n ).on('broadcasted', (data) => {\n console.log(data.transaction.hash);\n this.txHash = data.transaction.hash;\n });\n } catch (error) {\n console.error(error);\n }\n }", "startTransaction(id, metadata) {\n if (this.transaction.id) {\n throw Error(\"Nested transactions not supported\");\n }\n\n this.transaction.id = id;\n this.transaction.depth = 1;\n return this.emit('startTransaction', id, metadata);\n }", "function encodeCreateAccountTransaction(publicKey, privateKey, address, sequence) {\n const tx = {\n version: 1,\n operation: \"create_account\",\n params: {\n address\n },\n account: publicKey,\n sequence,\n memo: Buffer.alloc(0),\n }\n hdlTransaction.sign(tx, privateKey);\n const txEncode = \"0x\" + hdlTransaction.encode(tx).toString('hex');\n return txEncode;\n}", "async prepareBaseTransaction(wallet) {\n const classicAddress = xrp_utils_1.default.decodeXAddress(wallet.getAddress());\n if (!classicAddress) {\n throw xrp_error_1.default.xAddressRequired;\n }\n const fee = await this.getMinimumFee();\n const accountData = await this.getAccountData(classicAddress.address);\n const openLedgerSequence = await this.getOpenLedgerSequence();\n const senderAccountAddress = new account_pb_1.AccountAddress();\n senderAccountAddress.setAddress(wallet.getAddress());\n const account = new common_pb_1.Account();\n account.setValue(senderAccountAddress);\n const lastLedgerSequence = new common_pb_1.LastLedgerSequence();\n lastLedgerSequence.setValue(openLedgerSequence + maxLedgerVersionOffset);\n const signingPublicKeyBytes = xpring_common_js_1.Utils.toBytes(wallet.publicKey);\n const signingPublicKey = new common_pb_1.SigningPublicKey();\n signingPublicKey.setValue(signingPublicKeyBytes);\n const transaction = new transaction_pb_1.Transaction();\n transaction.setAccount(account);\n transaction.setFee(fee);\n transaction.setSequence(accountData.getSequence());\n transaction.setLastLedgerSequence(lastLedgerSequence);\n transaction.setSigningPublicKey(signingPublicKey);\n return transaction;\n }", "function createTransaction(dbInfo, mode, callback, retries) {\n if (retries === undefined) {\n retries = 1;\n }\n\n try {\n var tx = dbInfo.db.transaction(dbInfo.storeName, mode);\n callback(null, tx);\n } catch (err) {\n if (retries > 0 && (!dbInfo.db || err.name === 'InvalidStateError' || err.name === 'NotFoundError')) {\n return Promise$1.resolve().then(function () {\n if (!dbInfo.db || err.name === 'NotFoundError' && !dbInfo.db.objectStoreNames.contains(dbInfo.storeName) && dbInfo.version <= dbInfo.db.version) {\n // increase the db version, to create the new ObjectStore\n if (dbInfo.db) {\n dbInfo.version = dbInfo.db.version + 1;\n } // Reopen the database for upgrading.\n\n\n return _getUpgradedConnection(dbInfo);\n }\n }).then(function () {\n return _tryReconnect(dbInfo).then(function () {\n createTransaction(dbInfo, mode, callback, retries - 1);\n });\n })[\"catch\"](callback);\n }\n\n callback(err);\n }\n }", "static insertTransaction(connector, transactionModel, callback){\n\n var data = {\n username: transactionModel.username,\n amount: transactionModel.amount\n };\n connector.insertDocInCollection('transactions', data, callback);\n }", "function AddTransaction(RequestID, transaction) {\n try {\n if (!RequestID) {\n logger.logError(\"empty request ID\");\n }\n let result = common.error;\n transaction._RequestID = RequestID;\n //If visit ID was not set then take the same as ID\n if (transaction.queueBranchVisitID <= 0) {\n transaction.queueBranchVisitID = transaction.id;\n }\n //Get Branch Data\n let BracnhData = dataService.getBranchData(transaction.orgID, transaction.queueBranch_ID);\n if (BracnhData != null && BracnhData.transactionsData != null) {\n //To Branch Transactions\n BracnhData.transactionsData.push(transaction);\n //To Visit Data\n dataService.AddorUpdateVisitData(BracnhData, transaction);\n //Update the Statistics\n statisticsManager.AddOrUpdateTransaction(transaction);\n //Update To data base\n repositoriesManager.entitiesRepo.AddSynch(transaction);\n result = common.success;\n }\n return result;\n }\n catch (error) {\n logger.logError(error);\n return common.error;\n }\n\n}", "function generateTransaction(data, gas) {\n\tlet transaction = {\n\t\tfrom: '127.0.0.1', // ip of the user\n\t\tmessage: data,\n\t\tgas,\n\t\tminedBy: '',\n\t\tblockNumber: 0\n\t}\n\n\tunprocessedTransactions.push(transaction)\n\tconst currentContent = JSON.parse(fs.readFileSync('transactions.json', 'utf-8'))\n\tcurrentContent.push(transaction)\n\tconst stringTransaction = JSON.stringify(currentContent, null, 2)\n\t// Save the transaction on the file\n\tfs.writeFileSync('transactions.json', stringTransaction)\n\t// Broadcast the transaction to the ofther users connected to the node\n\twsServer.sendAllMessage(stringTransaction)\n\tif(isMining) mineBlock()\n}", "commit() {\n if (this.transactions.length === 0) {\n return 'TRANSACTION NOT FOUND';\n }\n \n this.db = this.applyTransactions();\n this.transactions = [];\n this.currentTransactionIndex = -1;\n }", "prepareTransaction() {\n \n // Create a new object to not affect the view\n let cleanTransferTransaction = nem.model.objects.get(\"transferTransaction\");\n \n // Clean recipient\n cleanTransferTransaction.recipient = this.formData.recipient.toUpperCase().replace(/-/g, '');\n \n cleanTransferTransaction.amount = 0;\n\n // Set multisig, if selected\n if (this.formData.isMultisig) {\n cleanTransferTransaction.isMultisig = true;\n cleanTransferTransaction.multisigAccount = this.formData.multisigAccount;\n } \n \n // Set recipient public key\n cleanTransferTransaction.recipientPublicKey = this.formData.recipientPublicKey;\n \n // Set the message\n cleanTransferTransaction.message = this.formData.message;\n cleanTransferTransaction.messageType = this.formData.messageType;\n \n // Prepare transaction object according to transfer type\n let entity;\n\n cleanTransferTransaction.mosaics = null;\n // Prepare\n entity = nem.model.transactions.prepare(\"transferTransaction\")(this.common, cleanTransferTransaction, this._Wallet.network);\n \n // Set the entity for fees in view\n this.preparedTransaction = entity;\n\n // Return prepared transaction\n return entity;\n }", "function createDB(){\r\n db.transaction(setupTable, dbErrorHandler, getEntries); \r\n}", "async insertTx(txLog) {\n const { from, to, from_id, to_id, value } = txLog;\n const detail = txLog.category;\n const sql = \"INSERT INTO transaction VALUES (null, ?, ?, ?, ?, ?, ?, now());\"\n const holder = [from_id, from, to_id, to, value, detail];\n const connection = await mysql.createConnection(\n {\n host: process.env.MYSQL_HOST,\n user: process.env.MYSQL_USER,\n password: process.env.MYSQL_PASSWORD,\n port: process.env.MYSQL_PORT,\n database: process.env.MYSQL_DATABASE,\n }\n );\n await connection.execute(sql, holder)\n }", "getTransaction(\n accountId: string,\n transactionId: string,\n keyLevel: string\n ): Promise<Transaction> {\n return this._member.getTransaction(accountId, transactionId, keyLevel);\n }", "function transactionTable() { }", "async createOrganization(data) {\n let transaction;\n // try to insert the org. if error, abort creation\n try {\n // create a transaction\n transaction = await this.db.sequelize.transaction();\n // create the organization in the database\n const org = await this.model.create(data, {transaction}); // same as {transaction: transaction}\n // all good, commit\n await transaction.commit();\n return org;\n } catch (e) {\n // error occured, rollback and throw it further\n transaction.rollback();\n throw e;\n }\n }", "async function createTransaction(req, res, next) {\n try {\n log.debug(`body`, req.body);\n const type = req.body.type;\n const url = req.body.url;\n const pageIndex = parseInt(req.body.pageIndex, 10);\n log.info(`Trying to create a transaction`);\n\n let result;\n switch (type) {\n case 'list': result = await mainService.buildPosts(pageIndex); break;\n case 'post': result = await mainService.buildPost(url); break;\n default: return res.json('No such type');\n }\n\n if (result.ok) {\n return res.status(200).send(result.msg);\n } else {\n return res.sendStatus(400);\n }\n } catch(ex) {\n log.error({\n pageIndex: parseInt(req.body.pageIndex, 10), ex: ex.stack\n }, 'Error in routers.post>/build');\n return res.sendStatus(500);\n }\n}", "function createTable() {\n const sql = `CREATE TABLE ${table} (c1 int UNIQUE) `;\n const request = new Request(sql, (err, rowCount) => {\n if (err) {\n console.log('error occured!');\n throw err;\n }\n\n console.log(`'${table}' created!`);\n\n createTransaction();\n });\n\n connection.execSql(request);\n}", "function transaction_create(req, res) {\n let req_arr = req.body;\n let bulk_updates = [];\n\n _.forEach(req_arr, function (doc, callback) {\n doc['company'] = getCompany(doc.name);\n bulk_updates.push({\n \"updateOne\": {\n \"filter\": {\n \"trans_id\": doc.trans_id\n },\n \"update\": {\n \"$set\": {\n \"name\": doc.name,\n \"company\": doc.company,\n \"amount\": doc.amount,\n \"date\": doc.date,\n \"user_id\": doc.user_id,\n \"trans_id\": doc.trans_id\n }\n },\n \"upsert\": true, // Avoid duplication of transactions\n \"multi\": true\n }\n });\n });\n\n // Break the txns array into smaller chunks based on the size set in config file\n let bulks = chunk_array(bulk_updates, config.BULK_INSERT_SIZE);\n let total_bulks = bulks.length;\n async.every(bulks, function (bulk, callback) {\n Transaction.bulkWrite(bulk, function () {\n // Only send the response when all the chunks of transactions have been written to db.\n if (--total_bulks == 0) callback();\n });\n }, function () {\n transaction_get_recurring(req, res);\n });\n}", "function createTransaction(type, value){\n //adicionar uma nova transação no array de transações de um usuário\n var valor = {type: type,value: value} \n user.transactions.push(valor)\n //console.log(valor)//{ type: 'credit', value: 10 }\n \n if(valor.type == \"credit\"){\n user.balance = user.balance + valor.value\n }else{\n user.balance = user.balance - valor.value\n }\n //console.log(user.balance)/// value inserido acima\n return user.balance\n}" ]
[ "0.77916604", "0.77828574", "0.7620501", "0.74126035", "0.72822857", "0.701867", "0.68479973", "0.68366176", "0.6836187", "0.68292737", "0.6665209", "0.65262556", "0.64872", "0.6461477", "0.6415897", "0.6381472", "0.63809055", "0.6379248", "0.6365055", "0.6344089", "0.63395214", "0.6334344", "0.63198364", "0.62975836", "0.6288126", "0.6275352", "0.62427884", "0.617956", "0.6167296", "0.6164558", "0.61586237", "0.6149703", "0.6130317", "0.6117169", "0.61097467", "0.61072135", "0.60984445", "0.60946894", "0.6073965", "0.6022917", "0.60184926", "0.60043323", "0.59919494", "0.5985321", "0.59762704", "0.5973111", "0.59678257", "0.5958725", "0.5956869", "0.59464324", "0.59217155", "0.59148604", "0.59074", "0.5899305", "0.58525693", "0.5851425", "0.5823852", "0.5816082", "0.5805386", "0.58029574", "0.57777977", "0.57704914", "0.5764484", "0.57581306", "0.57573754", "0.5756073", "0.574527", "0.57424325", "0.57347155", "0.572567", "0.5722995", "0.5721313", "0.57182425", "0.571279", "0.57122546", "0.57022035", "0.5698436", "0.56935763", "0.56846154", "0.56842625", "0.5677597", "0.56768864", "0.5670744", "0.56658804", "0.5662882", "0.56586915", "0.56578535", "0.56433755", "0.5628192", "0.56240803", "0.5619668", "0.5617065", "0.5609589", "0.5606551", "0.5606547", "0.5602694", "0.55978537", "0.5592706", "0.5579162", "0.5571208", "0.5570931" ]
0.0
-1
get transaction by id
async function getTransactionByIdAsync(_id) { return TransactionModel.findById(_id).populate('customer').exec(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getTransaction(id)\n {\n if (typeof(id) == \"object\")\n id = id.id\n\n return this.transactions.find(x => x.id == id) || null\n }", "function findById(id) {\n return db('transactions').where({ id }).first()\n}", "static async getTransactionById(req, res) {\n try {\n const table = new Model();\n const response = await table.query('SELECT * FROM transactions WHERE id = $1', [req.params.id]);\n if (response.rowCount === 0) {\n return res.json({\n status: 404,\n error: 'No transaction found',\n });\n }\n // specified return data\n return res.json({\n status: 200,\n data: response.rows,\n });\n } catch (error) {\n return res.status(400).json({\n status: 400,\n error,\n });\n }\n }", "function getTransaction(id) {\n\tload(\"get-transaction?id=\" + id, function(xhr) {\n\t\tif (null != xhr.responseText && xhr.responseText.length > 0) {\n\t\t\tvar jsonData = JSON.parse(xhr.responseText);\n\n\t\t if (null != jsonData) {\n\t\t \t// show transaction details panel\n\t\t \tshowHTMLById(\"trx-details\");\n\n\t\t \t// set corresponding field values\n\t\t \tsetFieldValueByName(\"customer_name\", jsonData.customer_name);\n\t\t \tsetFieldValueByName(\"customer_code\", jsonData.customer_code);\n\t\t \tsetFieldValueByName(\"created_date\", jsonData.created_date_formatted); // @TODO: incorrect date format\n\t\t \tsetFieldValueByName(\"transaction_id\", jsonData.id);\n\t\t \tsetFieldValueByName(\"sap_no\", jsonData.sap_no);\n\t\t \tsetFieldValueByName(\"plant_location\", jsonData.plant_location);\n\t\t \tsetFieldValueByName(\"storage_location\", jsonData.storage_location);\n\t\t \tsetFieldValueByName(\"truck_van\", jsonData.truck_van);\n\t\t \tsetFieldValueByName(\"pallet_count\", jsonData.pallet_count);\n\t\t \tsetFieldValueByName(\"total_weight\", jsonData.total_weight);\n\n\t\t \tremarks = jsonData.remarks;\n\t\t } else {\n\t\t \t// hide transaction details panel\n\t\t \thideHTMLById(\"trx-details\");\n\t\t }\n\t\t} else {\n\t\t\t// hide transaction details panel\n\t \thideHTMLById(\"trx-details\");\n\t\t}\n\n\n\t});\n}", "getUserTransactions(id) {\n return Api().get(`/transactions/user/${id}`);\n }", "getTransactionById(req, res) {\n const transactionId = req.params.id;\n Transaction.findById(transactionId, (error, transaction) => {\n if (error) return res.status(500).send(error);\n return res.json({ \"transation\": transaction });\n });\n }", "findTenantByIdTransaction(idTransaction, params) {\n return this.request.get(`tenant-transaction/${idTransaction}`, {\n params\n });\n }", "function transactionById(txId, nodeUrl, requestOptions) {\n return __awaiter(this, void 0, void 0, function* () {\n return tx_route.fetchInfo(nodeUrl, txId, requestOptions); //todo: fix types\n });\n}", "getTransaction(transactionId) {\n return rxjs_1.from(this.transactionRoutesApi.getTransaction(transactionId)).pipe(operators_1.map(({ body }) => CreateTransactionFromDTO_1.CreateTransactionFromDTO(body)), operators_1.catchError((error) => rxjs_1.throwError(this.errorHandling(error))));\n }", "async getTransactionInfo(transactionId) {\n let link = transactionApiUrl + \"/\" + transactionId;\n let response = await fetch(link);\n let transactionInfo = await response.json();\n return transactionInfo;\n }", "get transactionId() {\n return this._transactionId;\n }", "function getFrom(transaction) {\n}", "function getTransaction(callback) {\n transactionsLib.getTransaction(remote, dbinterface, opts, callback);\n }", "function get(id, callback) {\n var transaction = db.transaction([window.GLOBALS.DATABASE_NAME]);\n var objectStore = transaction.objectStore(window.GLOBALS.OBJECT_STORE_NAME);\n var request = objectStore.get(id);\n\n request.onsuccess = function(event) {\n callback(request.result);\n }\n }", "function deleteTransactionById(_id) {\r\n return TransactionModel.deleteOne({ _id }).exec();\r\n}", "get txId() { return this._txId }", "getTransaction(\n accountId: string,\n transactionId: string,\n keyLevel: string\n ): Promise<Transaction> {\n return this._member.getTransaction(accountId, transactionId, keyLevel);\n }", "function get(id) {\n return couchdb.get({_db: DB_NAME, _param: id}).$promise;\n }", "removeTransaction(id)\n {\n if (typeof(id) == \"object\")\n id = id.id\n\n let index = this.transactions.findIndex(x => x.id == id)\n\n if (index == -1)\n return\n\n this.transactions.splice(index, 1)\n }", "getTransactions (params) {\r\n return Api().get('/transactions')\r\n }", "getOrder(id) {\n const orderId = orderDummyData.orders.find(order => order.id === Number(id));\n return orderId;\n }", "function get(id) {\n return dataStore.get(id);\n }", "_get (id) {\n id = this._objectifyId(id);\n\n return this.Model.findOne({ [this.id]: id }, { '_revision.history': 0 })\n .then(data => {\n if (!data) {\n throw new errors.NotFound(`No record found for id '${id}'`);\n }\n\n return data;\n })\n .catch(errorHandler);\n }", "function deleteTransaction(id) {\n transaction.deleteTransaction(id)\n .then(res => loadTransactions())\n .catch(err => console.log(err));\n }", "function get(id) {\n return db.get(id);\n }", "function deleteTransaction(id) {\n transactions = transactions.filter( transaction => transaction.id != id );\n init();\n}", "getByID(storeName, id) {\n return from(new Promise((resolve, reject) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, reject);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readonly, storeName, reject, resolve));\n const objectStore = transaction.objectStore(storeName);\n const request = objectStore.get(id);\n request.onsuccess = (event) => {\n resolve(event.target.result);\n };\n })\n .catch((reason) => reject(reason));\n }));\n }", "findTaskById(id) {\n return this.addTask.filter(task => task.id === id)[0]\n }", "getById(id) {\r\n return this._byId[id]\r\n }", "Get(id) {\n\t\treturn this.obj.filter(function(o){return o.id == id;})[0];\n\t}", "getPurchaseById(purchaseId, callback) {\n\t\tvar _sql = sql.purchases.byId(purchaseId);\n\t\tthis._connection.query(_sql, function (err, result) {\n\t\t\tif(err) throw err;\n\n\t\t\tif(!result.length)\n\t\t\t\treturn callback(`Couldn't find purchase matching id ${purchaseId}`);\n\n\t\t\t// Transform and return purchase\n\t\t\tvar purchase = sqlDataModel.purchase(result[0]);\n\t\t\tcallback(null, purchase);\n\t\t});\n\t}", "getById(knex, id) {\n return knex\n .from('restaurants')\n .select('*')\n .where({ id })\n .first();\n }", "static async getOrderById(id) {\n const { rows } = await pool.query('SELECT * FROM orders WHERE id=$1', [id]); \n\n return new Order(rows[0]);\n \n }", "getById(db, id) {\n return db\n .from('activity')\n .select('*')\n .where({ id })\n .first();\n }", "getBoughtItemByTransectionId(transectionID) {\n for (let i = 0; i < window.Database.DB.bought.length; ++i) {\n if (window.Database.DB.bought[i].transaction_id == transectionID) {\n return window.Database.DB.bought[i];\n }\n }\n }", "existingTransaction(public_key) {\n //if not found it will return undefined\n return this.transactions.find(t => t.input.address === public_key);\n }", "function getTransactionId(candidateIdVar, transactionId) {\r\n return new Promise((resolve, reject) => {\r\n if (transactionId) {\r\n resolve(transactionId);\r\n }\r\n let mappingQuery = sqlQuery.sqlQueries.queryMapping + candidateIdVar;\r\n utility.printLog(\"mappingQuery\" + mappingQuery, constants.LOG_LEVEL.DEBUG);\r\n request.query(mappingQuery, (err, response) => {\r\n if (err) {\r\n utility.printLog(\"Error while fetching max trans id\", constants.LOG_LEVEL.ERROR);\r\n resolve(transactionId);\r\n }\r\n if (response && response.recordset) {\r\n transactionId = response.recordset[0].trans_id;\r\n if (transactionId)\r\n resolve(transactionId);\r\n else {\r\n utility.printLog(\"Error while fetching max trans id\", constants.LOG_LEVEL.ERROR);\r\n resolve(transactionId);\r\n }\r\n }\r\n });\r\n });\r\n}", "static async getTransaksi(req, res, next) {\n try {\n const id = req.access_id\n let transaction\n if (req.role === 'customer') {\n transaction = await Transaction.findAll({\n where: { CustomerId: id },\n order: [['createdAt','ASC']],\n include:[Customer, TukangCukur,{\n model: TransactionDetail,\n order: [['VarianId','ASC']],\n include: Varian\n }]})\n }\n else if (req.role === 'tukangcukur') {\n transaction = await Transaction.findAll({\n where: { TukangCukurId: id },\n order: [['createdAt','ASC']],\n include:[Customer, TukangCukur,{\n model: TransactionDetail,\n order: [['VarianId','ASC']],\n include: Varian\n }]})\n }\n res.status(200).json(transaction)\n } catch(error) {\n next({\n status: 500,\n message: \"Internal server error\"\n });\n }\n }", "async function getbyid(id){\n if(id === undefined){\n throw 'input is empty';\n }\n if(id.constructor != ObjectID){\n if(ObjectID.isValid(id)){\n id = new ObjectID(id);\n }\n else{\n // throw 'Id is invalid!(in data/reservation.getbyid)'\n return;\n }\n }\n\n const reservationCollections = await reservations();\n const target = await reservationCollections.findOne({ _id: id });\n // if(target === null) throw 'Reservation not found!';\n\n return await processReservationData(target);\n\n // return target;\n}", "function getTransactionByType(id, brds_type, sap_type) {\n var transaction_type = 'brds';\n if (sap_type) {\n transaction_type = 'sap';\n }\n load(\"get-transaction?id=\" + id + '&type=' + transaction_type, function(xhr) {\n if (null != xhr.responseText && xhr.responseText.length > 0) {\n var jsonData = JSON.parse(xhr.responseText);\n\n if (null != jsonData) {\n // show transaction details panel\n showHTMLById(\"trx-details\");\n\n // set corresponding field values\n setFieldValueByName(\"customer_name\", jsonData.customer_name);\n setFieldValueByName(\"customer_code\", jsonData.customer_code);\n setFieldValueByName(\"created_date\", jsonData.created_date_formatted); // @TODO: incorrect date format\n setFieldValueByName(\"transaction_id\", jsonData.id);\n setFieldValueByName(\"sap_no\", jsonData.sap_no);\n setFieldValueByName(\"plant_location\", jsonData.plant_location);\n setFieldValueByName(\"storage_location\", jsonData.storage_location);\n setFieldValueByName(\"truck_van\", jsonData.truck_van);\n setFieldValueByName(\"pallet_count\", jsonData.pallet_count);\n setFieldValueByName(\"total_weight\", jsonData.total_weight);\n\n remarks = jsonData.remarks;\n } else {\n // hide transaction details panel\n hideHTMLById(\"trx-details\");\n }\n } else {\n // hide transaction details panel\n hideHTMLById(\"trx-details\");\n }\n\n\n });\n}", "getById(id) {\n return this.get(id).then(response => {\n const item = response.data.data;\n this.setCid(item);\n return item;\n });\n }", "async getById(id) {\n if (!this.availableFunctions.includes('getById')) {\n throw new GuardianJSInvalidMethodException('getById is an invalid method');\n }\n return this._request(`${this.base}/${id}?api-key=${this.key}`);\n }", "get(id) {\n return this.db.get(id)\n }", "function getRecord(id){\n return MIRESAdmin.firestore().collection(MIRESconfig.MIRES_log).orderBy(\"timestamp\",\"asc\").where(\"transaction_id\",\"==\",id).limit(1).get()\n .then(querySnapshot => {\n if (querySnapshot.empty)\n {\n throw new Error(\"getRecord function: log is empty.\");\n } \n else \n { \n return querySnapshot.docs[0];\n }\n }) \n .catch(err => {\n throw new Error(\"getRecord function: \"+ err);\n });\n}", "async function fetchTransaction(txid) {\n\tconst cachedTransaction = transactionCache.get(txid);\n\tif (cachedTransaction) {\n\t\treturn cachedTransaction;\n\t}\n\n\t// https://developers.whatsonchain.com/#get-raw-transaction-data\n\tconst url = `https://api.whatsonchain.com/v1/bsv/main/tx/${txid}/hex`;\n\tconst response = await fetchRateLimited(url);\n\tif (!response.ok) {\n\t\tconsole.log(response);\n\t\tthrow new Error(`Request for transaction download rejected with status ${response.status}`);\n\t}\n\n\tconst txSerialized = await response.text();\n\ttransactionCache.add(txid, txSerialized);\n\treturn txSerialized;\n}", "function get(id) {\n return bus.find(id);\n}", "function get(id) {\n return bus.find(id);\n}", "function getBookingItem(id) {\n var url = 'data/bookingDetailData-' + id + '.json';\n return $http.get(url, {\n transformResponse: transformBookingItem\n })\n .then(sendResponseData)\n .catch(sendGetBookingError);\n }", "getPayMethodById(id, callback) {\n\t\tvar _sql = sql.paymethods.byId(id);\n\t\tthis._connection.query(_sql, function (err, result) {\n\t\t\tif(err) throw err;\n\n\t\t\tif(!result.length)\n\t\t\t\treturn callback(`Couldn't find pay method matching id \"${id}\"`);\n\n\t\t\t// Transform and return paymethod\n\t\t\tvar payMethod = sqlDataModel.payMethod(result[0]);\n\t\t\tcallback(null, payMethod);\n\t\t});\n\t}", "async getById(id) {\n try {\n const res = await api.get('api/tenants/' + id)\n\n const tenant = res.data\n AppState.tenant = tenant\n return tenant\n } catch (error) {\n logger.error(error)\n }\n }", "read({ transaction }, res) {\n res.json(transaction);\n }", "function getConfirmedRequest(id){\n let dfr = Q.defer();\n //populate transactions in order to cancel them\n Request.findOne({_id: id})\n .populate({\n path: 'transactionUser1',\n })\n .populate({\n path: 'transactionUser2',\n })\n .populate({\n path: 'user1',\n })\n .populate({\n path: 'user2',\n })\n .exec(function (err, request) {\n if (err || !request) {\n let msg = err;\n if(!request){\n msg = 'No relevant request found';\n }\n dfr.reject(msg);\n }\n else {\n dfr.resolve(request);\n }\n });\n return dfr.promise;\n}", "findById(id) {\n let sqlRequest = \"SELECT id, taskId,stateName, dbName,fileName,fileSize,status,startTime,allcount,downloadCount,source,msg FROM taskItem WHERE id=$id\";\n let sqlParams = {$id: id};\n return this.common.findOne(sqlRequest, sqlParams).then(row =>\n new TaskItem(row.id, row.taskId,row.stateName, row.dbName,row.fileName,row.fileSize,row.status,row.startTime,row.allcount,row.downloadCount,row.source,row.msg));\n }", "function transact(){\n const tid = transactions.length;\n const transaction = {\n tid: tid,\n timestamp: new Date(),\n user: 0\n };\n\n transactions.push(transaction);\n return transaction;\n }", "function getMyTransactions(req, res, next) {\n transactionService.getMyTransactions(req.params.id) // que pasar? req.params? id del wallet\n .then(wallets => res.json(wallets)) // alomejor hay q devolver otra cosa\n .catch(err => next(err));\n}", "static async getOne(id) {\n try {\n let result = await DatabaseService.getOne(collectionName, id);\n return result;\n } catch (err) {\n throw err;\n }\n\n }", "get(req, res, next) {\n this.transactionService.get(req.params.id)\n .then((data) => res.send(httpStatus.OK, data))\n .catch((error) => {\n res.send(httpStatus.InternalServerError, error);\n })\n .then(next);\n }", "function removeTransactions(id){\n console.log(id)\n transactions=transactions.filter(transaction=>\n \n transaction.id!==id)\n \n updateLocalStorage();\n\n init();\n}", "function findById(id) {\n return store.items.find(item => item.id === id);\n }", "get(id)\n {\n return this._fetch(this._url + '/' + id);\n }", "function removeTransaction(id) {\r\n // Filtrando todas las transacciones a quitar\r\n transactions = transactions.filter(transaction => transaction.id !== id);\r\n \r\n updateLocalStorage();\r\n init();\r\n}", "findHistory (id) {\n\t\treturn knex(this.tableName).where({ freelancer_id: id })\n\t\t\t.catch((err) => {\n\t\t\t\t// throw error if the id wasn't given in proper uuid format\n\t\t\t\tif (Errors.violatesIdSyntax(err))\n\t\t\t\t\tthrow Errors.badId(toSingular(this.tableName), 'find history for');\n\n\t\t\t\t// if the cause of the error wasn't found above, throw the given error\n\t\t\t\tthrow err;\n\t\t\t});\n\t}", "GetTransactionByHash(transactionHash = '') {}", "function get(id){\n return $q.when(db.get(id));\n }", "getTransactionReports(id){\r\n return Api().post('/emailtransactions/'+id)\r\n }", "getBasketItem(id) {\n for(let i = 0; i < this.basket.length; ++i) {\n if(this.basket[i].id == id) {\n return JSON.parse(JSON.stringify(this.basket[i]));\n }\n }\n }", "async getPurchaseRecord(wallet_id, event_id) {\n let users_id = await knex\n .select(\"id\")\n .from(\"users\")\n .where(\"wallet_id\", wallet_id.toLowerCase());\n if (users_id[0]) {\n let data = await knex(\"purchase_record\")\n .select(\"*\")\n .where(\"users_id\", users_id[0].id)\n .andWhere(\"event_id\", event_id);\n return data;\n }\n return null;\n }", "getById(knex, id) {\n return knex\n .from(\"comments\")\n .select(\"*\")\n .where(\"id\", id)\n .first();\n }", "async function doJob(id) {\n try {\n const tx = await transferLogic.createBookForBookDetailId(id);\n console.log(`Added a book for book_detail ${id}, tx_id: ${tx.id}`);\n\n return tx;\n } catch (err) {\n console.log(`Something failed: ${err}`);\n }\n}", "async function getItemById(id) {\n await validations.isIntValid(itemsDao.getItemId(id));\n let requestedItem = await itemsDao.getItemById(id);\n return requestedItem;\n}", "getById(id)\n {\n return this.getModel()\n .find(id)\n .first();\n }", "static getById(id) {\n if (!valid_string(id) && typeof id !== \"object\")\n return Promise.reject(new Error(`Invalid in getById(${id}) arguments`));\n return this.this_model().findOne({ _id: id });\n }", "get(id) {\n return this.rest.get(`${this.baseUrl}/${id}`);\n }", "get(id) {\n return this.rest.get(`${this.baseUrl}/${id}`);\n }", "static getById(id) {\n return db\n .oneOrNone('SELECT * FROM shopping_carts WHERE id = $1', [id])\n .then((shoppingCart) => {\n if (shoppingCart) return new this(shoppingCart);\n throw new Error(`Shopping Cart ${id} not found`);\n });\n }", "static async selectId(id)\n {\n const { rows } = await pool.query(`\n SELECT * FROM quotes\n WHERE id = $1`, [id]\n );\n return new Quote(rows[0]);\n }", "function getById(id) {\n return knex(TABLE_NAME).select('id', 'username').where({ id: id });\n}", "getPayment(id) {\n const path = `/payments?${id}`;\n const method = 'GET';\n const options = buildOptions(this.token, this.endPoint, path, method, null);\n return goCardlessRequest(options);\n }", "function deleteTransaction(id) {\n // Filter out the transaction with the provided id\n transactions = transactions.filter( transaction => transaction.id !== id );\n // Initialize the app again to update the DOM\n init();\n}", "function getTaskSync(id) {\n // https://docs.angularjs.org/api/ng/filter/filter\n var filtered = $filter('filter')(tasks, {id: id});\n return filtered.length ? filtered[0] : null;\n }", "function removeTransaction(id) {\n\ttransactions = transactions.filter((transaction) => transaction.id !== id);\n\n\tupdateLocalStorage();\n\n\tinit();\n}", "function fnDeleteTransaction(id) {\n jQuery.ajax({\n type: 'POST',\n url: bittionUrlProjectAndController + 'fnDeleteTransaction',\n dataType: 'json',\n data: {\n id: id\n },\n success: function(response) {\n if (response['status'] === 'SUCCESS') {\n bittionShowGrowlMessage(response['status'],response['title'],response['content']);\n fnRead(jQuery('#selectController').val());\n } else {\n bittionShowGrowlMessage(response['status'],response['title'],response['content']);\n }\n },\n error: function(response, status, error) {\n bittionAjaxErrorHandler(response, status, error);\n }\n });\n }", "static async getReservationById(id) {\n // const row = db.query(`SELECT * FROM reservations WHERE id=$1`, [id])[0];\n // let reservation = new Reservation({\n // id: row.id,\n // customerId: row.customer_id,\n // startAt: row.start_at,\n // numGuests: row.num_guests,\n // notes: row.notes\n // });\n // return reservation;\n const reservation = await db.query(\n `SELECT id,\n customer_id as \"customerId\",\n start_at as \"startAt\",\n num_guests as \"numGuests\",\n notes\n FROM reservations\n WHERE id=$1`,\n [id]\n )[0];\n\n if (reservation === undefined) {\n const err = new Error(`No such reservation: ${id}`);\n err.status = 404;\n throw err;\n }\n\n return new Reservation(reservation);\n }", "get(id) {\n\n }", "async findById(id) {\n return Order.findById(id);\n }", "get transaction() {\n return this._transaction;\n }", "readById(id, callback) {\n visitorHistoryModel.visitor_history.find({ where: { visitorId: id } }).then((visitorHistory) => {\n callback(visitorHistory);\n });\n }", "function getSingleEvent(id) {\n return knex('events')\n .select('*')\n .where({ id: parseInt(id) });\n}", "getAccount(id)\n {\n if (typeof(id) == \"object\")\n id = id.id\n\n return this.accounts.find(x => x.id == id) || null\n }", "static async get(id) {\n const result = await db.query(`SELECT * FROM messages WHERE id = $1`, [id]);\n\n return result.rows[0];\n }", "getById(id) {\n\t\treturn this._cache[id];\n\t}", "get(id) {\n return internal(this).idToEntity.get(id);\n }", "function getObject(id) {\n\n for (var i = 0; i < MAR.objects.length; i++) {\n if (MAR.objects[i].id === id) {\n return MAR.objects[i];\n }\n }\n\n return null;\n\n}", "function getEventByGateId(id) {\n return events.find(item => item.record.gateId === id);\n}", "async getCustomerById(id) {\n if (!id) {\n return {msg: 'No id was specified.', payload: 1}\n }\n\n let result = await customers.findById(id);\n\n if (!(!!result)) {\n return {msg: 'No customer was found with that id..', customer: {id: null}, payload: 1};\n }\n\n return {msg: 'Success', payload: 0, customer: result.dataValues};\n }", "findAllTenantTransaction(params) {\n return this.request.get('tenant-transaction', params);\n }", "get(id) {\n return http.get(`/orders/${id}`);\n }", "findOneOrder(id) {\n return this.orders.find(order => order.id === id);\n }", "async function readLogId(id) {\n try {\n return await knex('tb_users_logs').where('log_id', id);\n } catch (ex) {\n console.log('error when calling select is ID...');\n }\n}", "async getInvoiceFromDB(id){\n const invoicesDB= invoicesDBArray\n return invoicesDB.find(invoice=>invoice.id === id)\n }" ]
[ "0.8405136", "0.75180894", "0.74384165", "0.72922325", "0.72678393", "0.7149744", "0.7147425", "0.6840716", "0.662878", "0.6530607", "0.6415989", "0.63990885", "0.6379487", "0.630685", "0.6306483", "0.6282821", "0.627833", "0.6261638", "0.6199537", "0.6188094", "0.6166831", "0.6158894", "0.6148508", "0.61388314", "0.6133256", "0.61325467", "0.61267394", "0.6112232", "0.60950875", "0.60677105", "0.6030028", "0.59926367", "0.596191", "0.5957463", "0.5950156", "0.59473085", "0.5925324", "0.5913807", "0.5892767", "0.5880936", "0.5879443", "0.58666885", "0.5853266", "0.58503264", "0.58458424", "0.58404195", "0.58404195", "0.5839025", "0.5838378", "0.58370954", "0.58352315", "0.5825499", "0.5796185", "0.5793237", "0.5785908", "0.57811767", "0.5774928", "0.5771732", "0.5769881", "0.57609284", "0.5759617", "0.57498324", "0.5741172", "0.5741037", "0.57360417", "0.57356304", "0.5735505", "0.5734906", "0.5731749", "0.5728564", "0.5724877", "0.57219154", "0.5716801", "0.5716801", "0.57012933", "0.5696254", "0.5695244", "0.5692735", "0.5691264", "0.568957", "0.5663995", "0.56536883", "0.5653442", "0.56518257", "0.5651786", "0.56506115", "0.5649915", "0.5643167", "0.5639633", "0.56388235", "0.56344193", "0.56237864", "0.56184757", "0.5612376", "0.5602386", "0.5601092", "0.55904895", "0.5589568", "0.5583018", "0.5582508" ]
0.6903615
7
delete transaction by id
function deleteTransactionById(_id) { return TransactionModel.deleteOne({ _id }).exec(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteTransaction(id) {\n transaction.deleteTransaction(id)\n .then(res => loadTransactions())\n .catch(err => console.log(err));\n }", "function deleteTransaction(id) {\n transactions = transactions.filter( transaction => transaction.id != id );\n init();\n}", "function deleteTransaction (id){\n dispatch({\n type:'DELETE_TRANSACTION',\n payload: id\n });\n }", "function deleteTransaction(id) {\n dispatch({\n type: \"DELETE_TRANSACTION\",\n payload: id\n });\n }", "function DeleteTransaction(id) {\n dispatch({\n type: 'DELETE_TRANSACTION',\n payload: id\n });\n }", "function delTrans(id) {\n dispatch({\n type: \"DELETE_TRANSACTION\",\n payload: id\n });\n }", "removeTransaction(id)\n {\n if (typeof(id) == \"object\")\n id = id.id\n\n let index = this.transactions.findIndex(x => x.id == id)\n\n if (index == -1)\n return\n\n this.transactions.splice(index, 1)\n }", "function deleteTransaction(id) {\n // Filter out the transaction with the provided id\n transactions = transactions.filter( transaction => transaction.id !== id );\n // Initialize the app again to update the DOM\n init();\n}", "deleteTransaction(transactionID) {\r\n console.log('deleteing ID: '+ transactionID);\r\n this._transactionList.splice(this.findTransactionIndex(transactionID), 1);\r\n }", "function removeTransaction(id) {\r\n // Filtrando todas las transacciones a quitar\r\n transactions = transactions.filter(transaction => transaction.id !== id);\r\n \r\n updateLocalStorage();\r\n init();\r\n}", "deleteById(id) {\n let sqlRequest = \"DELETE FROM taskItem WHERE id=$id\";\n let sqlParams = {$id: id};\n return this.common.run(sqlRequest, sqlParams);\n }", "function removeTransaction(id) {\n\ttransactions = transactions.filter((transaction) => transaction.id !== id);\n\n\tupdateLocalStorage();\n\n\tinit();\n}", "function removeTransactions(id){\n console.log(id)\n transactions=transactions.filter(transaction=>\n \n transaction.id!==id)\n \n updateLocalStorage();\n\n init();\n}", "function fnDeleteTransaction(id) {\n jQuery.ajax({\n type: 'POST',\n url: bittionUrlProjectAndController + 'fnDeleteTransaction',\n dataType: 'json',\n data: {\n id: id\n },\n success: function(response) {\n if (response['status'] === 'SUCCESS') {\n bittionShowGrowlMessage(response['status'],response['title'],response['content']);\n fnRead(jQuery('#selectController').val());\n } else {\n bittionShowGrowlMessage(response['status'],response['title'],response['content']);\n }\n },\n error: function(response, status, error) {\n bittionAjaxErrorHandler(response, status, error);\n }\n });\n }", "async function removeTransaction(transId) {\n try {\n const res = await axios.delete(`/api/transactions/${transId}`);\n if (res.status === 200) {\n dispatch({\n type: \"REMOVE_TRANSACTION\",\n payload: transId,\n });\n }\n } catch (err) {\n dispatch({\n type: \"TRANSACTION_ERROR\",\n payload: err.response.data.error,\n });\n }\n }", "function deleteTransaction(id) {\n $.ajax({\n url: `/edit_transaction/${id}`\n }).done(function(response) {\n\n // transaction record ID link \n let updateURL = `/delete_transaction/${id}`;\n $('#deleteForm').attr('action', updateURL);\n $('#deleteTransactionModal').modal('show');\n });\n}", "deleteById(id) {\n let sqlRequest = \"DELETE FROM event WHERE id=$id\";\n let sqlParams = {$id: id};\n return this.common.run(sqlRequest, sqlParams);\n }", "delete(id) {\n if (!id) {\n return Promise.reject(new Error('invalid_id'));\n }\n return this.iugu.makeRequest('DELETE', `/customers/${id}`).begin();\n }", "function deleteTransactions(id){ // id received as a parameter when the user deletes the transaction\n dispatch({\n type: 'DELETE_TRANSACTIONS', //action type to pass on AppReducer.js\n payload: id // passing data (payload) i.e id to AppReducer.js\n })\n}", "deleteById(req, res) {\n let id = req.params.id;\n\n this.tradeDao.deleteById(id)\n .then(this.common.editSuccess(res))\n .catch(this.common.serverError(res));\n }", "async delete(id) {\n const res = window.confirm('Are you sure you want to remove this tenant?')\n if (!res) {\n return\n }\n try {\n await api.delete('api/tenants/' + id)\n this.getById(id)\n } catch (error) {\n logger.error(error)\n }\n }", "async deleteById(id) {\n try {\n if (!id) { throw new Error('id must be given'); }\n\n // create prepared statement\n this.delete({ id });\n\n // execute the query\n return await this.exec();\n } catch ({ stack, message }) {\n console.log(stack, message);\n return `Unable to fetch object: ${message}`;\n }\n }", "deleteById(id) {\n let sqlRequest = \"DELETE FROM restaurants WHERE id=$id\";\n let sqlParams = {\n $id: id\n };\n return this.common.run(sqlRequest, sqlParams);\n }", "static deleteTask(taskId = 0){\n var table_Name = Task.tableName\n const sql = `delete from ${table_Name} WHERE id = ?`\n const params = [taskId]\n console.log(\"Task id \"+taskId)\n return this.repository.databaseLayer.executeSql(sql, params)\n }", "deleteById(id) {\n let sqlRequest = \"DELETE FROM repo WHERE id=$id\";\n let sqlParams = {$id: id};\n return this.common.run(sqlRequest, sqlParams);\n }", "async deleteById(id) {\r\n const item = await this.findById(id);\r\n const result = await item.destroy();\r\n if (result === false) {\r\n throw new Exception('can not delete resource', 1002);\r\n }\r\n return result;\r\n }", "function deleteInt(id) {\n transition(DELETE);\n //Located in the hooks/useApplicationData.js\n cancelInterview(id)\n .then(() => transition(EMPTY))\n .catch(error => transition(ERR_DELETE, true));\n }", "function deleteRecord(id) {\n\n var iddelete = id.toString();\n\n db.transaction(function (tx) { tx.executeSql(deleteStatement, [id], showRecords, onError); alert(\"Sucessfully Deleted\"); });\n\n resetForm();\n \n}", "remove(table, id) {\n var queryString = `DELETE FROM ?? WHERE id = ?` \n\n return this.connection.query(queryString, [table, id]);\n }", "deleteUser({ commit }, id) {\n commit(\"deleteUser\", id)\n }", "deleteTodo (id, callback, table = this.table) {\n const s = 'DELETE FROM ' + table + ' WHERE id=?'\n\n knex.query(s, [id], function (err, result) {\n if (err) throw err\n callback(result)\n })\n }", "async deleteById(id) {\n return await conn.query(\"DELETE FROM Fitness_RoutineExercises WHERE routineExercises_id=?\", id);\n }", "async deleteById(id) {\n\t\tif (await empCal.findByEmpId(id)) {\n\t\t\tawait empCal.deleteByEmpID(id);\n\t\t}\n\t\tif (await empCard.findByEmpId(id)) {\n\t\t\tawait empCard.deleteByEmpID(id);\n\t\t}\n\t\tlet sqlRequest = \"DELETE FROM employee WHERE id=$id\";\n\t\tlet sqlParams = {$id: id};\n\t\treturn this.common.run(sqlRequest, sqlParams);\n\t}", "static async remove(id) {\r\n\t\tlet queryString = Tradesman.sqlForDelete(\"tradesmen\", \"id\", id);\r\n\t\tconst result = await db.query(queryString.query, [queryString.id]);\r\n\r\n\t\tif (result.rows.length === 0) {\r\n\t\t\tconst err = new ExpressError(\r\n\t\t\t\t`Could not find tradesman id: ${id}`,\r\n\t\t\t\t404\r\n\t\t\t);\r\n\t\t\tthrow err;\r\n\t\t}\r\n\t\treturn \"deleted\";\r\n\t}", "function deleteItem(id) {\n axios.delete(\"/delete/\" + id);\n }", "async delete(id) {\n await this.connection\n .getRepository(ApplicationInformationDBO_1.ApplicationInformationDBO)\n .createQueryBuilder()\n .delete()\n .from(ApplicationInformationDBO_1.ApplicationInformationDBO)\n .where(\"id = :id\", { id: id })\n .execute();\n console.log(\"ApplicationInformation deleted: \" + id);\n }", "async deleteObra(id){\n const sql = 'DELETE FROM obras WHERE id_obra= $1';\n const result = await pool.query(sql,[id]);\n return result.rows;\n }", "static delete(id) {\n try{\n delete IdentifyMap[id];\n const data = connection.query(`SELECT * FROM resource where id=${id}`);\n if (data.length > 0){\n const type = data[0].type;\n const resource_line_item_data = connection.query(`DELETE FROM resource_line_item WHERE resource_id=${id}`);\n const child_data = connection.query(`DELETE FROM ${type} where resource_id=${id}`);\n const resource_data = connection.query(`DELETE FROM resource where id=${id}`);\n return {status : 0, message : 'Resource deleted.'};\n } else {\n return {status : 1, message : 'Nothing to delete.'}\n }\n }\n catch(error){\n return {status : 1, message : 'Error' +error, error}\n }\n }", "function _delete(id) {\n return fetchWrapper.delete(`${accountUrl}/${id}`)\n}", "delete(tableName, id){\n\t\t\tif(this.hasTable(tableName)){\n\t\t\t\tlet index = this.mapping[tableName][id];\n\t\t\t\tthis.tableData[tableName].splice(index, 1);\n\n\t\t\t\treturn {code: 'code005', content: '删除成功!'};\n\t\t\t}\n\n\t\t\treturn {code: 'code006', content: '删除失败!'};\n\t\t}", "async deleteAccount(id){\n // console.log('Deleting Account...')\n data = {\n URI:`${ACCOUNTS}/${id}`,\n method: 'DELETE',\n }\n return await this.sendRequest(data)\n }", "deleteCat(item) {\n let query = \"DELETE FROM cat where cat_id=?\";\n let params = [\n item.cat_id\n ];\n console.log(params)\n db.transaction(tx => {\n tx.executeSql(\n query,\n params,\n (tx, results) => {\n console.log(\"Success\", results);\n this.recoverCat()\n },\n function(tx, err) {\n console.log(\"Erreur\" + err);\n }\n );\n });\n}", "delete(id: number) {\n return axios.delete<{}, { id: number }>('/tasks/' + id).then((response) => response.data.id);\n }", "function deleteTruck(id, truckId){\n return db('trucks_table')\n .where('owner_id', id)\n .andWhere('id', truckId)\n .del()\n}", "function removeFromOrderWithId(id) {\n var table = getCurrentTable();\n if (table === \"error\") return;\n delete table.item_id[id];\n return;\n}", "function deleteByMarketId(id){\n return db(\"market\")\n .where({ 'firebase_id': id })\n .del(); \n}", "function deleteRecord(id) {\n bookmarkTable.get(id).deleteRecord();\n }", "async function deleteLog(id) {\n try {\n return await knex('tb_users_logs')\n .where('log_id', id)\n .del();\n //In return, the answer 1 is returned if it is done successfully.\n } catch (ex) {\n console.log('error in deleting data by id...'+ex);\n }\n}", "async deleteCustomerById(id) {\n if (!id) {\n return {msg: 'No id was specified..', payload: 1}\n }\n\n try {\n return !!await customers.destroy({\n where: {\n id: id\n }\n })\n } catch (e) {\n return false;\n }\n\n }", "async function deleteOrder(id)\n{\n return pool.query('DELETE FROM orders WHERE order_id=$1 RETURNING *', [id])\n .then(res => {\n //Should be only one row\n return res.rows[0]\n })\n .catch(err => {\n return {error: err, errCode: 500}\n })\n}", "static delete(id) {\n //FIXME\n }", "async destroy ({ params }) {\n const deposito = await Deposito.findOrFail(params.id);\n await deposito.delete();\n }", "function deleteTask(id) {\n return $http.delete(url, {params: {id:id}})\n\t\t.then(function successCallback (res){\n\t return res.data;\n\t }, function errorCallback(error) {\n console.log('ERRRRR');\n \tconsole.log(error);\n \t});\n }", "handleDeleteTask (id) {\n this.model.deleteTask(id);\n }", "function deleteById(storename, id) {\r\n console.log(\"deleteAction: storename: \" + storename);\r\n setDatabaseName('dbCat', ['users', 'items', 'categories', 'subcategories ', 'events', 'watchlist']);\r\n setCurrObjectStoreName(storename);\r\n startDB(function () {\r\n deleteOne(id, function () {\r\n alert(\"deleted!\");\r\n location.reload();\r\n });\r\n }); // async func\r\n }", "async delete(id) {\n return await conn.query(\"DELETE FROM Fitness_Workouts WHERE workout_id=?\", id);\n }", "static deleteById(id) {\n return db.result(`delete from users where id = $1`, [id]);\n }", "function delItem(id) {\n connection.query(\"DELETE FROM itemList where id = ?\", [id], function(\n error,\n results,\n fields\n ) {\n if (error) throw error;\n console.log(results);\n });\n }", "async delete(id) {\n\t\t//For this, first we need to get all of the records\n\t\tconst records = await this.getAll();\n\t\t//Then, we will create a variable called filteredRecords using the .filter() array callback method. .filter() only copies the elements that return a value of true. We want to copy over all of the records except for the one whose ID we inputted. Therefore, we will make the boolean expression records.id !== id, so it filters out the one ID we are trying to delete\n\t\tconst filteredRecords = records.filter((records) => records.id !== id);\n\t\t//Then, we use writeAll() to write our new filteredRecords onto our this.filename\n\t\tawait this.writeAll(filteredRecords);\n\t}", "async delete(id) {\n return await keyv.delete(id);\n }", "static async removeTask(id) {\n let result = await Task.findOneAndDelete({id}).exec()\n return result\n }", "async delete(id = this.id) {\n try {\n const connection = await mysql.createConnection(this.dbConfig);\n await connection.query(`DELETE FROM department WHERE id=${id}`);\n connection.end();\n } catch (error) {\n console.error(error);\n }\n }", "deleteActivity(db, id) {\n return db('activity')\n .where({ id })\n .delete();\n }", "deleteById(case_id : number): Promise<void>{\n return axios.delete(url+'/deleteCase/'+case_id);\n }", "delete() {\n this.dbUpdater.checkOkToDelete();\n\n // TODO: What is the right way to test this?\n //if (this.last) {\n // throw \"cannot delete account with any transactions\";\n //}\n\n if (this.parent) {\n let parent = this.parent;\n parent.children.delete(this.data.name);\n parent._notifySubscribers();\n // TODO:\n // Should we notify the account itself?\n // Then any view that depends on it could just\n // redirect somewhere else?\n }\n\n this.db.accountsByGuid.delete(this.data.guid);\n this.dbUpdater.delete()\n }", "function deleteTask(id){\n API.deleteTask(id)\n .then(()=>{\n getTasks();\n }).catch();\n }", "function deleteSystemJSON(id)\n{\n systemDB.transaction(function (tx) \n {\n tx.executeSql(\"DELETE FROM files where id = ?\", [id]);\n });\n \n}", "function delete_cargo(id) {\n const key = datastore.key([CARGO, parseInt(id, 10)]);\n return datastore.delete(key);\n}", "async function deleteAction(actionId) {\n try {\n return await knex('tb_actions')\n .where('action_id', actionId)\n .del();\n //In return, the answer 1 is returned if it is done successfully.\n } catch (ex) {\n console.log('error in deleting data by id...');\n }\n}", "async delete(_id) {\n return await this.db.remove({ _id });\n }", "async deletePayment (req, res) {\n try {\n const {paymentId} = req.body\n Payment.destroy({\n where: {\n id: paymentId\n }\n })\n } catch (err) {\n res.status(500).send({\n error: 'An error has occured during deleting'\n })\n }\n }", "remove(id, params) {}", "function remove(id){\n return db('trips').where('id',id).del();\n}", "deleteBoughtTransaction(transactionID) {\n var index = 0;\n\n for (let i = 0; i < window.Database.DB.bought.length; ++i) {\n if (window.Database.DB.bought[i].transaction_id == transactionID) {\n window.Database.DB.bought.splice(i, 1);\n return true;\n }\n }\n return false;\n }", "async deleteOrder(id) {\n return Order.findByIdAndRemove(id)\n }", "async function deleteTodo(id) {\n const res = await query(`DELETE FROM todos WHERE id=${id};`);\n console.log(\"delete id\", res);\n return res;\n}", "static async delete(id) {\n const result = await db.query(\n `DELETE FROM jobs\n WHERE id=$1\n RETURNING id`,\n [id]\n );\n \n if (result.rows.length === 0) {\n throw { message: \"Invalid id\", status: 404};\n }\n return 'Job deleted'\n }", "static delete(id) {\n OrderComponent.deleteUsers(id)\n return userExtent.splice(userExtent.findIndex(u => u.id == id), 1)\n }", "function deleteJSON(id)\n{\n filesDB.transaction(function (tx) \n {\n tx.executeSql(\"DELETE FROM files where id = ?\", [id]);\n });\n \n}", "function deleteJSON(id)\n{\n filesDB.transaction(function (tx) \n {\n tx.executeSql(\"DELETE FROM files where id = ?\", [id]);\n });\n \n}", "deleteByTaskId(id, callback) {\n try {\n id = new ObjectID(id)\n } catch (err) {\n callback(null)\n }\n collection.deleteMany({task: id}, callback)\n }", "delete(id) {\n return this.rest.delete(`${this.baseUrl}/${id}`);\n }", "delete(id) {\n return this.rest.delete(`${this.baseUrl}/${id}`);\n }", "function removeItem(id) {\n // Finds transaction with given id from transactions array.\n transactions = transactions.filter(transaction => transaction.id !== id);\n\n // Updates local storage with latest JavaScript transactions array.\n updateLocalStorage();\n\n // Initialises application.\n init();\n}", "function remove(id){\n return knex.transaction( async (trx) => {\n //table where the reservation is seated\n const table = await knex(\"tables\").where({table_id: id}).first()\n \n return knex(\"reservations\") \n .transacting(trx)\n .where({reservation_id: table.reservation_id })\n .update({status: \"finished\" }) // associated reservation status updated to finished\n .then(() => {\n // then the table is cleared -- has no associated reservation_id\n return knex(\"tables\")\n .where({table_id: id})\n .update({reservation_id: null}) \n .returning([\"table_name\", \"table_id\", \"capacity\", \"reservation_id\"])\n })\n })\n}", "deleteTask(id) {\n var index = this.list.map(i => i.id).indexOf(id);\n this.list.splice(index, 1);\n ls.deleteItem(id);\n }", "deleteUserTask(id) {\n return instance.delete(`/clients/${id}`).then(response => {\n return response.data;\n });\n\n }", "function deleteItem(storeName, id){\n\treturn dbPromise\n\t\t.then(function(db){\n\t\t\tvar tx = db.transaction(storeName, 'readwrite');\n\t\t\tvar store = tx.objectStore(storeName);\n\t\t\tstore.delete(id); \n\t\t\treturn tx.complete;\n\t\t})\n\t\t.then(function(){\n\t\t\tconsole.log('Item deleted');\n\t\t});\n}", "function deleteTask(id){\r\n // Remove from DOM\r\n let item = document.getElementById(id);\r\n item.remove();\r\n\r\n // Remove from backend\r\n let dataSend = \"deleteTask=exec&id=\" + id;\r\n return apiReq(dataSend, 3);\r\n}", "async function deleteById(tag) {\n let confirm = await confirmModal();\n if(confirm){\n let element = $(tag);\n loadingElement(element)\n let id = element.attr(\"data-id\");\n let url = element.attr(\"data-url\");\n window.axios.delete(url)\n .then(function (response) {\n let data = response.data;\n if(!data.hasError){\n let tabla = $('#tabla-listado').DataTable();\n removeRowTable(element.parents('tr'),tabla);\n\n modalMessage(data.message,'success');\n }else{\n modalMessage(data.message,'error');\n }\n }).catch(function (error) {\n let mensaje = \"Problema al eliminar el registro.\";\n catchErrorAxios(error,mensaje);\n }).finally(function () {\n resetLoadingElement(element);\n });\n }\n }", "delete(req, res, next) {\n this.transactionService.delete(req.params.id)\n .then((data) => res.send(httpStatus.OK, data))\n .catch((error) => {\n res.send(httpStatus.InternalServerError, error);\n })\n .then(next);\n }", "deleteCardByID(context, id) {\n context.commit('deleteCard', id);\n context.commit('refresh');\n }", "function onDelete(td) {\n row = td.parentElement.parentElement;\n \n \n\n<<<<<<< HEAD\n \n=======\n // document.getElementById(\"myTable\").deleteRow(row.rowIndex);\n>>>>>>> d1f81fdb117ddbf74e736eb7cade24c2142b12e8\n \n if (confirm('Are you sure to delete this record ?')) {\n row = td.parentElement.parentElement;\n id_to_delete = row.cells.item(1).innerText;\n \n document.getElementById(\"myTable\").deleteRow(row.rowIndex);\n // to call function to delete transaction by transaction id (id_to_delete)\n deleteRecord = () => {\n fetch(`http://localhost:3000/transactions/delete/by-id?transaction_id=${id_to_delete}`, {\n method: \"DELETE\",\n })\n .then((response) => response.text())\n .catch((error) => console.log(error));};\n deleteRecord(id_to_delete);\n resetForm();\n \n }``\n}", "async function deleteTodoById(account_id){\n if(account_id){\n // const [result, ] = await pool.query(\"DELETE FROM todos WHERE id=?\",[account_id]); // return Promise [results, fields]\n return await Todo.destroy({\n attributes:attributes,\n where: { \n id: account_id\n }\n }) \n }\n return null;\n}", "function deleteById(id) {\n return fs.readFile(dbPath, \"utf-8\").then((jsonData) => {\n const articles = JSON.parse(jsonData);\n\n const newArticles = articles.filter((article) => {\n return article.id !== id;\n });\n\n return fs.writeFile(dbPath, JSON.stringify(newArticles));\n });\n}", "removeLedger({state, commit}, {id}) {\n let index = state.tableLedgers.findIndex( i => { return i.id === id });\n if (index >= 0) {\n commit('removeFilteredLedgerFromTable', {index});\n commit('pushToSnackBarQue', { text: 'Ledger removing completed', color: 'success'});\n } else {\n commit('pushToSnackBarQue', { text: 'Ledger Removing failed', color: 'error'});\n }\n }", "deletePost(id) {\n if (window.confirm('Are you sure you want to delete this instrument?')) {\n axios.delete(`/instrument/delete/${id}`).then(res => {\n this.setState({\n all_instruments: res.data\n })\n toast.success(\"Successfully got Instruments\")\n }).catch(() => toast.error(alert(\"Instrument has a dependent record. Cannot be deleted\")));\n }\n }", "function _delete(id) {\n const requestOptions = {\n method: 'DELETE',\n headers: authHeader()\n };\n\n}", "eliminarOperarioPersona(id) {\n return axios.delete(`${API_URL}/v1/operario/${id}`);\n }", "function removeTransactionHandler(id) {\n const newTransactions = transactions.filter(\n (transaction) => transaction.id !== id\n );\n\n updateTransactionHandler(newTransactions);\n }" ]
[ "0.87048256", "0.83477056", "0.8138373", "0.8123875", "0.8030812", "0.79025096", "0.789536", "0.77007", "0.7653753", "0.73849493", "0.7232468", "0.722017", "0.70500445", "0.704107", "0.6940432", "0.6928991", "0.6897247", "0.67960155", "0.67626005", "0.6711767", "0.6695826", "0.66136837", "0.66011596", "0.65937", "0.6591152", "0.6546276", "0.653762", "0.6503491", "0.6490362", "0.64846796", "0.6465838", "0.64402586", "0.643838", "0.6431257", "0.6421429", "0.6414652", "0.64082515", "0.63939106", "0.6378319", "0.63619494", "0.6357778", "0.6356957", "0.63522094", "0.63482475", "0.6336945", "0.63289094", "0.6299297", "0.6294762", "0.62879735", "0.6283296", "0.62762254", "0.6276058", "0.62710583", "0.62701327", "0.6269465", "0.62578607", "0.62559515", "0.624744", "0.62471545", "0.62413764", "0.6238464", "0.6238452", "0.62334514", "0.6230999", "0.62281746", "0.62191194", "0.62151766", "0.62147313", "0.6205699", "0.6203942", "0.6198843", "0.6196558", "0.6195334", "0.61941946", "0.6192992", "0.6192107", "0.6188899", "0.6186896", "0.61848986", "0.61848986", "0.618052", "0.61788356", "0.61788356", "0.6174067", "0.6172208", "0.61696064", "0.615784", "0.6147743", "0.61393815", "0.6135396", "0.6129348", "0.6128114", "0.61164826", "0.611386", "0.61077416", "0.6088688", "0.6085162", "0.60848486", "0.6083815", "0.60784566" ]
0.8468602
1
delete all transaction that relate to customer by customer id
function deleteAllTransactionsByCustomerId(customer_id) { return TransactionModel.deleteMany({ customer_id }).exec(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteTransaction(id) {\n transactions = transactions.filter( transaction => transaction.id != id );\n init();\n}", "async function clearCustomers() {\n try {\n const { result : { customers } } = await customersApi.listCustomers();\n if (customers) {\n for (const key in customers) {\n const customer = customers[key];\n await customersApi.deleteCustomer(customer.id);\n }\n console.log(\"Successfully deleted customers\");\n } else {\n console.log(\"No customers to delete\");\n }\n } catch (error) {\n console.error(\"Error in deleting customers:\", error);\n }\n}", "deleteCustomer(empid) { \n this.customerService.deleteCustomer(empid);\n this.getCustomerList();\n }", "async deleteCustomerById(id) {\n if (!id) {\n return {msg: 'No id was specified..', payload: 1}\n }\n\n try {\n return !!await customers.destroy({\n where: {\n id: id\n }\n })\n } catch (e) {\n return false;\n }\n\n }", "function deleteTransaction(id) {\n transaction.deleteTransaction(id)\n .then(res => loadTransactions())\n .catch(err => console.log(err));\n }", "function deleteTransactionById(_id) {\r\n return TransactionModel.deleteOne({ _id }).exec();\r\n}", "function del(){\r\nCustomer.deleteMany({dni:\"32111111-A\",dni:\"32111112-B\",dni:\"32111113-C\",dni:\"32111114-D\"}, (err, ret) =>{\r\n\t\r\n\tif(err) {\r\n\t\tconsole.error(err);\r\n\t\t\r\n\t} else {\r\n\t\tconsole.log(\"Los dueños que coinciden con el criterio de busqueda han sido borrados: \", ret);\r\n\t\tconsole.log(\"Todo correcto!!\");\r\n\t\t\r\n\t}\r\n\t\r\n\t\r\n});\r\n\r\n}", "deleteCustomer(params) {\r\n return Api().delete('/customers/' + params)\r\n }", "function deleteCustomer(customerID) {\n // console.log(\"id \" + carID);\n API.deleteCustomer(customerID).then(function () {\n refreshCars();\n });\n}", "function deleteCustomer(customerObj, options) {\n return datacontext.post('Customer/DeleteCustomer/', customerObj, options);\n }", "delete(id) {\n if (!id) {\n return Promise.reject(new Error('invalid_id'));\n }\n return this.iugu.makeRequest('DELETE', `/customers/${id}`).begin();\n }", "function deleteTransaction(id) {\n // Filter out the transaction with the provided id\n transactions = transactions.filter( transaction => transaction.id !== id );\n // Initialize the app again to update the DOM\n init();\n}", "function removeTransactions(id){\n console.log(id)\n transactions=transactions.filter(transaction=>\n \n transaction.id!==id)\n \n updateLocalStorage();\n\n init();\n}", "function deleteCustomer(deleteParameters) {\r\n // deleteParameters is an array. EG: ['Email','[email protected]','Mobile','086 123 4567','FirstNames','Bob']\r\n\r\n console.log('Delete - Customer:');\r\n deleteParameters.unshift('customers');\r\n deleteFromCollection(deleteParameters);\r\n\r\n} // END: function deleteCustomer()", "removeTransaction(id)\n {\n if (typeof(id) == \"object\")\n id = id.id\n\n let index = this.transactions.findIndex(x => x.id == id)\n\n if (index == -1)\n return\n\n this.transactions.splice(index, 1)\n }", "deleteTransaction(transactionID) {\r\n console.log('deleteing ID: '+ transactionID);\r\n this._transactionList.splice(this.findTransactionIndex(transactionID), 1);\r\n }", "function deleteTransaction (id){\n dispatch({\n type:'DELETE_TRANSACTION',\n payload: id\n });\n }", "function deleteTransaction(id) {\n dispatch({\n type: \"DELETE_TRANSACTION\",\n payload: id\n });\n }", "function deletecustomer() {\n data = \"name=\" + String($(\".customer_name.act\").html()) + \"^class=Customer\";\n dbOperations(\"cus\", \"delete_operation\", data);\n $(\"li.actparent\").remove();\n $(\"#customerhistorypane\").css(\"opacity\", \"0\");\n check_for_active_row(\"customer_name\", \"inventory\");\n $(\"#customerhistorypane\").animate({\n opacity: 1\n });\n}", "function DeleteTransaction(id) {\n dispatch({\n type: 'DELETE_TRANSACTION',\n payload: id\n });\n }", "function deleteCustomer(CustomerID) {\n\n let data = {\n CustomerID: CustomerID\n }\n\n $.ajax({\n url: '/api/Customers/deleteCustomer',\n type: 'DELETE',\n contentType:\n \"application/json;charset=utf-8\",\n data: JSON.stringify(data),\n success: function () {\n //removes row from customertable via id\n $(\"#row\" + CustomerID).remove();\n },\n error: function (request, message, error) {\n handleException(request, message, error);\n }\n });\n}", "function DeleteCustomerMaster(this_obj) {\n debugger;\n customerVM = DataTables.customerList.row($(this_obj).parents('tr')).data();\n notyConfirm('Are you sure to delete?', 'DeleteCustomer(\"' + customerVM.ID + '\")');\n}", "removeFromCustomers() {\n KebapHouse.customers.splice(0, 1);\n }", "@acceptsTransaction\n @acceptsRecords\n async delete(records: Record[]) {\n const source = new Var()\n const target = new Var()\n const relation = new Var()\n // noinspection JSUnresolvedVariable\n await this.connection.query(C.tag`\n ${this.__namedSelfQuery(source, relation, target)}\n WHERE ${target}.uuid IN ${records.map(record => record.uuid)}\n\n DELETE ${relation}`)\n }", "function deletecustomerlist(id) {\n //check to ensure the db object has been created\n if (db) {\n //Get all the cars from the database with a select statement, set outputCarList as the callback function for the executeSql command\n db.transaction(function (tx) {\n tx.executeSql(\"DELETE FROM user WHERE id=?\", [id], outputcustomerlist);\n });\n } else {\n alert(\"db not found, your browser does not support web sql!\");\n }\n}", "function delTrans(id) {\n dispatch({\n type: \"DELETE_TRANSACTION\",\n payload: id\n });\n }", "function removeTransaction(id) {\r\n // Filtrando todas las transacciones a quitar\r\n transactions = transactions.filter(transaction => transaction.id !== id);\r\n \r\n updateLocalStorage();\r\n init();\r\n}", "function onDeleteCustomerClick() {\n $('#modal-confirm-delete').modal('show');\n let vSelectedRow = $(this).parents('tr');\n let vSelectedData = gCustomerTable.row(vSelectedRow).data();\n gCustomerId = vSelectedData.id;\n }", "function deleteAllItinBus(req, res, next) {\n var query = `\n DELETE FROM itinerarybusiness\n WHERE itinerary_id = :id\n `;\n let id = req.params.id;\n const binds = [id];\n\n oracledb.getConnection({\n user : credentials.user,\n password : credentials.password,\n connectString : credentials.connectString\n }, function(err, connection) {\n if (err) {\n console.log(err);\n } else {\n connection.execute(query, binds, function(err, result) {\n if (err) {console.log(err);}\n else {\n next()\n }\n });\n }\n });\n}", "function deleteTransactions(id){ // id received as a parameter when the user deletes the transaction\n dispatch({\n type: 'DELETE_TRANSACTIONS', //action type to pass on AppReducer.js\n payload: id // passing data (payload) i.e id to AppReducer.js\n })\n}", "function removeTransaction(id) {\n\ttransactions = transactions.filter((transaction) => transaction.id !== id);\n\n\tupdateLocalStorage();\n\n\tinit();\n}", "function deleteAllItinFlights(req, res, next) {\n var query = `\n DELETE FROM itineraryflight\n WHERE itinerary_id = :id\n `;\n let id = req.params.id;\n const binds = [id];\n\n oracledb.getConnection({\n user : credentials.user,\n password : credentials.password,\n connectString : credentials.connectString\n }, function(err, connection) {\n if (err) {\n console.log(err);\n } else {\n connection.execute(query, binds, function(err, result) {\n if (err) {console.log(err);}\n else {\n next()\n }\n });\n }\n });\n}", "function removeCurrentCustomer (successResult) {\n\t\t\t\tfor (var idx = 0;idx < successResult.data.length ; idx++) {\n\t\t\t\t\tif ($scope.customerID === successResult.data[idx].id) {\n\t\t\t\t\t\tsuccessResult.data.splice(idx, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}", "function deleteAccountsByFilter(filter) {\n\n var setOfDeletePromises = [];\n\n return CrmRestKit\n .ByQueryAll('Account', ['AccountId'], filter)\n .then(function(data){\n\n _.each(data, function(contactrecord){\n setOfDeletePromises.push(\n CrmRestKit.Delete('Account', contactrecord.AccountId)\n );\n });\n })\n .then(function(){\n\n // return a promise that is resolved once all\n // deleted-promises are completed\n return $.when.apply($, setOfDeletePromises);\n });\n }", "function deleteCustomer() {\n var data = {\n CustomerId: $(\"#CustomerId\").val()\n };\n\n $.post(\"/Customers/DeleteCustomer\", data, function (data, status) {\n updateCustomerTable();\n });\n}", "delete() {\n this.dbUpdater.checkOkToDelete();\n\n // TODO: What is the right way to test this?\n //if (this.last) {\n // throw \"cannot delete account with any transactions\";\n //}\n\n if (this.parent) {\n let parent = this.parent;\n parent.children.delete(this.data.name);\n parent._notifySubscribers();\n // TODO:\n // Should we notify the account itself?\n // Then any view that depends on it could just\n // redirect somewhere else?\n }\n\n this.db.accountsByGuid.delete(this.data.guid);\n this.dbUpdater.delete()\n }", "function EliminarPagina(){\n var idPagina;\n var idCuento;\n\n $('.actual').each(function () {\n idPagina= $(this)[0].id.split('_')[1];\n idCuento= CuentoActual.ID.split('_')[1];\n });\n\n\n\n db.transaction(deletePage,errordeletePage, successdeletePage);\n\n function deletePage(tx) {\n var Tablas = [\"Paginas\",\"Objetos\",\"Personajes\",\"Narraciones\",\"Bocadillos\",\"Fondos\"];\n var index = Tablas.length;\n\n\n\n for(var i=0; i<index; i++){\n var sql = \"DELETE FROM \" + Tablas[i] + \" WHERE ID_Paginas=\" + idPagina + \" AND ID_Cuento=\" + idCuento;\n console.log(sql);\n tx.executeSql(sql);\n }\n }\n\n function errordeletePage(tx, err) {\n alert(\"Error al eliminar página: \"+err);\n }\n\n function successdeletePage() {\n }\n\n}", "function deleteContactsByFilter(filter) {\n\n var setOfDeletePromises = [];\n\n return CrmRestKit\n .ByQueryAll('Contact', ['ContactId'], filter)\n .then(function(data){\n\n _.each(data, function(contactrecord){\n setOfDeletePromises.push(\n CrmRestKit.Delete('Contact', contactrecord.ContactId)\n );\n });\n })\n .then(function(){\n\n // return a promise that is resolved once all\n // deleted-promises are completed\n return $.when.apply($, setOfDeletePromises);\n });\n }", "async _mergeDelete({ids, primaryID, foreignKeys}){\n // now delete the merged records\n await this.db.query(/*sql*/`DELETE FROM ${this.config.table} WHERE ${this.idAttribute} IN(?)`, [ids])\n }", "function delete_all(table, callback) {\n db.transaction(function(tx) {\n executeSqlLog(tx, \"DELETE FROM \" + table, callback);\n });\n }", "async delete(id) {\n\t\t//For this, first we need to get all of the records\n\t\tconst records = await this.getAll();\n\t\t//Then, we will create a variable called filteredRecords using the .filter() array callback method. .filter() only copies the elements that return a value of true. We want to copy over all of the records except for the one whose ID we inputted. Therefore, we will make the boolean expression records.id !== id, so it filters out the one ID we are trying to delete\n\t\tconst filteredRecords = records.filter((records) => records.id !== id);\n\t\t//Then, we use writeAll() to write our new filteredRecords onto our this.filename\n\t\tawait this.writeAll(filteredRecords);\n\t}", "function removeID(){\r\nCustomer.findByIdAndRemove(\"59dde71c63e107135cfffed8\", (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(\"El señor con esta ID ha sido borrado: \", ret);\r\n\t\tconsole.log(\"Todo correcto!!\");\r\n\t\t\r\n\t}\r\n\t\r\n});\r\n\r\n}", "deleteByTaskId(id, callback) {\n try {\n id = new ObjectID(id)\n } catch (err) {\n callback(null)\n }\n collection.deleteMany({task: id}, callback)\n }", "function deleteAllUsers() {\n return knex.from('users')\n .del();\n}", "function deleteTruck(id, truckId){\n return db('trucks_table')\n .where('owner_id', id)\n .andWhere('id', truckId)\n .del()\n}", "function deleteCard() {\n var customerMgr = require('dw/customer/CustomerMgr');\n var registeredUsers = customerMgr.queryProfiles(\"\", \"customerNo ASC\");\n for each(var user in registeredUsers) {\n var wallet = user.getWallet();\n var creditCardsSaved = wallet.getPaymentInstruments('CREDIT_CARD');\n for each(var card in creditCardsSaved) {\n var paymentTokenID = card.creditCardToken;\n if (!paymentTokenID) {\n Transaction.wrap(function () {\n wallet.removePaymentInstrument(card);\n });\n }\n }\n }\n}", "del(transaction, bucket, keys) {\n contract(arguments).params(\"object\", \"string\", \"string|array\").end();\n\n keys = Array.isArray(keys) ? keys : [keys];\n\n keys = keys.map((key) => this.bucketKey(bucket, key));\n\n transaction.del(keys);\n }", "deleteUser(db, req) {\n return db.transaction(trx =>\n Promise.all([\n db('users')\n .transacting(trx)\n .where('id', req.user.id)\n .del(),\n db('messages')\n .transacting(trx)\n .where('user_id', req.user.id)\n .del()\n ]));\n }", "deleteBoughtTransaction(transactionID) {\n var index = 0;\n\n for (let i = 0; i < window.Database.DB.bought.length; ++i) {\n if (window.Database.DB.bought[i].transaction_id == transactionID) {\n window.Database.DB.bought.splice(i, 1);\n return true;\n }\n }\n return false;\n }", "deleteOrders(id) {\n const order = this.findOneOrder(id);\n const index = this.orders.indexOf(order);\n this.orders.splice(index, 1);\n return {};\n }", "static delete(id) {\n OrderComponent.deleteUsers(id)\n return userExtent.splice(userExtent.findIndex(u => u.id == id), 1)\n }", "function deleteAllRows( tx, tableName ) {\n debug && console.log( \"MobileDb.deleteAllRows: Deleting all rows from table: \" + tableName );\n executeSql( 'DELETE FROM ' + tableName, [], tx, null, null );\n }", "static async onDelete(req, res) {\n const id = req.body.id || req.params.id\n const { orderID, totalAmount } = req.body\n try {\n\n await Promise.all([\n Request.findByIdAndRemove(id),\n Orders.findByIdAndUpdate(orderID,\n {\n $inc: { totalToPay: -totalAmount },\n },\n ),\n ])\n\n return res.end()\n } catch (err) {\n console.log(err)\n return res.status(400).json(err)\n }\n }", "deleteCustomer({ commit }, data) {\n return axios\n .post(\"/customer/delete\", {...data })\n .then(response => {\n //console.log(response);\n commit(\"setDataRequest\", response.data);\n return Promise.resolve(true);\n })\n .catch(function(error) {\n console.log(error);\n return Promise.resolve(false);\n });\n }", "function btndeletesales(id) {\n deletedata('/sales/delete/' + id)\n}", "function deleteOwnedcar(primaryKey) {\n for (var i = 0; i < ownedcarsRootScope.ownedcarsData.length; i++) {\n if (primaryKey === ownedcarsRootScope.ownedcarsData[i].primaryKey) {\n ownedcarsRootScope.ownedcarsData.splice(i, 1);\n }\n }\n}", "deleteCat(item) {\n let query = \"DELETE FROM cat where cat_id=?\";\n let params = [\n item.cat_id\n ];\n console.log(params)\n db.transaction(tx => {\n tx.executeSql(\n query,\n params,\n (tx, results) => {\n console.log(\"Success\", results);\n this.recoverCat()\n },\n function(tx, err) {\n console.log(\"Erreur\" + err);\n }\n );\n });\n}", "clear() {\n this.transactions = [];\n }", "function remove(id){\n return knex.transaction( async (trx) => {\n //table where the reservation is seated\n const table = await knex(\"tables\").where({table_id: id}).first()\n \n return knex(\"reservations\") \n .transacting(trx)\n .where({reservation_id: table.reservation_id })\n .update({status: \"finished\" }) // associated reservation status updated to finished\n .then(() => {\n // then the table is cleared -- has no associated reservation_id\n return knex(\"tables\")\n .where({table_id: id})\n .update({reservation_id: null}) \n .returning([\"table_name\", \"table_id\", \"capacity\", \"reservation_id\"])\n })\n })\n}", "async function deleteUserContactDets (userId) {\n\n try {\n\n const sql = 'DELETE FROM user_contact_details ' + db.createWhereClause ( { user_id: userId } );\n const res = await db.saveData(sql);\n\n return {statusCode: 201, msg: 'Account deleted.'};\n \n }catch (err) {\n throw err;\n }\n \n }", "function deleteTransaction(id) {\n $.ajax({\n url: `/edit_transaction/${id}`\n }).done(function(response) {\n\n // transaction record ID link \n let updateURL = `/delete_transaction/${id}`;\n $('#deleteForm').attr('action', updateURL);\n $('#deleteTransactionModal').modal('show');\n });\n}", "function fnDeleteTransaction(id) {\n jQuery.ajax({\n type: 'POST',\n url: bittionUrlProjectAndController + 'fnDeleteTransaction',\n dataType: 'json',\n data: {\n id: id\n },\n success: function(response) {\n if (response['status'] === 'SUCCESS') {\n bittionShowGrowlMessage(response['status'],response['title'],response['content']);\n fnRead(jQuery('#selectController').val());\n } else {\n bittionShowGrowlMessage(response['status'],response['title'],response['content']);\n }\n },\n error: function(response, status, error) {\n bittionAjaxErrorHandler(response, status, error);\n }\n });\n }", "async getAllOrdersByCustomer(root, { customer_id }, { Order }) {\n return await Order.findAll({\n where: {\n customer_id: customer_id,\n },\n }).catch((err) => console.log(err));\n }", "handleDelete(customer) {\n\t\treturn () => deleteCustomer(customer);\n\t}", "deleteEmployee(results) {\n return connection.query(`DELETE FROM employee WHERE ?`,\n {\n id: results.id\n }\n )\n }", "function _deleteAll() {\n\t\ttry {\n\t\t\t//Get the Request Body\n\t\t\tvar oBody = JSON.parse($.request.body.asString());\n\n\t\t\t//Get the Database connection\n\t\t\tvar oConnection = $.db.getConnection();\n\n\t\t\t//Build the Statement to delete the entries\n\t\t\tvar oStatement = oConnection.prepareStatement(\"DELETE FROM \\\"\" + gvSchemaName + \"\\\".\\\"\" + gvTableName +\n\t\t\t\t\"\\\" WHERE CONDITION_ID = ?\");\n\n\t\t\t//Condition Id\n\t\t\toStatement.setInt(1, parseInt(oBody.CONDITION_ID));\n\n\t\t\toStatement.addBatch();\n\n\t\t\t//Execute the Insert\n\t\t\toStatement.executeBatch();\n\n\t\t\t//Close the connection\n\t\t\toStatement.close();\n\t\t\toConnection.commit();\n\t\t\toConnection.close();\n\n\t\t\tgvTableUpdate = \"Table entries deleted successfully from Table:\" + gvTableName + \";\";\n\t\t\tgvStatus = \"Success\";\n\n\t\t} catch (errorObj) {\n\t\t\tif (oStatement !== null) {\n\t\t\t\toStatement.close();\n\t\t\t}\n\t\t\tif (oConnection !== null) {\n\t\t\t\toConnection.close();\n\t\t\t}\n\t\t\tgvTableUpdate = \"There was a problem deleting entries in the Table: \" + gvTableName + \", Error: \" + errorObj.message + \";\";\n\t\t\tgvStatus = \"Error\";\n\t\t}\n\t}", "deleteAll() {\n realm.write(() => {\n const user = realm.objects('User');\n realm.delete(user);\n });\n }", "async delete(sales_item_id) {\n return db\n .query(\n `DELETE FROM sales_item\n WHERE sales_item_id = $1`,\n [sales_item_id]\n )\n .then(Result.count);\n }", "function deleteAll() {\n deleteHazards();\n deleteARequests();\n}", "deleteById(id) {\n let sqlRequest = \"DELETE FROM restaurants WHERE id=$id\";\n let sqlParams = {\n $id: id\n };\n return this.common.run(sqlRequest, sqlParams);\n }", "function deleteCreditCard(custnumber, data, callback) {\n\n photoeye.transaction(function (t) {\n\n var sql =\n `SELECT \n autoid,\n tableid,\n custnumber,\n carddefault,\n cardtype,\n cardnum,\n exp,\n cardholder,\n cc_cid,\n LTRIM(RTRIM(custtoken)) AS custtoken,\n LTRIM(RTRIM(paytoken)) AS paytoken,\n cc_last_four\n FROM creditcardsadditional\n WHERE \n custnumber = :custnumber\n AND autoid = :autoid`;\n\n var params = {\n custnumber: custnumber,\n autoid: data.id\n }\n\n return photoeye\n .query(sql, { transaction: t, replacements: params })\n .then(function (cc_info) {\n cc_info = cc_info[0][0];\n\n return new Promise(function (resolve, reject) {\n\n payment.deleteCustomerPaymentProfile(cc_info.custtoken, cc_info.paytoken, function(result) {\n\n if(result && result.messages && result.messages.resultCode == 'Ok' && result.messages.message && result.messages.message.code == 'I00001') {\n sql =\n `UPDATE creditcardsadditional SET \n carddefault = 0, \n deleted = 1 \n WHERE \n autoid = :autoid \n AND custnumber = :custnumber`;\n\n params = {\n autoid: data.id,\n custnumber: custnumber\n };\n\n photoeye\n .query(sql, { transaction: t, replacements: params })\n .spread(function(results, metadata) {\n resolve(results);\n });\n \n }\n else\n reject(null);\n });\n });\n\n });\n\n })\n .then(function (result) {\n // Transaction has been committed\n\n callback(result);\n })\n .catch(function (err) {\n // Transaction has been rolled back\n winston.error(err);\n callback(err);\n });\n}", "allDelete(){\n\n}", "deleteTodo (id, callback, table = this.table) {\n const s = 'DELETE FROM ' + table + ' WHERE id=?'\n\n knex.query(s, [id], function (err, result) {\n if (err) throw err\n callback(result)\n })\n }", "deleteModalities(modalities){\n for (var i = 0; i < modalities.length; i++) {\n Modalities.remove({_id: modalities[i]});\n }\n }", "async deletePayment (req, res) {\n try {\n const {paymentId} = req.body\n Payment.destroy({\n where: {\n id: paymentId\n }\n })\n } catch (err) {\n res.status(500).send({\n error: 'An error has occured during deleting'\n })\n }\n }", "delete() { all = all.filter(task => task.id !== this.id) }", "async destroy ({ params }) {\n const deposito = await Deposito.findOrFail(params.id);\n await deposito.delete();\n }", "async function delete_cargoes(req) {\n\n let cargoes = await get_cargoes(req);\n console.log(cargoes);\n cargoes.items.forEach( async cargo => {\n console.log(\"deleting id: \" + cargo.id);\n const cargo_key = datastore.key([CARGO , parseInt(cargo.id, 10)]);\n return await datastore.delete(cargo_key);\n });\n}", "deleteContactById(id) {\n let index = this.contacts.findIndex(contact => contact.id === id)\n let deleteObject = this.contacts[index]\n this.contacts = this.contacts.filter(contact => contact.id !== id)\n\n return deleteObject\n }", "deleteById(id) {\n let sqlRequest = \"DELETE FROM taskItem WHERE id=$id\";\n let sqlParams = {$id: id};\n return this.common.run(sqlRequest, sqlParams);\n }", "function deleteByMarketId(id){\n return db(\"market\")\n .where({ 'firebase_id': id })\n .del(); \n}", "function deleteAllDatadbfs(callback) {\n console.log(\"inside deleteAllDatadbfs\");\n Model.Datadbf.destroy({ \n truncate: true \n }).then(function() {\n callback(null);\n });\n}", "async DeleteAllDoctorService(req,res) {\n\n }", "async delete(id) {\n const res = window.confirm('Are you sure you want to remove this tenant?')\n if (!res) {\n return\n }\n try {\n await api.delete('api/tenants/' + id)\n this.getById(id)\n } catch (error) {\n logger.error(error)\n }\n }", "function doBatchDelete(batch) {\r\n\r\n const requestBatch = buffer.nextKeys.map((keyVal) => {\r\n return {\r\n DeleteRequest: {\r\n Key: { [keyString]: keyVal }\r\n }\r\n };\r\n });\r\n\r\n let params = {\r\n RequestItems: {}\r\n };\r\n\r\n params.RequestItems[tableName] = requestBatch;\r\n\r\n return new Promise((resolve, reject) => {\r\n setTimeout(() => {\r\n const toResolve = docClient.batchWrite(params).promise()\r\n .then(data => {\r\n return data;\r\n });\r\n\r\n resolve(toResolve)\r\n }, writeDelay);\r\n })\r\n }", "function deleteItinerary(req, res) {\n deleteAllItinFlights(req, res, function () {\n deleteAllItinBus(req, res, function () {\n var query = `\n DELETE FROM itinerary\n WHERE itinerary_id = :id\n `;\n let id = req.params.id;\n const binds = [id];\n oracledb.getConnection({\n user : credentials.user,\n password : credentials.password,\n connectString : credentials.connectString\n }, function(err, connection) {\n if (err) {\n console.log(err);\n } else {\n connection.execute(query, binds, function(err, result) {\n if (err) {console.log(err);}\n else {\n res.json(result)\n }\n });\n }\n });\n }) \n }) \n}", "function htmlDeleteTransactionButton(transactionID) {\r\n account.deleteTransaction(transactionID);\r\n // Save budget to Local Storage to save the change\r\n budget.saveToStorage();\r\n // Update the HTML table\r\n updateTable(account);\r\n draw(account); // Redraw the analysis area using the new data\r\n drawLineChart(); // Redaw the line chart using the new data\r\n}", "function onDelete(td) {\n row = td.parentElement.parentElement;\n \n \n\n<<<<<<< HEAD\n \n=======\n // document.getElementById(\"myTable\").deleteRow(row.rowIndex);\n>>>>>>> d1f81fdb117ddbf74e736eb7cade24c2142b12e8\n \n if (confirm('Are you sure to delete this record ?')) {\n row = td.parentElement.parentElement;\n id_to_delete = row.cells.item(1).innerText;\n \n document.getElementById(\"myTable\").deleteRow(row.rowIndex);\n // to call function to delete transaction by transaction id (id_to_delete)\n deleteRecord = () => {\n fetch(`http://localhost:3000/transactions/delete/by-id?transaction_id=${id_to_delete}`, {\n method: \"DELETE\",\n })\n .then((response) => response.text())\n .catch((error) => console.log(error));};\n deleteRecord(id_to_delete);\n resetForm();\n \n }``\n}", "function delete_cargo(id) {\n const key = datastore.key([CARGO, parseInt(id, 10)]);\n return datastore.delete(key);\n}", "confirmDelete() {\n // this.order.destroyRecord();\n console.log('you have confired the delete for the order', this.order);\n }", "function removeAllData() {\r\n if (confirm(\"Pressing OK will clear all saved data.\\n\"+\r\n \"This action can not be undone!\\nPress Cancel to retrun without clearning.\")){\r\n let transactionTable = document.getElementById('transactionTableBody');\r\n while(transactionTable.rows.length > 0){\r\n transactionTable.deleteRow(transactionTable.rows.length-1);\r\n }\r\n budget.clearAllData();\r\n } else {\r\n // The user cancelled. Do nothing!\r\n }\r\n}", "function deleteTestRequests(){\n if (process.env.TEST_CASE_NUMBER) {\n return knex('requests').where('case_id', process.env.TEST_CASE_NUMBER)\n .del()\n }\n}", "restoreCustomer({ commit, dispatch }, data) {\n return axios\n .post(\"/customer/delete\", {...data })\n .then(response => {\n console.log(response);\n return Promise.resolve(true);\n })\n .catch(function(error) {\n console.log(error);\n return Promise.resolve(false);\n });\n }", "deleteUser(userId) {\n userId = this.esc(userId);\n return Promise.all([`DELETE FROM user WHERE userId = '${userId}'`,\n `DELETE FROM user_subscription WHERE userId = '${userId}'`,\n `DELETE FROM entity_like WHERE userId = '${userId}'`,\n `DELETE FROM entity_comment WHERE userId = '${userId}'`,\n `DELETE entity, post, photo FROM entity\n LEFT JOIN post ON post.entityId = entity.entityId\n LEFT JOIN photo ON photo.entityId = entity.entityId\n WHERE entity.userId = '${userId}'`].map(sql=>{return this.query(sql)}));\n }", "async deleteById(id) {\n\t\tif (await empCal.findByEmpId(id)) {\n\t\t\tawait empCal.deleteByEmpID(id);\n\t\t}\n\t\tif (await empCard.findByEmpId(id)) {\n\t\t\tawait empCard.deleteByEmpID(id);\n\t\t}\n\t\tlet sqlRequest = \"DELETE FROM employee WHERE id=$id\";\n\t\tlet sqlParams = {$id: id};\n\t\treturn this.common.run(sqlRequest, sqlParams);\n\t}", "function DeleteCustomer(id) {\n debugger;\n try {\n if (id) {\n var data = { \"id\": id };\n var jsonData = {};\n var message = \"\";\n var status = \"\";\n var result = \"\";\n jsonData = GetDataFromServer(\"Customer/DeleteCustomer/\", data);\n if (jsonData != '') {\n jsonData = JSON.parse(jsonData);\n message = jsonData.Message;\n status = jsonData.Status;\n result = jsonData.Record;\n }\n switch (status) {\n case \"OK\":\n notyAlert('success', result.Message);\n BindOrReloadCustomerTable('Reset');\n break;\n case \"ERROR\":\n notyAlert('error', message);\n break;\n default:\n notyAlert('error', message);\n break;\n }\n }\n }\n catch (e) {\n //this will show the error msg in the browser console(F12) \n console.log(e.message);\n }\n}", "function deleteAll(context, payload) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (payload && payload.entity) {\n context.commit('deleteAll', { entity: payload.entity });\n return [2 /*return*/];\n }\n context.commit('deleteAll');\n return [2 /*return*/];\n });\n });\n}", "function delBucketMarexRecords() {\n\tvar db = Ti.Database.open('_alloy_');\n\tvar deleteRecords = db.execute('DELETE FROM bucket_marex');\n\tTi.API.info('Affected Rows : ' + db.getRowsAffected());\n\tdb.close();\n}", "function deleteRequest(id) {\n const newRequestList = requests.filter((request) => request._id !== id)\n setRequests(newRequestList)\n }", "delete(req, res) {\n //console.log(req);\n let queryVars = req.query;\n Region.destroy({\n where: {\n id: queryVars.id\n }\n })\n .then(function (deletedRecords) {\n res.status(200).json(deletedRecords);\n })\n .catch(function (error){\n res.status(500).json(error);\n });\n }" ]
[ "0.6873459", "0.66026664", "0.65450925", "0.6539166", "0.64093316", "0.63606864", "0.6349919", "0.62439823", "0.6242813", "0.6217943", "0.62073547", "0.6166351", "0.6119943", "0.60789025", "0.602603", "0.6015245", "0.5917384", "0.58527005", "0.5841049", "0.5835707", "0.58148956", "0.5792845", "0.57870054", "0.5756596", "0.5720614", "0.5709108", "0.56687915", "0.5640411", "0.56242406", "0.5606822", "0.55973715", "0.55768704", "0.5536009", "0.5494866", "0.54911786", "0.5423722", "0.5407509", "0.5405132", "0.54007834", "0.53992635", "0.53894156", "0.53850573", "0.5354599", "0.5354344", "0.5317036", "0.5308262", "0.5305532", "0.5304355", "0.5280309", "0.5264089", "0.52473176", "0.5242523", "0.52342576", "0.5226665", "0.52142334", "0.52130485", "0.5204769", "0.52021605", "0.5191052", "0.5153853", "0.5153342", "0.5145236", "0.5132124", "0.5126244", "0.51260686", "0.5114371", "0.5109348", "0.5108707", "0.5090633", "0.5086914", "0.5083121", "0.5077368", "0.5064734", "0.5057167", "0.50559896", "0.50529975", "0.5051665", "0.50480026", "0.5037011", "0.5033102", "0.5032529", "0.50314075", "0.5030825", "0.5029032", "0.5027937", "0.5027518", "0.50216335", "0.5020607", "0.50201434", "0.5004391", "0.5004361", "0.49986616", "0.4998571", "0.49974275", "0.49957755", "0.4988195", "0.4987407", "0.49865764", "0.4983621", "0.49782634" ]
0.8589326
0
Create a new canvas to the browser size
function setup() { createCanvas(windowWidth, windowHeight); // Clear with black on setup background(0); // Make the volume quieter Tone.Master.volume.value = volume; // Setup a synth with ToneJS synth = new Tone.Synth({ oscillator: { type: "sine", }, }); // Wire up our nodes: // synth->master synth.connect(Tone.Master); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createCanvas() {\n this.canvas = document.createElement('canvas');\n this.canvas.width = this.width * this.resolution;\n this.canvas.height = this.height * this.resolution;\n this.context = this.canvas.getContext('2d');\n }", "create(width, height) {\n document.body.appendChild(this.canvas);\n this.canvas.width = width !== undefined ? width : window.innerWidth;\n this.canvas.height = height !== undefined ? height : window.innerHeight;\n this.canvas.style.border = \"1px solid black\";\n }", "function makeCanvas (width, height) {\n var canvas = document.createElement('canvas')\n canvas.width = width\n canvas.height = height\n return canvas\n}", "function setUpCanvas() {\r\n canvas = document.createElement(\"CANVAS\");\r\n canvas.id = \"canvas\";\r\n canvas.style.width = \"100%\";\r\n canvas.style.height = \"100%\";\r\n canvas.style.background = 'black';\r\n canvas.style.marginLeft = 'auto';\r\n canvas.style.marginRight = 'auto';\r\n canvas.style.display = 'block';\r\n }", "function initCanvas() {\n var canvas = document.createElement(\"canvas\");\n canvas.id = 'mycanvas';\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n document.body.appendChild(canvas);\n}", "function createCanvas(){\n var c = document.createElement('canvas');\n c.width = (width * cellsize) + ((1 + width) * padding);\n c.height = (height * cellsize) + ((1 + height) * padding);\n return c;\n }", "createCanvas(){\n this.myCanvasHolder = document.querySelector(\".myPaint\");\n this.width = this.myCanvasHolder.width = document.querySelector(\".content\").offsetWidth;\n this.height = this.myCanvasHolder.height = window.innerHeight*0.9;\n this.ctx = this.myCanvasHolder.getContext(\"2d\");\n this.ctx.width = this.width;\n this.ctx.height = this.height;\n this.isDrawing = false;\n }", "function createCanvas(w, h) {\n\tif (canvas) {\n\t\tcanvas.parentElement.removeChild(canvas);\n\t}\n\n\tcanvas = document.createElement('canvas');\n\tdocument.body.appendChild(canvas);\n\tc = canvas.getContext('2d');\n\tcanvas.width = w;\n\tcanvas.height = h;\n\twidth = w;\n\theight = h;\n}", "function createCanvas(parent) {\n var canvas = document.createElement(\"canvas\");\n canvas.style.position = \"absolute\";\n parent.insertBefore(canvas, parent.firstChild);\n\n window.addEventListener(\"resize\", resizeCanvas);\n resizeCanvas();\n\n return canvas;\n\n function resizeCanvas() {\n var rect = parent.getBoundingClientRect();\n canvas.width = rect.right - rect.left;\n canvas.height = rect.bottom - rect.top;\n }\n}", "function createCanvas(width, height)\r\n{\r\n var canvas = document.createElement('canvas');\r\n canvas.width = width;\r\n canvas.height = height;\r\n return canvas;\r\n}", "_setupCanvas () {\r\n\t\tthis.canvas = document.createElement('canvas');\r\n\t\tthis.context = this.canvas.getContext('2d');\r\n\r\n\t\tthis.canvas.width = 500;\r\n\t\tthis.canvas.height = 500;\r\n\r\n\t\tlet body = document.getElementById('body');\r\n\t\tbody.appendChild(this.canvas);\r\n\t}", "add(width, height) {\n // append the screen to the document\n document.body.appendChild(this.canvas);\n // style the canvas\n this.canvas.width = (width!==undefined)?width:window.innerWidth;\n this.canvas.height = (height!==undefined)?height:window.innerHeight;\n this.canvas.style = \"border:none\";\n }", "_createCanvas() {\n\n const canvasId = \"xeokit-canvas-\" + math.createUUID();\n const body = document.getElementsByTagName(\"body\")[0];\n const div = document.createElement('div');\n\n const style = div.style;\n style.height = \"100%\";\n style.width = \"100%\";\n style.padding = \"0\";\n style.margin = \"0\";\n style.background = \"rgba(0,0,0,0);\";\n style.float = \"left\";\n style.left = \"0\";\n style.top = \"0\";\n style.position = \"absolute\";\n style.opacity = \"1.0\";\n style[\"z-index\"] = \"-10000\";\n\n div.innerHTML += '<canvas id=\"' + canvasId + '\" style=\"width: 100%; height: 100%; float: left; margin: 0; padding: 0;\"></canvas>';\n\n body.appendChild(div);\n\n this.canvas = document.getElementById(canvasId);\n }", "function adjustCanvasSize() {\n CANVAS.width = CANVAS_WIDTH;\n CANVAS.height = window.innerHeight;\n}", "function setCanvasDimensions() {\n var canvas = document.getElementById('canvas');\n var width = window.innerWidth * 0.73408;\n var height = window.innerHeight * 0.58378;\n canvas.width = width;\n canvas.height = height;\n}", "function initPopupCanvas(width, height) {\n const canvas = document.querySelector('canvas');\n canvas.width = width * window.devicePixelRatio;\n canvas.height = height * window.devicePixelRatio;\n canvas.style.width = `${width}px`;\n canvas.style.height = `${height}px`;\n\n const ctx = canvas.getContext('2d');\n ctx.scale(window.devicePixelRatio, window.devicePixelRatio);\n return ctx;\n}", "function resizeCanvas() {\n c.width = window.innerWidth;\n c.height = window.innerHeight; \n}", "setUpCanvas(){\n var w = window.innerWidth;\n var h = window.innerHeight;\n this.$canvas = $(`<canvas id='${this.id}' width='${w}' height='${h}'></canvas`);\n this.canvas = this.$canvas[0];\n this.ctx = this.canvas.getContext('2d');\n this.$canvas = this.$canvas.css({\n position: 'absolute',\n top: 0,\n left: 0,\n });\n //console.log(document.body.clientWidth, window.innerHeight);\n }", "function resizeCanvas() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n}", "function resize() {\n ctx.canvas.width = window.outerWidth;\n ctx.canvas.height = window.outerHeight;\n}", "function createCanvas () { \n const canvas = document.createElement(\"canvas\"); \n canvas.style.position = \"absolute\"; \n canvas.style.left = \"0px\"; \n canvas.style.top = \"0px\";\n\n document.body.appendChild(canvas); // Add to document\n return canvas;\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 createCanvas() {\r\n var canvas = document.createElement('canvas');\r\n canvas.width = 0;\r\n canvas.height = 0;\r\n return canvas;\r\n }", "function initCanvas(width, height){}", "function doResize()\n{\n\tcanvas.width = window.innerWidth;\n\tcanvas.height = window.innerHeight;\n}", "function resizeCanvas()\r\n{\r\n\tvar canvas = getCanvas();\r\n\tcanvas.width = window.innerWidth;\r\n canvas.height = window.innerHeight;\r\n\t\r\n\tpaintClock();\r\n}", "function createCanvas() {\n var c = document.getElementById(\"myCanvas\");\n if (window.innerWidth < 400){\n c.width = 300;\n c.height = 300;\n }\n else{\n c.width = 370;\n c.height = 370;\n }\n canvas = c.getContext(\"2d\");\n canvas.lineWidth = 6;\n return [c, canvas]\n}", "function onResize() {\n var canvas = document.getElementById('canvas');\n canvas.width = document.body.offsetWidth;\n canvas.height = document.body.offsetHeight;\n}", "_initCanvas (canvas) {\n if (canvas) {\n this.canvas = canvas\n this.width = canvas.width\n this.height = canvas.height\n } else {\n this.canvas = document.createElement('canvas')\n this.canvas.width = this.width\n this.canvas.height = this.height\n this.canvas.style.width = '100%'\n this.canvas.style.height = '100%'\n this.canvas.style.imageRendering = 'pixelated'\n document.body.appendChild(this.canvas)\n }\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 canvas_resize()\n{\n canvas.style.width = window.innerWidth + 'px';\n canvas.style.height = window.innerHeight + 'px';\n}", "function makeCanvas() {\n console.log('making a canvas');\n var newCanvas = $('<canvas></canvas>')\n .attr('id', 'drawingCanvas');\n\n $('.drawing-container').append(newCanvas);\n\n _fabricCanvas = new fabric.Canvas('drawingCanvas', {\n isDrawingMode: true\n });\n\n _fabricCanvas.setHeight(2000);\n _fabricCanvas.setWidth(2000);\n _fabricCanvas.freeDrawingBrush.width = _brushSize;\n\n\n return _fabricCanvas;\n }", "function createCanvas(x, y, width, height) {\n // Create <canvas>\n var canvas;\n if (typeof G_vmlCanvasManager != 'undefined') {\n canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n $('#canvas').appendChild(canvas);\n canvas = G_vmlCanvasManager.initElement(canvas);\n }\n else {\n canvas = $('<canvas width=\"'+ width +'\" height=\"'+ height +'\"></canvas>');\n $('#canvas').append(canvas);\n canvas = canvas[0];\n }\n return canvas;\n}", "createCanvas(){\n let canvas = document.createElement(\"canvas\");\n canvas.width = this.cellWidth * this.width;\n canvas.height = this.cellHeight * this.height;\n document.querySelector(\"#main\").appendChild(canvas);\n return canvas;\n }", "createCanvas () {\n this.canvas = document.createElement(\"canvas\");\n this.canvas.width = GAME_WIDTH;\n this.canvas.height = GAME_HEIGHT;\n this.canvas.id = \"canvas\";\n document.querySelector(\"body\").appendChild(this.canvas);\n this.drawingContext = this.canvas.getContext('2d'); \n }", "function createCanvas () { \n const canvas = document.createElement(\"canvas\"); \n canvas.style.position = \"absolute\"; \n canvas.style.left = \"0px\"; \n canvas.style.top = \"0px\";\n // canvas.style.zIndex = 1; \n document.body.appendChild(canvas); // Add to document\n return canvas;\n}", "function resize() {\n context.width = canvas.width = window.innerWidth;\n context.height = canvas.height = window.innerHeight;\n}", "function resize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n}", "function resize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n}", "function setupCanvas(canvasSelector, width = window.innerWidth, height = 250) {\n\tconst canvas = document.querySelector(canvasSelector);\n\tconst ctx = canvas.getContext('2d');\n\t\n\tcanvas.width = canvasWidth = width;\n\tcanvas.height =\tcanvasHeight = height;\n\n\treturn ctx;\n}", "function resize() {\r\n ctx.canvas.width = window.innerWidth;\r\n ctx.canvas.height = window.innerHeight;\r\n}", "function createCanvas(width, height) {\n var canvasWidth = width,\n canvasHeight = height,\n element, context, devicePixelRatio;\n \n // When there is a high-def (retina) display,\n // we'll size our canvas larger, and draw with a scaled transform.\n // This means that we draw in high def coords - the graphics system\n // will just blast those high-def pixes to the screen. This gives\n // more detail / better anti-aliasing.\n \n devicePixelRatio = window.devicePixelRatio;\n if (devicePixelRatio) {\n canvasWidth *= devicePixelRatio;\n canvasHeight *= devicePixelRatio;\n }\n \n element = $(\"<canvas width=\" + canvasWidth + \" height=\"\n + canvasHeight + \"></canvas>\");\n \n context = element[0].getContext && element[0].getContext('2d');\n \n if( !context) {\n return null;\n }\n \n // Line dash polyfill. Just a no-op where not supported.\n // cf. http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas/#dash-list\n if( !context.setLineDash) {\n context.setLineDash = function(segments) {\n };\n context.getLineDash = function() {\n return( [ ]);\n };\n }\n \n if (devicePixelRatio) {\n context.scale(devicePixelRatio, devicePixelRatio);\n }\n \n return {\n 'canvas': element,\n 'context': context,\n 'width': canvasWidth,\n 'height': canvasHeight\n };\n }", "function resize() {\n canvas.height = window.innerHeight\n canvas.width = window.innerWidth\n }", "function createCanvas()\n{\n\tcanvas = document.createElement('canvas');\n\tcanvas.classList.add(\"heatmap\");\n\tcanvas.id = \"heatmap\";\n\tdocument.body.appendChild(canvas);\n\tcanvas.width = 500;\n\tcanvas.height = 500;\n}", "resize () {\n document.body.style.overflow = 'hidden'\n\n const maxMulti = 20\n // overflow pixels\n const padding = 1\n const w = 320\n const h = 180\n const availW = window.innerWidth\n const availH = window.innerHeight\n // - 20 for padding\n const maxW = Math.floor(availW / (w - padding))\n const maxH = Math.floor(availH / (h - padding))\n let multi = maxW < maxH ? maxW : maxH\n\n if (multi > maxMulti) multi = maxMulti\n\n const canvas = document.getElementsByTagName('canvas')[0]\n canvas.style.width = `${multi * w}px`\n canvas.style.height = `${multi * h}px`\n }", "function setSize(){\n\n\tvar winW = 600, winH = 400;\n\tif (document.body && document.body.offsetWidth) {\n\t winW = document.body.offsetWidth;\n\t winH = document.body.offsetHeight;\n\t}\n\tif (document.compatMode=='CSS1Compat' &&\n\t\tdocument.documentElement &&\n\t\tdocument.documentElement.offsetWidth ) {\n\t winW = document.documentElement.offsetWidth;\n\t winH = document.documentElement.offsetHeight;\n\t}\n\tif (window.innerWidth && window.innerHeight) {\n\t winW = window.innerWidth;\n\t winH = window.innerHeight;\n\t}\n\t\n\tvar canvas = document.getElementById(\"canvas\");\n\t\tcanvas.height = (winH - 25);\n\t\tcanvas.width = (winW - 5);\n\t\tconstants.MAX_X = winW - 5;\n\t\tconstants.MAX_Y = winH - 25;\n\t\n}", "function resizeCanvas() {\n\tcanvas.width = window.innerWidth * pixelRatio;\n\tcanvas.height = window.innerHeight * pixelRatio;\n\t//Necessary on devices with pixelRatio above 1\n\tcanvas.style.width = window.innerWidth + \"px\";\n\tcanvas.style.height = window.innerHeight + \"px\";\n}", "function constructCanvas(){\n\t\t\tcanvasWidth = target.getWidth();\n\t\t\tcanvasHeight = target.getHeight();\n\t\t\ttarget.innerHTML = '';\n\t\t\t\n\t\t\t/**\n\t\t\t * For positioning labels and overlay.\n\t\t\t */\n\t\t\ttarget.setStyle({'position': 'relative'});\n\t\t\t\n\t\t\tif(canvasWidth <= 0 || canvasHeight <= 0){\n\t\t\t\tthrow 'Invalid dimensions for plot, width = ' + canvasWidth + ', height = ' + canvasHeight;\n\t\t\t}\n\t\n\t\t\t/**\n\t\t\t * Insert main canvas.\n\t\t\t */\n\t\t\tcanvas = $(document.createElement('canvas')).writeAttribute({\n\t\t\t\t'width': canvasWidth,\n\t\t\t\t'height': canvasHeight\t\n\t\t\t});\n\t\t\ttarget.appendChild(canvas);\n\t\t\tif(Prototype.Browser.IE){\n\t\t\t\tcanvas = $(window.G_vmlCanvasManager.initElement(canvas));\n\t\t\t} \n\t\t\tctx = canvas.getContext('2d');\n\t\n\t\t\t/**\n\t\t\t * Insert overlay canvas for interactive features.\n\t\t\t */\n\t\t\toverlay = $(document.createElement('canvas')).writeAttribute({\n\t\t\t\t'width': canvasWidth,\n\t\t\t\t'height': canvasHeight\n\t\t\t}).setStyle({\n\t\t\t\t'position': 'absolute',\n\t\t\t\t'left': '0px',\n\t\t\t\t'top': '0px'\n\t\t\t});\n\t\t\ttarget.setStyle({cursor:'default'}).appendChild(overlay);\n\t\t\tif(Prototype.Browser.IE){\n\t\t\t\toverlay = $(window.G_vmlCanvasManager.initElement(overlay));\n\t\t\t}\t\t\t\n\t\t\toctx = overlay.getContext('2d');\n\t\t}", "function createCanvas (element, onDone, pixelRatio) {\n\t var canvas = document.createElement('canvas');\n\t extend(canvas.style, {\n\t border: 0,\n\t margin: 0,\n\t padding: 0,\n\t top: 0,\n\t left: 0\n\t });\n\t element.appendChild(canvas);\n\t\n\t if (element === document.body) {\n\t canvas.style.position = 'absolute';\n\t extend(element.style, {\n\t margin: 0,\n\t padding: 0\n\t });\n\t }\n\t\n\t function resize () {\n\t var w = window.innerWidth;\n\t var h = window.innerHeight;\n\t if (element !== document.body) {\n\t var bounds = element.getBoundingClientRect();\n\t w = bounds.right - bounds.left;\n\t h = bounds.bottom - bounds.top;\n\t }\n\t canvas.width = pixelRatio * w;\n\t canvas.height = pixelRatio * h;\n\t extend(canvas.style, {\n\t width: w + 'px',\n\t height: h + 'px'\n\t });\n\t }\n\t\n\t window.addEventListener('resize', resize, false);\n\t\n\t function onDestroy () {\n\t window.removeEventListener('resize', resize);\n\t element.removeChild(canvas);\n\t }\n\t\n\t resize();\n\t\n\t return {\n\t canvas: canvas,\n\t onDestroy: onDestroy\n\t }\n\t}", "createTempCanvas(){\n this.tempCanvasHolder = document.createElement(\"canvas\");\n this.tempCanvasHolder.classList.add(\"tempPaint\");\n document.body.append(this.tempCanvasHolder); // adds the canvas to the body element\n this.blockHolder.append(this.tempCanvasHolder); // adds the canvas to #someBox\n this.tempCanvasHolder.style.display = \"block\";\n this.tempCanvasHolder.style.position = \"absolute\";\n this.tempctx = this.tempCanvasHolder.getContext(\"2d\"); \n this.width = this.tempCanvasHolder.width = document.querySelector(\".content\").offsetWidth;\n this.height = this.tempCanvasHolder.height = window.innerHeight*0.9;\n \n }", "function resizeCanvas() {\n\t\tcanvas.width = (window.innerWidth) * .67;\n\t\tcanvas.height = (window.innerHeight) * .69;\n\t\tredraw();\n\t}", "function resizeCanvas() {\n\t\tcanvas.width = (window.innerWidth) - 150;\n\t\tcanvas.height = (window.innerHeight) - 100;\n\t\tredraw();\n\t}", "function createCanvas (element, onDone, pixelRatio) {\n var canvas = document.createElement('canvas');\n extend(canvas.style, {\n border: 0,\n margin: 0,\n padding: 0,\n top: 0,\n left: 0\n });\n element.appendChild(canvas);\n\n if (element === document.body) {\n canvas.style.position = 'absolute';\n extend(element.style, {\n margin: 0,\n padding: 0\n });\n }\n\n function resize () {\n var w = window.innerWidth;\n var h = window.innerHeight;\n if (element !== document.body) {\n var bounds = element.getBoundingClientRect();\n w = bounds.right - bounds.left;\n h = bounds.bottom - bounds.top;\n }\n canvas.width = pixelRatio * w;\n canvas.height = pixelRatio * h;\n extend(canvas.style, {\n width: w + 'px',\n height: h + 'px'\n });\n }\n\n window.addEventListener('resize', resize, false);\n\n function onDestroy () {\n window.removeEventListener('resize', resize);\n element.removeChild(canvas);\n }\n\n resize();\n\n return {\n canvas: canvas,\n onDestroy: onDestroy\n }\n}", "function createCanvas (element, onDone, pixelRatio) {\n var canvas = document.createElement('canvas');\n extend(canvas.style, {\n border: 0,\n margin: 0,\n padding: 0,\n top: 0,\n left: 0\n });\n element.appendChild(canvas);\n\n if (element === document.body) {\n canvas.style.position = 'absolute';\n extend(element.style, {\n margin: 0,\n padding: 0\n });\n }\n\n function resize () {\n var w = window.innerWidth;\n var h = window.innerHeight;\n if (element !== document.body) {\n var bounds = element.getBoundingClientRect();\n w = bounds.right - bounds.left;\n h = bounds.bottom - bounds.top;\n }\n canvas.width = pixelRatio * w;\n canvas.height = pixelRatio * h;\n extend(canvas.style, {\n width: w + 'px',\n height: h + 'px'\n });\n }\n\n window.addEventListener('resize', resize, false);\n\n function onDestroy () {\n window.removeEventListener('resize', resize);\n element.removeChild(canvas);\n }\n\n resize();\n\n return {\n canvas: canvas,\n onDestroy: onDestroy\n }\n}", "function createCanvas (element, onDone, pixelRatio) {\n var canvas = document.createElement('canvas');\n extend(canvas.style, {\n border: 0,\n margin: 0,\n padding: 0,\n top: 0,\n left: 0\n });\n element.appendChild(canvas);\n\n if (element === document.body) {\n canvas.style.position = 'absolute';\n extend(element.style, {\n margin: 0,\n padding: 0\n });\n }\n\n function resize () {\n var w = window.innerWidth;\n var h = window.innerHeight;\n if (element !== document.body) {\n var bounds = element.getBoundingClientRect();\n w = bounds.right - bounds.left;\n h = bounds.bottom - bounds.top;\n }\n canvas.width = pixelRatio * w;\n canvas.height = pixelRatio * h;\n extend(canvas.style, {\n width: w + 'px',\n height: h + 'px'\n });\n }\n\n window.addEventListener('resize', resize, false);\n\n function onDestroy () {\n window.removeEventListener('resize', resize);\n element.removeChild(canvas);\n }\n\n resize();\n\n return {\n canvas: canvas,\n onDestroy: onDestroy\n }\n}", "function createCanvas (element, onDone, pixelRatio) {\n var canvas = document.createElement('canvas');\n extend(canvas.style, {\n border: 0,\n margin: 0,\n padding: 0,\n top: 0,\n left: 0\n });\n element.appendChild(canvas);\n\n if (element === document.body) {\n canvas.style.position = 'absolute';\n extend(element.style, {\n margin: 0,\n padding: 0\n });\n }\n\n function resize () {\n var w = window.innerWidth;\n var h = window.innerHeight;\n if (element !== document.body) {\n var bounds = element.getBoundingClientRect();\n w = bounds.right - bounds.left;\n h = bounds.bottom - bounds.top;\n }\n canvas.width = pixelRatio * w;\n canvas.height = pixelRatio * h;\n extend(canvas.style, {\n width: w + 'px',\n height: h + 'px'\n });\n }\n\n window.addEventListener('resize', resize, false);\n\n function onDestroy () {\n window.removeEventListener('resize', resize);\n element.removeChild(canvas);\n }\n\n resize();\n\n return {\n canvas: canvas,\n onDestroy: onDestroy\n }\n}", "function createCanvas (element, onDone, pixelRatio) {\n var canvas = document.createElement('canvas');\n extend(canvas.style, {\n border: 0,\n margin: 0,\n padding: 0,\n top: 0,\n left: 0\n });\n element.appendChild(canvas);\n\n if (element === document.body) {\n canvas.style.position = 'absolute';\n extend(element.style, {\n margin: 0,\n padding: 0\n });\n }\n\n function resize () {\n var w = window.innerWidth;\n var h = window.innerHeight;\n if (element !== document.body) {\n var bounds = element.getBoundingClientRect();\n w = bounds.right - bounds.left;\n h = bounds.bottom - bounds.top;\n }\n canvas.width = pixelRatio * w;\n canvas.height = pixelRatio * h;\n extend(canvas.style, {\n width: w + 'px',\n height: h + 'px'\n });\n }\n\n window.addEventListener('resize', resize, false);\n\n function onDestroy () {\n window.removeEventListener('resize', resize);\n element.removeChild(canvas);\n }\n\n resize();\n\n return {\n canvas: canvas,\n onDestroy: onDestroy\n }\n}", "function createCanvas (element, onDone, pixelRatio) {\n var canvas = document.createElement('canvas');\n extend(canvas.style, {\n border: 0,\n margin: 0,\n padding: 0,\n top: 0,\n left: 0\n });\n element.appendChild(canvas);\n\n if (element === document.body) {\n canvas.style.position = 'absolute';\n extend(element.style, {\n margin: 0,\n padding: 0\n });\n }\n\n function resize () {\n var w = window.innerWidth;\n var h = window.innerHeight;\n if (element !== document.body) {\n var bounds = element.getBoundingClientRect();\n w = bounds.right - bounds.left;\n h = bounds.bottom - bounds.top;\n }\n canvas.width = pixelRatio * w;\n canvas.height = pixelRatio * h;\n extend(canvas.style, {\n width: w + 'px',\n height: h + 'px'\n });\n }\n\n window.addEventListener('resize', resize, false);\n\n function onDestroy () {\n window.removeEventListener('resize', resize);\n element.removeChild(canvas);\n }\n\n resize();\n\n return {\n canvas: canvas,\n onDestroy: onDestroy\n }\n}", "function createCanvas (element, onDone, pixelRatio) {\n var canvas = document.createElement('canvas');\n extend(canvas.style, {\n border: 0,\n margin: 0,\n padding: 0,\n top: 0,\n left: 0\n });\n element.appendChild(canvas);\n\n if (element === document.body) {\n canvas.style.position = 'absolute';\n extend(element.style, {\n margin: 0,\n padding: 0\n });\n }\n\n function resize () {\n var w = window.innerWidth;\n var h = window.innerHeight;\n if (element !== document.body) {\n var bounds = element.getBoundingClientRect();\n w = bounds.right - bounds.left;\n h = bounds.bottom - bounds.top;\n }\n canvas.width = pixelRatio * w;\n canvas.height = pixelRatio * h;\n extend(canvas.style, {\n width: w + 'px',\n height: h + 'px'\n });\n }\n\n window.addEventListener('resize', resize, false);\n\n function onDestroy () {\n window.removeEventListener('resize', resize);\n element.removeChild(canvas);\n }\n\n resize();\n\n return {\n canvas: canvas,\n onDestroy: onDestroy\n }\n}", "function resizeCanvas() {\n \t\t\t\thtmlCanvas.width = window.innerWidth;\n \t\t\t\thtmlCanvas.height = window.innerHeight;\n \t\t\t\tredraw();\n \t\t\t}", "function fixCanvas(){\n CANVAS.width=400\n CANVAS.height=225\n CANVAS.style.width = \"400px\"\n CANVAS.style.height = \"225px\"\n}", "init() {\n const canvas = document.createElement('canvas');\n\n canvas.style.display = 'none';\n canvas.style.position = 'fixed';\n canvas.style.top = '0px';\n canvas.style.left = '0px';\n canvas.style.zIndex = '1000000';\n this.canvas = canvas;\n\n this.context = canvas.getContext('2d');\n\n document.body.appendChild(canvas);\n\n window.addEventListener('resize', (event) => this.resize());\n\n // UI events\n window.addEventListener('mousemove', (event) => this.mouseMove(event));\n window.addEventListener('mouseup', (event) => this.mouseUp(event));\n window.addEventListener('mousedown', (event) => this.mouseDown(event));\n window.addEventListener('keydown', (event) => this.keyDown(event));\n\n this.resize();\n }", "function createTemporaryCanvas(size) {\n let canvas = document.createElement('canvas');\n canvas.width = size;\n canvas.height = size;\n return canvas;\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}", "init() {\n const wrapper = document.getElementById('canvasWrapper');\n let newCanvas;\n if (!document.querySelector('canvas')) {\n newCanvas = document.createElement('canvas');\n newCanvas.width = this.width;\n newCanvas.height = this.height;\n newCanvas.setAttribute('id', 'canvas');\n this.context = newCanvas.getContext('2d');\n wrapper.appendChild(newCanvas);\n } else {\n newCanvas = document.getElementById('canvas');\n newCanvas.width = this.width;\n newCanvas.height = this.height;\n this.context = newCanvas.getContext('2d');\n }\n this.style(wrapper);\n }", "function addMozDebugCanvas( size ) {\n var width = size,\n height = size;\n\n var canvas = document.createElement( 'canvas' );\n\n canvas.id = 'texture';\n canvas.classList.add( 'moz-canvas' );\n\n canvas.width = width;\n canvas.height = height;\n canvas.style.display = 'none';\n canvas.style.position = 'absolute';\n\n document.body.appendChild( canvas );\n\n return canvas;\n }", "function resize() {\n\tvar height = window.innerHeight;\n\n\tvar ratio = canvas.width/canvas.height;\n\tvar width = height * ratio;\n\n\tcanvas.style.width = width+'px';\n\tcanvas.style.height = height+'px';\n}", "function setSize() {\n canvas.width = iOS ? screen.width : window.innerWidth;\n canvas.height = iOS ? screen.height : window.innerHeight;\n}", "onAdd () {\n var canvas = document.createElement('canvas')\n canvas.width = this._size\n canvas.height = this._size\n this.context = canvas.getContext('2d')\n }", "function createCanvas(settings) {\n var $canvas = jq('<canvas/>').attr('width', settings.size).attr('height', settings.size);\n return drawOnCanvas($canvas, settings);\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 resizeCanvas() {\n context.canvas.width = window.innerWidth;\n context.canvas.height = window.innerHeight;\n game.size = {width: context.canvas.width, height: context.canvas.height};\n}", "function getTestCanvas() {\n\n var testCanvas\n\n if (isBrowser) {\n testCanvas = document.createElement('canvas')\n testCanvas.width = testCanvas.height = 1\n } else\n testCanvas = canvas\n\n return testCanvas\n }", "function createCanvas()\r\n{\r\n canvas.width=600;\r\n canvas.height=300;\r\n context.fillStyle=CurrentBucketColor;\r\n context.fillRect(0,0,canvas.width,canvas.height);\r\n document.body.appendChild(canvas);\r\n switchtoBrush();\r\n}", "function resizeCanvas() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n\n redrawCanvas();\n }", "function loadCanvas(width,height) {\n $('body').prepend('<canvas class=canvas>');\n // create context\n var canvas = document.querySelector('.canvas');\n var ctx = canvas.getContext('2d');\n // set dimensions\n canvas.width = width;\n canvas.height = height;\n // draw border\n ctx.strokeRect(0,0,width,height);\n return [canvas,ctx];\n }", "function initialiseBigCanvas() {\n var canvas = document.getElementById('big_canvas_canvas');\n fixedWidth = canvas.offsetWidth;\n fixedHeight = canvas.offsetHeight;\n createBigCanvas(fixedWidth, fixedHeight);\n registerTouchEvents(_big_canvas_stage);\n}", "createCanvas() {\n const canvas = document.createElement('canvas'),\n heroCanvas = document.createElement('canvas')\n \n heroCanvas.width = this.width\n heroCanvas.height = this.height\n canvas.width = this.width\n canvas.height = this.height\n this.cxt = canvas.getContext('2d')\n this.heroCxt = heroCanvas.getContext('2d')\n this.container.appendChild(canvas) \n this.container.appendChild(heroCanvas)\n this.heroCanvas = heroCanvas\n }", "_createNewCanvas(){\n\n let canvas = document.createElement('canvas');\n this.game.container.appendChild(canvas);\n canvas.width = this.game.width;\n canvas.height = this.game.height;\n canvas.style.position = 'absolute';\n canvas.style.zIndex = 0;\n\n\n console.log('Width, height', this.width, this.height);\n\n return canvas.getContext('2d');\n\n }", "function fixCanvas() {\n var con = $(window),\n aspect = (0.9 / 1.6),\n width = con.innerWidth(),\n height = Math.floor(width * aspect);\n\n canvas.setWidth(1920).setHeight(1080);\n $(\"#c\").css(\"width\", width + \"px\").css(\"height\", height + \"px\");\n canvas.calcOffset();\n}", "function resizeCanvas(){\n\tif (canvas.width < window.innerWidth){\n\t\tcanvas.width = window.innerWidth-15;\n\t}\n\tif (canvas.height < window.innerHeight){\n\t\tcanvas.height = window.innerHeight;\n\t}\n}", "function setCanvasDimensions() {\n // On small screens (e.g. phones), we want to \"zoom out\" so players can still see at least\n // 800 in-game units of width.\n const scaleRatio = Math.max(1, 800 / window.innerWidth)\n canvas.width = scaleRatio * window.innerWidth\n canvas.height = scaleRatio * window.innerHeight\n}", "function onResize() {\n var canvas = document.getElementById('canvas');\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n}", "function resize() {\n width = canvas.width = window.innerWidth;\n height = canvas.height = window.innerHeight - 60;\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 }", "function canvasElements() {\r\n\tcanvas = document.getElementById(\"Canvas\")\r\n\tcanvas.width = 630;\r\n canvas.height = 420;\r\n\tcanvaswidth = canvas.width\r\n\tcanvasheight = canvas.height\r\n\tctrl = canvas.getContext(\"2d\")\r\n}", "static canvas()\n {\n let canvas = document.getElementById('gl-canvas');\n\n canvas.width = 1000;\n canvas.height = 800;\n\n return canvas;\n }", "constructor(width, height, devicePixelRatio) {\n this.width = width\n this.height = height\n this.devicePixelRatio = devicePixelRatio\n this.canvas = document.createElement('canvas')\n this.canvas.width = this.width * this.devicePixelRatio\n this.canvas.height = this.height * this.devicePixelRatio\n this.ctx = this.canvas.getContext('2d')\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 createHiDPICanvas(w, h, ratio) {\n PIXEL_RATIO = calculatePixelRatio();\n\tif(PIXEL_RATIO > 1.5){\n PIXEL_RATIO *= 0.8;}\n if (!ratio) { ratio = PIXEL_RATIO; }\n var can = document.createElement(\"canvas\");\n can.width = w * ratio;\n can.height = h * ratio;\n can.style.width = w + \"px\";\n can.style.height = h + \"px\";\n can.getContext(\"2d\").setTransform(ratio, 0, 0, ratio, 0, 0);\n return can;\n}", "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 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}", "function onResize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\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 }", "function loadCanvas(w, h) {\n canvas = createCanvas(w, h);\n canvas.position(0,0);\n}", "function borraCanvas(){\n\tcanvas.width = 500;\n\tcanvas.height = 400;\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 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 borraCanvas(){\n \n canvas.width=500\n canvas.height=500\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}" ]
[ "0.77052224", "0.7663082", "0.7487349", "0.7481034", "0.74640995", "0.7317779", "0.7315109", "0.72425556", "0.7183717", "0.71820194", "0.7173591", "0.71403533", "0.7131482", "0.7090071", "0.7030521", "0.701344", "0.70129985", "0.69937015", "0.6988763", "0.6976152", "0.69517475", "0.6942391", "0.6934915", "0.6924716", "0.69227296", "0.68946415", "0.68918777", "0.688415", "0.68750346", "0.68604994", "0.6848291", "0.68474233", "0.6837953", "0.683787", "0.68340486", "0.68188477", "0.6814602", "0.6806847", "0.6806847", "0.6806057", "0.6797256", "0.67837065", "0.6775227", "0.6761572", "0.6757505", "0.6736734", "0.67349774", "0.67332447", "0.6720932", "0.6716563", "0.6710057", "0.6694911", "0.6677517", "0.6677517", "0.6677517", "0.6677517", "0.6677517", "0.6677517", "0.6677517", "0.6673468", "0.66726583", "0.66708976", "0.6661379", "0.66611576", "0.66509104", "0.6648892", "0.664504", "0.663535", "0.663331", "0.66302866", "0.66194797", "0.6617978", "0.66175497", "0.66149247", "0.66128695", "0.6601462", "0.6594213", "0.659121", "0.6584296", "0.6582577", "0.65812343", "0.6572947", "0.6561436", "0.65509975", "0.6550133", "0.65461296", "0.65292954", "0.6528705", "0.6528066", "0.6524358", "0.6524326", "0.6520163", "0.65177816", "0.65086067", "0.6492829", "0.6487888", "0.6473747", "0.6473747", "0.64718634", "0.6464804", "0.6450438" ]
0.0
-1
On window resize, update the canvas size
function windowResized() { resizeCanvas(windowWidth, windowHeight); // Clear with black on resize background(0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function windowResized() {\n resizeCanvas(canvasX, canvasY);\n}", "function windowResized() {\n resizeCanvas(canvasWidth, canvasHeight);\n}", "function windowResized() {\n resizeCanvas(width, height);\n}", "function windowResized() {\n resizeCanvas(innerWidth, innerHeight);\n}", "function windowResized() {\r\n resizeCanvas(windowWidth, windowHeight);\r\n}", "function windowResized() {\r\n resizeCanvas(windowWidth, windowHeight);\r\n}", "function windowResized() {\r\n resizeCanvas(windowWidth, windowHeight)\r\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight)\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight)\n}", "function windowResized() {\n\tresizeCanvas(innerWidth, innerHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight - 50);\n}", "function windowResized () {\n resizeCanvas(windowWidth, windowHeight);\n}", "resize() {\n if (this._isShutDown) return;\n this._canvas.width = window.innerWidth;\n this._canvas.height = window.innerHeight;\n this.redraw();\n }", "function windowResized() {\n resizeCanvas(canvasContainer.clientWidth, canvasContainer.clientHeight);\n}", "function windowResized(){\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized(){\n resizeCanvas(windowWidth, windowHeight);\n}", "canvasResize()\n {\n View.canvas.setAttribute(\"width\", this.floatToInt(window.innerWidth*0.95));\n View.canvas.setAttribute(\"height\",this.floatToInt(window.innerHeight*0.95));\n\n //update objects with the new size\n this.updateCharacterDim();\n this.updateVirusDim();\n this.updateSyringesDim();\n this.background.resize();\n\n }", "function windowResized(){\n canvas.resize(windowWidth, windowHeight - canvasadjust);\n}", "function resize() {\n canvas.height = window.innerHeight\n canvas.width = window.innerWidth\n }", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n}//end windowResized", "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}", "function onResize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n width = canvas.width;\n height = canvas.height;\n }", "function windowResized() {\n\tresizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n\tresizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n draw();\n}", "function windowResized() {\n console.log('resized');\n resizeCanvas(windowWidth, windowHeight);\n}", "function windowResized() {\r\n resizeCanvas(windowWidth, windowHeight, false);\r\n}", "function windowResized () {\n\tresizeCanvas(windowWidth, windowHeight);\n }", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight, false);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight, false);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight, false);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight, false);\n}", "function resizeCanvas() {\n\t\tcanvas.width = (window.innerWidth) * .67;\n\t\tcanvas.height = (window.innerHeight) * .69;\n\t\tredraw();\n\t}", "onResize() {\n this._canvas.width = window.innerWidth;\n this._canvas.height = window.innerHeight;\n this._ps.screenSize(this._canvas.width, this._canvas.height)\n }", "function onResize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n }", "function onResize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n }", "function onResize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n }", "function onResize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n }", "function onResize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n }", "function windowResized() {\n\twindowW = window.innerWidth;\n\twindowH = window.innerHeight;\n resizeCanvas(window.innerWidth, window.innerHeight);\n}", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight, false);\n init();\n}", "function windowResized () {\n resizeCanvas(windowWidth, windowHeight);\n resize=1;\n}", "function onResize() {\n canvas.width = window.innerWidth * 0.75;\n canvas.height = window.innerHeight;\n }", "function onResize() {\n canvas.width = window.innerWidth / 2;\n canvas.height = window.innerHeight;\n }", "function resizeCanvas() {\n\t\tcanvas.width = (window.innerWidth) - 150;\n\t\tcanvas.height = (window.innerHeight) - 100;\n\t\tredraw();\n\t}", "function resize() {\n width = canvas.width = window.innerWidth;\n height = canvas.height = window.innerHeight - 60;\n }", "function windowResized() {\n resizeCanvas(windowWidth, windowHeight);\n scaleMaximums();\n}", "function onWindowResize() {\n updateSizes();\n }", "function windowResized() {\r\n // While setting the canvas width/height, the drawing is cleared\r\n canvas.width = canvas.offsetWidth;\r\n canvas.height = canvas.offsetHeight;\r\n\r\n // We manually trigger a color change because the fill/stroke color is cleared too\r\n colorChanged();\r\n }", "function windowResized() {\r\n resizeCanvas(windowWidth, windowHeight, false);\r\n setupArray();\r\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}", "windowResized(width, height) {\n this.canvas.width = width;\n this.canvas.height = height;\n this.removeDotsOutside();\n }", "function windowResized() {\n\tlet w = window.innerWidth / 2;\n\tlet h = window.innerWidth / 2 / 475 * 600;\n\tresizeCanvas(w, h);\n\tcnv.position(window.innerWidth / 2, 0, \"absolute\");\n\t// reposition all shapes back in initial position relative to canvas\n\tinit_shapes();\n}", "function onResize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n}", "function windowResized() {\n // We can use the resizeCanvas() function to resize our canvas to the new window dimensions\n resizeCanvas(windowWidth,windowHeight);\n}", "function windowResized() {\n repositionCanvas();\n}", "function windowResized() {\n\n getWrapperWidth();\n resizeCanvas(wrapperWide, wrapperWide);\n\n widthVar = (width - 40) / 100;\n drawArea = (width - 40);\n\n switchBox();\n}", "function resizeCanvas() {\n //low level\n c.width = window.innerWidth;\n c.height = window.innerHeight;\n //update wrapper\n st.canvas.width = c.width;\n st.canvas.height = c.height;\n //update objects and redraw\n updateObjects();\n}", "function resizeCanvas() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n\n redrawCanvas();\n }", "function resize() {\n ctx.canvas.width = window.outerWidth;\n ctx.canvas.height = window.outerHeight;\n}", "function windowResized() {\n centerCanvas();\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 resize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n}", "function resize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n}" ]
[ "0.84558463", "0.8454732", "0.84449136", "0.84412926", "0.84224933", "0.84224933", "0.8406103", "0.83992654", "0.83992654", "0.83965033", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.83735055", "0.83735055", "0.83735055", "0.83735055", "0.83735055", "0.83735055", "0.83735055", "0.83735055", "0.83735055", "0.83735055", "0.83593374", "0.83580595", "0.83302575", "0.83190554", "0.8316165", "0.8316165", "0.82989943", "0.8296519", "0.8286599", "0.8286023", "0.8266881", "0.8239774", "0.823972", "0.823972", "0.82389736", "0.82336175", "0.8230498", "0.8219027", "0.8196801", "0.8196801", "0.8196801", "0.8196801", "0.8177889", "0.8172403", "0.81692547", "0.81692547", "0.81692547", "0.81692547", "0.81688565", "0.81595236", "0.81519324", "0.8142378", "0.8134469", "0.8123948", "0.81116277", "0.81057996", "0.81036305", "0.80781215", "0.80776566", "0.80676", "0.8047565", "0.8038956", "0.80262625", "0.8025655", "0.80055237", "0.7995735", "0.79932445", "0.79858965", "0.7981528", "0.7972575", "0.79663086", "0.7962144", "0.7962101", "0.7962101" ]
0.0
-1
Render loop that draws shapes with p5
function draw() { const dim = Math.min(width, height); // Instead of drawing black, we draw with // transparent black to give a 'ghosting' effect const opacity = 0.085; background(0, 0, 0, opacity * 255); // If we have a mouse position, draw it if (mouse) { noFill(); stroke(255); strokeWeight(dim * 0.01); circle(mouse[0], mouse[1], dim * 0.2); // Clear position so we stop drawing it, // this will make it fade away mouse = null; } // Draw a 'play' button noStroke(); fill(255); polygon(width / 2, height / 2, dim * 0.1, 3); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n\n stroke(this.layerColor)\n strokeWeight(this.randomWeight)\n noFill()\n push()\n translate(width / 2, height / 2)\n for (let i = 0; i <= this.numShapes; i++) {\n ellipse(this.position, 0, this.shapeSize, this.shapeSize)\n rotate(this.angle)\n }\n pop()\n\n }", "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 }", "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 }", "render() {\n stroke(this.layerColor)\n fill(this.layerColor)\n strokeWeight(this.weight)\n\n push()\n translate(width / 2, height / 2)\n let pick = random(1)\n for (let i = 0; i < this.numShapes; i++) {\n if (pick < 0.5) {\n myTriangle(this.center, this.radius, this.direction)\n } else {\n ellipse(0, this.center, this.radius, this.radius)\n }\n rotate(this.angle)\n }\n pop()\n }", "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 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 setup() {\n createCanvas(windowWidth, windowHeight, WEBGL);\n // Create object\n\n for(var i=0; i < 30; i++){ //loop 5 times\n //put an object in the array for each loop\n // var d=random(100,200);\n // pulse[i] = new Pulser(width/2, height/2, d,d); \n // spirits = new ghost();\n spirits[i] = new ghost();\n }\n\n colorMode(HSB, 360, 100, 100);\n}", "render() {\n fill(this.layerColor)\n noStroke()\n push()\n translate(width / 2, height / 2)\n if (this.randomShape < 0.33) {\n rotate(45)\n rect(0, 0, this.shapeSize * 2, this.shapeSize * 2)\n } else if (this.randomShape < 0.66) {\n ellipse(0, 0, this.shapeSize * 2, this.shapeSize * 2)\n } else {\n rotate(this.angle / 2)\n hexagon(0, 0, this.shapeSize)\n }\n pop()\n }", "display() {\n push();\n fill(255, 255, 0);\n let angle = TWO_PI / this.points;\n let halfAngle = angle / 2.0;\n beginShape();\n for (let a = 0; a < TWO_PI; a += angle) {\n let sx = this.x + cos(a) * this.outerRadius;\n let sy = this.y + sin(a) * this.outerRadius;\n vertex(sx, sy);\n sx = this.x + cos(a + halfAngle) * this.innerRadius;\n sy = this.y + sin(a + halfAngle) * this.innerRadius;\n vertex(sx, sy);\n }\n endShape(CLOSE);\n pop();\n }", "function setup() {\n\t// object containing P5 colors that are commonly reused\n\tcolors = {\n\t\tbg: color(40, 50, 60),\n\t\tbg_quad: color(220, 160, 80),\n\t\tbg_dark: color(20, 30, 40),\n\t\tr: color(200, 50, 50),\n\t\tbr: color(80, 50, 50),\n\t\tblk: color(0, 0, 0),\n\t\tpine: color(20, 50, 30),\n\t\tlt_bl: color(50, 100, 120),\n\t\tbl: color(80, 100, 120),\n\t\tg: color(45, 80, 50),\n\t\tpale_pink: color(180, 120, 120, 150),\n\t\tw: color(230, 230, 240)\n\t};\n\t// create canvas and assign to global variable cnv\n\t// canvas has width equal to half the window and height based on set aspect ratio\n\tcnv = createCanvas(window.innerWidth / 2, \n\t\twindow.innerWidth / 2 / 475 * 600);\n\t// position canvas so it occupies right half of screen\n\tcnv.position(window.innerWidth / 2, 0, \"absolute\");\n\t// initialize Shape obejcts to be drawn later\n\tinit_shapes();\n}", "function setup() {\n createCanvas(600, 600);\n frameRate(60);\n\n for (let i = 0; i < RECT_COUNT; i++) {\n rectangles.push(\n new Rectangle( \n (i+1) * (RECT_MAXSIZE / RECT_COUNT), \n colors.RECT_COLOR, \n (RECT_COUNT - i) * (0.3 / RECT_COUNT), \n RECT_ROTATION)\n );\n }\n\n /*for (let i in rectangles) {\n ellipses.push(new Ellipse_(rectangles[i].side * 3.75, colors.CIRCLE_COLOR, i * (75 / RECT_COUNT)));\n arcs.push(new Arc_(rectangles[i].side * 3, colors.CIRCLE_COLOR, i * (50 / RECT_COUNT), PI / 4 + random(PI * 1.2), random(PI * 2)));\n }*/\n}", "renderAllShapes( ) {\n for( var i = 0; i < 6; i++ ){ \n for(var k = 0; k < 3; k++ ) {\n this.renderShape( Piece.getRandom(), k*5, i*5 );\n }\n }\n }", "function draw() {\n background(255);\n strokeWeight(10);\n //noStroke();\n rectMode(CENTER);\n //rect(width/2, height/2, 1600);\n for (let x = 200; x < width - 200; x += step) {\n for (let y = 200; y < height - 200; y += step) {\n //stroke(random(colors2));\n if (random(1) > .5) {\n //fill(0);\n stroke(random(colors2));\n strokeWeight(10); //5 normally\n ellipse(x + step/2, y + step/2, step/2, step/2);\n stroke(random(colors2));\n line(x + step/2, y + step/2, x - step/2, y);\n }\n\n }\n }\n}", "_display() {\r\n\t\t\tlet x = this.p.width * 0.5 - this.p.world.origin.x + this.x * this.tileSize;\r\n\t\t\tlet y = this.p.height * 0.5 - this.p.world.origin.y + this.y * this.tileSize;\r\n\r\n\t\t\t// skip drawing for out-of-view bodies, but\r\n\t\t\t// edges can be very long, so they still should be drawn\r\n\t\t\tif (\r\n\t\t\t\tthis.shape != 'chain' &&\r\n\t\t\t\tthis.p.camera.active &&\r\n\t\t\t\t(x + this.w < this.p.camera.bound.min.x ||\r\n\t\t\t\t\tx - this.w > this.p.camera.bound.max.x ||\r\n\t\t\t\t\ty + this.h < this.p.camera.bound.min.y ||\r\n\t\t\t\t\ty - this.h > this.p.camera.bound.max.y)\r\n\t\t\t) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tx = fixRound(x);\r\n\t\t\tx -= (this.w * this.tileSize) % 2 ? 0.5 : 0;\r\n\t\t\ty = fixRound(y);\r\n\t\t\ty -= (this.h * this.tileSize) % 2 ? 0.5 : 0;\r\n\r\n\t\t\t// x += this.tileSize * 0.015;\r\n\t\t\t// y += this.tileSize * 0.015;\r\n\r\n\t\t\tthis.p.push();\r\n\t\t\tthis.p.imageMode(p5.prototype.CENTER);\r\n\t\t\tthis.p.rectMode(p5.prototype.CENTER);\r\n\t\t\tthis.p.ellipseMode(p5.prototype.CENTER);\r\n\r\n\t\t\tthis.p.translate(x, y);\r\n\t\t\tif (this.rotation) this.p.rotate(this.rotation);\r\n\t\t\tthis.p.scale(this._mirror.x, this._mirror.y);\r\n\r\n\t\t\tthis.p.fill(this.color);\r\n\r\n\t\t\tthis._draw();\r\n\r\n\t\t\tthis.p.pop();\r\n\t\t\tthis.p.p5play.autoDrawSprites = false;\r\n\r\n\t\t\tthis._cameraActiveWhenDrawn = this.p.camera.active;\r\n\t\t}", "p5display() {\n this.nodes.forEach(node => {\n node.draw();\n })\n\n strokeWeight(1)\n\n this.edges.forEach(edge => {\n let realNode1 = this.nodes.find(node => node.name === edge.node1);\n let realNode2 = this.nodes.find(node => node.name === edge.node2);\n\n line(realNode1.x, realNode1.y, realNode2.x, realNode2.y);\n })\n }", "function draw() {\n\t\tfor (var i = 0; i < loop.graphics.length; i++) {\n\t\t\tloop.graphics[i](graphics, 0.0);\n\t\t}\n\t}", "function draw() {\n background(55); //Redraw the background, p5 does not automatically \"erase\" the screen automatically\n\n //All objects are drawn relative to the origin which is set to the top left of the screen by default\n //text(content, xPosition, yPosition)\n \n\n //Can draw shapes, images, lines, etc.\n\n\n}", "function setup() {\n createCanvas(windowWidth, windowHeight);\n\n// *This is a random, 5 Circle placer*\n//while (i < 5) {\n //fill(random(255), random(255), random(255))\n //ellipse(random(width), random(height), 100, 100);\n //i++;\n //}\n\n\n}", "function setup() {\ncanvas = createCanvas(windowWidth, windowHeight); \nbackground(255, 120, 180);\nrectMode(CENTER);\nimageMode(CENTER);\n//var i is local to the for loop\nfor(var i = 0; i < 20; i++){\nprint(i);\nfill(random(0, 255), random(0, 255), random(0,255));\nellipse(random(0, width), random(0,height), 20, 20);\n}\n\n}", "function draw_scene() {\r\n noStroke(); // so we don't get a border when we draw a tiny rectangle\r\n // go through all the pixels in the image\r\n for (let y = 0; y < height; y++) {\r\n for (let x = 0; x < width; x++) {\r\n \r\n \r\n let r = 0, g = 0, b = 0; // placeholders to store the pixel's color\r\n \r\n for (let sy = 0; sy < sampleLevel; sy++) {\r\n for (let sx = 0; sx < sampleLevel; sx++) {\r\n let subx = x + ((sx + 1) / (sampleLevel + 1)) - 0.5;\r\n let suby = y + ((sy + 1) / (sampleLevel + 1)) - 0.5;\r\n \r\n // create eye ray\r\n let ray = eye_ray_uvw (subx, suby);\r\n \r\n // maybe print debug information\r\n debug_flag = 0;\r\n //if (x == width / 2 && y == height / 2) { debug_flag = 1; } // un-comment to debug center pixel\r\n \r\n if (debug_flag) {\r\n console.log (\"debug at: \" + x + \" \" + y);\r\n }\r\n \r\n let min_t = 9999;\r\n let hitobj = null;\r\n for (let i = 0; i < shapes.length; i++) {\r\n console.log(shapes[i]);\r\n let t = shapes[i].checkInter(ray);\r\n if (t < min_t && t > 0) {\r\n min_t = t;\r\n hitobj = shapes[i];\r\n }\r\n }\r\n \r\n // Figure out the pixel's color here (FOR YOU TO WRITE!!!)\r\n \r\n if (hitobj == null) {\r\n r = red;\r\n g = green;\r\n b = blue;\r\n } else {\r\n r += hitobj.k_ambient * hitobj.dr * a_red;\r\n g += hitobj.k_ambient * hitobj.dg * a_green;\r\n b += hitobj.k_ambient * hitobj.db * a_blue;\r\n \r\n let blee = p5.Vector.mult(ray.direction, min_t);\r\n let hitpos = p5.Vector.add(ray.origin, blee);\r\n let normal = hitobj.getNormal(ray);\r\n for (let i = 0; i < lights.length; i++) {\r\n //soft shadow\r\n let min_t_1 = 9999;\r\n let shadow = null;\r\n for (let j = 0; j < shapes.length; j++) {\r\n let shadowD = hitobj.pointLightVectors(ray)[i].direction;\r\n let shadowO = hitobj.pointLightVectors(ray)[i].origin;\r\n let t_1 = shapes[j].checkInter(new ShadowRay(shadowD, shadowO));\r\n if (t_1 < min_t_1 && t_1 > 0) {\r\n min_t_1 = t_1;\r\n shadow = shapes[j];\r\n }\r\n if (shadow != null) {\r\n if (shadow.tmin > 0 && shadow.tmin < 0) {\r\n r += 0;\r\n g += 0;\r\n b += 0;\r\n }\r\n } else {\r\n let lightpos = p5.Vector.sub(lights[i].getLightVector(), hitpos).normalize();\r\n r += lights[i].r * max(0, p5.Vector.dot(normal, lightpos));\r\n g += lights[i].g * max(0, p5.Vector.dot(normal, lightpos));\r\n b += lights[i].b * max(0, p5.Vector.dot(normal, lightpos));\r\n }\r\n }\r\n }\r\n for (let i = 0; i < areaLights.length; i++) {\r\n //soft shadow\r\n let min_t_2 = 9999;\r\n let shadow = null;\r\n for (let j = 0; j < shapes.length; j++) {\r\n let shadowD = hitobj.areaLightVectors(ray, subx, suby)[i].direction;\r\n let shadowO = hitobj.areaLightVectors(ray, subx, suby)[i].origin;\r\n let t_2 = shapes[j].checkInter(new ShadowRay(shadowD, shadowO));\r\n if (t_2 < min_t_2 && t_2 > 0) {\r\n min_t_2 = t_2;\r\n shadow = shapes[j];\r\n }\r\n if (shadow != null) {\r\n if (shadow.tmin > 0 && shadow.tmin < 1) {\r\n r += 0;\r\n g += 0;\r\n b += 0;\r\n }\r\n } else {\r\n /*\r\n let arealightpos = p5.Vector.sub(areaLights[i].getLightVector(), hitpos);\r\n let new_U = areaLights[i].getUVector();\r\n let new_V = areaLights[i].getVVector();\r\n let subx2 = ((subx + 1 + rand) / (sampleLevel + 1)) * 2 - 1;\r\n let suby2 = ((suby + 1 + rand) / (sampleLevel + 1)) * 2 - 1;\r\n new_U = p5.Vector.mult(U, subx2);\r\n new_V = p5.Vector.mult(V, suby2);\r\n arealightpos = p5.Vector.add(new_U, p5.Vector.add(new_V, arealightpos)).normalize(); \r\n */\r\n let arealightpos = shadowD.normalize();\r\n r += areaLights[i].r * max(0, p5.Vector.dot(normal, arealightpos.normalize()));\r\n g += areaLights[i].g * max(0, p5.Vector.dot(normal, arealightpos.normalize()));\r\n b += areaLights[i].b * max(0, p5.Vector.dot(normal, arealightpos.normalize()));\r\n }\r\n }\r\n }\r\n r *= hitobj.dr;\r\n g *= hitobj.dg;\r\n b *= hitobj.db;\r\n /*\r\n r = 1;\r\n g = 0;\r\n b = 0;\r\n */\r\n }\r\n }\r\n }\r\n r = r / sq(sampleLevel);\r\n g = g / sq(sampleLevel);\r\n b = b / sq(sampleLevel);\r\n //console.log(r + \" \" + g + \" \" + b);\r\n // set the pixel color, converting values from [0,1] into [0,255]\r\n fill (255 * r, 255 * g, 255 * b);\r\n \r\n rect (x, y, 1, 1); // make a little rectangle to fill in the pixel\r\n }\r\n }\r\n \r\n}", "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 }", "display(){\r\n //create a shape & store in a var engine body position\r\n var pos=this.body.position;\r\n //capture engine body angle\r\n var angle=this.body.angle;\r\n \r\n push();\r\n translate(pos.x,pos.y);\r\n rotate(angle);\r\n stroke(\"red\");\r\n strokeWeight(4);\r\n fill(\"red\");\r\n rectMode(CENTER);\r\n ellipse(0,0,this.r,this.r);\r\n //rect(0,0,this.width, this.height);\r\n pop();\r\n }", "function setup() {\r\n\tClearCanvasOnLoop = false;\r\n\r\n\tCanvas.Rectangle((-wid-100),(-hei-100),(wid+100)*2,(hei+100)*2,\"fill\",\"black\")\r\n\tCanvas.ctx.lineWidth = wid/20;\r\n\tfor(let i=0;i<=9;i++) {\r\n\tconst ang1 = AM.map(i-0.2,0,10,0,Math.PI*2);\r\n\tconst ang2 = AM.map(i+0.2,0,10,0,Math.PI*2);\r\n\tconst ang3 = AM.map(i,0,10,0,Math.PI*2);\r\n\tlet p1 = new V2D(Math.cos(ang1)*(wid+wid/20) , Math.sin(ang1)*(hei+hei/20));\r\n\tlet p2 = new V2D(Math.cos(ang2)*(wid+wid/20) , Math.sin(ang2)*(hei+hei/20));\r\n\tlet p3 = new V2D(Math.cos(ang3)*(wid+wid/20) , Math.sin(ang3)*(hei+hei/20));\r\n\r\n\tCanvas.ctx.beginPath();\r\n\tCanvas.ctx.moveTo(p1.x,p1.y);\r\n\tCanvas.ctx.bezierCurveTo(p3.x, p3.y, p3.x, p3.y,p2.x,p2.y);\r\n\tCanvas.ctx.strokeStyle = color[i];\r\n\tCanvas.ctx.stroke();\r\n}\r\n\tCanvas.alpha(0.2);\r\n\r\n\tCanvas.ctx.lineWidth = 1;\r\n}", "function setup() {\n\n createCanvas(windowWidth, windowHeight);\n // background(color(48, 39, 140));\n\n // cx = windowWidth / 2;\n // cy = windowHeight / 2;\n\n startx = windowWidth * 0.2;\n starty = windowHeight * 0.2;\n shiftx = 10;\n shifty = 10;\n sizex = 500;\n sizey = 500;\n\n n = 10;\n\n noFill();\n stroke(0);\n strokeWeight(2)\n\n // rect(startx, starty, sizex, sizey);\n\n for(var i = 0; i < 10; i++){\n\n startx = startx + shiftx;\n starty = starty + shifty;\n\n rect(startx, starty, sizex, sizey);\n // print(i);\n }\n\n}", "displayShape() {\n // this.red += random(-20,20);\n // this.green += random(-20,20);\n // this.blue += random(-20,20);\n for (let i = 0; i < 10; i++) {\n // Sets the width and height of the spray according to the mouse position\n this.pixelWidth = map(mouseX, 0, width, 1, 5);\n this.pixelHeight = map(mouseY, 0, height, 1, 5);\n // Display the pixels\n this.displayPixel();\n\n }\n }", "function draw() {\n background(\"#222239\");\n\n fill(255);\n beginShape();\n\n var xoff = 0;\n var whr = { w: 1100, h: 600 };\n if (widthHeightRatio < 1) whr = { w: 2100, h: 1500 };\n\n for (var x = 0; x <= width; x += 10) {\n var y = map(noise(xoff, yoff), 0, 1, whr.w, whr.h);\n vertex(x, y);\n xoff += 0.05;\n }\n yoff += 0.01;\n vertex(width, height);\n vertex(0, height);\n endShape(CLOSE);\n}", "function draw() {\n\n//moving the sketch a little to the center\n translate ( 20, 20 );\n\n//assigning the background color\n background ( 219, 73, 172 );\n\n//drawing out the ellipse 'for' loop\n for ( var x = 0; x <= width; x += 60 ) {\n for ( var y = 0; y <= height; y += 40 ) {\n fill ( random(255), 0, random(255) );\n ellipse ( x, y, 45, 45 );\n stroke( 0, random(255), random(255) );\n strokeWeight ( 3 );\n }\n }\n\n//drawing out the line 'for' loop\n for ( var i = 30; i < 1300; i += 60 ) {\n translate ( 0, -20 )\n line ( i, i*20, i, 0 );\n strokeWeight ( 3 );\n stroke ( random(255), 0, random(255) );\n }\n}", "function draw() {\n background(255);\n particles.forEach(p => {\n p.move();\n p.draw();\n });\n}", "function setup() {\n var cnv = createCanvas(800, 800);\n cnv.position((windowWidth-width)/2, 30);\n background(235);\n // Create a function that loads the squares into an\n // array of square objects and call the function\nvar sqr = [];\nloadSquares();\nfor(i = 0; i < squares.length; i++){\n squares[i].render();\n}\n // traverse array and run each square\n\n}", "function draw() {\n\tbackground(30);\n\t// this is a local variable with scope limited to setup()\n\t// I will use it for the ratio of width to height\n\tvar localVar = w/h;\n\n\t// for loops will \"iterate\" until a condition is met\n\t// useful for drawing x and y axes\n\tfor (var i = 0; i < w; i+=Math.round(50*localVar)) {\n\t\tfor (var j = 0; j < h; j+= 50) {\n\t\t\tfill(i%255, j%200, globalVar%255);\n\t\t\tstrokeWeight(globalVar%20);\n\t\t\tif (i >= w/2) {\n\t\t\t\trect(i, j, 25, 25);\n\t\t\t} else if (j >= h/2) {\n\t\t\t\tfill(i%255, globalVar%255, j%255);\n\t\t\t\tellipse(i, j, 25, 25);\n\t\t\t} else {\n\t\t\t\tfill(globalVar%255, i%255, j%255);\n\t\t\t\ttriangle(i, j, i+25, j, i, j+25);\n\t\t\t}\n\t\t\t// counts endlessly\n\t\t\tglobalVar = globalVar + 0.01;\n\t\t}\n\t}\n\n}", "function draw() {\n\tconsole.log('sfdsf');\n //fill(0);\n for (var i = 0; i < 50; i+10) {\n for (var j = 0; j < 50; j+10) {\n \tconsole.log('i,j',i,j);\n fill(random(255),0,random(255));\n ellipse(i, j, 20, 20);\n }\n }\n}", "drawGraph(){\n let shapes = this.vertices.iterator();\n\n while(!shapes.isEmpty()){\n shapes.currItem().drawEdges();\n shapes.next();\n }\n\n shapes = this.vertices.iterator();\n\n \n while(!shapes.isEmpty()){\n shapes.currItem().draw(this.currentStage);\n shapes.next();\n }\n }", "function draw() {\n shapes();\n w++;\n z++;\n}", "function draw() {\n textSize(50);\n textFont(\"cooper\");\n text(\"art generates itself\", windowWidth / 2, windowHeight / 2);\n textAlign(CENTER, CENTER);\n\n r = random(0, 255);\n g = random(0, 255);\n b = random(0, 255);\n fill(r, g, b);\n rect(25 * horizontalp, 25 * verticalp, 100, 100);\n\n r = random(0, 255);\n g = random(0, 255);\n b = random(0, 255);\n fill(r, g, b);\n circle(25 * horizontalp, 25 * verticalp, 100, 100);\n\n //increasing the horizontal and vertical position so i can cover the whole screen with the shapes\n horizontalp = horizontalp + 2;\n if (horizontalp > 100) {\n verticalp = verticalp + 2;\n horizontalp = 1;\n }\n\n if (verticalp > 35) {\n horizontalp = horizontalp + 4;\n verticalp = 1;\n }\n}", "function draw() {\n\n background(0);\n for(let i = 0; i < h; i += 10) {\n for(let j = 0; j < w; j+= 10) {\n \n point_color = 'rgb(0,255,0)';\n strokeWeight(noise_color/90);\n // stroke(point_color);\n point(cx[counting],cy[counting])\n counting++;\n } \n counting = 0;\n } \n perlin();\n // console.log(noise_color)\n\n fill(62, noise_color, 242);\n // Plane.displayRect(); // class method\n // Plane1.displayRect();\n // Plane2.displayRect();\n // for(let i = 0; i < coords_array.length; i++) {\n // // console.log('hi')\n // Plane[i].displayRect();\n // }\n for(let i = 0; i < Plane.length; i++) {\n Plane[i].displayRect();\n }\n\n\n}", "display(){\n\n push();\n\n fill(this.color);\n noStroke();\n\n for(let i = 0; i < this.numOfSegs; i++){\n ellipse(this.segments[i].x,this.segments[i].y,this.segments[i].width);\n }\n pop();\n\n }", "function draw_step(){\n // perform these many iterations\n for (let i = 0; i < controllers.iterations; i++) {\n // set the styling of points\n strokeWeight(controllers.pointStroke);\n // stroke(\"#EC7272\");\n stroke(255);\n // pick next points\n let next = random(points);\n // skip to match condition\n if (controllers.notPrevious && next === previous) continue;\n if (controllers.noAdjacent) {\n var indexOfPrev = points.indexOf(previous)\n if (abs(points.indexOf(next) - indexOfPrev) == 2) continue;\n }\n if (controllers.no2PreviousSame && earlier === previous){\n var indexOfPrev = points.indexOf(previous);\n var indexOfNext = points.indexOf(next);\n if (indexOfNext === mod_index(indexOfPrev-1)) continue;\n if (indexOfNext === mod_index(indexOfPrev+1)) continue;\n }\n // universal step, update current and plot it\n current.x = lerp(current.x, next.x, controllers.compressionRatio);\n current.y = lerp(current.y, next.y, controllers.compressionRatio);\n // if (points.indexOf(next)==0)\n // {\n // // current = rotation_x.mult(current.x).add(rotation_y.mult(current.y));\n // current = createVector(\n // p5.Vector.dot(createVector(0, 1), current),\n // p5.Vector.dot(createVector(-1, 0), current)\n // )\n // }\n point(current.x, current.y);\n // current is nesxt\n earlier = previous;\n previous = next;\n }\n}", "function setup() {\n createCanvas(800, 800);\n smooth();\n //noLoop();\n \n n = 1600;\n \n // put bounding circles\n circles.push(new Circ(-10, height/2, 20));\n circles.push(new Circ(width+10, height/2, 20));\n circles.push(new Circ(width/2, -10, 20));\n circles.push(new Circ(width/2, height+10, 20));\n \n //for (var i=0; i<n; i++) {\n //circles.push(new Circ()); \n //}\n}", "function draw() {\n\t// set up background\n\tdraw_background();\n\t// draw all pre-square shapes that are occluded by square\n\tdraw_shapes(pre_shapes);\n\t// draw background-colored square\n\tvar bg_sqr = {w_square_bg: new Shape(\"square\", width * .47, height * .95 / 2, \n\t\t\twidth * .3, null, colors.bg)};\n\tdraw_shapes(bg_sqr);\n\t// draw all post-square shapes that overlap square\n\tdraw_shapes(post_shapes);\n}", "function sketch (p){\n\n const cols = GridConstants.num_cols;\n const rows = GridConstants.num_rows;\n let parentW = document.querySelector(\".sketch-container\").clientWidth;\n let parentH = document.querySelector(\".sketch-container\").clientHeight;\n let currGrid = [[]], nextGrid = [[]]\n let cellFill = \"#cc527a\", textFill = \"#D11554\", textStroke=\"#e8175d\";\n // textStroke2 = rgba(232, 23, 93, 0.4);\n let isBlasting = false, goForClear = 0;\n let generations = 0, isRandom = false;\n\n p.preload = () => {};\n\n const createCells = () => {\n for (let i=0; i<cols; i++){\n currGrid[i] = [];\n nextGrid[i] = [];\n for(let j=0; j<rows; j++){\n currGrid[i][j] = new Cell(p, i, j);\n nextGrid[i][j] = new Cell(p, i, j);\n }\n }\n };\n\n const stirChaos = () => {\n if(isBlasting == true){\n return;\n }\n for(let i=0; i<cols; i++){\n for(let j=0; j<rows; j++){\n currGrid[i][j].randomActive();\n currGrid[i][j].createRect();\n }\n }\n }\n \n // \"Props\" coming from React via P5Wrapper\n p.arbitrary = (props) => {\n console.log(props);\n if(props.data.isRandom == true && isBlasting == false){\n isRandom = true;\n stirChaos();\n } else {\n isRandom = false;\n }\n if(props.data.isClear == true){\n clearEm();\n }\n if(props.data.isRollin == true){\n isBlasting = !isBlasting;\n }\n }\n\n p.setup = () => {\n p.frameRate(15);\n p.pixelDensity(1);\n p.createCanvas(parentW,parentH);\n createCells();\n p.background(\"#e8175d\");\n p.textSize(480);\n p.textAlign(p.CENTER, p.CENTER);\n };\n\n\n\n p.draw = () => {\n if(isBlasting == true){\n judgement();\n }\n for(let i=0; i<cols; i++){\n for(let j=0; j<rows; j++){\n currGrid[i][j].setGeneration(generations);\n currGrid[i][j].createRect();\n\n }\n }\n p.textAlign(p.LEFT);\n drawText( parentW * 0.03);\n };\n\n p.mousePressed = () => {\n if(isBlasting == true){\n return;\n }\n for(let i=0; i<cols; i++){\n for(let j=0; j<rows; j++){\n currGrid[i][j].clicked(p.mouseX, p.mouseY);\n }\n }\n }\n\n const drawText = (x) => {\n if(generations != 0 && generations % 50 == 0){\n\n p.fill(241, 255, 192, 200);\n p.strokeWeight(8);\n p.text(generations, x, 200);\n\n window.setTimeout(()=>{\n p.stroke(232, 23, 93, 131)\n p.fill(232, 23, 93, 91);\n p.strokeWeight(8);\n p.text(generations, x, 200);\n },1700);\n }\n \n p.stroke(232, 23, 93, 131)\n p.fill(232, 23, 93, 91);\n p.strokeWeight(8);\n p.text(generations, x, 200);\n }\n\n const judgement = () => {\n \n for(let i=1; i<cols-1; i++){\n for( let j=1; j<rows-1; j++){\n let theLoving = 0;\n if(currGrid[i-1][j-1].getActivity() == true){theLoving++;}\n if(currGrid[i-1][j+1].getActivity() == true){theLoving++;}\n if(currGrid[i-1][j].getActivity() == true){theLoving++;}\n if(currGrid[i+1][j-1].getActivity() == true){theLoving++;}\n if(currGrid[i+1][j].getActivity() == true){theLoving++;}\n if(currGrid[i+1][j+1].getActivity() == true){theLoving++;}\n if(currGrid[i][j-1].getActivity() == true){theLoving++;}\n if(currGrid[i][j+1].getActivity() == true){theLoving++;}\n if(theLoving > 3 || theLoving < 2){\n if(currGrid[i][j].getActivity() == true){\n nextGrid[i][j].setActiveToFalse();\n }\n } else if (theLoving == 3) {\n console.log(currGrid[i][j].getActivity());\n if(currGrid[i][j].getActivity() == false){\n nextGrid[i][j].setActiveToTrue();\n }\n } else {\n nextGrid[i][j].setActivity(currGrid[i][j].getActivity());\n }\n }\n }\n\n swapJudgement();\n incrementGenerations();\n };\n\n const swapJudgement = () => {\n for(let i=0; i<cols; i++){\n for (let j = 0; j < rows; j++) {\n currGrid[i][j].setActivity(nextGrid[i][j].getActivity());\n }\n }\n }\n\n const incrementGenerations = () => {\n generations += 1;\n }\n\n const clearEm = () => {\n if(isBlasting == true){\n return;\n }\n for (let i=0; i<cols; i++){\n for (let j=0; j<rows; j++){\n currGrid[i][j].setActiveToFalse();\n }\n }\n generations = 0;\n }\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 }", "drawEveryIteration() {\n //let index = this.scenarioParameters.populationSize - 1;\n let index = this.activeIndividuals[0] || 0;\n\n if (!this.population[index].alive) {\n background(255, 0, 0);\n return;\n }\n var screen_width = 100;\n var screen_height = 100;\n var screen_offset_x = 0;\n var screen_offset_y = 0;\n var world_width = this.scenarioVariables.x_threshold * 2;\n var scale = screen_width / world_width;\n\n var polewidth = 10;\n var polelen = scale * (2 * this.scenarioVariables.length);\n var cartwidth = 0.5;\n var cartheight = 0.3;\n var carty = 100 - cartheight * scale;\n //cart\n background(0);\n fill(0);\n stroke(255, 0, 0);\n //console.log(this.population[0]);\n\n rect(\n (this.population[index].inputs[0] - cartwidth / 2) * scale +\n screen_width / 2,\n carty,\n cartwidth * scale,\n cartheight * scale\n );\n //pole\n stroke(255, 255, 255);\n strokeWeight(1);\n\n line(\n this.population[index].inputs[0] * scale + screen_width / 2,\n carty,\n this.population[index].inputs[0] * scale +\n scale * polelen * Math.sin(this.population[index].inputs[2]) +\n screen_width / 2,\n carty -\n Math.abs(scale * polelen * Math.cos(this.population[index].inputs[2]))\n );\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 }", "show(){\n for(let i = 0; i<this.body.length; i++){\n fill(0);\n noStroke();\n rect(this.body[i].x, this.body[i].y, 1,1)\n }\n }", "display(){\n push();\n noStroke();\n fill(this.fill.r,this.fill.g,this.fill.b);\n //2 balls\n ellipse(this.x, this.y, this.size);\n ellipse(this.x2, this.y2, this.size);\n // timer ball\n ellipse(this.x3,this.y3, this.size3);\n pop();\n }", "function draw() {\n background(\"white\");\n for (let i = 0; i < width; i += 10) {\n for (let j = 0; j < height; j += 10) {\n//applied random variable for color of circles\n randFillR = random(255);\n randFillG = random(255);\n randFillB = random(255);\n fill(randFillR, randFillG, randFillB);\n circle(i, j, r);\n }\n }\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 }", "display(){\n noStroke();\n fill(this.color);\n if(this.shape === rect){\n rotation += rotFactor;\n translate(windowWidth/2, windowHeight/2);\n rotate(rotation);\n this.shape(0, 0, this.size, this.size);\n }\n else{this.shape(this.x, this.y, this.size, this.size);}\n }", "display() {\n push();\n translate(this.pX, this.pY);\n fill(color(255, 255, 255, (random(120))));\n ellipse(0, 0, this.rR);\n pop();\n }", "function draw() {\n background(255);\n strokeWeight(0.3);\n fill(209,223,245);\n\n // create eyes\n for (let i = 0; i < 5; i++){\n ellipse(width/3+50+i*100, height/4, 40, 30);\n }\n\n push();\n noStroke();\n fill(19,71,120);\n\n // track the pupil position\n if (mouseX < windowWidth/2){\n xPos = -mouseX/120;\n }\n\n if (mouseY < windowHeight/2){\n yPos = -mouseY/150;\n }\n\n // create eyelashes\n for (let i = 0; i < 5; i++){\n push();\n fill(0);\n rect(width/3+50+i*100, height/4-22, 2, 13);\n rect(width/3+40+i*100, height/4-18, 2, 10);\n rect(width/3+60+i*100, height/4-18, 2, 10);\n pop();\n\n // create pupils\n ellipse(width/3+48+i*100-xPos, height/4-yPos, 15, 20);\n }\n pop();\n}", "display(){\n noStroke();\n fill(245,172,114);\n ellipse(this.location.x, this.location.y, this.mass * 5, this.mass * 5)\n }", "function draw(){//the main loop in a p5.js sketch\r\n\tbackground(51);\r\n\r\n\tfill(255);\r\n\tnoStroke();\r\n\r\n\ttext(eqString, pad, 2*(waveHeight+pad), width - pad*2, 100);\r\n\t\r\n\tnoFill();\r\n\tstroke(255);\r\n\trect(pad/2, pad/2, width-pad, 2*waveHeight +pad);\r\n\r\n\tbeginShape(); //this begins the shape of the sinusoidal wave at the top of the sketch\r\n\tfor(let i = 0; i<xDetail; i++){\r\n\t\txPos = map(i, 0, xDetail, pad, width-pad);\r\n\r\n\t\tvertex(xPos, (-1)*sumWaves(wave,(i*xScale)) + waveHeight + pad);\r\n\t}\r\n\tendShape();\r\n\r\n\t\r\n\ttranslate(100+pad/2, 300-pad/2);\r\n\tfill(100);\r\n\trect(-100, -100, 2*100, 2*100);\r\n\tpoint(0,0);\r\n\tnoFill();\r\n\r\n\r\n\r\n\t\r\n\txWavePoints = [];//the array of the points in the polar graph (x-axis)\r\n\tyWavePoints = [];//the array of the points in the polar graph (y-axis)\r\n\r\n\tbeginShape();//begins the polar curve shape\r\n\tfor(let ang = 0; ang<xDetail*rotations; ang++){\r\n\t\t[xPos, yPos] = polar_to_cart(sumWaves(wave,(ang*xScale)), ang*xScale*currF*fDelta);\r\n\t\tvertex(xPos, yPos);\r\n\t\txWavePoints.push(xPos/rotations);\r\n\t\tyWavePoints.push(yPos/rotations);\r\n\t}\r\n\tendShape();\r\n\r\n\t//this is the \"centre of mass\", so to speak, of the polar graph\r\n\tnoStroke();\r\n\tfill(0,0,0);\r\n\tellipse(4*sumArr(xWavePoints)/xWavePoints.length, 4*sumArr(yWavePoints)/yWavePoints.length, 4);\r\n\tnoFill();\r\n\tstroke(255);\r\n\r\n\tcurrF = currF+1;//increment the currF\r\n\tif(currF*fDelta>fRange){\r\n\t\tcurrF = 0;\r\n\t}\r\n\r\n\tySpectrum[currF] = (sumArr(yWavePoints)/spectrumScale);\r\n\txSpectrum[currF] = (sumArr(xWavePoints)/spectrumScale);\r\n\r\n\r\n\tresetMatrix();\r\n\r\n\ttranslate(200 + pad, 300+pad);\r\n\r\n\t//showing the y-axis component of the spectrum\r\n\r\n\tstroke(255, 200, 200);\r\n\tbeginShape();\r\n\tfor(i=0; i<ySpectrum.length; i++){\r\n\t\txPos = map(i, 0, totalFreqs, 0, 300-2*pad);\r\n\t\tvertex(xPos, (-1)*(ySpectrum[i]));\r\n\t}\r\n\tendShape();\r\n\r\n\r\n\t//showing the x-axis component of the spectrum\r\n\r\n\t// stroke(200, 255, 200);\r\n\t// beginShape();\r\n\t// for(i=0; i<xSpectrum.length; i++){\r\n\t// \txPos = map(i, 0, totalFreqs, 0, 300-2*pad);\r\n\t// \tvertex(xPos, (-1)*xSpectrum[i]);\r\n\t// }\r\n\t// endShape();\r\n\r\n}", "displayNext() {\n let next_shapes = []; // Holds the p5 image object for the upcoming shapes\n\n for (var i = 0; i < rand_shapes.length; i++) { // Necessary to separate 3 times to prevent bluriness from constant resizing\n let shape = rand_shapes[i];\n if (i == 0) {\n if (shape == 0) {\n next_shapes.push(Box_img0);\n } else if (shape == 1) {\n next_shapes.push(J_img0);\n } else if (shape == 2) {\n next_shapes.push(L_img0);\n } else if (shape == 3) {\n next_shapes.push(Z_img0);\n } else if (shape == 4) {\n next_shapes.push(S_img0);\n } else if (shape == 5) {\n next_shapes.push(T_img0);\n } else if (shape == 6) {\n next_shapes.push(Line_img0);\n }\n } else if (i == 1) {\n if (shape == 0) {\n next_shapes.push(Box_img1);\n } else if (shape == 1) {\n next_shapes.push(J_img1);\n } else if (shape == 2) {\n next_shapes.push(L_img1);\n } else if (shape == 3) {\n next_shapes.push(Z_img1);\n } else if (shape == 4) {\n next_shapes.push(S_img1);\n } else if (shape == 5) {\n next_shapes.push(T_img1);\n } else if (shape == 6) {\n next_shapes.push(Line_img1);\n }\n } else { // After the first two next pieces, they're all the same size\n if (shape == 0) {\n next_shapes.push(Box_img2);\n } else if (shape == 1) {\n next_shapes.push(J_img2);\n } else if (shape == 2) {\n next_shapes.push(L_img2);\n } else if (shape == 3) {\n next_shapes.push(Z_img2);\n } else if (shape == 4) {\n next_shapes.push(S_img2);\n } else if (shape == 5) {\n next_shapes.push(T_img2);\n } else if (shape == 6) {\n next_shapes.push(Line_img2);\n } \n }\n }\n\n imageMode(CENTER);\n // Constant resizing causes blurriness\n image(next_shapes[0], 553, 157);\n image(next_shapes[1], 553, 278);\n image(next_shapes[2], 553, 375);\n image(next_shapes[3], 553, 466);\n image(next_shapes[4], 553, 557); \n }", "function setup() {\n var cnv = createCanvas(800, 800);\n cnv.position((windowWidth-width)/2, 30);\n background(22);\n squareSize = width/numberofSquares;\n\n // Create a function that loads the squares into an\n // array of square objects and call the function\n\n loadSquares(8);\n // traverse array and run each square \\\n\n for(var i = 0; i < squares.length; i++){\n squares[i].render();\n }\n\n}", "function setup() {\n \n createCanvas(960, 500);\n background(255);\n graphObjects[2].creation();\n noStroke();\n noLoop(); // Run once and stop\n \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}", "function draw() {\n particles.forEach((p) => {\n p.draw();\n });\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}", "display() {\n push();\n noStroke();\n fill(this.color1);\n translate(this.posX, this.posY);\n ellipse(0, 0, this.size);\n noStroke();\n fill(this.color2);\n translate(this.posX, this.posY);\n ellipse(0, 0, this.size);\n noStroke();\n fill(this.color3);\n translate(this.posX, this.posY);\n ellipse(0, 0, this.size);\n pop();\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 }", "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 setup() {\r\n createCanvas(600, 500, WEBGL);\r\n rect(0, 0, width, height)\r\n strokeWeight(4)\r\n}", "function draw(){//p5.js update loop\n if(frame == 0) trainer = train();\n frame++;\n if(frame % (FRAME_BUFFER - fSlider.value())) return;\n background(BACKGROUND_COLOR);\n let idx = trainer.next().value;\n drawLattice();\n drawEpoch();\n if(!trained) drawIndex(idx);\n}", "function draw(){\r\n background(0);\r\n numOfSegments = map(mouseY,0,400,12,180);\r\n stepAngle = 360/numOfSegments;\r\n // Allows us to increase and decrease radius as we move the mouse\r\n radius = map(mouseX,0,400,50,200);\r\n\r\n fill(360,100,100);\r\n push();\r\n //translate(250,250);\r\n beginShape(TRIANGLE_FAN);\r\n vertex(250,250);\r\n\r\n // Starting for loop with a variable which represents alpha\r\n for(let a=0; a<=360; a += stepAngle){\r\n let vx= (radius * cos(a)) +250;\r\n let vy= (radius *sin(a)) +250;\r\n fill(a,100,100);\r\n vertex(vx,vy);\r\n }\r\n endShape();\r\n pop();\r\n} // End of draw function", "function drawAll() {\n ctx.clearRect(0, 0, 800, 500);\n for (var j = 0; j < lgt; j++) {\n shape[j].draw();\n\n }\n for (var k = 0; k < COUNT; k++) {\n snowflakes[k].update();\n\n }\n\n\n}", "function setup() {\r\n //Create a canvas of a particular size\r\n createCanvas(windowHeight,windowWidth);\r\n\r\n background(255,0,255);\r\n\r\n //Drawing shapes\r\n fill(255,255,255);\r\n stroke(255,255,0);\r\n strokeWeight(10);\r\n //(x,y,diameter)\r\n ellipse(200,100,100);\r\n rect(150,150,100,200);\r\n}", "display() {\n fill(127);\n stroke(200);\n strokeWeight(2);\n ellipse(this.x, this.y, this.r * 2, this.r * 2);\n }", "function setup() {\n frameRate(10);\n \n var cvn = createCanvas(SizeW,SizeH);\n cvn.parent(\"sketch-holder\");\n \nvar NumBlocksX = (floor(SizeW/blockX));\nvar NumBlocksY = (floor(SizeH/blockY)) ;\n total = (NumBlocksX * NumBlocksY) -1;\n\n\n //this loop is for creating the tiles\n for(var i = 0; i<=total; i++){\n tile.push(new Tile());\n tile[i].selectColor(i);\n \n }\n setTilePositions(tile,NumBlocksX,NumBlocksY);\n \n \n // flipRing(2,tile,224,tile[224].x,tile[224].y,NumBlocksX,NumBlocksY);\n setRings(numRings);\n \n}", "async function main() {\n new p5((p_) => {\n p = p_;\n p.setup = setup;\n p.draw = draw;\n }, elements.container);\n\n // Settings\n const lineSettings = gui.addFolder('Line');\n lineSettings.add(settings, 'radius', 10, 800).step(1).onChange(redraw);\n lineSettings\n .add(settings, 'lineControlPoint', 5, 25)\n .step(1)\n .onChange(redraw);\n lineSettings.add(settings, 'lineWidth', 1, 10).step(1).onChange(redraw);\n lineSettings.add(settings, 'yStep', 1, 100).step(1).onChange(redraw);\n\n const noiseSettings = gui.addFolder('Noise');\n noiseSettings.add(settings, 'noiseSpeed', 0.1, 1).step(0.1).onChange(redraw);\n noiseSettings.add(settings, 'noiseXStep', 0.1, 10).step(0.1).onChange(redraw);\n noiseSettings\n .add(settings, 'noiseYFactor', 0.01, 1)\n .step(0.01)\n .onChange(redraw);\n\n const viewSettings = gui.addFolder('View');\n viewSettings.addColor(settings, 'bgColor').listen().onChange(redraw);\n viewSettings.addColor(settings, 'lineColorUp').listen().onChange(redraw);\n viewSettings.addColor(settings, 'lineColorDown').listen().onChange(redraw);\n viewSettings.add(settings, 'randomizeColors');\n\n gui.add(settings, 'redraw');\n gui.add(settings, 'saveImage');\n gui.close();\n\n if (ENABLE_STATS) {\n stats.showPanel(0);\n elements.stats.appendChild(stats.dom);\n }\n}", "function setup() {\n var cnv = createCanvas(800, 800);\n cnv.position((windowWidth-width)/2, 30);\n background(235);\n // Create a function that loads the squares into an\n // array of square objects and call the function\n loadSquares();\n // traverse array and run each square\n for(var i = 0; i < squares.length; i++){\n squares[i].render();\n }\n}", "function setup() {\n var canvas = createCanvas(640, 360);\n canvas.parent(\"p5container\");\n stroke(255);\n frameRate(30);\n}", "function renderScarf(){\n makeScarf();\n for (i = 0; i < scarfShapes.length; i++){\n scarfShapes[i].render();\n }\n }", "function draw() {\n // Clears everything to make all of the pixels 100% transparent\n clear(); // avoids having planets leave a trail\n\n // Removing the stroke on all planets\n noStroke();\n\n // Draw the sun and each planet\n planets();\n\n // Draw saturn's ring\n push();\n saturnRing();\n pop();\n\n // P5's orbitControl() allows you to drag and move around the world\n // in this case, the zoom is disabled\n orbitControl();\n}", "display(){\n noStroke();\n fill(0,0,0);\n ellipse(this.location.x, this.location.y, this.mass * 5, this.mass * 5)\n noFill();\n stroke(255,255,255);\n ellipse(this.location.x, this.location.y, 200, 200);\n }", "function draw() {\n ctx.clearRect(0,0, canvas.width, canvas.height);\n drawList.forEach((shape) => {\n shape.draw();\n });\n raf = window.requestAnimationFrame(draw);\n}", "function draw(){\n\n //write hello world using p5 positioned at ( x: 20, y: 30 )\n text( \"Hello World!\", 300, 200);\n}", "draw(){\n let shapes = this.shapeList.iterator();\n push();\n while(!shapes.isEmpty()){\n shapes.currItem().draw();\n shapes.next();\n }\n pop();\n\n this.drawText();\n }", "draw() {\n\n\t\tthis.p5.push();\n\n\t\tlet h = this.p5.map(this.sprite.height, 0, 625, 0, this.p5.height);\n\t\tlet w = h * 500/625;\n\t\tthis.p5.image(this.sprite, 0, 0, w, h);\n\n\t\tthis.p5.pop();\n\t\t\n\t}", "draw() {\n this.bg.forEach((a) => a.draw());\n this.shapes.forEach((a) => a.draw());\n Help.clean(this.shapes);\n }", "display() {\n fill(random(255), random(255), random(255));\n ellipse(this.x, this.y, 30);\n }", "function setup() {\n var cnv = createCanvas(800, 800);\n cnv.position((windowWidth-width)/2, 30);\n background(20, 20, 20);\n fill(200, 30, 150);\n loadBalls(100);\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 background(\"white\");\n for (let i = 0; i < width; i += w*2) {\n for (let j = 0; j < height; j += w*2) {\n//applied random variable for color of squares\n randFillR = random(255);\n randFillG = random(255);\n randFillB = random(255);\n fill(randFillR, randFillG, randFillB);\n square(i, j, w);\n }\n }\n}", "function setup() {\n // createCanvas(windowWidth, windowHeight);\n createCanvas(600, 600);\n\n // background(0);\n nR = random(1000);\n nG = random(1000);\n nB = random(1000);\n}", "function setup() {\n //p5Canvas = createCanvas(1300, 300);\n p5Canvas = createCanvas(500, 300);\n //frameRate(1);\\\n frameRate(40);\n //p5Canvas = createCanvas(300, 300,WEBGL);\n //normalMaterial();\n textSize(64);\n //textAlign(CENTER, CENTER);\n}", "function setup() {\n createCanvas(500, 500);\n color(255);\n background(255, 0, 0); \n noLoop();\n fill(255);\n stroke(0);\n strokeWeight(10);\n}", "function setup() {\n createCanvas(600, 400);\n\n // Initialize Variables\n bubbles = [];\n rcolors = [];\n for (var n = 0; n < 200; n++) {\n rcolors.push(color(random(255), random(255), random(255), 180));\n bubbles.push(new Bubble(random(width), random(height), rcolors[n]));\n }\n\n}", "function draw() {\n rocketshape();\n}", "draw(){\n push();\n\n beginShape();\n texture(this.texture);\n textureWrap(MIRROR);\n //draw as a rectangle, divide by 2 for width and height\n vertex(this.getX() - (this.w/2.0), this.getY() - (this.h/2.0),CENTER,TOP_EDGE); //bottom right, CCW, Need UV coordinates for texture mapping\n vertex(this.getX() + (this.w/2.0), this.getY() - (this.h/2.0),RIGHT_EDGE,TOP_EDGE); //for some reason this starts on bottom right?\n vertex(this.getX() + (this.w/2.0), this.getY() + (this.h/2.0),RIGHT_EDGE,CENTER);\n vertex(this.getX() - (this.w/2.0), this.getY() + (this.h/2.0),CENTER,CENTER);\n\n endShape(CLOSE);\n\n pop();\n }", "function setup() {\ncreateCanvas(500,500);\nbackground(200,200,200);\n\npoint(50,50);\nrect(0,0,250,200)\nline(0,0,250,500)\n}", "function setupDrawing8() {\n\n let loopLength = 6\n\n let svgs = [humanSVG, owlSVG, headSVG, dinoSVG, lotusSVG, heartHandsSVG, musclesSVG]\n\n // Use my included SVG library to load these commands and scale the SVG\n // This library lets me load the SVG, but also scale it to fit a certain size\n // Since SVGs can be any size, this keeps any possible SVG I load to a uniform size\n // ...so that I don't have to change the rest of the drawing code\n let svgImage = new SVGImage(svgs[4])\n svgImage.scaleToFit(WIDTH * .7, HEIGHT * .7, true)\n\n\n function setup(p) {\n p.createCanvas(WIDTH, HEIGHT);\n p.colorMode(p.HSL);\n p.background(0);\n }\n\n function draw(p) {\n\n let loopPct = (p.millis() * .001 / loopLength) % 1\n\n p.background(0, 0, 0, .05)\n\n p.push()\n p.translate(p.width / 2, p.height / 2);\n\n\n // Draw a bunch of circles, using various looping tricks\n\n for (var i = 0; i < 120; i++) {\n let hue = (loopPct * 360 + i * 10) % 360\n let pastel = Math.sin(loopPct * Math.PI * 2 + i * 2)\n\n p.stroke(hue, 100, 80, .8)\n p.fill(hue, 100, 50 + 50 * pastel, .7 - i * .003)\n let x = (p.noise(i) - .5) * p.width * 1.2\n let y = (p.noise(i + 100) - .5) * p.height * 1.2\n p.circle(x, y, 40 + 20 * Math.sin(loopPct * Math.PI * 2 + i))\n }\n\n p.stroke(0, 100, 100)\n p.fill(0)\n p.beginShape()\n let count = 10;\n for (var i = 0; i < count; i++) {\n let theta = Math.PI * 2 * i / count\n let r = p.width * 2\n p.vertex(r * Math.cos(theta), r * Math.sin(theta))\n }\n\n svgImage.draw(p, true)\n p.endShape()\n\n // Repeatedly draw the SVG shape, but fade it out\n let outlineCount = 10\n for (var i = 0; i < outlineCount; i++) {\n // Make a second percentage that decides how far out it is\n // This is a handy trick for\n // \"things that get continually larger, but forever\"\n\n let pct2 = (loopPct + i / outlineCount) % 1\n p.push()\n p.scale(1 + pct2 * 3, 1 + pct2)\n p.noFill()\n p.stroke(0, 100, 100, (1 - pct2) * .3)\n svgImage.draw(p)\n p.pop()\n }\n\n p.pop()\n\n }\n\n\n let element = getP5Element(8) // <- Make sure to change this to the right index\n let myP5 = new p5(function(p) {\n p.setup = () => setup(p)\n p.draw = () => draw(p)\n }, element);\n}", "function draw() {\n drawbackground();\n drawHoles();\n }", "render() {\n this.ctx.clearRect(0, 0, this.pad.width, this.pad.height);\n this.paths.forEach((path) => path.render());\n }", "display() {\n\n push();\n fill(225, 225, 100, 50);\n noStroke();\n ellipse(this.x, this.y, this.size);\n pop();\n\n }", "function paper() {\n if (counter < 2) {\n for (let i = 0; i < width; i += 2) {\n for (let j = 0; j < width; j += 2) {\n fill(random(175, 225), 25);\n rect(i, j, 2, 2);\n }\n }\n counter += 1;\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}", "function draw() {\r\n background(255,255,255);\r\n \r\n Engine.update(engine);\r\n\r\n back.display();\r\n\r\n constr.display();\r\n\r\n for(var j = 0; j < boxy.length; j++) {\r\n boxy[j].display();\r\n }\r\n\r\n rectMode(CENTER);\r\n rect(air_ground.position.x,air_ground.position.y,200,20);\r\n\r\n fill(\"red\");\r\n strokeWeight(3);\r\n stroke(\"Yellow\");\r\n ellipseMode(CENTER);\r\n ellipse(particle.position.x,particle.position.y,50);\r\n}", "function fdrawShapes(){\r\n\tvar longitud = this.shapes.length;\r\n\tvar CiX = this.PiX+15;\r\n\tvar CiY = this.PiY;\r\n\tvar lX = this.mainWidth-this.PiX-30;\r\n\tvar lY = this.b*this.j;\r\n\tvar tX = CiX;\r\n\tvar tY = CiY;\r\n\tvar p = this.getMaxValue();\r\n\tif(this.drawTemp){\r\n\tthis.ax = CiX;\r\n\tthis.ay = CiY+lY;\r\n\tfor (var i = 0; i < longitud; i++) {\r\n\t\tvar t = this.shapes[i].temp;\r\n\t\tvar xx = tX;\r\n\t\tvar yy = (CiY+lY)-((lY/p)*t);\r\n\t\tvar pp = true;\r\n\t\tif(i == 0)\r\n\t\t{\r\n\t\t\tpp = false;\r\n\t\t}\r\n\t\tthis.newPoint(xx,yy);\r\n\t\ttX = tX + (lX/(longitud-1));\r\n\t\tax = xx;\r\n\t\tay = yy;\r\n\t}\r\n\t}\r\n\tif(this.drawHum){\r\n\tthis.axh = CiX;\r\n\tthis.ayh = CiY+lY;\r\n\tvar tX = CiX;\r\n\tvar tY = CiY;\r\n\tfor (var i = 0; i < longitud; i++) {\r\n\t\tvar t = this.shapes[i].hum;\r\n\t\tvar xx = tX;\r\n\t\tvar yy = (CiY+lY)-((lY/p)*t);\r\n\t\tvar pp = true;\r\n\t\tif(i == 0)\r\n\t\t{\r\n\t\t\tpp = false;\r\n\t\t}\r\n\t\tthis.newPointH(xx,yy);\r\n\t\ttX = tX + (lX/(longitud-1));\r\n\t\taxh = xx;\r\n\t\tayh = yy;\r\n\t}\r\n\t}\r\n\tthis.drawLine(true,true);\r\n\tthis.drawPoint(this.drawTemp,this.drawHum);\r\n}", "run() {\n try {\n this.createCanvas()\n this.createShaders()\n this.createProgram()\n this.createVertexArray()\n // Initial drawing on the canvas\n {\n // Random points\n for (let i = 0, max = 100000; i < max; i++) {\n this.data.positions.push(Math.random() * 2 - 1, Math.random() * 2 - 1)\n this.data.colors.push(Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255), 0)\n }\n // White point in the middle.\n this.data.positions.push(0, 0)\n this.data.colors.push(...this.colors.white)\n }\n this.drawScene()\n\n } catch (error) {\n console.error(error)\n }\n }", "function draw() {\n background(220, 30);\n \n // most commands are exactly the same\n // (like setting color for stroke and fill)\n fill(0);\n noStroke();\n \n // others just need to be changed to match\n // the Javascript variable syntax\n for (var i=0; i<100; i++) {\n var x = random(0, width);\n var y = random(0, height);\n ellipse(x,y, 10,10);\n } \n}", "display() {\n push();\n fill(255, 0, 0);\n ellipse(this.x, this.y, this.size);\n pop();\n }" ]
[ "0.77065647", "0.7554695", "0.7400974", "0.7222684", "0.7175581", "0.71698993", "0.71154195", "0.71147346", "0.71019745", "0.70888376", "0.70879453", "0.7056376", "0.700674", "0.7000129", "0.69764084", "0.69714475", "0.6967267", "0.6953379", "0.6935261", "0.6917497", "0.69103867", "0.68831074", "0.6881042", "0.6873537", "0.6852181", "0.68383163", "0.68294305", "0.68167233", "0.67680025", "0.67607546", "0.6718454", "0.67137516", "0.6713636", "0.670403", "0.6698286", "0.66956353", "0.667842", "0.6666289", "0.664399", "0.66401654", "0.66337776", "0.6625071", "0.6622751", "0.6620302", "0.661078", "0.66107446", "0.6597762", "0.65834814", "0.6571601", "0.65715736", "0.6568748", "0.65632296", "0.65601623", "0.6558542", "0.65500885", "0.65409374", "0.6535662", "0.65279174", "0.65265495", "0.652537", "0.6523264", "0.6519658", "0.65168345", "0.6516651", "0.6513569", "0.65128267", "0.6497869", "0.64966553", "0.64871913", "0.64838296", "0.6482061", "0.64799696", "0.6478307", "0.6476894", "0.6469426", "0.6461563", "0.645903", "0.6456871", "0.64509684", "0.6447919", "0.6444767", "0.6444505", "0.64423734", "0.64395475", "0.64387965", "0.64382464", "0.64320207", "0.64310795", "0.6428426", "0.642492", "0.6423585", "0.6420025", "0.6418563", "0.64166546", "0.64041054", "0.6403848", "0.6403714", "0.63714546", "0.63709694", "0.6366708", "0.6366234" ]
0.0
-1